Altera_Forum
Honored Contributor
16 years agoInterrupt Problem
Currently i am working on low level driver for Nand Flash in NIOS II.In my system following component are included DDR_SDRAM,JTAG_UART,PERFORMANCE COUNTER,PIO(LED),NFC(Nand flash controller).In my sytem i use interrupt on PIO Base.
in my low level API like read and write i use it as following code. write() { //data write code //enable NFC while(intrstat == 0); intrstat = 0;//globel variable } read() { //data read code //enable NFC while(intrstat == 0); intrstat = 0; } main() { IOWR(LED_BASE,0,0); alt_irq_register(NFC_IRQ,edge_capture_ptr,handle_nfc_interrupts); alt_irq_enable(NFC_BASE); write(); read(); } static void handle_nfc_interrupts(void* context, alt_u32 id) { volatile int* irq_capture_ptr = (volatile int*) context; printf("Into the nfc_handler:\n"); alt_irq_disable(NFC_BASE); IORD(NFC_BASE,NFC_STATUS); IOWR(LED_BASE,0,1); intrstat = 1; alt_irq_enable(NFC_BASE); } my problem is when i call the write or read API it goes in infinite loop and also not call the ISR for it.so pls give me help what change i needed in above code..............