summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2009-06-05 01:42:15 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2009-06-05 01:42:15 +0000
commitacf206fcfba0737d6bccefda54fd442f91f2237e (patch)
tree6a598ec3633b250a76db261fe3bf6d22370dfb08
parente3335f09c0ed2caa078a7dfae1b1af1d61def824 (diff)
downloadnuttx-acf206fcfba0737d6bccefda54fd442f91f2237e.tar.gz
nuttx-acf206fcfba0737d6bccefda54fd442f91f2237e.tar.bz2
nuttx-acf206fcfba0737d6bccefda54fd442f91f2237e.zip
Timer interrupts work; examples/ostest passes
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@1849 42af7a65-404d-4744-a932-0658087f49c3
-rw-r--r--nuttx/ChangeLog6
-rw-r--r--nuttx/Documentation/NuttX.html8
-rw-r--r--nuttx/arch/arm/include/str71x/irq.h2
-rw-r--r--nuttx/arch/arm/src/common/up_exit.c3
-rw-r--r--nuttx/arch/arm/src/str71x/str71x_decodeirq.c16
-rw-r--r--nuttx/arch/arm/src/str71x/str71x_timerisr.c48
-rw-r--r--nuttx/configs/olimex-strp711/ostest/defconfig2
7 files changed, 54 insertions, 31 deletions
diff --git a/nuttx/ChangeLog b/nuttx/ChangeLog
index 48c647e55..2c0d9e8b8 100644
--- a/nuttx/ChangeLog
+++ b/nuttx/ChangeLog
@@ -755,8 +755,8 @@
0.4.8 2009-xx-xx Gregory Nutt <spudmonkey@racsa.co.cr>
* lib/lib_*stream.c: Extend internal stream logic to support incoming streams.
- * arch/arm/src/str71x: Made some progress with the Olimex STR-P711 before my
- emulator stopped working. Serial output is now correct. I don't think it
- would take much more to get it working!
+ * arch/arm/src/str71x: Serial output is now correct and timer interrupts are
+ working. The test at configs/olimex-strp711/ostest passes. This means that
+ the basic STR-P711 port is complete.
diff --git a/nuttx/Documentation/NuttX.html b/nuttx/Documentation/NuttX.html
index 5070ab98b..253328243 100644
--- a/nuttx/Documentation/NuttX.html
+++ b/nuttx/Documentation/NuttX.html
@@ -8,7 +8,7 @@
<tr align="center" bgcolor="#e4e4e4">
<td>
<h1><big><font color="#3c34ec"><i>NuttX RTOS</i></font></big></h1>
- <p>Last Updated: June 01, 2009</p>
+ <p>Last Updated: June 04, 2009</p>
</td>
</tr>
</table>
@@ -1423,9 +1423,9 @@ buildroot-0.1.6 2009-xx-xx &lt;spudmonkey@racsa.co.cr&gt;
nuttx-0.4.8 2009-xx-xx Gregory Nutt &lt;spudmonkey@racsa.co.cr&gt;
* lib/lib_*stream.c: Extend internal stream logic to support incoming streams.
- * arch/arm/src/str71x: Made some progress with the Olimex STR-P711 before my
- emulator stopped working. Serial output is now correct. I don't think it
- would take much more to get it working!
+ * arch/arm/src/str71x: Serial output is now correct and timer interrupts are
+ working. The test at configs/olimex-strp711/ostest passes. This means that
+ the basic STR-P711 port is complete.
pascal-0.1.3 2009-xx-xx Gregory Nutt &lt;spudmonkey@racsa.co.cr&gt;
diff --git a/nuttx/arch/arm/include/str71x/irq.h b/nuttx/arch/arm/include/str71x/irq.h
index ecb1dcc95..26a9d1eb6 100644
--- a/nuttx/arch/arm/include/str71x/irq.h
+++ b/nuttx/arch/arm/include/str71x/irq.h
@@ -1,7 +1,7 @@
/************************************************************************************
* arch/arm/include/str71x/irq.h
*
- * Copyright (C) 2008 Gregory Nutt. All rights reserved.
+ * Copyright (C) 2008-2009 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
diff --git a/nuttx/arch/arm/src/common/up_exit.c b/nuttx/arch/arm/src/common/up_exit.c
index dea542181..0d62a3d28 100644
--- a/nuttx/arch/arm/src/common/up_exit.c
+++ b/nuttx/arch/arm/src/common/up_exit.c
@@ -79,7 +79,8 @@ static void _up_dumponexit(FAR _TCB *tcb, FAR void *arg)
int i;
#endif
- sdbg(" TCB=%p name=%s\n", tcb, tcb->argv[0]);
+ sdbg(" TCB=%p name=%s pid=%d\n", tcb, tcb->argv[0], tcb->pid);
+ sdbg(" priority=%d state=%d\n", tcb->sched_priority, tcb->task_state);
#if CONFIG_NFILE_DESCRIPTORS > 0
if (tcb->filelist)
diff --git a/nuttx/arch/arm/src/str71x/str71x_decodeirq.c b/nuttx/arch/arm/src/str71x/str71x_decodeirq.c
index 618e774a0..92cc5c70e 100644
--- a/nuttx/arch/arm/src/str71x/str71x_decodeirq.c
+++ b/nuttx/arch/arm/src/str71x/str71x_decodeirq.c
@@ -87,15 +87,19 @@
void up_decodeirq(uint32 *regs)
{
#ifdef CONFIG_SUPPRESS_INTERRUPTS
+ up_ledon(LED_INIRQ);
lib_lowprintf("Unexpected IRQ\n");
current_regs = regs;
PANIC(OSERR_ERREXCEPTION);
#else
+ unsigned int irq;
+
/* Read the IRQ number from the IVR register (Could probably get the same
* info from CIC register without the setup.
*/
- unsigned int irq = getreg32(STR71X_EIC_IVR);
+ up_ledon(LED_INIRQ);
+ irq = getreg32(STR71X_EIC_IVR);
/* Verify that the resulting IRQ number is valid */
@@ -105,8 +109,13 @@ void up_decodeirq(uint32 *regs)
* current_regs is also used to manage interrupt level context switches.
*/
+ DEBUGASSERT(current_regs == NULL);
current_regs = regs;
+ /* Mask and acknowledge the interrupt */
+
+ up_maskack_irq(irq);
+
/* Deliver the IRQ */
irq_dispatch(irq, regs);
@@ -114,6 +123,10 @@ void up_decodeirq(uint32 *regs)
/* Indicate that we are no long in an interrupt handler */
current_regs = NULL;
+
+ /* Unmask the last interrupt (global interrupts are still disabled) */
+
+ up_enable_irq(irq);
}
#if CONFIG_DEBUG
else
@@ -121,5 +134,6 @@ void up_decodeirq(uint32 *regs)
PANIC(OSERR_ERREXCEPTION); /* Normally never happens */
}
#endif
+ up_ledoff(LED_INIRQ);
#endif
}
diff --git a/nuttx/arch/arm/src/str71x/str71x_timerisr.c b/nuttx/arch/arm/src/str71x/str71x_timerisr.c
index f6b709e60..ad4565cb9 100644
--- a/nuttx/arch/arm/src/str71x/str71x_timerisr.c
+++ b/nuttx/arch/arm/src/str71x/str71x_timerisr.c
@@ -1,7 +1,7 @@
/****************************************************************************
* arch/arm/src/str71x/str71x_timerisr.c
*
- * Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
+ * Copyright (C) 2007-2009 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
@@ -125,10 +125,25 @@
int up_timerisr(int irq, uint32 *regs)
{
- /* Process timer interrupt */
+ uint16 ocar;
- sched_process_timer();
- return 0;
+ /* Clear all the output compare A interrupt status bit */
+
+ putreg16(~STR71X_TIMERSR_OCFA, STR71X_TIMER0_SR);
+
+ /* Set up for the next compare match. We could either reset
+ * the OCAR and CNTR to restart, or simply update the OCAR as
+ * follows to that the match occurs later without resetting:
+ */
+
+ ocar = getreg16(STR71X_TIMER0_OCAR);
+ ocar += OCAR_VALUE;
+ putreg16(ocar, STR71X_TIMER0_OCAR);
+
+ /* Process timer interrupt */
+
+ sched_process_timer();
+ return 0;
}
/****************************************************************************
@@ -142,32 +157,29 @@ int up_timerisr(int irq, uint32 *regs)
void up_timerinit(void)
{
- uint16 cr1;
- uint16 cr2;
+ irqstate_t flags;
/* Make sure that timer0 is disabled */
+ flags = irqsave();
putreg16(0x0000, STR71X_TIMER0_CR1);
putreg16(0x0000, STR71X_TIMER0_CR2);
putreg16(0x0000, STR71X_TIMER0_SR);
- /* Start The TIM0 Counter */
-
- cr1 = STR71X_TIMERCR1_EN;
- putreg16(cr1, STR71X_TIMER0_CR1);
-
/* Configure TIM0 so that it is clocked by the internal APB2 frequency (PCLK2)
* divided by the above prescaler value (1) -- versus an external Clock.
* -- Nothing to do because STR71X_TIMERCR1_ECKEN is already cleared.
*
- *
* Select a divisor to reduce the frequency of clocking. This must be
* done so that the entire timer interval can fit in the 16-bit OCAR register.
* (see the discussion above).
*/
- cr2 = PCLK2_DIVIDER;
- putreg16(cr2, STR71X_TIMER0_CR2);
+ putreg16(STR71X_TIMERCR2_OCAIE | (PCLK2_DIVIDER - 1), STR71X_TIMER0_CR2);
+
+ /* Start The TIM0 Counter and enable the output comparison A */
+
+ putreg16(STR71X_TIMERCR1_EN | STR71X_TIMERCR1_OCAE, STR71X_TIMER0_CR1);
/* Setup output compare A for desired interrupt frequency. Note that
* the OCAE and OCBE bits are cleared and the pins are available for other
@@ -175,12 +187,7 @@ void up_timerinit(void)
*/
putreg16(OCAR_VALUE, STR71X_TIMER0_OCAR);
- putreg16(0, STR71X_TIMER0_CNTR);
-
- /* Enable TIM0 Output Compare A interrupt */
-
- cr2 |= STR71X_TIMERCR2_OCAIE;
- putreg16(cr2, STR71X_TIMER0_CR2);
+ putreg16(0xfffc, STR71X_TIMER0_CNTR);
/* Set the IRQ interrupt priority */
@@ -193,4 +200,5 @@ void up_timerinit(void)
/* And enable the timer interrupt */
up_enable_irq(STR71X_IRQ_SYSTIMER);
+ irqrestore(flags);
}
diff --git a/nuttx/configs/olimex-strp711/ostest/defconfig b/nuttx/configs/olimex-strp711/ostest/defconfig
index ca65ef5d5..93c6886ec 100644
--- a/nuttx/configs/olimex-strp711/ostest/defconfig
+++ b/nuttx/configs/olimex-strp711/ostest/defconfig
@@ -74,7 +74,7 @@ CONFIG_ARCH_BOARD=olimex-strp711
CONFIG_ARCH_BOARD_OLIMEX_STRP711=y
CONFIG_ARCH_NOINTC=n
CONFIG_ARCH_IRQPRIO=y
-CONFIG_BOARD_LOOPSPERMSEC=3270
+CONFIG_BOARD_LOOPSPERMSEC=1431
CONFIG_ARCH_LEDS=y
CONFIG_ARCH_BUTTONS=y
CONFIG_DRAM_SIZE=0x00010000