|
ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
|
USBX device-controller-driver bridge to ra8_usb – per-module cross-translation-unit contract. More...
#include <stdint.h>#include "ra8_attributes.h"#include "ra8_isr.h"#include "ra8_usb.h"#include "ux_dcd_ra8_usb.h"Go to the source code of this file.
Data Structures | |
| struct | ra8_usb_dcd_pipe_slot_t |
| Per-pipe class-layer cache so the IRQ handler can re-arm BRDY-driven transfers without crawling the device endpoint list. More... | |
| struct | ra8_usb_dcd_t |
| Bridge-singleton state. More... | |
| struct | ra8_usb_dcd_diag_t |
| Externally-readable diagnostic counters for OUT-pipe stall debug. More... | |
Functions | |
| uint8_t | priv_ep_to_pipe (uint8_t ep_addr) |
| Map a USB EP number (1..9) into the PIPE table index. | |
| unsigned int | priv_transfer_request (struct UX_SLAVE_TRANSFER_STRUCT *tr) |
| USBX UX_DCD_TRANSFER_REQUEST dispatcher entry point. | |
| void | priv_usbfs_irq_mask (void) |
| Mask the USB IRQ at the NVIC to break an interrupt storm. | |
| void | priv_trace_event (uint8_t kind, uint8_t code, uint16_t length) |
| Append one packed event to the JLink-readable trace ring. | |
| ra8_elc_event_t | priv_pick_event (ra8_usb_speed_t speed) |
| Pick the ELC event number for a controller. | |
| ra8_isr_handler_t | priv_pick_isr (ra8_usb_speed_t speed) |
| Pick the ISR trampoline for a controller. | |
| void | priv_event_cb (void *ctx, ra8_usb_speed_t speed, uint16_t status_mask) |
| ra8_usb_attach_handler trampoline into ux_dcd_ra8_usb_irq. | |
| unsigned int | priv_dispatch_setup (const ra8_usb_setup_t *setup) |
| Push a decoded SETUP packet into the USBX chapter-9 dispatcher. | |
| void | priv_handle_ctrt (ra8_usb_speed_t speed, uint16_t intsts0) |
| Handle the CTRT (control-transfer-stage) interrupt branch. | |
| void | priv_handle_ctrl_out_data (ra8_usb_speed_t speed) |
| Drain a deferred control-OUT data stage and run chapter-9. | |
| void | priv_dvst_default_state (ra8_usb_speed_t speed) |
| Process the DVSQ=Default branch of the DVST handler. | |
| void | priv_irq_dvst_prelude (ra8_usb_speed_t speed, uint16_t intsts0) |
| Capture DVSTCTR0 / RHST history, mirror speed, dispatch DVST. | |
Variables | |
| ra8_usb_dcd_t | g_dcd |
| The single bridge instance, defined in ux_dcd_ra8_usb.c. | |
| ra8_usb_dcd_diag_t | g_diag |
| Bridge diagnostic counter block, defined in ux_dcd_ra8_usb.c. | |
| volatile uint32_t | g_dcd_auto_echo_enable |
| Non-zero once ISR-side auto-echo is armed. | |
| uint8_t | g_dcd_auto_echo_out_pipe |
| Pipe drained by the in-ISR auto-echo path. | |
| uint8_t | g_dcd_auto_echo_in_pipe |
| Pipe the auto-echo path re-queues onto. | |
| volatile uint32_t | g_isr_spurious_run |
| Consecutive event-less ISR entries since the last SysTick re-enable. | |
| uint8_t | g_orphan_buf [k_ra8_usb_orphan_bytes] |
| One held no-receiver bulk-OUT packet. | |
| uint16_t | g_orphan_len |
| Held orphan byte count; 0 = empty. | |
| uint8_t | g_orphan_pipe |
| Pipe the held orphan packet is on. | |
| volatile uint32_t | g_setup_dispatch_count |
| Count of SETUP packets fed into the chapter-9 dispatcher. | |
| volatile uint8_t | g_setup_packet_buffer [8] |
| Wire-format bytes of the most recent SETUP packet. | |
| volatile uint32_t | g_setup_packet_count |
| Total SETUP packets latched into g_setup_packet_buffer. | |
| volatile uint32_t | g_dispatch_skip_reason |
| Last-iteration bitmask of why a SETUP dispatch was skipped or completed. | |
| volatile uint64_t | g_last_dispatched_setup_fp |
| 64-bit fingerprint of the last dispatched SETUP packet. | |
| volatile uint32_t | g_setup_token_observed |
| Counter of proven device-side SETUP-token latches. | |
USBX device-controller-driver bridge to ra8_usb – per-module cross-translation-unit contract.
The DCD bridge implementation is split across ux_dcd_ra8_usb.c and its per-aspect siblings (ux_dcd_ra8_usb_{ep,xfer,isr,setup,dvst, dvst_default,irq}.c). This header carries every symbol that more than one of those translation units references: the shared typed-enum and struct definitions, the bridge singleton and diagnostic blocks (extern), and the handful of formerly-static helpers that are called across the split. Single-translation-unit symbols stay private to their owning .c; only genuinely shared symbols live here.
This header is included by every translation unit of the bridge, after the public ux_dcd_ra8_usb.h.
Definition in file ux_dcd_ra8_usb_internal.h.
| enum ra8_setup_byte_idx_t : uint8_t |
Wire-format byte indices into the USBX SETUP buffer.
Mirrors the USB 2.0 Ch 9.3 layout, identical to USBX's own UX_SETUP_REQUEST_TYPE .. UX_SETUP_LENGTH constants but expressed as a typed enum to satisfy the project's no-magic-numbers rule and to keep the SETUP-pack code readable.
Definition at line 174 of file ux_dcd_ra8_usb_internal.h.
| enum ra8_setup_byte_pack_t : uint16_t |
Bit-shift / mask constants for splitting a uint16_t SETUP field into its little-endian byte pair.
| Enumerator | |
|---|---|
| k_setup_byte_shift | Bits per byte for the hi-byte extraction. |
| k_setup_byte_mask | Low-byte mask after the shift. |
Definition at line 190 of file ux_dcd_ra8_usb_internal.h.
| enum ra8_usb_dcd_field_mask_t : uint16_t |
Small field masks and sentinels used across the DCD bridge.
| Enumerator | |
|---|---|
| k_ra8_usb_dvsq_field_mask | 3-bit DVSQ/RHST field after shift. |
| k_ra8_usb_state_unknown | Device-state snapshot sentinel. |
Definition at line 211 of file ux_dcd_ra8_usb_internal.h.
| enum ra8_usb_dcd_intsts0_field_shift_t : uint8_t |
Bit-position shifts used to extract INTSTS0 multi-bit fields.
HUM Ch 36.2.16 INTSTS0 p 1986: DVSQ occupies bits 6:4.
| Enumerator | |
|---|---|
| k_ra8_int0_dvsq_shift | DVSQ[2:0] field starts at bit 4. |
Definition at line 50 of file ux_dcd_ra8_usb_internal.h.
| enum ra8_usb_dcd_trace_t : uint32_t |
Sizing/packing constants for the JLink-readable event ring.
Each ring entry is one uint32 packed as kind<<24 | code<<16 | length: kind 1 = bulk-OUT transfer completed (code = SCSI opcode when the transfer is a 31-byte CBW), kind 2 = bulk-IN transfer completed (code unused), kind 3 = EP0 SETUP received (code = bRequest, length = wValue). Read s_trace_seq then s_trace[] via JLink to reconstruct the device-side BOT conversation after a host probe.
Definition at line 140 of file ux_dcd_ra8_usb_internal.h.
| enum ra8_usb_dispatch_skip_bit_t : uint8_t |
Bits ORed into g_dispatch_skip_reason to record why a SETUP dispatch was skipped or how it completed.
| Enumerator | |
|---|---|
| k_ra8_usb_skip_usbreq_unchanged | USBREQ unchanged since last dispatch. |
| k_ra8_usb_skip_process_ok | control_request_process returned OK. |
Definition at line 221 of file ux_dcd_ra8_usb_internal.h.
| enum ra8_usb_ep_addr_field_t : uint8_t |
Bit fields of a USB endpoint address (bEndpointAddress).
USB 2.0 sec 9.6.6: bit 7 is the direction bit (1 = IN), and bits 3:0 carry the endpoint number; bits 6:4 are reserved.
| Enumerator | |
|---|---|
| k_ra8_usb_ep_addr_dir_in_bit | Direction bit set => IN endpoint. |
| k_ra8_usb_ep_addr_num_mask | Endpoint-number field (bits 3:0). |
Definition at line 202 of file ux_dcd_ra8_usb_internal.h.
| enum ux_dcd_ra8_usb_orphan_cfg_t : uint16_t |
| Enumerator | |
|---|---|
| k_ra8_usb_orphan_bytes | One full-speed bulk MPS packet. |
Definition at line 90 of file ux_dcd_ra8_usb_internal.h.
| unsigned int priv_dispatch_setup | ( | const ra8_usb_setup_t * | setup | ) |
Push a decoded SETUP packet into the USBX chapter-9 dispatcher.
Defined in ux_dcd_ra8_usb_setup.c.
| [in] | setup | Decoded SETUP packet snapshot (non-null). |
| UX_SUCCESS | Chapter-9 dispatcher consumed the SETUP. |
| UX_ERROR | setup null, USBX not bound, or EP0 unavailable. |
Mirrors the SETUP into the JLink-readable probe buffer (g_setup_packet_buffer) so the bench can confirm the bridge drained USBREQ/USBVAL/USBINDX/USBLENG correctly even before USBX is fully bound, then forwards the packet through _ux_system_slave's EP0 transfer-request buffer into _ux_device_stack_control_request_process.
| [in] | setup | Decoded SETUP packet snapshot (non-null). |
| UX_SUCCESS | Chapter-9 dispatcher consumed the SETUP. |
| UX_ERROR | setup was null, or USBX is not yet bound, or EP0 endpoint is not available. |
Definition at line 430 of file ux_dcd_ra8_usb_setup.c.
References ra8_usb_setup_t::b_request, g_dispatch_skip_reason, g_setup_packet_buffer, g_setup_packet_count, internal_pack_setup_le(), internal_try_defer_ctrl_out(), k_dcd_trace_kind_setup, k_ra8_usb_skip_process_ok, priv_trace_event(), and ra8_usb_setup_t::w_value.
Referenced by internal_ctrt_dispatch_fresh_setup(), and internal_dvst_dispatch_if_new().
| void priv_dvst_default_state | ( | ra8_usb_speed_t | speed | ) |
Process the DVSQ=Default branch of the DVST handler.
Defined in ux_dcd_ra8_usb_dvst_default.c; drains the persistent SETUP mirrors, dispatches a fresh SETUP if USBREQ changed, then re-arms the DCP via ra8_usb_device_busreset_rearm.
| [in] | speed | Which controller fired. |
Process the DVSQ=Default branch of the DVST handler.
Captures DCPCTR / INTSTS0 probes, drains the persistent SETUP mirrors, dispatches a fresh SETUP if USBREQ changed, then re-arms DCP via ra8_usb_device_busreset_rearm so the IP can latch the host's next SETUP token (FSP usb_pstd_busreset parity). HUM Ch 36.2.7 / 36.2.10 / 36.2.21 (FS) and Ch 37 mirrors.
| [in] | speed | Which controller fired. |
Definition at line 453 of file ux_dcd_ra8_usb_dvst_default.c.
References r_usb_regs_t::CFIFOSEL, r_usb_regs_t::DCPCTR, g_busreset_rearm_count, g_cfifosel_after_rearm, g_dcpctr_after_rearm, g_dcpctr_bit_map_observed, g_dcpctr_pre_rearm, g_dispatch_attempts, g_intenb0_after_rearm, g_intsts0_at_sqmon_edge, g_intsts0_observed_or_recent, r_usb_regs_t::INTENB0, internal_dvst_capture_setup_mirror(), internal_dvst_dispatch_if_new(), r_usb_regs_t::INTSTS0, k_ra8_dcpctr_mask_sqmon, k_ra8_usb_speed_hs, ra8_usb_device_busreset_rearm(), ra8_usb_fs(), ra8_usb_hs(), s_prev_dcpctr_sqmon, r_usb_regs_t::USBINDX, r_usb_regs_t::USBLENG, r_usb_regs_t::USBREQ, and r_usb_regs_t::USBVAL.
Referenced by internal_handle_dvst().
| uint8_t priv_ep_to_pipe | ( | uint8_t | ep_addr | ) |
Map a USB EP number (1..9) into the PIPE table index.
Defined in ux_dcd_ra8_usb_xfer.c.
| [in] | ep_addr | Endpoint address (with dir bit in 0x80). |
| 0 | The masked endpoint number is 0 (control endpoint EP0). |
| 1..9 | The masked endpoint number, used directly as the pipe index. |
| k_ux_dcd_ra8_usb_max_pipes | The masked endpoint number is >= the pipe count (out-of-range overflow sentinel). |
Map a USB EP number (1..9) into the PIPE table index.
| [in] | ep_addr | Endpoint address (with dir bit in 0x80). |
See implementation for details.
| 0 | Success or default value. |
Definition at line 66 of file ux_dcd_ra8_usb_xfer.c.
References k_ra8_usb_ep_addr_num_mask, and k_ux_dcd_ra8_usb_max_pipes.
Referenced by internal_endpoint_create(), internal_endpoint_destroy(), internal_endpoint_stall(), and priv_transfer_request().
| void priv_event_cb | ( | void * | ctx, |
| ra8_usb_speed_t | speed, | ||
| uint16_t | status_mask ) |
ra8_usb_attach_handler trampoline into ux_dcd_ra8_usb_irq.
Defined in ux_dcd_ra8_usb_isr.c.
| [in,out] | ctx | Unused ra8_usb callback context. |
| [in] | speed | Which controller fired. |
| [in] | status_mask | INTSTS0 snapshot forwarded from ra8_usb_dispatch. |
ra8_usb_attach_handler trampoline into ux_dcd_ra8_usb_irq.
See implementation for details.
| [in,out] | ctx | See function signature. |
| [in,out] | speed | See function signature. |
| [in,out] | status_mask | See function signature. |
Definition at line 500 of file ux_dcd_ra8_usb_isr.c.
References ux_dcd_ra8_usb_irq().
Referenced by ux_dcd_ra8_usb_initialize().
| void priv_handle_ctrl_out_data | ( | ra8_usb_speed_t | speed | ) |
Drain a deferred control-OUT data stage and run chapter-9.
Defined in ux_dcd_ra8_usb_setup.c.
| [in] | speed | Which controller fired (FS or HS). |
Back half of the host->device control-write data path; the front half (priv_dispatch_setup) armed the DCP and set g_ctrl_out_pending on the SETUP IRQ. Invoked from ux_dcd_ra8_usb_irq on every IRQ, AHEAD of the CTRT status handling, this acts only when a control-write data stage is pending and the host's OUT packet has landed in the DCP bank (DCP BRDY asserted). It drains the bytes into the captured EP0 transfer buffer via ra8_usb_dcp_out_read and then runs ::_ux_device_stack_control_request_process so the class control_request (e.g. DFU_DNLOAD) sees its payload. The control-write status stage (IN-ZLP) is driven separately by the CTSQ=wrss edge in priv_handle_ctrt.
Deferring to this BRDY IRQ – rather than receiving synchronously in the SETUP IRQ – is mandatory on the USB self-loop: the FS device ISR and the lower-priority HS host worker thread share one CPU, so a blocking receive in the SETUP path would spin out the very thread that must SEND the data.
| [in] | speed | Which controller fired (FS or HS). |
Definition at line 712 of file ux_dcd_ra8_usb_setup.c.
References r_usb_regs_t::BRDYSTS, g_ctrl_out_done, g_ctrl_out_pending, g_ctrl_out_rx, g_ctrl_out_tr, g_ctrl_out_wlen, k_ra8_ok, k_ra8_usb_dcp_brdy_bit, k_ra8_usb_speed_hs, ra8_usb_control_response(), ra8_usb_dcp_out_read(), ra8_usb_fs(), and ra8_usb_hs().
Referenced by ux_dcd_ra8_usb_irq().
| void priv_handle_ctrt | ( | ra8_usb_speed_t | speed, |
| uint16_t | intsts0 ) |
Handle the CTRT (control-transfer-stage) interrupt branch.
Defined in ux_dcd_ra8_usb_setup.c.
| [in] | speed | Which controller fired. |
| [in] | intsts0 | INTSTS0 snapshot captured at the top of the ISR. |
Decodes the CTSQ status field from intsts0, drains any latched VALID SETUP via internal_ctrt_handle_valid, and threads the per-stage handlers (SETUP / IN data / OUT data / status). Pulled out of the outer ISR so each helper stays under the NASA P10 Rule 4 size cap. Per HUM Ch 37.2.18 p 2081, USBREQ/USBVAL/USBINDX/USBLENG persist after the SIE auto-clears VALID, so VALID is drained unconditionally and the dispatcher dedups via a 64-bit fingerprint.
| [in] | speed | Which controller fired (k_ra8_usb_speed_fs or k_ra8_usb_speed_hs). |
| [in] | intsts0 | INTSTS0 snapshot captured at the top of the ISR. |
Definition at line 652 of file ux_dcd_ra8_usb_setup.c.
References internal_ctrt_handle_valid(), k_ra8_ctsq_rdss, k_ra8_ctsq_sqer, k_ra8_ctsq_wrnd, k_ra8_ctsq_wrss, k_ra8_intsts0_mask_ctsq, k_ra8_intsts0_mask_valid, and ra8_usb_control_response().
Referenced by ux_dcd_ra8_usb_irq().
| void priv_irq_dvst_prelude | ( | ra8_usb_speed_t | speed, |
| uint16_t | intsts0 ) |
Capture DVSTCTR0 / RHST history, mirror speed, dispatch DVST.
Defined in ux_dcd_ra8_usb_dvst.c.
| [in] | speed | Which controller fired (FS or HS). |
| [in] | intsts0 | INTSTS0 snapshot (forwarded to internal_handle_dvst). |
Pulled out of ux_dcd_ra8_usb_irq so the outer ISR fits in one page. Reads DVSTCTR0 (HUM Ch 36.2.5 p 1971) for RHST history, latches the first-observed value into g_dvstctr0_at_first_dvst, mirrors the settled link speed via internal_dvst_track_speed, then calls internal_handle_dvst for the state-machine update.
| [in] | speed | Which controller fired (FS or HS). |
| [in] | intsts0 | INTSTS0 snapshot (forwarded to internal_handle_dvst). |
Definition at line 472 of file ux_dcd_ra8_usb_dvst.c.
References r_usb_regs_t::DVSTCTR0, g_dvst_irq_count, g_dvstctr0_at_first_dvst, g_rhst_history, g_rhst_history_count, internal_dvst_track_speed(), internal_handle_dvst(), k_ra8_usb_dcd_rhst_hist_n, k_ra8_usb_dvsq_field_mask, k_ra8_usb_speed_hs, k_ra8_usb_u16_unset, ra8_usb_fs(), and ra8_usb_hs().
Referenced by ux_dcd_ra8_usb_irq().
| ra8_elc_event_t priv_pick_event | ( | ra8_usb_speed_t | speed | ) |
Pick the ELC event number for a controller.
Defined in ux_dcd_ra8_usb_isr.c.
| [in] | speed | Which controller (FS or HS). |
| k_ra8_elc_event_usbhs_int_resume | speed is k_ra8_usb_speed_hs. |
| k_ra8_elc_event_usbfs_int | speed is k_ra8_usb_speed_fs (any non-HS value). |
| [in] | speed | Which controller (FS or HS). |
See implementation for details.
| 0 | Success or default value. |
Definition at line 457 of file ux_dcd_ra8_usb_isr.c.
References k_ra8_elc_event_usbfs_int, k_ra8_elc_event_usbhs_int_resume, and k_ra8_usb_speed_hs.
Referenced by internal_init_bind_owner(), and internal_usbfs_storm_guard_init().
| ra8_isr_handler_t priv_pick_isr | ( | ra8_usb_speed_t | speed | ) |
Pick the ISR trampoline for a controller.
Defined in ux_dcd_ra8_usb_isr.c.
| [in] | speed | Which controller (FS or HS). |
| internal_usbhs_isr | speed is k_ra8_usb_speed_hs. |
| internal_usbfs_isr | speed is k_ra8_usb_speed_fs (any non-HS value). |
| [in] | speed | Which controller (FS or HS). |
See implementation for details.
| 0 | Success or default value. |
Definition at line 481 of file ux_dcd_ra8_usb_isr.c.
References internal_usbfs_isr(), internal_usbhs_isr(), and k_ra8_usb_speed_hs.
Referenced by internal_init_bind_owner().
| void priv_trace_event | ( | uint8_t | kind, |
| uint8_t | code, | ||
| uint16_t | length ) |
Append one packed event to the JLink-readable trace ring.
Defined in ux_dcd_ra8_usb_setup.c; packs kind<<24 | code<<16 | length into the next ring slot.
| [in] | kind | Event kind (ra8_usb_dcd_trace_t kinds). |
| [in] | code | Per-kind code byte (opcode / bRequest / none). |
| [in] | length | Per-kind 16-bit payload (length or wValue). |
Packs kind<<24 | code<<16 | length into the next ring slot and bumps the sequence counter. Overwrites the oldest entry once the ring wraps.
| [in] | kind | Event kind (ra8_usb_dcd_trace_t kinds). |
| [in] | code | Per-kind code byte (opcode / bRequest / none). |
| [in] | length | Per-kind 16-bit payload (length or wValue). |
Definition at line 288 of file ux_dcd_ra8_usb_setup.c.
References k_dcd_trace_code_shift, k_dcd_trace_entries, k_dcd_trace_kind_shift, s_dcd_dwt_cyccnt, s_trace, s_trace_seq, and s_trace_ts.
Referenced by internal_ctrt_dispatch_fresh_setup(), internal_dvst_record_history(), internal_irq_complete_in(), internal_irq_drain_orphan_out(), internal_irq_finish_out(), internal_submit_consume_orphan(), and priv_dispatch_setup().
| unsigned int priv_transfer_request | ( | struct UX_SLAVE_TRANSFER_STRUCT * | tr | ) |
USBX UX_DCD_TRANSFER_REQUEST dispatcher entry point.
Defined in ux_dcd_ra8_usb_xfer.c; validates the incoming transfer request, maps the endpoint to a pipe, and dispatches to the EP0 control path or the IN/OUT data-transfer path.
| [in,out] | tr | USBX transfer request to submit. |
| UX_SUCCESS | Transfer submitted (and completed by the IRQ path). |
| UX_TRANSFER_ERROR | Validation or bridge-layer rejection. |
Validates the incoming transfer request, maps the endpoint address to a pipe index, and dispatches to either internal_ep0_transfer (EP0 control) or stashes the request and submits an IN/OUT data transfer via internal_submit_pipe through the ra8_usb_* register layer. Under non-standalone builds the request is then awaited via internal_wait_completion so USBX class drivers see synchronous completion with non-zero actual_length.
| [in,out] | tr | USBX transfer request to submit. ux_slave_transfer_request_endpoint must point at a configured endpoint; data pointer and requested length describe the buffer. |
| UX_SUCCESS | Transfer submitted (and, in non-standalone builds, completed by the IRQ path). |
| UX_TRANSFER_ERROR | tr was null, endpoint was null, pipe was out of range, or the bridge layer rejected the submission. |
Definition at line 465 of file ux_dcd_ra8_usb_xfer.c.
References g_dcd, g_diag, internal_ep0_transfer(), internal_submit_pipe(), internal_wait_completion(), k_ra8_usb_ep_addr_dir_in_bit, k_ux_dcd_ra8_usb_max_pipes, and priv_ep_to_pipe().
Referenced by _ux_dcd_ra8_usb_function().
| void priv_usbfs_irq_mask | ( | void | ) |
Mask the USB IRQ at the NVIC to break an interrupt storm.
Defined in ux_dcd_ra8_usb.c; called from the ISR trampolines once a sustained run of event-less entries proves a storm.
Called from internal_usbfs_isr or internal_usbhs_isr once a sustained run of event-less entries proves a storm is in progress. With the line masked the storming controller cannot tail-chain the CPU, so RTOS thread mode runs; the per-app 1 ms SysTick_Handler re-enables the line via ux_dcd_ra8_usb_irq_reenable. The line masked is s_usb_irq_slot – whichever controller this DCD instance drives.
Definition at line 231 of file ux_dcd_ra8_usb.c.
References internal_usbfs_irq_set_enabled().
Referenced by internal_usbfs_isr(), and internal_usbhs_isr().
|
extern |
The single bridge instance, defined in ux_dcd_ra8_usb.c.
The single bridge instance.
RA8 has two USB controllers but the device stack only ever drives one at a time, so a single instance is sufficient. Updated from the ISR and the dispatch trampoline; concurrency is arbitrated at the call-site.
RA8 has two USB controllers but the device stack only ever drives one at a time, so a single static is sufficient.
Definition at line 103 of file ux_dcd_ra8_usb.c.
Referenced by _ux_dcd_ra8_usb_function(), internal_endpoint_arm_out_pid(), internal_endpoint_create(), internal_endpoint_destroy(), internal_endpoint_stall(), internal_ep0_transfer(), internal_init_bind_owner(), internal_irq_auto_echo(), internal_irq_complete_in(), internal_irq_complete_out(), internal_irq_drain_orphan_out(), internal_irq_finish_out(), internal_irq_recover_in_nak(), internal_irq_stage_next_in(), internal_irq_walk_pipe(), internal_submit_consume_orphan(), internal_submit_in_pipe(), internal_submit_pipe(), internal_try_defer_ctrl_out(), internal_wait_completion(), priv_transfer_request(), ux_dcd_ra8_usb_initialize(), ux_dcd_ra8_usb_irq(), ux_dcd_ra8_usb_irq_reenable(), ux_dcd_ra8_usb_state(), and ux_dcd_ra8_usb_uninitialize().
|
extern |
Non-zero once ISR-side auto-echo is armed.
Defined in ux_dcd_ra8_usb.c.
Definition at line 110 of file ux_dcd_ra8_usb.c.
Referenced by internal_endpoint_arm_out_pid(), internal_irq_auto_echo(), internal_irq_drain_orphan_out(), and ux_dcd_ra8_usb_auto_echo_enable().
|
extern |
Pipe the auto-echo path re-queues onto.
Defined in ux_dcd_ra8_usb.c.
Definition at line 114 of file ux_dcd_ra8_usb.c.
Referenced by internal_irq_auto_echo(), and ux_dcd_ra8_usb_auto_echo_enable().
|
extern |
Pipe drained by the in-ISR auto-echo path.
Defined in ux_dcd_ra8_usb.c.
Definition at line 112 of file ux_dcd_ra8_usb.c.
Referenced by internal_endpoint_arm_out_pid(), internal_irq_auto_echo(), internal_irq_drain_orphan_out(), and ux_dcd_ra8_usb_auto_echo_enable().
|
extern |
Bridge diagnostic counter block, defined in ux_dcd_ra8_usb.c.
Bridge diagnostic counter block.
Read via JLink memory.
Definition at line 291 of file ux_dcd_ra8_usb.c.
Referenced by internal_count_change_state(), internal_endpoint_create(), internal_irq_complete_out(), internal_irq_recover_in_nak(), internal_irq_stage_next_in(), internal_irq_walk_pipe(), internal_wait_completion(), and priv_transfer_request().
|
extern |
Last-iteration bitmask of why a SETUP dispatch was skipped or completed.
Last-iteration bitmask of why the SQMON dispatch path skipped.
Defined in ux_dcd_ra8_usb_setup.c.
Bits:
Definition at line 100 of file ux_dcd_ra8_usb_setup.c.
Referenced by internal_dvst_dispatch_if_new(), and priv_dispatch_setup().
|
extern |
Consecutive event-less ISR entries since the last SysTick re-enable.
Consecutive event-less FS ISR entries since the last SysTick re-enable.
Defined in ux_dcd_ra8_usb.c.
Incremented by internal_usbfs_isr on an entry with no real event bit, reset by it on a real event, and zeroed every 1 ms by ux_dcd_ra8_usb_irq_reenable. JLink-readable storm probe.
Definition at line 185 of file ux_dcd_ra8_usb.c.
Referenced by internal_usbfs_isr(), internal_usbhs_isr(), and ux_dcd_ra8_usb_irq_reenable().
|
extern |
64-bit fingerprint of the last dispatched SETUP packet.
64-bit fingerprint of the last SETUP packet dispatched from the ISR-driven SETUP drain in priv_handle_ctrt.
Defined in ux_dcd_ra8_usb_setup.c.
Layout (little-endian-style bit packing):
Used to de-dup VALID-driven SETUP drains so a single SETUP that fires multiple ISR snapshots is not re-dispatched. A fresh fingerprint (different from this latch) is treated as a new SETUP.
Definition at line 179 of file ux_dcd_ra8_usb_setup.c.
Referenced by internal_ctrt_dispatch_fresh_setup(), and internal_handle_dvst().
|
extern |
One held no-receiver bulk-OUT packet.
Defined in ux_dcd_ra8_usb_xfer.c.
One held no-receiver bulk-OUT packet.
Definition at line 40 of file ux_dcd_ra8_usb_xfer.c.
Referenced by internal_irq_drain_orphan_out(), and internal_submit_consume_orphan().
|
extern |
Held orphan byte count; 0 = empty.
Defined in ux_dcd_ra8_usb_xfer.c.
Held orphan byte count; 0 = empty.
Definition at line 42 of file ux_dcd_ra8_usb_xfer.c.
Referenced by internal_endpoint_arm_out_pid(), internal_irq_drain_orphan_out(), internal_submit_consume_orphan(), and internal_submit_pipe().
|
extern |
Pipe the held orphan packet is on.
Defined in ux_dcd_ra8_usb_xfer.c.
Pipe the held orphan packet is on.
Definition at line 44 of file ux_dcd_ra8_usb_xfer.c.
Referenced by internal_irq_drain_orphan_out(), and internal_submit_pipe().
|
extern |
Count of SETUP packets fed into the chapter-9 dispatcher.
Counter of SETUP packets fed into the chapter-9 dispatcher.
Defined in ux_dcd_ra8_usb_setup.c.
Bisect probe. Non-zero confirms a SETUP-drain entry point (ra8_usb_read_setup_if_valid or _unconditional) emptied USBREQ/USBVAL/USBINDX/USBLENG and priv_dispatch_setup fired. Stays zero if VALID never asserts (no SETUP token reached the IP). HUM Ch 36.2.16..36.2.19 p 1623..1626.
Definition at line 54 of file ux_dcd_ra8_usb_setup.c.
Referenced by internal_ctrt_dispatch_fresh_setup(), and internal_dvst_dispatch_if_new().
|
extern |
Wire-format bytes of the most recent SETUP packet.
Wire-format bytes of the most recent SETUP packet drained from the controller, ready for JLink inspection.
Defined in ux_dcd_ra8_usb_setup.c.
Layout matches USB 2.0 Ch 9.3: [0]=bmRequestType, [1]=bRequest, [2..3]=wValue (LE), [4..5]=wIndex (LE), [6..7]=wLength (LE). A standard GET_DESCRIPTOR(DEVICE) shows as 80 06 00 01 00 00 40 00. Stays all-zero until the first VALID/CTRT edge drains a SETUP. HUM Ch 36.2.17..36.2.20 (USBREQ/USBVAL/USBINDX/USBLENG).
Definition at line 72 of file ux_dcd_ra8_usb_setup.c.
Referenced by internal_dvst_capture_setup_mirror(), and priv_dispatch_setup().
|
extern |
Total SETUP packets latched into g_setup_packet_buffer.
Defined in ux_dcd_ra8_usb_setup.c.
Definition at line 81 of file ux_dcd_ra8_usb_setup.c.
Referenced by internal_dvst_capture_setup_mirror(), and priv_dispatch_setup().
|
extern |
Counter of proven device-side SETUP-token latches.
Counter incremented every time the IRQ snapshot proves the device-side controller latched a SETUP token from the host.
Defined in ux_dcd_ra8_usb_dvst_default.c.
Two independent evidence paths fold into this counter:
Note: INTSTS1.SACK is HOST-mode only (HUM Ch 37.2.19 SACK flag p 2084: "Values read from the SACK flag in device controller mode are invalid."), so SACK cannot serve as a SETUP-receipt probe.
Definition at line 162 of file ux_dcd_ra8_usb_dvst_default.c.
Referenced by internal_dvst_dispatch_if_new(), and internal_irq_record_snapshot().