/* Read and write a data element from and to the SPI interface.  */
unsigned long SPISingleDataReadWrite(unsigned long ulBase, unsigned long ulWData)
/* Read and write a data element from and to the SPI interface.  */
unsigned long SPISingleDataReadWrite(unsigned long ulBase, unsigned long ulWData)
{
    unsigned long ulRData;
    xASSERT((ulBase == SPI0_BASE) || (ulBase == SPI1_BASE));
    while(!(xHWREGB(ulBase + SPI_S) & SPI_S_SPTEF))
    {
    }
    xHWREGB(ulBase + SPI_D) = (unsigned char)ulWData;
    while(!(xHWREGB(ulBase + SPI_S) & SPI_S_SPRF))
    {
    }
    ulRData = xHWREGB(ulBase + SPI_D); 
    return ulRData;
}