Hi,
Can I suggest a couple of asserts for flexspi.c please?
RT1021, SDK 2.15.0
1. In fsl_flexspi.c
Assert #1:
status_t FLEXSPI_TransferBlocking(FLEXSPI_Type *base, flexspi_transfer_t *xfer)
{
<snip>
/* Configure data size. */
if ((xfer->cmdType == kFLEXSPI_Read) || (xfer->cmdType == kFLEXSPI_Write) || (xfer->cmdType == kFLEXSPI_Config))
{
configValue = FLEXSPI_IPCR1_IDATSZ(xfer->dataSize);
// Catch when dataSize is > max possible.
assert(((configValue & (FLEXSPI_IPCR1_IDATSZ_MASK)) >> (FLEXSPI_IPCR1_IDATSZ_SHIFT)) == xfer->dataSize);
}
Assert #2:
status_t FLEXSPI_TransferNonBlocking(FLEXSPI_Type *base, flexspi_handle_t *handle, flexspi_transfer_t *xfer)
{
<snip>
/* Configure data size. */
if ((xfer->cmdType == kFLEXSPI_Read) || (xfer->cmdType == kFLEXSPI_Write))
{
configValue = FLEXSPI_IPCR1_IDATSZ(xfer->dataSize);
// Catch when dataSize is > max possible.
assert(((configValue & (FLEXSPI_IPCR1_IDATSZ_MASK)) >> (FLEXSPI_IPCR1_IDATSZ_SHIFT)) == xfer->dataSize);
}
2. In fsl_flexspi.h
/*! @brief Transfer structure for FLEXSPI. */
typedef struct _flexspi_transfer
{
uint32_t deviceAddress; /*!< Operation device address. */
flexspi_port_t port; /*!< Operation port. */
flexspi_command_type_t cmdType; /*!< Execution command type. */
uint8_t seqIndex; /*!< Sequence ID for command. */
uint8_t SeqNumber; /*!< Sequence number for command. */
uint8_t *data; /*!< Data buffer. */
size_t dataSize; /*!< Data size in bytes. */
} flexspi_transfer_t;
Make the data field uint8_t* instead of uint32_t*. Because it is cast to uint8_t* when it is used. I think this is a hangover from when _flexspi_handle's data field was uint32_t* (and associated code in the .c file), but is now uint8_t*.
Kind regards.