diff options
Diffstat (limited to 'os/hal/platforms')
-rw-r--r-- | os/hal/platforms/STM32/usb_lld.c | 17 | ||||
-rw-r--r-- | os/hal/platforms/STM32/usb_lld.h | 18 |
2 files changed, 10 insertions, 25 deletions
diff --git a/os/hal/platforms/STM32/usb_lld.c b/os/hal/platforms/STM32/usb_lld.c index b0d356bcb..f09e6d0ea 100644 --- a/os/hal/platforms/STM32/usb_lld.c +++ b/os/hal/platforms/STM32/usb_lld.c @@ -58,12 +58,11 @@ static USBEndpointState ep0state; * @brief EP0 initialization structure.
*/
static const USBEndpointConfig ep0config = {
- EP_TYPE_CTRL,
+ USB_EP_MODE_TYPE_CTRL | USB_EP_MODE_TRANSACTION,
_usb_ep0in,
_usb_ep0out,
0x40,
0x40,
- 0,
0x40,
0x80
};
@@ -179,7 +178,7 @@ CH_IRQ_HANDLER(USB_LP_IRQHandler) { if (epr & EPR_CTR_TX) {
/* IN endpoint, transmission.*/
EPR_CLEAR_CTR_TX(ep);
- if (epcp->flags & USB_EP_FLAGS_IN_PACKET_MODE) {
+ if (epcp->ep_mode & USB_EP_MODE_PACKET) {
/* Packet mode, just invokes the callback.*/
(usbp)->transmitting &= ~((uint16_t)(1 << ep));
epcp->in_cb(usbp, ep);
@@ -208,7 +207,7 @@ CH_IRQ_HANDLER(USB_LP_IRQHandler) { if (epr & EPR_CTR_RX) {
EPR_CLEAR_CTR_RX(ep);
/* OUT endpoint, receive.*/
- if (epcp->flags & USB_EP_FLAGS_OUT_PACKET_MODE) {
+ if (epcp->ep_mode & USB_EP_MODE_PACKET) {
/* Packet mode, just invokes the callback.*/
(usbp)->receiving &= ~((uint16_t)(1 << ep));
epcp->out_cb(usbp, ep);
@@ -376,14 +375,14 @@ void usb_lld_init_endpoint(USBDriver *usbp, usbep_t ep) { const USBEndpointConfig *epcp = usbp->ep[ep]->config;
/* Setting the endpoint type.*/
- switch (epcp->ep_type) {
- case EP_TYPE_ISOC:
+ switch (epcp->ep_mode & USB_EP_MODE_TYPE) {
+ case USB_EP_MODE_TYPE_ISOC:
epr = EPR_EP_TYPE_ISO;
break;
- case EP_TYPE_BULK:
+ case USB_EP_MODE_TYPE_BULK:
epr = EPR_EP_TYPE_BULK;
break;
- case EP_TYPE_INTR:
+ case USB_EP_MODE_TYPE_INTR:
epr = EPR_EP_TYPE_INTERRUPT;
break;
default:
@@ -397,7 +396,7 @@ void usb_lld_init_endpoint(USBDriver *usbp, usbep_t ep) { /* OUT endpoint settings. If the endpoint is in packet mode then it must
start ready to accept data else it must start in NAK mode.*/
if (epcp->out_cb) {
- if (epcp->flags & USB_EP_FLAGS_OUT_PACKET_MODE) {
+ if (epcp->ep_mode & USB_EP_MODE_PACKET) {
usbp->receiving |= ((uint16_t)(1 << ep));
epr |= EPR_STAT_RX_VALID;
}
diff --git a/os/hal/platforms/STM32/usb_lld.h b/os/hal/platforms/STM32/usb_lld.h index 4eebda951..c1b00de06 100644 --- a/os/hal/platforms/STM32/usb_lld.h +++ b/os/hal/platforms/STM32/usb_lld.h @@ -46,16 +46,6 @@ */
#define USB_SET_ADDRESS_MODE USB_LATE_SET_ADDRESS
-/**
- * @brief Enables the packet mode for an IN endpoint.
- */
-#define USB_EP_FLAGS_IN_PACKET_MODE 1
-
-/**
- * @brief Enables the packet mode for an OUT endpoint.
- */
-#define USB_EP_FLAGS_OUT_PACKET_MODE 2
-
/*===========================================================================*/
/* Driver pre-compile time settings. */
/*===========================================================================*/
@@ -109,9 +99,9 @@ */
typedef struct {
/**
- * @brief Type of the endpoint.
+ * @brief Type and mode of the endpoint.
*/
- usbeptype_t ep_type;
+ uint32_t ep_mode;
/**
* @brief IN endpoint notification callback.
* @details This field must be set to @p NULL if the IN endpoint is not
@@ -138,10 +128,6 @@ typedef struct { uint16_t out_maxsize;
/* End of the mandatory fields.*/
/**
- * @bief Endpoint mode flags.
- */
- uint16_t flags;
- /**
* @brief Endpoint IN buffer address as offset in the PMA.
*/
uint16_t inaddr;
|