aboutsummaryrefslogtreecommitdiffstats
path: root/os
diff options
context:
space:
mode:
authorgdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2012-04-07 10:37:45 +0000
committergdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2012-04-07 10:37:45 +0000
commit44a66d45cedb33599ddb226baf14cfe5372ae8d1 (patch)
treed54087160bb90010e6e32ee15b836753ef8f6ef2 /os
parentca05d68dabf77e308edbb7abbf43b1226fd3432d (diff)
downloadChibiOS-44a66d45cedb33599ddb226baf14cfe5372ae8d1.tar.gz
ChibiOS-44a66d45cedb33599ddb226baf14cfe5372ae8d1.tar.bz2
ChibiOS-44a66d45cedb33599ddb226baf14cfe5372ae8d1.zip
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@4079 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os')
-rw-r--r--os/hal/include/usb.h8
-rw-r--r--os/hal/platforms/STM32/OTGv1/usb_lld.c11
-rw-r--r--os/hal/platforms/STM32/OTGv1/usb_lld.h6
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;
/**