1) NVIC_EnableIRQ() is defined in core_cm3.h which is included from LPC17xx.h.
2) To make sure the compiler sees your handler, you need to declare it as extern:
extern "C" void ADC_IRQHandler()
{
// handle interrupt
}
3) Alternatively, you can use NVIC_SetVector (declared in cmsis_nvic.h), which relocates exception vectors to RAM and patches the vector with your function:
NVIC_SetVector(ADC_IRQn, (uint32_t)ADC_IRQHandler);
This option also works for 2368 model.
Here's how I did it for the USB host sample:
#ifdef TARGET_LPC2368
NVIC->IntSelect &= ~(1 << USB_IRQn); /* Configure the ISR handler as IRQ */
/* Set the vector address */
NVIC_SetVector(USB_IRQn, (USB_INT32U)USB_IRQHandler);
#endif
NVIC_SetPriority(USB_IRQn, 0); /* highest priority */
/* Enable the USB Interrupt */
NVIC_EnableIRQ(USB_IRQn);
Edit: IRQ handler names are defined in the startup_LPC17xx.s file, the source of which is not provided but you can find a very close (if not the same) copy in the CMSIS package. I previously posted the list of all handler names here.
I am writing a more fully-functioned ADC driver that gets more closer to the hardware so I can work at faster speeds, use interrupts, use burst mode, dma etc.
In some sample code I downloaded from NXP there is a function, NVIC_EnableIRQ(ADC_IRQn). This seems to work for me with the MBED compiler but I have no idea where this function/macro is defined. I just want to understand it a bit better.
Also, nothing runs after ther point where I enable the interrupt. I am guessing this means that I got the interrupt handler name wrong and the interrupt vector is unset. I used ADC_IRQHandler(void). What name should I be using? Where are they defined? I couldn't find them in LPC17xx.h.