ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
Loading...
Searching...
No Matches
ra8_npu.h
Go to the documentation of this file.
1
42
43#pragma once
44
45#include <stdint.h>
46
47#include "ra8_device.h"
48#include "ra8_err.h"
49#include "ra8_npu_regs.h"
50
51#ifndef RA8_HAS_NPU
52#error "ra8_npu.h included on a device without an NPU (RA8P1-only)."
53#endif
54
55#ifdef __cplusplus
56extern "C" {
57#endif
58
87typedef struct {
88 const void* cmd_stream;
90 uint8_t region_count;
93
106typedef struct {
107 uint32_t raw;
108 bool running;
110 bool cmd_end;
111 bool fault;
113
142[[nodiscard]] ra8_err_t ra8_npu_init(void);
143
165[[nodiscard]] ra8_err_t ra8_npu_deinit(void);
166
188[[nodiscard]] ra8_err_t ra8_npu_reset(void);
189
213[[nodiscard]] ra8_err_t ra8_npu_read_id(uint32_t* out_id);
214
247[[nodiscard]] ra8_err_t ra8_npu_submit(const ra8_npu_job_t* job);
248
271[[nodiscard]] ra8_err_t ra8_npu_run(void);
272
297[[nodiscard]] ra8_err_t ra8_npu_poll(bool* out_done);
298
321[[nodiscard]] ra8_err_t ra8_npu_wait(void);
322
343
363[[nodiscard]] ra8_err_t ra8_npu_clear_irq(void);
364
390[[nodiscard]] ra8_err_t ra8_npu_irq_arm(void);
391
420void ra8_npu_irq_handler(void* ctx);
421
449[[nodiscard]] ra8_err_t ra8_npu_wait_irq(void);
450
451#ifdef __cplusplus
452}
453#endif
Compile-time device selection for the RA8 multi-chip build (RA8D2 / RA8P1).
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
ra8_err_t ra8_npu_clear_irq(void)
Acknowledge (clear) a raised NPU interrupt.
ra8_err_t ra8_npu_read_status(ra8_npu_status_t *out)
Read and decode the NPU_STATUS register.
ra8_err_t ra8_npu_poll(bool *out_done)
Non-blocking completion / fault poll of a running job.
ra8_err_t ra8_npu_submit(const ra8_npu_job_t *job)
Program the command queue and tensor region base pointers for a job.
ra8_err_t ra8_npu_wait_irq(void)
Block on the NPU interrupt until the armed job completes or faults.
ra8_err_t ra8_npu_irq_arm(void)
Arm the interrupt-driven completion latch for the submitted job.
void ra8_npu_irq_handler(void *ctx)
NPU interrupt service routine: latch completion / fault, ack the IRQ.
ra8_err_t ra8_npu_run(void)
Kick the currently-submitted job (transition the NPU to running).
ra8_err_t ra8_npu_reset(void)
Soft-reset an already-initialized NPU.
ra8_err_t ra8_npu_deinit(void)
Gate the NPU back into module-stop.
ra8_err_t ra8_npu_read_id(uint32_t *out_id)
Read the Ethos-U55 NPU_ID (architecture / product revision) register.
ra8_err_t ra8_npu_init(void)
Bring the NPU out of module-stop and soft-reset it.
ra8_err_t ra8_npu_wait(void)
Bounded busy-wait until the running job completes or faults.
Arm Ethos-U55 NPU register window on the Renesas RA8P1 (RA8P1-only).
@ k_ra8_npu_region_count
Number of BASEPn region base-pointer pairs.
One Ethos-U55 inference job: a command stream plus its tensor arenas.
Definition ra8_npu.h:87
uint8_t region_count
Number of region_base[] entries in use.
Definition ra8_npu.h:90
uint32_t cmd_stream_bytes
Command stream length in bytes (> 0).
Definition ra8_npu.h:89
uint64_t region_base[k_ra8_npu_region_count]
AXI base of each BASEPn arena.
Definition ra8_npu.h:91
const void * cmd_stream
Vela command stream base in SRAM.
Definition ra8_npu.h:88
Decoded snapshot of the NPU_STATUS register.
Definition ra8_npu.h:106
bool fault
Any bus / parse / weight-decoder / ECC fault bit.
Definition ra8_npu.h:111
uint32_t raw
Verbatim NPU_STATUS register value.
Definition ra8_npu.h:107
bool running
STATUS.state: NPU is executing a command stream.
Definition ra8_npu.h:108
bool irq_raised
STATUS.irq_raised: an interrupt is pending.
Definition ra8_npu.h:109
bool cmd_end
STATUS.cmd_end: command stream fully consumed.
Definition ra8_npu.h:110