/* Gets a data element from the SPI interface.  */
void xSPIDataRead(unsigned long ulBase, void *pulRData, unsigned long ulLen)
/* Gets a data element from the SPI interface.  */
void xSPIDataRead(unsigned long ulBase, void *pulRData, unsigned long ulLen)
{
    unsigned long i;
    unsigned char ucBitLength = xSPIBitLengthGet(ulBase);
    xASSERT((ulBase == SPI0_BASE) || (ulBase == SPI1_BASE)||
            (ulBase == SPI2_BASE) || (ulBase == SPI3_BASE));
    for (i=0; i<ulLen; i++)
    {
        if (ucBitLength <= 8)
        {
            ((unsigned char*)pulRData)[i] = 
            xSPISingleDataReadWrite(ulBase, 0xFF);
        }
        else if (ucBitLength >= 8 && ucBitLength <= 16)
        {
            ((unsigned short*)pulRData)[i] = 
            xSPISingleDataReadWrite(ulBase, 0xFFFF);
        }   
        else
        {
            ((unsigned long*)pulRData)[i] = 
            xSPISingleDataReadWrite(ulBase, 0xFFFFFF);
        }
    }
}