diff options
Diffstat (limited to 'nuttx/configs/z80sim/src/z80_decodeirq.c')
-rw-r--r-- | nuttx/configs/z80sim/src/z80_decodeirq.c | 56 |
1 files changed, 19 insertions, 37 deletions
diff --git a/nuttx/configs/z80sim/src/z80_decodeirq.c b/nuttx/configs/z80sim/src/z80_decodeirq.c index d4faf0f89..c1acfffb9 100644 --- a/nuttx/configs/z80sim/src/z80_decodeirq.c +++ b/nuttx/configs/z80sim/src/z80_decodeirq.c @@ -1,5 +1,5 @@ /******************************************************************************** - * z80/z80_decodeirq.c + * board/z80_decodeirq.c * * Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <spudmonkey@racsa.co.cr> @@ -38,12 +38,13 @@ ********************************************************************************/ #include <nuttx/config.h> + #include <sys/types.h> #include <nuttx/irq.h> #include <nuttx/arch.h> #include <assert.h> #include <debug.h> -#include "up_arch.h" + #include "os_internal.h" #include "up_internal.h" @@ -64,56 +65,37 @@ ********************************************************************************/ /******************************************************************************** - * Public Funtions + * Public Functions ********************************************************************************/ -void up_decodeirq(uint16* regs) +FAR chipreg_t *up_decodeirq(FAR chipreg_t *regs) { #ifdef CONFIG_SUPPRESS_INTERRUPTS + lib_lowprintf("Unexpected IRQ\n"); current_regs = regs; PANIC(OSERR_ERREXCEPTION); -#else - /* Decode the interrupt. First, fetch the interrupt id register. */ - - uint16 irqentry = getreg16(DM320_INTC_IRQENTRY0); - - /* The irqentry value is an offset into a table. Zero means no interrupt. */ + return NULL; /* Won't get here */ - if (irqentry != 0) - { - /* If non-zero, then we can map the table offset into an IRQ number */ - - int irq = (irqentry >> 2) - 1; - - /* Verify that the resulting IRQ number is valie */ - - if ((unsigned)irq < NR_IRQS) - { - /* Mask and acknowledge the interrupt */ - - up_maskack_irq(irq); +#else - /* Current regs non-zero indicates that we are processing an interrupt; - * current_regs is also used to manage interrupt level context switches. - */ + /* Current regs non-zero indicates that we are processing an interrupt; + * current_regs is also used to manage interrupt level context switches. + */ - current_regs = regs; + current_regs = regs; - /* Deliver the IRQ */ + /* Deliver the IRQ -- the simulation supports only timer interrupts */ - irq_dispatch(irq, regs); + irq_dispatch(Z80_IRQ_SYSTIMER, regs); - /* Indicate that we are no long in an interrupt handler */ + /* If a context switch occurred, current_regs will hold the new context */ - current_regs = NULL; + regs = current_regs; - /* Unmask the last interrupt (global interrupts are still - * disabled. - */ + /* Indicate that we are no long in an interrupt handler */ - up_enable_irq(irq); - } - } + current_regs = NULL; + return regs; #endif } |