/* Send a piece of data for ECSPI. 
This function computes the number of data to be written into D register or Tx FIFO, and write the data into it. At the same time, this function updates the values in master handle structure. */
static void ECSPI_SendTransfer(ECSPI_Type *base, ecspi_master_handle_t *handle)
/* Send a piece of data for ECSPI. 
This function computes the number of data to be written into D register or Tx FIFO, and write the data into it. At the same time, this function updates the values in master handle structure. */
static void ECSPI_SendTransfer(ECSPI_Type *base, ecspi_master_handle_t *handle)
{
    assert(base);
    assert(handle);
    uint32_t dataCounts = 0U;
    dataCounts = (FSL_FEATURE_ECSPI_TX_FIFO_SIZEn(base) - ECSPI_GetTxFifoCount(base)) < (handle->txRemainingBytes) ?
                     (FSL_FEATURE_ECSPI_TX_FIFO_SIZEn(base) - ECSPI_GetTxFifoCount(base)) :
                     (handle->txRemainingBytes);
    while (dataCounts--)
    {
        ECSPI_WriteNonBlocking(base, handle->txData, 1);
        if (NULL != handle->txData)
        {
            handle->txData += 1U;
        }
        handle->txRemainingBytes -= 1U;
    }
}