Closed penfold42 closed 10 hours ago
I think than access to
usb_volume
andusb_mute
might need locking.
How come ? are usb and rx_dsp on separate cores ?
I think than access to
usb_volume
andusb_mute
might need locking.How come ? are usb and rx_dsp on separate cores ?
No, but on_usb_set_mutevol
will, most likely, be called from usb_audio_device_task
, which is run from an interrupt. on_usb_audio_tx_ready
only communicates via a ring buffer, which has locking.
There's only 1 writer/1 reader and they're each less than 32 bit objects. Can i be lazy and mark them volatile?
There's only 1 writer/1 reader and they're each less than 32 bit objects. Can i be lazy and mark them volatile?
Yes, sure, we can try, should be atomic.
It seemed to work fine and continues to work fine with volatile.
It seemed to work fine and continues to work fine with volatile.
With concurrency issues it always seems to work fine at the beginning :wink:
If you still want me to add the locking, is this approach IRQ safe ?
sem_acquire_blocking(&usbcontrol_semaphore);
sem_release(&usbcontrol_semaphore);
If you still want me to add the locking, is this approach IRQ safe ?
sem_acquire_blocking(&usbcontrol_semaphore); sem_release(&usbcontrol_semaphore);
I think a critical section is appropriate in this case: https://www.raspberrypi.com/documentation/pico-sdk/high_level.html#group_critical_section
Thanks - please have a peek if you have a moment.
Looks good and works okay on Linux :+1:
Cheers
oh excellent - thanks for checking that. Does alsamixer behave sensibly?
oh excellent - thanks for checking that. Does alsamixer behave sensibly?
Yes.
I think than access to
usb_volume
andusb_mute
might need locking.