diff --git a/kmpp/base/CMakeLists.txt b/kmpp/base/CMakeLists.txt index 70a880cb..a7c9a52f 100644 --- a/kmpp/base/CMakeLists.txt +++ b/kmpp/base/CMakeLists.txt @@ -4,6 +4,7 @@ # add kmpp basic components # ---------------------------------------------------------------------------- add_library(kmpp_base OBJECT + kmpp_ioc.c kmpp_obj.c kmpp_meta.c kmpp_frame.c diff --git a/kmpp/base/inc/kmpp_ioc.h b/kmpp/base/inc/kmpp_ioc.h new file mode 100644 index 00000000..841bc285 --- /dev/null +++ b/kmpp/base/inc/kmpp_ioc.h @@ -0,0 +1,27 @@ +/* SPDX-License-Identifier: Apache-2.0 OR MIT */ +/* + * Copyright (c) 2025 Rockchip Electronics Co., Ltd. + */ + +#ifndef __KMPP_IOC_H__ +#define __KMPP_IOC_H__ + +#include "rk_type.h" + +typedef void* KmppIoc; + +#define KMPP_IOC_ENTRY_TABLE(prefix, ENTRY, STRCT, EHOOK, SHOOK, ALIAS) \ + ENTRY(prefix, u32, rk_u32, def, FLAG_NONE, def) \ + ENTRY(prefix, u32, rk_u32, cmd, FLAG_NONE, cmd) \ + ENTRY(prefix, u32, rk_u32, flags, FLAG_NONE, flags) \ + ENTRY(prefix, u32, rk_u32, id, FLAG_NONE, id) \ + STRCT(prefix, shm, KmppShmPtr, ctx, FLAG_NONE, ctx) \ + STRCT(prefix, shm, KmppShmPtr, in, FLAG_NONE, in) \ + STRCT(prefix, shm, KmppShmPtr, out, FLAG_NONE, out) + +#define KMPP_OBJ_NAME kmpp_ioc +#define KMPP_OBJ_INTF_TYPE KmppIoc +#define KMPP_OBJ_ENTRY_TABLE KMPP_IOC_ENTRY_TABLE +#include "kmpp_obj_func.h" + +#endif /*__KMPP_IOC_H__*/ diff --git a/kmpp/base/kmpp_ioc.c b/kmpp/base/kmpp_ioc.c new file mode 100644 index 00000000..8a94bad7 --- /dev/null +++ b/kmpp/base/kmpp_ioc.c @@ -0,0 +1,38 @@ +/* SPDX-License-Identifier: Apache-2.0 OR MIT */ +/* + * Copyright (c) 2025 Rockchip Electronics Co., Ltd. + */ + +#include "kmpp_ioc.h" + +typedef struct KmppIocImpl_t { + /* object defintion index for ioctl functions */ + rk_u32 def; + /* object defintion ioctl command */ + rk_u32 cmd; + /* + * flags for: + * last in the batch / not last + * block / non-block + * return / non-return + * sync / async + * ack / non-ack + * direct call / timer call + */ + rk_u32 flags; + /* ioc object id for input and output queue match */ + rk_u32 id; + /* ioc context object */ + KmppShmPtr ctx; + /* input config object */ + KmppShmPtr in; + /* output return object */ + KmppShmPtr out; +} KmppIocImpl; + +#define KMPP_OBJ_NAME kmpp_ioc +#define KMPP_OBJ_INTF_TYPE KmppIoc +#define KMPP_OBJ_IMPL_TYPE KmppIocImpl +#define KMPP_OBJ_SGLN_ID MPP_SGLN_KMPP_IOC +#define KMPP_OBJ_ENTRY_TABLE KMPP_IOC_ENTRY_TABLE +#include "kmpp_obj_helper.h" diff --git a/osal/inc/mpp_singleton.h b/osal/inc/mpp_singleton.h index 6571b51f..a86b22e2 100644 --- a/osal/inc/mpp_singleton.h +++ b/osal/inc/mpp_singleton.h @@ -25,6 +25,7 @@ typedef enum MppSingletonId_e { MPP_SGLN_RUNTIME, /* kernel module (MUST before userspace module) */ MPP_SGLN_KOBJ, + MPP_SGLN_KMPP_IOC, MPP_SGLN_KMPP_BUF_GRP_CFG, MPP_SGLN_KMPP_BUF_GRP, MPP_SGLN_KMPP_BUF_CFG,