/* Read and write a data element from and to the SPI interface.  */
unsigned long xSPISingleDataReadWrite(unsigned long ulBase, unsigned long ulWData)
/* Read and write a data element from and to the SPI interface.  */
unsigned long xSPISingleDataReadWrite(unsigned long ulBase, unsigned long ulWData)
{
    unsigned long ulReadTemp;
    xASSERT((ulBase == SPI0_BASE) || (ulBase == SPI1_BASE)||
            (ulBase == SPI2_BASE) || (ulBase == SPI3_BASE));
    while((xHWREG(ulBase + SPI_CNTRL) & SPI_CNTRL_GO_BUSY))
    {
    }
    xHWREG(ulBase + SPI_TX0) = ulWData;
    xHWREG(ulBase + SPI_CNTRL) |= SPI_CNTRL_GO_BUSY;
    while((xHWREG(ulBase + SPI_CNTRL) & SPI_CNTRL_GO_BUSY))
    {
    }
    ulReadTemp = xHWREG(ulBase + SPI_RX0);
    return ulReadTemp;
}