aboutsummaryrefslogtreecommitdiffstats
path: root/os
diff options
context:
space:
mode:
Diffstat (limited to 'os')
-rw-r--r--os/hal/ports/STM32/LLD/OTGv1/hal_usb_lld.h1
-rw-r--r--os/hal/src/hal_serial_usb.c17
-rw-r--r--os/various/shell/shell.c6
-rw-r--r--os/various/shell/shell.h15
-rw-r--r--os/various/shell/shell_cmd.c34
5 files changed, 39 insertions, 34 deletions
diff --git a/os/hal/ports/STM32/LLD/OTGv1/hal_usb_lld.h b/os/hal/ports/STM32/LLD/OTGv1/hal_usb_lld.h
index 56ef3792c..7c2019685 100644
--- a/os/hal/ports/STM32/LLD/OTGv1/hal_usb_lld.h
+++ b/os/hal/ports/STM32/LLD/OTGv1/hal_usb_lld.h
@@ -616,7 +616,6 @@ extern "C" {
void usb_lld_stall_in(USBDriver *usbp, usbep_t ep);
void usb_lld_clear_out(USBDriver *usbp, usbep_t ep);
void usb_lld_clear_in(USBDriver *usbp, usbep_t ep);
- void usb_lld_pump(void *p);
#ifdef __cplusplus
}
#endif
diff --git a/os/hal/src/hal_serial_usb.c b/os/hal/src/hal_serial_usb.c
index ec1f1c4fe..246360ebc 100644
--- a/os/hal/src/hal_serial_usb.c
+++ b/os/hal/src/hal_serial_usb.c
@@ -484,20 +484,25 @@ void sduDataTransmitted(USBDriver *usbp, usbep_t ep) {
* @param[in] ep OUT endpoint number
*/
void sduDataReceived(USBDriver *usbp, usbep_t ep) {
+ size_t size;
SerialUSBDriver *sdup = usbp->out_params[ep - 1U];
+
if (sdup == NULL) {
return;
}
osalSysLockFromISR();
- /* Signaling that data is available in the input queue.*/
- chnAddFlagsI(sdup, CHN_INPUT_AVAILABLE);
+ /* Checking for zero-size transactions.*/
+ size = usbGetReceiveTransactionSizeX(sdup->config->usbp,
+ sdup->config->bulk_out);
+ if (size > (size_t)0) {
+ /* Signaling that data is available in the input queue.*/
+ chnAddFlagsI(sdup, CHN_INPUT_AVAILABLE);
- /* Posting the filled buffer in the queue.*/
- ibqPostFullBufferI(&sdup->ibqueue,
- usbGetReceiveTransactionSizeX(sdup->config->usbp,
- sdup->config->bulk_out));
+ /* Posting the filled buffer in the queue.*/
+ ibqPostFullBufferI(&sdup->ibqueue, size);
+ }
/* The endpoint cannot be busy, we are in the context of the callback,
so a packet is in the buffer for sure. Trying to get a free buffer
diff --git a/os/various/shell/shell.c b/os/various/shell/shell.c
index 1b6662136..f699901ec 100644
--- a/os/various/shell/shell.c
+++ b/os/various/shell/shell.c
@@ -353,7 +353,7 @@ THD_FUNCTION(shellThread, p) {
#endif
chprintf(chp, SHELL_NEWLINE_STR);
- chprintf(chp, "ChibiOS/RT Shell"SHELL_NEWLINE_STR);
+ chprintf(chp, "ChibiOS/RT Shell" SHELL_NEWLINE_STR);
while (true) {
chprintf(chp, SHELL_PROMPT_STR);
if (shellGetLine(scfg, line, sizeof(line), shp)) {
@@ -372,7 +372,7 @@ THD_FUNCTION(shellThread, p) {
n = 0;
while ((lp = parse_arguments(NULL, &tokp)) != NULL) {
if (n >= SHELL_MAX_ARGUMENTS) {
- chprintf(chp, "too many arguments"SHELL_NEWLINE_STR);
+ chprintf(chp, "too many arguments" SHELL_NEWLINE_STR);
cmd = NULL;
break;
}
@@ -394,7 +394,7 @@ THD_FUNCTION(shellThread, p) {
else if (cmdexec(shell_local_commands, chp, cmd, n, args) &&
((scp == NULL) || cmdexec(scp, chp, cmd, n, args))) {
chprintf(chp, "%s", cmd);
- chprintf(chp, " ?"SHELL_NEWLINE_STR);
+ chprintf(chp, " ?" SHELL_NEWLINE_STR);
}
}
}
diff --git a/os/various/shell/shell.h b/os/various/shell/shell.h
index 97518b4e0..cecf5969b 100644
--- a/os/various/shell/shell.h
+++ b/os/various/shell/shell.h
@@ -174,10 +174,10 @@ typedef struct {
*
* @notapi
*/
-#define _shell_reset_cur(stream) chprintf(stream, "\033[%dD\033[%dC", \
- SHELL_MAX_LINE_LENGTH + \
- strlen(SHELL_PROMPT_STR) + 2, \
- strlen(SHELL_PROMPT_STR))
+#define _shell_reset_cur(stream) chprintf(stream, "\033[%dD\033[%dC", \
+ SHELL_MAX_LINE_LENGTH + \
+ strlen(SHELL_PROMPT_STR) + 2, \
+ strlen(SHELL_PROMPT_STR))
/**
* @brief Send escape codes to clear the rest of the line
@@ -196,8 +196,8 @@ typedef struct {
*
* @api
*/
-#define shellUsage(stream, message) \
- chprintf(stream, "Usage: %s"SHELL_NEWLINE_STR, message)
+#define shellUsage(stream, message) \
+ chprintf(stream, "Usage: %s" SHELL_NEWLINE_STR, message)
/*===========================================================================*/
/* External declarations. */
@@ -213,7 +213,8 @@ extern "C" {
void shellInit(void);
THD_FUNCTION(shellThread, p);
void shellExit(msg_t msg);
- bool shellGetLine(ShellConfig *scfg, char *line, unsigned size, ShellHistory *shp);
+ bool shellGetLine(ShellConfig *scfg, char *line,
+ unsigned size, ShellHistory *shp);
#ifdef __cplusplus
}
#endif
diff --git a/os/various/shell/shell_cmd.c b/os/various/shell/shell_cmd.c
index 37f80020e..525f26980 100644
--- a/os/various/shell/shell_cmd.c
+++ b/os/various/shell/shell_cmd.c
@@ -78,26 +78,26 @@ static void cmd_info(BaseSequentialStream *chp, int argc, char *argv[]) {
return;
}
- chprintf(chp, "Kernel: %s"SHELL_NEWLINE_STR, CH_KERNEL_VERSION);
+ chprintf(chp, "Kernel: %s" SHELL_NEWLINE_STR, CH_KERNEL_VERSION);
#ifdef PORT_COMPILER_NAME
- chprintf(chp, "Compiler: %s"SHELL_NEWLINE_STR, PORT_COMPILER_NAME);
+ chprintf(chp, "Compiler: %s" SHELL_NEWLINE_STR, PORT_COMPILER_NAME);
#endif
- chprintf(chp, "Architecture: %s"SHELL_NEWLINE_STR, PORT_ARCHITECTURE_NAME);
+ chprintf(chp, "Architecture: %s" SHELL_NEWLINE_STR, PORT_ARCHITECTURE_NAME);
#ifdef PORT_CORE_VARIANT_NAME
- chprintf(chp, "Core Variant: %s"SHELL_NEWLINE_STR, PORT_CORE_VARIANT_NAME);
+ chprintf(chp, "Core Variant: %s" SHELL_NEWLINE_STR, PORT_CORE_VARIANT_NAME);
#endif
#ifdef PORT_INFO
- chprintf(chp, "Port Info: %s"SHELL_NEWLINE_STR, PORT_INFO);
+ chprintf(chp, "Port Info: %s" SHELL_NEWLINE_STR, PORT_INFO);
#endif
#ifdef PLATFORM_NAME
- chprintf(chp, "Platform: %s"SHELL_NEWLINE_STR, PLATFORM_NAME);
+ chprintf(chp, "Platform: %s" SHELL_NEWLINE_STR, PLATFORM_NAME);
#endif
#ifdef BOARD_NAME
- chprintf(chp, "Board: %s"SHELL_NEWLINE_STR, BOARD_NAME);
+ chprintf(chp, "Board: %s" SHELL_NEWLINE_STR, BOARD_NAME);
#endif
#ifdef __DATE__
#ifdef __TIME__
- chprintf(chp, "Build time: %s%s%s"SHELL_NEWLINE_STR, __DATE__, " - ", __TIME__);
+ chprintf(chp, "Build time: %s%s%s" SHELL_NEWLINE_STR, __DATE__, " - ", __TIME__);
#endif
#endif
}
@@ -111,7 +111,7 @@ static void cmd_echo(BaseSequentialStream *chp, int argc, char *argv[]) {
shellUsage(chp, "echo \"message\"");
return;
}
- chprintf(chp, "%s"SHELL_NEWLINE_STR, argv[0]);
+ chprintf(chp, "%s" SHELL_NEWLINE_STR, argv[0]);
}
#endif
@@ -123,7 +123,7 @@ static void cmd_systime(BaseSequentialStream *chp, int argc, char *argv[]) {
shellUsage(chp, "systime");
return;
}
- chprintf(chp, "%lu"SHELL_NEWLINE_STR, (unsigned long)chVTGetSystemTime());
+ chprintf(chp, "%lu" SHELL_NEWLINE_STR, (unsigned long)chVTGetSystemTime());
}
#endif
@@ -137,10 +137,10 @@ static void cmd_mem(BaseSequentialStream *chp, int argc, char *argv[]) {
return;
}
n = chHeapStatus(NULL, &total, &largest);
- chprintf(chp, "core free memory : %u bytes"SHELL_NEWLINE_STR, chCoreGetStatusX());
- chprintf(chp, "heap fragments : %u"SHELL_NEWLINE_STR, n);
- chprintf(chp, "heap free total : %u bytes"SHELL_NEWLINE_STR, total);
- chprintf(chp, "heap free largest: %u bytes"SHELL_NEWLINE_STR, largest);
+ chprintf(chp, "core free memory : %u bytes" SHELL_NEWLINE_STR, chCoreGetStatusX());
+ chprintf(chp, "heap fragments : %u" SHELL_NEWLINE_STR, n);
+ chprintf(chp, "heap free total : %u bytes" SHELL_NEWLINE_STR, total);
+ chprintf(chp, "heap free largest: %u bytes" SHELL_NEWLINE_STR, largest);
}
#endif
@@ -154,7 +154,7 @@ static void cmd_threads(BaseSequentialStream *chp, int argc, char *argv[]) {
shellUsage(chp, "threads");
return;
}
- chprintf(chp, "stklimit stack addr refs prio state name\r\n"SHELL_NEWLINE_STR);
+ chprintf(chp, "stklimit stack addr refs prio state name\r\n" SHELL_NEWLINE_STR);
tp = chRegFirstThread();
do {
#if (CH_DBG_ENABLE_STACK_CHECK == TRUE) || (CH_CFG_USE_DYNAMIC == TRUE)
@@ -162,7 +162,7 @@ static void cmd_threads(BaseSequentialStream *chp, int argc, char *argv[]) {
#else
uint32_t stklimit = 0U;
#endif
- chprintf(chp, "%08lx %08lx %08lx %4lu %4lu %9s %12s"SHELL_NEWLINE_STR,
+ chprintf(chp, "%08lx %08lx %08lx %4lu %4lu %9s %12s" SHELL_NEWLINE_STR,
stklimit, (uint32_t)tp->ctx.sp, (uint32_t)tp,
(uint32_t)tp->refs - 1, (uint32_t)tp->prio, states[tp->state],
tp->name == NULL ? "" : tp->name);
@@ -205,7 +205,7 @@ static void cmd_test(BaseSequentialStream *chp, int argc, char *argv[]) {
"test", chThdGetPriorityX(),
tfp, chp);
if (tp == NULL) {
- chprintf(chp, "out of memory"SHELL_NEWLINE_STR);
+ chprintf(chp, "out of memory" SHELL_NEWLINE_STR);
return;
}
chThdWait(tp);