aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbarthess <barthess@35acf78f-673a-0410-8e92-d51de3d6d3f4>2011-09-17 21:06:25 +0000
committerbarthess <barthess@35acf78f-673a-0410-8e92-d51de3d6d3f4>2011-09-17 21:06:25 +0000
commit62b5054dfabcf9e26bf8e65db351db896c552e75 (patch)
treed5d26798a855f930adb9cbb418520a3be72ad517
parent278fc39f993660a8d7ebf4df4a89f6beb10c7f7b (diff)
downloadChibiOS-62b5054dfabcf9e26bf8e65db351db896c552e75.tar.gz
ChibiOS-62b5054dfabcf9e26bf8e65db351db896c552e75.tar.bz2
ChibiOS-62b5054dfabcf9e26bf8e65db351db896c552e75.zip
Shell. Added possibility to create statically allocated shell thread.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@3331 35acf78f-673a-0410-8e92-d51de3d6d3f4
-rw-r--r--os/various/shell.c26
-rw-r--r--os/various/shell.h2
2 files changed, 28 insertions, 0 deletions
diff --git a/os/various/shell.c b/os/various/shell.c
index 5f2fc760b..1fe03fc1e 100644
--- a/os/various/shell.c
+++ b/os/various/shell.c
@@ -220,6 +220,8 @@ void shellInit(void) {
/**
* @brief Spawns a new shell.
*
+ * @pre @p CH_USE_MALLOC_HEAP and @p CH_USE_DYNAMIC must be enabled.
+ *
* @param[in] scp pointer to a @p ShellConfig object
* @param[in] size size of the shell working area to be allocated
* @param[in] prio the priority level for the new shell
@@ -227,10 +229,34 @@ void shellInit(void) {
* @return A pointer to the shell thread.
* @retval NULL thread creation failed because memory allocation.
*/
+#if CH_USE_HEAP && CH_USE_DYNAMIC
Thread *shellCreate(const ShellConfig *scp, size_t size, tprio_t prio) {
return chThdCreateFromHeap(NULL, size, prio, shell_thread, (void *)scp);
}
+#endif
+
+/**
+ * @brief Create statically allocated shell thread.
+ *
+ * @param[in] scp pointer to a @p ShellConfig object
+ * @param[in] wsp pointer to a working area dedicated to the shell thread stack
+ * @param[in] size size of the shell working area to be allocated
+ * @param[in] prio the priority level for the new shell
+ *
+ * @return A pointer to the shell thread.
+ */
+Thread *shellCreateStatic(const ShellConfig *scp, void *wsp,
+ size_t size, tprio_t prio) {
+
+ return chThdCreateStatic(wsp, size, prio, shell_thread, (void *)scp);
+}
+
+
+
+
+
+
/**
* @brief Reads a whole line from the input channel.
diff --git a/os/various/shell.h b/os/various/shell.h
index 075d4e264..2946df947 100644
--- a/os/various/shell.h
+++ b/os/various/shell.h
@@ -80,6 +80,8 @@ extern "C" {
#endif
void shellInit(void);
Thread *shellCreate(const ShellConfig *scp, size_t size, tprio_t prio);
+ Thread *shellCreateStatic(const ShellConfig *scp, void *wsp,
+ size_t size, tprio_t prio);
bool_t shellGetLine(BaseChannel *chp, char *line, unsigned size);
#ifdef __cplusplus
}