![]() |
qspips
Vitis Drivers API Documentation
|
Data Structures | |
| struct | XQspiPs_Config |
| Holds the configuration information for the device. More... | |
| struct | XQspiPs |
| Holds the XQspiPs driver instance data. More... | |
Macros | |
| #define | XQspiPs_IsManualStart(InstancePtr) |
| Checks in OptionsTable if Manual Start Option is enabled or disabled. More... | |
| #define | XQspiPs_IsManualChipSelect(InstancePtr) |
| Checks in OptionsTable if Manual Chip Select Option is enabled or disabled. More... | |
| #define | XQspiPs_SetSlaveIdle(InstancePtr, RegisterValue) |
| Sets the contents of the slave idle count register. More... | |
| #define | XQspiPs_GetSlaveIdle(InstancePtr) |
| Gets the contents of the slave idle count register. More... | |
| #define | XQspiPs_SetTXWatermark(InstancePtr, RegisterValue) |
| Sets the contents of the transmit FIFO watermark register. More... | |
| #define | XQspiPs_GetTXWatermark(InstancePtr) XQspiPs_In32(((InstancePtr)->Config.BaseAddress) + XQSPIPS_TXWR_OFFSET) |
| Gets the contents of the transmit FIFO watermark register. More... | |
| #define | XQspiPs_SetRXWatermark(InstancePtr, RegisterValue) |
| Sets the contents of the receive FIFO watermark register. More... | |
| #define | XQspiPs_GetRXWatermark(InstancePtr) XQspiPs_In32(((InstancePtr)->Config.BaseAddress) + XQSPIPS_RXWR_OFFSET) |
| Gets the contents of the receive FIFO watermark register. More... | |
| #define | XQspiPs_Enable(InstancePtr) |
| Enables the device and uninhibits master transactions. More... | |
| #define | XQspiPs_Disable(InstancePtr) XQspiPs_Out32(((InstancePtr)->Config.BaseAddress) + XQSPIPS_ER_OFFSET, 0) |
| Disables the device. More... | |
| #define | XQspiPs_SetLqspiConfigReg(InstancePtr, RegisterValue) |
| Sets the contents of the Linear QSPI Configuration register. More... | |
| #define | XQspiPs_GetLqspiConfigReg(InstancePtr) |
| Gets the contents of the Linear QSPI Configuration register. More... | |
Typedefs | |
| typedef void(* | XQspiPs_StatusHandler )(void *CallBackRef, u32 StatusEvent, unsigned ByteCount) |
| Describes the status callback handler type for the QSPI device. More... | |
Functions | |
| XQspiPs_Config * | XQspiPs_LookupConfig (UINTPTR BaseAddress) |
| Looks up the device configuration based on the unique device ID/BaseAddress. More... | |
| int | XQspiPs_CfgInitialize (XQspiPs *InstancePtr, XQspiPs_Config *Config, u32 EffectiveAddr) |
| Initializes a specific XQspiPs instance such that the driver is ready to use. More... | |
| void | XQspiPs_Reset (XQspiPs *InstancePtr) |
| Resets the QSPI device. More... | |
| void | XQspiPs_Abort (XQspiPs *InstancePtr) |
| Aborts a transfer in progress by disabling the device and flushing the RxFIFO. More... | |
| s32 | XQspiPs_Transfer (XQspiPs *InstancePtr, u8 *SendBufPtr, u8 *RecvBufPtr, u32 ByteCount) |
| Transfers specified data on the QSPI bus. More... | |
| s32 | XQspiPs_PolledTransfer (XQspiPs *InstancePtr, u8 *SendBufPtr, u8 *RecvBufPtr, u32 ByteCount) |
| Transfers specified data on the QSPI bus in polled mode. More... | |
| int | XQspiPs_LqspiRead (XQspiPs *InstancePtr, u8 *RecvBufPtr, u32 Address, unsigned ByteCount) |
| Reads the flash in Linear QSPI mode. More... | |
| int | XQspiPs_SetSlaveSelect (XQspiPs *InstancePtr) |
| Selects the slave with which the master communicates. More... | |
| void | XQspiPs_SetStatusHandler (XQspiPs *InstancePtr, void *CallBackRef, XQspiPs_StatusHandler FuncPtr) |
| Sets the status callback function, the status handler, which the driver calls when it encounters conditions that should be reported to upper layer software. More... | |
| void | XQspiPs_InterruptHandler (void *InstancePtr) |
| Handles QSPI interrupts. More... | |
| int | XQspiPs_SelfTest (XQspiPs *InstancePtr) |
| Runs a self-test on the driver/device. More... | |
| s32 | XQspiPs_SetOptions (XQspiPs *InstancePtr, u32 Options) |
| Sets the options for the QSPI device driver. More... | |
| u32 | XQspiPs_GetOptions (XQspiPs *InstancePtr) |
| Gets the options for the QSPI device. More... | |
| s32 | XQspiPs_SetClkPrescaler (XQspiPs *InstancePtr, u8 Prescaler) |
| Sets the clock prescaler for an QSPI device. More... | |
| u8 | XQspiPs_GetClkPrescaler (XQspiPs *InstancePtr) |
| Gets the clock prescaler of an QSPI device. More... | |
| int | XQspiPs_SetDelays (XQspiPs *InstancePtr, u8 DelayNss, u8 DelayBtwn, u8 DelayAfter, u8 DelayInit) |
| Sets the delay register for the QSPI device driver. More... | |
| void | XQspiPs_GetDelays (XQspiPs *InstancePtr, u8 *DelayNss, u8 *DelayBtwn, u8 *DelayAfter, u8 *DelayInit) |
| Gets the delay settings for an QSPI device. More... | |
Configuration options | |
The following options are supported to enable/disable certain features of an QSPI device. Each of the options is a bit mask, so more than one may be specified. The Active Low Clock option configures the device's clock polarity. Setting this option means the clock is active low and the SCK signal idles high. By default, the clock is active high and SCK idles low. The Clock Phase option configures the QSPI device for one of two transfer formats. A clock phase of 0, the default, means data is valid on the first SCK edge (rising or falling) after the slave select (SS) signal has been asserted. A clock phase of 1 means data is valid on the second SCK edge (rising or falling) after SS has been asserted. The QSPI Force Slave Select option enables manual control of the slave select signal. 0: The SPI_SS signal is controlled by the QSPI controller during transfers. (Default) 1: The SPI_SS signal is forced active (driven low) regardless of any transfers in progress. NOTE: The driver handles setting and clearing the Slave Select when the user sets the "FORCE_SSELECT_OPTION". Using this option allows the QSPI clock to be set to a faster speed. If the QSPI clock is too fast, the processor cannot empty and refill the FIFOs before the TX FIFO is empty When the QSPI hardware is controlling the Slave Select signals, this causes the slave to be de-selected and terminates the transfer. The Manual Start option enables manual control of the Start command to perform data transfer. 0: The Start command is controlled by the QSPI controller during transfers(Default). Data transmission starts as soon as there is data in the TXFIFO and stalls when the TXFIFO is empty 1: The Start command must be issued by software to perform data transfer. Bit 15 of Configuration register issues the Start command. This bit must be set whenever TXFIFO is filled with new data. NOTE: The driver sets the Manual Start Enable bit in Configuration Register, if Manual Start option is selected. Software issues Manual Start command whenever TXFIFO is filled with data. When there is no further data, driver clears the Manual Start Enable bit. | |
| #define | XQSPIPS_CLK_ACTIVE_LOW_OPTION 0x2 |
| Active Low Clock option. More... | |
| #define | XQSPIPS_CLK_PHASE_1_OPTION 0x4 |
| Clock Phase one option. More... | |
| #define | XQSPIPS_FORCE_SSELECT_OPTION 0x10 |
| Force Slave Select. More... | |
| #define | XQSPIPS_MANUAL_START_OPTION 0x20 |
| Manual Start enable. More... | |
| #define | XQSPIPS_LQSPI_MODE_OPTION 0x80 |
| Linear QPSI mode. More... | |
| #define | XQSPIPS_HOLD_B_DRIVE_OPTION 0x100 |
| Drive HOLD_B Pin. More... | |
QSPI Clock Prescaler options | |
The QSPI Clock Prescaler Configuration bits are used to program master mode bit rate. The bit rate can be programmed in divide-by-two decrements from pclk/2 to pclk/256. | |
| #define | XQSPIPS_CLK_PRESCALE_2 0x00 |
| PCLK/2 Prescaler. More... | |
| #define | XQSPIPS_CLK_PRESCALE_4 0x01 |
| PCLK/4 Prescaler. More... | |
| #define | XQSPIPS_CLK_PRESCALE_8 0x02 |
| PCLK/8 Prescaler. More... | |
| #define | XQSPIPS_CLK_PRESCALE_16 0x03 |
| PCLK/16 Prescaler. More... | |
| #define | XQSPIPS_CLK_PRESCALE_32 0x04 |
| PCLK/32 Prescaler. More... | |
| #define | XQSPIPS_CLK_PRESCALE_64 0x05 |
| PCLK/64 Prescaler. More... | |
| #define | XQSPIPS_CLK_PRESCALE_128 0x06 |
| PCLK/128 Prescaler. More... | |
| #define | XQSPIPS_CLK_PRESCALE_256 0x07 |
| PCLK/256 Prescaler. More... | |
Callback events | |
These constants specify the handler events that are passed to a handler from the driver. These constants are not bit masks such that only one is passed at a time to the handler. | |
| #define | XQSPIPS_EVENT_TRANSFER_DONE 2 |
| Transfer done. More... | |
| #define | XQSPIPS_EVENT_TRANSMIT_UNDERRUN 3 |
| TX FIFO empty. More... | |
| #define | XQSPIPS_EVENT_RECEIVE_OVERRUN 4 |
| Receive data loss because RX FIFO full. More... | |
Flash commands | |
The following constants define most of the commands supported by flash devices. Users can add more commands supported by the flash devices | |
| #define | XQSPIPS_FLASH_OPCODE_WRSR 0x01 |
| Write status register. More... | |
| #define | XQSPIPS_FLASH_OPCODE_PP 0x02 |
| Page program. More... | |
| #define | XQSPIPS_FLASH_OPCODE_NORM_READ 0x03 |
| Normal read data bytes. More... | |
| #define | XQSPIPS_FLASH_OPCODE_WRDS 0x04 |
| Write disable. More... | |
| #define | XQSPIPS_FLASH_OPCODE_RDSR1 0x05 |
| Read status register 1. More... | |
| #define | XQSPIPS_FLASH_OPCODE_WREN 0x06 |
| Write enable. More... | |
| #define | XQSPIPS_FLASH_OPCODE_FAST_READ 0x0B |
| Fast read data bytes. More... | |
| #define | XQSPIPS_FLASH_OPCODE_BE_4K 0x20 |
| Erase 4KiB block. More... | |
| #define | XQSPIPS_FLASH_OPCODE_RDSR2 0x35 |
| Read status register 2. More... | |
| #define | XQSPIPS_FLASH_OPCODE_DUAL_READ 0x3B |
| Dual read data bytes. More... | |
| #define | XQSPIPS_FLASH_OPCODE_BE_32K 0x52 |
| Erase 32KiB block. More... | |
| #define | XQSPIPS_FLASH_OPCODE_QUAD_READ 0x6B |
| Quad read data bytes. More... | |
| #define | XQSPIPS_FLASH_OPCODE_ERASE_SUS 0x75 |
| Erase suspend. More... | |
| #define | XQSPIPS_FLASH_OPCODE_ERASE_RES 0x7A |
| Erase resume. More... | |
| #define | XQSPIPS_FLASH_OPCODE_RDID 0x9F |
| Read JEDEC ID. More... | |
| #define | XQSPIPS_FLASH_OPCODE_BE 0xC7 |
| Erase whole flash block. More... | |
| #define | XQSPIPS_FLASH_OPCODE_SE 0xD8 |
| Sector erase (usually 64KB). More... | |
| #define | XQSPIPS_FLASH_OPCODE_DUAL_IO_READ 0xBB |
| Read data using Dual I/O. More... | |
| #define | XQSPIPS_FLASH_OPCODE_QUAD_IO_READ 0xEB |
| Read data using Quad I/O. More... | |
| #define | XQSPIPS_FLASH_OPCODE_BRWR 0x17 |
| Bank Register Write. More... | |
| #define | XQSPIPS_FLASH_OPCODE_BRRD 0x16 |
| Bank Register Read. More... | |
| #define | XQSPIPS_FLASH_OPCODE_EARWR 0xC5 |
| Extended Address Register Write - Micron's equivalent of Bank Register. More... | |
| #define | XQSPIPS_FLASH_OPCODE_EARRD 0xC8 |
| Extended Address Register Read - Micron's equivalent of Bank Register. More... | |
| #define | XQSPIPS_FLASH_OPCODE_DIE_ERASE 0xC4 |
| Die erase. More... | |
| #define | XQSPIPS_FLASH_OPCODE_READ_FLAG_SR 0x70 |
| Read flag status register. More... | |
| #define | XQSPIPS_FLASH_OPCODE_CLEAR_FLAG_SR 0x50 |
| Clear flag status register. More... | |
| #define | XQSPIPS_FLASH_OPCODE_READ_LOCK_REG 0xE8 |
| Lock Reg Read. More... | |
| #define | XQSPIPS_FLASH_OPCODE_WRITE_LOCK_REG 0xE5 |
| Lock Reg Write. More... | |
Instruction size | |
The following constants define numbers 1 to 4. Used to identify whether TXD0,1,2 or 3 is to be used. | |
| #define | XQSPIPS_SIZE_ONE 1 |
| Instruction size of one byte. More... | |
| #define | XQSPIPS_SIZE_TWO 2 |
| Instruction size of two bytes. More... | |
| #define | XQSPIPS_SIZE_THREE 3 |
| Instruction size of three bytes. More... | |
| #define | XQSPIPS_SIZE_FOUR 4 |
| Instruction size of four bytes. More... | |
ConnectionMode | |
The following constants are the possible values of ConnectionMode in Config structure. | |
| #define | XQSPIPS_CONNECTION_MODE_SINGLE 0 |
| Single mode. More... | |
| #define | XQSPIPS_CONNECTION_MODE_STACKED 1 |
| Stacked mode. More... | |
| #define | XQSPIPS_CONNECTION_MODE_PARALLEL 2 |
| Parallel mode. More... | |
FIFO threshold value | |
This is the Rx FIFO threshold (in words) that was found to be most optimal in terms of performance | |
| #define | XQSPIPS_RXFIFO_THRESHOLD_OPT 32 |
| Optimal Rx FIFO threshold in words. More... | |
| #define XQSPIPS_CLK_ACTIVE_LOW_OPTION 0x2 |
Active Low Clock option.
| #define XQSPIPS_CLK_PHASE_1_OPTION 0x4 |
Clock Phase one option.
| #define XQSPIPS_CLK_PRESCALE_128 0x06 |
PCLK/128 Prescaler.
| #define XQSPIPS_CLK_PRESCALE_16 0x03 |
PCLK/16 Prescaler.
| #define XQSPIPS_CLK_PRESCALE_2 0x00 |
PCLK/2 Prescaler.
| #define XQSPIPS_CLK_PRESCALE_256 0x07 |
PCLK/256 Prescaler.
| #define XQSPIPS_CLK_PRESCALE_32 0x04 |
PCLK/32 Prescaler.
| #define XQSPIPS_CLK_PRESCALE_4 0x01 |
PCLK/4 Prescaler.
| #define XQSPIPS_CLK_PRESCALE_64 0x05 |
PCLK/64 Prescaler.
| #define XQSPIPS_CLK_PRESCALE_8 0x02 |
PCLK/8 Prescaler.
Referenced by QspiFlashIntrExample().
| #define XQSPIPS_CONNECTION_MODE_PARALLEL 2 |
Parallel mode.
Referenced by GetRealAddr(), and XQspiPs_LinearInit().
| #define XQSPIPS_CONNECTION_MODE_SINGLE 0 |
Single mode.
Referenced by GetRealAddr(), and XQspiPs_LinearInit().
| #define XQSPIPS_CONNECTION_MODE_STACKED 1 |
Stacked mode.
Referenced by GetRealAddr(), and XQspiPs_LinearInit().
| #define XQspiPs_Disable | ( | InstancePtr | ) | XQspiPs_Out32(((InstancePtr)->Config.BaseAddress) + XQSPIPS_ER_OFFSET, 0) |
Disables the device.
| [in] | InstancePtr | Pointer to the XQspiPs instance. |
Referenced by XQspiPs_Abort(), XQspiPs_InterruptHandler(), XQspiPs_LqspiRead(), and XQspiPs_PolledTransfer().
| #define XQspiPs_Enable | ( | InstancePtr | ) |
Enables the device and uninhibits master transactions.
| [in] | InstancePtr | Pointer to the XQspiPs instance. |
Referenced by XQspiPs_LqspiRead(), XQspiPs_PolledTransfer(), and XQspiPs_Transfer().
| #define XQSPIPS_EVENT_RECEIVE_OVERRUN 4 |
Receive data loss because RX FIFO full.
| #define XQSPIPS_EVENT_TRANSFER_DONE 2 |
Transfer done.
| #define XQSPIPS_EVENT_TRANSMIT_UNDERRUN 3 |
TX FIFO empty.
| #define XQSPIPS_FLASH_OPCODE_BE 0xC7 |
Erase whole flash block.
| #define XQSPIPS_FLASH_OPCODE_BE_32K 0x52 |
Erase 32KiB block.
| #define XQSPIPS_FLASH_OPCODE_BE_4K 0x20 |
Erase 4KiB block.
| #define XQSPIPS_FLASH_OPCODE_BRRD 0x16 |
Bank Register Read.
| #define XQSPIPS_FLASH_OPCODE_BRWR 0x17 |
Bank Register Write.
| #define XQSPIPS_FLASH_OPCODE_CLEAR_FLAG_SR 0x50 |
Clear flag status register.
| #define XQSPIPS_FLASH_OPCODE_DIE_ERASE 0xC4 |
Die erase.
| #define XQSPIPS_FLASH_OPCODE_DUAL_IO_READ 0xBB |
Read data using Dual I/O.
| #define XQSPIPS_FLASH_OPCODE_DUAL_READ 0x3B |
Dual read data bytes.
| #define XQSPIPS_FLASH_OPCODE_EARRD 0xC8 |
Extended Address Register Read - Micron's equivalent of Bank Register.
| #define XQSPIPS_FLASH_OPCODE_EARWR 0xC5 |
Extended Address Register Write - Micron's equivalent of Bank Register.
| #define XQSPIPS_FLASH_OPCODE_ERASE_RES 0x7A |
Erase resume.
| #define XQSPIPS_FLASH_OPCODE_ERASE_SUS 0x75 |
Erase suspend.
| #define XQSPIPS_FLASH_OPCODE_FAST_READ 0x0B |
Fast read data bytes.
| #define XQSPIPS_FLASH_OPCODE_NORM_READ 0x03 |
Normal read data bytes.
| #define XQSPIPS_FLASH_OPCODE_PP 0x02 |
Page program.
| #define XQSPIPS_FLASH_OPCODE_QUAD_IO_READ 0xEB |
Read data using Quad I/O.
| #define XQSPIPS_FLASH_OPCODE_QUAD_READ 0x6B |
Quad read data bytes.
| #define XQSPIPS_FLASH_OPCODE_RDID 0x9F |
Read JEDEC ID.
| #define XQSPIPS_FLASH_OPCODE_RDSR1 0x05 |
Read status register 1.
| #define XQSPIPS_FLASH_OPCODE_RDSR2 0x35 |
Read status register 2.
| #define XQSPIPS_FLASH_OPCODE_READ_FLAG_SR 0x70 |
Read flag status register.
| #define XQSPIPS_FLASH_OPCODE_READ_LOCK_REG 0xE8 |
Lock Reg Read.
| #define XQSPIPS_FLASH_OPCODE_SE 0xD8 |
Sector erase (usually 64KB).
| #define XQSPIPS_FLASH_OPCODE_WRDS 0x04 |
Write disable.
| #define XQSPIPS_FLASH_OPCODE_WREN 0x06 |
Write enable.
| #define XQSPIPS_FLASH_OPCODE_WRITE_LOCK_REG 0xE5 |
Lock Reg Write.
| #define XQSPIPS_FLASH_OPCODE_WRSR 0x01 |
Write status register.
Referenced by XQspiPs_PolledTransfer(), and XQspiPs_Transfer().
| #define XQSPIPS_FORCE_SSELECT_OPTION 0x10 |
Force Slave Select.
Referenced by QspiFlashIntrExample().
| #define XQspiPs_GetLqspiConfigReg | ( | InstancePtr | ) |
Gets the contents of the Linear QSPI Configuration register.
| [in] | InstancePtr | Pointer to the XQspiPs instance. |
Referenced by GetRealAddr(), and XQspiPs_LqspiRead().
| #define XQspiPs_GetRXWatermark | ( | InstancePtr | ) | XQspiPs_In32(((InstancePtr)->Config.BaseAddress) + XQSPIPS_RXWR_OFFSET) |
Gets the contents of the receive FIFO watermark register.
Valid values are in the range 1-63.
| [in] | InstancePtr | Pointer to the XQspiPs instance. |
| #define XQspiPs_GetSlaveIdle | ( | InstancePtr | ) |
Gets the contents of the slave idle count register.
Use the XQSPIPS_SICR_* constants defined in xqspips_hw.h to interpret the bit-mask returned.
| [in] | InstancePtr | Pointer to the XQspiPs instance. |
| #define XQspiPs_GetTXWatermark | ( | InstancePtr | ) | XQspiPs_In32(((InstancePtr)->Config.BaseAddress) + XQSPIPS_TXWR_OFFSET) |
Gets the contents of the transmit FIFO watermark register.
Valid values are in the range 1-63.
| [in] | InstancePtr | Pointer to the XQspiPs instance. |
| #define XQSPIPS_HOLD_B_DRIVE_OPTION 0x100 |
Drive HOLD_B Pin.
Referenced by QspiFlashIntrExample().
| #define XQspiPs_IsManualChipSelect | ( | InstancePtr | ) |
Checks in OptionsTable if Manual Chip Select Option is enabled or disabled.
| [in] | InstancePtr | Pointer to the XQspiPs instance. |
Referenced by XQspiPs_InterruptHandler(), XQspiPs_PolledTransfer(), and XQspiPs_Transfer().
| #define XQspiPs_IsManualStart | ( | InstancePtr | ) |
Checks in OptionsTable if Manual Start Option is enabled or disabled.
| [in] | InstancePtr | Pointer to the XQspiPs instance. |
Referenced by XQspiPs_InterruptHandler(), XQspiPs_PolledTransfer(), and XQspiPs_Transfer().
| #define XQSPIPS_LQSPI_MODE_OPTION 0x80 |
Linear QPSI mode.
Referenced by XQspiPs_GetOptions(), and XQspiPs_SetOptions().
| #define XQSPIPS_MANUAL_START_OPTION 0x20 |
Manual Start enable.
Referenced by QspiFlashIntrExample().
| #define XQSPIPS_RXFIFO_THRESHOLD_OPT 32 |
Optimal Rx FIFO threshold in words.
Referenced by XQspiPs_InterruptHandler(), XQspiPs_PolledTransfer(), and XQspiPs_Transfer().
| #define XQspiPs_SetLqspiConfigReg | ( | InstancePtr, | |
| RegisterValue | |||
| ) |
Sets the contents of the Linear QSPI Configuration register.
| [in] | InstancePtr | Pointer to the XQspiPs instance. |
| [in] | RegisterValue | The value to be written to the Linear QSPI configuration register. |
Referenced by GetRealAddr().
| #define XQspiPs_SetRXWatermark | ( | InstancePtr, | |
| RegisterValue | |||
| ) |
Sets the contents of the receive FIFO watermark register.
| [in] | InstancePtr | Pointer to the XQspiPs instance. |
| [in] | RegisterValue | The value to be written, valid values are 1-63. |
| #define XQspiPs_SetSlaveIdle | ( | InstancePtr, | |
| RegisterValue | |||
| ) |
Sets the contents of the slave idle count register.
| [in] | InstancePtr | Pointer to the XQspiPs instance. |
| [in] | RegisterValue | The value to be written, valid values are 0-255. |
| #define XQspiPs_SetTXWatermark | ( | InstancePtr, | |
| RegisterValue | |||
| ) |
Sets the contents of the transmit FIFO watermark register.
| [in] | InstancePtr | Pointer to the XQspiPs instance. |
| [in] | RegisterValue | The value to be written, valid values are 1-63. |
| #define XQSPIPS_SIZE_FOUR 4 |
Instruction size of four bytes.
Referenced by XQspiPs_PolledTransfer(), and XQspiPs_Transfer().
| #define XQSPIPS_SIZE_ONE 1 |
Instruction size of one byte.
Referenced by XQspiPs_PolledTransfer(), and XQspiPs_Transfer().
| #define XQSPIPS_SIZE_THREE 3 |
Instruction size of three bytes.
Referenced by XQspiPs_PolledTransfer(), and XQspiPs_Transfer().
| #define XQSPIPS_SIZE_TWO 2 |
Instruction size of two bytes.
Referenced by XQspiPs_PolledTransfer(), and XQspiPs_Transfer().
| typedef void(* XQspiPs_StatusHandler)(void *CallBackRef, u32 StatusEvent, unsigned ByteCount) |
Describes the status callback handler type for the QSPI device.
The handler data type allows the user to define a callback function to handle the asynchronous processing for the QSPI device. The application using this driver is expected to define a handler of this type to support interrupt driven mode. The handler executes in an interrupt context, so only minimal processing should be performed.
| [in] | CallBackRef | The callback reference passed in by the upper layer when setting the callback functions, and passed back to the upper layer when the callback is invoked. Its type is not important to the driver, so it is a void pointer. |
| [in] | StatusEvent | Holds one or more status events that have occurred. See the XQspiPs_SetStatusHandler() for details on the status events that can be passed in the callback. |
| [in] | ByteCount | Indicates how many bytes of data were successfully transferred. This may be less than the number of bytes requested if the status event indicates an error. |
| void XQspiPs_Abort | ( | XQspiPs * | InstancePtr | ) |
Aborts a transfer in progress by disabling the device and flushing the RxFIFO.
The byte counts are cleared, the busy flag is cleared.
| [in,out] | InstancePtr | Pointer to the XQspiPs instance. |
References XQspiPs_Config::BaseAddress, XQspiPs::Config, XQspiPs::IsBusy, LQSPI_RST_CTRL, LQSPI_RST_CTRL_MASK, XQspiPs::RemainingBytes, XQspiPs::RequestedBytes, SLCR_LOCK, SLCR_LOCK_MASK, SLCR_LOCKSTA, SLCR_UNLOCK, SLCR_UNLOCK_MASK, XPAR_XSLCR_0_BASEADDR, XQSPIPS_CR_OFFSET, XQSPIPS_CR_SSCTRL_MASK, XQSPIPS_CR_SSFORCE_MASK, XQspiPs_Disable, XQspiPs_ReadReg, XQSPIPS_RXWR_OFFSET, XQSPIPS_RXWR_RESET_VALUE, XQSPIPS_TXWR_OFFSET, XQSPIPS_TXWR_RESET_VALUE, and XQspiPs_WriteReg.
Referenced by XQspiPs_Reset().
| int XQspiPs_CfgInitialize | ( | XQspiPs * | InstancePtr, |
| XQspiPs_Config * | ConfigPtr, | ||
| u32 | EffectiveAddr | ||
| ) |
Initializes a specific XQspiPs instance such that the driver is ready to use.
The state of the device after initialization is:
| [in,out] | InstancePtr | Pointer to the XQspiPs instance. |
| [in] | ConfigPtr | A reference to a structure containing information about a specific QSPI device. The InstancePtr object is initialized for a specific device specified by the contents of Config. |
| [in] | EffectiveAddr | The device base address in the virtual memory address space. The caller is responsible for keeping the address mapping from EffectiveAddr to the device physical base address unchanged once this function is invoked. Unexpected errors may occur if the address mapping changes after this function is called. If address translation is not used, use ConfigPtr->Config.BaseAddress for this device. |
References XQspiPs_Config::BaseAddress, XQspiPs::Config, XQspiPs_Config::ConnectionMode, XQspiPs::IsBusy, XQspiPs::IsReady, XQspiPs::RecvBufferPtr, XQspiPs::RemainingBytes, XQspiPs::RequestedBytes, XQspiPs::SendBufferPtr, XQspiPs::StatusHandler, and XQspiPs_Reset().
Referenced by QspiFlashIntrExample(), and QspiPsSelfTestExample().
| u8 XQspiPs_GetClkPrescaler | ( | XQspiPs * | InstancePtr | ) |
Gets the clock prescaler of an QSPI device.
| [in] | InstancePtr | Pointer to the XQspiPs instance. |
References XQspiPs_Config::BaseAddress, XQspiPs::Config, XQspiPs::IsReady, XQSPIPS_CR_OFFSET, XQSPIPS_CR_PRESC_MASK, XQSPIPS_CR_PRESC_SHIFT, and XQspiPs_ReadReg.
| void XQspiPs_GetDelays | ( | XQspiPs * | InstancePtr, |
| u8 * | DelayNss, | ||
| u8 * | DelayBtwn, | ||
| u8 * | DelayAfter, | ||
| u8 * | DelayInit | ||
| ) |
Gets the delay settings for an QSPI device.
The delay register controls the Delay Between Transfers, Delay After Transfers, and the Delay Initially. The default value is 0x0.
| [in] | InstancePtr | Pointer to the XQspiPs instance. |
| [out] | DelayNss | Pointer to the Delay to de-assert slave select between two word transfers. |
| [out] | DelayBtwn | Pointer to the Delay Between transfers value. |
| [out] | DelayAfter | Pointer to the Delay After transfer value. |
| [out] | DelayInit | Pointer to the Delay Initially value. |
References XQspiPs_Config::BaseAddress, XQspiPs::Config, XQspiPs::IsReady, XQSPIPS_DR_AFTER_MASK, XQSPIPS_DR_AFTER_SHIFT, XQSPIPS_DR_BTWN_MASK, XQSPIPS_DR_BTWN_SHIFT, XQSPIPS_DR_INIT_MASK, XQSPIPS_DR_NSS_MASK, XQSPIPS_DR_NSS_SHIFT, XQSPIPS_DR_OFFSET, and XQspiPs_ReadReg.
Referenced by XQspiPs_SelfTest().
| u32 XQspiPs_GetOptions | ( | XQspiPs * | InstancePtr | ) |
Gets the options for the QSPI device.
The options control how the device behaves relative to the QSPI bus.
| [in] | InstancePtr | Pointer to the XQspiPs instance. |
References XQspiPs_Config::BaseAddress, XQspiPs::Config, XQspiPs::IsReady, XQSPIPS_CR_OFFSET, XQSPIPS_LQSPI_CR_LINEAR_MASK, XQSPIPS_LQSPI_CR_OFFSET, XQSPIPS_LQSPI_MODE_OPTION, XQSPIPS_NUM_OPTIONS, and XQspiPs_ReadReg.
| void XQspiPs_InterruptHandler | ( | void * | InstancePtr | ) |
Handles QSPI interrupts.
The interrupt handler must be connected by the user to an interrupt controller.
The interrupts that are handled are:
| [in] | InstancePtr | Pointer to the XQspiPs instance. |
References XQspiPs_Config::BaseAddress, XQspiPs::Config, XQspiPs::IsBusy, XQspiPs::IsReady, XQspiPs::RecvBufferPtr, XQspiPs::RemainingBytes, XQspiPs::RequestedBytes, XQspiPs::SendBufferPtr, XQspiPs::StatusHandler, XQspiPs::StatusRef, XQSPIPS_CR_MANSTRT_MASK, XQSPIPS_CR_OFFSET, XQSPIPS_CR_SSCTRL_MASK, XQspiPs_Disable, XQSPIPS_DUMMY_TX_DATA, XQSPIPS_IDR_OFFSET, XQSPIPS_IER_OFFSET, XQspiPs_IsManualChipSelect, XQspiPs_IsManualStart, XQSPIPS_IXR_RXNEMPTY_MASK, XQSPIPS_IXR_RXOVR_MASK, XQSPIPS_IXR_TXOW_MASK, XQSPIPS_IXR_TXUF_MASK, XQSPIPS_IXR_WR_TO_CLR_MASK, XQspiPs_ReadReg, XQSPIPS_RXD_OFFSET, XQSPIPS_RXFIFO_THRESHOLD_OPT, XQSPIPS_RXWR_OFFSET, XQSPIPS_RXWR_RESET_VALUE, XQSPIPS_SR_OFFSET, XQSPIPS_TXD_00_OFFSET, and XQspiPs_WriteReg.
Referenced by QspiFlashIntrExample().
| XQspiPs_Config* XQspiPs_LookupConfig | ( | UINTPTR | BaseAddress | ) |
Looks up the device configuration based on the unique device ID/BaseAddress.
The XQspiPs_ConfigTable[] contains the configuration info for each device in the system.
| [in] | BaseAddress | The base address of the device. |
References XQspiPs_Config::Name.
Referenced by QspiFlashIntrExample(), and QspiPsSelfTestExample().
| int XQspiPs_LqspiRead | ( | XQspiPs * | InstancePtr, |
| u8 * | RecvBufPtr, | ||
| u32 | Address, | ||
| unsigned | ByteCount | ||
| ) |
Reads the flash in Linear QSPI mode.
| [in] | InstancePtr | Pointer to the XQspiPs instance. |
| [out] | RecvBufPtr | Pointer to a buffer for received data. |
| [in] | Address | The starting address within the flash from from where data needs to be read. |
| [in] | ByteCount | The number of bytes to receive. |
References XQspiPs::IsReady, XPAR_PS7_QSPI_LINEAR_0_S_AXI_BASEADDR, XQspiPs_Disable, XQspiPs_Enable, XQspiPs_GetLqspiConfigReg, and XQSPIPS_LQSPI_CR_LINEAR_MASK.
| s32 XQspiPs_PolledTransfer | ( | XQspiPs * | InstancePtr, |
| u8 * | SendBufPtr, | ||
| u8 * | RecvBufPtr, | ||
| u32 | ByteCount | ||
| ) |
Transfers specified data on the QSPI bus in polled mode.
The caller has the option of providing two different buffers for send and receive, or one buffer for both send and receive, or no buffer for receive. The receive buffer must be at least as big as the send buffer to prevent unwanted memory writes. This implies that the byte count passed in as an argument must be the smaller of the two buffers if they differ in size. Here are some sample usages:
XQspiPs_PolledTransfer(InstancePtr, SendBuf, RecvBuf, ByteCount)
The caller wishes to send and receive, and provides two different
buffers for send and receive. XQspiPs_PolledTransfer(InstancePtr, SendBuf, NULL, ByteCount)
The caller wishes only to send and does not care about the received
data. The driver ignores the received data in this case. XQspiPs_PolledTransfer(InstancePtr, SendBuf, SendBuf, ByteCount)
The caller wishes to send and receive, but provides the same buffer
for doing both. The driver sends the data and overwrites the send
buffer with received data as it transfers the data. XQspiPs_PolledTransfer(InstancePtr, RecvBuf, RecvBuf, ByteCount)
The caller wishes to only receive and does not care about sending
data. In this case, the caller must still provide a send buffer, but
it can be the same as the receive buffer if the caller does not care
what it sends. The device must send N bytes of data if it wishes to
receive N bytes of data.| [in,out] | InstancePtr | Pointer to the XQspiPs instance. |
| [in] | SendBufPtr | Pointer to a data buffer that needs to be transmitted. This buffer must not be NULL. |
| [out] | RecvBufPtr | Pointer to a buffer for received data. This argument can be NULL if do not care about receiving. |
| [in] | ByteCount | The number of bytes to send/receive. The number of bytes received always equals the number of bytes sent. |
References ARRAY_SIZE, XQspiPs_Config::BaseAddress, XQspiPs::Config, XQspiPs::IsBusy, XQspiPs::IsReady, XQspiPs::RecvBufferPtr, XQspiPs::RemainingBytes, XQspiPs::RequestedBytes, XQspiPs::SendBufferPtr, XQspiPs::ShiftReadData, XQSPIPS_CR_MANSTRT_MASK, XQSPIPS_CR_OFFSET, XQSPIPS_CR_SSCTRL_MASK, XQspiPs_Disable, XQSPIPS_DUMMY_TX_DATA, XQspiPs_Enable, XQSPIPS_FIFO_DEPTH, XQSPIPS_FLASH_OPCODE_WRSR, XQspiPs_IsManualChipSelect, XQspiPs_IsManualStart, XQSPIPS_IXR_RXNEMPTY_MASK, XQSPIPS_IXR_TXOW_MASK, XQspiPs_ReadReg, XQSPIPS_RXD_OFFSET, XQSPIPS_RXFIFO_THRESHOLD_OPT, XQSPIPS_RXWR_OFFSET, XQSPIPS_RXWR_RESET_VALUE, XQSPIPS_SIZE_FOUR, XQSPIPS_SIZE_ONE, XQSPIPS_SIZE_THREE, XQSPIPS_SIZE_TWO, XQSPIPS_SR_OFFSET, XQSPIPS_TXD_00_OFFSET, XQSPIPS_TXD_01_OFFSET, XQSPIPS_TXD_10_OFFSET, XQSPIPS_TXD_11_OFFSET, and XQspiPs_WriteReg.
Referenced by FlashErase(), FlashQuadEnable(), FlashRead(), and SendBankSelect().
| void XQspiPs_Reset | ( | XQspiPs * | InstancePtr | ) |
Resets the QSPI device.
Reset must only be called after the driver has been initialized. Any data transfer that is in progress is aborted.
The upper layer software is responsible for re-configuring (if necessary) and restarting the QSPI device after the reset.
| [in,out] | InstancePtr | Pointer to the XQspiPs instance. |
References XQspiPs_Config::BaseAddress, XQspiPs::Config, XQspiPs::IsReady, XQspiPs_Abort(), XQSPIPS_CR_OFFSET, XQSPIPS_CR_RESET_MASK_CLR, XQSPIPS_CR_RESET_MASK_SET, XQspiPs_ReadReg, and XQspiPs_WriteReg.
Referenced by XQspiPs_CfgInitialize(), and XQspiPs_SelfTest().
| int XQspiPs_SelfTest | ( | XQspiPs * | InstancePtr | ) |
Runs a self-test on the driver/device.
The self-test is destructive in that a reset of the device is performed in order to check the reset values of the registers and to get the device into a known state.
Upon successful return from the self-test, the device is reset.
| [in,out] | InstancePtr | Pointer to the XQspiPs instance. |
References XQspiPs::IsReady, XQspiPs_GetDelays(), XQspiPs_Reset(), and XQspiPs_SetDelays().
Referenced by QspiFlashIntrExample(), and QspiPsSelfTestExample().
| s32 XQspiPs_SetClkPrescaler | ( | XQspiPs * | InstancePtr, |
| u8 | Prescaler | ||
| ) |
Sets the clock prescaler for an QSPI device.
The device must be idle rather than busy transferring data before setting these device options.
| [in] | InstancePtr | Pointer to the XQspiPs instance. |
| [in] | Prescaler | The value that determine how much the clock should be divided by. Use the XQSPIPS_CLK_PRESCALE_* constants defined in xqspips.h for this setting. |
References XQspiPs_Config::BaseAddress, XQspiPs::Config, XQspiPs::IsBusy, XQspiPs::IsReady, XQSPIPS_CR_OFFSET, XQSPIPS_CR_PRESC_MASK, XQSPIPS_CR_PRESC_MAXIMUM, XQSPIPS_CR_PRESC_SHIFT, XQspiPs_ReadReg, and XQspiPs_WriteReg.
Referenced by QspiFlashIntrExample().
| int XQspiPs_SetDelays | ( | XQspiPs * | InstancePtr, |
| u8 | DelayNss, | ||
| u8 | DelayBtwn, | ||
| u8 | DelayAfter, | ||
| u8 | DelayInit | ||
| ) |
Sets the delay register for the QSPI device driver.
The delay register controls the Delay Between Transfers, Delay After Transfers, and the Delay Initially. The default value is 0x0. The range of each delay value is 0-255.
| [in] | InstancePtr | Pointer to the XQspiPs instance. |
| [in] | DelayNss | The delay to de-assert slave select between two word transfers. |
| [in] | DelayBtwn | The delay between one Slave Select being de-activated and the activation of another slave. The delay is the number of master clock periods given by DelayBtwn + 2. |
| [in] | DelayAfter | Define the delay between the last bit of the current byte transfer and the first bit of the next byte transfer. The delay in number of master clock periods is given as: CHPA=0:DelayInit+DelayAfter+3 CHPA=1:DelayAfter+1 |
| [in] | DelayInit | The delay between asserting the slave select signal and the first bit transfer. The delay int number of master clock periods is DelayInit+1. |
References XQspiPs_Config::BaseAddress, XQspiPs::Config, XQspiPs::IsBusy, XQspiPs::IsReady, XQSPIPS_DR_AFTER_SHIFT, XQSPIPS_DR_BTWN_SHIFT, XQSPIPS_DR_NSS_SHIFT, XQSPIPS_DR_OFFSET, and XQspiPs_WriteReg.
Referenced by XQspiPs_SelfTest().
| s32 XQspiPs_SetOptions | ( | XQspiPs * | InstancePtr, |
| u32 | Options | ||
| ) |
Sets the options for the QSPI device driver.
The options control how the device behaves relative to the QSPI bus. The device must be idle rather than busy transferring data before setting these device options.
| [in] | InstancePtr | Pointer to the XQspiPs instance. |
| [in] | Options | The specified options to be set. This is a bit mask where a 1 means to turn the option on, and a 0 means to turn the option off. One or more bit values may be contained in the mask. See the bit definitions named XQSPIPS_*_OPTIONS in the file xqspips.h. |
References XQspiPs_Config::BaseAddress, XQspiPs::Config, XQspiPs::IsBusy, XQspiPs::IsReady, XQSPIPS_CR_OFFSET, XQSPIPS_LQSPI_CR_LINEAR_MASK, XQSPIPS_LQSPI_CR_OFFSET, XQSPIPS_LQSPI_CR_RST_STATE, XQSPIPS_LQSPI_MODE_OPTION, XQSPIPS_NUM_OPTIONS, XQspiPs_ReadReg, XQspiPs_SetSlaveSelect(), and XQspiPs_WriteReg.
Referenced by QspiFlashIntrExample().
| int XQspiPs_SetSlaveSelect | ( | XQspiPs * | InstancePtr | ) |
Selects the slave with which the master communicates.
The user is not allowed to select the slave while a transfer is in progress.
| [in] | InstancePtr | Pointer to the XQspiPs instance. |
References XQspiPs_Config::BaseAddress, XQspiPs::Config, XQspiPs::IsBusy, XQspiPs::IsReady, XQSPIPS_CR_OFFSET, XQSPIPS_CR_SSCTRL_MASK, XQspiPs_ReadReg, and XQspiPs_WriteReg.
Referenced by GetRealAddr(), QspiFlashIntrExample(), and XQspiPs_SetOptions().
| void XQspiPs_SetStatusHandler | ( | XQspiPs * | InstancePtr, |
| void * | CallBackRef, | ||
| XQspiPs_StatusHandler | FuncPtr | ||
| ) |
Sets the status callback function, the status handler, which the driver calls when it encounters conditions that should be reported to upper layer software.
The handler executes in an interrupt context, so it must minimize the amount of processing performed. One of the following status events is passed to the status handler.
XST_SPI_TRANSFER_DONE The requested data transfer is done
XST_SPI_TRANSMIT_UNDERRUN As a slave device, the master clocked data
but there were none available in the transmit
register/FIFO. This typically means the slave
application did not issue a transfer request
fast enough, or the processor/driver could not
fill the transmit register/FIFO fast enough.XST_SPI_RECEIVE_OVERRUN The QSPI device lost data. Data was received
but the receive data register/FIFO was full. | [in,out] | InstancePtr | Pointer to the XQspiPs instance. |
| [in] | CallBackRef | The upper layer callback reference passed back when the callback function is invoked. |
| [in] | FuncPtr | Pointer to the callback function. |
References XQspiPs::IsReady, XQspiPs::StatusHandler, and XQspiPs::StatusRef.
Referenced by QspiFlashIntrExample().
| s32 XQspiPs_Transfer | ( | XQspiPs * | InstancePtr, |
| u8 * | SendBufPtr, | ||
| u8 * | RecvBufPtr, | ||
| u32 | ByteCount | ||
| ) |
Transfers specified data on the QSPI bus.
Initiates bus communication and sends/receives data to/from the selected QSPI slave. For every byte sent, a byte is received.
The caller has the option of providing two different buffers for send and receive, or one buffer for both send and receive, or no buffer for receive. The receive buffer must be at least as big as the send buffer to prevent unwanted memory writes. This implies that the byte count passed in as an argument must be the smaller of the two buffers if they differ in size. Here are some sample usages:
XQspiPs_Transfer(InstancePtr, SendBuf, RecvBuf, ByteCount)
The caller wishes to send and receive, and provides two different
buffers for send and receive. XQspiPs_Transfer(InstancePtr, SendBuf, NULL, ByteCount)
The caller wishes only to send and does not care about the received
data. The driver ignores the received data in this case. XQspiPs_Transfer(InstancePtr, SendBuf, SendBuf, ByteCount)
The caller wishes to send and receive, but provides the same buffer
for doing both. The driver sends the data and overwrites the send
buffer with received data as it transfers the data. XQspiPs_Transfer(InstancePtr, RecvBuf, RecvBuf, ByteCount)
The caller wishes to only receive and does not care about sending
data. In this case, the caller must still provide a send buffer, but
it can be the same as the receive buffer if the caller does not care
what it sends. The device must send N bytes of data if it wishes to
receive N bytes of data.
Although this function takes entire buffers as arguments, the driver can only transfer a limited number of bytes at a time, limited by the size of the FIFO. A call to this function only starts the transfer, then subsequent transfers of the data is performed by the interrupt service routine until the entire buffer has been transferred. The status callback function is called when the entire buffer has been sent/received.
The function is non-blocking. The SetSlaveSelect function must be called prior to this function.
| [in,out] | InstancePtr | Pointer to the XQspiPs instance. |
| [in] | SendBufPtr | Pointer to a data buffer that needs to be transmitted. This buffer must not be NULL. |
| [out] | RecvBufPtr | Pointer to a buffer for received data. This argument can be NULL if do not care about receiving. |
| [in] | ByteCount | The number of bytes to send/receive. The number of bytes received always equals the number of bytes sent. |
References ARRAY_SIZE, XQspiPs_Config::BaseAddress, XQspiPs::Config, XQspiPs::IsBusy, XQspiPs::IsReady, XQspiPs::RecvBufferPtr, XQspiPs::RemainingBytes, XQspiPs::RequestedBytes, XQspiPs::SendBufferPtr, XQspiPs::ShiftReadData, XQSPIPS_CR_MANSTRT_MASK, XQSPIPS_CR_OFFSET, XQSPIPS_CR_SSCTRL_MASK, XQSPIPS_DUMMY_TX_DATA, XQspiPs_Enable, XQSPIPS_FIFO_DEPTH, XQSPIPS_FLASH_OPCODE_WRSR, XQSPIPS_IER_OFFSET, XQspiPs_IsManualChipSelect, XQspiPs_IsManualStart, XQSPIPS_IXR_RXNEMPTY_MASK, XQSPIPS_IXR_RXOVR_MASK, XQSPIPS_IXR_TXOW_MASK, XQSPIPS_IXR_TXUF_MASK, XQSPIPS_IXR_WR_TO_CLR_MASK, XQspiPs_ReadReg, XQSPIPS_RXFIFO_THRESHOLD_OPT, XQSPIPS_RXWR_OFFSET, XQSPIPS_SIZE_FOUR, XQSPIPS_SIZE_ONE, XQSPIPS_SIZE_THREE, XQSPIPS_SIZE_TWO, XQSPIPS_SR_OFFSET, XQSPIPS_TXD_00_OFFSET, XQSPIPS_TXD_01_OFFSET, XQSPIPS_TXD_10_OFFSET, XQSPIPS_TXD_11_OFFSET, and XQspiPs_WriteReg.