ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
Loading...
Searching...
No Matches
board_usb_internal.h File Reference

Module-private state + interfaces shared by the board_usb TUs. More...

#include <stdint.h>
#include <unicorn/unicorn.h>
#include "board_usb.h"
#include "ra8_attributes.h"
Include dependency graph for board_usb_internal.h:
This graph shows which files directly or indirectly include this file:

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).

Detailed Description

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.

Since
0.1.0

Definition in file board_usb_internal.h.

Enumeration Type Documentation

◆ cdc_breq_t

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.

◆ scsi_cap10_off_t

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.

◆ usb_be_lane_t

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.

◆ usb_breq_t

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.

◆ usb_const_t

enum usb_const_t : uint32_t

Misc small constants used across the model (avoid bare literals).

Enumerator
k_usb_byte_bits 

Bits per byte.

k_usb_byte_mask 

One-byte mask.

k_usb_cfifo_h 

CFIFOH alias offset from CFIFO (+0x2).

HS-instance 16-bit residual port.

k_usb_cfifo_hh 

CFIFOHH alias offset from CFIFO (+0x3).

HS-instance 8-bit residual port.

k_usb_addr_assigned 

Address the host assigns the device.

k_usb_config_value 

bConfigurationValue the host sets.

k_usb_desc8_len 

First GET_DESCRIPTOR(device) length.

k_usb_desc_dev_len 

Full device-descriptor length.

k_usb_cfg_probe_len 

Config-descriptor header probe len.

k_usb_cfg_full_cap 

Config-descriptor full request cap.

k_usb_str_len 

String-descriptor request length.

k_usb_step_timeout 

Host per-step wait budget (ticks).

k_usb_reset_settle 

Ticks held in bus reset before SETUP.

k_usb_post_cfg_idle 

Settle ticks after CONFIGURED.

k_usb_log_cap 

Enumeration-step log capacity.

k_usb_log_width 

Bytes per enumeration-step log line.

k_usb_trace_dump_max 

Control-IN payload bytes shown in –trace.

k_usb_bulk_in_pipe 

CDC bulk IN pipe (EP1 IN -> pipe 1).

k_usb_bulk_out_pipe 

CDC bulk OUT pipe (EP2 OUT -> pipe 2).

k_usb_dcp_pipe_bit 

DCP (pipe 0) BRDYSTS/BRDYENB bit mask.

Definition at line 85 of file board_usb_internal.h.

◆ usb_dev_class_t

enum usb_dev_class_t : uint8_t

USB device class the host detected from the interface descriptor.

Enumerator
k_usb_class_unknown 

Not yet detected.

k_usb_class_cdc 

CDC-ACM (virtual serial).

k_usb_class_hid 

HID (boot mouse / keyboard).

k_usb_class_msc 

Mass storage (BOT/SCSI).

k_usb_class_printer 

Printer (7/1/x), issue #265.

k_usb_class_vendor 

Vendor specific (0xFF).

Definition at line 234 of file board_usb_internal.h.

◆ usb_dir_t

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.

◆ usb_dt_t

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.

◆ usb_geom_t

enum usb_geom_t : uint64_t

USBFS register-window geometry and the staging-buffer caps.

Enumerator
k_usb_base 

USBFS base (HUM Ch 36, p 1965).

k_usb_span 

Modelled window (PIPECTR end < 0x90).

k_usb_reg_words 

16-bit register shadow word count.

k_usb_dcp_mps 

EP0 default control-pipe max packet.

k_usb_pipe_mps 

Bulk-FS data pipe max packet.

k_usb_pipe_count 

DCP (0) + PIPE1..PIPE9.

k_usb_echo_cap 

Bulk echo staging capacity.

k_usb_in_cap 

DCP/bulk IN staging cap (multi-MPS).

Definition at line 37 of file board_usb_internal.h.

◆ usb_host_phase_t

enum usb_host_phase_t : uint8_t

Host state-machine phases.

Enumerator
k_phase_idle 

Waiting for the device pull-up (DPRPU).

k_phase_reset 

Holding bus reset; device re-arms its DCP.

k_phase_setup 

Walking the enumeration script.

k_phase_configured 

Device configured; optional bulk echo.

k_phase_done 

Terminal idle.

Definition at line 158 of file board_usb_internal.h.

◆ usb_host_sub_t

enum usb_host_sub_t : uint8_t

Per-SETUP-step sub-states.

Enumerator
k_sub_deliver 

Latch the SETUP + raise CTRT.

k_sub_wait_in 

Wait for the device's IN data (control read).

k_sub_status 

Deliver the status stage + raise CTRT.

k_sub_wait_ack 

Wait for the device's CCPL (transfer end).

k_sub_next 

Advance to the next script step.

Definition at line 167 of file board_usb_internal.h.

◆ usb_iclass_t

enum usb_iclass_t : uint8_t

bInterfaceClass codes + the INTERFACE descriptor type (USB 2.0).

Enumerator
k_usb_iclass_cdc_comm 

Communications (CDC control).

k_usb_iclass_hid 

Human Interface Device.

k_usb_iclass_printer 

Printer (issue #265).

k_usb_iclass_msc 

Mass Storage.

k_usb_iclass_cdc_data 

CDC data.

k_usb_iclass_vendor 

Vendor specific (issue #265).

k_usb_dt_interface 

INTERFACE descriptor type.

Definition at line 244 of file board_usb_internal.h.

◆ usb_le_lane_t

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.

◆ usb_lit_t

enum usb_lit_t : uint32_t

USB class-request, SCSI command, and CBW-layout constants.

Enumerator
k_iface_class_off 

bInterfaceClass offset in the iface descriptor.

k_usb_req_class_iface 

bmRequestType: class, interface, host->device.

k_cdc_line_coding_len 

SET_LINE_CODING wLength.

k_scsi_inquiry 

SCSI INQUIRY opcode.

k_inquiry_len 

INQUIRY allocation length.

k_scsi_read_capacity 

SCSI READ CAPACITY(10) opcode.

k_scsi_read10 

SCSI READ(10) opcode.

k_cdb10_len 

10-byte CDB length.

k_sector_bytes 

Logical block size.

k_usb_shift24 

Byte-3 position in a 32-bit word.

k_cbw_tag_off 

CBW dCBWTag offset (LE u32).

k_cbw_dtl_off 

CBW dCBWDataTransferLength offset (LE u32).

k_cbw_flags_off 

CBW bmCBWFlags offset.

k_cbw_lun_off 

CBW bCBWLUN offset.

k_cbw_cdblen_off 

CBW bCBWCBLength offset.

k_cbw_cdb_off 

CBW CBWCB (command block) offset.

Definition at line 176 of file board_usb_internal.h.

◆ usb_rhst_t

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.

Function Documentation

◆ internal_usb_word()

uint32_t internal_usb_word ( uint64_t off)
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.

Parameters
[in]offRegister or byte offset addressed by the operation.
Returns
The USB word result produced by the board USB model.
Return values
valueThe operation-specific USB word value.
Precondition
Arguments satisfy the ranges documented for USB word.
The call executes on the emulator's single owning thread.
Postcondition
State changes remain confined to the board USB model and documented output objects.
Ownership of caller-supplied storage is unchanged.
Note
The operation is synchronous and does not transfer heap ownership.
Since
0.1.0

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().

◆ priv_bridge_pump_device()

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.

Parameters
[in,out]ucUnicorn engine whose emulated state is read or updated.
Precondition
Arguments satisfy the ranges documented for bridge pump device.
The call executes on the emulator's single owning thread.
Postcondition
State changes remain confined to the board USB model and documented output objects.
Ownership of caller-supplied storage is unchanged.
Note
The operation is synchronous and does not transfer heap ownership.
Since
0.1.0

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.

Parameters
[in,out]ucUnicorn 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().

◆ priv_host_apply_no_data()

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.

Parameters
[in,out]ucUnicorn engine whose emulated state is read or updated.
[in]sModule state instance processed by the operation.
Precondition
Arguments satisfy the ranges documented for host apply no data.
The call executes on the emulator's single owning thread.
Postcondition
State changes remain confined to the board USB model and documented output objects.
Ownership of caller-supplied storage is unchanged.
Note
The operation is synchronous and does not transfer heap ownership.
Since
0.1.0

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().

◆ priv_host_dcp_pid_buf()

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.

Returns
The host default control pipe pid buf result produced by the board USB model.
Return values
trueThe host default control pipe pid buf condition holds or completed successfully; false otherwise.
Precondition
Arguments satisfy the ranges documented for host default control pipe pid buf.
The call executes on the emulator's single owning thread.
Postcondition
State changes remain confined to the board USB model and documented output objects.
Ownership of caller-supplied storage is unchanged.
Note
The operation is synchronous and does not transfer heap ownership.
Since
0.1.0

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().

◆ priv_host_deliver_setup()

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.

Parameters
[in,out]ucUnicorn engine whose emulated state is read or updated.
[in]sModule state instance processed by the operation.
Precondition
Arguments satisfy the ranges documented for host deliver setup.
The call executes on the emulator's single owning thread.
Postcondition
State changes remain confined to the board USB model and documented output objects.
Ownership of caller-supplied storage is unchanged.
Note
The operation is synchronous and does not transfer heap ownership.
Since
0.1.0

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().

◆ priv_host_device_attached()

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.

Returns
The host device attached result produced by the board USB model.
Return values
trueThe host device attached condition holds or completed successfully; false otherwise.
Precondition
Arguments satisfy the ranges documented for host device attached.
The call executes on the emulator's single owning thread.
Postcondition
State changes remain confined to the board USB model and documented output objects.
Ownership of caller-supplied storage is unchanged.
Note
The operation is synchronous and does not transfer heap ownership.
Since
0.1.0

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().

◆ priv_host_echo_read_in()

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.

Parameters
[in,out]ucUnicorn engine whose emulated state is read or updated.
Precondition
Arguments satisfy the ranges documented for host echo read in.
The call executes on the emulator's single owning thread.
Postcondition
State changes remain confined to the board USB model and documented output objects.
Ownership of caller-supplied storage is unchanged.
Note
The operation is synchronous and does not transfer heap ownership.
Since
0.1.0

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.

Parameters
[in,out]ucUnicorn 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().

◆ priv_host_mark_configured()

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.

Parameters
[in,out]ucUnicorn engine whose emulated state is read or updated.
Precondition
Arguments satisfy the ranges documented for host mark configured.
The call executes on the emulator's single owning thread.
Postcondition
State changes remain confined to the board USB model and documented output objects.
Ownership of caller-supplied storage is unchanged.
Note
The operation is synchronous and does not transfer heap ownership.
Since
0.1.0

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().

◆ priv_host_run_configured_phase()

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.

Parameters
[in,out]ucUnicorn engine whose emulated state is read or updated.
Precondition
Arguments satisfy the ranges documented for host run configured phase.
The call executes on the emulator's single owning thread.
Postcondition
State changes remain confined to the board USB model and documented output objects.
Ownership of caller-supplied storage is unchanged.
Note
The operation is synchronous and does not transfer heap ownership.
Since
0.1.0

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().

◆ priv_host_run_idle_phase()

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.

Parameters
[in,out]ucUnicorn engine whose emulated state is read or updated.
Precondition
Arguments satisfy the ranges documented for host run idle phase.
The call executes on the emulator's single owning thread.
Postcondition
State changes remain confined to the board USB model and documented output objects.
Ownership of caller-supplied storage is unchanged.
Note
The operation is synchronous and does not transfer heap ownership.
Since
0.1.0

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().

◆ priv_host_run_reset_phase()

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.

Parameters
[in,out]ucUnicorn engine whose emulated state is read or updated.
Precondition
Arguments satisfy the ranges documented for host run reset phase.
The call executes on the emulator's single owning thread.
Postcondition
State changes remain confined to the board USB model and documented output objects.
Ownership of caller-supplied storage is unchanged.
Note
The operation is synchronous and does not transfer heap ownership.
Since
0.1.0

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().

◆ priv_host_run_setup_phase()

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.

Parameters
[in,out]ucUnicorn engine whose emulated state is read or updated.
Precondition
Arguments satisfy the ranges documented for host run setup phase.
The call executes on the emulator's single owning thread.
Postcondition
State changes remain confined to the board USB model and documented output objects.
Ownership of caller-supplied storage is unchanged.
Note
The operation is synchronous and does not transfer heap ownership.
Since
0.1.0

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().

◆ priv_host_take_ccpl()

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.

Returns
The host take ccpl result produced by the board USB model.
Return values
trueThe host take ccpl condition holds or completed successfully; false otherwise.
Precondition
Arguments satisfy the ranges documented for host take ccpl.
The call executes on the emulator's single owning thread.
Postcondition
State changes remain confined to the board USB model and documented output objects.
Ownership of caller-supplied storage is unchanged.
Note
The operation is synchronous and does not transfer heap ownership.
Since
0.1.0

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().

◆ priv_usb_class_active_str()

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().

◆ priv_usb_detect_class()

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.

Parameters
[in]dD input used by the operation.
[in]lenNumber of payload bytes to process.
Precondition
Arguments satisfy the ranges documented for USB detect class.
The call executes on the emulator's single owning thread.
Postcondition
State changes remain confined to the board USB model and documented output objects.
Ownership of caller-supplied storage is unchanged.
Note
The operation is synchronous and does not transfer heap ownership.
Since
0.1.0

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.

Parameters
[in]dDescriptor bytes the device returned.
[in]lenNumber 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().

◆ priv_usb_intsts0()

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.

Returns
The USB intsts0 result produced by the board USB model.
Return values
valueThe operation-specific USB intsts0 value.
Precondition
Arguments satisfy the ranges documented for USB intsts0.
The call executes on the emulator's single owning thread.
Postcondition
State changes remain confined to the board USB model and documented output objects.
Ownership of caller-supplied storage is unchanged.
Note
The operation is synchronous and does not transfer heap ownership.
Since
0.1.0

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().

◆ priv_usb_intsts0_set()

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.

Parameters
[in]bitBit input used by the operation.
Precondition
Arguments satisfy the ranges documented for USB intsts0 set.
The call executes on the emulator's single owning thread.
Postcondition
State changes remain confined to the board USB model and documented output objects.
Ownership of caller-supplied storage is unchanged.
Note
The operation is synchronous and does not transfer heap ownership.
Since
0.1.0

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().

◆ priv_usb_log_count()

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.

Parameters
[in]labelNUL-terminated label used by the operation.
[in]nNumber of elements or bytes participating in the operation.
Precondition
Arguments satisfy the ranges documented for USB log count.
The call executes on the emulator's single owning thread.
Postcondition
State changes remain confined to the board USB model and documented output objects.
Ownership of caller-supplied storage is unchanged.
Note
The operation is synchronous and does not transfer heap ownership.
Since
0.1.0

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().

◆ priv_usb_log_line()

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.

Parameters
[in]msgMsg input used by the operation.
Precondition
Arguments satisfy the ranges documented for USB log line.
The call executes on the emulator's single owning thread.
Postcondition
State changes remain confined to the board USB model and documented output objects.
Ownership of caller-supplied storage is unchanged.
Note
The operation is synchronous and does not transfer heap ownership.
Since
0.1.0

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().

◆ priv_usb_raise_irq()

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.

Parameters
[in,out]ucUnicorn engine whose emulated state is read or updated.
Precondition
Arguments satisfy the ranges documented for USB raise interrupt.
The call executes on the emulator's single owning thread.
Postcondition
State changes remain confined to the board USB model and documented output objects.
Ownership of caller-supplied storage is unchanged.
Note
The operation is synchronous and does not transfer heap ownership.
Since
0.1.0

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().

◆ priv_usb_reg_read()

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.

Parameters
[in]offRegister or byte offset addressed by the operation.
[in]sizeSize of the requested region or access in bytes.
Returns
The USB reg read result produced by the board USB model.
Return values
valueThe operation-specific USB reg read value.
Precondition
Arguments satisfy the ranges documented for USB reg read.
The call executes on the emulator's single owning thread.
Postcondition
State changes remain confined to the board USB model and documented output objects.
Ownership of caller-supplied storage is unchanged.
Note
The operation is synchronous and does not transfer heap ownership.
Since
0.1.0

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().

◆ priv_usb_reg_write()

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.

Parameters
[in]offRegister or byte offset addressed by the operation.
[in]valueRegister or payload value involved in the operation.
[in]sizeSize of the requested region or access in bytes.
Precondition
Arguments satisfy the ranges documented for USB reg write.
The call executes on the emulator's single owning thread.
Postcondition
State changes remain confined to the board USB model and documented output objects.
Ownership of caller-supplied storage is unchanged.
Note
The operation is synchronous and does not transfer heap ownership.
Since
0.1.0

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().

Variable Documentation

◆ g_dev_irq_event

uint16_t g_dev_irq_event
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().

◆ s_configured

bool s_configured
extern

Device reached CONFIGURED (core).

Device reached CONFIGURED (core).

Definition at line 72 of file board_usb.c.

◆ s_dcp_hold

uint8_t s_dcp_hold[k_usb_in_cap]
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().

◆ s_dcp_hold_len

uint16_t s_dcp_hold_len
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().

◆ s_dcp_hold_pending

bool s_dcp_hold_pending
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().

◆ s_dev_class

uint8_t s_dev_class
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().

◆ s_echo_in_got

uint32_t s_echo_in_got
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().

◆ s_echo_out

uint8_t s_echo_out[k_usb_echo_cap]
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().

◆ s_echo_out_len

uint32_t s_echo_out_len
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().

◆ s_echo_out_sent

uint32_t s_echo_out_sent
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().

◆ s_external_host

bool s_external_host
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().

◆ s_hid_buttons

uint8_t s_hid_buttons
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().

◆ s_hid_cx

int32_t s_hid_cx
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().

◆ s_hid_cy

int32_t s_hid_cy
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().

◆ s_hid_reports

uint32_t s_hid_reports
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().

◆ s_host_phase

uint8_t s_host_phase
extern

◆ s_host_step

uint8_t s_host_step
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().

◆ s_host_substate

uint8_t s_host_substate
extern

◆ s_host_wait

◆ s_loop_bulk_in_pkts

uint32_t s_loop_bulk_in_pkts
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().

◆ s_loop_bulk_out_pkts

uint32_t s_loop_bulk_out_pkts
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().

◆ s_loop_latched

bool s_loop_latched
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().

◆ s_loop_setups

uint32_t s_loop_setups
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().

◆ s_msc_block_len

uint32_t s_msc_block_len
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().

◆ s_msc_blocks

uint32_t s_msc_blocks
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().

◆ s_msc_inquiry_ok

bool s_msc_inquiry_ok
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().

◆ s_msc_read_ok

uint32_t s_msc_read_ok
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().

◆ s_raise

board_usb_irq_raiser_t s_raise
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().

◆ s_roles_swapped

bool s_roles_swapped
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().

◆ s_trace

bool s_trace
extern

–trace verbose logging (core).

Definition at line 34 of file board_usb.c.

◆ s_usb

usb_state_t s_usb
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().

◆ s_usb_irqs

uint32_t s_usb_irqs
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().