Adding support for a generic SOF callback
- 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
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.
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.