From a7835b02521ce565eed9e2f0f6c043f6ee8b8ceb Mon Sep 17 00:00:00 2001 From: patacongo Date: Thu, 10 Mar 2011 23:37:45 +0000 Subject: [PATCH] enable/disable IRQ backward git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@3363 42af7a65-404d-4744-a932-0658087f49c3 --- arch/x86/src/i486/up_irq.c | 25 +++++++++++++++---------- arch/x86/src/i486/up_regdump.c | 2 +- arch/x86/src/qemu/qemu_timerisr.c | 4 +--- 3 files changed, 17 insertions(+), 14 deletions(-) diff --git a/arch/x86/src/i486/up_irq.c b/arch/x86/src/i486/up_irq.c index 33a9130d53..c77936b4f1 100755 --- a/arch/x86/src/i486/up_irq.c +++ b/arch/x86/src/i486/up_irq.c @@ -138,6 +138,11 @@ static void up_remappic(void) idt_outb(0x28, PIC2_ICW2); idt_outb(PIC_ICW3_SID2, PIC2_ICW3); idt_outb(PIC_ICW4_808xMODE, PIC2_ICW4); + + /* Mask interrupts from PIC */ + + idt_outb(PIC1_IMR_ALL, PIC1_IMR); + idt_outb(PIC2_IMR_ALL, PIC2_IMR); } /**************************************************************************** @@ -276,16 +281,16 @@ void up_disable_irq(int irq) unsigned int regaddr; uint8_t regbit; - if ((unsigned)irq >= IRQ0) + if (irq >= IRQ0) { /* Map the IRQ IMR regiser to a PIC and a bit number */ - if ((unsigned)irq <= IRQ7) + if (irq <= IRQ7) { regaddr = PIC1_IMR; regbit = (1 << (irq - IRQ0)); } - else if ((unsigned)irq <= IRQ15) + else if (irq <= IRQ15) { regaddr = PIC2_IMR; regbit = (1 << (irq - IRQ8)); @@ -295,9 +300,9 @@ void up_disable_irq(int irq) return; } - /* Disable the interrupt */ + /* Disable (mask) the interrupt */ - modifyreg8(regaddr, regbit, 0); + modifyreg8(regaddr, 0, regbit); } } @@ -314,16 +319,16 @@ void up_enable_irq(int irq) unsigned int regaddr; uint8_t regbit; - if ((unsigned)irq >= IRQ0) + if (irq >= IRQ0) { /* Map the IRQ IMR regiser to a PIC and a bit number */ - if ((unsigned)irq <= IRQ7) + if (irq <= IRQ7) { regaddr = PIC1_IMR; regbit = (1 << (irq - IRQ0)); } - else if ((unsigned)irq <= IRQ15) + else if (irq <= IRQ15) { regaddr = PIC2_IMR; regbit = (1 << (irq - IRQ8)); @@ -333,9 +338,9 @@ void up_enable_irq(int irq) return; } - /* Enable the interrupt */ + /* Enable (unmask) the interrupt */ - modifyreg8(regaddr, 0, regbit); + modifyreg8(regaddr, regbit, 0); } } diff --git a/arch/x86/src/i486/up_regdump.c b/arch/x86/src/i486/up_regdump.c index 68d31cdce4..5a5da0e70b 100644 --- a/arch/x86/src/i486/up_regdump.c +++ b/arch/x86/src/i486/up_regdump.c @@ -76,7 +76,7 @@ void up_registerdump(uint32_t *regs) regs[REG_EDI], regs[REG_ESI], regs[REG_EBP], regs[REG_ESP]); lldbg("ebx:%08x edx:%08x ecx:%08x eax:%08x\n", regs[REG_EBX], regs[REG_EDX], regs[REG_ECX], regs[REG_EAX]); - lldbg("eip:%08x cs:%08x flg:%08x sp:%08x ss:%08x\n", + lldbg("eip:%08x cs:%08x flg:%08x sp:%08x ss:%08x\n", regs[REG_EIP], regs[REG_CS], regs[REG_EFLAGS], regs[REG_SP], regs[REG_SS]); } diff --git a/arch/x86/src/qemu/qemu_timerisr.c b/arch/x86/src/qemu/qemu_timerisr.c index ca51816af0..531b7d09d9 100755 --- a/arch/x86/src/qemu/qemu_timerisr.c +++ b/arch/x86/src/qemu/qemu_timerisr.c @@ -47,6 +47,7 @@ #include #include +#include #include #include @@ -87,9 +88,6 @@ * Private Function Prototypes ****************************************************************************/ -static void outb(uint8_t val, uint16_t addr) __attribute__((noinline)); -static int up_timerisr(int irq, uint32_t *regs); - /**************************************************************************** * Private Functions ****************************************************************************/