Updated the STM32 USB drivers to the new setup phase convention.

git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@6884 35acf78f-673a-0410-8e92-d51de3d6d3f4
This commit is contained in:
gdisirio 2014-04-26 09:49:10 +00:00
parent 84cba6bb97
commit 3aa8654e3a
6 changed files with 16 additions and 11 deletions

View File

@ -451,9 +451,6 @@ typedef const USBDescriptor * (*usbgetdescriptor_t)(USBDriver *usbp,
(usbp)->ep0endcb = (endcb); \ (usbp)->ep0endcb = (endcb); \
} }
#define usbSetupEnd(usbp, ep) \
usb_lld_end_transaction(usbp, ep)
/** /**
* @brief Reads a setup packet from the dedicated packet buffer. * @brief Reads a setup packet from the dedicated packet buffer.
* @details This function must be invoked in the context of the @p setup_cb * @details This function must be invoked in the context of the @p setup_cb

View File

@ -25,7 +25,6 @@
#include "ch.h" #include "ch.h"
#include "hal.h" #include "hal.h"
#if HAL_USE_USB || defined(__DOXYGEN__) #if HAL_USE_USB || defined(__DOXYGEN__)
/*===========================================================================*/ /*===========================================================================*/

View File

@ -457,7 +457,7 @@ struct USBDriver {
* *
* @notapi * @notapi
*/ */
#define usb_lld_end_transaction(usbp, ep) \ #define usb_lld_end_setup(usbp, ep) \
((usbp)->usb->DCPCTR.BIT.CCPL=1) ((usbp)->usb->DCPCTR.BIT.CCPL=1)
/** /**

View File

@ -42,6 +42,11 @@
#define USB_MAX_ENDPOINTS 5 #define USB_MAX_ENDPOINTS 5
#endif #endif
/**
* @brief Status stage handling method.
*/
#define USB_EP0_STATUS_STAGE USB_EP0_STATUS_STAGE_SW
/** /**
* @brief The address can be changed immediately upon packet reception. * @brief The address can be changed immediately upon packet reception.
*/ */

View File

@ -38,6 +38,11 @@
*/ */
#define USB_MAX_ENDPOINTS USB_ENDOPOINTS_NUMBER #define USB_MAX_ENDPOINTS USB_ENDOPOINTS_NUMBER
/**
* @brief Status stage handling method.
*/
#define USB_EP0_STATUS_STAGE USB_EP0_STATUS_STAGE_SW
/** /**
* @brief This device requires the address change after the status packet. * @brief This device requires the address change after the status packet.
*/ */

View File

@ -628,8 +628,7 @@ void _usb_ep0setup(USBDriver *usbp, usbep_t ep) {
} }
} }
#if (USB_SET_ADDRESS_ACK_HANDLING == USB_SET_ADDRESS_ACK_HW) #if (USB_SET_ADDRESS_ACK_HANDLING == USB_SET_ADDRESS_ACK_HW)
if (usbp->setup[1] == USB_REQ_SET_ADDRESS) if (usbp->setup[1] == USB_REQ_SET_ADDRESS) {
{
/* Zero-length packet sent by hardware */ /* Zero-length packet sent by hardware */
return; return;
} }
@ -661,7 +660,7 @@ void _usb_ep0setup(USBDriver *usbp, usbep_t ep) {
usbStartReceiveI(usbp, 0); usbStartReceiveI(usbp, 0);
chSysUnlockFromIsr(); chSysUnlockFromIsr();
#else #else
usbSetupEnd(usbp, ep); usb_lld_end_setup(usbp, ep);
#endif #endif
} }
} }
@ -685,7 +684,7 @@ void _usb_ep0setup(USBDriver *usbp, usbep_t ep) {
usbStartTransmitI(usbp, 0); usbStartTransmitI(usbp, 0);
chSysUnlockFromIsr(); chSysUnlockFromIsr();
#else #else
usbSetupEnd(usbp, ep); usb_lld_end_setup(usbp, ep);
#endif #endif
} }
} }
@ -729,7 +728,7 @@ void _usb_ep0in(USBDriver *usbp, usbep_t ep) {
usbStartReceiveI(usbp, 0); usbStartReceiveI(usbp, 0);
chSysUnlockFromIsr(); chSysUnlockFromIsr();
#else #else
usbSetupEnd(usbp, ep); usb_lld_end_setup(usbp, ep);
#endif #endif
return; return;
case USB_EP0_SENDING_STS: case USB_EP0_SENDING_STS:
@ -773,7 +772,7 @@ void _usb_ep0out(USBDriver *usbp, usbep_t ep) {
usbStartTransmitI(usbp, 0); usbStartTransmitI(usbp, 0);
chSysUnlockFromIsr(); chSysUnlockFromIsr();
#else #else
usbSetupEnd(usbp, ep); usb_lld_end_setup(usbp, ep);
#endif #endif
return; return;
case USB_EP0_WAITING_STS: case USB_EP0_WAITING_STS: