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