/* 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 ulBase, ulShift;
    ASSERT(((ulPinConfig >> 16) & 0xff) < 9);
    ASSERT(((ulPinConfig >> 8) & 0xe3) == 0);
    ulBase = (ulPinConfig >> 16) & 0xff;
    if(HWREG(SYSCTL_GPIOHSCTL) & (1 << ulBase))
    {
        ulBase = g_pulGPIOBaseAddrs[(ulBase << 1) + 1];
    }
    else
    {
        ulBase = g_pulGPIOBaseAddrs[ulBase << 1];
    }
    ulShift = (ulPinConfig >> 8) & 0xff;
    HWREG(ulBase + GPIO_O_PCTL) = ((HWREG(ulBase + GPIO_O_PCTL) &
                                    ~(0xf << ulShift)) |
                                   ((ulPinConfig & 0xf) << ulShift));
}