diff --git a/arch/c5471/include/irq.h b/arch/c5471/include/irq.h index c6a89e9511a..051848ba506 100644 --- a/arch/c5471/include/irq.h +++ b/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/arch/c5471/src/up_assert.c b/arch/c5471/src/up_assert.c index 8b70349f47e..49754088a87 100644 --- a/arch/c5471/src/up_assert.c +++ b/arch/c5471/src/up_assert.c @@ -42,6 +42,9 @@ #include #include #include +#include +#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/arch/c5471/src/up_doirq.c b/arch/c5471/src/up_doirq.c index 339b2859661..48cbd3e4ad8 100644 --- a/arch/c5471/src/up_doirq.c +++ b/arch/c5471/src/up_doirq.c @@ -41,7 +41,9 @@ #include #include #include +#include #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/arch/c5471/src/up_idle.c b/arch/c5471/src/up_idle.c index 46177a3de8f..3ec71e50e03 100644 --- a/arch/c5471/src/up_idle.c +++ b/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/arch/c5471/src/up_internal.h b/arch/c5471/src/up_internal.h index 7563a15fcd3..0c03967c044 100644 --- a/arch/c5471/src/up_internal.h +++ b/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/arch/c5471/src/up_irq.c b/arch/c5471/src/up_irq.c index 6b981c99a53..fabd47b26c4 100644 --- a/arch/c5471/src/up_irq.c +++ b/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/arch/c5471/src/up_serial.c b/arch/c5471/src/up_serial.c index 7bd90ef1117..faaf7aeed2f 100644 --- a/arch/c5471/src/up_serial.c +++ b/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/arch/c5471/src/up_vectors.S b/arch/c5471/src/up_vectors.S index 110fcce6934..07aab9272a7 100644 --- a/arch/c5471/src/up_vectors.S +++ b/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/arch/sim/src/up_idle.c b/arch/sim/src/up_idle.c index b40b2e3d87b..3ca8c094a47 100644 --- a/arch/sim/src/up_idle.c +++ b/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();