Copy the code for these two functions to their respective callers.
This is in preparation for double buffer support.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Add helper functions for manipulating the buffer memory and packet
control registers. This is in preparation for double buffer support.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
On a USB bus reset the controller address needs to be reset to zero.
Otherwise, the device becomes unresponsive after a USB reset and will
remain unresponsive until a power cycle. This often shows up in the
Linux system logs as "device descriptor read/64, error -32" messages.
Make sure USB_INTE_BUS_RESET_BITS is enabled and clear the USB address
on a bus reset.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Rename this board API function to a more generic name. This is in
preparation for calling the function from the canbus code.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
The rp2040 USB may not connect after a reset. Implementation the
recommended workaround.
Signed-off-by: Lasse Dalegaard <dalegaard@gmail.com>
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Some versions of gcc, in some cases, decide that it is OK to move the
read to `INTR` to right after clearing the `SETUP_REC` bit of
`SIE_STATUS`, instead of after the `memcpy`.
The rp2040 datasheet doesn't appear to say anything about how quickly
the `SETUP_REC` bit will be cleared in `INTR`, but regardless the
compiler should not be re-ordering the read like this.
Here we force the correct ordering using a memory barrier.
Signed-off-by: Lasse Dalegaard <dalegaard@gmail.com>