/* Read a data from a slave when the bus is idle, and waiting for all bus transmiton complete.(Read Step1) 
This function is usually used in thread mode. */
unsigned long I2CMasterReadS1(unsigned long ulBase, unsigned char ucSlaveAddr, unsigned char *pucData, xtBoolean bEndTransmition)
/* Read a data from a slave when the bus is idle, and waiting for all bus transmiton complete.(Read Step1) 
This function is usually used in thread mode. */
unsigned long I2CMasterReadS1(unsigned long ulBase, unsigned char ucSlaveAddr, unsigned char *pucData, xtBoolean bEndTransmition)
{
    unsigned long ulStatus;
    xASSERT((ulBase == I2C0_BASE) || (ulBase == I2C1_BASE));
    xASSERT(pucData);
    I2CMasterReadRequestS1(ulBase, ucSlaveAddr, xfalse);
    if(bEndTransmition)
    {
        xHWREG(ulBase + I2C_CR) &= ~I2C_CR_AA;
    }
    do
    {
        ulStatus = I2CStatusGet(ulBase);  
        if(xHWREG(ulBase + I2C_CSR) & 0x0700)
            break;
    }
    while(!(ulStatus == I2C_MASTER_RX_NOT_EMPTY));
    ulStatus &= (I2C_CSR_ARBLOS | I2C_CSR_RXNACK);
    if(!ulStatus)
    {
        *pucData = xHWREG(ulBase + I2C_DR);
    }
    if(bEndTransmition)
    {
        I2CStopSend(ulBase);
    }
    return ulStatus;       
}