Suggestions for fsl_flexspi.c, fsl_flexspi.h

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

Suggestions for fsl_flexspi.c, fsl_flexspi.h

511 次查看
rshipman
Contributor V

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.

标记 (2)
0 项奖励
回复
1 回复

467 次查看
EdwinHz
NXP TechSupport
NXP TechSupport

Hi @rshipman,

Thanks for the suggestions.

I will pass them on to the SDK team so they can take a look into this and deliberate on the implementation of these changes.

BR,
Edwin.

0 项奖励
回复