Firmware/PeugeotDisplay4245/PeugeotDisplay4245.cydsn/codegentemp/SPILCD_SPI_BOOT.c
/**
*
*  Allows the caller to read data from the bootloader host (the host writes the
*  data). The function handles polling to allow a block of data to be completely
*  received from the host device.
*
*  \param pData: Pointer to the block of data to be written to the bootloader
*   host.
*  \param size: Number of bytes to be written.
*  \param count: Pointer to the variable to write the number of bytes actually
*   written.
*  \param timeOut: Number of units in 10 ms to wait before returning
*   because of a timeout.
*
*  \return
*   Returns CYRET_SUCCESS if no problem was encountered or returns the value
*   that best describes the problem. For more information refer to the
*   "Return Codes" section of the System Reference Guide.
*
*******************************************************************************/
Allows the caller to read data from the bootloader host (the host writes the
data). The function handles polling to allow a block of data to be completely
received from the host device.

\param pData: Pointer to the block of data to be written to the bootloader
host.
\param size: Number of bytes to be written.
\param count: Pointer to the variable to write the number of bytes actually
written.
\param timeOut: Number of units in 10 ms to wait before returning
because of a timeout.

\return
Returns CYRET_SUCCESS if no problem was encountered or returns the value
that best describes the problem. For more information refer to the
"Return Codes" section of the System Reference Guide.
Allows the caller to read data from the bootloader host ( the host writes the data ) . The function handles polling to allow a block of data to be completely received from the host device . \ param pData : Pointer to the block of data to be written to the bootloader host . \ param size : Number of bytes to be written . \ param count : Pointer to the variable to write the number of bytes actually written . \ param timeOut : Number of units in 10 ms to wait before returning because of a timeout . \ return Returns CYRET_SUCCESS if no problem was encountered or returns the value that best describes the problem . For more information refer to the " Return Codes " section of the System Reference Guide .
cystatus SPILCD_SpiCyBtldrCommWrite(const uint8 pData[], uint16 size, uint16 * count, uint8 timeOut)
{
    cystatus status;
    uint32 timeoutMs;
    status = CYRET_BAD_PARAM;
    if ((NULL != pData) && (size > 0u))
    {
        status = CYRET_TIMEOUT;
        timeoutMs = ((uint32) 10u * timeOut); 
        SPILCD_SpiUartPutArray(pData, (uint32) size);
        do
        {
            if ((0u == SPILCD_SpiUartGetTxBufferSize()) &&
                (0u == (SPILCD_SPI_STATUS_REG & SPILCD_SPI_STATUS_BUS_BUSY)) &&
                (0u == (SPILCD_TX_FIFO_STATUS_REG & SPILCD_TX_FIFO_SR_VALID)))
            {
                *count = size;
                status = CYRET_SUCCESS;
                break;
            }
            CyDelay(SPILCD_WAIT_1_MS);
            --timeoutMs;
        }
        while (0u != timeoutMs);
        SPILCD_SpiUartClearRxBuffer();
        SPILCD_RX_FIFO_CTRL_REG &= (uint32) ~SPILCD_RX_FIFO_CTRL_FREEZE;
    }
    return (status);
}
cystatus SPILCD_SpiCyBtldrCommWrite ( const uint8 pData [ ] , uint16 size , uint16 * count , uint8 timeOut ) { cystatus status ; uint32 timeoutMs ; status = CYRET_BAD_PARAM ; if ( ( NULL != pData ) && ( size > 0u ) ) { status = CYRET_TIMEOUT ; timeoutMs = ( ( uint32 ) 10u * timeOut ) ; SPILCD_SpiUartPutArray ( pData , ( uint32 ) size ) ; do { if ( ( 0u == SPILCD_SpiUartGetTxBufferSize ( ) ) && ( 0u == ( SPILCD_SPI_STATUS_REG & SPILCD_SPI_STATUS_BUS_BUSY ) ) && ( 0u == ( SPILCD_TX_FIFO_STATUS_REG & SPILCD_TX_FIFO_SR_VALID ) ) ) { * count = size ; status = CYRET_SUCCESS ; break ; } CyDelay ( SPILCD_WAIT_1_MS ) ; -- timeoutMs ; } while ( 0u != timeoutMs ) ; SPILCD_SpiUartClearRxBuffer ( ) ; SPILCD_RX_FIFO_CTRL_REG &= ( uint32 ) ~ SPILCD_RX_FIFO_CTRL_FREEZE ; } return ( status ) ; }
Allows the caller to read data from the bootloader host (the host writes the
data).
Allows the caller to read data from the bootloader host ( the host writes the data ) .
/* Convert from 10mS check to 1mS checks */ /* Put data into TX buffer */ /* Wait with timeout 1mS for packet end */ /* Check for packet end */ /* Enable data reception into RX FIFO */