Skip to content
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 2 commits into from
Apr 12, 2024
Merged

Conversation

HiFiPhile
Copy link
Collaborator

Describe the PR
Implement dcd_edpt_close_all()

Tested with net_lwip_webserver on NUCLEO-G0B1RE , with command:
echo 1 | sudo tee /sys/bus/usb/devices/3-5/bConfigurationValue echo 2 | sudo tee /sys/bus/usb/devices/3-5/bConfigurationValue
Can't test with L053 as RAM too small.

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);
Copy link
Collaborator Author

@HiFiPhile HiFiPhile Apr 11, 2024

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.

}

// Reset PMA allocation
ep_buf_ptr = DCD_STM32_BTABLE_BASE + 8 * MAX_EP_COUNT + 2 * CFG_TUD_ENDPOINT0_SIZE;
Copy link
Collaborator Author

Choose a reason for hiding this comment

The 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.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that is totally fine.

Copy link
Owner

@hathach hathach left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

perfect, thank you

@hathach hathach merged commit 48b1e73 into hathach:master Apr 12, 2024
49 of 50 checks passed
@HiFiPhile HiFiPhile deleted the fsdev_close branch April 26, 2024 16:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants