summaryrefslogtreecommitdiff
path: root/nuttx/arch/c5471/src
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2007-03-07 23:34:48 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2007-03-07 23:34:48 +0000
commit2ec8b9a0f5c8b7e7590cc5a7cc793eb249f449fe (patch)
tree0657bd5d2fe69185a4439dc25ed1b5a725878d97 /nuttx/arch/c5471/src
parent1f754edf772673bababe1dc42dad095208525230 (diff)
downloadpx4-nuttx-2ec8b9a0f5c8b7e7590cc5a7cc793eb249f449fe.tar.gz
px4-nuttx-2ec8b9a0f5c8b7e7590cc5a7cc793eb249f449fe.tar.bz2
px4-nuttx-2ec8b9a0f5c8b7e7590cc5a7cc793eb249f449fe.zip
Working with c5471 interrupts
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@42 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/arch/c5471/src')
-rw-r--r--nuttx/arch/c5471/src/up_assert.c22
-rw-r--r--nuttx/arch/c5471/src/up_doirq.c6
-rw-r--r--nuttx/arch/c5471/src/up_idle.c7
-rw-r--r--nuttx/arch/c5471/src/up_internal.h2
-rw-r--r--nuttx/arch/c5471/src/up_irq.c1
-rw-r--r--nuttx/arch/c5471/src/up_serial.c5
-rw-r--r--nuttx/arch/c5471/src/up_vectors.S6
7 files changed, 41 insertions, 8 deletions
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)
*/