Skip to content

Commit

Permalink
sam3u2c: use MSC/CDC EPs for BULK if disabled
Browse files Browse the repository at this point in the history
  • Loading branch information
9names authored and mbrossard committed Aug 17, 2023
1 parent 929509f commit 027f425
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions source/hic_hal/atmel/sam3u2c/usb_config.c
Original file line number Diff line number Diff line change
Expand Up @@ -430,9 +430,21 @@
// </e>
// </e>

#define USBD_BULK_ENABLE BULK_ENDPOINT //no endpts left
#define USBD_BULK_EP_BULKIN 7
#define USBD_BULK_EP_BULKOUT 8
#define USBD_BULK_ENABLE BULK_ENDPOINT
// We don't have enough endpoints for BULK unless MSC or CDC are disabled.
// MSC is the best choice, since this is only useful in the fixed target IF config and we can still upload firmware via DAP.
// We'll still want MSC for the BL though, but in that case BULK isn't useful anyway.
#if USBD_MSC_ENABLE == 0
#define USBD_BULK_EP_BULKIN 1 // Use the MSC endpoints for BULK
#define USBD_BULK_EP_BULKOUT 2
#elif USBD_CDC_ACM_ENABLE == 0
#define USBD_BULK_EP_BULKIN 5 // Use the CDC endpoints for BULK
#define USBD_BULK_EP_BULKOUT 6
#else
#define USBD_BULK_EP_BULKIN 7 // Use non-existent endpoints to force an error
#define USBD_BULK_EP_BULKOUT 8 // if BULK is enabled but MSC + CDC are still enabled
#endif

#define USBD_BULK_WMAXPACKETSIZE 64
#define USBD_BULK_HS_ENABLE 1
#define USBD_BULK_HS_WMAXPACKETSIZE 512
Expand Down

0 comments on commit 027f425

Please sign in to comment.