/* Gets a data element from the SPI interface.  */
void SPIDataRead(unsigned long ulBase, void *pulRData, unsigned long ulLen)
/* Gets a data element from the SPI interface.  */
void SPIDataRead(unsigned long ulBase, void *pulRData, unsigned long ulLen)
{
    unsigned long i;
    xASSERT((ulBase == SPI3_BASE) || (ulBase == SPI1_BASE)||
            (ulBase == SPI2_BASE));
    for (i=0; i<ulLen; i++)
    {
        if ((xHWREG(ulBase + SPI_CR1) & SPI_CR1_DFF) != SPI_CR1_DFF)
        {
            ((unsigned char*)pulRData)[i] = 
            SPISingleDataReadWrite(ulBase, 0xFF);
        }
        else
        {
            ((unsigned short*)pulRData)[i] = 
            SPISingleDataReadWrite(ulBase, 0xFFFF);
        }   
    }
}