stm32/usb: Make CDC endpoint definitions private to core usbdev driver.
This commit is contained in:
parent
ed92d62326
commit
68271a27e6
|
@ -165,7 +165,7 @@ void HAL_PCD_SOFCallback(PCD_HandleTypeDef *hpcd) {
|
||||||
// doing other things and we must give it a chance to read our data.
|
// doing other things and we must give it a chance to read our data.
|
||||||
if (cdc->tx_buf_ptr_wait_count < 500) {
|
if (cdc->tx_buf_ptr_wait_count < 500) {
|
||||||
USB_OTG_GlobalTypeDef *USBx = hpcd->Instance;
|
USB_OTG_GlobalTypeDef *USBx = hpcd->Instance;
|
||||||
if (USBx_INEP(CDC_IN_EP & 0x7f)->DIEPTSIZ & USB_OTG_DIEPTSIZ_XFRSIZ) {
|
if (USBx_INEP(cdc->base.in_ep & 0x7f)->DIEPTSIZ & USB_OTG_DIEPTSIZ_XFRSIZ) {
|
||||||
// USB in-endpoint is still reading the data
|
// USB in-endpoint is still reading the data
|
||||||
cdc->tx_buf_ptr_wait_count++;
|
cdc->tx_buf_ptr_wait_count++;
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -39,17 +39,13 @@
|
||||||
#define MSC_IN_EP (0x81)
|
#define MSC_IN_EP (0x81)
|
||||||
#define MSC_OUT_EP (0x01)
|
#define MSC_OUT_EP (0x01)
|
||||||
|
|
||||||
// Need to define here for usbd_cdc_interface.c (it needs CDC_IN_EP)
|
|
||||||
#define CDC_IN_EP (0x83)
|
|
||||||
#define CDC_OUT_EP (0x03)
|
|
||||||
#define CDC_CMD_EP (0x82)
|
|
||||||
|
|
||||||
struct _usbd_cdc_msc_hid_state_t;
|
struct _usbd_cdc_msc_hid_state_t;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
struct _usbd_cdc_msc_hid_state_t *usbd; // The parent USB device
|
struct _usbd_cdc_msc_hid_state_t *usbd; // The parent USB device
|
||||||
uint32_t ctl_packet_buf[CDC_DATA_MAX_PACKET_SIZE / 4]; // Force 32-bit alignment
|
uint32_t ctl_packet_buf[CDC_DATA_MAX_PACKET_SIZE / 4]; // Force 32-bit alignment
|
||||||
uint8_t iface_num;
|
uint8_t iface_num;
|
||||||
|
uint8_t in_ep;
|
||||||
uint8_t cur_request;
|
uint8_t cur_request;
|
||||||
uint8_t cur_length;
|
uint8_t cur_length;
|
||||||
volatile uint8_t tx_in_progress;
|
volatile uint8_t tx_in_progress;
|
||||||
|
|
|
@ -61,6 +61,11 @@
|
||||||
#define MSC_IFACE_NUM_WITH_CDC (0)
|
#define MSC_IFACE_NUM_WITH_CDC (0)
|
||||||
#define HID_IFACE_NUM_WITH_CDC (0)
|
#define HID_IFACE_NUM_WITH_CDC (0)
|
||||||
#define HID_IFACE_NUM_WITH_MSC (1)
|
#define HID_IFACE_NUM_WITH_MSC (1)
|
||||||
|
|
||||||
|
#define CDC_IN_EP (0x83)
|
||||||
|
#define CDC_OUT_EP (0x03)
|
||||||
|
#define CDC_CMD_EP (0x82)
|
||||||
|
|
||||||
#define HID_IN_EP_WITH_CDC (0x81)
|
#define HID_IN_EP_WITH_CDC (0x81)
|
||||||
#define HID_OUT_EP_WITH_CDC (0x01)
|
#define HID_OUT_EP_WITH_CDC (0x01)
|
||||||
#define HID_IN_EP_WITH_MSC (0x83)
|
#define HID_IN_EP_WITH_MSC (0x83)
|
||||||
|
@ -650,6 +655,10 @@ int USBD_SelectMode(usbd_cdc_msc_hid_state_t *usbd, uint32_t mode, USBD_HID_Mode
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (usbd->usbd_mode & USBD_MODE_CDC) {
|
||||||
|
usbd->cdc->in_ep = CDC_IN_EP;
|
||||||
|
}
|
||||||
|
|
||||||
// configure the HID descriptor, if needed
|
// configure the HID descriptor, if needed
|
||||||
if (usbd->usbd_mode & USBD_MODE_HID) {
|
if (usbd->usbd_mode & USBD_MODE_HID) {
|
||||||
uint8_t *hid_desc = usbd->hid->desc;
|
uint8_t *hid_desc = usbd->hid->desc;
|
||||||
|
|
Loading…
Reference in New Issue