void
Delay(uint32_t ui32Seconds)
{
//
// Loop while there are more seconds to wait.
//
while(ui32Seconds--)
{
//
// Wait until the SysTick value is less than 1000.
//
while(ROM_SysTickValueGet() > 1000)
{
}
//
// Wait until the SysTick value is greater than 1000.
//
while(ROM_SysTickValueGet() < 1000)
{
}
}
}
//*****************************************************************************
//
// Display the interrupt state on the UART. The currently active and pending
// interrupts are displayed.
//
//*****************************************************************************
void
DisplayIntStatus(void)
{
uint32_t ui32Temp;
//
// Display the currently active interrupts.
//
ui32Temp = HWREG(NVIC_ACTIVE0);
UARTprintf("\rActive: %c%c%c ", (ui32Temp & 1) ? '1' : ' ',
(ui32Temp & 2) ? '2' : ' ', (ui32Temp & 4) ? '3' : ' ');
//
// Display the currently pending interrupts.
//
ui32Temp = HWREG(NVIC_PEND0);
UARTprintf("Pending: %c%c%c", (ui32Temp & 1) ? '1' : ' ',
(ui32Temp & 2) ? '2' : ' ', (ui32Temp & 4) ? '3' : ' ');
}
//*****************************************************************************
//
// This is the handler for INT_GPIOA. It simply saves the interrupt sequence
// number.
//
//*****************************************************************************
void
IntGPIOa(void)
{
//
// Set PE1 high to indicate entry to this interrupt handler.
//
ROM_GPIOPinWrite(GPIO_PORTE_BASE, GPIO_PIN_1, GPIO_PIN_1);
//
// Put the current interrupt state on the display.
//
DisplayIntStatus();
//
// Wait two seconds.
//
Delay(2);
//
// Save and increment the interrupt sequence number.
//
g_ui32GPIOa = g_ui32Index++;
//
// Set PE1 low to indicate exit from this interrupt handler.
//
ROM_GPIOPinWrite(GPIO_PORTE_BASE, GPIO_PIN_1, 0);
}
//*****************************************************************************
//
// This is the handler for INT_GPIOB. It triggers INT_GPIOA and saves the
// interrupt sequence number.
//
//*****************************************************************************
void
IntGPIOb(void)
{
//
// Set PE2 high to indicate entry to this interrupt handler.
//
ROM_GPIOPinWrite(GPIO_PORTE_BASE, GPIO_PIN_2, GPIO_PIN_2);
//
// Put the current interrupt state on the display.
//
DisplayIntStatus();