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 storage for the block of data to be read from the
*   bootloader host
*  \param size: Number of bytes to be read.
*  \param count: Pointer to the variable to write the number of bytes actually
*   read.
*  \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 storage for the block of data to be read from the
bootloader host
\param size: Number of bytes to be read.
\param count: Pointer to the variable to write the number of bytes actually
read.
\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 storage for the block of data to be read from the bootloader host \ param size : Number of bytes to be read . \ param count : Pointer to the variable to write the number of bytes actually read . \ 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_SpiCyBtldrCommRead(uint8 pData[], uint16 size, uint16 * count, uint8 timeOut)
{
    cystatus status;
    uint32 byteCount;
    uint32 timeoutMs;
    uint32 i;
    status = CYRET_BAD_PARAM;
    if ((NULL != pData) && (size > 0u))
    {
        status = CYRET_TIMEOUT;
        timeoutMs = ((uint32) 10u * timeOut); 
        byteCount = 0u;
        do
        {
            if (0u != SPILCD_SpiUartGetRxBufferSize())
            {
                do
                {
                    byteCount = SPILCD_SpiUartGetRxBufferSize();
                    CyDelayUs(SPILCD_SPI_BYTE_TO_BYTE);
                }
                while (byteCount != SPILCD_SpiUartGetRxBufferSize());
                SPILCD_RX_FIFO_CTRL_REG |= SPILCD_RX_FIFO_CTRL_FREEZE;
                byteCount = SPILCD_BYTES_TO_COPY(byteCount, size);
                *count = (uint16) byteCount;
                status = CYRET_SUCCESS;
                break;
            }
            CyDelay(SPILCD_WAIT_1_MS);
            --timeoutMs;
        }
        while (0u != timeoutMs);
        for (i = 0u; i < byteCount; ++i)
        {
            pData[i] = (uint8) SPILCD_SpiUartReadRxData();
        }
    }
    return (status);
}
cystatus SPILCD_SpiCyBtldrCommRead ( uint8 pData [ ] , uint16 size , uint16 * count , uint8 timeOut ) { cystatus status ; uint32 byteCount ; uint32 timeoutMs ; uint32 i ; status = CYRET_BAD_PARAM ; if ( ( NULL != pData ) && ( size > 0u ) ) { status = CYRET_TIMEOUT ; timeoutMs = ( ( uint32 ) 10u * timeOut ) ; byteCount = 0u ; do { if ( 0u != SPILCD_SpiUartGetRxBufferSize ( ) ) { do { byteCount = SPILCD_SpiUartGetRxBufferSize ( ) ; CyDelayUs ( SPILCD_SPI_BYTE_TO_BYTE ) ; } while ( byteCount != SPILCD_SpiUartGetRxBufferSize ( ) ) ; SPILCD_RX_FIFO_CTRL_REG |= SPILCD_RX_FIFO_CTRL_FREEZE ; byteCount = SPILCD_BYTES_TO_COPY ( byteCount , size ) ; * count = ( uint16 ) byteCount ; status = CYRET_SUCCESS ; break ; } CyDelay ( SPILCD_WAIT_1_MS ) ; -- timeoutMs ; } while ( 0u != timeoutMs ) ; for ( i = 0u ; i < byteCount ; ++ i ) { pData [ i ] = ( uint8 ) SPILCD_SpiUartReadRxData ( ) ; } } 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 */ /* Wait with timeout 1mS for packet start */ /* Check packet start */ /* Wait for packet end */ /* Disable data reception into RX FIFO */ /* Get data from the RX buffer into bootloader buffer */