So, I managed to fish out this line from APP_isrUart(void) in the file uart.c from JN-AN-1217.
unsigned int irq = ((*((volatile uint32 *)(UART_START_ADR + 0x08))) >> 1) & 0x0007;
To setup UART1, it is just UART_START_ADR -> UART1_START_ADR as written in the same uart.c file.
Now, how do I do the same for SPI ?
What should the settings be ?
What does (UART_START_ADR + 0x08))) >> 1) & 0x0007; do ? How should it be for SPI or any other peripheral that has interrupts ?
Hi Lim CB,
The recommended way to handle an SPI interrupt is by configuring a callback function using vAHI_SpiRegisterCallback(PR_HWINT_APPCALLBACK prSpiCallback) for an SPI Master or
vAHI_SpiSlaveRegisterCallback(PR_HWINT_APPCALLBACK prSpiCallback) for an SPI Slave.
The callback function prototype should be in the form of void SpiCallback(uint32 u32DeviceId, uint32 u32ItemBitmap) and will be automatically called when an interrupt of the type E_AHI_DEVICE_SPIM or E_AHI_DEVICE_SPIS occurs respectively.
The callback function parameter u32DeviceId identifies the peripheral that generated the interrupt and u32ItemBitmap is a bitmap that identifies the specific cause of the interrupt. These can then be used to handle each interrupt appropriately in the application.
The same method is used to handle most of the other peripheral interrupts using peripheral-specific
callback functions of the same form (e.g. vAHI_Timer0RegisterCallback(PR_HWINT_APPCALLBACK PrTimer0Callback)). Further details on peripheral interrupt handling can be found in Appendix A and Appendix B, JN516x Integrated Peripherals API User Guide, JN-UG-3087.
Regards,
Mario