Skip to content

RP2040:Enable full size isochronous buffers#657

Merged
hathach merged 6 commits into
hathach:masterfrom
ndinsmore:RP2040_enable_isochronous_buffer_size
Feb 22, 2021
Merged

RP2040:Enable full size isochronous buffers#657
hathach merged 6 commits into
hathach:masterfrom
ndinsmore:RP2040_enable_isochronous_buffer_size

Conversation

@ndinsmore
Copy link
Copy Markdown
Contributor

Describe the PR
The RP2040 spec allows full-sized isochronous buffers, this enables it.
Additional context
The rp2040 spec limits none ISO buffers to 64 bits.

Copy link
Copy Markdown
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.

Look good to me, though I prefer to merge if() else{} with simple min function against ep max size. Let wait for more feedback from RPI team.

Comment thread src/portable/raspberrypi/rp2040/rp2040_usb.c Outdated
}
else
{
ep->transfer_size = total_len > 64 ? 64 : total_len;
Copy link
Copy Markdown
Owner

@hathach hathach Feb 18, 2021

Choose a reason for hiding this comment

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

I think this else{} could be merged to the above if() as well if 64 stands for ep size of non-iso here. Unless there is something I don't know of. @liamfraser what do you think, could we just use the max ep size for 64 here on non-ISO endpoints

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

64 is the max Non ISO EP size. We could potentially use a define for this.

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

The ep size can actually be smaller for example interrupt ep can have max packet size of 8 or 16. Will we use the actual mps (8) here or 64 still is correct ? If 8 is needed then we should change it to wMaxPacketSize (like iso) instead of fixed 64.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think we should use wMaxPacketSize everywhere. I think that's what my "// FIXME: What if low speed" was meant for but I never got round to fixing it. I would like there to be a check that wMaxPacketSize is in a valid range for RP2040 somewhere though.

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Yeah, that is what I think as well. Will update pr accordingly. usbd already perform the endpoint size check already before passing it to dcd open, so I guess it is rather OK afterwards.

bool usbd_edpt_open(uint8_t rhport, tusb_desc_endpoint_t const * desc_ep)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Ah. I think I need to swap dcd_event_bus_signal(0, DCD_EVENT_BUS_RESET) with dcd_event_bus_reset(0, TUSB_SPEED_FULL). We don't actually report our speed anywhere. I think the API might have changed since I did the original port.

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Yeah, it changes recently to dynamically support FS/HS. It is mostly for HS capable device to work properly with attached to let's say PICO FS host. Fullspeed device as default should have no issue, don't worry about low speed mode. It is virtually non-existent, no body is interested in it 😄 .

Comment thread src/portable/raspberrypi/rp2040/rp2040_usb.c Outdated
This was a github edit, not tested
Comment thread src/portable/raspberrypi/rp2040/rp2040_usb.c Outdated
@hathach hathach changed the base branch from master to edpt_ISO_xfer February 22, 2021 05:33
@hathach hathach changed the base branch from edpt_ISO_xfer to master February 22, 2021 05:33
Copy link
Copy Markdown
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.

update the PR to min check against remaining and ep size. I did accidentally merge from latest master and have to do the trick to change-rechange base for github to update the file difference. All good now, PR will be merged when ci complete. Thank you very much for the fix.

@hathach hathach merged commit d319541 into hathach:master Feb 22, 2021
@corvus-ossifragus corvus-ossifragus mentioned this pull request May 12, 2021
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.

3 participants