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

On-chip USBHS host controller model (0x40351000) for the board emulator. More...

#include <stdint.h>
#include <stdio.h>
#include <string.h>
#include "board_periph_block.h"
#include "board_usb.h"
#include "emu_host_io_internal.h"
#include "ra8_usb_regs.h"
Include dependency graph for board_periph_usbhs_host.c:

Go to the source code of this file.

Data Structures

struct  usbhs_state_t
 Aggregate USBHS host-controller model state. More...

Enumerations

enum  usbhs_geom_t : uint64_t {
  k_usbhs_base = 0x40351000UL ,
  k_usbhs_span = 0x200UL ,
  k_usbhs_words = 0x200UL / 2U ,
  k_usbhs_dev_span = 0x100UL ,
  k_usbhs_pipes = 10UL ,
  k_usbhs_pkt_cap = 512UL ,
  k_usbhs_din_cap = 512UL ,
  k_usbhs_setup_len = 8UL ,
  k_usbhs_report_ord = 155UL
}
 USBHS host register-window geometry and staging-buffer caps. More...
enum  usbhs_lines_t : uint16_t {
  k_usbhs_lnst_j = 0x0001U ,
  k_usbhs_rhst_fs = 0x0002U
}
 SYSSTS0 / DVSTCTR0 host-role line-state fields (HUM Ch 37.2.3 / 37.2.5). More...
enum  usbhs_dvstctr_bit_t : uint8_t { k_usbhs_dvstctr_usbrst = 6U }
 DVSTCTR0 host-control bit positions (HUM Ch 37.2.5, p 2065). More...
enum  usbhs_pllsta_bit_t : uint16_t { k_usbhs_plllock = 0x0001U }
 PLLSTA lock flag reported so the firmware's PHY PLL wait completes. More...
enum  usbhs_status_bit_t : uint16_t { k_usbhs_dcp_bit = 0x0001U }
 DCP (pipe 0) status bit shared by BRDYSTS / BEMPSTS / NRDYSTS. More...
enum  usbhs_usb_std_t : uint8_t {
  k_usbhs_setup_dir_in = 0x80U ,
  k_usbhs_breq_set_addr = 0x05U ,
  k_usbhs_breq_set_config = 0x09U
}
 Standard USB chapter-9 SETUP field values the model classifies on. More...
enum  usbhs_lit_t : uint32_t {
  k_usbhs_byte_bits = 8U ,
  k_usbhs_byte_mask = 0xFFU ,
  k_usbhs_epnum_mask = 0x0FU ,
  k_usbhs_cfifo_h = 2U ,
  k_usbhs_cfifo_hh = 3U
}
 Small shared literals (avoid bare numeric literals). More...
enum  usbhs_setup_idx_t : uint8_t {
  k_usbhs_setup_bmrt = 0U ,
  k_usbhs_setup_breq = 1U ,
  k_usbhs_setup_wval_lo = 2U ,
  k_usbhs_setup_wval_hi = 3U ,
  k_usbhs_setup_widx_lo = 4U ,
  k_usbhs_setup_widx_hi = 5U ,
  k_usbhs_setup_wlen_lo = 6U ,
  k_usbhs_setup_wlen_hi = 7U
}
 SETUP-packet byte offsets (USB 2.0 sec 9.3, little-endian fields). More...

Functions

static uint32_t internal_hs_word (uint64_t off)
 16-bit shadow word index for a window byte offset.
static uint16_t internal_hs_reg (uint16_t off)
 Read a 16-bit shadow register at window byte offset off.
static void internal_hs_set (uint16_t off, uint16_t value)
 Write a 16-bit shadow register at window byte offset off.
static void internal_hs_or (uint16_t off, uint16_t bits)
 OR bits into the 16-bit shadow register at off.
static uint8_t internal_hs_curpipe (void)
 Currently-selected CFIFO pipe (CFIFOSEL.CURPIPE[3:0], modulo pipe count).
static uint8_t internal_hs_pipesel (void)
 The host pipe currently selected by PIPESEL (modulo pipe count).
static bool internal_hs_is_pipectr (uint64_t off)
 True when off is inside the PIPECTR[9] array window.
static uint8_t internal_hs_pipectr_index (uint64_t off)
 PIPECTR array index (PIPE1..PIPE9, modulo pipe count) for off.
static uint16_t internal_hs_cfifo_dtln (void)
 Bytes still available for the host to read on the selected IN staging.
static void internal_hs_cfifo_write (uint32_t value, unsigned size)
 Append size bytes of value (LSB-first) to the selected OUT pipe.
static uint32_t internal_hs_cfifo_read (unsigned size)
 Read size bytes (LSB-first) from the selected IN staging buffer.
static void internal_hs_bulk_out_commit (uc_engine *uc)
 Deliver the selected bulk pipe's accumulated OUT payload to the device.
static uint16_t internal_hs_bempsts_read (void)
 BEMPSTS read: raise a pipe's BEMP once the device has drained its OUT packet.
static void internal_hs_ctrl_status_complete (uc_engine *uc)
 Finish a no-data / control-write IN status stage.
static uint16_t internal_hs_brdysts_read (uc_engine *uc)
 Latch any device IN data the host is now polling for (BRDY sources).
static void internal_hs_brdysts_write (uint16_t value)
 Apply a BRDYSTS W0C write: a written 0 clears that bit, a 1 preserves it.
static void internal_hs_capture_setup (void)
 Copy USBREQ..USBLENG from the shadow into the 8-byte SETUP buffer.
static void internal_hs_setup_launch (uc_engine *uc)
 Launch a SETUP (DCPCTR.SUREQ write): deliver it and latch SACK.
static void internal_hs_ccpl_status (uc_engine *uc)
 Handle a DCPCTR.CCPL rising edge: drive the control-transfer status stage.
static void internal_hs_dcpctr_write (uc_engine *uc, uint16_t value)
 Apply a DCPCTR write: SUREQ launches a SETUP, CCPL drives the status.
static void internal_hs_cfifoctr_write (uc_engine *uc, uint16_t value)
 Apply a CFIFOCTR write: BCLR flushes the buffer, BVAL commits a bulk OUT.
static void internal_hs_dvstctr0_write (uc_engine *uc, uint16_t value)
 Apply a DVSTCTR0 write, bridging a host bus-reset edge onto the device.
static uint64_t internal_hs_read (uc_engine *uc, uint64_t off, unsigned size)
 Read one USBHS host register at window byte offset off.
static void internal_hs_write (uc_engine *uc, uint64_t off, unsigned size, uint64_t value)
 Write one USBHS host register at window byte offset off.
uint64_t board_usbhs_host_reg_read (uc_engine *uc, uint64_t off, unsigned size)
 Host-model register read by window byte offset (role routing).
void board_usbhs_host_reg_write (uc_engine *uc, uint64_t off, unsigned size, uint64_t value)
 Host-model register write by window byte offset (role routing).
uint32_t board_usbhs_host_shadow_handoff (uint16_t *dst_words, uint32_t word_capacity)
 Hand the host model's register shadow off and reset the host model.
static uint64_t internal_usbhs_block_read (uc_engine *uc, uint64_t addr, unsigned size)
 MMIO read handler: dispatch inside the USBHS controller window.
static void internal_usbhs_block_write (uc_engine *uc, uint64_t addr, unsigned size, uint64_t value)
 MMIO write handler: dispatch inside the USBHS controller window.
static void internal_usbhs_reset (void)
 Reset the USBHS host model to power-on state.
static void internal_usbhs_report (void)
 End-of-run summary: enumeration + bulk traffic bridged to the device.
static void internal_usbhs_block_register (void)
 Register the USBHS host block before main (host constructor).

Variables

static usbhs_state_t s_hs
static const board_periph_block_t s_k_usbhs_block
 USBHS host block descriptor (loop-only: owns 0x40351000 with –usbhs-loop).

Detailed Description

On-chip USBHS host controller model (0x40351000) for the board emulator.

Models the RA8D2 USB 2.0 High-Speed controller (USBHS, base 0x40351000, HUM Ch 37) in HOST role – the missing half of the chip-internal USB self-loop. board_usb.c already models the USBFS controller (0x40250000) in DEVICE role; this block models the second on-chip controller acting as the HOST that enumerates and talks to that device, exactly as the EK-RA8D2's two USB jacks do when cabled to each other on the bench. Together they close the loop the usb_selftest_* / dfu_selftest_* apps exercise, entirely in-process.

The firmware's first-party host driver (libs/ra8_hal ra8_usb_host_*) is polled: it programs the host registers here and spins on their status bits (SACK on INTSTS1, BRDY/BEMP on BRDYSTS/BEMPSTS, SUREQ self-clear on DCPCTR) rather than taking a host interrupt. So this model is purely reactive – it answers the firmware's register reads and, on the writes that launch a transfer (SUREQ, a bulk BVAL, a CCPL), calls the board_usb.c bridge to drive the DEVICE model: deliver the SETUP + raise the device CTRT, stage the host's OUT bytes into the device's OUT pipe + raise BRDY, or collect the device's IN response. The device firmware's own ISR runs (preempting the host's spin via SysTick/PendSV, the higher-priority device worker) and fills its side of the FIFO, which this model reflects back to the host as the descriptor / echo bytes. No host interrupt, no second Unicorn core – one image, both stacks, a modelled cable.

This block only owns its window when ra8_emulator is started with --usbhs-loop (board_periph_block_t::loop_only): without the flag the window falls through to the sparse fallback, so the existing ra8_usb_host_* function-intercept seam (main.c, the virtual HID keyboard / MSC disk for host-only apps) is untouched. A self-loop app opts in through its hil.conf's HIL_EMU_ARGS.

Register offsets and bit fields come from ra8_usb_regs.h (the same first-party HUM transcription the driver uses). The few host-role fields not carried there (SYSSTS0.LNST line state, DVSTCTR0.USBRST/UACT/RHST, PLLSTA lock) are defined locally and flagged with a [CONFIRM] note where the value comes from general USB2_B knowledge rather than a direct HUM transcription.

Since
0.1.0

Definition in file board_periph_usbhs_host.c.

Enumeration Type Documentation

◆ usbhs_dvstctr_bit_t

enum usbhs_dvstctr_bit_t : uint8_t

DVSTCTR0 host-control bit positions (HUM Ch 37.2.5, p 2065).

Enumerator
k_usbhs_dvstctr_usbrst 

USBRST: drive bus reset.

[CONFIRM] HUM Ch 37.2.5.

Definition at line 85 of file board_periph_usbhs_host.c.

◆ usbhs_geom_t

enum usbhs_geom_t : uint64_t

USBHS host register-window geometry and staging-buffer caps.

Enumerator
k_usbhs_base 

USBHS base (HUM Ch 37, p 2059).

k_usbhs_span 

Modelled window (covers DEVADD / LPSTS).

k_usbhs_words 

16-bit register-shadow word count.

k_usbhs_dev_span 

Device-model span; PHY page lies past it.

k_usbhs_pipes 

DCP (0) + PIPE1..PIPE9.

k_usbhs_pkt_cap 

Per-pipe staging cap (HS bulk MPS).

k_usbhs_din_cap 

DCP IN staging cap (full config desc).

k_usbhs_setup_len 

SETUP packet length.

k_usbhs_report_ord 

End-of-run report slot (after USB-FS).

Definition at line 59 of file board_periph_usbhs_host.c.

◆ usbhs_lines_t

enum usbhs_lines_t : uint16_t

SYSSTS0 / DVSTCTR0 host-role line-state fields (HUM Ch 37.2.3 / 37.2.5).

Enumerator
k_usbhs_lnst_j 

SYSSTS0.LNST J-state: an FS device is attached.

[CONFIRM] general USB2_B LNST encoding.

k_usbhs_rhst_fs 

DVSTCTR0.RHST = full speed.

[CONFIRM] driver comment (01=LS,10=FS,11=HS) in ra8_usb_host_ctrl.c.

Definition at line 77 of file board_periph_usbhs_host.c.

◆ usbhs_lit_t

enum usbhs_lit_t : uint32_t

Small shared literals (avoid bare numeric literals).

Enumerator
k_usbhs_byte_bits 

Bits per byte.

k_usbhs_byte_mask 

One-byte mask.

k_usbhs_epnum_mask 

PIPECFG endpoint-number field.

k_usbhs_cfifo_h 

CFIFOH alias offset from CFIFO (+0x2).

k_usbhs_cfifo_hh 

CFIFOHH alias offset from CFIFO (+0x3).

Definition at line 107 of file board_periph_usbhs_host.c.

◆ usbhs_pllsta_bit_t

enum usbhs_pllsta_bit_t : uint16_t

PLLSTA lock flag reported so the firmware's PHY PLL wait completes.

Enumerator
k_usbhs_plllock 

PLLSTA.PLLLOCK (HUM Ch 37.2.4 "PLLSTA" p 2064).

Definition at line 90 of file board_periph_usbhs_host.c.

◆ usbhs_setup_idx_t

enum usbhs_setup_idx_t : uint8_t

SETUP-packet byte offsets (USB 2.0 sec 9.3, little-endian fields).

Enumerator
k_usbhs_setup_bmrt 

bmRequestType.

k_usbhs_setup_breq 

bRequest.

k_usbhs_setup_wval_lo 

wValue low byte.

k_usbhs_setup_wval_hi 

wValue high byte.

k_usbhs_setup_widx_lo 

wIndex low byte.

k_usbhs_setup_widx_hi 

wIndex high byte.

k_usbhs_setup_wlen_lo 

wLength low byte.

k_usbhs_setup_wlen_hi 

wLength high byte.

Definition at line 116 of file board_periph_usbhs_host.c.

◆ usbhs_status_bit_t

enum usbhs_status_bit_t : uint16_t

DCP (pipe 0) status bit shared by BRDYSTS / BEMPSTS / NRDYSTS.

Enumerator
k_usbhs_dcp_bit 

BRDYSTS/BEMPSTS/NRDYSTS DCP (pipe 0) bit.

Definition at line 95 of file board_periph_usbhs_host.c.

◆ usbhs_usb_std_t

enum usbhs_usb_std_t : uint8_t

Standard USB chapter-9 SETUP field values the model classifies on.

Enumerator
k_usbhs_setup_dir_in 

bmRequestType device-to-host bit (USB 2.0 9.3).

k_usbhs_breq_set_addr 

SET_ADDRESS bRequest (USB 2.0 9.4).

k_usbhs_breq_set_config 

SET_CONFIGURATION bRequest (USB 2.0 9.4).

Definition at line 100 of file board_periph_usbhs_host.c.

Function Documentation

◆ board_usbhs_host_reg_read()

uint64_t board_usbhs_host_reg_read ( uc_engine * uc,
uint64_t off,
unsigned size )

Host-model register read by window byte offset (role routing).

Exported by board_periph_usbhs_host.c so the USBFS window claim in board_usb.c can route its reads into the host model when the roles are swapped (Config B: the polled ra8_usb_host_* driver runs on the USBFS controller).

Parameters
[in,out]ucUnicorn engine (bulk/control latching pends device IRQs).
[in]offByte offset inside the controller register window.
[in]sizeAccess width in bytes (1, 2 or 4).
Returns
The register value, zero-extended to 64 bits.
Precondition
off is inside the host model's 0x200-byte register span.
The self-loop bridge is active (–usbhs-loop).
Postcondition
Read side effects (status latch, FIFO cursors) match the host model's.
Note
Not thread-safe; single-threaded emulation loop use.
See also
board_usbhs_host_reg_write
Since
0.1.0
Return values
valueThe operation-specific board usbhs host reg read value.
Postcondition
Ownership of caller-supplied storage is unchanged.

Definition at line 818 of file board_periph_usbhs_host.c.

References internal_hs_read().

Referenced by board_usb_read().

◆ board_usbhs_host_reg_write()

void board_usbhs_host_reg_write ( uc_engine * uc,
uint64_t off,
unsigned size,
uint64_t value )

Host-model register write by window byte offset (role routing).

Exported by board_periph_usbhs_host.c so the USBFS window claim in board_usb.c can route its writes into the host model when the roles are swapped (Config B).

Parameters
[in,out]ucUnicorn engine (transfer launches drive the device model).
[in]offByte offset inside the controller register window.
[in]sizeAccess width in bytes (1, 2 or 4).
[in]valueValue the firmware wrote.
Returns
Nothing.
Precondition
off is inside the host model's 0x200-byte register span.
The self-loop bridge is active (–usbhs-loop).
Postcondition
Write side effects (SETUP launch, FIFO commits) match the host model's.
Note
Not thread-safe; single-threaded emulation loop use.
See also
board_usbhs_host_reg_read
Since
0.1.0
Postcondition
Ownership of caller-supplied storage is unchanged.

Definition at line 823 of file board_periph_usbhs_host.c.

References internal_hs_write().

Referenced by board_usb_write().

◆ board_usbhs_host_shadow_handoff()

uint32_t board_usbhs_host_shadow_handoff ( uint16_t * dst_words,
uint32_t word_capacity )

Hand the host model's register shadow off and reset the host model.

Role-swap migration primitive (board_periph_usbhs_host.c): copies up to word_capacity 16-bit shadow words – the USBHS window's accumulated writes, i.e. the device firmware's PHY + module-init register state – into dst_words, then resets the entire host model so it starts virgin behind the USBFS window. Called exactly once, by board_usb_roles_swap.

Parameters
[out]dst_wordsDestination for the 16-bit shadow words.
[in]word_capacityCapacity of dst_words in 16-bit words.
Returns
The number of 16-bit words copied.
Precondition
dst_words is non-NULL with room for word_capacity words.
No host-side USB traffic has occurred yet (bring-up phase only).
Postcondition
The host model is fully reset (power-on state).
Note
Not thread-safe; single-threaded emulation loop use.
See also
board_usb_roles_swap
Since
0.1.0
Return values
valueThe operation-specific board usbhs host shadow handoff value.
Postcondition
Ownership of caller-supplied storage is unchanged.

Definition at line 828 of file board_periph_usbhs_host.c.

References k_usbhs_dev_span, k_usbhs_words, memcpy(), and s_hs.

Referenced by board_usb_roles_swap().

◆ internal_hs_bempsts_read()

uint16_t internal_hs_bempsts_read ( void )
static

BEMPSTS read: raise a pipe's BEMP once the device has drained its OUT packet.

Bempsts read: raise a pipe's bemp once the device has drained its out packet; this step is contained within the board periph usbhs host model and uses bounded caller or module-owned storage.

Returns
The hs bempsts read result produced by the board periph usbhs host model.
Return values
valueThe operation-specific hs bempsts read value.
Precondition
Arguments satisfy the ranges documented for hs bempsts read.
The call executes on the emulator's single owning thread.
Postcondition
State changes remain confined to the board periph usbhs host 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 416 of file board_periph_usbhs_host.c.

References board_usb_bridge_bulk_out_consumed(), board_usb_bridge_dcp_out_consumed(), internal_hs_or(), internal_hs_reg(), k_ra8_usb_off_bempsts, k_usbhs_dcp_bit, k_usbhs_pipes, RA8_INTERNAL, and s_hs.

Referenced by internal_hs_read().

◆ internal_hs_brdysts_read()

uint16_t internal_hs_brdysts_read ( uc_engine * uc)
static

Latch any device IN data the host is now polling for (BRDY sources).

Called on every BRDYSTS read – the register the polled host driver spins on. First completes a deferred no-data control-write status stage once the device has pulsed its CCPL (so the host does not race past a request the device is still applying). Then reflects the device's control-IN response into din and any armed bulk-IN pipe's echo into pin, setting the matching BRDYSTS bit. The guards (din_ready / pin_ready, PID==BUF) latch each packet once, only after the host armed the transfer and the device produced the data.

Parameters
[in,out]ucUnicorn engine (bulk-IN collection pends the device BEMP).
Returns
The BRDYSTS value to report.
Return values
valueThe operation-specific hs brdysts read value.
Precondition
Arguments satisfy the ranges documented for hs brdysts read.
The call executes on the emulator's single owning thread.
Postcondition
State changes remain confined to the board periph usbhs host 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 476 of file board_periph_usbhs_host.c.

References board_usb_bridge_bulk_in_ready(), board_usb_bridge_bulk_in_take(), board_usb_bridge_dcp_in_ready(), board_usb_bridge_dcp_in_take(), board_usb_bridge_dev_took_ccpl(), internal_hs_ctrl_status_complete(), internal_hs_or(), internal_hs_reg(), k_ra8_pid_buf, k_ra8_pid_mask, k_ra8_usb_off_brdysts, k_usbhs_dcp_bit, k_usbhs_din_cap, k_usbhs_pipes, k_usbhs_pkt_cap, RA8_INTERNAL, and s_hs.

Referenced by internal_hs_read().

◆ internal_hs_brdysts_write()

void internal_hs_brdysts_write ( uint16_t value)
static

Apply a BRDYSTS W0C write: a written 0 clears that bit, a 1 preserves it.

Apply a brdysts w0c write: a written 0 clears that bit, a 1 preserves it; this step is contained within the board periph usbhs host model and uses bounded caller or module-owned storage.

Parameters
[in]valueRegister or payload value involved in the operation.
Precondition
Arguments satisfy the ranges documented for hs brdysts write.
The call executes on the emulator's single owning thread.
Postcondition
State changes remain confined to the board periph usbhs host 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 513 of file board_periph_usbhs_host.c.

References internal_hs_reg(), internal_hs_set(), k_ra8_usb_off_brdysts, k_usbhs_dcp_bit, k_usbhs_pipes, RA8_INTERNAL, and s_hs.

Referenced by internal_hs_write().

◆ internal_hs_bulk_out_commit()

void internal_hs_bulk_out_commit ( uc_engine * uc)
static

Deliver the selected bulk pipe's accumulated OUT payload to the device.

Deliver the selected bulk pipe's accumulated out payload to the device; this step is contained within the board periph usbhs host 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 hs bulk out commit.
The call executes on the emulator's single owning thread.
Postcondition
State changes remain confined to the board periph usbhs host 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 381 of file board_periph_usbhs_host.c.

References board_usb_bridge_bulk_out(), board_usb_bridge_dcp_out(), internal_hs_curpipe(), RA8_INTERNAL, and s_hs.

Referenced by internal_hs_cfifoctr_write().

◆ internal_hs_capture_setup()

void internal_hs_capture_setup ( void )
static

Copy USBREQ..USBLENG from the shadow into the 8-byte SETUP buffer.

Copy usbreq..usbleng from the shadow into the 8-byte setup buffer; this step is contained within the board periph usbhs host model and uses bounded caller or module-owned storage.

Precondition
Arguments satisfy the ranges documented for hs capture setup.
The call executes on the emulator's single owning thread.
Postcondition
State changes remain confined to the board periph usbhs host 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 540 of file board_periph_usbhs_host.c.

References internal_hs_reg(), k_ra8_usb_off_usbindx, k_ra8_usb_off_usbleng, k_ra8_usb_off_usbreq, k_ra8_usb_off_usbval, k_usbhs_byte_bits, k_usbhs_byte_mask, k_usbhs_setup_bmrt, k_usbhs_setup_breq, k_usbhs_setup_widx_hi, k_usbhs_setup_widx_lo, k_usbhs_setup_wlen_hi, k_usbhs_setup_wlen_lo, k_usbhs_setup_wval_hi, k_usbhs_setup_wval_lo, RA8_INTERNAL, and s_hs.

Referenced by internal_hs_setup_launch().

◆ internal_hs_ccpl_status()

void internal_hs_ccpl_status ( uc_engine * uc)
static

Handle a DCPCTR.CCPL rising edge: drive the control-transfer status stage.

Handle a dcpctr.ccpl rising edge: drive the control-transfer status stage; this step is contained within the board periph usbhs host 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 hs ccpl status.
The call executes on the emulator's single owning thread.
Postcondition
State changes remain confined to the board periph usbhs host 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 600 of file board_periph_usbhs_host.c.

References board_usb_bridge_ctrl_status(), internal_hs_ctrl_status_complete(), internal_hs_or(), k_ra8_usb_off_bempsts, k_usbhs_breq_set_addr, k_usbhs_dcp_bit, RA8_INTERNAL, and s_hs.

Referenced by internal_hs_dcpctr_write().

◆ internal_hs_cfifo_dtln()

uint16_t internal_hs_cfifo_dtln ( void )
static

Bytes still available for the host to read on the selected IN staging.

Bytes still available for the host to read on the selected in staging; this step is contained within the board periph usbhs host model and uses bounded caller or module-owned storage.

Returns
The hs cfifo dtln result produced by the board periph usbhs host model.
Return values
valueThe operation-specific hs cfifo dtln value.
Precondition
Arguments satisfy the ranges documented for hs cfifo dtln.
The call executes on the emulator's single owning thread.
Postcondition
State changes remain confined to the board periph usbhs host 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 311 of file board_periph_usbhs_host.c.

References internal_hs_curpipe(), RA8_INTERNAL, and s_hs.

Referenced by internal_hs_read().

◆ internal_hs_cfifo_read()

uint32_t internal_hs_cfifo_read ( unsigned size)
static

Read size bytes (LSB-first) from the selected IN staging buffer.

Read size bytes (lsb-first) from the selected in staging buffer; this step is contained within the board periph usbhs host model and uses bounded caller or module-owned storage.

Parameters
[in]sizeSize of the requested region or access in bytes.
Returns
The hs cfifo read result produced by the board periph usbhs host model.
Return values
valueThe operation-specific hs cfifo read value.
Precondition
Arguments satisfy the ranges documented for hs cfifo read.
The call executes on the emulator's single owning thread.
Postcondition
State changes remain confined to the board periph usbhs host 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 354 of file board_periph_usbhs_host.c.

References internal_hs_curpipe(), k_usbhs_byte_bits, RA8_INTERNAL, and s_hs.

Referenced by internal_hs_read().

◆ internal_hs_cfifo_write()

void internal_hs_cfifo_write ( uint32_t value,
unsigned size )
static

Append size bytes of value (LSB-first) to the selected OUT pipe.

Append size bytes of value (lsb-first) to the selected out pipe; this step is contained within the board periph usbhs host model and uses bounded caller or module-owned storage.

Parameters
[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 hs cfifo write.
The call executes on the emulator's single owning thread.
Postcondition
State changes remain confined to the board periph usbhs host 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 334 of file board_periph_usbhs_host.c.

References internal_hs_curpipe(), k_usbhs_byte_bits, k_usbhs_byte_mask, k_usbhs_pkt_cap, RA8_INTERNAL, and s_hs.

Referenced by internal_hs_write().

◆ internal_hs_cfifoctr_write()

void internal_hs_cfifoctr_write ( uc_engine * uc,
uint16_t value )
static

Apply a CFIFOCTR write: BCLR flushes the buffer, BVAL commits a bulk OUT.

Apply a cfifoctr write: bclr flushes the buffer, bval commits a bulk out; this step is contained within the board periph usbhs host model and uses bounded caller or module-owned storage.

Parameters
[in,out]ucUnicorn engine whose emulated state is read or updated.
[in]valueRegister or payload value involved in the operation.
Precondition
Arguments satisfy the ranges documented for hs cfifoctr write.
The call executes on the emulator's single owning thread.
Postcondition
State changes remain confined to the board periph usbhs host 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 667 of file board_periph_usbhs_host.c.

References internal_hs_bulk_out_commit(), internal_hs_curpipe(), k_ra8_fifoctr_bclr, k_ra8_fifoctr_bval, RA8_INTERNAL, and s_hs.

Referenced by internal_hs_write().

◆ internal_hs_ctrl_status_complete()

void internal_hs_ctrl_status_complete ( uc_engine * uc)
static

Finish a no-data / control-write IN status stage.

Presents the device's status ZLP as a zero-length DCP IN packet so the polled host's status-stage BRDY wait (internal_host_dcp_in_wait) returns, and – for SET_CONFIGURATION – advances the device model to the Configured state. Shared by the immediate path (SIE-owned SET_ADDRESS, and control writes that carried a data stage) and the deferred path that waits on the device's DCPCTR.CCPL.

Parameters
[in,out]ucUnicorn engine (mark-configured pends the device DVST IRQ).
Precondition
Arguments satisfy the ranges documented for hs ctrl status complete.
The call executes on the emulator's single owning thread.
Postcondition
State changes remain confined to the board periph usbhs host 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 446 of file board_periph_usbhs_host.c.

References board_usb_bridge_mark_configured(), internal_hs_or(), k_ra8_usb_off_brdysts, k_usbhs_breq_set_config, k_usbhs_dcp_bit, RA8_INTERNAL, and s_hs.

Referenced by internal_hs_brdysts_read(), and internal_hs_ccpl_status().

◆ internal_hs_curpipe()

uint8_t internal_hs_curpipe ( void )
static

Currently-selected CFIFO pipe (CFIFOSEL.CURPIPE[3:0], modulo pipe count).

Currently-selected cfifo pipe (cfifosel.curpipe[3:0], modulo pipe count); this step is contained within the board periph usbhs host model and uses bounded caller or module-owned storage.

Returns
The hs curpipe result produced by the board periph usbhs host model.
Return values
valueThe operation-specific hs curpipe value.
Precondition
Arguments satisfy the ranges documented for hs curpipe.
The call executes on the emulator's single owning thread.
Postcondition
State changes remain confined to the board periph usbhs host 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 248 of file board_periph_usbhs_host.c.

References internal_hs_reg(), k_ra8_fifosel_curpipe, k_ra8_usb_off_cfifosel, k_usbhs_pipes, and RA8_INTERNAL.

Referenced by internal_hs_bulk_out_commit(), internal_hs_cfifo_dtln(), internal_hs_cfifo_read(), internal_hs_cfifo_write(), and internal_hs_cfifoctr_write().

◆ internal_hs_dcpctr_write()

void internal_hs_dcpctr_write ( uc_engine * uc,
uint16_t value )
static

Apply a DCPCTR write: SUREQ launches a SETUP, CCPL drives the status.

Apply a dcpctr write: sureq launches a setup, ccpl drives the status; this step is contained within the board periph usbhs host model and uses bounded caller or module-owned storage.

Parameters
[in,out]ucUnicorn engine whose emulated state is read or updated.
[in]valueRegister or payload value involved in the operation.
Precondition
Arguments satisfy the ranges documented for hs dcpctr write.
The call executes on the emulator's single owning thread.
Postcondition
State changes remain confined to the board periph usbhs host 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 638 of file board_periph_usbhs_host.c.

References internal_hs_ccpl_status(), internal_hs_reg(), internal_hs_set(), internal_hs_setup_launch(), k_ra8_dcpctr_bit_ccpl, k_ra8_dcpctr_bit_sureq, k_ra8_usb_off_dcpctr, and RA8_INTERNAL.

Referenced by internal_hs_write().

◆ internal_hs_dvstctr0_write()

void internal_hs_dvstctr0_write ( uc_engine * uc,
uint16_t value )
static

Apply a DVSTCTR0 write, bridging a host bus-reset edge onto the device.

Apply a dvstctr0 write, bridging a host bus-reset edge onto the device; this step is contained within the board periph usbhs host model and uses bounded caller or module-owned storage.

Parameters
[in,out]ucUnicorn engine whose emulated state is read or updated.
[in]valueRegister or payload value involved in the operation.
Precondition
Arguments satisfy the ranges documented for hs dvstctr0 write.
The call executes on the emulator's single owning thread.
Postcondition
State changes remain confined to the board periph usbhs host 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 694 of file board_periph_usbhs_host.c.

References board_usb_bridge_bus_reset(), internal_hs_set(), k_ra8_usb_off_dvstctr0, k_usbhs_dvstctr_usbrst, RA8_INTERNAL, and s_hs.

Referenced by internal_hs_write().

◆ internal_hs_is_pipectr()

bool internal_hs_is_pipectr ( uint64_t off)
static

True when off is inside the PIPECTR[9] array window.

True when off is inside the pipectr[9] array window; this step is contained within the board periph usbhs host model and uses bounded caller or module-owned storage.

Parameters
[in]offRegister or byte offset addressed by the operation.
Returns
The hs is pipectr result produced by the board periph usbhs host model.
Return values
trueThe hs is pipectr condition holds or completed successfully; false otherwise.
Precondition
Arguments satisfy the ranges documented for hs is pipectr.
The call executes on the emulator's single owning thread.
Postcondition
State changes remain confined to the board periph usbhs host 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 279 of file board_periph_usbhs_host.c.

References k_ra8_usb_off_pipectr, k_ra8_usb_pipectr_count, and RA8_INTERNAL.

Referenced by internal_hs_read(), and internal_hs_write().

◆ internal_hs_or()

void internal_hs_or ( uint16_t off,
uint16_t bits )
static

OR bits into the 16-bit shadow register at off.

Or bits into the 16-bit shadow register at off; this step is contained within the board periph usbhs host model and uses bounded caller or module-owned storage.

Parameters
[in]offRegister or byte offset addressed by the operation.
[in]bitsBits input used by the operation.
Precondition
Arguments satisfy the ranges documented for hs or.
The call executes on the emulator's single owning thread.
Postcondition
State changes remain confined to the board periph usbhs host 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 234 of file board_periph_usbhs_host.c.

References internal_hs_reg(), internal_hs_set(), and RA8_INTERNAL.

Referenced by internal_hs_bempsts_read(), internal_hs_brdysts_read(), internal_hs_ccpl_status(), internal_hs_ctrl_status_complete(), and internal_hs_setup_launch().

◆ internal_hs_pipectr_index()

uint8_t internal_hs_pipectr_index ( uint64_t off)
static

PIPECTR array index (PIPE1..PIPE9, modulo pipe count) for off.

Pipectr array index (pipe1..pipe9, modulo pipe count) for off; this step is contained within the board periph usbhs host model and uses bounded caller or module-owned storage.

Parameters
[in]offRegister or byte offset addressed by the operation.
Returns
The hs pipectr index result produced by the board periph usbhs host model.
Return values
valueThe operation-specific hs pipectr index value.
Precondition
Arguments satisfy the ranges documented for hs pipectr index.
The call executes on the emulator's single owning thread.
Postcondition
State changes remain confined to the board periph usbhs host 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 296 of file board_periph_usbhs_host.c.

References k_ra8_usb_off_pipectr, k_usbhs_pipes, and RA8_INTERNAL.

Referenced by internal_hs_read(), and internal_hs_write().

◆ internal_hs_pipesel()

uint8_t internal_hs_pipesel ( void )
static

The host pipe currently selected by PIPESEL (modulo pipe count).

The host pipe currently selected by pipesel (modulo pipe count); this step is contained within the board periph usbhs host model and uses bounded caller or module-owned storage.

Returns
The hs pipesel result produced by the board periph usbhs host model.
Return values
valueThe operation-specific hs pipesel value.
Precondition
Arguments satisfy the ranges documented for hs pipesel.
The call executes on the emulator's single owning thread.
Postcondition
State changes remain confined to the board periph usbhs host 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 264 of file board_periph_usbhs_host.c.

References internal_hs_reg(), k_ra8_usb_off_pipesel, k_usbhs_pipes, and RA8_INTERNAL.

Referenced by internal_hs_read(), and internal_hs_write().

◆ internal_hs_read()

uint64_t internal_hs_read ( uc_engine * uc,
uint64_t off,
unsigned size )
static

Read one USBHS host register at window byte offset off.

Read one usbhs host register at window byte offset off; this step is contained within the board periph usbhs host model and uses bounded caller or module-owned storage.

Parameters
[in,out]ucUnicorn engine whose emulated state is read or updated.
[in]offRegister or byte offset addressed by the operation.
[in]sizeSize of the requested region or access in bytes.
Returns
The hs read result produced by the board periph usbhs host model.
Return values
valueThe operation-specific hs read value.
Precondition
Arguments satisfy the ranges documented for hs read.
The call executes on the emulator's single owning thread.
Postcondition
State changes remain confined to the board periph usbhs host 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 721 of file board_periph_usbhs_host.c.

References board_usb_dev_attached(), internal_hs_bempsts_read(), internal_hs_brdysts_read(), internal_hs_cfifo_dtln(), internal_hs_cfifo_read(), internal_hs_is_pipectr(), internal_hs_pipectr_index(), internal_hs_pipesel(), internal_hs_reg(), k_ra8_fifoctr_dtln, k_ra8_fifoctr_frdy, k_ra8_usb_off_bempsts, k_ra8_usb_off_brdysts, k_ra8_usb_off_cfifo, k_ra8_usb_off_cfifoctr, k_ra8_usb_off_dvstctr0, k_ra8_usb_off_pipemaxp, k_ra8_usb_off_syssts0, k_ra8_usbhs_off_pllsta, k_usbhs_lnst_j, k_usbhs_plllock, k_usbhs_rhst_fs, RA8_INTERNAL, and s_hs.

Referenced by board_usbhs_host_reg_read(), and internal_usbhs_block_read().

◆ internal_hs_reg()

uint16_t internal_hs_reg ( uint16_t off)
static

Read a 16-bit shadow register at window byte offset off.

Read a 16-bit shadow register at window byte offset off; this step is contained within the board periph usbhs host model and uses bounded caller or module-owned storage.

Parameters
[in]offRegister or byte offset addressed by the operation.
Returns
The hs reg result produced by the board periph usbhs host model.
Return values
valueThe operation-specific hs reg value.
Precondition
Arguments satisfy the ranges documented for hs reg.
The call executes on the emulator's single owning thread.
Postcondition
State changes remain confined to the board periph usbhs host 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 206 of file board_periph_usbhs_host.c.

References internal_hs_word(), RA8_INTERNAL, and s_hs.

Referenced by internal_hs_bempsts_read(), internal_hs_brdysts_read(), internal_hs_brdysts_write(), internal_hs_capture_setup(), internal_hs_curpipe(), internal_hs_dcpctr_write(), internal_hs_or(), internal_hs_pipesel(), internal_hs_read(), internal_hs_setup_launch(), internal_hs_write(), and internal_usbhs_block_read().

◆ internal_hs_set()

void internal_hs_set ( uint16_t off,
uint16_t value )
static

Write a 16-bit shadow register at window byte offset off.

Write a 16-bit shadow register at window byte offset off; this step is contained within the board periph usbhs host 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.
Precondition
Arguments satisfy the ranges documented for hs set.
The call executes on the emulator's single owning thread.
Postcondition
State changes remain confined to the board periph usbhs host 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 220 of file board_periph_usbhs_host.c.

References internal_hs_word(), RA8_INTERNAL, and s_hs.

Referenced by internal_hs_brdysts_write(), internal_hs_dcpctr_write(), internal_hs_dvstctr0_write(), internal_hs_or(), internal_hs_write(), and internal_usbhs_block_write().

◆ internal_hs_setup_launch()

void internal_hs_setup_launch ( uc_engine * uc)
static

Launch a SETUP (DCPCTR.SUREQ write): deliver it and latch SACK.

Launch a setup (dcpctr.sureq write): deliver it and latch sack; this step is contained within the board periph usbhs host 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 hs setup launch.
The call executes on the emulator's single owning thread.
Postcondition
State changes remain confined to the board periph usbhs host 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 568 of file board_periph_usbhs_host.c.

References board_usb_bridge_deliver_setup(), board_usb_bridge_dev_took_ccpl(), internal_hs_capture_setup(), internal_hs_or(), internal_hs_reg(), k_ra8_int1_bit_sack, k_ra8_usb_off_intsts1, k_ra8_usb_off_usbleng, k_usbhs_setup_bmrt, k_usbhs_setup_breq, k_usbhs_setup_dir_in, RA8_INTERNAL, and s_hs.

Referenced by internal_hs_dcpctr_write().

◆ internal_hs_word()

uint32_t internal_hs_word ( uint64_t off)
static

16-bit shadow word index for a window byte offset.

16-bit shadow word index for a window byte offset; this step is contained within the board periph usbhs host model and uses bounded caller or module-owned storage.

Parameters
[in]offRegister or byte offset addressed by the operation.
Returns
The hs word result produced by the board periph usbhs host model.
Return values
valueThe operation-specific hs word value.
Precondition
Arguments satisfy the ranges documented for hs word.
The call executes on the emulator's single owning thread.
Postcondition
State changes remain confined to the board periph usbhs host 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 191 of file board_periph_usbhs_host.c.

References RA8_INTERNAL.

Referenced by internal_hs_reg(), and internal_hs_set().

◆ internal_hs_write()

void internal_hs_write ( uc_engine * uc,
uint64_t off,
unsigned size,
uint64_t value )
static

Write one USBHS host register at window byte offset off.

Write one usbhs host register at window byte offset off; this step is contained within the board periph usbhs host model and uses bounded caller or module-owned storage.

Parameters
[in,out]ucUnicorn engine whose emulated state is read or updated.
[in]offRegister or byte offset addressed by the operation.
[in]sizeSize of the requested region or access in bytes.
[in]valueRegister or payload value involved in the operation.
Precondition
Arguments satisfy the ranges documented for hs write.
The call executes on the emulator's single owning thread.
Postcondition
State changes remain confined to the board periph usbhs host 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 767 of file board_periph_usbhs_host.c.

References internal_hs_brdysts_write(), internal_hs_cfifo_write(), internal_hs_cfifoctr_write(), internal_hs_dcpctr_write(), internal_hs_dvstctr0_write(), internal_hs_is_pipectr(), internal_hs_pipectr_index(), internal_hs_pipesel(), internal_hs_reg(), internal_hs_set(), k_ra8_usb_off_bempsts, k_ra8_usb_off_brdysts, k_ra8_usb_off_cfifo, k_ra8_usb_off_cfifoctr, k_ra8_usb_off_dcpctr, k_ra8_usb_off_dvstctr0, k_ra8_usb_off_intsts0, k_ra8_usb_off_intsts1, k_ra8_usb_off_nrdysts, k_ra8_usb_off_pipecfg, k_ra8_usb_off_pipemaxp, k_usbhs_cfifo_h, k_usbhs_cfifo_hh, k_usbhs_epnum_mask, and s_hs.

Referenced by board_usbhs_host_reg_write(), and internal_usbhs_block_write().

◆ internal_usbhs_block_read()

uint64_t internal_usbhs_block_read ( uc_engine * uc,
uint64_t addr,
unsigned size )
static

MMIO read handler: dispatch inside the USBHS controller window.

The embedded HS PHY page is role-agnostic and always answered here: PLLSTA reports the UTMI PLL locked so either role's PHY bring-up completes, and offsets past the device model's 0x100-byte span (LPSTS at 0x102) reflect the local shadow. Everything else routes by the self-loop polarity: to the host model (Config A, default) or to the device model after a role swap (Config B: the DCD drives this controller in device role).

Parameters
[in,out]ucUnicorn engine (forwarded to the routed model).
[in]addrAbsolute MMIO address inside the window.
[in]sizeAccess width in bytes.
Returns
The register value, zero-extended to 64 bits.
Return values
valueThe operation-specific usbhs block read value.
Precondition
Arguments satisfy the ranges documented for usbhs block read.
The call executes on the emulator's single owning thread.
Postcondition
State changes remain confined to the board periph usbhs host 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 874 of file board_periph_usbhs_host.c.

References board_usb_dev_reg_read(), board_usb_roles_swapped(), internal_hs_read(), internal_hs_reg(), k_ra8_usbhs_off_pllsta, k_usbhs_base, k_usbhs_dev_span, k_usbhs_plllock, and RA8_INTERNAL.

◆ internal_usbhs_block_register()

void internal_usbhs_block_register ( void )
static

Register the USBHS host block before main (host constructor).

Definition at line 978 of file board_periph_usbhs_host.c.

References board_periph_register_block(), RA8_INTERNAL, and s_k_usbhs_block.

◆ internal_usbhs_block_write()

void internal_usbhs_block_write ( uc_engine * uc,
uint64_t addr,
unsigned size,
uint64_t value )
static

MMIO write handler: dispatch inside the USBHS controller window.

Watches for the firmware's device-role declaration – a SYSCFG write with DPRPU=1 (the D+ pull-up only a device asserts, HUM Ch 37.2.1) – and swaps the self-loop window<->model bindings on it (Config B). PHY-page writes past the device model's span (LPSTS) always land in the local shadow; everything else routes by the current polarity.

Parameters
[in,out]ucUnicorn engine (forwarded to the routed model).
[in]addrAbsolute MMIO address inside the window.
[in]sizeAccess width in bytes.
[in]valueValue the firmware wrote.
Precondition
Arguments satisfy the ranges documented for usbhs block write.
The call executes on the emulator's single owning thread.
Postcondition
State changes remain confined to the board periph usbhs host 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 908 of file board_periph_usbhs_host.c.

References board_usb_dev_reg_write(), board_usb_roles_swap(), board_usb_roles_swapped(), internal_hs_set(), internal_hs_write(), k_ra8_syscfg_bit_dprpu, k_ra8_usb_off_syscfg, k_usbhs_base, and k_usbhs_dev_span.

◆ internal_usbhs_report()

void internal_usbhs_report ( void )
static

End-of-run summary: enumeration + bulk traffic bridged to the device.

End-of-run summary: enumeration + bulk traffic bridged to the device; this step is contained within the board periph usbhs host model and uses bounded caller or module-owned storage.

Precondition
Arguments satisfy the ranges documented for usbhs report.
The call executes on the emulator's single owning thread.
Postcondition
State changes remain confined to the board periph usbhs host 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 948 of file board_periph_usbhs_host.c.

References board_usb_roles_swapped(), priv_emu_io_errf(), RA8_INTERNAL, and s_hs.

◆ internal_usbhs_reset()

void internal_usbhs_reset ( void )
static

Reset the USBHS host model to power-on state.

Reset the usbhs host model to power-on state; this step is contained within the board periph usbhs host model and uses bounded caller or module-owned storage.

Precondition
Arguments satisfy the ranges documented for usbhs reset.
The call executes on the emulator's single owning thread.
Postcondition
State changes remain confined to the board periph usbhs host 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 936 of file board_periph_usbhs_host.c.

References RA8_INTERNAL, and s_hs.

Variable Documentation

◆ s_hs

◆ s_k_usbhs_block

const board_periph_block_t s_k_usbhs_block
static
Initial value:
= {
.base = (uint64_t)k_usbhs_base,
.span = (uint64_t)k_usbhs_span,
.order = (uint32_t)k_usbhs_report_ord,
.tick = nullptr,
.name = "USBHS-host",
.observe = false,
.loop_only = true,
}
@ k_board_block_dev_any
Present on every modelled device (default).
static void internal_usbhs_reset(void)
Reset the USBHS host model to power-on state.
static void internal_usbhs_block_write(uc_engine *uc, uint64_t addr, unsigned size, uint64_t value)
MMIO write handler: dispatch inside the USBHS controller window.
static uint64_t internal_usbhs_block_read(uc_engine *uc, uint64_t addr, unsigned size)
MMIO read handler: dispatch inside the USBHS controller window.
static void internal_usbhs_report(void)
End-of-run summary: enumeration + bulk traffic bridged to the device.
@ k_usbhs_report_ord
End-of-run report slot (after USB-FS).
@ k_usbhs_base
USBHS base (HUM Ch 37, p 2059).
@ k_usbhs_span
Modelled window (covers DEVADD / LPSTS).
-proof

USBHS host block descriptor (loop-only: owns 0x40351000 with –usbhs-loop).

Definition at line 962 of file board_periph_usbhs_host.c.

Referenced by internal_usbhs_block_register().