diff options
Diffstat (limited to 'os')
-rw-r--r-- | os/hal/include/serial_usb.h | 2 | ||||
-rw-r--r-- | os/hal/src/serial_usb.c | 8 |
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.*/
|