CI130X SDK API手册  2.2.0
本手册用于描述CI130X SDK各个组件和驱动API
结构体 | 宏定义 | 类型定义 | 函数 | 变量
command_file_reader_v3.c 文件参考
#include "stdio.h"
#include "ci130x_spiflash.h"
#include "command_file_reader.h"
#include "string.h"
#include "ci_flash_data_info.h"
#include "flash_manage_outside_port.h"
#include "ci_log.h"
#include "FreeRTOS.h"
#include "task.h"
#include "romlib_runtime.h"

结构体

struct  cmd_file_header_st
 Command information file header. 更多...
 
struct  models_table_item_st
 
struct  cmd_models_table_item_st
 
struct  model_header_st
 Model header 更多...
 

宏定义

#define MAX_CMD_FILE_FLAG_LEN   16
 
#define cmd_file_reader_malloc(x)   pvPortMalloc(x)
 
#define cmd_file_reader_free(x)   vPortFree(x)
 

类型定义

typedef struct cmd_file_header_st cmd_file_header_t
 Command information file header. 更多...
 
typedef struct models_table_item_st models_table_item_t
 
typedef struct cmd_models_table_item_st cmd_models_table_item_t
 
typedef struct model_header_st model_header_t
 Model header 更多...
 

函数

uint32_t cmd_file_reader_init (uint32_t start_addr_in_flash)
 Initialize command file reader. 更多...
 
uint32_t cmd_file_get_model_number ()
 Get models number. 更多...
 
uint32_t cmd_file_change_cur_model_group (uint8_t model_group_id)
 
uint32_t cmd_file_change_model (uint32_t model_id)
 Change current model group. 更多...
 
uint32_t cmd_file_get_max_model_group_id ()
 Get id of model group, that prun of asr is the max. 更多...
 
uint32_t cmd_file_get_cur_model_dnn_id ()
 
uint32_t cmd_file_get_cur_model_id (uint32_t *p_dnn_id, uint32_t *p_asr_id)
 Get models ID. 更多...
 
uint32_t cmd_file_get_command_number ()
 Get number of commands in current model. 更多...
 
uint32_t cmd_file_read_command_table (void *table_buffer)
 Reads commands table to the specifiled buffer. 更多...
 
uint32_t cmd_file_get_special_word_number ()
 Get number of special words. 更多...
 
uint32_t cmd_file_read_special_word_table (void *table_buffer)
 Reads special words table to the specifiled buffer. 更多...
 
uint32_t cmd_file_read_string_index_table (void *table_buffer)
 Read string index table to the specifiled buffer. 更多...
 
uint32_t cmd_file_get_string_table_size ()
 Get size of string table. 更多...
 
uint32_t cmd_file_read_string_table (void *table_buffer)
 Read string table to the specifiled buffer. 更多...
 
uint32_t cmd_file_get_voice_number ()
 Get number of voice. 更多...
 
uint32_t cmd_file_read_voice_table (void *table_buffer)
 Read voice table to the specifiled buffer. 更多...
 
int32_t cmd_file_get_send_data_item_len (void)
 
int32_t cmd_file_get_recieve_data_item_len (void)
 
int32_t cmd_file_read_send_data_table (uint8_t *p_send_data_table, uint8_t *p_item_length)
 
int32_t cmd_file_read_recieve_data_table (uint8_t *p_recieve_data_table, uint8_t *p_item_length)
 

变量

static uint32_t cmd_file_start_addr_in_flash = (uint32_t)-1
 
static cmd_file_header_t cmd_file_header = {0}
 
static model_header_t model_header ={0}
 

结构体说明

◆ cmd_file_header_st

struct cmd_file_header_st

Command information file header.

成员变量
char file_flag[16] Version of file format.
uint16_t file_format_version
uint8_t model_number Start offset of table that save the voice.
uint16_t voice_number
uint32_t voice_table_offset Number of voice.

◆ models_table_item_st

struct models_table_item_st
成员变量
uint8_t model_id
uint32_t model_offset

◆ cmd_models_table_item_st

struct cmd_models_table_item_st
成员变量
uint8_t model_group_id
uint32_t model_group_offset

◆ model_header_st

struct model_header_st

Model header

成员变量
uint16_t asr_id ID of DNN file.
uint32_t cmd_string_index_table_offset Start offset of table that save the wait time after special word.
uint32_t cmd_string_table_offset Size of table that save the command strings.
uint32_t cmd_string_table_size Start offset of table that save the index of strings.
uint16_t command_number
uint32_t command_table_offset ID of ASR file.
uint16_t dnn_id Number of command.
uint8_t recieve_data_item_len
uint32_t recieve_data_table_offset
uint8_t send_data_item_len Start offset of table that save the command strings.
uint32_t send_data_table_offset
uint16_t special_word_number Start offset of command table in file.
uint32_t special_word_wait_count_table_offset Number of special words.

宏定义说明

◆ cmd_file_reader_free

#define cmd_file_reader_free (   x)    vPortFree(x)

◆ cmd_file_reader_malloc

#define cmd_file_reader_malloc (   x)    pvPortMalloc(x)

◆ MAX_CMD_FILE_FLAG_LEN

#define MAX_CMD_FILE_FLAG_LEN   16

类型定义说明

◆ cmd_file_header_t

Command information file header.

◆ cmd_models_table_item_t

◆ model_header_t

Model header

◆ models_table_item_t

函数说明

◆ cmd_file_change_cur_model_group()

uint32_t cmd_file_change_cur_model_group ( uint8_t  model_group_id)

◆ cmd_file_change_model()

uint32_t cmd_file_change_model ( uint32_t  model_index)

Change current model group.

参数
model_group_idID of medel group in cmd file.
返回
uint32_t 0:sucessful, others:error number.

◆ cmd_file_get_command_number()

uint32_t cmd_file_get_command_number ( )

Get number of commands in current model.

返回
uint32_t number of commands.

◆ cmd_file_get_cur_model_dnn_id()

uint32_t cmd_file_get_cur_model_dnn_id ( )

◆ cmd_file_get_cur_model_id()

uint32_t cmd_file_get_cur_model_id ( uint32_t *  p_dnn_id,
uint32_t *  p_asr_id 
)

Get models ID.

参数
p_dnn_idA pointer to a uint32_t variable used to receive dnn file id.
p_asr_idA pointer to a uint32_t variable used to receive asr file id.
p_voice_group_idA pointer to a uint32_t variable used to receive voice group id.
返回
uint32_t 0:sucessful, others:error number.

◆ cmd_file_get_max_model_group_id()

uint32_t cmd_file_get_max_model_group_id ( )

Get id of model group, that prun of asr is the max.

返回
id of model group.

◆ cmd_file_get_model_number()

uint32_t cmd_file_get_model_number ( )

Get models number.

返回
uint32_t Number of model in cmd file.

◆ cmd_file_get_recieve_data_item_len()

int32_t cmd_file_get_recieve_data_item_len ( void  )

◆ cmd_file_get_send_data_item_len()

int32_t cmd_file_get_send_data_item_len ( void  )

◆ cmd_file_get_special_word_number()

uint32_t cmd_file_get_special_word_number ( )

Get number of special words.

返回
uint32_t number of special words.

◆ cmd_file_get_string_table_size()

uint32_t cmd_file_get_string_table_size ( )

Get size of string table.

返回
uint32_t Size of string table.

◆ cmd_file_get_voice_number()

uint32_t cmd_file_get_voice_number ( )

Get number of voice.

返回
uint32_t Number of voice.

◆ cmd_file_read_command_table()

uint32_t cmd_file_read_command_table ( void *  table_buffer)

Reads commands table to the specifiled buffer.

参数
table_bufferThe buffer use to save commands table, provided by caller. Buffer size is larger or equal to commands number times sizeof(command_info_t).
返回
uint32_t 0:sucessful, others:error number.

◆ cmd_file_read_recieve_data_table()

int32_t cmd_file_read_recieve_data_table ( uint8_t *  p_recieve_data_table,
uint8_t *  p_item_length 
)

◆ cmd_file_read_send_data_table()

int32_t cmd_file_read_send_data_table ( uint8_t *  p_send_data_table,
uint8_t *  p_item_length 
)

◆ cmd_file_read_special_word_table()

uint32_t cmd_file_read_special_word_table ( void *  table_buffer)

Reads special words table to the specifiled buffer.

参数
table_bufferThe buffer use to save special words table, provided by caller. Buffer size is larger or equal to special words number times sizeof(special_wait_count_t).
返回
uint32_t 0:sucessful, others:error number.

◆ cmd_file_read_string_index_table()

uint32_t cmd_file_read_string_index_table ( void *  table_buffer)

Read string index table to the specifiled buffer.

参数
table_bufferThe buffer use to save string index table, provided by caller. Buffer size is larger or eaqual to commands number times sizeof(command_string_index_t).
返回
uint32_t 0:sucessful, others:error number.

◆ cmd_file_read_string_table()

uint32_t cmd_file_read_string_table ( void *  table_buffer)

Read string table to the specifiled buffer.

参数
table_bufferThe buffer use to save string table, provided by caller. Buffer size is larger or eaqual to string table size.
返回
uint32_t 0:sucessful, others:error number.

◆ cmd_file_read_voice_table()

uint32_t cmd_file_read_voice_table ( void *  table_buffer)

Read voice table to the specifiled buffer.

参数
table_bufferThe buffer used to save voice table, provided by caller. Buffer size is larger or equal to voice number times sizeof(voice_info_t).
返回
uint32_t 0:sucessful, others:error number.

◆ cmd_file_reader_init()

uint32_t cmd_file_reader_init ( uint32_t  start_addr_in_flash)

Initialize command file reader.

参数
start_addr_in_flashStart address of command file in flash.
返回
uint32_t 0:sucessful, others:error number.

变量说明

◆ cmd_file_header

cmd_file_header_t cmd_file_header = {0}
static

◆ cmd_file_start_addr_in_flash

uint32_t cmd_file_start_addr_in_flash = (uint32_t)-1
static

◆ model_header

model_header_t model_header ={0}
static