14#ifndef __INCLUDE_GNA__
15#define __INCLUDE_GNA__
114typedef int (*gna_api_config)(
const struct device *dev,
116typedef int (*gna_api_register)(
const struct device *dev,
118 void **model_handle);
119typedef int (*gna_api_deregister)(
const struct device *dev,
121typedef int (*gna_api_infer)(
const struct device *dev,
123 gna_callback callback);
125struct gna_driver_api {
126 gna_api_config configure;
127 gna_api_register register_model;
128 gna_api_deregister deregister_model;
151 const struct gna_driver_api *api =
152 (
const struct gna_driver_api *)dev->
api;
154 return api->configure(dev, cfg);
174 const struct gna_driver_api *api =
175 (
const struct gna_driver_api *)dev->
api;
177 return api->register_model(dev, model, model_handle);
195 const struct gna_driver_api *api =
196 (
const struct gna_driver_api *)dev->
api;
198 return api->deregister_model(dev, model);
217 gna_callback callback)
219 const struct gna_driver_api *api =
220 (
const struct gna_driver_api *)dev->
api;
222 return api->infer(dev, req, callback);
struct result result[2]
Definition: errno.c:41
static int gna_infer(const struct device *dev, struct gna_inference_req *req, gna_callback callback)
Perform inference on a model with input vectors.
Definition: gna.h:215
gna_result
Definition: gna.h:89
static int gna_deregister_model(const struct device *dev, void *model)
De-register a previously registered neural network model.
Definition: gna.h:193
static int gna_register_model(const struct device *dev, struct gna_model_info *model, void **model_handle)
Register a neural network model.
Definition: gna.h:170
static int gna_configure(const struct device *dev, struct gna_config *cfg)
Configure the GNA device.
Definition: gna.h:148
@ GNA_RESULT_INFERENCE_COMPLETE
Definition: gna.h:90
@ GNA_RESULT_SATURATION_OCCURRED
Definition: gna.h:91
@ GNA_RESULT_OUTPUT_BUFFER_FULL_ERROR
Definition: gna.h:92
@ GNA_RESULT_PARAM_OUT_OF_RANGE_ERROR
Definition: gna.h:93
@ GNA_RESULT_GENERIC_ERROR
Definition: gna.h:94
__UINT32_TYPE__ uint32_t
Definition: stdint.h:60
Runtime device structure (in ROM) per driver instance.
Definition: device.h:367
const void * api
Definition: device.h:373
void * intermediate
Definition: gna.h:74
void * model_handle
Definition: gna.h:71
void * output
Definition: gna.h:73
void * input
Definition: gna.h:72
enum gna_result result
Definition: gna.h:101
size_t output_len
Definition: gna.h:103
struct gna_inference_stats stats
Definition: gna.h:104
void * output
Definition: gna.h:102
uint32_t total_cycles
Definition: gna.h:81
uint32_t cycles_per_sec
Definition: gna.h:83
uint32_t stall_cycles
Definition: gna.h:82
void * ro_region
Definition: gna.h:64
void * rw_region
Definition: gna.h:63
struct gna_model_header * header
Definition: gna.h:62