/* Registers a function to be called when an interrupt occurs. */
void IntRegister(unsigned long ulInterrupt, void(*pfnHandler)(void))
/* Registers a function to be called when an interrupt occurs. */
void IntRegister(unsigned long ulInterrupt, void(*pfnHandler)(void))
{
    unsigned long ulIdx, ulValue;
    ASSERT(ulInterrupt < NUM_INTERRUPTS);
    ASSERT(((unsigned long)g_pfnRAMVectors & 0x000003ff) == 0);
    if(HWREG(NVIC_VTABLE) != (unsigned long)g_pfnRAMVectors)
    {
        ulValue = HWREG(NVIC_VTABLE);
        for(ulIdx = 0; ulIdx < NUM_INTERRUPTS; ulIdx++)
        {
            g_pfnRAMVectors[ulIdx] = (void (*)(void))HWREG((ulIdx * 4) +
                                                     ulValue);
        }
        HWREG(NVIC_VTABLE) = (unsigned long)g_pfnRAMVectors;
    }
    g_pfnRAMVectors[ulInterrupt] = pfnHandler;
}