Fix some interrupt handling issues
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@37 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
parent
eaa8134b71
commit
d62a01ebfa
@ -142,8 +142,8 @@ extern "C" {
|
||||
#define EXTERN extern
|
||||
#endif
|
||||
|
||||
EXTERN irqstate_t irqsave(void) __naked;
|
||||
EXTERN void irqrestore(irqstate_t flags) __naked;
|
||||
EXTERN irqstate_t irqsave(void);
|
||||
EXTERN void irqrestore(irqstate_t flags);
|
||||
|
||||
#undef EXTERN
|
||||
#ifdef __cplusplus
|
||||
|
@ -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
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user