[mpp_device]: Add regs offset helper function

This helper function is for address register setup its offset.

When offset is less than 4M (20bit) the offset and buffer fd (10bit) can
be filled in 32bit word.

When offset is larger than 4M the full offset should be sent by ioctl
MPP_DEV_REG_OFFSET.

Change-Id: I5f59f3c941e41cf85fa2ab8895d2a177f4412e64
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
This commit is contained in:
Herman Chen
2020-12-04 11:04:14 +08:00
parent fe89da930f
commit 3be3d97054
2 changed files with 20 additions and 0 deletions

View File

@@ -21,6 +21,7 @@
#include "mpp_env.h"
#include "mpp_log.h"
#include "mpp_mem.h"
#include "mpp_common.h"
#include "mpp_device_debug.h"
#include "mpp_service_api.h"
@@ -152,3 +153,19 @@ MPP_RET mpp_dev_ioctl(MppDev ctx, RK_S32 cmd, void *param)
return ret;
}
MPP_RET mpp_dev_set_reg_offset(MppDev dev, RK_U32 *regs, RK_S32 index, RK_U32 offset)
{
if (offset < SZ_4M)
regs[index] += offset << 10;
else {
MppDevRegOffsetCfg trans_cfg;
trans_cfg.reg_idx = index;
trans_cfg.offset = offset;
mpp_dev_ioctl(dev, MPP_DEV_REG_OFFSET, &trans_cfg);
}
return MPP_OK;
}