tinyusb icon indicating copy to clipboard operation
tinyusb copied to clipboard

Adding support for a generic SOF callback

Open Rocky04 opened this issue 2 years ago • 1 comments

  • Added support for a simple general callback when a new frame or micro frame started

Can be used to synchronize the scanning to the polling for HID devices or other device functions. Not useful for time critical things because the time which has passed between the interrupt and the execution is unknown. For that it would be necessary to save the timestamp when the SOF interrupt handling is done in the ISR.

Proper example implementation of the PR #2180.

Edit: A draft for a vendor specific SOF callback which is executed in the ISR via dcd_event_handler() can be found here: #2220

Rocky04 avatar Aug 08 '23 18:08 Rocky04

I'm unsure if the device port should be part of the parameter of the callback or not. I started the PR with it but removed it for now.

Rocky04 avatar Aug 08 '23 18:08 Rocky04

I've move sof status into usbd_device_t to ensure it's cleared on bus reset or configuration change.

~~Currently audio driver could call sof enable/disable different times, will fix later.~~ Or just use a bitfield for each driver instead of ref counting.

HiFiPhile avatar May 09 '24 16:05 HiFiPhile