Skip to content

Commit 049ceda

Browse files
committed
Implement dcd_edpt_close_all()
1 parent dfef0bc commit 049ceda

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

src/portable/st/stm32_fsdev/dcd_stm32_fsdev.c

+13-1
Original file line numberDiff line numberDiff line change
@@ -864,7 +864,19 @@ bool dcd_edpt_open(uint8_t rhport, tusb_desc_endpoint_t const *p_endpoint_desc)
864864
void dcd_edpt_close_all(uint8_t rhport)
865865
{
866866
(void)rhport;
867-
// TODO implement dcd_edpt_close_all()
867+
868+
for (uint32_t i = 1; i < STFSDEV_EP_COUNT; i++) {
869+
// Reset endpoint
870+
pcd_set_endpoint(USB, i, 0);
871+
// Clear EP allocation status
872+
ep_alloc_status[i].ep_num = 0xFF;
873+
ep_alloc_status[i].ep_type = 0xFF;
874+
ep_alloc_status[i].allocated[0] = false;
875+
ep_alloc_status[i].allocated[1] = false;
876+
}
877+
878+
// Reset PMA allocation
879+
ep_buf_ptr = DCD_STM32_BTABLE_BASE + 8 * MAX_EP_COUNT + 2 * CFG_TUD_ENDPOINT0_SIZE;
868880
}
869881

870882
/**

0 commit comments

Comments
 (0)