39typedef enum : uint8_t {
51typedef enum : uint8_t {
63typedef enum : uint8_t {
72typedef enum : uint8_t {
363 uint16_t max_packet);
Error Code Definitions for ra8-firmware.
ra8_err_codes_t ra8_err_t
Canonical error-return type used by every ra8-firmware API.
ra8_err_t ra8_usb_park_out_pipe(ra8_usb_speed_t speed, uint8_t pipe_num)
Park an OUT pipe at PID=NAK so an idle pipe stays quiescent.
uint16_t ra8_usb_intsts0_snapshot(ra8_usb_speed_t speed)
Read INTSTS0 without acking any bits.
ra8_err_t ra8_usb_dcp_out_arm(ra8_usb_speed_t speed)
Arm the DCP (EP0) to receive a host-to-device control data stage.
ra8_err_t ra8_usb_read_setup_if_valid(ra8_usb_speed_t speed, ra8_usb_setup_t *out_setup)
Snapshot the current SETUP packet from the controller, gated on INTSTS0.VALID (FS / CTRT path).
ra8_err_t ra8_usb_queue_out(ra8_usb_speed_t speed, uint8_t pipe_num, uint8_t *out_buf, uint16_t *inout_len, bool rearm)
Drain an OUT transfer (host -> device) from pipe_num.
ra8_usb_ep_type_t
Transfer type for a non-control endpoint.
@ k_ra8_usb_ep_type_bulk
Bulk transfer.
@ k_ra8_usb_ep_type_iso
Isochronous transfer.
@ k_ra8_usb_ep_type_intr
Interrupt transfer.
ra8_err_t ra8_usb_device_init(ra8_usb_speed_t speed)
Bring up a USB controller in device mode.
ra8_err_t ra8_usb_control_response(ra8_usb_speed_t speed, bool accept)
Issue a control-transfer status response on EP0.
void ra8_usb_dispatch(ra8_usb_speed_t speed)
Snapshot INTSTS0 and fire the installed event handler.
ra8_err_t ra8_usb_device_busreset_rearm(ra8_usb_speed_t speed)
Re-arm the default control pipe (DCP) after a host-issued bus reset.
ra8_err_t ra8_usb_exit_stop(ra8_usb_speed_t speed)
Re-enable the controller's MSTP gate (counterpart to ra8_usb_enter_stop).
ra8_err_t ra8_usb_set_address(ra8_usb_speed_t speed, uint8_t address)
Program the device USB address into USBADDR.
ra8_err_t ra8_usb_get_device_state(ra8_usb_speed_t speed, ra8_usb_dev_state_t *out_state)
Read the decoded device state from INTSTS0.DVSQ[2:0].
ra8_err_t ra8_usb_device_deinit(ra8_usb_speed_t speed)
Tear down a USB controller and drop its MSTP reference.
ra8_err_t ra8_usb_stall_endpoint(ra8_usb_speed_t speed, uint8_t pipe_num)
Stall a configured endpoint.
ra8_err_t ra8_usb_rearm_out_pipe(ra8_usb_speed_t speed, uint8_t pipe_num)
Re-arm an OUT pipe that the controller has parked at PID=NAK.
ra8_err_t ra8_usb_configure_endpoint(ra8_usb_speed_t speed, uint8_t pipe_num, uint8_t ep_addr, ra8_usb_ep_dir_t dir, ra8_usb_ep_type_t type, uint16_t max_packet)
Configure a non-control PIPE for IN or OUT bulk / interrupt / iso transfers.
ra8_err_t ra8_usb_device_attach(ra8_usb_speed_t speed, bool attached)
Raise / drop the D+ pull-up to advertise the device to the host.
void(* ra8_usb_event_fn_t)(void *ctx, ra8_usb_speed_t speed, uint16_t status_mask)
USB event callback signature.
ra8_usb_ep_dir_t
Endpoint direction.
@ k_ra8_usb_ep_dir_in
Device -> host.
@ k_ra8_usb_ep_dir_out
Host -> device.
ra8_err_t ra8_usb_read_setup_unconditional(ra8_usb_speed_t speed, ra8_usb_setup_t *out_setup)
Snapshot the current SETUP packet from the controller without gating on INTSTS0.VALID (HS / SQMON pol...
ra8_err_t ra8_usb_get_status(ra8_usb_speed_t speed, uint16_t *out_mask)
Read raw INTSTS0 snapshot.
ra8_err_t ra8_usb_enter_stop(ra8_usb_speed_t speed)
Drop the controller's MSTP gate without touching SYSCFG.
void ra8_usb_attach_handler(ra8_usb_speed_t speed, ra8_usb_event_fn_t fn, void *ctx)
Install (or detach) the per-controller USB event handler.
ra8_usb_speed_t
Selects which controller instance the call targets.
@ k_ra8_usb_speed_hs
High-Speed controller (USBHS @ 0x40351000).
@ k_ra8_usb_speed_fs
Full-Speed controller (USBFS @ 0x40250000).
ra8_err_t ra8_usb_dcp_out_read(ra8_usb_speed_t speed, uint8_t *buf, uint16_t cap, uint16_t *out_rx)
Drain an armed control-OUT data stage from the DCP (EP0).
ra8_usb_dev_state_t
Decoded INTSTS0.DVSQ[2:0] device-state values.
@ k_ra8_usb_dev_state_suspended
Suspended.
@ k_ra8_usb_dev_state_default
Default (post reset).
@ k_ra8_usb_dev_state_address
Address assigned.
@ k_ra8_usb_dev_state_configured
Configured.
@ k_ra8_usb_dev_state_powered
Powered, no reset yet.
ra8_err_t ra8_usb_queue_in(ra8_usb_speed_t speed, uint8_t pipe_num, const uint8_t *data, uint16_t len)
Queue an IN transfer (device -> host) on pipe_num.
ra8_err_t ra8_usb_clear_status(ra8_usb_speed_t speed, uint16_t mask)
Clear bits in INTSTS0.
ra8_err_t ra8_usb_dcp_in_data(ra8_usb_speed_t speed, const uint8_t *data, uint16_t len)
Push the EP0 / DCP IN data-stage payload for a control transfer.
Decoded 8-byte USB SETUP packet.
uint16_t w_length
wLength.
uint8_t b_request
bRequest code.
uint8_t bm_request_type
Request direction / type / recipient.