fix[misc]: Fix compile on 32bit platform

Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
Change-Id: I5175ed62993116a58e879d434db6b1b94747f605
This commit is contained in:
Herman Chen
2024-12-05 09:15:03 +08:00
parent ae3ef50921
commit 1cbb6a2527
2 changed files with 9 additions and 15 deletions

View File

@@ -17,6 +17,8 @@
#ifndef __RK_TYPE_H__ #ifndef __RK_TYPE_H__
#define __RK_TYPE_H__ #define __RK_TYPE_H__
#include <stddef.h>
typedef unsigned char RK_U8; typedef unsigned char RK_U8;
typedef unsigned short RK_U16; typedef unsigned short RK_U16;
typedef unsigned int RK_U32; typedef unsigned int RK_U32;
@@ -71,16 +73,6 @@ typedef enum {
#define NULL 0L #define NULL 0L
#endif #endif
#ifndef _SIZE_T
#define _SIZE_T
typedef unsigned long size_t;
#endif
#ifndef _SSIZE_T
#define _SSIZE_T
typedef long ssize_t;
#endif
#define RK_RET RK_S32 #define RK_RET RK_S32
#define RK_NULL 0L #define RK_NULL 0L
#define RK_OK 0 #define RK_OK 0

View File

@@ -25,10 +25,12 @@
#define MPP_OBJ_DBG_SET (0x00000001) #define MPP_OBJ_DBG_SET (0x00000001)
#define MPP_OBJ_DBG_GET (0x00000002) #define MPP_OBJ_DBG_GET (0x00000002)
#define kmpp_obj_dbg(flag, fmt, ...) _mpp_dbg(kmpp_obj_debug, flag, fmt, ## __VA_ARGS__) #define kmpp_obj_dbg(flag, fmt, ...) _mpp_dbg(kmpp_obj_debug, flag, fmt, ## __VA_ARGS__)
#define kmpp_obj_dbg_set(fmt, ...) kmpp_obj_dbg(MPP_OBJ_DBG_SET, fmt, ## __VA_ARGS__) #define kmpp_obj_dbg_set(fmt, ...) kmpp_obj_dbg(MPP_OBJ_DBG_SET, fmt, ## __VA_ARGS__)
#define kmpp_obj_dbg_get(fmt, ...) kmpp_obj_dbg(MPP_OBJ_DBG_GET, fmt, ## __VA_ARGS__) #define kmpp_obj_dbg_get(fmt, ...) kmpp_obj_dbg(MPP_OBJ_DBG_GET, fmt, ## __VA_ARGS__)
#define U64_TO_PTR(ptr) ((void *)(intptr_t)(ptr))
#define ENTRY_TO_PTR(tbl, entry) ((char *)entry + tbl->data_offset) #define ENTRY_TO_PTR(tbl, entry) ((char *)entry + tbl->data_offset)
#define ENTRY_TO_s32_PTR(tbl, entry) ((rk_s32 *)ENTRY_TO_PTR(tbl, entry)) #define ENTRY_TO_s32_PTR(tbl, entry) ((rk_s32 *)ENTRY_TO_PTR(tbl, entry))
@@ -259,7 +261,7 @@ rk_s32 kmpp_objdef_init(KmppObjDef *def, const char *name)
goto DONE; goto DONE;
} }
root = (void *)s.trie_root; root = U64_TO_PTR(s.trie_root);
info = mpp_trie_get_info_from_root(root, "__size"); info = mpp_trie_get_info_from_root(root, "__size");
obj_size = info ? *(RK_S32 *)mpp_trie_info_ctx(info) : 0; obj_size = info ? *(RK_S32 *)mpp_trie_info_ctx(info) : 0;
@@ -428,7 +430,7 @@ rk_s32 kmpp_obj_get(KmppObj *obj, KmppObjDef def)
impl->trie = def_impl->trie; impl->trie = def_impl->trie;
impl->need_free = 1; impl->need_free = 1;
impl->shm = shm; impl->shm = shm;
impl->entry = (void *)shm->kobj_uaddr; impl->entry = U64_TO_PTR(shm->kobj_uaddr);
*obj = impl; *obj = impl;