drivers: udc: add helper to estimate FIFO and largest endpoint MPS#94766
drivers: udc: add helper to estimate FIFO and largest endpoint MPS#94766jfischer-no wants to merge 6 commits intozephyrproject-rtos:mainfrom
Conversation
a080a34 to
ac91f24
Compare
|
| * USB device controller endpoint status | ||
| */ | ||
| struct udc_ep_stat { | ||
| /** Endpoint is claimed */ |
There was a problem hiding this comment.
What does it mean that endpoint is claimed?
There was a problem hiding this comment.
That is explained in the second commit, dd69e48#diff-e35b5db282dc4b82092896f84fea69d5be994a93c813eb07cad87f55b33c2523L525-R547
There was a problem hiding this comment.
The commit does not explain what claimed means.
The stack uses the function to test the endpoint configuration, calling
it for any alternate settings. We could also use it to mark the endpoint
as claimed
What exactly does it mean that endpoint is claimed?
There was a problem hiding this comment.
It means that the stack "demands" it for use in a configuration. The driver can then determine which of its resources are being used.
| void udc_get_eps_fifo_size(const struct device *dev, | ||
| size_t *const rx_size, | ||
| size_t *const tx_size, | ||
| uint16_t *const out_mps, | ||
| uint16_t *const in_mps); |
There was a problem hiding this comment.
rx_size and tx_size sounds way too specific. Why not just have the function populate 16-element array for OUT and 16-element array for IN endpoints? Then the driver could use that information according to actual hardware constraints.
There was a problem hiding this comment.
This is done in the third commit f400ffb#diff-e35b5db282dc4b82092896f84fea69d5be994a93c813eb07cad87f55b33c2523.
There was a problem hiding this comment.
Where exactly? Can you point exact lines?
There was a problem hiding this comment.
Exactly: It is stored for each endpoint in struct udc_ep_config, L119..L120
ac91f24 to
ab12ec2
Compare
|
|
This pull request has been marked as stale because it has been open (more than) 60 days with no activity. Remove the stale label or add a comment saying that you would like to have the label removed otherwise this pull request will automatically be closed in 14 days. Note, that you can always re-open a closed pull request at any time. |
If the stack passes a zero MPS value during initialization, there is a function to update the bulk/interrupt endpoint MPS. This function is no longer used in the tree and is a bit problematic because it does not take supported speed into account. Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
The stack uses the function to test the endpoint configuration, calling it for any alternate settings. We could also use it to mark the endpoint as claimed, determine the largest endpoint size, and store it in the endpoint configuration. Rename it to udc_ep_claim_config(). Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
To configure FIFOs properly, UDC controllers with internal endpoint FIFO memory may require information such as the largest endpoint MPS, the number of endpoints, and the estimated RX and TX FIFO sizes. Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
To ensure that the alternate endpoint setting does not result in a memory window that is too small being allocated and locked because a higher FIFO is still in use, use the maximum MPS value for FIFO memory allocation. Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
Check that the memory usage calculated by the stack does not exceed the available DPRAM space for the interface endpoints. Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
Use largest OUT endpoint MPS and number of OUT endpoints to configure RX FIFO based on the stack configuration. Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
ab12ec2 to
bdb3f03
Compare
|
❌ The last analysis has failed. |
|
This pull request has been marked as stale because it has been open (more than) 30 days with no activity. Remove the stale label or add a comment saying that you would like to have the label removed otherwise this pull request will automatically be closed in 7 days. Note, that you can always re-open a closed pull request at any time. |



To configure FIFOs properly, UDC controllers with internal endpoint FIFO
memory may require information such as the largest endpoint MPS, the
number of endpoints, and the estimated RX and TX FIFO sizes.