diff options
-rw-r--r-- | os/hal/include/usb.h | 8 | ||||
-rw-r--r-- | os/hal/platforms/STM32/OTGv1/usb_lld.c | 11 | ||||
-rw-r--r-- | os/hal/platforms/STM32/OTGv1/usb_lld.h | 6 |
3 files changed, 14 insertions, 11 deletions
diff --git a/os/hal/include/usb.h b/os/hal/include/usb.h index 7b68d0eeb..9e5eb1b62 100644 --- a/os/hal/include/usb.h +++ b/os/hal/include/usb.h @@ -373,7 +373,7 @@ typedef const USBDescriptor * (*usbgetdescriptor_t)(USBDriver *usbp, /**
* @brief Reads from a dedicated packet buffer.
- * @pre In order to use this function he endpoint must have been
+ * @pre In order to use this function the endpoint must have been
* initialized in packet mode.
* @note This function can be invoked both in thread and IRQ context.
*
@@ -393,7 +393,7 @@ typedef const USBDescriptor * (*usbgetdescriptor_t)(USBDriver *usbp, /**
* @brief Writes to a dedicated packet buffer.
- * @pre In order to use this function he endpoint must have been
+ * @pre In order to use this function the endpoint must have been
* initialized in packet mode.
* @note This function can be invoked both in thread and IRQ context.
*
@@ -410,7 +410,7 @@ typedef const USBDescriptor * (*usbgetdescriptor_t)(USBDriver *usbp, /**
* @brief Prepares for a receive transaction on an OUT endpoint.
- * @pre In order to use this function he endpoint must have been
+ * @pre In order to use this function the endpoint must have been
* initialized in transaction mode.
* @post The endpoint is ready for @p usbStartReceiveI().
*
@@ -426,7 +426,7 @@ typedef const USBDescriptor * (*usbgetdescriptor_t)(USBDriver *usbp, /**
* @brief Prepares for a transmit transaction on an IN endpoint.
- * @pre In order to use this function he endpoint must have been
+ * @pre In order to use this function the endpoint must have been
* initialized in transaction mode.
* @post The endpoint is ready for @p usbStartTransmitI().
*
diff --git a/os/hal/platforms/STM32/OTGv1/usb_lld.c b/os/hal/platforms/STM32/OTGv1/usb_lld.c index b79d17f1c..be2bccee9 100644 --- a/os/hal/platforms/STM32/OTGv1/usb_lld.c +++ b/os/hal/platforms/STM32/OTGv1/usb_lld.c @@ -236,12 +236,7 @@ static void otg_rxfifo_handler(USBDriver *usbp) { case GRXSTSP_SETUP_DATA:
cnt = (sts & GRXSTSP_BCNT_MASK) >> GRXSTSP_BCNT_OFF;
ep = (sts & GRXSTSP_EPNUM_MASK) >> GRXSTSP_EPNUM_OFF;
- if (ep == 0)
- otg_fifo_read(usbp->setup, cnt, 8);
- else
- otg_fifo_read(usbp->epc[ep]->out_state->rxbuf, cnt,
- usbp->epc[ep]->out_state->rxsize);
- usbp->epc[ep]->out_state->rxcnt = cnt;
+ otg_fifo_read(usbp->epc[ep]->setup_buf, cnt, 8);
break;
case GRXSTSP_OUT_DATA:
cnt = (sts & GRXSTSP_BCNT_MASK) >> GRXSTSP_BCNT_OFF;
@@ -270,6 +265,7 @@ static void otg_rxfifo_handler(USBDriver *usbp) { static void otg_txfifo_handler(USBDriver *usbp, usbep_t ep) {
uint32_t n;
+#if 0
if ((usbp->transmitting & (1 << ep))== 0) {
/* Nothing to transmit.*/
/* ????????????????????? */
@@ -289,6 +285,8 @@ static void otg_txfifo_handler(USBDriver *usbp, usbep_t ep) { OTG->ie[ep].DIEPTSIZ = DIEPTSIZ_PKTCNT(pcnt) |
DIEPTSIZ_XFRSIZ(usbp->epc[ep]->in_state->txsize);
}
+#endif
+
n = usbp->epc[ep]->in_state->txsize - usbp->epc[ep]->in_state->txcnt;
if (n > usbp->epc[ep]->in_maxsize)
n = usbp->epc[ep]->in_maxsize;
@@ -298,7 +296,6 @@ static void otg_txfifo_handler(USBDriver *usbp, usbep_t ep) { usbp->epc[ep]->in_state->txcnt += n;
if (usbp->epc[ep]->in_state->txcnt >= usbp->epc[ep]->in_state->txsize) {
/* Transfer finished.*/
- /* ????????????????????? */
OTG->DIEPEMPMSK &= ~DIEPEMPMSK_INEPTXFEM(ep);
}
}
diff --git a/os/hal/platforms/STM32/OTGv1/usb_lld.h b/os/hal/platforms/STM32/OTGv1/usb_lld.h index 4ef236ea0..752adbfcd 100644 --- a/os/hal/platforms/STM32/OTGv1/usb_lld.h +++ b/os/hal/platforms/STM32/OTGv1/usb_lld.h @@ -206,6 +206,12 @@ typedef struct { */
USBOutEndpointState *out_state;
/* End of the mandatory fields.*/
+ /**
+ * @brief Pointer to a buffer for setup packets.
+ * @details Setup packets require a dedicated 8-bytes buffer, set this
+ * field to @p NULL for non-control endpoints.
+ */
+ uint8_t *setup_buf;
} USBEndpointConfig;
/**
|