|
ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
|
Arm Ethos-U55 NPU register window on the Renesas RA8P1 (RA8P1-only). More...
Go to the source code of this file.
Functions | |
| static volatile uint32_t * | ra8_npu_reg (uint32_t byte_off) |
| Compute a volatile pointer to an NPU register by byte offset. | |
Arm Ethos-U55 NPU register window on the Renesas RA8P1 (RA8P1-only).
The RA8P1 (R7KA8P1KFLCAC) integrates an Arm Ethos-U55 micro-NPU that the RA8D2 does not have. This header exposes the register window base, the command / queue / base-pointer interface offsets, and the CMD / STATUS / RESET field bits so ra8_npu.c can drive an inference job out of shared system SRAM.
The window base, size, interrupt event, module-stop bit, and clock domain are CONFIRMED constants cross-validated across the RA8P1 FSP CMSIS device header R7KA8P1KF_core0.h and the Zephyr r7ka8p1xf.dtsi, which agree exactly. The register OFFSETS and field-bit layout below are the Arm Ethos-U55 architectural APB interface, transcribed from the "Arm Ethos-U55 NPU Technical Reference Manual" register map and cross-checked byte-for-byte against Arm's open ethos-u-core-driver ethosu_interface.h (both REFERENCE-ONLY: the offsets are hardware facts, the prose and enums here are hand-authored under this project's style). This is deliberately NOT the RSIP-style invented- register fiction the project has been burned by before – every offset traces to the published Ethos-U55 interface. On-silicon behaviour is UNPROVEN (there is no RA8P1 board yet); the driver foundation is host-tested for the register write sequence only, and a real inference is a follow-up.
Confirmed integration facts:
Definition in file ra8_npu_regs.h.
| enum ra8_npu_addr_t : uintptr_t |
Ethos-U55 register-window base and extent on the RA8P1.
Address constants for the NPU peripheral. uintptr_t so the base is a correct pointer on both the 32-bit target and the 64-bit test host.
| Enumerator | |
|---|---|
| k_ra8_npu_base_addr | R_NPU register window base (Ethos-U55). |
Definition at line 75 of file ra8_npu_regs.h.
| enum ra8_npu_cmd_bit_t : uint8_t |
Bit positions in the NPU_CMD register.
Writing 1 to k_ra8_npu_cmd_run_bit transitions the NPU into the running state and it begins parsing the command queue. Writing 1 to k_ra8_npu_cmd_clear_irq_bit acknowledges (clears) a raised IRQ. The clock/power Q-enable bits gate the internal power/clock quiescence handshakes and are held enabled while a job runs.
Definition at line 172 of file ra8_npu_regs.h.
| enum ra8_npu_event_t : uint16_t |
ICU/ELC event number for the NPU interrupt.
Route this event to an NVIC line via the ICU IELSR registers the same way any other peripheral event is routed (see ra8_icu_regs.h / ra8_isr_register). This number occupies a slot that is a reserved gap in the RA8D2 event space, so it does not collide with any shared event.
| Enumerator | |
|---|---|
| k_ra8_npu_event_irq | NPU_IRQ event (RA8P1 elc_event_t). |
Definition at line 236 of file ra8_npu_regs.h.
| enum ra8_npu_geom_t : uint32_t |
Geometry of the 64-bit register pairs (QBASE, BASEPn).
Ethos-U55 addresses are 64-bit and split across two consecutive 32-bit words: a low word then a high word k_ra8_npu_reg_hi_offset bytes above it. Consecutive BASEPn pairs are k_ra8_npu_basep_stride_bytes apart.
| Enumerator | |
|---|---|
| k_ra8_npu_reg_hi_offset | Low->high word gap in a 64-bit reg. |
| k_ra8_npu_basep_stride_bytes | Bytes between BASEPn pairs (lo+hi). |
Definition at line 153 of file ra8_npu_regs.h.
| enum ra8_npu_layout_t : uint32_t |
Byte offsets of the Ethos-U55 APB registers within the window.
Word-aligned byte offsets into the 4 KiB window, transcribed from the Ethos-U55 TRM register map (see the file header for sourcing). The command queue is the CPU->NPU submission channel: QBASE (lo/hi 64-bit) points at the Vela command stream in SRAM and QSIZE gives its byte length. The eight base-pointer regions (see k_ra8_npu_off_basep0_lo and ra8_npu_region_idx_t) supply the AXI base address of each tensor arena the command stream references.
Definition at line 95 of file ra8_npu_regs.h.
| enum ra8_npu_region_idx_t : uint8_t |
Base-pointer region indices (Ethos-U55 has eight AXI region bases).
The Vela command stream addresses tensors by region index; the CPU programs the actual AXI base of each region into the BASEPn register pair before running a job. BASEPn_lo sits at k_ra8_npu_off_basep0_lo + n * k_ra8_npu_basep_stride_bytes, and its high word k_ra8_npu_reg_hi_offset bytes above that. Region 0 is the read-only weight/bias arena by Vela convention; other regions hold the scratch, input, and output tensors.
Definition at line 128 of file ra8_npu_regs.h.
| enum ra8_npu_reset_bit_t : uint8_t |
Bit positions in the NPU_RESET register.
A write to NPU_RESET requests a soft reset; the target privilege and security levels the NPU adopts on the next run are encoded in these bits. The driver clears both (privileged, secure) and then polls k_ra8_npu_status_reset_bit until the reset completes.
| Enumerator | |
|---|---|
| k_ra8_npu_reset_pending_cpl_bit | Privilege level adopted after reset. |
| k_ra8_npu_reset_pending_csl_bit | Security level adopted after reset. |
Definition at line 218 of file ra8_npu_regs.h.
| enum ra8_npu_status_bit_t : uint8_t |
Bit positions in the NPU_STATUS register.
state reads 1 while the NPU is running and 0 when it has stopped. cmd_end asserts when the command stream is fully consumed. The remaining bits latch fault conditions (bus error, command-stream parse error, weight-decoder fault, internal-SRAM ECC fault) that the driver surfaces as k_ra8_err_hw_error.
Definition at line 193 of file ra8_npu_regs.h.
|
inlinestatic |
Compute a volatile pointer to an NPU register by byte offset.
Returns k_ra8_npu_base_addr + byte_off as a volatile uint32_t* so ra8_npu.c can read/write a confirmed offset (e.g. k_ra8_npu_off_cmd) with a single word access. This accessor performs NO register access – it only computes an address – so no register citation lives here; the citation sits at each dereference site in the driver. The caller must have released the NPU module-stop bit and enabled NPUCLK before dereferencing the result.
| [in] | byte_off | Register byte offset from ra8_npu_layout_t (0 .. k_ra8_npu_window_bytes - 4, 4-byte aligned). |
| (base+off) | Always the fixed peripheral base plus byte_off (non-NULL). |
Definition at line 269 of file ra8_npu_regs.h.
References k_ra8_npu_base_addr.