/* 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 ulReadTemp;
    xASSERT((ulBase == SPI3_BASE) || (ulBase == SPI1_BASE)||
            (ulBase == SPI2_BASE));
    while(!(xHWREG(ulBase + SPI_SR) & SPI_SR_TXE));
    xHWREG(ulBase + SPI_DR) = ulWData;
    while(!(xHWREG(ulBase + SPI_SR) & SPI_SR_RXNE));
    ulReadTemp = xHWREG(ulBase + SPI_DR);
    return ulReadTemp;
}