MCU API
优质
小牛编辑
131浏览
2023-12-01
/* Voice Signal Preprocess
* Copyright (C) 1991-2017 Nationalchip Co., Ltd
* All Rights Reserved!
*
* snpu.h: Device Driver for SNPU
*
*/
#ifndef __SNPU_H__
#define __SNPU_H__
int SnpuInit(void);
int SnpuLoadFirmware(void);
int SnpuDone(void);
#ifdef CONFIG_GX8010NRE
int SnpuFloat32To16(unsigned int *in_data, unsigned short *out_data, int num, int exponent_width);
int SnpuFloat16To32(unsigned short *in_data, unsigned int *out_data, int num, int exponent_width);
#endif
typedef enum {
SNPU_IDLE,
SNPU_BUSY,
SNPU_STALL,
} SNPU_STATE;
typedef int (*SNPU_CALLBACK)(SNPU_STATE state, void *private_data);
typedef struct {
const char *version; // version in model.c
void *ops; // ops_content in model.c
void *data; // cpu_content in model.c
void *input; // input in model.c
void *output; // output in model.c
void *cmd; // npu_content in model.c
void *tmp_mem; // tmp_content in model.c
} SNPU_TASK;
int SnpuRunTask(SNPU_TASK *task, SNPU_CALLBACK callback, void *private_data);
SNPU_STATE SnpuGetState(void);
#endif // __SNPU_H__