aboutsummaryrefslogtreecommitdiffstats
path: root/os
diff options
context:
space:
mode:
authorGiovanni Di Sirio <gdisirio@gmail.com>2015-05-08 09:24:11 +0000
committerGiovanni Di Sirio <gdisirio@gmail.com>2015-05-08 09:24:11 +0000
commit0cd802faf1c7ab3f2ae237a91aabbd8a79cea831 (patch)
tree1e8f5f1605f144ead2459bfa45aea13404821813 /os
parentbd1bedbbf7502541cc6cf6b11faedc9acd03228c (diff)
downloadChibiOS-0cd802faf1c7ab3f2ae237a91aabbd8a79cea831.tar.gz
ChibiOS-0cd802faf1c7ab3f2ae237a91aabbd8a79cea831.tar.bz2
ChibiOS-0cd802faf1c7ab3f2ae237a91aabbd8a79cea831.zip
Improvement to serial_usb driver.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@7955 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os')
-rw-r--r--os/hal/include/serial_usb.h2
-rw-r--r--os/hal/src/serial_usb.c8
2 files changed, 8 insertions, 2 deletions
diff --git a/os/hal/include/serial_usb.h b/os/hal/include/serial_usb.h
index b926b1a68..abf6313d0 100644
--- a/os/hal/include/serial_usb.h
+++ b/os/hal/include/serial_usb.h
@@ -179,6 +179,8 @@ typedef struct {
usbep_t bulk_out;
/**
* @brief Interrupt IN endpoint used for notifications.
+ * @note If set to zero then the INT endpoint is assumed to be not
+ * present, USB descriptors must be changed accordingly.
*/
usbep_t int_in;
} SerialUSBConfig;
diff --git a/os/hal/src/serial_usb.c b/os/hal/src/serial_usb.c
index f5392bdf6..dc0e803a8 100644
--- a/os/hal/src/serial_usb.c
+++ b/os/hal/src/serial_usb.c
@@ -218,7 +218,9 @@ void sduStart(SerialUSBDriver *sdup, const SerialUSBConfig *config) {
"invalid state");
usbp->in_params[config->bulk_in - 1U] = sdup;
usbp->out_params[config->bulk_out - 1U] = sdup;
- usbp->in_params[config->int_in - 1U] = sdup;
+ if (config->int_in > 0U) {
+ usbp->in_params[config->int_in - 1U] = sdup;
+ }
sdup->config = config;
sdup->state = SDU_READY;
osalSysUnlock();
@@ -245,7 +247,9 @@ void sduStop(SerialUSBDriver *sdup) {
/* Driver in stopped state.*/
usbp->in_params[sdup->config->bulk_in - 1U] = NULL;
usbp->out_params[sdup->config->bulk_out - 1U] = NULL;
- usbp->in_params[sdup->config->int_in - 1U] = NULL;
+ if (sdup->config->int_in > 0U) {
+ usbp->in_params[sdup->config->int_in - 1U] = NULL;
+ }
sdup->state = SDU_STOP;
/* Queues reset in order to signal the driver stop to the application.*/