mirror of https://github.com/ARMmbed/mbed-os.git
Merge pull request #13816 from pennam/patch-stm32-usbhs-pull
STM32: allow HS USB endpoints and increase USB OTG_HS endpoints numberpull/13904/head
commit
e8a3282181
|
|
@ -33,6 +33,8 @@ class AsyncOp;
|
|||
* @{
|
||||
*/
|
||||
|
||||
#define CDC_MAX_PACKET_SIZE 64
|
||||
|
||||
class USBCDC: public USBDevice {
|
||||
public:
|
||||
|
||||
|
|
@ -219,13 +221,13 @@ protected:
|
|||
|
||||
OperationList<AsyncWrite> _tx_list;
|
||||
bool _tx_in_progress;
|
||||
uint8_t _tx_buffer[64];
|
||||
uint8_t _tx_buffer[CDC_MAX_PACKET_SIZE];
|
||||
uint8_t *_tx_buf;
|
||||
uint32_t _tx_size;
|
||||
|
||||
OperationList<AsyncRead> _rx_list;
|
||||
bool _rx_in_progress;
|
||||
uint8_t _rx_buffer[64];
|
||||
uint8_t _rx_buffer[CDC_MAX_PACKET_SIZE];
|
||||
uint8_t *_rx_buf;
|
||||
uint32_t _rx_size;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -34,8 +34,6 @@ static const uint8_t cdc_line_coding_default[7] = {0x80, 0x25, 0x00, 0x00, 0x00,
|
|||
#define CLS_DTR (1 << 0)
|
||||
#define CLS_RTS (1 << 1)
|
||||
|
||||
#define CDC_MAX_PACKET_SIZE 64
|
||||
|
||||
class USBCDC::AsyncWrite: public AsyncOp {
|
||||
public:
|
||||
AsyncWrite(USBCDC *serial, uint8_t *buf, uint32_t size):
|
||||
|
|
|
|||
|
|
@ -29,14 +29,29 @@
|
|||
#define IDX_TO_EP(idx) (((idx) >> 1)|((idx) & 1) << 7)
|
||||
|
||||
/* endpoint defines */
|
||||
#define NUM_ENDPOINTS 4
|
||||
|
||||
#if (MBED_CONF_TARGET_USB_SPEED == USE_USB_OTG_HS)
|
||||
|
||||
#define NUM_ENDPOINTS 6
|
||||
#define MAX_PACKET_SIZE_NON_ISO 512
|
||||
#define MAX_PACKET_SIZE_ISO 1023
|
||||
|
||||
#else
|
||||
|
||||
#define NUM_ENDPOINTS 4
|
||||
#define MAX_PACKET_SIZE_NON_ISO 64
|
||||
#define MAX_PACKET_SIZE_ISO (256 + 128) // Spec can go up to 1023, only ram for this though
|
||||
|
||||
#endif
|
||||
|
||||
static const uint32_t tx_ep_sizes[NUM_ENDPOINTS] = {
|
||||
MAX_PACKET_SIZE_NON_ISO,
|
||||
MAX_PACKET_SIZE_NON_ISO,
|
||||
MAX_PACKET_SIZE_NON_ISO,
|
||||
#if (MBED_CONF_TARGET_USB_SPEED == USE_USB_OTG_HS)
|
||||
MAX_PACKET_SIZE_NON_ISO,
|
||||
MAX_PACKET_SIZE_NON_ISO,
|
||||
#endif
|
||||
MAX_PACKET_SIZE_ISO
|
||||
};
|
||||
|
||||
|
|
@ -333,8 +348,11 @@ void USBPhyHw::init(USBPhyEvents *events)
|
|||
total_bytes += fifo_size;
|
||||
}
|
||||
|
||||
#if (MBED_CONF_TARGET_USB_SPEED != USE_USB_OTG_HS)
|
||||
/* 1.25 kbytes */
|
||||
MBED_ASSERT(total_bytes <= 1280);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
// Configure interrupt vector
|
||||
|
|
@ -424,11 +442,18 @@ void USBPhyHw::remote_wakeup()
|
|||
const usb_ep_table_t *USBPhyHw::endpoint_table()
|
||||
{
|
||||
static const usb_ep_table_t table = {
|
||||
#if (MBED_CONF_TARGET_USB_SPEED != USE_USB_OTG_HS)
|
||||
1280, // 1.25K for endpoint buffers but space is allocated up front
|
||||
#else
|
||||
4096,
|
||||
#endif
|
||||
{
|
||||
{USB_EP_ATTR_ALLOW_CTRL | USB_EP_ATTR_DIR_IN_AND_OUT, 0, 0},
|
||||
{USB_EP_ATTR_ALLOW_BULK | USB_EP_ATTR_ALLOW_INT | USB_EP_ATTR_DIR_IN_AND_OUT, 0, 0}, // NON ISO
|
||||
{USB_EP_ATTR_ALLOW_BULK | USB_EP_ATTR_ALLOW_INT | USB_EP_ATTR_DIR_IN_AND_OUT, 0, 0}, // NON ISO
|
||||
#if (MBED_CONF_TARGET_USB_SPEED == USE_USB_OTG_HS)
|
||||
{USB_EP_ATTR_ALLOW_ALL | USB_EP_ATTR_DIR_IN_AND_OUT, 0, 0},
|
||||
#endif
|
||||
{USB_EP_ATTR_ALLOW_ALL | USB_EP_ATTR_DIR_IN_AND_OUT, 0, 0},
|
||||
{0 | USB_EP_ATTR_DIR_IN_AND_OUT, 0, 0},
|
||||
{0 | USB_EP_ATTR_DIR_IN_AND_OUT, 0, 0},
|
||||
|
|
@ -441,7 +466,9 @@ const usb_ep_table_t *USBPhyHw::endpoint_table()
|
|||
{0 | USB_EP_ATTR_DIR_IN_AND_OUT, 0, 0},
|
||||
{0 | USB_EP_ATTR_DIR_IN_AND_OUT, 0, 0},
|
||||
{0 | USB_EP_ATTR_DIR_IN_AND_OUT, 0, 0},
|
||||
#if (MBED_CONF_TARGET_USB_SPEED != USE_USB_OTG_HS)
|
||||
{0 | USB_EP_ATTR_DIR_IN_AND_OUT, 0, 0}
|
||||
#endif
|
||||
}
|
||||
};
|
||||
return &table;
|
||||
|
|
|
|||
Loading…
Reference in New Issue