diff options
-rw-r--r-- | nuttx/arch/c5471/include/irq.h | 2 | ||||
-rw-r--r-- | nuttx/arch/c5471/src/up_assert.c | 22 | ||||
-rw-r--r-- | nuttx/arch/c5471/src/up_doirq.c | 6 | ||||
-rw-r--r-- | nuttx/arch/c5471/src/up_idle.c | 7 | ||||
-rw-r--r-- | nuttx/arch/c5471/src/up_internal.h | 2 | ||||
-rw-r--r-- | nuttx/arch/c5471/src/up_irq.c | 1 | ||||
-rw-r--r-- | nuttx/arch/c5471/src/up_serial.c | 5 | ||||
-rw-r--r-- | nuttx/arch/c5471/src/up_vectors.S | 6 | ||||
-rw-r--r-- | nuttx/arch/sim/src/up_idle.c | 4 | ||||
-rw-r--r-- | nuttx/examples/ostest/cancel.c | 1 |
10 files changed, 44 insertions, 12 deletions
diff --git a/nuttx/arch/c5471/include/irq.h b/nuttx/arch/c5471/include/irq.h index c6a89e951..051848ba5 100644 --- a/nuttx/arch/c5471/include/irq.h +++ b/nuttx/arch/c5471/include/irq.h @@ -212,7 +212,7 @@ static inline void system_call(swint_t func, int parm1, "mov\tr0,%0\n\t" "mov\tr1,%1\n\t" "mov\tr2,%2\n\t" - "mov\tr2,%3\n\t" + "mov\tr3,%3\n\t" "swi\t0x900001\n\t" : : "r" ((long)(func)), "r" ((long)(parm1)), diff --git a/nuttx/arch/c5471/src/up_assert.c b/nuttx/arch/c5471/src/up_assert.c index 8b70349f4..49754088a 100644 --- a/nuttx/arch/c5471/src/up_assert.c +++ b/nuttx/arch/c5471/src/up_assert.c @@ -42,6 +42,9 @@ #include <stdlib.h> #include <assert.h> #include <debug.h> +#include <nuttx/irq.h> +#include "os_internal.h" +#include "up_internal.h" /************************************************************ * Definitions @@ -55,6 +58,21 @@ * Private Functions ************************************************************/ +static void _up_assert(int errorcode) /* __attribute__ ((noreturn)) */ +{ + /* Are we in an interrupt handler or the idle task? */ + + if (current_regs || ((_TCB*)g_readytorun.head)->pid == 0) + { + (void)irqsave(); + for(;;); + } + else + { + exit(errorcode); + } +} + /************************************************************ * Public Funtions ************************************************************/ @@ -67,7 +85,7 @@ void up_assert(const ubyte *filename, int lineno) { dbg("Assertion failed at file:%s line: %d\n", filename, lineno); - exit(EXIT_FAILURE); + _up_assert(EXIT_FAILURE); } /************************************************************ @@ -78,5 +96,5 @@ void up_assert_code(const ubyte *filename, int lineno, int errorcode) { dbg("Assertion failed at file:%s line: %d error code: %d\n", filename, lineno, errorcode); - exit(errorcode); + _up_assert(errorcode); } diff --git a/nuttx/arch/c5471/src/up_doirq.c b/nuttx/arch/c5471/src/up_doirq.c index 339b28596..48cbd3e4a 100644 --- a/nuttx/arch/c5471/src/up_doirq.c +++ b/nuttx/arch/c5471/src/up_doirq.c @@ -41,7 +41,9 @@ #include <sys/types.h> #include <nuttx/irq.h> #include <nuttx/arch.h> +#include <assert.h> #include "c5471.h" +#include "os_internal.h" #include "up_internal.h" /************************************************************ @@ -66,6 +68,9 @@ void up_doirq(int irq, uint32* regs) { +#ifdef CONFIG_SUPPRESS_INTERRUPTS + PANIC(OSERR_ERREXCEPTION); +#else if ((unsigned)irq < NR_IRQS) { /* Mask and acknowledge the interrupt */ @@ -80,4 +85,5 @@ void up_doirq(int irq, uint32* regs) up_enable_irq(irq); } +#endif } diff --git a/nuttx/arch/c5471/src/up_idle.c b/nuttx/arch/c5471/src/up_idle.c index 46177a3de..3ec71e50e 100644 --- a/nuttx/arch/c5471/src/up_idle.c +++ b/nuttx/arch/c5471/src/up_idle.c @@ -75,5 +75,12 @@ void up_idle(void) { +#ifdef CONFIG_SUPPRESS_INTERRUPTS + /* If the system is idle, then process "fake" timer interrupts. + * Hopefully, something will wake up. + */ + + sched_process_timer(); +#endif } diff --git a/nuttx/arch/c5471/src/up_internal.h b/nuttx/arch/c5471/src/up_internal.h index 7563a15fc..0c03967c0 100644 --- a/nuttx/arch/c5471/src/up_internal.h +++ b/nuttx/arch/c5471/src/up_internal.h @@ -47,7 +47,7 @@ /* Bring-up debug configurations */ #define CONFIG_SUPPRESS_INTERRUPTS 1 /* Do not enable interrupts */ -#define CONFIG_SUPPRESS_UART_CONFIG 1 /* Do not reconfig UART */ +#undef CONFIG_SUPPRESS_UART_CONFIG /* Do not reconfig UART */ /************************************************************ * Public Types diff --git a/nuttx/arch/c5471/src/up_irq.c b/nuttx/arch/c5471/src/up_irq.c index 6b981c99a..fabd47b26 100644 --- a/nuttx/arch/c5471/src/up_irq.c +++ b/nuttx/arch/c5471/src/up_irq.c @@ -136,6 +136,7 @@ static inline void up_vectorinitialize(void) up_vector_t *src = g_vectorinittab; up_vector_t *dest = (up_vector_t*)&_svectors; int i; + for (i = 0; i < NVECTORS; i++) { *dest++ = *src++; diff --git a/nuttx/arch/c5471/src/up_serial.c b/nuttx/arch/c5471/src/up_serial.c index 7bd90ef11..faaf7aeed 100644 --- a/nuttx/arch/c5471/src/up_serial.c +++ b/nuttx/arch/c5471/src/up_serial.c @@ -96,8 +96,8 @@ struct up_dev_s ubyte xmit_fifo_size; /* Size of transmit FIFO */ ubyte irq; /* IRQ associated with * this UART */ - boolean parity; /* 0=none, 1=odd, 2=even */ - boolean bits; /* Number of bits (7 or 8) */ + ubyte parity; /* 0=none, 1=odd, 2=even */ + ubyte bits; /* Number of bits (7 or 8) */ #ifdef CONFIG_UART_HWFLOWCONTROL boolean flowcontrol; /* TRUE: Hardware flow control * is enabled. */ @@ -1140,3 +1140,4 @@ int up_putc(int ch) up_restoreuartint(&CONSOLE_DEV, ier); return ch; } + diff --git a/nuttx/arch/c5471/src/up_vectors.S b/nuttx/arch/c5471/src/up_vectors.S index 110fcce69..07aab9272 100644 --- a/nuttx/arch/c5471/src/up_vectors.S +++ b/nuttx/arch/c5471/src/up_vectors.S @@ -141,7 +141,7 @@ up_vectorirq: * no pending interrupt */ .Lhaveirq: #endif - /* Then call the data abort handler with interrupt disabled. + /* Then call the IRQ handler with interrupt disabled. * rq_dispatch(int irq, struct xcptcontext *xcp) */ @@ -297,7 +297,7 @@ up_vectorprefetch: add r0, sp, #(4*REG_PC) /* Offset to pc, cpsr storage */ stmia r0, {r1, r2} - /* Then call the data abort handler with interrupt disabled. + /* Then call the prefetch abort handler with interrupt disabled. * void up_prefetchabort(struct xcptcontext *xcp) */ @@ -352,7 +352,7 @@ up_vectorundefinsn: add r0, sp, #(4*REG_PC) /* Offset to pc, cpsr storage */ stmia r0, {r1, r2} - /* Then call the data abort handler with interrupt disabled. + /* Then call the undef insn handler with interrupt disabled. * void up_undefinedinsn(struct xcptcontext *xcp) */ diff --git a/nuttx/arch/sim/src/up_idle.c b/nuttx/arch/sim/src/up_idle.c index b40b2e3d8..3ca8c094a 100644 --- a/nuttx/arch/sim/src/up_idle.c +++ b/nuttx/arch/sim/src/up_idle.c @@ -75,8 +75,8 @@ void up_idle(void) { - /* If the system, then process timer interrupts. Hopefully - * something will wake up. + /* If the system is idle, then process "fake" timer interrupts. + * Hopefully, something will wake up. */ sched_process_timer(); diff --git a/nuttx/examples/ostest/cancel.c b/nuttx/examples/ostest/cancel.c index c6803c048..2bd08da24 100644 --- a/nuttx/examples/ostest/cancel.c +++ b/nuttx/examples/ostest/cancel.c @@ -150,7 +150,6 @@ static void start_thread(pthread_t *waiter, int cancelable) printf("start_thread: Yielding\n"); pthread_yield(); - } static void restart_thread(pthread_t *waiter, int cancelable) |