summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorHiFiPhile <[email protected]>2024-04-11 22:02:44 +0200
committerHiFiPhile <[email protected]>2024-04-11 22:02:59 +0200
commit049ceda315cb581eba27c31952f82353bb881520 (patch)
tree4995cf097c8cb9c60311ed19ec7d6e2041a6f518 /src
parentdfef0bc81b1677c2d6bbd148b8a0cea4b64aacec (diff)
Implement dcd_edpt_close_all()
Diffstat (limited to 'src')
-rw-r--r--src/portable/st/stm32_fsdev/dcd_stm32_fsdev.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/portable/st/stm32_fsdev/dcd_stm32_fsdev.c b/src/portable/st/stm32_fsdev/dcd_stm32_fsdev.c
index c38247c38..cd6142d3a 100644
--- a/src/portable/st/stm32_fsdev/dcd_stm32_fsdev.c
+++ b/src/portable/st/stm32_fsdev/dcd_stm32_fsdev.c
@@ -864,7 +864,19 @@ bool dcd_edpt_open(uint8_t rhport, tusb_desc_endpoint_t const *p_endpoint_desc)
void dcd_edpt_close_all(uint8_t rhport)
{
(void)rhport;
- // TODO implement dcd_edpt_close_all()
+
+ for (uint32_t i = 1; i < STFSDEV_EP_COUNT; i++) {
+ // Reset endpoint
+ pcd_set_endpoint(USB, i, 0);
+ // Clear EP allocation status
+ ep_alloc_status[i].ep_num = 0xFF;
+ ep_alloc_status[i].ep_type = 0xFF;
+ ep_alloc_status[i].allocated[0] = false;
+ ep_alloc_status[i].allocated[1] = false;
+ }
+
+ // Reset PMA allocation
+ ep_buf_ptr = DCD_STM32_BTABLE_BASE + 8 * MAX_EP_COUNT + 2 * CFG_TUD_ENDPOINT0_SIZE;
}
/**