/* Gets the direction and mode of a pin. */
unsigned long GPIODirModeGet(unsigned long ulPort, unsigned long ulBit)
/* Gets the direction and mode of a pin. */
unsigned long GPIODirModeGet(unsigned long ulPort, unsigned long ulBit)
{
    xASSERT(GPIOBaseValid(ulPort));
    xASSERT(ulBit < 16);
    if(ulBit < 8)
    {
        return((xHWREG(ulPort + GPIO_CRL) &
               (0xF << (ulBit * 4))) >> (ulBit * 4));
    }
    else
    {
        return((xHWREG(ulPort + GPIO_CRH) &
               (0xF << ((ulBit - 8) * 4))) >> ((ulBit - 8) * 4));
    }
}