-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FSDEV: Implement dcd_edpt_close_all() #2592
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -459,13 +459,9 @@ static const tusb_desc_endpoint_t ep0IN_desc = { | |
|
||
static void dcd_handle_bus_reset(void) | ||
{ | ||
//__IO uint16_t * const epreg = &(EPREG(0)); | ||
USB->DADDR = 0u; // disable USB peripheral by clearing the EF flag | ||
|
||
for (uint32_t i = 0; i < STFSDEV_EP_COUNT; i++) { | ||
// Clear all EPREG (or maybe this is automatic? I'm not sure) | ||
pcd_set_endpoint(USB, i, 0u); | ||
|
||
// Clear EP allocation status | ||
ep_alloc_status[i].ep_num = 0xFF; | ||
ep_alloc_status[i].ep_type = 0xFF; | ||
|
@@ -624,7 +620,6 @@ static void dcd_ep_ctr_rx_handler(uint32_t wIstr) | |
uint16_t remaining = xfer->total_len - xfer->queued_len; | ||
uint16_t cnt = tu_min16(remaining, xfer->max_packet_size); | ||
pcd_set_ep_rx_cnt(USB, EPindex, cnt); | ||
pcd_set_ep_rx_cnt(USB, EPindex, remaining); | ||
} | ||
pcd_set_ep_rx_status(USB, EPindex, USB_EP_RX_VALID); | ||
} | ||
|
@@ -869,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; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since EP0 size is always aligned to buffer size, I didn't put more check. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. that is totally fine. |
||
} | ||
|
||
/** | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Confirmed with oldest F1 datasheet and actual behavior.