/* Configures the alternate function of a GPIO pin.  */
void GPIOPinConfigure(unsigned long ulPinConfig)
/* Configures the alternate function of a GPIO pin.  */
void GPIOPinConfigure(unsigned long ulPinConfig)
{
    unsigned long ulPortBase, ulPinBase, ulMux;
    unsigned long ulShift;
    ulShift = (ulPinConfig >> 12) & 0x0f;
    ulPortBase = g_pulPortBase[ulShift];
    ulShift = (ulPinConfig >> 4) & 0xff; 
    ulPinBase = ulShift * 4;
    ulMux = ulPinConfig & 0x0f;
    xHWREG(ulPortBase + ulPinBase) &= ~PORT_PCR_PIN_MUX_M;
    xHWREG(ulPortBase + ulPinBase) |= (ulMux << 8);
}