Forum Discussion

DRaja2's avatar
DRaja2
Icon for New Contributor rankNew Contributor
7 years ago

UART interrupt using alt_ic_isr_register

I am trying to write a simple interrupt service routine for UART. MY code is as follows:

in main function:

alt_ic_isr_register(UART_0_IRQ_INTERRUPT_CONTROLLER_ID,

UART_0_IRQ,

&receive_data,

uart_capture_ptr,

0x0);

ISR function

static void receive_data(void* context)

{

// put new char into buffer from UART

volatile int *uart_capture_ptr = (volatile int*) context;

// Store the value in the Buttons edge capture register in *context.

*uart_capture_ptr = IORD_8DIRECT(UART_0_BASE, 0x0);

// Reset the Buttons edge capture register.

IOWR_16DIRECT(PIO_0_BASE, 0, (alt_16)uart_capture_ptr);

}

The program builds but seems to terminate upon the initialisation of the isr (i.e whilst executing the alt_ic_isr_register function). Does anyone know why this is the case and how I should fix it?