diff options
author | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2007-03-05 14:38:43 +0000 |
---|---|---|
committer | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2007-03-05 14:38:43 +0000 |
commit | 152b278e70541d86a06e76c25f37c9588526c6fa (patch) | |
tree | 4008aa82fd18b0e9af796a06428e137a283c74a4 /nuttx/arch/pjrc-8051/src | |
parent | d2acb6aaa8d4d69a5b19d4f94e8a68b300693562 (diff) | |
download | px4-nuttx-152b278e70541d86a06e76c25f37c9588526c6fa.tar.gz px4-nuttx-152b278e70541d86a06e76c25f37c9588526c6fa.tar.bz2 px4-nuttx-152b278e70541d86a06e76c25f37c9588526c6fa.zip |
Fix some interrupt handling issues
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@37 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/arch/pjrc-8051/src')
-rw-r--r-- | nuttx/arch/pjrc-8051/src/up_head.S | 11 | ||||
-rw-r--r-- | nuttx/arch/pjrc-8051/src/up_irq.c | 48 |
2 files changed, 16 insertions, 43 deletions
diff --git a/nuttx/arch/pjrc-8051/src/up_head.S b/nuttx/arch/pjrc-8051/src/up_head.S index 4aecda48a..662b6b18e 100644 --- a/nuttx/arch/pjrc-8051/src/up_head.S +++ b/nuttx/arch/pjrc-8051/src/up_head.S @@ -84,37 +84,31 @@ .org PM2_VECTOR_EXTINT0 push acc - push ie mov a, #EXT_INT0_IRQ ljmp _up_interrupt .org PM2_VECTOR_TIMER0 push acc - push ie mov a, #TIMER0_IRQ ljmp _up_interrupt .org PM2_VECTOR_EXTINT1 push acc - push ie mov a, #EXT_INT1_IRQ ljmp _up_interrupt .org PM2_VECTOR_TIMER1 push acc - push ie mov a, #TIMER1_IRQ ljmp _up_interrupt .org PM2_VECTOR_UART push acc - push ie mov a, #UART_IRQ ljmp _up_interrupt .org PM2_VECTOR_TIMER2 push acc - push ie mov a, #TIMER2_IRQ ljmp _up_interrupt @@ -136,7 +130,7 @@ start: * Description: * All interrupts vector to this point with: * - * (1) acc and ie on the stack and + * (1) acc on the stack and * (2) the IRQ number in the accumulator * ************************************************************/ @@ -151,9 +145,8 @@ _up_interrupt: ar0 = 0x00 ar1 = 0x01 - /* Push ACC and IE. Then disable interrupts */ + /* ACC already on the stack; push IE. Then disable interrupts */ - push acc push ie clr ea diff --git a/nuttx/arch/pjrc-8051/src/up_irq.c b/nuttx/arch/pjrc-8051/src/up_irq.c index c524fe3e7..772623167 100644 --- a/nuttx/arch/pjrc-8051/src/up_irq.c +++ b/nuttx/arch/pjrc-8051/src/up_irq.c @@ -40,6 +40,7 @@ #include <nuttx/config.h> #include <sys/types.h> #include <nuttx/irq.h> +#include <8052.h> #include "up_internal.h" /************************************************************ @@ -68,6 +69,11 @@ void up_irqinitialize(void) { + /* Enable interrupts globally, but disable all interrupt + * sources. + */ + + IE = 0x80; } /************************************************************ @@ -78,13 +84,11 @@ void up_irqinitialize(void) * ************************************************************/ -irqstate_t irqsave(void) _naked +irqstate_t irqsave(void) { - _asm - mov ie, dpl - clr ea - ret - _endasm; + irqstate_t ret = IE; + EA = 0; + return ret; } /************************************************************ @@ -95,13 +99,9 @@ irqstate_t irqsave(void) _naked * ************************************************************/ -void irqrestore(irqstate_t flags) __naked +void irqrestore(irqstate_t flags) { - flags; /* Avoid compiler warning about unused argument */ - _asm - mov ie, dpl - ret - _endasm; + IE = flags; } /************************************************************ @@ -112,21 +112,11 @@ void irqrestore(irqstate_t flags) __naked * ************************************************************/ -static void _up_disable_irq(ubyte iebit) __naked -{ - _asm - mov a, ie - orl a, dpl - mov ie, a - ret - _endasm; -} - void up_disable_irq(int irq) { if ((unsigned)irq < NR_IRQS) { - _up_disable_irq(1 << irq); + IE |= (1 << irq); } } @@ -138,20 +128,10 @@ void up_disable_irq(int irq) * ************************************************************/ -static void _up_enable_irq(ubyte iebit) __naked -{ - _asm - mov a, ie - anl a, dpl - mov ie, a - ret - _endasm; -} - void up_enable_irq(int irq) { if ((unsigned)irq < NR_IRQS) { - _up_enable_irq(~(1 << irq)); + IE &= ~(1 << irq); } } |