diff options
Diffstat (limited to 'os')
-rw-r--r-- | os/hal/include/usb_cdc.h | 22 | ||||
-rw-r--r-- | os/hal/platforms/STM32/USBv1/usb_lld.c | 2 | ||||
-rw-r--r-- | os/hal/src/serial_usb.c | 6 |
3 files changed, 20 insertions, 10 deletions
diff --git a/os/hal/include/usb_cdc.h b/os/hal/include/usb_cdc.h index cd9d78f10..48a543642 100644 --- a/os/hal/include/usb_cdc.h +++ b/os/hal/include/usb_cdc.h @@ -33,6 +33,10 @@ /* Driver constants. */
/*===========================================================================*/
+/**
+ * @name CDC specific messages.
+ * @{
+ */
#define CDC_SEND_ENCAPSULATED_COMMAND 0x00
#define CDC_GET_ENCAPSULATED_RESPONSE 0x01
#define CDC_SET_COMM_FEATURE 0x02
@@ -52,7 +56,12 @@ #define CDC_GET_RINGER_PARMS 0x31
#define CDC_SET_OPERATION_PARMS 0x32
#define CDC_GET_OPERATION_PARMS 0x33
+/** @} */
+/**
+ * @name Line Control bit definitions.
+ * @{
+ */
#define LC_STOP_1 0
#define LC_STOP_1P5 1
#define LC_STOP_2 2
@@ -62,6 +71,7 @@ #define LC_PARITY_EVEN 2
#define LC_PARITY_MARK 3
#define LC_PARITY_SPACE 4
+/** @} */
/*===========================================================================*/
/* Driver pre-compile time settings. */
@@ -74,22 +84,22 @@ /**
* @brief Endpoint number for bulk IN.
*/
-#if !defined(DATA_REQUEST_EP) || defined(__DOXYGEN__)
-#define DATA_REQUEST_EP 1
+#if !defined(USB_CDC_DATA_REQUEST_EP) || defined(__DOXYGEN__)
+#define USB_CDC_DATA_REQUEST_EP 1
#endif
/**
* @brief Endpoint number for interrupt IN.
*/
-#if !defined(INTERRUPT_REQUEST_EP) || defined(__DOXYGEN__)
-#define INTERRUPT_REQUEST_EP 2
+#if !defined(USB_CDC_INTERRUPT_REQUEST_EP) || defined(__DOXYGEN__)
+#define USB_CDC_INTERRUPT_REQUEST_EP 2
#endif
/**
* @brief Endpoint number for bulk OUT.
*/
-#if !defined(DATA_AVAILABLE_EP) || defined(__DOXYGEN__)
-#define DATA_AVAILABLE_EP 3
+#if !defined(USB_CDC_DATA_AVAILABLE_EP) || defined(__DOXYGEN__)
+#define USB_CDC_DATA_AVAILABLE_EP 3
#endif
/** @} */
diff --git a/os/hal/platforms/STM32/USBv1/usb_lld.c b/os/hal/platforms/STM32/USBv1/usb_lld.c index db0c558b6..34b8d9bf0 100644 --- a/os/hal/platforms/STM32/USBv1/usb_lld.c +++ b/os/hal/platforms/STM32/USBv1/usb_lld.c @@ -105,7 +105,7 @@ static uint32_t pm_alloc(USBDriver *usbp, size_t size) { next = usbp->pmnext;
usbp->pmnext += size;
- chDbgAssert(usbp->pmnext > USB_PMA_SIZE, "pm_alloc(), #1", "PMA overflow");
+ chDbgAssert(usbp->pmnext <= USB_PMA_SIZE, "pm_alloc(), #1", "PMA overflow");
return next;
}
diff --git a/os/hal/src/serial_usb.c b/os/hal/src/serial_usb.c index d9c25ecdf..237d8e027 100644 --- a/os/hal/src/serial_usb.c +++ b/os/hal/src/serial_usb.c @@ -124,7 +124,7 @@ static void inotify(GenericQueue *qp) { emptied, then a whole packet is loaded in the queue.*/
if (chIQIsEmptyI(&sdup->iqueue)) {
- n = usbReadPacketI(sdup->config->usbp, DATA_AVAILABLE_EP,
+ n = usbReadPacketI(sdup->config->usbp, USB_CDC_DATA_AVAILABLE_EP,
sdup->iqueue.q_buffer, SERIAL_USB_BUFFERS_SIZE);
if (n != USB_ENDPOINT_BUSY) {
chIOAddFlagsI(sdup, IO_INPUT_AVAILABLE);
@@ -146,7 +146,7 @@ static void onotify(GenericQueue *qp) { /* If there is any data in the output queue then it is sent within a
single packet and the queue is emptied.*/
n = chOQGetFullI(&sdup->oqueue);
- w = usbWritePacketI(sdup->config->usbp, DATA_REQUEST_EP,
+ w = usbWritePacketI(sdup->config->usbp, USB_CDC_DATA_REQUEST_EP,
sdup->oqueue.q_buffer, n);
if (w != USB_ENDPOINT_BUSY) {
chIOAddFlagsI(sdup, IO_OUTPUT_EMPTY);
@@ -211,10 +211,10 @@ void sduStart(SerialUSBDriver *sdup, const SerialUSBConfig *config) { "sduStart(), #1",
"invalid state");
sdup->config = config;
- usbStart(config->usbp, &config->usb_config);
config->usbp->param = sdup;
sdup->state = SDU_READY;
chSysUnlock();
+ usbStart(config->usbp, &config->usb_config);
}
/**
|