aboutsummaryrefslogtreecommitdiffstats
path: root/testhal/STM32/STM32F4xx/SDC/main.c
diff options
context:
space:
mode:
authorGiovanni Di Sirio <gdisirio@gmail.com>2016-02-20 21:50:58 +0000
committerGiovanni Di Sirio <gdisirio@gmail.com>2016-02-20 21:50:58 +0000
commit951efe320c6a035b67c99deae380b351b2e0b9c0 (patch)
tree7069d41a6aa79e26ac5c12f1c261ee47be24b625 /testhal/STM32/STM32F4xx/SDC/main.c
parent41585364a77e8d8491c958525d1f0446fe2772e9 (diff)
downloadChibiOS-951efe320c6a035b67c99deae380b351b2e0b9c0.tar.gz
ChibiOS-951efe320c6a035b67c99deae380b351b2e0b9c0.tar.bz2
ChibiOS-951efe320c6a035b67c99deae380b351b2e0b9c0.zip
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@8917 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'testhal/STM32/STM32F4xx/SDC/main.c')
-rw-r--r--testhal/STM32/STM32F4xx/SDC/main.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/testhal/STM32/STM32F4xx/SDC/main.c b/testhal/STM32/STM32F4xx/SDC/main.c
index 93538ae5c..2aed5c496 100644
--- a/testhal/STM32/STM32F4xx/SDC/main.c
+++ b/testhal/STM32/STM32F4xx/SDC/main.c
@@ -292,7 +292,6 @@ static const ShellConfig shell_cfg1 = {
* Application entry point.
*/
int main(void) {
- thread_t *shelltp = NULL;
/*
* System initializations.
@@ -325,15 +324,14 @@ int main(void) {
chThdCreateStatic(waThread1, sizeof(waThread1), NORMALPRIO, Thread1, NULL);
/*
- * Normal main() thread activity, in this demo it does nothing.
+ * Normal main() thread activity, spawning shells.
*/
while (true) {
- if (!shelltp)
- shelltp = shellCreate(&shell_cfg1, SHELL_WA_SIZE, NORMALPRIO);
- else if (chThdTerminatedX(shelltp)) {
- chThdRelease(shelltp); /* Recovers memory of the previous shell. */
- shelltp = NULL; /* Triggers spawning of a new shell. */
- }
+ thread_t *shelltp = chThdCreateFromHeap(NULL, SHELL_WA_SIZE,
+ NORMALPRIO + 1, shellThread,
+ (void *)&shell_cfg1);
+ chThdWait(shelltp); /* Waiting termination. */
+ chThdFreeToHeap(shelltp); /* Returning memory to heap. */
chThdSleepMilliseconds(1000);
}
}