mirror of https://github.com/ARMmbed/mbed-os.git
SiL USB: Fix endpoint definitions for Happy Gecko
Happy only has 3 endpoints, so flag out the rest.pull/1287/head
parent
1620432608
commit
549d2b9e21
|
@ -1,5 +1,10 @@
|
||||||
|
|
||||||
#define NUMBER_OF_LOGICAL_ENDPOINTS (6)
|
#ifndef TARGET_EFM32HG_STK3400
|
||||||
|
# define NUMBER_OF_LOGICAL_ENDPOINTS (6)
|
||||||
|
#else
|
||||||
|
# define NUMBER_OF_LOGICAL_ENDPOINTS (3)
|
||||||
|
#endif
|
||||||
|
|
||||||
#define NUMBER_OF_PHYSICAL_ENDPOINTS (NUMBER_OF_LOGICAL_ENDPOINTS * 2)
|
#define NUMBER_OF_PHYSICAL_ENDPOINTS (NUMBER_OF_LOGICAL_ENDPOINTS * 2)
|
||||||
#define NUMBER_OF_ENDPOINTS (NUMBER_OF_PHYSICAL_ENDPOINTS + 2) /* Includes EP0 */
|
#define NUMBER_OF_ENDPOINTS (NUMBER_OF_PHYSICAL_ENDPOINTS + 2) /* Includes EP0 */
|
||||||
|
|
||||||
|
@ -11,12 +16,14 @@
|
||||||
#define EP2IN (5)
|
#define EP2IN (5)
|
||||||
#define EP3OUT (6)
|
#define EP3OUT (6)
|
||||||
#define EP3IN (7)
|
#define EP3IN (7)
|
||||||
#define EP4OUT (8)
|
#ifndef TARGET_EFM32HG_STK3400
|
||||||
#define EP4IN (9)
|
# define EP4OUT (8)
|
||||||
#define EP5OUT (10)
|
# define EP4IN (9)
|
||||||
#define EP5IN (11)
|
# define EP5OUT (10)
|
||||||
#define EP6OUT (12)
|
# define EP5IN (11)
|
||||||
#define EP6IN (13)
|
# define EP6OUT (12)
|
||||||
|
# define EP6IN (13)
|
||||||
|
#endif
|
||||||
|
|
||||||
#define USB_EP_TO_INDEX(ep) (ep)
|
#define USB_EP_TO_INDEX(ep) (ep)
|
||||||
#define USB_EP_TO_ADDR(ep) (((ep)>>1) | (((ep) & 1 ) ? 0x80 : 0x00))
|
#define USB_EP_TO_ADDR(ep) (((ep)>>1) | (((ep) & 1 ) ? 0x80 : 0x00))
|
||||||
|
@ -24,13 +31,15 @@
|
||||||
|
|
||||||
/* Maximum Packet sizes */
|
/* Maximum Packet sizes */
|
||||||
|
|
||||||
#define MAX_PACKET_SIZE_EP0 64
|
#define MAX_PACKET_SIZE_EP0 64
|
||||||
#define MAX_PACKET_SIZE_EP1 64
|
#define MAX_PACKET_SIZE_EP1 64
|
||||||
#define MAX_PACKET_SIZE_EP2 64
|
#define MAX_PACKET_SIZE_EP2 64
|
||||||
#define MAX_PACKET_SIZE_EP3 64
|
#define MAX_PACKET_SIZE_EP3 64
|
||||||
#define MAX_PACKET_SIZE_EP4 64
|
#ifndef TARGET_EFM32HG_STK3400
|
||||||
#define MAX_PACKET_SIZE_EP5 64
|
# define MAX_PACKET_SIZE_EP4 64
|
||||||
#define MAX_PACKET_SIZE_EP6 64
|
# define MAX_PACKET_SIZE_EP5 64
|
||||||
|
# define MAX_PACKET_SIZE_EP6 64
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Generic endpoints - intended to be portable accross devices */
|
/* Generic endpoints - intended to be portable accross devices */
|
||||||
/* and be suitable for simple USB devices. */
|
/* and be suitable for simple USB devices. */
|
||||||
|
|
|
@ -104,12 +104,14 @@ EPCB(EP2OUT)
|
||||||
EPCB(EP2IN)
|
EPCB(EP2IN)
|
||||||
EPCB(EP3OUT)
|
EPCB(EP3OUT)
|
||||||
EPCB(EP3IN)
|
EPCB(EP3IN)
|
||||||
|
#ifndef TARGET_EFM32HG_STK3400
|
||||||
EPCB(EP4OUT)
|
EPCB(EP4OUT)
|
||||||
EPCB(EP4IN)
|
EPCB(EP4IN)
|
||||||
EPCB(EP5OUT)
|
EPCB(EP5OUT)
|
||||||
EPCB(EP5IN)
|
EPCB(EP5IN)
|
||||||
EPCB(EP6OUT)
|
EPCB(EP6OUT)
|
||||||
EPCB(EP6IN)
|
EPCB(EP6IN)
|
||||||
|
#endif
|
||||||
|
|
||||||
static inline bool is_aligned(const void *pointer, size_t byte_count)
|
static inline bool is_aligned(const void *pointer, size_t byte_count)
|
||||||
{
|
{
|
||||||
|
@ -145,12 +147,14 @@ USBHAL::USBHAL(void)
|
||||||
epCallback[EP2IN ] = &USBHAL::EP2_IN_callback;
|
epCallback[EP2IN ] = &USBHAL::EP2_IN_callback;
|
||||||
epCallback[EP3OUT] = &USBHAL::EP3_OUT_callback;
|
epCallback[EP3OUT] = &USBHAL::EP3_OUT_callback;
|
||||||
epCallback[EP3IN ] = &USBHAL::EP3_IN_callback;
|
epCallback[EP3IN ] = &USBHAL::EP3_IN_callback;
|
||||||
|
#ifndef TARGET_EFM32HG_STK3400
|
||||||
epCallback[EP4OUT] = &USBHAL::EP4_OUT_callback;
|
epCallback[EP4OUT] = &USBHAL::EP4_OUT_callback;
|
||||||
epCallback[EP4IN ] = &USBHAL::EP4_IN_callback;
|
epCallback[EP4IN ] = &USBHAL::EP4_IN_callback;
|
||||||
epCallback[EP5OUT] = &USBHAL::EP5_OUT_callback;
|
epCallback[EP5OUT] = &USBHAL::EP5_OUT_callback;
|
||||||
epCallback[EP5IN ] = &USBHAL::EP5_IN_callback;
|
epCallback[EP5IN ] = &USBHAL::EP5_IN_callback;
|
||||||
epCallback[EP6OUT] = &USBHAL::EP6_OUT_callback;
|
epCallback[EP6OUT] = &USBHAL::EP6_OUT_callback;
|
||||||
epCallback[EP6IN ] = &USBHAL::EP6_IN_callback;
|
epCallback[EP6IN ] = &USBHAL::EP6_IN_callback;
|
||||||
|
#endif
|
||||||
|
|
||||||
memset(ep_state, 0, sizeof(ep_state));
|
memset(ep_state, 0, sizeof(ep_state));
|
||||||
|
|
||||||
|
@ -162,12 +166,14 @@ USBHAL::USBHAL(void)
|
||||||
ep_state[EP2IN ].intern_cb = usbhal_xfer_complete_cb_EP2IN;
|
ep_state[EP2IN ].intern_cb = usbhal_xfer_complete_cb_EP2IN;
|
||||||
ep_state[EP3OUT].intern_cb = usbhal_xfer_complete_cb_EP3OUT;
|
ep_state[EP3OUT].intern_cb = usbhal_xfer_complete_cb_EP3OUT;
|
||||||
ep_state[EP3IN ].intern_cb = usbhal_xfer_complete_cb_EP3IN;
|
ep_state[EP3IN ].intern_cb = usbhal_xfer_complete_cb_EP3IN;
|
||||||
|
#ifndef TARGET_EFM32HG_STK3400
|
||||||
ep_state[EP4OUT].intern_cb = usbhal_xfer_complete_cb_EP4OUT;
|
ep_state[EP4OUT].intern_cb = usbhal_xfer_complete_cb_EP4OUT;
|
||||||
ep_state[EP4IN ].intern_cb = usbhal_xfer_complete_cb_EP4IN;
|
ep_state[EP4IN ].intern_cb = usbhal_xfer_complete_cb_EP4IN;
|
||||||
ep_state[EP5OUT].intern_cb = usbhal_xfer_complete_cb_EP5OUT;
|
ep_state[EP5OUT].intern_cb = usbhal_xfer_complete_cb_EP5OUT;
|
||||||
ep_state[EP5IN ].intern_cb = usbhal_xfer_complete_cb_EP5IN;
|
ep_state[EP5IN ].intern_cb = usbhal_xfer_complete_cb_EP5IN;
|
||||||
ep_state[EP6OUT].intern_cb = usbhal_xfer_complete_cb_EP6OUT;
|
ep_state[EP6OUT].intern_cb = usbhal_xfer_complete_cb_EP6OUT;
|
||||||
ep_state[EP6IN ].intern_cb = usbhal_xfer_complete_cb_EP6IN;
|
ep_state[EP6IN ].intern_cb = usbhal_xfer_complete_cb_EP6IN;
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef USB_USE_DYNAMIC_MEMORY
|
#ifdef USB_USE_DYNAMIC_MEMORY
|
||||||
ep_state[EP0OUT].data_buf = ep0out_data_buf;
|
ep_state[EP0OUT].data_buf = ep0out_data_buf;
|
||||||
|
|
Loading…
Reference in New Issue