ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
Loading...
Searching...
No Matches
ra8_hal_internal.h
Go to the documentation of this file.
1
20
21#pragma once
22
23#include <stdint.h>
24
25#include "ra8_attributes.h"
26#include "ra8_canfd_regs.h"
27#include "ra8_dotf.h"
28#include "ra8_err.h"
29#include "ra8_rmac_regs.h"
30#include "ra8_ssie_regs.h"
31#include "ra8_usb_hmsc.h"
32
55{
56 return (uint16_t)channel < (uint16_t)k_ra8_dotf_channel_count;
57}
58
59/* =============================================================================
60 * ra8_rmac: split between ra8_rmac.c (lifecycle / config / MDIO primitives /
61 * status / dispatch) and ra8_rmac_mgmt.c (statistic-counter snapshot + IEEE
62 * 802.3 Clause-22 PHY management). Both translation units range-check the
63 * port argument before touching the RMAC register window, so the port-bounds
64 * predicate is shared here as a header ``static inline`` -- each TU gets its
65 * own copy with no external linkage symbol, keeping the split link-clean.
66 * =============================================================================
67 */
68
91{
92 return (uint8_t)port < k_ra8_rmac_port_count;
93}
94
95/* =============================================================================
96 * ra8_mipi_csi: split between ra8_mipi_csi.c (lifecycle / register knobs) and
97 * ra8_mipi_csi_irq.c (interrupt path + per-VC framing). The interrupt TU owns
98 * every callback function-pointer / context static, so lifecycle teardown in
99 * ra8_mipi_csi.c detaches them through this promoted helper rather than
100 * touching the statics across the TU boundary.
101 * =============================================================================
102 */
103
126
127/* =============================================================================
128 * ra8_ssie: split between ra8_ssie.c (lifecycle / register knobs / polled FIFO /
129 * status / IRQ) and ra8_ssie_stream.c (DMA channel attach/detach + polled ISO
130 * bulk send/recv). Both translation units read and write the per-channel
131 * runtime bookkeeping array and call the channel-validating register accessor,
132 * so the runtime state stays a single object and the accessor is promoted to
133 * TU-external linkage here.
134 * =============================================================================
135 */
136
146
157
173
195RA8_PRIV volatile r_ssie_regs_t* priv_ra8_ssie_internal_regs(uint8_t channel);
196
197/* =============================================================================
198 * ra8_usb_hmsc: split between ra8_usb_hmsc.c (CBW/CSW helpers, lifecycle, attach
199 * callback, BOT/SCSI command path) and ra8_usb_hmsc_enum.c (the polled
200 * enumeration ladder). Both translation units read and write the singleton
201 * shadow state, so it stays a single object: the type and the extern
202 * declaration live here, the one definition lives in ra8_usb_hmsc.c.
203 * =============================================================================
204 */
205
229
246
247/* =============================================================================
248 * ra8_canfd: split between ra8_canfd.c (clock / MSTP / global+channel mode state
249 * machine, AFL / RX-FIFO bring-up, lifecycle, status / IRQ / filter / test-mode
250 * / power) and two siblings: ra8_canfd_frame.c (TX/RX frame data path) and
251 * ra8_canfd_timing.c (bit-timing solver + bitrate / BRS configuration). The
252 * timing TU has to drive the channel mode state machine to land NCFG / DCFG
253 * edits in CH_RESET, so the channel-mode helper -- whose definition stays in
254 * ra8_canfd.c next to the rest of the mode machinery -- is promoted to
255 * TU-external linkage here. No mutable state crosses the split.
256 * =============================================================================
257 */
258
286 ra8_chmdc_mode_t mode);
Annotation-attribute framework macros for ra8-firmware.
#define RA8_PRIV
Module-private helper: shared across TUs but only inside one library.
#define RA8_INTERNAL
Marker that a function is intended to be static (file-local).
CANFD controller register layout for the Renesas RA8D2.
ra8_chmdc_mode_t
Channel Mode Control (CFDC[0].CTR.CHMDC[1:0]) values.
Decryption On The Fly (DOTF) HAL driver public API.
@ k_ra8_dotf_channel_count
DOTF0 + DOTF1.
Error Code Definitions for ra8-firmware.
ra8_err_codes_t ra8_err_t
Canonical error-return type used by every ra8-firmware API.
Definition ra8_err.h:546
volatile r_ssie_regs_t * priv_ra8_ssie_internal_regs(uint8_t channel)
Validate an SSIE channel index and return its register block.
Definition ra8_ssie.c:101
ra8_ssie_internal_const_t
Internal magic-number constants promoted to typed enums.
@ k_ra8_ssie_dma_ch_unused
Sentinel: no DMA channel.
@ k_ra8_ssie_thresh_max
Max SSISCR threshold value.
@ k_ra8_ssie_dma_max_ch
DMAC channel count (0..7).
ra8_usb_hmsc_state_t g_usb_hmsc_state
Singleton host-MSC shadow state, shared across the ra8_usb_hmsc split.
ra8_ssie_runtime_t g_ssie_runtime[k_ra8_ssie_channel_count]
Per-channel SSIE runtime state, shared across the ra8_ssie split.
Definition ra8_ssie.c:73
ra8_err_t priv_ra8_canfd_internal_set_channel_mode(volatile r_canfd_t *reg, ra8_chmdc_mode_t mode)
Drive CFDC[0].CTR.CHMDC and wait for the matching status bit.
Definition ra8_canfd.c:138
static bool internal_ra8_dotf_internal_channel_in_range(uint8_t channel)
Bound-check a DOTF channel index.
void priv_ra8_mipi_csi_detach_all_handlers(void)
Detach every MIPI CSI-2 receiver callback (module / data-lane / virtual-channel / power-management / ...
static bool internal_port_ok(ra8_rmac_port_t port)
Range-check an RMAC port argument.
Ethernet MAC (RMAC) per-port register layout for the RA8D2.
ra8_rmac_port_t
RMAC port index (m = 0, 1).
@ k_ra8_rmac_port_count
Number of RMAC ports.
Serial Sound Interface Enhanced (SSIE) register layout for the RA8D2.
@ k_ra8_ssie_channel_count
SSIE0 + SSIE1.
ra8_usb_speed_t
Selects which controller instance the call targets.
Native USB host-side MSC (Mass Storage Class) class layer.
void(* ra8_usb_hmsc_attach_fn_t)(void *ctx, const ra8_usb_hmsc_device_t *device)
Attach-callback signature.
Per-channel SSIE register window.
Per-channel runtime bookkeeping.
uint8_t tx_dma_channel
DMAC channel pumping TX (or unused).
bool dma_attached
true after ra8_ssie_attach_dma.
uint8_t rx_dma_channel
DMAC channel pumping RX (or unused).
bool initialized
true after ra8_ssie_init succeeded.
Snapshot of the attached MSC device, passed to the attach callback.
Singleton shadow state for the host-MSC driver.
ra8_usb_hmsc_device_t device
Snapshot of attached dev.
ra8_usb_speed_t speed
Underlying controller.
void * attach_ctx
Attach callback ctx.
bool attached
True after enum done.
bool initialized
True after init.
uint32_t next_cbw_tag
Monotonic BOT tag.
ra8_usb_hmsc_attach_fn_t attach_cb
Attach callback, or NULL.