4.3.29.4. HIFI5接口文档
Modules API
Module是
typedef struct module_ops {
int32_t (*cmd)(struct plugin_module *modptr, ele_msg_p msg_ptr);
int32_t (*process)(struct plugin_module *modptr, sample_p data_ptr);
/* this hook is for specitial used */
int32_t (*create)(struct plugin_module *modptr);
int32_t (*destroy)(struct plugin_module *modptr);
uint32_t (*priv_size)(void *work_param, uint32_t size);
uint32_t (*stack_size)(sttuct plugin_module *modptr);
} module_ops_t;
Module自身
控制接口
【函数
int32_t (*cmd)(struct plugin_module * modptr, ele_msg_p msg_ptr);
【参数
[IN] :struct plugin_module * modptr,模块
[IN]:ele_msg_p msg_ptr,命令
【说明】
框架
ELE_OPEN: 模块打开,通常是一些初始化等动作
ELE_CLOSE: 模块关闭
ELE_START: 开始 (通常是硬件驱动模块在此时开启DMA传输、开启中断等操作)
ELE_STOP: 停止
ELE_SET_PARAM: 设置参数
ELE_GET_PARAM: 获取参数
【返回值】
操作
操作
【功能
发送
基本
上述
数据接口
【函数
int32_t (*process)(struct plugin_module * modptr, sample_p data_ptr);
【参数
[IN] :struct plugin_module * modptr,模块
[IN]:sample_p data_ptr,数据结构
【说明】
process接口
typedef struct sample {
sample_attr_t attr;
uint32_t ch_count;
uint32_t sample_count;
struct sample_data {
sample_type_t **noninterleaved;/*!< noninterleaved samples: noninterleaved[ch_count][sample_count] */
char *interleaved;/*!< interlaved samples */
} samples;
} sample_t __attribute__((aligned(8)));
在module的process处理函数
【返回值】
操作
操作
【功能
数据处理
创建/销毁Hook接口
【函数
/* this hook is called after module's creating */
int32_t (*create)(struct plugin_module *modptr);
/* this hook is call before module's destroy */
int32_t (*destroy)(struct plugin_module *modptr);
【参数
[IN] :struct plugin_module * modptr,模块
【说明】
create_hook在
destroy_hook在
【返回值】
操作
操作
【功能
上述
获取模块的内存size接口
【函数
uint32_t (*priv_size)(void *work_param, uint32_t size);
【参数
[IN] :void *work_param, 工作
[IN] :uint32_t size, 参数
【说明】
有
【返回值】
操作
操作
【功能
返回
获取栈内存size接口
【函数
uint32_t (*stack_size)(struct plugin_module *modptr);
【参数
[IN] :struct plugin_module * modptr,模块
【说明】
部分
【返回值】
栈
【功能
返回
ARM 侧 IPC 调用 API
DSP 固件hb_dsp_mgr.h(DSP 生命周期hb_ipcf_hal.h(IPC 通道-ldsp -lhbipcfhal -lhbmem。
典型
hb_dsp_init → hb_dsp_mem_alloc(×N) → (hb_ipcfhal_getchan_byjson + hb_ipcfhal_init)(×N)
→ hb_dsp_start → [发送线程] hb_ipcfhal_send / [接收线程] hb_ipcfhal_recv
→ hb_ipcfhal_deinit(×N) → hb_dsp_stop → hb_dsp_mem_free(×N) → hb_dsp_deinit
各
| 接口 | 功能 |
|---|---|
| hb_dsp_init | 初始化 DSP 环境。 |
| hb_dsp_mem_alloc | 为 DSP 操作 |
| hb_ipcfhal_getchan_byjson | 按 JSON 配置文件 |
| hb_ipcfhal_init | 初始化 IPC 通道。 |
| hb_dsp_start | 加载 |
| hb_ipcfhal_send | ARM 侧 |
| hb_ipcfhal_recv | ARM 侧 |
| hb_ipcfhal_deinit | 释放 IPC 通道。 |
| hb_dsp_stop | 停止 DSP 处理。 |
| hb_dsp_mem_free | 释放 |
| hb_dsp_deinit | DSP 环境 |
IPC 通道log_level、config_num、config_num_max 以及config_x 的 name/instance/channel/pkg_size_max/fifo_size/fifo_type/ipcf_dev_path/ipcf_dev_name,字
完整adsp 源码
上述
接口 的 精确 原型 以 SDK 头文件 hb_dsp_mgr.h/hb_ipcf_hal.h为准;此处按 sample_dsp 的 实际 调用 方式 整理。
返回值说明
enum sys_error {
SYS_OK = 0,
SYS_ERR = -1,
SYS_ERR_SEM = -2,
SYS_ERR_MEM = -3,
SYS_ERR_TRANSFER = -4,
SYS_ERR_TIMEOUT = -5
};