refactor[mpp]: Remove MppCfgInfo struct

Change-Id: Id040f070276b031b52d925e1a5c882371a7ce92e
Signed-off-by: Xiaoxu Chen <xiaoxu.chen@rock-chips.com>
This commit is contained in:
Xiaoxu Chen 2025-11-19 11:49:24 +08:00 committed by Herman Chen
parent 5e01384500
commit a378c6de04
7 changed files with 107 additions and 239 deletions

View file

@ -70,16 +70,10 @@
.tbl.elem_type = ELEM_TYPE_##ftype, \
.tbl.flag_offset = FLAG_TYPE_TO_OFFSET(name, flag, #flag), \
}; \
MppCfgInfo info = { \
.data_type = CFG_FUNC_TYPE_##ftype, \
.flag_offset = tbl.tbl.flag_offset, \
.data_offset = tbl.tbl.elem_offset, \
.data_size = tbl.tbl.elem_size, \
}; \
MppCfgObj CONCAT_US(obj, name) = NULL; \
kmpp_objdef_add_entry(KMPP_OBJ_DEF(prefix), ENTRY_TO_NAME_START(name), &tbl); \
mpp_cfg_get_object(&CONCAT_US(obj, name), TO_STR(name), MPP_CFG_TYPE_##ftype, NULL); \
mpp_cfg_set_info(CONCAT_US(obj, name), &info); \
mpp_cfg_set_entry(CONCAT_US(obj, name), &tbl); \
mpp_cfg_add(__parent, CONCAT_US(obj, name)); \
ENTRY_TO_NAME_END(name); \
} while (0);

View file

@ -65,8 +65,6 @@ rk_s32 mpp_cfg_del(MppCfgObj obj);
/* find by name string */
rk_s32 mpp_cfg_find(MppCfgObj *obj, MppCfgObj root, char *name, rk_s32 type);
/* attach MppCfgInfo for access location */
rk_s32 mpp_cfg_set_info(MppCfgObj obj, MppCfgInfo *info);
/* attach KmppEntry for access location */
rk_s32 mpp_cfg_set_entry(MppCfgObj obj, KmppEntry *entry);
/* add cfg obj condition for input / output option */

View file

@ -19,124 +19,30 @@
#define mpp_cfg_dbg_set(fmt, ...) mpp_cfg_dbg(MPP_CFG_DBG_SET, fmt, ## __VA_ARGS__)
#define mpp_cfg_dbg_get(fmt, ...) mpp_cfg_dbg(MPP_CFG_DBG_GET, fmt, ## __VA_ARGS__)
#define CFG_TO_PTR(info, cfg) ((char *)cfg + info->data_offset)
#define CFG_TO_s32_PTR(info, cfg) ((RK_S32 *)CFG_TO_PTR(info, cfg))
#define CFG_TO_u32_PTR(info, cfg) ((RK_U32 *)CFG_TO_PTR(info, cfg))
#define CFG_TO_s64_PTR(info, cfg) ((RK_S64 *)CFG_TO_PTR(info, cfg))
#define CFG_TO_u64_PTR(info, cfg) ((RK_U64 *)CFG_TO_PTR(info, cfg))
#define CFG_TO_ptr_PTR(info, cfg) ((void **)CFG_TO_PTR(info, cfg))
/* 32bit unsigned long pointer */
#define ELEM_FLAG_U32_POS(offset) (((offset) & (~31)) / 8)
#define ELEM_FLAG_BIT_POS(offset) ((offset) & 31)
#define CFG_TO_FLAG_PTR(info, cfg) ((rk_ul *)((rk_u8 *)cfg + ELEM_FLAG_U32_POS(info->flag_offset)))
#define CFG_SET_FLAG(info, cfg) \
*CFG_TO_FLAG_PTR(info, cfg) |= 1ul << (ELEM_FLAG_BIT_POS(info->flag_offset))
static RK_U32 mpp_cfg_debug = 0;
const char *strof_cfg_type(CfgType type)
{
static const char *cfg_type_names[] = {
"RK_S32",
"RK_U32",
"RK_S64",
"RK_U64",
"struct",
"void *",
"unknown"
};
if (type < 0 || type >= CFG_FUNC_TYPE_BUTT)
type = CFG_FUNC_TYPE_BUTT;
return cfg_type_names[type];
}
static void show_cfg_info_err(MppCfgInfo *node, CfgType type, const char *func, const char *name)
static void show_cfg_entry_err(KmppEntry *node, ElemType type, const char *func, const char *name)
{
mpp_err("%s cfg %s expect %s input NOT %s\n", func, name,
strof_cfg_type(node->data_type), strof_cfg_type(type));
strof_elem_type(node->tbl.elem_type), strof_elem_type(type));
}
static MPP_RET mpp_cfg_set(MppCfgInfo *info, void *cfg, void *val)
{
if (memcmp((char *)cfg + info->data_offset, val, info->data_size)) {
memcpy((char *)cfg + info->data_offset, val, info->data_size);
CFG_SET_FLAG(info, cfg);
}
return MPP_OK;
}
static MPP_RET mpp_cfg_get(MppCfgInfo *info, void *cfg, void *val)
{
memcpy(val, (char *)cfg + info->data_offset, info->data_size);
return MPP_OK;
}
#define MPP_CFG_ACCESS(type, base_type) \
MPP_RET mpp_cfg_set_##type(MppCfgInfo *info, void *cfg, base_type val) \
{ \
base_type *dst = CFG_TO_##type##_PTR(info, cfg); \
base_type old = dst[0]; \
dst[0] = val; \
if (!info->flag_offset) { \
mpp_cfg_dbg_set("%p + %d set " #type " change %d -> %d\n", cfg, info->data_offset, old, val); \
} else { \
if (old != val) { \
mpp_cfg_dbg_set("%p + %d set " #type " update %d -> %d flag %d\n", \
cfg, info->data_offset, old, val, info->flag_offset); \
CFG_SET_FLAG(info, cfg); \
} else { \
mpp_cfg_dbg_set("%p + %d set " #type " keep %d\n", cfg, info->data_offset, old); \
} \
} \
return MPP_OK; \
} \
MPP_RET mpp_cfg_get_##type(MppCfgInfo *info, void *cfg, base_type *val) \
{ \
if (info && info->data_size) { \
base_type *src = CFG_TO_##type##_PTR(info, cfg); \
mpp_cfg_dbg_set("%p + %d get " #type " value %d\n", cfg, info->data_offset, src[0]); \
val[0] = src[0]; \
return MPP_OK; \
} \
return MPP_NOK; \
}
MPP_CFG_ACCESS(s32, RK_S32)
MPP_CFG_ACCESS(u32, RK_U32)
MPP_CFG_ACCESS(s64, RK_S64)
MPP_CFG_ACCESS(u64, RK_U64)
MPP_CFG_ACCESS(ptr, void *)
MPP_RET mpp_cfg_set_st(MppCfgInfo *info, void *cfg, void *val)
{
return mpp_cfg_set(info, cfg, val);
}
MPP_RET mpp_cfg_get_st(MppCfgInfo *info, void *cfg, void *val)
{
return mpp_cfg_get(info, cfg, val);
}
MPP_RET check_cfg_info(MppCfgInfo *node, const char *name, CfgType type,
const char *func)
MPP_RET check_cfg_entry(KmppEntry *node, const char *name, ElemType type,
const char *func)
{
if (NULL == node) {
mpp_err("%s: cfg %s is invalid\n", func, name);
return MPP_NOK;
}
CfgType cfg_type = (CfgType)node->data_type;
RK_S32 cfg_size = node->data_size;
ElemType cfg_type = (ElemType)node->tbl.elem_type;
RK_S32 cfg_size = node->tbl.elem_size;
MPP_RET ret = MPP_OK;
switch (type) {
case CFG_FUNC_TYPE_st : {
case ELEM_TYPE_st : {
if (cfg_type != type) {
show_cfg_info_err(node, type, func, name);
show_cfg_entry_err(node, type, func, name);
ret = MPP_NOK;
}
if (cfg_size <= 0) {
@ -144,23 +50,23 @@ MPP_RET check_cfg_info(MppCfgInfo *node, const char *name, CfgType type,
ret = MPP_NOK;
}
} break;
case CFG_FUNC_TYPE_ptr : {
case ELEM_TYPE_ptr : {
if (cfg_type != type) {
show_cfg_info_err(node, type, func, name);
show_cfg_entry_err(node, type, func, name);
ret = MPP_NOK;
}
} break;
case CFG_FUNC_TYPE_s32 :
case CFG_FUNC_TYPE_u32 : {
case ELEM_TYPE_s32 :
case ELEM_TYPE_u32 : {
if (cfg_size != sizeof(RK_S32)) {
show_cfg_info_err(node, type, func, name);
show_cfg_entry_err(node, type, func, name);
ret = MPP_NOK;
}
} break;
case CFG_FUNC_TYPE_s64 :
case CFG_FUNC_TYPE_u64 : {
case ELEM_TYPE_s64 :
case ELEM_TYPE_u64 : {
if (cfg_size != sizeof(RK_S64)) {
show_cfg_info_err(node, type, func, name);
show_cfg_entry_err(node, type, func, name);
ret = MPP_NOK;
}
} break;

View file

@ -20,6 +20,7 @@
#include "mpp_cfg.h"
#include "mpp_cfg_io.h"
#include "rk_venc_cfg.h"
#include "kmpp_obj.h"
#define MAX_CFG_DEPTH (64)
@ -77,9 +78,9 @@ struct MppCfgIoImpl_t {
rk_s32 name_len;
rk_s32 name_buf_len;
/* location info for structure access */
/* location entry for structure access */
MppTrie trie;
MppCfgInfo info;
KmppEntry entry;
union {
/* MPP_CFG_TYPE_STRING */
@ -262,7 +263,7 @@ rk_s32 mpp_cfg_get_object(MppCfgObj *obj, const char *name, MppCfgType type, Mpp
impl->val = *val;
impl->buf_size = buf_size;
/* set invalid data type by default */
impl->info.data_type = CFG_FUNC_TYPE_BUTT;
impl->entry.tbl.elem_type = ELEM_TYPE_BUTT;
if (type == MPP_CFG_TYPE_STRING)
impl->val.str = impl->string;
@ -316,7 +317,7 @@ rk_s32 mpp_cfg_get_array(MppCfgObj *obj, const char *name, rk_s32 count)
impl->type = MPP_CFG_TYPE_ARRAY;
impl->buf_size = buf_size;
/* set invalid data type by default */
impl->info.data_type = CFG_FUNC_TYPE_BUTT;
impl->entry.tbl.elem_type = ELEM_TYPE_BUTT;
if (count) {
impl->elems = (MppCfgIoImpl **)((char *)(impl + 1) + name_buf_len);
@ -544,36 +545,36 @@ rk_s32 mpp_cfg_find(MppCfgObj *obj, MppCfgObj root, char *name, rk_s32 type)
return rk_ok;
}
rk_s32 mpp_cfg_set_info(MppCfgObj obj, MppCfgInfo *info)
rk_s32 mpp_cfg_set_entry(MppCfgObj obj, KmppEntry *entry)
{
MppCfgIoImpl *impl = (MppCfgIoImpl *)obj;
if (impl && info) {
cfg_io_dbg_info("obj %-16s set info type %s offset %d size %d\n",
impl->name, strof_cfg_type(info->data_type),
info->data_offset, info->data_size);
if (impl && entry) {
cfg_io_dbg_info("obj %-16s set entry type %s offset %d size %d\n",
impl->name, strof_elem_type(entry->tbl.elem_type),
entry->tbl.elem_offset, entry->tbl.elem_size);
if (info->data_type < CFG_FUNC_TYPE_BUTT) {
memcpy(&impl->info, info, sizeof(impl->info));
if (entry->tbl.elem_type < ELEM_TYPE_BUTT) {
memcpy(&impl->entry, entry, sizeof(impl->entry));
switch (info->data_type) {
case CFG_FUNC_TYPE_s32 : {
switch (entry->tbl.elem_type) {
case ELEM_TYPE_s32 : {
impl->type = MPP_CFG_TYPE_s32;
} break;
case CFG_FUNC_TYPE_u32 : {
case ELEM_TYPE_u32 : {
impl->type = MPP_CFG_TYPE_u32;
} break;
case CFG_FUNC_TYPE_s64 : {
case ELEM_TYPE_s64 : {
impl->type = MPP_CFG_TYPE_s64;
} break;
case CFG_FUNC_TYPE_u64 : {
case ELEM_TYPE_u64 : {
impl->type = MPP_CFG_TYPE_u64;
} break;
default : {
} break;
}
} else {
impl->info.data_type = CFG_FUNC_TYPE_BUTT;
impl->entry.tbl.elem_type = ELEM_TYPE_BUTT;
}
return rk_ok;
@ -600,11 +601,11 @@ typedef struct MppCfgFullNameCtx_t {
static void add_obj_info(MppCfgIoImpl *impl, void *data)
{
/* NOTE: skip the root object and the invalid object */
if (impl->info.data_type < CFG_FUNC_TYPE_BUTT && impl->parent) {
if (impl->entry.tbl.elem_type < ELEM_TYPE_BUTT && impl->parent) {
MppCfgFullNameCtx *ctx = (MppCfgFullNameCtx *)data;
get_full_name(impl, ctx->buf, ctx->buf_size);
mpp_trie_add_info(ctx->trie, ctx->buf, &impl->info, sizeof(impl->info));
mpp_trie_add_info(ctx->trie, ctx->buf, &impl->entry, sizeof(impl->entry));
}
}
@ -3056,7 +3057,7 @@ rk_s32 mpp_cfg_from_string(MppCfgObj *obj, MppCfgStrFmt fmt, const char *buf)
static void write_struct(MppCfgIoImpl *obj, MppTrie trie, MppCfgStrBuf *str, void *st)
{
MppCfgInfo *tbl = NULL;
KmppEntry *tbl = NULL;
if (obj->name) {
MppTrieInfo *info = NULL;
@ -3070,25 +3071,25 @@ static void write_struct(MppCfgIoImpl *obj, MppTrie trie, MppCfgStrBuf *str, voi
}
if (!tbl)
tbl = &obj->info;
tbl = &obj->entry;
cfg_io_dbg_show("depth %d obj type %s name %s -> info %s offset %d size %d\n",
obj->depth, strof_type(obj->type), obj->name ? str->buf : "null",
strof_cfg_type(tbl->data_type), tbl->data_offset, tbl->data_size);
strof_elem_type(tbl->tbl.elem_type), tbl->tbl.elem_offset, tbl->tbl.elem_size);
if (tbl->data_type < CFG_FUNC_TYPE_BUTT) {
switch (tbl->data_type) {
case CFG_FUNC_TYPE_s32 : {
mpp_cfg_set_s32(tbl, st, obj->val.s32);
if (tbl->tbl.elem_type < ELEM_TYPE_BUTT) {
switch (tbl->tbl.elem_type) {
case ELEM_TYPE_s32 : {
kmpp_obj_impl_set_s32(tbl, st, obj->val.s32);
} break;
case CFG_FUNC_TYPE_u32 : {
mpp_cfg_set_u32(tbl, st, obj->val.u32);
case ELEM_TYPE_u32 : {
kmpp_obj_impl_set_u32(tbl, st, obj->val.u32);
} break;
case CFG_FUNC_TYPE_s64 : {
mpp_cfg_set_s64(tbl, st, obj->val.s64);
case ELEM_TYPE_s64 : {
kmpp_obj_impl_set_s64(tbl, st, obj->val.s64);
} break;
case CFG_FUNC_TYPE_u64 : {
mpp_cfg_set_u64(tbl, st, obj->val.u64);
case ELEM_TYPE_u64 : {
kmpp_obj_impl_set_u64(tbl, st, obj->val.u64);
} break;
default : {
} break;
@ -3126,14 +3127,14 @@ rk_s32 mpp_cfg_to_struct(MppCfgObj obj, MppCfgObj type, void *st)
str.offset = 0;
str.depth = 0;
write_struct(impl, trie, &str, st + orig->info.data_offset);
write_struct(impl, trie, &str, st + orig->entry.tbl.elem_offset);
return rk_ok;
}
static MppCfgObj read_struct(MppCfgIoImpl *impl, MppCfgObj parent, void *st)
{
MppCfgInfo *info = &impl->info;
KmppEntry *entry = &impl->entry;
MppCfgIoImpl *ret = NULL;
/* dup node first */
@ -3157,34 +3158,34 @@ static MppCfgObj read_struct(MppCfgIoImpl *impl, MppCfgObj parent, void *st)
}
/* assign value by different type */
switch (info->data_type) {
case CFG_FUNC_TYPE_s32 :
case CFG_FUNC_TYPE_u32 :
case CFG_FUNC_TYPE_s64 :
case CFG_FUNC_TYPE_u64 : {
switch (info->data_type) {
case CFG_FUNC_TYPE_s32 : {
switch (entry->tbl.elem_type) {
case ELEM_TYPE_s32 :
case ELEM_TYPE_u32 :
case ELEM_TYPE_s64 :
case ELEM_TYPE_u64 : {
switch (entry->tbl.elem_type) {
case ELEM_TYPE_s32 : {
mpp_assert(impl->type == MPP_CFG_TYPE_s32);
mpp_cfg_get_s32(info, st, &ret->val.s32);
kmpp_obj_impl_get_s32(entry, st, &ret->val.s32);
} break;
case CFG_FUNC_TYPE_u32 : {
case ELEM_TYPE_u32 : {
mpp_assert(impl->type == MPP_CFG_TYPE_u32);
mpp_cfg_get_u32(info, st, &ret->val.u32);
kmpp_obj_impl_get_u32(entry, st, &ret->val.u32);
} break;
case CFG_FUNC_TYPE_s64 : {
case ELEM_TYPE_s64 : {
mpp_assert(impl->type == MPP_CFG_TYPE_s64);
mpp_cfg_get_s64(info, st, &ret->val.s64);
kmpp_obj_impl_get_s64(entry, st, &ret->val.s64);
} break;
case CFG_FUNC_TYPE_u64 : {
case ELEM_TYPE_u64 : {
mpp_assert(impl->type == MPP_CFG_TYPE_u64);
mpp_cfg_get_u64(info, st, &ret->val.u64);
kmpp_obj_impl_get_u64(entry, st, &ret->val.u64);
} break;
default : {
} break;
}
} break;
case CFG_FUNC_TYPE_st :
case CFG_FUNC_TYPE_ptr : {
case ELEM_TYPE_st :
case ELEM_TYPE_ptr : {
ret->val = impl->val;
} break;
default : {
@ -3218,7 +3219,7 @@ rk_s32 mpp_cfg_from_struct(MppCfgObj *obj, MppCfgObj type, void *st)
}
/* NOTE: update structure pointer by data_offset */
*obj = read_struct(orig, NULL, st + orig->info.data_offset);
*obj = read_struct(orig, NULL, st + orig->entry.tbl.elem_offset);
return *obj ? rk_ok : rk_nok;
}

View file

@ -25,6 +25,8 @@
#include "mpp_mem_pool.h"
#include "mpp_compat_impl.h"
#include "kmpp_obj.h"
#define SYS_CFG_DBG_FUNC (0x00000001)
#define SYS_CFG_DBG_INFO (0x00000002)
#define SYS_CFG_DBG_SET (0x00000004)
@ -63,11 +65,11 @@ static RK_U32 mpp_sys_cfg_debug = 0;
#define EXPAND_AS_TRIE(base, name, cfg_type, in_type, flag, field_change, field_data) \
do { \
MppCfgInfo tmp = { \
CFG_FUNC_TYPE_##cfg_type, \
(RK_U32)((long)&(((MppSysCfgSet *)0)->field_change.change)), \
(RK_U32)((long)&(((MppSysCfgSet *)0)->field_change.field_data)), \
sizeof((((MppSysCfgSet *)0)->field_change.field_data)), \
KmppEntry tmp = { \
.tbl.elem_type = ELEM_TYPE_##cfg_type, \
.tbl.flag_offset = (RK_U32)flag, \
.tbl.elem_offset = (RK_U32)((long)&(((MppSysCfgSet *)0)->field_change.field_data)), \
.tbl.elem_size = sizeof((((MppSysCfgSet *)0)->field_change.field_data)), \
}; \
mpp_trie_add_info(srv->trie, #base":"#name, &tmp, sizeof(tmp)); \
} while (0);
@ -633,7 +635,7 @@ MPP_RET mpp_sys_cfg_ioctl(MppSysCfg cfg)
MppSysCfgSrv *srv = get_srv_sys_cfg_f(); \
MppSysCfgSet *p; \
MppTrieInfo *node; \
MppCfgInfo *info; \
KmppEntry *entry; \
if (!srv) \
return MPP_NOK; \
if (!cfg || !name) { \
@ -642,17 +644,17 @@ MPP_RET mpp_sys_cfg_ioctl(MppSysCfg cfg)
} \
p = (MppSysCfgSet *)cfg; \
node = mpp_trie_get_info(srv->trie, name); \
info = (MppCfgInfo *)mpp_trie_info_ctx(node); \
if (CHECK_CFG_INFO(info, name, CFG_FUNC_TYPE_##cfg_type)) { \
entry = (KmppEntry *)mpp_trie_info_ctx(node); \
if (CHECK_CFG_ENTRY(entry, name, ELEM_TYPE_##cfg_type)) { \
return MPP_NOK; \
} \
if (!info->flag_offset) { \
if (!entry->tbl.flag_offset) { \
mpp_log_f("can not set readonly cfg %s\n", mpp_trie_info_name(node)); \
return MPP_NOK; \
} \
sys_cfg_dbg_set("name %s type %s\n", mpp_trie_info_name(node), \
strof_cfg_type(info->data_type)); \
MPP_RET ret = MPP_CFG_SET_##cfg_type(info, p, val); \
strof_elem_type(entry->tbl.elem_type)); \
MPP_RET ret = MPP_CFG_SET_##cfg_type(entry, p, val); \
return ret; \
}
@ -669,7 +671,7 @@ MPP_CFG_SET_ACCESS(mpp_sys_cfg_set_st, void *, st);
MppSysCfgSrv *srv = get_srv_sys_cfg_f(); \
MppSysCfgSet *p; \
MppTrieInfo *node; \
MppCfgInfo *info; \
KmppEntry *entry; \
if (!srv) \
return MPP_NOK; \
if (!cfg || !name) { \
@ -678,13 +680,13 @@ MPP_CFG_SET_ACCESS(mpp_sys_cfg_set_st, void *, st);
} \
p = (MppSysCfgSet *)cfg; \
node = mpp_trie_get_info(srv->trie, name); \
info = (MppCfgInfo *)mpp_trie_info_ctx(node); \
if (CHECK_CFG_INFO(info, name, CFG_FUNC_TYPE_##cfg_type)) { \
entry = (KmppEntry *)mpp_trie_info_ctx(node); \
if (CHECK_CFG_ENTRY(entry, name, ELEM_TYPE_##cfg_type)) { \
return MPP_NOK; \
} \
sys_cfg_dbg_set("name %s type %s\n", mpp_trie_info_name(node), \
strof_cfg_type(info->data_type)); \
MPP_RET ret = MPP_CFG_GET_##cfg_type(info, p, val); \
strof_elem_type(entry->tbl.elem_type)); \
MPP_RET ret = MPP_CFG_GET_##cfg_type(entry, p, val); \
return ret; \
}
@ -717,11 +719,11 @@ void mpp_sys_cfg_show(void)
if (mpp_trie_info_is_self(node))
continue;
if (node->ctx_len == sizeof(MppCfgInfo)) {
MppCfgInfo *info = (MppCfgInfo *)mpp_trie_info_ctx(node);
if (node->ctx_len == sizeof(KmppEntry)) {
KmppEntry *entry = (KmppEntry *)mpp_trie_info_ctx(node);
mpp_log("%-*s type %s - %d:%d\n", len, mpp_trie_info_name(node),
strof_cfg_type(info->data_type), info->data_offset, info->data_size);
strof_elem_type(entry->tbl.elem_type), entry->tbl.elem_offset, entry->tbl.elem_size);
} else {
mpp_log("%-*s size - %d\n", len, mpp_trie_info_name(node), node->ctx_len);
}

View file

@ -7,6 +7,7 @@
#define MPP_CFG_H
#include "mpp_internal.h"
#include "kmpp_obj_impl.h"
/* header size 128 byte */
typedef struct MppCfgInfoHead_t {
@ -20,39 +21,24 @@ typedef struct MppCfgInfoHead_t {
extern "C" {
#endif
MPP_RET mpp_cfg_set_s32(MppCfgInfo *info, void *cfg, RK_S32 val);
MPP_RET mpp_cfg_get_s32(MppCfgInfo *info, void *cfg, RK_S32 *val);
MPP_RET mpp_cfg_set_u32(MppCfgInfo *info, void *cfg, RK_U32 val);
MPP_RET mpp_cfg_get_u32(MppCfgInfo *info, void *cfg, RK_U32 *val);
MPP_RET mpp_cfg_set_s64(MppCfgInfo *info, void *cfg, RK_S64 val);
MPP_RET mpp_cfg_get_s64(MppCfgInfo *info, void *cfg, RK_S64 *val);
MPP_RET mpp_cfg_set_u64(MppCfgInfo *info, void *cfg, RK_U64 val);
MPP_RET mpp_cfg_get_u64(MppCfgInfo *info, void *cfg, RK_U64 *val);
MPP_RET mpp_cfg_set_st(MppCfgInfo *info, void *cfg, void *val);
MPP_RET mpp_cfg_get_st(MppCfgInfo *info, void *cfg, void *val);
MPP_RET mpp_cfg_set_ptr(MppCfgInfo *info, void *cfg, void *val);
MPP_RET mpp_cfg_get_ptr(MppCfgInfo *info, void *cfg, void **val);
#define MPP_CFG_SET_s32(entry, cfg, val) (kmpp_obj_impl_set_s32)(entry, cfg, val)
#define MPP_CFG_GET_s32(entry, cfg, val) (kmpp_obj_impl_get_s32)(entry, cfg, (RK_S32 *)(val))
#define MPP_CFG_SET_u32(entry, cfg, val) (kmpp_obj_impl_set_u32)(entry, cfg, val)
#define MPP_CFG_GET_u32(entry, cfg, val) (kmpp_obj_impl_get_u32)(entry, cfg, (RK_U32 *)(val))
#define MPP_CFG_SET_s64(entry, cfg, val) (kmpp_obj_impl_set_s64)(entry, cfg, val)
#define MPP_CFG_GET_s64(entry, cfg, val) (kmpp_obj_impl_get_s64)(entry, cfg, (RK_S64 *)(val))
#define MPP_CFG_SET_u64(entry, cfg, val) (kmpp_obj_impl_set_u64)(entry, cfg, val)
#define MPP_CFG_GET_u64(entry, cfg, val) (kmpp_obj_impl_get_u64)(entry, cfg, (RK_U64 *)(val))
#define MPP_CFG_SET_st(entry, cfg, val) (kmpp_obj_impl_set_st)(entry, cfg, val)
#define MPP_CFG_GET_st(entry, cfg, val) (kmpp_obj_impl_get_st)(entry, cfg, (void *)(val))
#define MPP_CFG_SET_ptr(entry, cfg, val) (kmpp_obj_impl_set_ptr)(entry, cfg, val)
#define MPP_CFG_GET_ptr(entry, cfg, val) (kmpp_obj_impl_get_ptr)(entry, cfg, (void **)(val))
#define MPP_CFG_SET_s32(info, cfg, val) (mpp_cfg_set_s32)(info, cfg, val)
#define MPP_CFG_GET_s32(info, cfg, val) (mpp_cfg_get_s32)(info, cfg, (RK_S32 *)(val))
#define MPP_CFG_SET_u32(info, cfg, val) (mpp_cfg_set_u32)(info, cfg, val)
#define MPP_CFG_GET_u32(info, cfg, val) (mpp_cfg_get_u32)(info, cfg, (RK_U32 *)(val))
#define MPP_CFG_SET_s64(info, cfg, val) (mpp_cfg_set_s64)(info, cfg, val)
#define MPP_CFG_GET_s64(info, cfg, val) (mpp_cfg_get_s64)(info, cfg, (RK_S64 *)(val))
#define MPP_CFG_SET_u64(info, cfg, val) (mpp_cfg_set_u64)(info, cfg, val)
#define MPP_CFG_GET_u64(info, cfg, val) (mpp_cfg_get_u64)(info, cfg, (RK_U64 *)(val))
#define MPP_CFG_SET_st(info, cfg, val) (mpp_cfg_set_st )(info, cfg, val)
#define MPP_CFG_GET_st(info, cfg, val) (mpp_cfg_get_st )(info, cfg, (void *)(val))
#define MPP_CFG_SET_ptr(info, cfg, val) (mpp_cfg_set_ptr)(info, cfg, val)
#define MPP_CFG_GET_ptr(info, cfg, val) (mpp_cfg_get_ptr)(info, cfg, (void **)(val))
#define CHECK_CFG_ENTRY(node, name, type) \
check_cfg_entry(node, name, type, __FUNCTION__)
const char *strof_cfg_type(CfgType type);
#define CHECK_CFG_INFO(node, name, type) \
check_cfg_info(node, name, type, __FUNCTION__)
MPP_RET check_cfg_info(MppCfgInfo *node, const char *name, CfgType type,
const char *func);
MPP_RET check_cfg_entry(KmppEntry *node, const char *name, ElemType type,
const char *func);
#ifdef __cplusplus
}

View file

@ -26,25 +26,6 @@ typedef void* KmppObjDef;
/* KmppObj - mpp kernel object for string name access and function access */
typedef void* KmppObj;
typedef enum CfgType_e {
CFG_FUNC_TYPE_s32,
CFG_FUNC_TYPE_u32,
CFG_FUNC_TYPE_s64,
CFG_FUNC_TYPE_u64,
CFG_FUNC_TYPE_st,
CFG_FUNC_TYPE_ptr,
CFG_FUNC_TYPE_BUTT,
} CfgType;
typedef struct MppCfgInfo_t {
CfgType data_type;
/* update flag info 32bit */
RK_U32 flag_offset;
/* data access info */
RK_U32 data_offset;
RK_S32 data_size;
} MppCfgInfo;
/*
* kernel - userspace transaction trie node ctx info (64 bit) definition
*