summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2012-04-23 13:59:31 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2012-04-23 13:59:31 +0000
commit68bc7cefbd11c4dbeca86fb64fac3466dd4f5b69 (patch)
treefd1605d23bc93e70f2d8bd7fa5541bec9d33cd2d
parentcc17fe8980154e5af111651cce271798b4f8482b (diff)
downloadnuttx-68bc7cefbd11c4dbeca86fb64fac3466dd4f5b69.tar.gz
nuttx-68bc7cefbd11c4dbeca86fb64fac3466dd4f5b69.tar.bz2
nuttx-68bc7cefbd11c4dbeca86fb64fac3466dd4f5b69.zip
Fix atexit() function being called twice
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@4644 42af7a65-404d-4744-a932-0658087f49c3
-rw-r--r--nuttx/Documentation/NuttX.html17
-rw-r--r--nuttx/Documentation/NuttxUserGuide.html6
-rw-r--r--nuttx/arch/arm/src/stm32/Kconfig42
-rw-r--r--nuttx/configs/README.txt3
-rw-r--r--nuttx/configs/pic32mx7mmb/README.txt2
-rw-r--r--nuttx/sched/task_delete.c18
-rw-r--r--nuttx/sched/task_exithook.c18
7 files changed, 99 insertions, 7 deletions
diff --git a/nuttx/Documentation/NuttX.html b/nuttx/Documentation/NuttX.html
index 0b85fcb65..85b513469 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: April 14, 2012</p>
+ <p>Last Updated: April 23, 2012</p>
</td>
</tr>
</table>
@@ -2228,10 +2228,13 @@
<td>
<p>
<b>PIC32MX795F512L</b>.
- This port uses the Microchip PIC32 Ethernet Starter Kit (DM320004) with the Expansion I/O board.
- See the <a href="http://ww.microchip.com">Microchip website</a> for further information.
+ There one two board ports using this chip:
</p>
<ul>
+ <li><b>Microchip PIC32 Ethernet Starter Kit</b>.
+ This port uses the Microchip PIC32 Ethernet Starter Kit (DM320004) with the Expansion I/O board.
+ See the <a href="http://ww.microchip.com">Microchip website</a> for further information.
+ </li>
<p>
<b>STATUS:</b>
This port was started and then shelved for some time until I received the Expansion I/O board.
@@ -2243,6 +2246,14 @@
Also included are a a verified Ethernet driver, a partially verified USB device controller driver, and an unverifed SPI driver.
Stay tuned for updates.
</p>
+ <li><b>Mikroelektronika PIC32MX7 Mulitmedia Board (MMB)</b>.
+ A port has begun for the Mikroelektronika PIC32MX7 Multimedia Board (MMB).
+ See http://www.mikroe.com/ for further information.
+ </li>
+ <p>
+ <b>STATUS:</b>
+ A configuration exists for this board, but has not been verfied as of this writing.
+ </p>
</ul>
</td>
</tr>
diff --git a/nuttx/Documentation/NuttxUserGuide.html b/nuttx/Documentation/NuttxUserGuide.html
index dec4fca02..9d3af1c27 100644
--- a/nuttx/Documentation/NuttxUserGuide.html
+++ b/nuttx/Documentation/NuttxUserGuide.html
@@ -522,6 +522,12 @@ And the UNIX interface:
The task is first terminated and then reinitialized with same
ID, priority, original entry point, stack size, and parameters
it had when it was first started.
+</p>
+<p>
+NOTE: The normal task exit clean up is not performed.
+For example, file descriptors are not closed;
+any files opened prior to the restart will remain opened after the task is restarted.
+</p>
<p>
<b>Input Parameters:</b>
<ul>
diff --git a/nuttx/arch/arm/src/stm32/Kconfig b/nuttx/arch/arm/src/stm32/Kconfig
index ae92d8cfb..2dbc4b468 100644
--- a/nuttx/arch/arm/src/stm32/Kconfig
+++ b/nuttx/arch/arm/src/stm32/Kconfig
@@ -1467,6 +1467,13 @@ config USART1_2STOP
---help---
Two stop bits
+config USART1_RXDMA
+ bool "USART1 Rx DMA"
+ default n
+ depends on STM32_STM32F40XX && ARCH_DMA && STM32_DMA2
+ ---help---
+ In high data rate usage, Rx DMA may eliminate Rx overrun errors
+
endmenu
menu "USART2 Configuration"
@@ -1516,6 +1523,13 @@ config USART2_2STOP
---help---
Two stop bits
+config USART2_RXDMA
+ bool "USART2 Rx DMA"
+ default n
+ depends on STM32_STM32F40XX && ARCH_DMA && STM32_DMA1
+ ---help---
+ In high data rate usage, Rx DMA may eliminate Rx overrun errors
+
endmenu
menu "USART3 Configuration"
@@ -1565,6 +1579,13 @@ config USART3_2STOP
---help---
Two stop bits
+config USART3_RXDMA
+ bool "USART3 Rx DMA"
+ default n
+ depends on STM32_STM32F40XX && ARCH_DMA && STM32_DMA1
+ ---help---
+ In high data rate usage, Rx DMA may eliminate Rx overrun errors
+
endmenu
menu "UART4 Configuration"
@@ -1614,6 +1635,13 @@ config USART4_2STOP
---help---
Two stop bits
+config USART4_RXDMA
+ bool "USART4 Rx DMA"
+ default n
+ depends on STM32_STM32F40XX && ARCH_DMA && STM32_DMA1
+ ---help---
+ In high data rate usage, Rx DMA may eliminate Rx overrun errors
+
endmenu
menu "UART5 Configuration"
@@ -1663,6 +1691,13 @@ config USART5_2STOP
---help---
Two stop bits
+config USART5_RXDMA
+ bool "USART5 Rx DMA"
+ default n
+ depends on STM32_STM32F40XX && ARCH_DMA && STM32_DMA1
+ ---help---
+ In high data rate usage, Rx DMA may eliminate Rx overrun errors
+
endmenu
menu "USART6 Configuration"
@@ -1712,6 +1747,13 @@ config USART6_2STOP
---help---
Two stop bits
+config USART6_RXDMA
+ bool "USART6 Rx DMA"
+ default n
+ depends on STM32_STM32F40XX && ARCH_DMA && STM32_DMA2
+ ---help---
+ In high data rate usage, Rx DMA may eliminate Rx overrun errors
+
endmenu
menu "SPI Configuration"
diff --git a/nuttx/configs/README.txt b/nuttx/configs/README.txt
index e4e524822..2d0e6e5af 100644
--- a/nuttx/configs/README.txt
+++ b/nuttx/configs/README.txt
@@ -1495,9 +1495,6 @@ configs/pic32mx7mmb
This directory will (eventually) contain the port of NuttX to the
Mikroelektronika PIC32MX7 Multimedia Board (MMB). See
http://www.mikroe.com/ for further information.
-
- On initial check-in, this directory is just a clone of the PIC32 starter
- kit port with the appropriate naming changes. More to come.
configs/pjrc-8051
8051 Microcontroller. This port uses the PJRC 87C52 development system
diff --git a/nuttx/configs/pic32mx7mmb/README.txt b/nuttx/configs/pic32mx7mmb/README.txt
index 9ee125f7b..d24b99430 100644
--- a/nuttx/configs/pic32mx7mmb/README.txt
+++ b/nuttx/configs/pic32mx7mmb/README.txt
@@ -2,7 +2,7 @@ configs/pic32mx7mmb README
===============================
This README file discusses the port of NuttX to the Mikroelektronika PIC32MX7
-Multimedia Board (MMB)
+Multimedia Board (MMB). See http://www.mikroe.com/ for further information.
Contents
========
diff --git a/nuttx/sched/task_delete.c b/nuttx/sched/task_delete.c
index 4cd2b3ba7..e5244a0b8 100644
--- a/nuttx/sched/task_delete.c
+++ b/nuttx/sched/task_delete.c
@@ -83,6 +83,21 @@
* This function causes a specified task to cease to exist. Its stack and
* TCB will be deallocated. This function is the companion to task_create().
*
+ * The logic in this function only deletes non-running tasks. If the 'pid'
+ * parameter refers to to the currently runing task, then processing is
+ * redirected to exit().
+ *
+ * Control will still be returned to task_delete() after the exit() logic
+ * finishes. In fact, this function is the final function called all task
+ * termination sequences. Here are all possible exit scenarios:
+ *
+ * - pthread_exit(). Calls exit()
+ * - exit(). Calls _exit()
+ * - _exit(). Calls task_deletecurrent() making the currently running task
+ * non-running then calls task_delete() to terminate the non-running
+ * task.
+ * - task_delete()
+ *
* Inputs:
* pid - The task ID of the task to delete. A pid of zero
* signifies the calling task.
@@ -145,6 +160,9 @@ int task_delete(pid_t pid)
* this as early as possible so that higher level clean-up logic
* can run in a healthy tasking environment.
*
+ * In the case where the task exits via exit(), task_exithook()
+ * may be called twice.
+ *
* I suppose EXIT_SUCCESS is an appropriate return value???
*/
diff --git a/nuttx/sched/task_exithook.c b/nuttx/sched/task_exithook.c
index 44073165a..e160a1cb3 100644
--- a/nuttx/sched/task_exithook.c
+++ b/nuttx/sched/task_exithook.c
@@ -114,14 +114,32 @@ void task_exithook(FAR _TCB *tcb, int status)
#ifdef CONFIG_SCHED_ATEXIT
if (tcb->atexitfunc)
{
+ /* Call the atexit function */
+
(*tcb->atexitfunc)();
+
+ /* Nullify the atexit function. task_exithook may be called more then
+ * once in most task exit scenarios. Nullifying the atext function
+ * pointer will assure that the callback is performed only once.
+ */
+
+ tcb->atexitfunc = NULL;
}
#endif
#ifdef CONFIG_SCHED_ONEXIT
if (tcb->onexitfunc)
{
+ /* Call the on_exit function */
+
(*tcb->onexitfunc)(status, tcb->onexitarg);
+
+ /* Nullify the on_exit function. task_exithook may be called more then
+ * once in most task exit scenarios. Nullifying the on_exit function
+ * pointer will assure that the callback is performed only once.
+ */
+
+ tcb->onexitfunc = NULL;
}
#endif