![]() |
Kinetis SDK v.2.0 API Reference Manual
Rev. 0
NXP Semiconductors
|
Modules | |
| SPIFI DMA Driver | |
| SPIFI Driver | |
Data Structures | |
| struct | spifi_command_t |
| SPIFI command structure. More... | |
| struct | spifi_config_t |
| SPIFI region configuration structure. More... | |
| struct | spifi_transfer_t |
| Transfer structure for SPIFI. More... | |
| struct | spifi_dma_handle_t |
| SPIFI DMA transfer handle, users should not touch the content of the handle. More... | |
Typedefs | |
| typedef void(* | spifi_dma_callback_t )(SPIFI_Type *base, spifi_dma_handle_t *handle, status_t status, void *userData) |
| SPIFI DMA transfer callback function for finish and error. | |
Functions | |
| static void | SPIFI_EnableDMA (SPIFI_Type *base, bool enable) |
| Enable or disable DMA request for SPIFI. More... | |
| static uint32_t | SPIFI_GetDataRegisterAddress (SPIFI_Type *base) |
| Gets the SPIFI data register address. More... | |
| static void | SPIFI_WriteData (SPIFI_Type *base, uint32_t data) |
| Write a word data in address of SPIFI. More... | |
| void | SPIFI_WriteBuffer (SPIFI_Type *base, uint8_t *buf, size_t size_to_write) |
| Write a buffer worth of data to SPIFI . More... | |
| static void | SPIFI_WriteDataByte (SPIFI_Type *base, uint8_t data) |
| Write a byte data in address of SPIFI. More... | |
| void | SPIFI_WriteDataHalfword (SPIFI_Type *base, uint16_t data) |
| Write a halfword data in address of SPIFI. More... | |
| static uint32_t | SPIFI_ReadData (SPIFI_Type *base) |
| Read data from serial flash. More... | |
| static uint8_t | SPIFI_ReadDataByte (SPIFI_Type *base) |
| Read a byte data from serial flash. More... | |
| uint16_t | SPIFI_ReadDataHalfword (SPIFI_Type *base) |
| Read a halfword data from serial flash. More... | |
Driver version | |
| #define | FSL_SPIFI_DRIVER_VERSION (MAKE_VERSION(2, 0, 2)) |
| SPIFI driver version 2.0.2. More... | |
Initialization and deinitialization | |
| uint32_t | SPIFI_GetInstance (SPIFI_Type *base) |
| Get the SPIFI instance from peripheral base address. More... | |
| void | SPIFI_Init (SPIFI_Type *base, const spifi_config_t *config) |
| Initializes the SPIFI with the user configuration structure. More... | |
| void | SPIFI_GetDefaultConfig (spifi_config_t *config) |
| Get SPIFI default configure settings. More... | |
| void | SPIFI_Deinit (SPIFI_Type *base) |
| Deinitializes the SPIFI regions. More... | |
Basic Control Operations | |
| void | SPIFI_SetCommand (SPIFI_Type *base, const spifi_command_t *cmd) |
| Set SPIFI flash command. More... | |
| static void | SPIFI_SetCommandAddress (SPIFI_Type *base, uint32_t addr) |
| Set SPIFI command address. More... | |
| static void | SPIFI_SetIntermediateData (SPIFI_Type *base, uint32_t val) |
| Set SPIFI intermediate data. More... | |
| static void | SPIFI_SetCacheLimit (SPIFI_Type *base, uint32_t val) |
| Set SPIFI Cache limit value. More... | |
| static void | SPIFI_ResetCommand (SPIFI_Type *base) |
| Reset the command field of SPIFI. More... | |
| void | SPIFI_SetMemoryCommand (SPIFI_Type *base, const spifi_command_t *cmd) |
| Set SPIFI flash AHB read command. More... | |
| static void | SPIFI_EnableInterrupt (SPIFI_Type *base, uint32_t mask) |
| Enable SPIFI interrupt. More... | |
| static void | SPIFI_DisableInterrupt (SPIFI_Type *base, uint32_t mask) |
| Disable SPIFI interrupt. More... | |
Status | |
| static uint32_t | SPIFI_GetStatusFlag (SPIFI_Type *base) |
| Get the status of all interrupt flags for SPIFI. More... | |
Driver version | |
| #define | FSL_SPIFI_DMA_DRIVER_VERSION (MAKE_VERSION(2, 0, 2)) |
| SPIFI DMA driver version 2.0.2. More... | |
DMA Transactional | |
| void | SPIFI_TransferTxCreateHandleDMA (SPIFI_Type *base, spifi_dma_handle_t *handle, spifi_dma_callback_t callback, void *userData, dma_handle_t *dmaHandle) |
| Initializes the SPIFI handle for send which is used in transactional functions and set the callback. More... | |
| void | SPIFI_TransferRxCreateHandleDMA (SPIFI_Type *base, spifi_dma_handle_t *handle, spifi_dma_callback_t callback, void *userData, dma_handle_t *dmaHandle) |
| Initializes the SPIFI handle for receive which is used in transactional functions and set the callback. More... | |
| status_t | SPIFI_TransferSendDMA (SPIFI_Type *base, spifi_dma_handle_t *handle, spifi_transfer_t *xfer) |
| Transfers SPIFI data using an DMA non-blocking method. More... | |
| status_t | SPIFI_TransferReceiveDMA (SPIFI_Type *base, spifi_dma_handle_t *handle, spifi_transfer_t *xfer) |
| Receives data using an DMA non-blocking method. More... | |
| void | SPIFI_TransferAbortSendDMA (SPIFI_Type *base, spifi_dma_handle_t *handle) |
| Aborts the sent data using DMA. More... | |
| void | SPIFI_TransferAbortReceiveDMA (SPIFI_Type *base, spifi_dma_handle_t *handle) |
| Aborts the receive data using DMA. More... | |
| status_t | SPIFI_TransferGetSendCountDMA (SPIFI_Type *base, spifi_dma_handle_t *handle, size_t *count) |
| Gets the transferred counts of send. More... | |
| status_t | SPIFI_TransferGetReceiveCountDMA (SPIFI_Type *base, spifi_dma_handle_t *handle, size_t *count) |
| Gets the status of the receive transfer. More... | |
| struct spifi_command_t |
Data Fields | |
| uint16_t | dataLen |
| How many data bytes are needed in this command. More... | |
| bool | isPollMode |
| For command need to read data from serial flash. | |
| spifi_data_direction_t | direction |
| Data direction of this command. More... | |
| uint8_t | intermediateBytes |
| How many intermediate bytes needed. | |
| spifi_command_format_t | format |
| Command format. | |
| spifi_command_type_t | type |
| Command type. | |
| uint8_t | opcode |
| Command opcode value. | |
| uint16_t spifi_command_t::dataLen |
| spifi_data_direction_t spifi_command_t::direction |
| struct spifi_config_t |
Data Fields | |
| uint16_t | timeout |
| SPI transfer timeout, the unit is SCK cycles. | |
| uint8_t | csHighTime |
| CS high time cycles. | |
| bool | disablePrefetch |
| True means SPIFI will not attempt a speculative prefetch. More... | |
| bool | disableCachePrefech |
| Disable prefetch of cache line. | |
| bool | isFeedbackClock |
| Is data sample uses feedback clock. More... | |
| spifi_spi_mode_t | spiMode |
| SPIFI spi mode select. | |
| bool | isReadFullClockCycle |
| If enable read full clock cycle. More... | |
| spifi_dual_mode_t | dualMode |
| SPIFI dual mode, dual or quad. More... | |
| bool spifi_config_t::disablePrefetch |
| bool spifi_config_t::isFeedbackClock |
| bool spifi_config_t::isReadFullClockCycle |
| spifi_dual_mode_t spifi_config_t::dualMode |
| struct spifi_transfer_t |
| struct _spifi_dma_handle |
Data Fields | |
| dma_handle_t * | dmaHandle |
| DMA handler for SPIFI send. | |
| size_t | transferSize |
| Bytes need to transfer. More... | |
| uint32_t | state |
| Internal state for SPIFI DMA transfer. | |
| spifi_dma_callback_t | callback |
| Callback for users while transfer finish or error occurred. | |
| void * | userData |
| User callback parameter. | |
| size_t spifi_dma_handle_t::transferSize |
| #define FSL_SPIFI_DRIVER_VERSION (MAKE_VERSION(2, 0, 2)) |
| #define FSL_SPIFI_DMA_DRIVER_VERSION (MAKE_VERSION(2, 0, 2)) |
| enum _status_t |
| enum spifi_spi_mode_t |
| enum spifi_dual_mode_t |
| enum spifi_command_type_t |
| enum _spifi_status_flags |
| uint32_t SPIFI_GetInstance | ( | SPIFI_Type * | base | ) |
| base | SPIFI peripheral base address. |
| void SPIFI_Init | ( | SPIFI_Type * | base, |
| const spifi_config_t * | config | ||
| ) |
This function configures the SPIFI module with the user-defined configuration.
| base | SPIFI peripheral base address. |
| config | The pointer to the configuration structure. |
| void SPIFI_GetDefaultConfig | ( | spifi_config_t * | config | ) |
| config | SPIFI config structure pointer. |
| void SPIFI_Deinit | ( | SPIFI_Type * | base | ) |
| base | SPIFI peripheral base address. |
| void SPIFI_SetCommand | ( | SPIFI_Type * | base, |
| const spifi_command_t * | cmd | ||
| ) |
| base | SPIFI peripheral base address. |
| cmd | SPIFI command structure pointer. |
|
inlinestatic |
| base | SPIFI peripheral base address. |
| addr | Address value for the command. |
|
inlinestatic |
Before writing a command wihch needs specific intermediate value, users shall call this function to write it. The main use of this function for current serial flash is to select no-opcode mode and cancelling this mode. As dummy cycle do not care about the value, no need to call this function.
| base | SPIFI peripheral base address. |
| val | Intermediate data. |
|
inlinestatic |
SPIFI includes caching of prevously-accessed data to improve performance. Software can write an address to this function, to prevent such caching at and above the address.
| base | SPIFI peripheral base address. |
| val | Zero-based upper limit of cacheable memory. |
|
inlinestatic |
This function is used to abort the current command or memory mode.
| base | SPIFI peripheral base address. |
| void SPIFI_SetMemoryCommand | ( | SPIFI_Type * | base, |
| const spifi_command_t * | cmd | ||
| ) |
Call this function means SPIFI enters to memory mode, while users need to use command, a SPIFI_ResetCommand shall be called.
| base | SPIFI peripheral base address. |
| cmd | SPIFI command structure pointer. |
|
inlinestatic |
The interrupt is triggered only in command mode, and it means the command now is finished.
| base | SPIFI peripheral base address. |
| mask | SPIFI interrupt enable mask. It is a logic OR of members the enumeration :: spifi_interrupt_enable_t |
|
inlinestatic |
The interrupt is triggered only in command mode, and it means the command now is finished.
| base | SPIFI peripheral base address. |
| mask | SPIFI interrupt enable mask. It is a logic OR of members the enumeration :: spifi_interrupt_enable_t |
|
inlinestatic |
| base | SPIFI peripheral base address. |
|
inlinestatic |
| base | SPIFI peripheral base address. |
| enable | True means enable DMA and false means disable DMA. |
|
inlinestatic |
This API is used to provide a transfer address for the SPIFI DMA transfer configuration.
| base | SPIFI base pointer |
|
inlinestatic |
Users can write a page or at least a word data into SPIFI address. Beware: certain SPIFI implementations (such as that of JN5189/QN9090/K32W061) require that the data do not exceed the actual size of the command, so cannot call SPIFI_WriteData when less than 32 bits are expected.
| base | SPIFI peripheral base address. |
| data | Data that need to be written. |
| void SPIFI_WriteBuffer | ( | SPIFI_Type * | base, |
| uint8_t * | buf, | ||
| size_t | size_to_write | ||
| ) |
Used for transaction requiring less than 32 bits of data
| base | SPIFI peripheral base address. |
| buf | pointer on octet buffer to be written to the SPIFI. |
| size_to_write | size of buffer. |
|
inlinestatic |
Users can write a byte data into SPIFI address.
| base | SPIFI peripheral base address. |
| data | Data need be write. |
| void SPIFI_WriteDataHalfword | ( | SPIFI_Type * | base, |
| uint16_t | data | ||
| ) |
Users can write a halfword data into SPIFI address.
| base | SPIFI peripheral base address. |
| data | Data need be write. |
|
inlinestatic |
Users should notice before call this function, the data length field in command register shall be larger than 4, otherwise a hard fault will happen.
| base | SPIFI peripheral base address. |
|
inlinestatic |
| base | SPIFI peripheral base address. |
| uint16_t SPIFI_ReadDataHalfword | ( | SPIFI_Type * | base | ) |
| base | SPIFI peripheral base address. |
| void SPIFI_TransferTxCreateHandleDMA | ( | SPIFI_Type * | base, |
| spifi_dma_handle_t * | handle, | ||
| spifi_dma_callback_t | callback, | ||
| void * | userData, | ||
| dma_handle_t * | dmaHandle | ||
| ) |
| base | SPIFI peripheral base address |
| handle | Pointer to spifi_dma_handle_t structure |
| callback | SPIFI callback, NULL means no callback. |
| userData | User callback function data. |
| rxDmaHandle | User requested DMA handle for DMA transfer |
| void SPIFI_TransferRxCreateHandleDMA | ( | SPIFI_Type * | base, |
| spifi_dma_handle_t * | handle, | ||
| spifi_dma_callback_t | callback, | ||
| void * | userData, | ||
| dma_handle_t * | dmaHandle | ||
| ) |
| base | SPIFI peripheral base address |
| handle | Pointer to spifi_dma_handle_t structure |
| callback | SPIFI callback, NULL means no callback. |
| userData | User callback function data. |
| rxDmaHandle | User requested DMA handle for DMA transfer |
| status_t SPIFI_TransferSendDMA | ( | SPIFI_Type * | base, |
| spifi_dma_handle_t * | handle, | ||
| spifi_transfer_t * | xfer | ||
| ) |
This function writes data to the SPIFI transmit FIFO. This function is non-blocking.
| base | Pointer to QuadSPI Type. |
| handle | Pointer to spifi_dma_handle_t structure |
| xfer | SPIFI transfer structure. |
| status_t SPIFI_TransferReceiveDMA | ( | SPIFI_Type * | base, |
| spifi_dma_handle_t * | handle, | ||
| spifi_transfer_t * | xfer | ||
| ) |
This function receive data from the SPIFI receive buffer/FIFO. This function is non-blocking.
| base | Pointer to QuadSPI Type. |
| handle | Pointer to spifi_dma_handle_t structure |
| xfer | SPIFI transfer structure. |
| void SPIFI_TransferAbortSendDMA | ( | SPIFI_Type * | base, |
| spifi_dma_handle_t * | handle | ||
| ) |
This function aborts the sent data using DMA.
| base | SPIFI peripheral base address. |
| handle | Pointer to spifi_dma_handle_t structure |
| void SPIFI_TransferAbortReceiveDMA | ( | SPIFI_Type * | base, |
| spifi_dma_handle_t * | handle | ||
| ) |
This function abort receive data which using DMA.
| base | SPIFI peripheral base address. |
| handle | Pointer to spifi_dma_handle_t structure |
| status_t SPIFI_TransferGetSendCountDMA | ( | SPIFI_Type * | base, |
| spifi_dma_handle_t * | handle, | ||
| size_t * | count | ||
| ) |
| base | Pointer to QuadSPI Type. |
| handle | Pointer to spifi_dma_handle_t structure. |
| count | Bytes sent. |
| kStatus_Success | Succeed get the transfer count. |
| kStatus_NoTransferInProgress | There is not a non-blocking transaction currently in progress. |
| status_t SPIFI_TransferGetReceiveCountDMA | ( | SPIFI_Type * | base, |
| spifi_dma_handle_t * | handle, | ||
| size_t * | count | ||
| ) |
| base | Pointer to QuadSPI Type. |
| handle | Pointer to spifi_dma_handle_t structure |
| count | Bytes received. |
| kStatus_Success | Succeed get the transfer count. |
| kStatus_NoTransferInProgress | There is not a non-blocking transaction currently in progress. |