You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
67 lines
1.4 KiB
67 lines
1.4 KiB
4 months ago
|
/*
|
||
|
* Copyright (c) Hisilicon Technologies Co., Ltd.. 2020-2020. All rights reserved.
|
||
|
* Description: baseparam database operation function
|
||
|
* Author: huanglong
|
||
|
* Create: 2020-4-6
|
||
|
*/
|
||
|
|
||
|
#ifndef __DRV_MCE_DB_H__
|
||
|
#define __DRV_MCE_DB_H__
|
||
|
|
||
|
#include "td_type.h"
|
||
|
#include "soc_log.h"
|
||
|
|
||
|
#ifdef __cplusplus
|
||
|
extern "C" {
|
||
|
#endif
|
||
|
|
||
|
#undef LOG_MODULE_ID
|
||
|
#define LOG_MODULE_ID SOC_ID_PDM
|
||
|
|
||
|
#define EXT_DB_CHECK_LEN 4
|
||
|
#define EXT_DB_MAX_SIZE (12*1024)
|
||
|
#define EXT_DB_MAX_NAME_LEN 32
|
||
|
|
||
|
typedef struct {
|
||
|
td_u32 data_len;
|
||
|
td_u8 *data;
|
||
|
} ext_db;
|
||
|
|
||
|
typedef struct {
|
||
|
ext_db *db;
|
||
|
td_char name[EXT_DB_MAX_NAME_LEN];
|
||
|
td_u32 data_size;
|
||
|
td_u8 *data;
|
||
|
} ext_db_table;
|
||
|
|
||
|
typedef struct {
|
||
|
td_u32 value_size;
|
||
|
td_char name[EXT_DB_MAX_NAME_LEN];
|
||
|
td_void *value;
|
||
|
} ext_db_key;
|
||
|
|
||
|
td_s32 ext_db_create(ext_db *db);
|
||
|
|
||
|
td_s32 ext_db_destroy(ext_db *db);
|
||
|
|
||
|
td_s32 ext_db_get_db_from_mem(td_u8 *db_mem, ext_db *db);
|
||
|
|
||
|
td_s32 ext_db_insert_table(ext_db *db, ext_db_table *table);
|
||
|
|
||
|
td_s32 ext_db_delete_table(const ext_db *db, const td_char table_name[]);
|
||
|
|
||
|
td_s32 ext_db_get_table_by_name(ext_db *db, td_char table_name[], ext_db_table *table);
|
||
|
|
||
|
td_s32 ext_db_insert_key(ext_db_table *table, ext_db_key *key);
|
||
|
|
||
|
td_s32 ext_db_delete_key(const ext_db_table *table, const td_char key_name[]);
|
||
|
|
||
|
td_s32 ext_db_get_key_by_name(const ext_db_table *table, td_char *key_name, td_u32 key_len, ext_db_key *key);
|
||
|
|
||
|
#ifdef __cplusplus
|
||
|
}
|
||
|
#endif
|
||
|
|
||
|
#endif
|
||
|
|