summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2007-03-08 22:34:02 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2007-03-08 22:34:02 +0000
commit49737fea1face763babc39b5b6a547157d7131f0 (patch)
treef2fa344d78e3a37689a7fc509c37f393295198ee
parenta8872bea509f507b8f595e210e49fd06d8aa0d49 (diff)
downloadpx4-nuttx-49737fea1face763babc39b5b6a547157d7131f0.tar.gz
px4-nuttx-49737fea1face763babc39b5b6a547157d7131f0.tar.bz2
px4-nuttx-49737fea1face763babc39b5b6a547157d7131f0.zip
Fixed some interrupt-related bugs
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@45 42af7a65-404d-4744-a932-0658087f49c3
-rw-r--r--nuttx/arch/c5471/src/up_assert.c8
-rw-r--r--nuttx/arch/c5471/src/up_idle.c7
-rw-r--r--nuttx/arch/c5471/src/up_initialize.c2
-rw-r--r--nuttx/arch/c5471/src/up_internal.h4
-rw-r--r--nuttx/arch/c5471/src/up_serial.c12
-rw-r--r--nuttx/arch/c5471/src/up_timerisr.c20
-rw-r--r--nuttx/arch/c5471/src/up_vectors.S22
7 files changed, 33 insertions, 42 deletions
diff --git a/nuttx/arch/c5471/src/up_assert.c b/nuttx/arch/c5471/src/up_assert.c
index 570a80ad6..678bb4f27 100644
--- a/nuttx/arch/c5471/src/up_assert.c
+++ b/nuttx/arch/c5471/src/up_assert.c
@@ -155,10 +155,10 @@ void up_assert(const ubyte *filename, int lineno)
up_ledon(LED_ASSERTION);
#if CONFIG_TASK_NAME_SIZE > 0
- dbg("Assertion failed at file:%s line: %d task: %s\n",
+ lldbg("Assertion failed at file:%s line: %d task: %s\n",
filename, lineno, rtcb->name);
#else
- dbg("Assertion failed at file:%s line: %d\n",
+ lldbg("Assertion failed at file:%s line: %d\n",
filename, lineno);
#endif
up_stackdump();
@@ -177,10 +177,10 @@ void up_assert_code(const ubyte *filename, int lineno, int errorcode)
up_ledon(LED_ASSERTION);
#if CONFIG_TASK_NAME_SIZE > 0
- dbg("Assertion failed at file:%s line: %d task: %s error code: %d\n",
+ lldbg("Assertion failed at file:%s line: %d task: %s error code: %d\n",
filename, lineno, rtcb->name, errorcode);
#else
- dbg("Assertion failed at file:%s line: %d error code: %d\n",
+ lldbg("Assertion failed at file:%s line: %d error code: %d\n",
filename, lineno, errorcode);
#endif
up_stackdump();
diff --git a/nuttx/arch/c5471/src/up_idle.c b/nuttx/arch/c5471/src/up_idle.c
index 3ec71e50e..9a6bc9900 100644
--- a/nuttx/arch/c5471/src/up_idle.c
+++ b/nuttx/arch/c5471/src/up_idle.c
@@ -75,9 +75,10 @@
void up_idle(void)
{
-#ifdef CONFIG_SUPPRESS_INTERRUPTS
- /* If the system is idle, then process "fake" timer interrupts.
- * Hopefully, something will wake up.
+#if defined(CONFIG_SUPPRESS_INTERRUPTS) || defined(CONFIG_SUPPRESS_TIMER_INTS)
+ /* If the system is idle and there are no timer interrupts,
+ * then process "fake" timer interrupts. Hopefully, something
+ * will wake up.
*/
sched_process_timer();
diff --git a/nuttx/arch/c5471/src/up_initialize.c b/nuttx/arch/c5471/src/up_initialize.c
index 6ae3f0de3..04ca68914 100644
--- a/nuttx/arch/c5471/src/up_initialize.c
+++ b/nuttx/arch/c5471/src/up_initialize.c
@@ -88,7 +88,7 @@ void up_initialize(void)
/* Initialize the system timer interrupt */
-#ifndef CONFIG_SUPPRESS_INTERRUPTS
+#if !defined(CONFIG_SUPPRESS_INTERRUPTS) && !defined(CONFIG_SUPPRESS_TIMER_INTS)
up_timerinit();
#endif
diff --git a/nuttx/arch/c5471/src/up_internal.h b/nuttx/arch/c5471/src/up_internal.h
index a5eb40ae8..46f936f25 100644
--- a/nuttx/arch/c5471/src/up_internal.h
+++ b/nuttx/arch/c5471/src/up_internal.h
@@ -49,7 +49,9 @@
* board bring-up and not part of normal platform configuration.
*/
-#define CONFIG_SUPPRESS_INTERRUPTS 1 /* Do not enable interrupts */
+#undef CONFIG_SUPPRESS_INTERRUPTS /* Do not enable interrupts */
+#define CONFIG_SUPPRESS_TIMER_INTS 1 /* No timer */
+#define CONFIG_SUPPRESS_SERIAL_INTS 1 /* Console will poll */
#undef CONFIG_SUPPRESS_UART_CONFIG /* Do not reconfig UART */
#define CONFIG_C5471_STACKDUMP 1 /* Dump stack on assertion */
diff --git a/nuttx/arch/c5471/src/up_serial.c b/nuttx/arch/c5471/src/up_serial.c
index d0d5ed6ba..8ab1d6954 100644
--- a/nuttx/arch/c5471/src/up_serial.c
+++ b/nuttx/arch/c5471/src/up_serial.c
@@ -252,14 +252,18 @@ static inline void up_disablerxint(up_dev_t *dev)
static inline void up_enabletxint(up_dev_t *dev)
{
+#ifndef CONFIG_SUPPRESS_SERIAL_INTS
dev->regs.ier |= UART_IER_XmitInt;
up_serialout(dev, UART_IER_OFFS, dev->regs.ier);
+#endif
}
static inline void up_enablerxint(up_dev_t *dev)
{
+#ifndef CONFIG_SUPPRESS_SERIAL_INTS
dev->regs.ier |= UART_IER_RecvInt;
up_serialout(dev, UART_IER_OFFS, dev->regs.ier);
+#endif
}
static inline void up_disableuartint(up_dev_t *dev, uint16 *ier)
@@ -617,7 +621,7 @@ static void up_putxmitchar(up_dev_t *dev, int ch)
{
/* Still no space */
-#ifdef CONFIG_SUPPRESS_INTERRUPTS
+#if defined(CONFIG_SUPPRESS_INTERRUPTS) || defined(CONFIG_SUPPRESS_SERIAL_INTS)
up_waittxfifonotfull(dev);
#else
dev->xmitwaiting = TRUE;
@@ -876,7 +880,7 @@ static ssize_t up_read(struct file *filep, char *buffer, size_t buflen)
}
}
- up_enabletxint(dev);
+ up_enablerxint(dev);
return ret;
}
@@ -1026,8 +1030,10 @@ static int up_open(struct file *filep)
/* Attache and enabled the IRQ */
+#ifndef CONFIG_SUPPRESS_SERIAL_INTS
ret = irq_attach(dev->irq, up_interrupt);
if (ret == OK)
+#endif
{
/* Mark the io buffers empty */
@@ -1038,7 +1044,9 @@ static int up_open(struct file *filep)
/* Finally, enable interrupts */
+#ifndef CONFIG_SUPPRESS_SERIAL_INTS
up_enable_irq(dev->irq);
+#endif
up_enablerxint(dev);
}
irqrestore(flags);
diff --git a/nuttx/arch/c5471/src/up_timerisr.c b/nuttx/arch/c5471/src/up_timerisr.c
index 4e6ad1e93..d3c03a191 100644
--- a/nuttx/arch/c5471/src/up_timerisr.c
+++ b/nuttx/arch/c5471/src/up_timerisr.c
@@ -89,29 +89,9 @@
int up_timerisr(int irq, uint32 *regs)
{
- uint32 *saved_regs;
-
- /* Save the pointer to the interrupted context (exercising some
- * logic for the unexpected case of nested interrupts).
- */
-
- if (!current_regs)
- {
- saved_regs = NULL;
- current_regs = regs;
- }
- else
- {
- saved_regs = current_regs;
- }
-
/* Process timer interrupt */
sched_process_timer();
-
- /* Restore the previous context */
-
- current_regs = saved_regs;
return 0;
}
diff --git a/nuttx/arch/c5471/src/up_vectors.S b/nuttx/arch/c5471/src/up_vectors.S
index 07aab9272..c751cdb4b 100644
--- a/nuttx/arch/c5471/src/up_vectors.S
+++ b/nuttx/arch/c5471/src/up_vectors.S
@@ -50,13 +50,13 @@
************************************************************/
.data
-up_irqtmp:
+g_irqtmp:
.word 0 /* Saved lr */
.word 0 /* Saved spsr */
-up_undeftmp:
+g_undeftmp:
.word 0 /* Saved lr */
.word 0 /* Saved spsr */
-up_aborttmp:
+g_aborttmp:
.word 0 /* Saved lr */
.word 0 /* Saved spsr */
@@ -102,7 +102,7 @@ up_vectorirq:
bic lr, lr, #MODE_MASK /* Keep F and T bits */
orr lr, lr, #I_BIT | SVC_MODE
- msr spsr_c, lr /* Swith to SVC mode */
+ msr cpsr, lr /* Swith to SVC mode */
/* Create a context structure */
@@ -156,7 +156,7 @@ up_vectorirq:
ldmia sp, {r0-r15}^ /* Return */
.Lirqtmp:
- .word up_irqtmp
+ .word g_irqtmp
.align 5
@@ -231,7 +231,7 @@ up_vectordata:
bic lr, lr, #MODE_MASK /* Keep F and T bits */
orr lr, lr, #I_BIT | SVC_MODE
- msr spsr_c, lr /* Swith to SVC mode */
+ msr cpsr, lr /* Swith to SVC mode */
/* Create a context structure */
@@ -257,7 +257,7 @@ up_vectordata:
ldmia sp, {r0-r15}^ /* Return */
.Ldaborttmp:
- .word up_aborttmp
+ .word g_aborttmp
.align 5
@@ -286,7 +286,7 @@ up_vectorprefetch:
bic lr, lr, #MODE_MASK /* Keep F and T bits */
orr lr, lr, #I_BIT | SVC_MODE
- msr spsr_c, lr /* Swith to SVC mode */
+ msr cpsr, lr /* Swith to SVC mode */
/* Create a context structure */
@@ -312,7 +312,7 @@ up_vectorprefetch:
ldmia sp, {r0-r15}^ /* Return */
.Lpaborttmp:
- .word up_aborttmp
+ .word g_aborttmp
.align 5
@@ -341,7 +341,7 @@ up_vectorundefinsn:
bic lr, lr, #MODE_MASK /* Keep F and T bits */
orr lr, lr, #I_BIT | SVC_MODE
- msr spsr_c, lr /* Swith to SVC mode */
+ msr cpsr, lr /* Swith to SVC mode */
/* Create a context structure */
@@ -367,7 +367,7 @@ up_vectorundefinsn:
ldmia sp, {r0-r15}^ /* Return */
.Lundeftmp:
- .word up_undeftmp
+ .word g_undeftmp
.align 5