diff options
author | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2011-04-06 23:01:06 +0000 |
---|---|---|
committer | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2011-04-06 23:01:06 +0000 |
commit | 8285ffad2245a53de14c65913b00dab5568f0afc (patch) | |
tree | a4707d8f1e51d31b1fc2866c63260bfbf99b1f34 /nuttx/arch/z16/src | |
parent | dcea5f0360725d2c25b61eefe9db7b2474b26dd6 (diff) | |
download | px4-nuttx-8285ffad2245a53de14c65913b00dab5568f0afc.tar.gz px4-nuttx-8285ffad2245a53de14c65913b00dab5568f0afc.tar.bz2 px4-nuttx-8285ffad2245a53de14c65913b00dab5568f0afc.zip |
current_regs should be volatile; add support for nested interrupts; enable interrupts during syscall processing
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@3475 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/arch/z16/src')
-rw-r--r-- | nuttx/arch/z16/src/common/up_doirq.c | 40 | ||||
-rw-r--r-- | nuttx/arch/z16/src/common/up_initialize.c | 4 | ||||
-rw-r--r-- | nuttx/arch/z16/src/common/up_internal.h | 6 |
3 files changed, 28 insertions, 22 deletions
diff --git a/nuttx/arch/z16/src/common/up_doirq.c b/nuttx/arch/z16/src/common/up_doirq.c index e7e43b24d..3adddf6db 100644 --- a/nuttx/arch/z16/src/common/up_doirq.c +++ b/nuttx/arch/z16/src/common/up_doirq.c @@ -1,7 +1,7 @@ /**************************************************************************** * common/up_doirq.c * - * Copyright (C) 2008-2009 Gregory Nutt. All rights reserved. + * Copyright (C) 2008-2009, 2011 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <spudmonkey@racsa.co.cr> * * Redistribution and use in source and binary forms, with or without @@ -88,31 +88,37 @@ FAR chipreg_t *up_doirq(int irq, FAR chipreg_t *regs) #else if ((unsigned)irq < NR_IRQS) { - /* Current regs non-zero indicates that we are processing - * an interrupt; current_regs is also used to manage - * interrupt level context switches. - */ + FAR chipreg_t *savestate; - current_regs = regs; + /* Current regs non-zero indicates that we are processing + * an interrupt; current_regs is also used to manage + * interrupt level context switches. + */ - /* Mask and acknowledge the interrupt */ + savestate = (uint32_t*)current_regs; + current_regs = regs; - up_maskack_irq(irq); + /* Mask and acknowledge the interrupt */ - /* Deliver the IRQ */ + up_maskack_irq(irq); - irq_dispatch(irq, regs); + /* Deliver the IRQ */ - /* Indicate that we are no long in an interrupt handler */ + irq_dispatch(irq, regs); - ret = current_regs; - current_regs = NULL; + /* Restore the previous value of current_regs. NULL would indicate that + * we are no longer in an interrupt handler. It will be non-NULL if we + * are returning from a nested interrupt. + */ - /* Unmask the last interrupt (global interrupts are still - * disabled. - */ + ret = current_regs; + current_regs = savestate; - up_enable_irq(irq); + /* Unmask the last interrupt (global interrupts are still + * disabled. + */ + + up_enable_irq(irq); } up_ledoff(LED_INIRQ); #endif diff --git a/nuttx/arch/z16/src/common/up_initialize.c b/nuttx/arch/z16/src/common/up_initialize.c index 2121f73d9..063ccdf71 100644 --- a/nuttx/arch/z16/src/common/up_initialize.c +++ b/nuttx/arch/z16/src/common/up_initialize.c @@ -1,7 +1,7 @@ /**************************************************************************** * common/up_initialize.c * - * Copyright (C) 2008-2009 Gregory Nutt. All rights reserved. + * Copyright (C) 2008-2009, 2011 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <spudmonkey@racsa.co.cr> * * Redistribution and use in source and binary forms, with or without @@ -68,7 +68,7 @@ * interrupt processing. */ -FAR chipreg_t *current_regs; +volatile FAR chipreg_t *current_regs; /**************************************************************************** * Private Types diff --git a/nuttx/arch/z16/src/common/up_internal.h b/nuttx/arch/z16/src/common/up_internal.h index fa527fd62..117d7f405 100644 --- a/nuttx/arch/z16/src/common/up_internal.h +++ b/nuttx/arch/z16/src/common/up_internal.h @@ -1,7 +1,7 @@ /**************************************************************************** * common/up_internal.h * - * Copyright (C) 2008-2009 Gregory Nutt. All rights reserved. + * Copyright (C) 2008-2009, 2011 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <spudmonkey@racsa.co.cr> * * Redistribution and use in source and binary forms, with or without @@ -74,7 +74,7 @@ /* Macros for portability */ #define IN_INTERRUPT (current_regs != NULL) -#define SAVE_IRQCONTEXT(tcb) up_copystate((tcb)->xcp.regs, current_regs) +#define SAVE_IRQCONTEXT(tcb) up_copystate((tcb)->xcp.regs, (FAR chipreg_t*)current_regs) #define SET_IRQCONTEXT(tcb) do { current_regs = (tcb)->xcp.regs; } while (0) #define SAVE_USERCONTEXT(tcb) up_saveusercontext((tcb)->xcp.regs) #define RESTORE_USERCONTEXT(tcb) up_restoreusercontext((tcb)->xcp.regs) @@ -98,7 +98,7 @@ typedef void (*up_vector_t)(void); * interrupt processing. */ -extern FAR chipreg_t *current_regs; +extern voltile FAR chipreg_t *current_regs; #endif /**************************************************************************** |