aboutsummaryrefslogtreecommitdiffstats
path: root/os
diff options
context:
space:
mode:
Diffstat (limited to 'os')
-rw-r--r--os/hal/ports/STM32/LLD/OTGv1/usb_lld.c22
-rw-r--r--os/various/shell.c45
-rw-r--r--os/various/shell.h6
3 files changed, 20 insertions, 53 deletions
diff --git a/os/hal/ports/STM32/LLD/OTGv1/usb_lld.c b/os/hal/ports/STM32/LLD/OTGv1/usb_lld.c
index 6224cbb5c..ffdaaf3ca 100644
--- a/os/hal/ports/STM32/LLD/OTGv1/usb_lld.c
+++ b/os/hal/ports/STM32/LLD/OTGv1/usb_lld.c
@@ -714,10 +714,7 @@ void usb_lld_init(void) {
{
void *wsp = USBD2.wa_pump;
_thread_memfill((uint8_t *)wsp,
- (uint8_t *)wsp + sizeof(thread_t),
- CH_DBG_THREAD_FILL_VALUE);
- _thread_memfill((uint8_t *)wsp + sizeof(thread_t),
- (uint8_t *)wsp + sizeof(USBD2.wa_pump),
+ (uint8_t *)wsp + sizeof (USBD2.wa_pump),
CH_DBG_STACK_FILL_VALUE);
}
#endif /* CH_DBG_FILL_THREADS */
@@ -861,10 +858,16 @@ void usb_lld_start(USBDriver *usbp) {
#if defined(_CHIBIOS_RT_)
/* Creates the data pump thread. Note, it is created only once.*/
if (usbp->tr == NULL) {
- usbp->tr = chThdCreateI(usbp->wa_pump, sizeof usbp->wa_pump,
- STM32_USB_OTG_THREAD_PRIO,
- usb_lld_pump, usbp);
- chThdStartI(usbp->tr);
+ thread_descriptor_t usbpump_descriptor = {
+ "usb_pump",
+ THD_WORKING_AREA_BASE(usbp->wa_pump),
+ THD_WORKING_AREA_END(usbp->wa_pump),
+ STM32_USB_OTG_THREAD_PRIO,
+ usb_lld_pump,
+ (void *)usbp
+ };
+
+ usbp->tr = chThdCreateI(&usbpump_descriptor);
chSchRescheduleS();
}
#endif
@@ -1286,9 +1289,6 @@ void usb_lld_pump(void *p) {
USBDriver *usbp = (USBDriver *)p;
stm32_otg_t *otgp = usbp->otg;
-#if defined(_CHIBIOS_RT_)
- chRegSetThreadName("usb_lld_pump");
-#endif
osalSysLock();
while (true) {
usbep_t ep;
diff --git a/os/various/shell.c b/os/various/shell.c
index 0de6f449a..a60f9b479 100644
--- a/os/various/shell.c
+++ b/os/various/shell.c
@@ -133,7 +133,7 @@ static bool cmdexec(const ShellCommand *scp, BaseSequentialStream *chp,
*
* @param[in] p pointer to a @p BaseSequentialStream object
*/
-static THD_FUNCTION(shell_thread, p) {
+THD_FUNCTION(shellThread, p) {
int n;
BaseSequentialStream *chp = ((ShellConfig *)p)->sc_channel;
const ShellCommand *scp = ((ShellConfig *)p)->sc_commands;
@@ -218,43 +218,14 @@ void shellExit(msg_t msg) {
}
/**
- * @brief Spawns a new shell.
- * @pre @p CH_CFG_USE_HEAP and @p CH_CFG_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 priority level for the new shell
- * @return A pointer to the shell thread.
- * @retval NULL thread creation failed because memory allocation.
- *
- * @api
- */
-#if CH_CFG_USE_HEAP && CH_CFG_USE_DYNAMIC
-thread_t *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
- * @param[in] prio priority level for the new shell
- * @return A pointer to the shell thread.
- *
- * @api
- */
-thread_t *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.
+ * @note Input chars are echoed on the same stream object with the
+ * following exceptions:
+ * - DEL and BS are echoed as BS-SPACE-BS.
+ * - CR is echoed as CR-LF.
+ * - 0x4 is echoed as "^D".
+ * - Other values below 0x20 are not echoed.
+ * .
*
* @param[in] chp pointer to a @p BaseSequentialStream object
* @param[in] line pointer to the line buffer
diff --git a/os/various/shell.h b/os/various/shell.h
index 29d20db5e..9ee73d4dc 100644
--- a/os/various/shell.h
+++ b/os/various/shell.h
@@ -70,12 +70,8 @@ extern event_source_t shell_terminated;
extern "C" {
#endif
void shellInit(void);
+ THD_FUNCTION(shellThread, p);
void shellExit(msg_t msg);
-#if CH_CFG_USE_HEAP && CH_CFG_USE_DYNAMIC
- thread_t *shellCreate(const ShellConfig *scp, size_t size, tprio_t prio);
-#endif
- thread_t *shellCreateStatic(const ShellConfig *scp, void *wsp,
- size_t size, tprio_t prio);
bool shellGetLine(BaseSequentialStream *chp, char *line, unsigned size);
#ifdef __cplusplus
}