45static const char*
s_tag =
"ETHOSU";
60typedef enum : int32_t {
61 k_ra8_ethosu_ret_ok = 0,
62 k_ra8_ethosu_ret_err = -1,
91static struct ethosu_driver s_ethosu_driver = {};
101static bool s_ethosu_driver_ready =
false;
103struct ethosu_driver* ethosu_reserve_driver(
void)
105 if (!s_ethosu_driver_ready) {
111 s_ethosu_driver_ready =
true;
113 s_ethosu_driver.reserved =
true;
114 return &s_ethosu_driver;
144static bool internal_invoke_args_ok(
const struct ethosu_driver* drv,
145 const void* custom_data_ptr,
146 int custom_data_size,
147 const uint64_t* base_addr,
150 if (drv ==
nullptr) {
154 if (custom_data_ptr ==
nullptr) {
158 if (custom_data_size <= 0) {
162 if (num_base_addr < 0) {
172 if ((num_base_addr > 0) && (base_addr ==
nullptr)) {
179int ethosu_invoke_v3(
struct ethosu_driver* drv,
180 const void* custom_data_ptr,
181 int custom_data_size,
182 const uint64_t* base_addr,
183 const size_t* base_addr_size,
189 (void)base_addr_size;
192 if (!internal_invoke_args_ok(drv, custom_data_ptr, custom_data_size, base_addr, num_base_addr)) {
193 return (
int)k_ra8_ethosu_ret_err;
207 return (
int)k_ra8_ethosu_ret_err;
212 return (
int)k_ra8_ethosu_ret_err;
217 return (
int)k_ra8_ethosu_ret_err;
219 return (
int)k_ra8_ethosu_ret_ok;
222void ethosu_release_driver(
struct ethosu_driver* drv)
224 if (drv ==
nullptr) {
231 drv->reserved =
false;
static const char * s_tag
Logging / check tag.
Annotation-attribute framework macros for ra8-firmware.
#define RA8_INTERNAL
Marker that a function is intended to be static (file-local).
Compile-time device selection for the RA8 multi-chip build (RA8D2 / RA8P1).
Error Code Definitions for ra8-firmware.
static bool ra8_err_is_error(ra8_err_t err)
Test whether a code represents failure.
ra8_err_codes_t ra8_err_t
Canonical error-return type used by every ra8-firmware API.
int ra8_ethosu_shim_not_on_this_device_t
Arm ethos-u-core-driver C API shim over the ra8_npu driver (RA8P1-only).
Lightweight Logging Interface for ra8-firmware.
#define ra8_log_error(tag, message)
RA8 log error.
Arm Ethos-U55 NPU command/queue driver foundation (RA8P1-only).
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_run(void)
Kick the currently-submitted job (transition the NPU to running).
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.
uint8_t region_count
Number of region_base[] entries in use.
uint32_t cmd_stream_bytes
Command stream length in bytes (> 0).
uint64_t region_base[k_ra8_npu_region_count]
AXI base of each BASEPn arena.
const void * cmd_stream
Vela command stream base in SRAM.