Platform/ECM3532/M3/hw/csp/ecm3532/m3/csp/src/eta_csp_spi.c
/***************************************************************************/
/**
 *
 *  EtaCspSpiSlaveTxDataSend - Send bytes to the master. Function will send
 *    fewer than the requested number of bytes if the TX buffer becomes full.
 *
 *  @param iNum the SPI number.
 *  @param pui8TxData pointer to TX Data Array
 *  @param ui32TxWriteLen TX Data bytes to write to the interface
 *  @param pui32TxSentLen TX Data bytes actually sent on return
 *  @return tEtaStatus will return eEtaSpiTxFifoUflow if the TX FIFO underflows
 *
 ******************************************************************************/
Send bytes to the master. Function will send
fewer than the requested number of bytes if the TX buffer becomes full.

@param iNum the SPI number.
@param pui8TxData pointer to TX Data Array
@param ui32TxWriteLen TX Data bytes to write to the interface
@param pui32TxSentLen TX Data bytes actually sent on return
@return tEtaStatus will return eEtaSpiTxFifoUflow if the TX FIFO underflows
Send bytes to the master . Function will send fewer than the requested number of bytes if the TX buffer becomes full . @param iNum the SPI number . @param pui8TxData pointer to TX Data Array @param ui32TxWriteLen TX Data bytes to write to the interface @param pui32TxSentLen TX Data bytes actually sent on return @return tEtaStatus will return eEtaSpiTxFifoUflow if the TX FIFO underflows
tEtaStatus EtaCspSpiSlaveTxDataSend(tSpiNum iNum, uint8_t * pui8TxData,
                        uint32_t ui32TxWriteLen, uint32_t * pui32TxSentLen)
{
    tEtaStatus iStatus = eEtaSuccess;
    uint8_t ui8Debug = MEMIO8(REG_SPI_TX_FIFO_DEBUG_ADDR(iNum) );
    int32_t i32Space = 16 - (ui8Debug & BM_SPI_TX_FIFO_DEBUG_ENTRIES);
    *pui32TxSentLen = ui32TxWriteLen;
    if (i32Space < ui32TxWriteLen) {
        *pui32TxSentLen = i32Space;
    }
    else if (i32Space > ui32TxWriteLen) {
        i32Space = ui32TxWriteLen;
    }
    for (; i32Space > 0; i32Space--) {
        MEMIO8(REG_SPI_TXRX_1BYTE_FIFO_DATA_ADDR(iNum) ) = (*pui8TxData++);
    }
    ui8Debug = MEMIO8(REG_SPI_TX_FIFO_DEBUG_ADDR(iNum) );
    if (ui8Debug & BM_SPI_TX_FIFO_DEBUG_UFLOW) {
        iStatus = eEtaSpiTxFifoUflow;
    }
    return iStatus;
}
tEtaStatus EtaCspSpiSlaveTxDataSend ( tSpiNum iNum , uint8_t * pui8TxData , uint32_t ui32TxWriteLen , uint32_t * pui32TxSentLen ) { tEtaStatus iStatus = eEtaSuccess ; uint8_t ui8Debug = MEMIO8 ( REG_SPI_TX_FIFO_DEBUG_ADDR ( iNum ) ) ; int32_t i32Space = 16 - ( ui8Debug & BM_SPI_TX_FIFO_DEBUG_ENTRIES ) ; * pui32TxSentLen = ui32TxWriteLen ; if ( i32Space < ui32TxWriteLen ) { * pui32TxSentLen = i32Space ; } else if ( i32Space > ui32TxWriteLen ) { i32Space = ui32TxWriteLen ; } for ( ; i32Space > 0 ; i32Space -- ) { MEMIO8 ( REG_SPI_TXRX_1BYTE_FIFO_DATA_ADDR ( iNum ) ) = ( * pui8TxData ++ ) ; } ui8Debug = MEMIO8 ( REG_SPI_TX_FIFO_DEBUG_ADDR ( iNum ) ) ; if ( ui8Debug & BM_SPI_TX_FIFO_DEBUG_UFLOW ) { iStatus = eEtaSpiTxFifoUflow ; } return iStatus ; }
EtaCspSpiSlaveTxDataSend - Send bytes to the master.
EtaCspSpiSlaveTxDataSend - Send bytes to the master .
// Set the number of sent bytes based on the number in the FIFO. // Put data in the FIFO /* NONE */