|
ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
|
Module-private state + interfaces shared by the board_usb TUs. More...
Go to the source code of this file.
Data Structures | |
| struct | usb_out_buf_t |
| One pipe's host-visible OUT staging buffer (host -> device payload). More... | |
| struct | usb_in_buf_t |
| One pipe's device-visible IN staging buffer (device -> host payload). More... | |
| struct | usb_state_t |
| Aggregate USBFS controller + virtual-host model state. More... | |
| struct | usb_setup_step_t |
| One SETUP step in the host enumeration script (USB 2.0 sec 9.4). More... | |
Enumerations | |
| enum | usb_geom_t : uint64_t { k_usb_base = 0x40250000UL , k_usb_span = 0x100UL , k_usb_reg_words = 0x100UL / 2U , k_usb_dcp_mps = 64UL , k_usb_pipe_mps = 64UL , k_usb_pipe_count = 10UL , k_usb_echo_cap = 256UL , k_usb_in_cap = 512UL } |
| USBFS register-window geometry and the staging-buffer caps. More... | |
| enum | usb_breq_t : uint8_t { k_usb_req_get_descriptor = 0x06U , k_usb_req_set_address = 0x05U , k_usb_req_set_config = 0x09U } |
| bRequest values the virtual host issues (USB 2.0 sec 9.4). More... | |
| enum | cdc_breq_t : uint8_t { k_cdc_req_set_line_coding = 0x20U , k_cdc_req_set_control_line_state = 0x22U } |
| CDC class bRequest values issued after configuration (CDC 1.20). More... | |
| enum | usb_dt_t : uint8_t { k_usb_dt_device = 0x01U , k_usb_dt_config = 0x02U , k_usb_dt_string = 0x03U } |
| bDescriptorType values used in GET_DESCRIPTOR wValue high byte. More... | |
| enum | usb_dir_t : uint8_t { k_usb_dir_device_to_host = 0x80U , k_usb_dir_host_to_device = 0x00U } |
| bmRequestType direction bit (USB 2.0 sec 9.3 Table 9-2). More... | |
| enum | usb_rhst_t : uint16_t { k_usb_rhst_fs = 0x0002U } |
| DVSTCTR0.RHST reset-handshake field values (HUM Ch 36.2.5 "DVSTCTR0", p 1971). More... | |
| enum | usb_const_t : uint32_t { k_usb_byte_bits = 8U , k_usb_byte_mask = 0xFFU , k_usb_cfifo_h = 2U , k_usb_cfifo_hh = 3U , k_usb_addr_assigned = 7U , k_usb_config_value = 1U , k_usb_desc8_len = 8U , k_usb_desc_dev_len = 18U , k_usb_cfg_probe_len = 9U , k_usb_cfg_full_cap = 255U , k_usb_str_len = 255U , k_usb_step_timeout = 64U , k_usb_reset_settle = 4U , k_usb_post_cfg_idle = 8U , k_usb_log_cap = 48U , k_usb_log_width = 96U , k_usb_trace_dump_max = 24U , k_usb_bulk_in_pipe = 1U , k_usb_bulk_out_pipe = 2U , k_usb_dcp_pipe_bit = 1U } |
| Misc small constants used across the model (avoid bare literals). More... | |
| enum | usb_host_phase_t : uint8_t { k_phase_idle = 0U , k_phase_reset = 1U , k_phase_setup = 2U , k_phase_configured = 3U , k_phase_done = 4U } |
| Host state-machine phases. More... | |
| enum | usb_host_sub_t : uint8_t { k_sub_deliver = 0U , k_sub_wait_in = 1U , k_sub_status = 2U , k_sub_wait_ack = 3U , k_sub_next = 4U } |
| Per-SETUP-step sub-states. More... | |
| enum | usb_lit_t : uint32_t { k_iface_class_off = 5U , k_usb_req_class_iface = 0x21U , k_cdc_line_coding_len = 7U , k_scsi_inquiry = 0x12U , k_inquiry_len = 36U , k_scsi_read_capacity = 0x25U , k_scsi_read10 = 0x28U , k_cdb10_len = 10U , k_sector_bytes = 512U , k_usb_shift24 = 24U , k_cbw_tag_off = 4U , k_cbw_dtl_off = 8U , k_cbw_flags_off = 12U , k_cbw_lun_off = 13U , k_cbw_cdblen_off = 14U , k_cbw_cdb_off = 15U } |
| USB class-request, SCSI command, and CBW-layout constants. More... | |
| enum | usb_le_lane_t : uint8_t { k_le_lane_b0 = 0U , k_le_lane_b1 = 1U , k_le_lane_b2 = 2U , k_le_lane_b3 = 3U } |
| Byte-lane offsets within a little-endian 32-bit protocol field. More... | |
| enum | scsi_cap10_off_t : uint8_t { k_cap10_last_lba_off = 0U , k_cap10_blocklen_off = 4U } |
| Field offsets in a SCSI READ CAPACITY(10) parameter block. More... | |
| enum | usb_be_lane_t : uint8_t { k_be_lane_b3 = 0U , k_be_lane_b2 = 1U , k_be_lane_b1 = 2U , k_be_lane_b0 = 3U } |
| Byte-lane offsets within a big-endian 32-bit SCSI field. More... | |
| enum | usb_dev_class_t : uint8_t { k_usb_class_unknown = 0U , k_usb_class_cdc = 1U , k_usb_class_hid = 2U , k_usb_class_msc = 3U , k_usb_class_printer = 4U , k_usb_class_vendor = 5U } |
| USB device class the host detected from the interface descriptor. More... | |
| enum | usb_iclass_t : uint8_t { k_usb_iclass_cdc_comm = 0x02U , k_usb_iclass_hid = 0x03U , k_usb_iclass_printer = 0x07U , k_usb_iclass_msc = 0x08U , k_usb_iclass_cdc_data = 0x0AU , k_usb_iclass_vendor = 0xFFU , k_usb_dt_interface = 0x04U } |
| bInterfaceClass codes + the INTERFACE descriptor type (USB 2.0). More... | |
Functions | |
| static uint32_t | internal_usb_word (uint64_t off) |
| Word index into the 16-bit register shadow for a window offset. | |
| void | priv_usb_log_line (const char *msg) |
| Append one already-formatted line to the enumeration-step log (core). | |
| void | priv_usb_log_count (const char *label, unsigned n) |
| Log a labelled count once (label + n) into the step log (core). | |
| uint16_t | priv_usb_intsts0 (void) |
| INTSTS0 value the device reads: event bits OR computed fields (dev). | |
| void | priv_usb_intsts0_set (uint8_t bit) |
| Set one INTSTS0 event bit in the register shadow (dev). | |
| void | priv_usb_raise_irq (uc_engine *uc) |
| Pend the device's ICU interrupt via the registered raiser (dev). | |
| uint32_t | priv_usb_reg_read (uint64_t off, unsigned size) |
| USBFS window register read dispatch (dev). | |
| void | priv_usb_reg_write (uint64_t off, uint32_t value, unsigned size) |
| USBFS window register write dispatch (dev). | |
| void | priv_usb_detect_class (const uint8_t *d, uint16_t len) |
| Detect the device class from the enumerated config descriptor (vhost). | |
| const char * | priv_usb_class_active_str (void) |
| Human label of the detected class + live traffic totals (vhost). | |
| void | priv_host_run_idle_phase (uc_engine *uc) |
| Virtual-host phase driver: waiting for the device pull-up (vhost). | |
| void | priv_host_run_reset_phase (uc_engine *uc) |
| Virtual-host phase driver: holding bus reset (vhost). | |
| void | priv_host_run_setup_phase (uc_engine *uc) |
| Virtual-host phase driver: walking the enumeration script (vhost). | |
| void | priv_host_run_configured_phase (uc_engine *uc) |
| Virtual-host phase driver: post-CONFIGURED class traffic (vhost). | |
| void | priv_host_echo_read_in (uc_engine *uc) |
| Drain any device bulk-IN data the virtual host is owed (vhost). | |
| void | priv_bridge_pump_device (uc_engine *uc) |
| Pump the device's level-triggered DCP-OUT receive (bridge). | |
| bool | priv_host_device_attached (void) |
| True when SYSCFG.DPRPU is set: the device attached its pull-up (vhost). | |
| void | priv_host_deliver_setup (uc_engine *uc, const usb_setup_step_t *s) |
| Latch a SETUP packet into USBREQ..USBLENG + raise CTRT (vhost). | |
| void | priv_host_apply_no_data (uc_engine *uc, const usb_setup_step_t *s) |
| Apply a no-data control write's device-state side effects (vhost). | |
| bool | priv_host_dcp_pid_buf (void) |
| True when the device armed its DCP to BUF (ready for OUT) (vhost). | |
| bool | priv_host_take_ccpl (void) |
| Consume the device's CCPL (control transfer complete) (vhost). | |
| void | priv_host_mark_configured (uc_engine *uc) |
| Advance the device state to CONFIGURED (vhost). | |
Variables | |
| usb_state_t | s_usb |
| Controller + FIFO state (core). | |
| bool | s_trace |
| –trace verbose logging (core). | |
| board_usb_irq_raiser_t | s_raise |
| ICU pend callback (core). | |
| bool | s_external_host |
| Bridge host owns the bus (core). | |
| bool | s_roles_swapped |
| Self-loop role polarity (core). | |
| uint16_t | g_dev_irq_event |
| Device ICU event number (core). | |
| uint8_t | s_dcp_hold [k_usb_in_cap] |
| Held control-OUT bytes (core). | |
| uint16_t | s_dcp_hold_len |
| Held byte count (core). | |
| bool | s_dcp_hold_pending |
| Held bytes await the arm (core). | |
| uint8_t | s_host_phase |
| Virtual-host phase (core). | |
| uint8_t | s_host_step |
| Enumeration-script index (core). | |
| uint8_t | s_host_substate |
| Per-step sub-state (core). | |
| uint32_t | s_host_wait |
| Sub-state wait ticks (core). | |
| bool | s_configured |
| Device reached CONFIGURED (core). | |
| uint32_t | s_usb_irqs |
| USB interrupts raised (core). | |
| uint8_t | s_echo_out [k_usb_echo_cap] |
| Host bulk-OUT payload (core). | |
| uint32_t | s_echo_out_len |
| Bytes queued by –usb-in (core). | |
| uint32_t | s_echo_out_sent |
| Bytes delivered to device (core). | |
| uint32_t | s_echo_in_got |
| Echoed bytes read back (core). | |
| uint8_t | s_dev_class |
| Detected device class (vhost). | |
| uint32_t | s_hid_reports |
| HID reports read (vhost). | |
| int32_t | s_hid_cx |
| Accumulated HID mouse X (vhost). | |
| int32_t | s_hid_cy |
| Accumulated HID mouse Y (vhost). | |
| uint8_t | s_hid_buttons |
| Last HID button bitmap (vhost). | |
| uint32_t | s_msc_blocks |
| MSC capacity in blocks (vhost). | |
| uint32_t | s_msc_block_len |
| MSC block size (vhost). | |
| uint32_t | s_msc_read_ok |
| MSC read data bytes (vhost). | |
| bool | s_msc_inquiry_ok |
| MSC INQUIRY completed (vhost). | |
| bool | s_loop_latched |
| Firmware host owns the bus (loop). | |
| uint32_t | s_loop_setups |
| SETUPs from the fw host (loop). | |
| uint32_t | s_loop_bulk_out_pkts |
| Bulk-OUT packets (loop). | |
| uint32_t | s_loop_bulk_in_pkts |
| Bulk-IN packets (loop). | |
Module-private state + interfaces shared by the board_usb TUs.
The USBFS device model is one logical module split across five translation units (core lifecycle/tick/report, the register+CFIFO model, the built-in virtual chapter-9 host, the USBHS<->USBFS bridge, and the self-loop transport). They share one controller state instance and a set of bookkeeping counters; this header carries the shared types, the state declarations and the cross-TU helpers. Nothing here is part of the emulator-facing API in inc/board_usb.h.
Definition in file board_usb_internal.h.
| enum cdc_breq_t : uint8_t |
CDC class bRequest values issued after configuration (CDC 1.20).
| Enumerator | |
|---|---|
| k_cdc_req_set_line_coding | SET_LINE_CODING (OUT data). |
| k_cdc_req_set_control_line_state | SET_CONTROL_LINE_STATE. |
Definition at line 61 of file board_usb_internal.h.
| enum scsi_cap10_off_t : uint8_t |
Field offsets in a SCSI READ CAPACITY(10) parameter block.
Both fields are big-endian u32 (SCSI byte order), so lane 0 is the most-significant byte – the opposite of usb_le_lane_t.
| Enumerator | |
|---|---|
| k_cap10_last_lba_off | Returned logical block address (BE u32). |
| k_cap10_blocklen_off | Block length in bytes (BE u32). |
Definition at line 220 of file board_usb_internal.h.
| enum usb_be_lane_t : uint8_t |
Byte-lane offsets within a big-endian 32-bit SCSI field.
| Enumerator | |
|---|---|
| k_be_lane_b3 | Most-significant byte (bits 31:24). |
| k_be_lane_b2 | Bits 23:16. |
| k_be_lane_b1 | Bits 15:8. |
| k_be_lane_b0 | Least-significant byte (bits 7:0). |
Definition at line 226 of file board_usb_internal.h.
| enum usb_breq_t : uint8_t |
bRequest values the virtual host issues (USB 2.0 sec 9.4).
| Enumerator | |
|---|---|
| k_usb_req_get_descriptor | GET_DESCRIPTOR. |
| k_usb_req_set_address | SET_ADDRESS. |
| k_usb_req_set_config | SET_CONFIGURATION. |
Definition at line 54 of file board_usb_internal.h.
| enum usb_const_t : uint32_t |
Misc small constants used across the model (avoid bare literals).
Definition at line 85 of file board_usb_internal.h.
| enum usb_dev_class_t : uint8_t |
USB device class the host detected from the interface descriptor.
Definition at line 234 of file board_usb_internal.h.
| enum usb_dir_t : uint8_t |
bmRequestType direction bit (USB 2.0 sec 9.3 Table 9-2).
| Enumerator | |
|---|---|
| k_usb_dir_device_to_host | IN: device -> host (control read). |
| k_usb_dir_host_to_device | OUT: host -> device (control write). |
Definition at line 74 of file board_usb_internal.h.
| enum usb_dt_t : uint8_t |
bDescriptorType values used in GET_DESCRIPTOR wValue high byte.
| Enumerator | |
|---|---|
| k_usb_dt_device | DEVICE descriptor. |
| k_usb_dt_config | CONFIGURATION descriptor. |
| k_usb_dt_string | STRING descriptor. |
Definition at line 67 of file board_usb_internal.h.
| enum usb_geom_t : uint64_t |
USBFS register-window geometry and the staging-buffer caps.
Definition at line 37 of file board_usb_internal.h.
| enum usb_host_phase_t : uint8_t |
Host state-machine phases.
Definition at line 158 of file board_usb_internal.h.
| enum usb_host_sub_t : uint8_t |
Per-SETUP-step sub-states.
Definition at line 167 of file board_usb_internal.h.
| enum usb_iclass_t : uint8_t |
bInterfaceClass codes + the INTERFACE descriptor type (USB 2.0).
Definition at line 244 of file board_usb_internal.h.
| enum usb_le_lane_t : uint8_t |
Byte-lane offsets within a little-endian 32-bit protocol field.
The USB Mass Storage CBW stores dCBWTag and dCBWDataTransferLength little-endian, so each is written as four byte lanes relative to the field's own offset. Naming the lanes keeps k_cbw_tag_off + k_le_lane_b1 readable as "byte 1 of the tag" rather than as the bare index 5.
| Enumerator | |
|---|---|
| k_le_lane_b0 | Least-significant byte (bits 7:0). |
| k_le_lane_b1 | Bits 15:8. |
| k_le_lane_b2 | Bits 23:16. |
| k_le_lane_b3 | Most-significant byte (bits 31:24). |
Definition at line 205 of file board_usb_internal.h.
| enum usb_lit_t : uint32_t |
USB class-request, SCSI command, and CBW-layout constants.
Definition at line 176 of file board_usb_internal.h.
| enum usb_rhst_t : uint16_t |
DVSTCTR0.RHST reset-handshake field values (HUM Ch 36.2.5 "DVSTCTR0", p 1971).
| Enumerator | |
|---|---|
| k_usb_rhst_fs | Link settled at full speed after the bus reset. |
Definition at line 80 of file board_usb_internal.h.
|
inlinestatic |
Word index into the 16-bit register shadow for a window offset.
Word index into the 16-bit register shadow for a window offset; this step is contained within the board USB model and uses bounded caller or module-owned storage.
| [in] | off | Register or byte offset addressed by the operation. |
| value | The operation-specific USB word value. |
Definition at line 275 of file board_usb_internal.h.
References RA8_INTERNAL.
Referenced by board_usb_bridge_bulk_in_take(), board_usb_bridge_bulk_out(), board_usb_loop_bulk_in_read(), board_usb_loop_bulk_out(), board_usb_loop_ctrl_out(), board_usb_loop_setup(), internal_cfifo_is_in(), internal_cfifo_pipe(), internal_host_echo_send_out(), internal_host_latch_setup(), internal_host_msc_send_cbw(), internal_host_msc_take_in(), priv_bridge_pump_device(), priv_host_apply_no_data(), priv_host_dcp_pid_buf(), priv_host_device_attached(), priv_host_echo_read_in(), priv_host_take_ccpl(), priv_usb_intsts0(), priv_usb_intsts0_set(), priv_usb_reg_read(), and priv_usb_reg_write().
| void priv_bridge_pump_device | ( | uc_engine * | uc | ) |
Pump the device's level-triggered DCP-OUT receive (bridge).
Pump the device's level-triggered dcp-out receive (bridge); this step is contained within the board USB model and uses bounded caller or module-owned storage.
| [in,out] | uc | Unicorn engine whose emulated state is read or updated. |
Pump the device's level-triggered DCP-OUT receive (bridge).
In the chip-internal self-loop the polled host issues a control-write data stage (e.g. a DFU_DNLOAD block) on the DCP before the device firmware – running on the same core off its own IRQ – has armed the DCP to receive it. On real silicon the SIE keeps re-issuing the OUT token until the device ACKs; here the one-shot BRDY the delivery pended is cleared by the device's own ra8_usb_dcp_out_arm (W0C) and never re-raised, so the receive stalls. This pump, run each emulation chunk while the external host drives the device, re-raises the device DCP BRDY whenever the device has armed the DCP for OUT (PID=BUF and BRDYENB.PIPE0) and undrained OUT data is still staged – exactly the SIE's OUT-retry, so the device reads the block on its next BRDY ISR.
| [in,out] | uc | Unicorn engine (to pend the device USB interrupt). |
Definition at line 258 of file board_usb_bridge.c.
References internal_usb_word(), k_ra8_int0_bit_brdy, k_ra8_pid_buf, k_ra8_pid_mask, k_ra8_usb_off_brdyenb, k_ra8_usb_off_brdysts, k_ra8_usb_off_dcpctr, k_usb_dcp_pipe_bit, memcpy(), priv_usb_intsts0_set(), priv_usb_raise_irq(), s_dcp_hold, s_dcp_hold_len, s_dcp_hold_pending, and s_usb.
Referenced by board_usb_tick().
| void priv_host_apply_no_data | ( | uc_engine * | uc, |
| const usb_setup_step_t * | s ) |
Apply a no-data control write's device-state side effects (vhost).
Apply a no-data control write's device-state side effects (vhost); this step is contained within the board USB model and uses bounded caller or module-owned storage.
| [in,out] | uc | Unicorn engine whose emulated state is read or updated. |
| [in] | s | Module state instance processed by the operation. |
Apply a no-data control write's device-state side effects (vhost).
Definition at line 334 of file board_usb_vhost.c.
References usb_setup_step_t::b_request, internal_usb_word(), k_ra8_dvsq_address, k_ra8_int0_bit_dvst, k_ra8_usb_off_usbaddr, k_ra8_usbaddr_addr_mask, k_usb_log_width, k_usb_req_set_address, priv_usb_intsts0_set(), priv_usb_log_line(), priv_usb_raise_irq(), s_usb, and usb_setup_step_t::w_value.
Referenced by board_usb_bridge_deliver_setup(), and internal_host_step_deliver().
| bool priv_host_dcp_pid_buf | ( | void | ) |
True when the device armed its DCP to BUF (ready for OUT) (vhost).
True when the device armed its dcp to buf (ready for out) (vhost); this step is contained within the board USB model and uses bounded caller or module-owned storage.
| true | The host default control pipe pid buf condition holds or completed successfully; false otherwise. |
True when the device armed its DCP to BUF (ready for OUT) (vhost).
Definition at line 315 of file board_usb_vhost.c.
References internal_usb_word(), k_ra8_pid_buf, k_ra8_pid_mask, k_ra8_usb_off_dcpctr, and s_usb.
Referenced by board_usb_bridge_dcp_in_ready(), and internal_host_step_wait_in().
| void priv_host_deliver_setup | ( | uc_engine * | uc, |
| const usb_setup_step_t * | s ) |
Latch a SETUP packet into USBREQ..USBLENG + raise CTRT (vhost).
Latch a setup packet into usbreq..usbleng + raise ctrt (vhost); this step is contained within the board USB model and uses bounded caller or module-owned storage.
| [in,out] | uc | Unicorn engine whose emulated state is read or updated. |
| [in] | s | Module state instance processed by the operation. |
Latch a SETUP packet into USBREQ..USBLENG + raise CTRT (vhost).
Definition at line 266 of file board_usb_vhost.c.
References usb_setup_step_t::bm_request_type, internal_host_latch_setup(), internal_host_setup_ctsq(), k_ra8_int0_bit_ctrt, k_usb_dcp_mps, k_usb_dir_device_to_host, k_usb_log_width, memset(), usb_setup_step_t::name, priv_usb_intsts0_set(), priv_usb_log_line(), priv_usb_raise_irq(), s_external_host, s_host_step, s_usb, and usb_setup_step_t::w_length.
Referenced by board_usb_bridge_deliver_setup(), and internal_host_step_deliver().
| bool priv_host_device_attached | ( | void | ) |
True when SYSCFG.DPRPU is set: the device attached its pull-up (vhost).
True when syscfg.dprpu is set: the device attached its pull-up (vhost); this step is contained within the board USB model and uses bounded caller or module-owned storage.
| true | The host device attached condition holds or completed successfully; false otherwise. |
True when SYSCFG.DPRPU is set: the device attached its pull-up (vhost).
Definition at line 219 of file board_usb_vhost.c.
References internal_usb_word(), k_ra8_syscfg_bit_dprpu, k_ra8_usb_off_syscfg, and s_usb.
Referenced by board_usb_dev_attached(), board_usb_loop_attached(), and priv_host_run_idle_phase().
| void priv_host_echo_read_in | ( | uc_engine * | uc | ) |
Drain any device bulk-IN data the virtual host is owed (vhost).
Drain any device bulk-in data the virtual host is owed (vhost); this step is contained within the board USB model and uses bounded caller or module-owned storage.
| [in,out] | uc | Unicorn engine whose emulated state is read or updated. |
Drain any device bulk-IN data the virtual host is owed (vhost).
After consuming the buffer the host raises BEMP for the pipe – the "transmit buffer empty" interrupt the RA dcd uses to complete an IN transfer. Without it the device-side USBX blocks after one packet, so a HID device that streams reports (the boot mouse) freezes after the first; with it the reports keep flowing and the cursor walks its square.
| [in,out] | uc | Unicorn engine (to pend the USB interrupt). |
Definition at line 589 of file board_usb_vhost.c.
References internal_usb_hid_decode_report(), internal_usb_word(), k_ra8_int0_bit_bemp, k_ra8_usb_off_bempsts, k_usb_bulk_in_pipe, k_usb_class_hid, priv_usb_intsts0_set(), priv_usb_log_count(), priv_usb_raise_irq(), s_dev_class, s_echo_in_got, and s_usb.
Referenced by board_usb_tick(), and priv_host_run_configured_phase().
| void priv_host_mark_configured | ( | uc_engine * | uc | ) |
Advance the device state to CONFIGURED (vhost).
Advance the device state to configured (vhost); this step is contained within the board USB model and uses bounded caller or module-owned storage.
| [in,out] | uc | Unicorn engine whose emulated state is read or updated. |
Advance the device state to CONFIGURED (vhost).
Definition at line 456 of file board_usb_vhost.c.
References k_ra8_dvsq_configured, k_ra8_int0_bit_dvst, priv_usb_intsts0_set(), priv_usb_log_line(), priv_usb_raise_irq(), s_configured, and s_usb.
Referenced by board_usb_bridge_mark_configured(), board_usb_loop_take_ccpl(), and internal_host_step_next().
| void priv_host_run_configured_phase | ( | uc_engine * | uc | ) |
Virtual-host phase driver: post-CONFIGURED class traffic (vhost).
Virtual-host phase driver: post-configured class traffic (vhost); this step is contained within the board USB model and uses bounded caller or module-owned storage.
| [in,out] | uc | Unicorn engine whose emulated state is read or updated. |
Virtual-host phase driver: post-CONFIGURED class traffic (vhost).
Definition at line 935 of file board_usb_vhost.c.
References internal_host_echo_send_out(), internal_host_msc_drive(), k_phase_done, k_usb_class_hid, k_usb_class_msc, k_usb_post_cfg_idle, k_usb_reset_settle, priv_host_echo_read_in(), s_dev_class, s_echo_out_len, s_echo_out_sent, s_host_phase, and s_host_wait.
Referenced by board_usb_tick().
| void priv_host_run_idle_phase | ( | uc_engine * | uc | ) |
Virtual-host phase driver: waiting for the device pull-up (vhost).
Virtual-host phase driver: waiting for the device pull-up (vhost); this step is contained within the board USB model and uses bounded caller or module-owned storage.
| [in,out] | uc | Unicorn engine whose emulated state is read or updated. |
Virtual-host phase driver: waiting for the device pull-up (vhost).
Definition at line 519 of file board_usb_vhost.c.
References k_phase_reset, k_ra8_dvsq_default, k_ra8_int0_bit_dvst, priv_host_device_attached(), priv_usb_intsts0_set(), priv_usb_log_line(), priv_usb_raise_irq(), s_host_phase, s_host_wait, and s_usb.
Referenced by board_usb_tick().
| void priv_host_run_reset_phase | ( | uc_engine * | uc | ) |
Virtual-host phase driver: holding bus reset (vhost).
Virtual-host phase driver: holding bus reset (vhost); this step is contained within the board USB model and uses bounded caller or module-owned storage.
| [in,out] | uc | Unicorn engine whose emulated state is read or updated. |
Virtual-host phase driver: holding bus reset (vhost).
Definition at line 533 of file board_usb_vhost.c.
References k_phase_setup, k_ra8_dvsq_default, k_ra8_int0_bit_dvst, k_sub_deliver, k_usb_reset_settle, priv_usb_intsts0_set(), priv_usb_raise_irq(), s_host_phase, s_host_step, s_host_substate, s_host_wait, and s_usb.
Referenced by board_usb_tick().
| void priv_host_run_setup_phase | ( | uc_engine * | uc | ) |
Virtual-host phase driver: walking the enumeration script (vhost).
Virtual-host phase driver: walking the enumeration script (vhost); this step is contained within the board USB model and uses bounded caller or module-owned storage.
| [in,out] | uc | Unicorn engine whose emulated state is read or updated. |
Virtual-host phase driver: walking the enumeration script (vhost).
Definition at line 491 of file board_usb_vhost.c.
References internal_host_script_len(), internal_host_step_deliver(), internal_host_step_next(), internal_host_step_status(), internal_host_step_wait_ack(), internal_host_step_wait_in(), k_phase_configured, k_sub_deliver, k_sub_next, k_sub_status, k_sub_wait_ack, k_sub_wait_in, s_host_phase, s_host_step, s_host_substate, and s_k_enum_script.
Referenced by board_usb_tick().
| bool priv_host_take_ccpl | ( | void | ) |
Consume the device's CCPL (control transfer complete) (vhost).
Consume the device's ccpl (control transfer complete) (vhost); this step is contained within the board USB model and uses bounded caller or module-owned storage.
| true | The host take ccpl condition holds or completed successfully; false otherwise. |
Consume the device's CCPL (control transfer complete) (vhost).
Definition at line 322 of file board_usb_vhost.c.
References internal_usb_word(), k_ra8_dcpctr_bit_ccpl, k_ra8_usb_off_dcpctr, and s_usb.
Referenced by board_usb_bridge_dev_took_ccpl(), board_usb_loop_setup(), board_usb_loop_take_ccpl(), and internal_host_step_wait_ack().
| const char * priv_usb_class_active_str | ( | void | ) |
Human label of the detected class + live traffic totals (vhost).
Human label of the detected class + live traffic totals (vhost).
Definition at line 38 of file board_usb_vhost.c.
References k_usb_class_cdc, k_usb_class_hid, k_usb_class_msc, k_usb_class_printer, k_usb_class_unknown, k_usb_class_vendor, and s_dev_class.
Referenced by board_usb_report().
| void priv_usb_detect_class | ( | const uint8_t * | d, |
| uint16_t | len ) |
Detect the device class from the enumerated config descriptor (vhost).
Detect the device class from the enumerated config descriptor (vhost); this step is contained within the board USB model and uses bounded caller or module-owned storage.
| [in] | d | D input used by the operation. |
| [in] | len | Number of payload bytes to process. |
Detect the device class from the enumerated config descriptor (vhost).
Walks the standard descriptor chain (each entry: bLength, bDescriptorType, ...). The configuration descriptor carries the interface descriptor(s); the first interface's bInterfaceClass (offset 5) names the device class. Called for every control-IN response – only the configuration descriptor contains an interface descriptor, so the first hit wins.
| [in] | d | Descriptor bytes the device returned. |
| [in] | len | Number of valid bytes in d. |
Definition at line 69 of file board_usb_vhost.c.
References k_iface_class_off, k_usb_class_cdc, k_usb_class_hid, k_usb_class_msc, k_usb_class_printer, k_usb_class_unknown, k_usb_class_vendor, k_usb_dt_interface, k_usb_iclass_cdc_comm, k_usb_iclass_cdc_data, k_usb_iclass_hid, k_usb_iclass_msc, k_usb_iclass_printer, k_usb_iclass_vendor, and s_dev_class.
Referenced by board_usb_bridge_dcp_in_take(), board_usb_loop_ctrl_in_read(), and internal_host_drain_in().
| uint16_t priv_usb_intsts0 | ( | void | ) |
INTSTS0 value the device reads: event bits OR computed fields (dev).
Intsts0 value the device reads: event bits or computed fields (dev); this step is contained within the board USB model and uses bounded caller or module-owned storage.
| value | The operation-specific USB intsts0 value. |
INTSTS0 value the device reads: event bits OR computed fields (dev).
Definition at line 23 of file board_usb_dev.c.
References internal_usb_word(), k_ra8_int0_bit_bemp, k_ra8_int0_bit_brdy, k_ra8_int0_bit_ctrt, k_ra8_int0_bit_dvst, k_ra8_int0_bit_nrdy, k_ra8_int0_bit_vbse, k_ra8_intsts0_mask_ctsq, k_ra8_intsts0_mask_dvsq, k_ra8_intsts0_mask_valid, k_ra8_intsts0_mask_vbsts, k_ra8_usb_off_intsts0, and s_usb.
Referenced by priv_usb_reg_read().
| void priv_usb_intsts0_set | ( | uint8_t | bit | ) |
Set one INTSTS0 event bit in the register shadow (dev).
Set one intsts0 event bit in the register shadow (dev); this step is contained within the board USB model and uses bounded caller or module-owned storage.
| [in] | bit | Bit input used by the operation. |
Set one INTSTS0 event bit in the register shadow (dev).
Definition at line 39 of file board_usb_dev.c.
References internal_usb_word(), k_ra8_usb_off_intsts0, and s_usb.
Referenced by board_usb_bridge_bulk_in_take(), board_usb_bridge_bulk_out(), board_usb_bridge_bus_reset(), board_usb_bridge_ctrl_status(), board_usb_loop_bulk_in_read(), board_usb_loop_bulk_out(), board_usb_loop_bus_reset(), board_usb_loop_ctrl_out(), board_usb_loop_setup(), board_usb_loop_status_out_zlp(), internal_host_echo_send_out(), internal_host_msc_send_cbw(), internal_host_msc_take_in(), internal_host_step_status(), priv_bridge_pump_device(), priv_host_apply_no_data(), priv_host_deliver_setup(), priv_host_echo_read_in(), priv_host_mark_configured(), priv_host_run_idle_phase(), and priv_host_run_reset_phase().
| void priv_usb_log_count | ( | const char * | label, |
| unsigned | n ) |
Log a labelled count once (label + n) into the step log (core).
Log a labelled count once (label + n) into the step log (core); this step is contained within the board USB model and uses bounded caller or module-owned storage.
| [in] | label | NUL-terminated label used by the operation. |
| [in] | n | Number of elements or bytes participating in the operation. |
Log a labelled count once (label + n) into the step log (core).
Definition at line 109 of file board_usb.c.
References k_usb_log_width, and priv_usb_log_line().
Referenced by board_usb_bridge_dcp_in_take(), internal_host_drain_in(), internal_host_echo_send_out(), internal_host_step_wait_in(), and priv_host_echo_read_in().
| void priv_usb_log_line | ( | const char * | msg | ) |
Append one already-formatted line to the enumeration-step log (core).
Append one already-formatted line to the enumeration-step log (core); this step is contained within the board USB model and uses bounded caller or module-owned storage.
| [in] | msg | Msg input used by the operation. |
Append one already-formatted line to the enumeration-step log (core).
Definition at line 91 of file board_usb.c.
References board_console_push(), k_board_console_ch_usb, k_usb_log_cap, priv_emu_io_errf(), s_log, s_log_n, and s_trace.
Referenced by board_usb_bridge_bus_reset(), board_usb_loop_bus_reset(), board_usb_loop_latch(), board_usb_loop_setup(), board_usb_roles_swap(), priv_host_apply_no_data(), priv_host_deliver_setup(), priv_host_mark_configured(), priv_host_run_idle_phase(), and priv_usb_log_count().
| void priv_usb_raise_irq | ( | uc_engine * | uc | ) |
Pend the device's ICU interrupt via the registered raiser (dev).
Pend the device's icu interrupt via the registered raiser (dev); this step is contained within the board USB model and uses bounded caller or module-owned storage.
| [in,out] | uc | Unicorn engine whose emulated state is read or updated. |
Pend the device's ICU interrupt via the registered raiser (dev).
Definition at line 46 of file board_usb_dev.c.
References g_dev_irq_event, s_raise, and s_usb_irqs.
Referenced by board_usb_bridge_bulk_in_take(), board_usb_bridge_bulk_out(), board_usb_bridge_bus_reset(), board_usb_bridge_ctrl_status(), board_usb_loop_bulk_in_read(), board_usb_loop_bulk_out(), board_usb_loop_bus_reset(), board_usb_loop_ctrl_out(), board_usb_loop_setup(), board_usb_loop_status_out_zlp(), internal_host_echo_send_out(), internal_host_msc_send_cbw(), internal_host_msc_take_in(), internal_host_step_status(), priv_bridge_pump_device(), priv_host_apply_no_data(), priv_host_deliver_setup(), priv_host_echo_read_in(), priv_host_mark_configured(), priv_host_run_idle_phase(), and priv_host_run_reset_phase().
| uint32_t priv_usb_reg_read | ( | uint64_t | off, |
| unsigned | size ) |
USBFS window register read dispatch (dev).
USBFS window register read dispatch (dev); this step is contained within the board USB model and uses bounded caller or module-owned storage.
| [in] | off | Register or byte offset addressed by the operation. |
| [in] | size | Size of the requested region or access in bytes. |
| value | The operation-specific USB reg read value. |
USBFS window register read dispatch (dev).
Definition at line 215 of file board_usb_dev.c.
References internal_cfifo_read_port(), internal_cfifoctr_read(), internal_usb_word(), k_ra8_dvsq_powered, k_ra8_usb_off_cfifo, k_ra8_usb_off_cfifoctr, k_ra8_usb_off_dvstctr0, k_ra8_usb_off_frmnum, k_ra8_usb_off_intsts0, k_ra8_usb_off_syssts0, k_usb_cfifo_h, k_usb_cfifo_hh, k_usb_rhst_fs, priv_usb_intsts0(), and s_usb.
Referenced by board_usb_dev_reg_read(), and board_usb_read().
| void priv_usb_reg_write | ( | uint64_t | off, |
| uint32_t | value, | ||
| unsigned | size ) |
USBFS window register write dispatch (dev).
USBFS window register write dispatch (dev); this step is contained within the board USB model and uses bounded caller or module-owned storage.
| [in] | off | Register or byte offset addressed by the operation. |
| [in] | value | Register or payload value involved in the operation. |
| [in] | size | Size of the requested region or access in bytes. |
USBFS window register write dispatch (dev).
Definition at line 253 of file board_usb_dev.c.
References internal_cfifo_write_port(), internal_cfifoctr_write(), internal_usb_word(), k_ra8_intsts0_mask_valid, k_ra8_usb_off_cfifo, k_ra8_usb_off_cfifoctr, k_ra8_usb_off_intsts0, k_usb_cfifo_h, k_usb_cfifo_hh, and s_usb.
Referenced by board_usb_dev_reg_write(), and board_usb_write().
|
extern |
Device ICU event number (core).
Definition at line 54 of file board_usb.c.
Referenced by board_usb_init(), board_usb_roles_swap(), and priv_usb_raise_irq().
|
extern |
Device reached CONFIGURED (core).
Device reached CONFIGURED (core).
Definition at line 72 of file board_usb.c.
|
extern |
Held control-OUT bytes (core).
Held control-OUT bytes (core).
Definition at line 63 of file board_usb.c.
Referenced by board_usb_bridge_dcp_out(), and priv_bridge_pump_device().
|
extern |
Held byte count (core).
Held byte count (core).
Definition at line 64 of file board_usb.c.
Referenced by board_usb_bridge_dcp_out(), board_usb_init(), and priv_bridge_pump_device().
|
extern |
Held bytes await the arm (core).
Held bytes await the arm (core).
Definition at line 65 of file board_usb.c.
Referenced by board_usb_bridge_dcp_out(), board_usb_bridge_dcp_out_consumed(), board_usb_init(), and priv_bridge_pump_device().
|
extern |
Detected device class (vhost).
Detected device class (vhost).
Definition at line 31 of file board_usb_vhost.c.
Referenced by board_usb_state_string(), priv_host_echo_read_in(), priv_host_run_configured_phase(), priv_usb_class_active_str(), and priv_usb_detect_class().
|
extern |
Echoed bytes read back (core).
Echoed bytes read back (core).
Definition at line 79 of file board_usb.c.
Referenced by board_usb_echo_received(), board_usb_init(), board_usb_report(), and priv_host_echo_read_in().
|
extern |
Host bulk-OUT payload (core).
Host bulk-OUT payload (core).
Definition at line 76 of file board_usb.c.
Referenced by board_usb_feed_bulk_in(), and internal_host_echo_send_out().
|
extern |
Bytes queued by –usb-in (core).
Bytes queued by –usb-in (core).
Definition at line 77 of file board_usb.c.
Referenced by board_usb_feed_bulk_in(), board_usb_init(), board_usb_report(), internal_host_echo_send_out(), and priv_host_run_configured_phase().
|
extern |
Bytes delivered to device (core).
Bytes delivered to device (core).
Definition at line 78 of file board_usb.c.
Referenced by board_usb_init(), board_usb_report(), internal_host_echo_send_out(), and priv_host_run_configured_phase().
|
extern |
Bridge host owns the bus (core).
Definition at line 41 of file board_usb.c.
Referenced by board_usb_set_external_host(), board_usb_tick(), board_usb_write(), and priv_host_deliver_setup().
|
extern |
Last HID button bitmap (vhost).
Last HID button bitmap (vhost).
Definition at line 35 of file board_usb_vhost.c.
Referenced by board_usb_report(), and internal_usb_hid_decode_report().
|
extern |
Accumulated HID mouse X (vhost).
Accumulated HID mouse X (vhost).
Definition at line 33 of file board_usb_vhost.c.
Referenced by board_usb_report(), and internal_usb_hid_decode_report().
|
extern |
Accumulated HID mouse Y (vhost).
Accumulated HID mouse Y (vhost).
Definition at line 34 of file board_usb_vhost.c.
Referenced by board_usb_report(), and internal_usb_hid_decode_report().
|
extern |
HID reports read (vhost).
HID reports read (vhost).
Definition at line 32 of file board_usb_vhost.c.
Referenced by board_usb_report(), and internal_usb_hid_decode_report().
|
extern |
Virtual-host phase (core).
Virtual-host phase (core).
Definition at line 68 of file board_usb.c.
Referenced by board_usb_init(), board_usb_tick(), internal_host_step_next(), priv_host_run_configured_phase(), priv_host_run_idle_phase(), priv_host_run_reset_phase(), and priv_host_run_setup_phase().
|
extern |
Enumeration-script index (core).
Enumeration-script index (core).
Definition at line 69 of file board_usb.c.
Referenced by board_usb_init(), internal_host_step_next(), internal_host_step_wait_in(), priv_host_deliver_setup(), priv_host_run_reset_phase(), and priv_host_run_setup_phase().
|
extern |
Per-step sub-state (core).
Per-step sub-state (core).
Definition at line 70 of file board_usb.c.
Referenced by board_usb_init(), internal_host_step_deliver(), internal_host_step_next(), internal_host_step_status(), internal_host_step_wait_ack(), internal_host_step_wait_in(), priv_host_run_reset_phase(), and priv_host_run_setup_phase().
|
extern |
Sub-state wait ticks (core).
Sub-state wait ticks (core).
Definition at line 71 of file board_usb.c.
Referenced by board_usb_init(), internal_host_step_deliver(), internal_host_step_next(), internal_host_step_status(), internal_host_step_wait_ack(), internal_host_step_wait_in(), priv_host_run_configured_phase(), priv_host_run_idle_phase(), and priv_host_run_reset_phase().
|
extern |
Bulk-IN packets (loop).
Bulk-IN packets (loop).
Definition at line 29 of file board_usb_loop.c.
Referenced by board_usb_loop_bulk_in_read(), and board_usb_report().
|
extern |
Bulk-OUT packets (loop).
Bulk-OUT packets (loop).
Definition at line 28 of file board_usb_loop.c.
Referenced by board_usb_loop_bulk_out(), and board_usb_report().
|
extern |
Firmware host owns the bus (loop).
Firmware host owns the bus (loop).
Definition at line 23 of file board_usb_loop.c.
Referenced by board_usb_loop_latch(), board_usb_report(), and board_usb_tick().
|
extern |
SETUPs from the fw host (loop).
SETUPs from the fw host (loop).
Definition at line 27 of file board_usb_loop.c.
Referenced by board_usb_loop_setup(), and board_usb_report().
|
extern |
MSC block size (vhost).
MSC block size (vhost).
Definition at line 648 of file board_usb_vhost.c.
Referenced by board_usb_report(), and internal_host_msc_parse_capacity().
|
extern |
MSC capacity in blocks (vhost).
MSC capacity in blocks (vhost).
Definition at line 647 of file board_usb_vhost.c.
Referenced by board_usb_report(), and internal_host_msc_parse_capacity().
|
extern |
MSC INQUIRY completed (vhost).
MSC INQUIRY completed (vhost).
Definition at line 650 of file board_usb_vhost.c.
Referenced by board_usb_report(), and internal_host_msc_record_data().
|
extern |
MSC read data bytes (vhost).
MSC read data bytes (vhost).
Definition at line 649 of file board_usb_vhost.c.
Referenced by board_usb_report(), and internal_host_msc_record_data().
|
extern |
ICU pend callback (core).
Definition at line 35 of file board_usb.c.
Referenced by board_usb_set_irq_raiser(), and priv_usb_raise_irq().
|
extern |
Self-loop role polarity (core).
Definition at line 49 of file board_usb.c.
Referenced by board_usb_init(), board_usb_read(), board_usb_roles_swap(), board_usb_roles_swapped(), and board_usb_write().
|
extern |
–trace verbose logging (core).
Definition at line 34 of file board_usb.c.
|
extern |
Controller + FIFO state (core).
Definition at line 33 of file board_usb.c.
Referenced by board_usb_bridge_bulk_in_ready(), board_usb_bridge_bulk_in_take(), board_usb_bridge_bulk_out(), board_usb_bridge_bulk_out_consumed(), board_usb_bridge_bus_reset(), board_usb_bridge_ctrl_status(), board_usb_bridge_dcp_in_ready(), board_usb_bridge_dcp_in_take(), board_usb_bridge_dcp_out_consumed(), board_usb_init(), board_usb_loop_bulk_in_avail(), board_usb_loop_bulk_in_flush(), board_usb_loop_bulk_in_read(), board_usb_loop_bulk_out(), board_usb_loop_bus_reset(), board_usb_loop_ctrl_in_avail(), board_usb_loop_ctrl_in_flush(), board_usb_loop_ctrl_in_read(), board_usb_loop_ctrl_out(), board_usb_loop_setup(), board_usb_loop_status_out_zlp(), board_usb_report(), board_usb_roles_swap(), board_usb_state_string(), board_usb_tick(), internal_cfifo_in_buf(), internal_cfifo_is_in(), internal_cfifo_out_buf(), internal_cfifo_pipe(), internal_host_drain_in(), internal_host_echo_send_out(), internal_host_latch_setup(), internal_host_msc_send_cbw(), internal_host_msc_take_in(), internal_host_step_status(), internal_host_step_wait_in(), internal_loop_reset_dcp(), internal_loop_reset_pipe(), priv_bridge_pump_device(), priv_host_apply_no_data(), priv_host_dcp_pid_buf(), priv_host_deliver_setup(), priv_host_device_attached(), priv_host_echo_read_in(), priv_host_mark_configured(), priv_host_run_idle_phase(), priv_host_run_reset_phase(), priv_host_take_ccpl(), priv_usb_intsts0(), priv_usb_intsts0_set(), priv_usb_reg_read(), and priv_usb_reg_write().
|
extern |
USB interrupts raised (core).
USB interrupts raised (core).
Definition at line 73 of file board_usb.c.
Referenced by board_usb_init(), board_usb_report(), and priv_usb_raise_irq().