diff options
author | Giovanni Di Sirio <gdisirio@gmail.com> | 2017-08-18 13:35:28 +0000 |
---|---|---|
committer | Giovanni Di Sirio <gdisirio@gmail.com> | 2017-08-18 13:35:28 +0000 |
commit | 9662d58fb67b5c11f68f79d091c83280b7903dd3 (patch) | |
tree | 9fc3234f8f3ca3f92878fd210f823505bf574713 /os/hal/src | |
parent | 62f078360f93ff89fd8d3dc4fd4d911dafa592b5 (diff) | |
download | ChibiOS-9662d58fb67b5c11f68f79d091c83280b7903dd3.tar.gz ChibiOS-9662d58fb67b5c11f68f79d091c83280b7903dd3.tar.bz2 ChibiOS-9662d58fb67b5c11f68f79d091c83280b7903dd3.zip |
Some renaming work for clearness.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@10449 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os/hal/src')
-rw-r--r-- | os/hal/src/hal_usb.c | 47 |
1 files changed, 24 insertions, 23 deletions
diff --git a/os/hal/src/hal_usb.c b/os/hal/src/hal_usb.c index 813c2a597..e58055714 100644 --- a/os/hal/src/hal_usb.c +++ b/os/hal/src/hal_usb.c @@ -671,7 +671,7 @@ void _usb_reset(USBDriver *usbp) { }
/* EP0 state machine initialization.*/
- usbp->ep0state = USB_EP0_WAITING_SETUP;
+ usbp->ep0state = USB_EP0_STP_WAITING;
/* Low level reset.*/
usb_lld_reset(usbp);
@@ -751,7 +751,8 @@ void _usb_wakeup(USBDriver *usbp) { void _usb_ep0setup(USBDriver *usbp, usbep_t ep) {
size_t max;
- usbp->ep0state = USB_EP0_WAITING_SETUP;
+ osalDbgAssert(usbp->ep0state == USB_EP0_STP_WAITING, "not in setup state");
+
usbReadSetup(usbp, ep, usbp->setup);
/* First verify if the application has an handler installed for this
@@ -794,7 +795,7 @@ void _usb_ep0setup(USBDriver *usbp, usbep_t ep) { /* IN phase.*/
if (usbp->ep0n != 0U) {
/* Starts the transmit phase.*/
- usbp->ep0state = USB_EP0_TX;
+ usbp->ep0state = USB_EP0_IN_TX;
osalSysLockFromISR();
usbStartTransmitI(usbp, 0, usbp->ep0next, usbp->ep0n);
osalSysUnlockFromISR();
@@ -802,7 +803,7 @@ void _usb_ep0setup(USBDriver *usbp, usbep_t ep) { else {
/* No transmission phase, directly receiving the zero sized status
packet.*/
- usbp->ep0state = USB_EP0_WAITING_STS;
+ usbp->ep0state = USB_EP0_OUT_WAITING_STS;
#if (USB_EP0_STATUS_STAGE == USB_EP0_STATUS_STAGE_SW)
osalSysLockFromISR();
usbStartReceiveI(usbp, 0, NULL, 0);
@@ -816,7 +817,7 @@ void _usb_ep0setup(USBDriver *usbp, usbep_t ep) { /* OUT phase.*/
if (usbp->ep0n != 0U) {
/* Starts the receive phase.*/
- usbp->ep0state = USB_EP0_RX;
+ usbp->ep0state = USB_EP0_OUT_RX;
osalSysLockFromISR();
usbStartReceiveI(usbp, 0, usbp->ep0next, usbp->ep0n);
osalSysUnlockFromISR();
@@ -824,7 +825,7 @@ void _usb_ep0setup(USBDriver *usbp, usbep_t ep) { else {
/* No receive phase, directly sending the zero sized status
packet.*/
- usbp->ep0state = USB_EP0_SENDING_STS;
+ usbp->ep0state = USB_EP0_IN_SENDING_STS;
#if (USB_EP0_STATUS_STAGE == USB_EP0_STATUS_STAGE_SW)
osalSysLockFromISR();
usbStartTransmitI(usbp, 0, NULL, 0);
@@ -851,7 +852,7 @@ void _usb_ep0in(USBDriver *usbp, usbep_t ep) { (void)ep;
switch (usbp->ep0state) {
- case USB_EP0_TX:
+ case USB_EP0_IN_TX:
max = (size_t)get_hword(&usbp->setup[6]);
/* If the transmitted size is less than the requested size and it is a
multiple of the maximum packet size then a zero size packet must be
@@ -861,13 +862,13 @@ void _usb_ep0in(USBDriver *usbp, usbep_t ep) { osalSysLockFromISR();
usbStartTransmitI(usbp, 0, NULL, 0);
osalSysUnlockFromISR();
- usbp->ep0state = USB_EP0_WAITING_TX0;
+ usbp->ep0state = USB_EP0_IN_WAITING_TX0;
return;
}
/* Falls into, it is intentional.*/
- case USB_EP0_WAITING_TX0:
+ case USB_EP0_IN_WAITING_TX0:
/* Transmit phase over, receiving the zero sized status packet.*/
- usbp->ep0state = USB_EP0_WAITING_STS;
+ usbp->ep0state = USB_EP0_OUT_WAITING_STS;
#if (USB_EP0_STATUS_STAGE == USB_EP0_STATUS_STAGE_SW)
osalSysLockFromISR();
usbStartReceiveI(usbp, 0, NULL, 0);
@@ -876,16 +877,16 @@ void _usb_ep0in(USBDriver *usbp, usbep_t ep) { usb_lld_end_setup(usbp, ep);
#endif
return;
- case USB_EP0_SENDING_STS:
+ case USB_EP0_IN_SENDING_STS:
/* Status packet sent, invoking the callback if defined.*/
if (usbp->ep0endcb != NULL) {
usbp->ep0endcb(usbp);
}
- usbp->ep0state = USB_EP0_WAITING_SETUP;
+ usbp->ep0state = USB_EP0_STP_WAITING;
return;
- case USB_EP0_WAITING_SETUP:
- case USB_EP0_WAITING_STS:
- case USB_EP0_RX:
+ case USB_EP0_STP_WAITING:
+ case USB_EP0_OUT_WAITING_STS:
+ case USB_EP0_OUT_RX:
/* All the above are invalid states in the IN phase.*/
osalDbgAssert(false, "EP0 state machine error");
/* Falling through is intentional.*/
@@ -917,9 +918,9 @@ void _usb_ep0out(USBDriver *usbp, usbep_t ep) { (void)ep;
switch (usbp->ep0state) {
- case USB_EP0_RX:
+ case USB_EP0_OUT_RX:
/* Receive phase over, sending the zero sized status packet.*/
- usbp->ep0state = USB_EP0_SENDING_STS;
+ usbp->ep0state = USB_EP0_IN_SENDING_STS;
#if (USB_EP0_STATUS_STAGE == USB_EP0_STATUS_STAGE_SW)
osalSysLockFromISR();
usbStartTransmitI(usbp, 0, NULL, 0);
@@ -928,7 +929,7 @@ void _usb_ep0out(USBDriver *usbp, usbep_t ep) { usb_lld_end_setup(usbp, ep);
#endif
return;
- case USB_EP0_WAITING_STS:
+ case USB_EP0_OUT_WAITING_STS:
/* Status packet received, it must be zero sized, invoking the callback
if defined.*/
#if (USB_EP0_STATUS_STAGE == USB_EP0_STATUS_STAGE_SW)
@@ -939,12 +940,12 @@ void _usb_ep0out(USBDriver *usbp, usbep_t ep) { if (usbp->ep0endcb != NULL) {
usbp->ep0endcb(usbp);
}
- usbp->ep0state = USB_EP0_WAITING_SETUP;
+ usbp->ep0state = USB_EP0_STP_WAITING;
return;
- case USB_EP0_WAITING_SETUP:
- case USB_EP0_TX:
- case USB_EP0_WAITING_TX0:
- case USB_EP0_SENDING_STS:
+ case USB_EP0_STP_WAITING:
+ case USB_EP0_IN_TX:
+ case USB_EP0_IN_WAITING_TX0:
+ case USB_EP0_IN_SENDING_STS:
/* All the above are invalid states in the IN phase.*/
osalDbgAssert(false, "EP0 state machine error");
/* Falling through is intentional.*/
|