diff --git a/mpp/mpp_info.cpp b/mpp/mpp_info.cpp index 07243172..b21edfc6 100644 --- a/mpp/mpp_info.cpp +++ b/mpp/mpp_info.cpp @@ -48,32 +48,32 @@ static RK_CHIP_TYPE chip_version(void) { RK_CHIP_TYPE type = NONE; char *value = NULL; - RK_S32 ret = rk_get_env_str("ro.product.board", &value, NULL); + RK_S32 ret = mpp_get_env_str("ro.product.board", &value, NULL); if (0 == ret) { if (strstr(value, "rk29")) { - rk_log("rk29 board found in board property"); + mpp_log("rk29 board found in board property"); type = RK29; } else if (strstr(value, "rk30")) { - rk_log("rk30 board found in board property"); + mpp_log("rk30 board found in board property"); type = RK30; } } if (NONE == type) { - ret = rk_get_env_str("ro.board.platform", &value, NULL); + ret = mpp_get_env_str("ro.board.platform", &value, NULL); if (0 == ret) { if (strstr(value, "rk29")) { - rk_log("rk29 board found in platform property"); + mpp_log("rk29 board found in platform property"); type = RK29; } else if (strstr(value, "rk30")) { - rk_log("rk30 board found in platform property"); + mpp_log("rk30 board found in platform property"); type = RK30; } } } if (NONE == type) { - rk_log("can not found matched chip type"); + mpp_log("can not found matched chip type"); } return type; } @@ -92,7 +92,7 @@ mpp_info::mpp_info() void mpp_info::show_mpp_info() { - rk_log("%s\n", mpp_version_one_line); + mpp_log("%s\n", mpp_version_one_line); } RK_CHIP_TYPE get_chip_type() diff --git a/mpp/test/mpp_info_test.c b/mpp/test/mpp_info_test.c index 67b4bda3..8e875b6d 100644 --- a/mpp/test/mpp_info_test.c +++ b/mpp/test/mpp_info_test.c @@ -21,7 +21,7 @@ int main() { - rk_log("mpp revision is %d\n", get_mpp_revision()); + mpp_log("mpp revision is %d\n", get_mpp_revision()); return 0; } diff --git a/osal/inc/mpp_env.h b/osal/inc/mpp_env.h index 3f575b3e..a0f0d041 100644 --- a/osal/inc/mpp_env.h +++ b/osal/inc/mpp_env.h @@ -23,11 +23,11 @@ extern "C" { #endif -RK_S32 rk_get_env_u32(const char *name, RK_U32 *value, RK_U32 default_value); -RK_S32 rk_get_env_str(const char *name, char **value, char *default_value); +RK_S32 mpp_get_env_u32(const char *name, RK_U32 *value, RK_U32 default_value); +RK_S32 mpp_get_env_str(const char *name, char **value, char *default_value); -RK_S32 rk_set_env_u32(const char *name, RK_U32 value); -RK_S32 rk_set_env_str(const char *name, char *value); +RK_S32 mpp_set_env_u32(const char *name, RK_U32 value); +RK_S32 mpp_set_env_str(const char *name, char *value); #ifdef __cplusplus } diff --git a/osal/inc/mpp_list.h b/osal/inc/mpp_list.h index 2062f69f..5321e7ea 100644 --- a/osal/inc/mpp_list.h +++ b/osal/inc/mpp_list.h @@ -30,11 +30,11 @@ // desctructor of list node typedef void *(*node_destructor)(void *); -struct rk_list_node; -class rk_list { +struct mpp_list_node; +class mpp_list { public: - rk_list(node_destructor func); - ~rk_list(); + mpp_list(node_destructor func); + ~mpp_list(); // for FIFO or FILO implement // adding functions support simple structure like C struct or C++ class pointer, @@ -61,14 +61,14 @@ public: private: pthread_mutex_t mutex; node_destructor destroy; - struct rk_list_node *head; + struct mpp_list_node *head; RK_S32 count; static RK_U32 keys; static RK_U32 get_key(); - rk_list(); - rk_list(const rk_list &); - rk_list &operator=(const rk_list &); + mpp_list(); + mpp_list(const mpp_list &); + mpp_list &operator=(const mpp_list &); }; #endif diff --git a/osal/inc/mpp_log.h b/osal/inc/mpp_log.h index 2f2168ef..44feca7f 100644 --- a/osal/inc/mpp_log.h +++ b/osal/inc/mpp_log.h @@ -26,26 +26,26 @@ extern "C" { #endif -void rk_set_log_flag(RK_U32 flag); -RK_U32 rk_get_log_flag(); +void mpp_set_log_flag(RK_U32 flag); +RK_U32 mpp_get_log_flag(); -#define rk_log(fmt, ...) _rk_log(MODULE_TAG, fmt, ## __VA_ARGS__) -#define rk_err(fmt, ...) _rk_err(MODULE_TAG, fmt, ## __VA_ARGS__) +#define mpp_log(fmt, ...) _mpp_log(MODULE_TAG, fmt, ## __VA_ARGS__) +#define mpp_err(fmt, ...) _mpp_err(MODULE_TAG, fmt, ## __VA_ARGS__) -#define rk_dbg(debug, flag, fmt, ...) \ +#define mpp_dbg(debug, flag, fmt, ...) \ do { \ if (debug & flag) { \ - _rk_log(MODULE_TAG, fmt, ## __VA_ARGS__); \ + _mpp_log(MODULE_TAG, fmt, ## __VA_ARGS__); \ } \ } while(0) /* * Send the specified message to the log - * _rk_log : general log function, send log to stdout - * _rk_err : log function for error information, send log to stderr + * _mpp_log : general log function, send log to stdout + * _mpp_err : log function for error information, send log to stderr */ -void _rk_log(const char *tag, const char *fmt, ...); -void _rk_err(const char *tag, const char *fmt, ...); +void _mpp_log(const char *tag, const char *fmt, ...); +void _mpp_err(const char *tag, const char *fmt, ...); /* * debug flag usage: @@ -58,17 +58,17 @@ void _rk_err(const char *tag, const char *fmt, ...); */ /* * dynamic debug function - * rk_dbg_add_flag : add a new debug flag associated with module name - * rk_dbg_set_flag : set a existing debug flag associated with module name - * rk_dbg_show_flag : show all existing debug flags + * mpp_dbg_add_flag : add a new debug flag associated with module name + * mpp_dbg_set_flag : set a existing debug flag associated with module name + * mpp_dbg_show_flag : show all existing debug flags */ -//void rk_dbg(RK_U32 debug, RK_U32 flag, const char *tag, const char *fmt, ...); +//void mpp_dbg(RK_U32 debug, RK_U32 flag, const char *tag, const char *fmt, ...); /* * submodules suggest to use macro as below: * #define h264d_dbg(flag, const char *fmt, ...) \ - * rk_dbg(h264d_debug, flag, fmt, ## __VA_ARGS__) + * mpp_dbg(h264d_debug, flag, fmt, ## __VA_ARGS__) */ #ifdef __cplusplus diff --git a/osal/inc/mpp_malloc.h b/osal/inc/mpp_malloc.h index 85a6534e..4dcada08 100644 --- a/osal/inc/mpp_malloc.h +++ b/osal/inc/mpp_malloc.h @@ -21,21 +21,21 @@ #include "rk_type.h" -#define rk_malloc_tagged(type, count, tag) \ - (type*)rk_mpp_malloc(tag, sizeof(type) * (count)) +#define mpp_malloc_tagged(type, count, tag) \ + (type*)mpp_osal_malloc(tag, sizeof(type) * (count)) -#define rk_malloc(type, count) \ - (type*)rk_mpp_malloc(MODULE_TAG, sizeof(type) * (count)) +#define mpp_malloc(type, count) \ + (type*)mpp_osal_malloc(MODULE_TAG, sizeof(type) * (count)) -#define rk_free(ptr) rk_mpp_free(ptr) +#define mpp_free(ptr) mpp_osal_free(ptr) #ifdef __cplusplus extern "C" { #endif -void rk_mpp_show_mem_status(); -void *rk_mpp_malloc(char *tag, size_t size); -void rk_mpp_free(void *ptr); +void mpp_show_mem_status(); +void *mpp_osal_malloc(char *tag, size_t size); +void mpp_osal_free(void *ptr); #ifdef __cplusplus } diff --git a/osal/inc/mpp_thread.h b/osal/inc/mpp_thread.h index 74c3c56a..4271f6a7 100644 --- a/osal/inc/mpp_thread.h +++ b/osal/inc/mpp_thread.h @@ -15,7 +15,7 @@ */ /* - * File : rk_thread.h + * File : mpp_thread.h * Description : thread library for different OS * Author : herman.chen@rock-chips.com * Date : 9:47 2015/7/27 diff --git a/osal/mpp_env.cpp b/osal/mpp_env.cpp index 46874619..9aaa1ef4 100644 --- a/osal/mpp_env.cpp +++ b/osal/mpp_env.cpp @@ -19,22 +19,22 @@ // TODO: add previous value compare to save call times -RK_S32 rk_get_env_u32(const char *name, RK_U32 *value, RK_U32 default_value) +RK_S32 mpp_get_env_u32(const char *name, RK_U32 *value, RK_U32 default_value) { return os_get_env_u32(name, value, default_value); } -RK_S32 rk_get_env_str(const char *name, char **value, char *default_value) +RK_S32 mpp_get_env_str(const char *name, char **value, char *default_value) { return os_get_env_str(name, value, default_value); } -RK_S32 rk_set_env_u32(const char *name, RK_U32 value) +RK_S32 mpp_set_env_u32(const char *name, RK_U32 value) { return os_set_env_u32(name, value); } -RK_S32 rk_set_env_str(const char *name, char *value) +RK_S32 mpp_set_env_str(const char *name, char *value) { return os_set_env_str(name, value); } diff --git a/osal/mpp_list.cpp b/osal/mpp_list.cpp index 16fc3a4a..9381629e 100644 --- a/osal/mpp_list.cpp +++ b/osal/mpp_list.cpp @@ -14,7 +14,8 @@ * limitations under the License. */ -#define MODULE_TAG "rk_list" +#define MODULE_TAG "mpp_list" + #include #include #include @@ -24,33 +25,33 @@ #include "mpp_list.h" -#define LIST_DEBUG(fmt, ...) rk_log(fmt, ## __VA_ARGS__) -#define LIST_ERROR(fmt, ...) rk_err(fmt, ## __VA_ARGS__) +#define LIST_DEBUG(fmt, ...) mpp_log(fmt, ## __VA_ARGS__) +#define LIST_ERROR(fmt, ...) mpp_err(fmt, ## __VA_ARGS__) -RK_U32 rk_list::keys = 0; +RK_U32 mpp_list::keys = 0; -typedef struct rk_list_node { - rk_list_node* prev; - rk_list_node* next; +typedef struct mpp_list_node { + mpp_list_node* prev; + mpp_list_node* next; RK_U32 key; RK_S32 size; -} rk_list_node; +} mpp_list_node; -static inline void list_node_init(rk_list_node *node) +static inline void list_node_init(mpp_list_node *node) { node->prev = node->next = node; } -static inline void list_node_init_with_key_and_size(rk_list_node *node, RK_U32 key, RK_S32 size) +static inline void list_node_init_with_key_and_size(mpp_list_node *node, RK_U32 key, RK_S32 size) { list_node_init(node); node->key = key; node->size = size; } -static rk_list_node* create_list(void *data, RK_S32 size, RK_U32 key) +static mpp_list_node* create_list(void *data, RK_S32 size, RK_U32 key) { - rk_list_node *node = (rk_list_node*)malloc(sizeof(rk_list_node)+size); + mpp_list_node *node = (mpp_list_node*)malloc(sizeof(mpp_list_node)+size); if (node) { void *dst = (void*)(node + 1); list_node_init_with_key_and_size(node, key, size); @@ -61,7 +62,7 @@ static rk_list_node* create_list(void *data, RK_S32 size, RK_U32 key) return node; } -static inline void _rk_list_add(rk_list_node * _new, rk_list_node * prev, rk_list_node * next) +static inline void _mpp_list_add(mpp_list_node * _new, mpp_list_node * prev, mpp_list_node * next) { next->prev = _new; _new->next = next; @@ -69,24 +70,24 @@ static inline void _rk_list_add(rk_list_node * _new, rk_list_node * prev, rk_lis prev->next = _new; } -static inline void rk_list_add(rk_list_node *_new, rk_list_node *head) +static inline void mpp_list_add(mpp_list_node *_new, mpp_list_node *head) { - _rk_list_add(_new, head, head->next); + _mpp_list_add(_new, head, head->next); } -static inline void rk_list_add_tail(rk_list_node *_new, rk_list_node *head) +static inline void mpp_list_add_tail(mpp_list_node *_new, mpp_list_node *head) { - _rk_list_add(_new, head->prev, head); + _mpp_list_add(_new, head->prev, head); } -RK_S32 rk_list::add_at_head(void *data, RK_S32 size) +RK_S32 mpp_list::add_at_head(void *data, RK_S32 size) { RK_S32 ret = -EINVAL; pthread_mutex_lock(&mutex); if (head) { - rk_list_node *node = create_list(data, size, 0); + mpp_list_node *node = create_list(data, size, 0); if (node) { - rk_list_add(node, head); + mpp_list_add(node, head); count++; ret = 0; } else { @@ -97,14 +98,14 @@ RK_S32 rk_list::add_at_head(void *data, RK_S32 size) return ret; } -RK_S32 rk_list::add_at_tail(void *data, RK_S32 size) +RK_S32 mpp_list::add_at_tail(void *data, RK_S32 size) { RK_S32 ret = -EINVAL; pthread_mutex_lock(&mutex); if (head) { - rk_list_node *node = create_list(data, size, 0); + mpp_list_node *node = create_list(data, size, 0); if (node) { - rk_list_add_tail(node, head); + mpp_list_add_tail(node, head); count++; ret = 0; } else { @@ -115,7 +116,7 @@ RK_S32 rk_list::add_at_tail(void *data, RK_S32 size) return ret; } -static void release_list(rk_list_node*node, void *data, RK_S32 size) +static void release_list(mpp_list_node*node, void *data, RK_S32 size) { void *src = (void*)(node + 1); if (node->size == size) { @@ -128,30 +129,30 @@ static void release_list(rk_list_node*node, void *data, RK_S32 size) free(node); } -static inline void _rk_list_del(rk_list_node *prev, rk_list_node *next) +static inline void _mpp_list_del(mpp_list_node *prev, mpp_list_node *next) { next->prev = prev; prev->next = next; } -static inline void rk_list_del_init(rk_list_node *node) +static inline void mpp_list_del_init(mpp_list_node *node) { - _rk_list_del(node->prev, node->next); + _mpp_list_del(node->prev, node->next); list_node_init(node); } -static inline int list_is_last(const rk_list_node *list, const rk_list_node *head) +static inline int list_is_last(const mpp_list_node *list, const mpp_list_node *head) { return list->next == head; } -static inline void _list_del_node_no_lock(rk_list_node *node, void *data, RK_S32 size) +static inline void _list_del_node_no_lock(mpp_list_node *node, void *data, RK_S32 size) { - rk_list_del_init(node); + mpp_list_del_init(node); release_list(node, data, size); } -RK_S32 rk_list::del_at_head(void *data, RK_S32 size) +RK_S32 mpp_list::del_at_head(void *data, RK_S32 size) { RK_S32 ret = -EINVAL; pthread_mutex_lock(&mutex); @@ -164,7 +165,7 @@ RK_S32 rk_list::del_at_head(void *data, RK_S32 size) return ret; } -RK_S32 rk_list::del_at_tail(void *data, RK_S32 size) +RK_S32 mpp_list::del_at_tail(void *data, RK_S32 size) { RK_S32 ret = -EINVAL; pthread_mutex_lock(&mutex); @@ -178,7 +179,7 @@ RK_S32 rk_list::del_at_tail(void *data, RK_S32 size) return ret; } -RK_S32 rk_list::list_is_empty() +RK_S32 mpp_list::list_is_empty() { pthread_mutex_lock(&mutex); RK_S32 ret = (count == 0); @@ -186,7 +187,7 @@ RK_S32 rk_list::list_is_empty() return ret; } -RK_S32 rk_list::list_size() +RK_S32 mpp_list::list_size() { pthread_mutex_lock(&mutex); RK_S32 ret = count; @@ -194,16 +195,16 @@ RK_S32 rk_list::list_size() return ret; } -RK_S32 rk_list::add_by_key(void *data, RK_S32 size, RK_U32 *key) +RK_S32 mpp_list::add_by_key(void *data, RK_S32 size, RK_U32 *key) { RK_S32 ret = 0; pthread_mutex_lock(&mutex); if (head) { RK_U32 list_key = get_key(); *key = list_key; - rk_list_node *node = create_list(data, size, list_key); + mpp_list_node *node = create_list(data, size, list_key); if (node) { - rk_list_add_tail(node, head); + mpp_list_add_tail(node, head); count++; ret = 0; } else { @@ -214,12 +215,12 @@ RK_S32 rk_list::add_by_key(void *data, RK_S32 size, RK_U32 *key) return ret; } -RK_S32 rk_list::del_by_key(void *data, RK_S32 size, RK_U32 key) +RK_S32 mpp_list::del_by_key(void *data, RK_S32 size, RK_U32 key) { RK_S32 ret = 0; pthread_mutex_lock(&mutex); if (head && count) { - struct rk_list_node *tmp = head->next; + struct mpp_list_node *tmp = head->next; ret = -EINVAL; while (tmp->next != head) { if (tmp->key == key) { @@ -234,7 +235,7 @@ RK_S32 rk_list::del_by_key(void *data, RK_S32 size, RK_U32 key) } -RK_S32 rk_list::show_by_key(void *data, RK_U32 key) +RK_S32 mpp_list::show_by_key(void *data, RK_U32 key) { RK_S32 ret = -EINVAL; (void)data; @@ -242,13 +243,13 @@ RK_S32 rk_list::show_by_key(void *data, RK_U32 key) return ret; } -RK_S32 rk_list::flush() +RK_S32 mpp_list::flush() { pthread_mutex_lock(&mutex); if (head) { while (count) { - rk_list_node* node = head->next; - rk_list_del_init(node); + mpp_list_node* node = head->next; + mpp_list_del_init(node); if (destroy) { destroy((void*)(node + 1)); } @@ -260,12 +261,12 @@ RK_S32 rk_list::flush() return 0; } -RK_U32 rk_list::get_key() +RK_U32 mpp_list::get_key() { return keys++; } -rk_list::rk_list(node_destructor func) +mpp_list::mpp_list(node_destructor func) : destroy(NULL), head(NULL), count(0) @@ -276,7 +277,7 @@ rk_list::rk_list(node_destructor func) pthread_mutex_init(&mutex, &attr); pthread_mutexattr_destroy(&attr); destroy = func; - head = (rk_list_node*)malloc(sizeof(rk_list_node)); + head = (mpp_list_node*)malloc(sizeof(mpp_list_node)); if (NULL == head) { LIST_ERROR("failed to allocate list header"); } else { @@ -284,7 +285,7 @@ rk_list::rk_list(node_destructor func) } } -rk_list::~rk_list() +mpp_list::~mpp_list() { flush(); if (head) free(head); @@ -306,19 +307,19 @@ rk_list::~rk_list() volatile int err = 0; -static int rk_list_fifo_test(rk_list *list_0) +static int mpp_list_fifo_test(mpp_list *list_0) { int count; VPUMemLinear_t m; for (count = 0; count < COUNT_ADD; count++) { err |= VPUMallocLinear(&m, 100); if (err) { - printf("VPUMallocLinear in rk_list_fifo_test\n"); + printf("VPUMallocLinear in mpp_list_fifo_test\n"); break; } err |= list_0->add_at_head(&m, sizeof(m)); if (err) { - printf("add_at_head in rk_list_fifo_test\n"); + printf("add_at_head in mpp_list_fifo_test\n"); break; } } @@ -327,12 +328,12 @@ static int rk_list_fifo_test(rk_list *list_0) for (count = 0; count < COUNT_DEL; count++) { err |= list_0->del_at_tail(&m, sizeof(m)); if (err) { - printf("del_at_tail in rk_list_fifo_test\n"); + printf("del_at_tail in mpp_list_fifo_test\n"); break; } err |= VPUFreeLinear(&m); if (err) { - printf("VPUFreeLinear in rk_list_fifo_test\n"); + printf("VPUFreeLinear in mpp_list_fifo_test\n"); break; } } @@ -340,7 +341,7 @@ static int rk_list_fifo_test(rk_list *list_0) return err; } -static int rk_list_filo_test(rk_list *list_0) +static int mpp_list_filo_test(mpp_list *list_0) { int count; VPUMemLinear_t m; @@ -348,23 +349,23 @@ static int rk_list_filo_test(rk_list *list_0) if (count & 1) { err |= list_0->del_at_head(&m, sizeof(m)); if (err) { - printf("del_at_head in rk_list_filo_test\n"); + printf("del_at_head in mpp_list_filo_test\n"); break; } err |= VPUFreeLinear(&m); if (err) { - printf("VPUFreeLinear in rk_list_fifo_test\n"); + printf("VPUFreeLinear in mpp_list_fifo_test\n"); break; } } else { err |= VPUMallocLinear(&m, 100); if (err) { - printf("VPUMallocLinear in rk_list_filo_test\n"); + printf("VPUMallocLinear in mpp_list_filo_test\n"); break; } err |= list_0->add_at_head(&m, sizeof(m)); if (err) { - printf("add_at_head in rk_list_fifo_test\n"); + printf("add_at_head in mpp_list_fifo_test\n"); break; } } @@ -374,14 +375,14 @@ static int rk_list_filo_test(rk_list *list_0) } -void *rk_list_test_loop_0(void *pdata) +void *mpp_list_test_loop_0(void *pdata) { int i; - rk_list *list_0 = (rk_list *)pdata; + mpp_list *list_0 = (mpp_list *)pdata; - printf("rk_list test 0 loop start\n"); + printf("mpp_list test 0 loop start\n"); for (i = 0; i < LOOP_RK_LIST; i++) { - err |= rk_list_filo_test(list_0); + err |= mpp_list_filo_test(list_0); if (err) break; } @@ -393,27 +394,27 @@ void *rk_list_test_loop_0(void *pdata) return NULL; } -int rk_list_test_0() +int mpp_list_test_0() { int i, err = 0; - printf("rk_list test 0 FIFO start\n"); + printf("mpp_list test 0 FIFO start\n"); - rk_list *list_0 = new rk_list((node_destructor)VPUFreeLinear); + mpp_list *list_0 = new mpp_list((node_destructor)VPUFreeLinear); pthread_t mThread; pthread_attr_t attr; pthread_attr_init(&attr); pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE); - pthread_create(&mThread, &attr, rk_list_test_loop_0, (void*)list_0); + pthread_create(&mThread, &attr, mpp_list_test_loop_0, (void*)list_0); pthread_attr_destroy(&attr); for (i = 0; i < LOOP_RK_LIST; i++) { - err |= rk_list_fifo_test(list_0); + err |= mpp_list_fifo_test(list_0); if (err) break; } if (err) { - printf("main : found rk_list operation err %d\n", err); + printf("main : found mpp_list operation err %d\n", err); } else { printf("main : test done and found no err\n"); } @@ -421,7 +422,7 @@ int rk_list_test_0() void *dummy; pthread_join(mThread, &dummy); - printf("rk_list test 0 end size %d\n", list_0->list_size()); + printf("mpp_list test 0 end size %d\n", list_0->list_size()); delete list_0; return err; } @@ -430,7 +431,7 @@ int rk_list_test_0() typedef int (*RK_LIST_TEST_FUNC)(void); RK_LIST_TEST_FUNC test_func[TOTAL_RK_LIST_TEST_COUNT] = { - rk_list_test_0, + mpp_list_test_0, }; int main(int argc, char *argv[]) diff --git a/osal/mpp_log.cpp b/osal/mpp_log.cpp index 46c3968a..dd9bbfcd 100644 --- a/osal/mpp_log.cpp +++ b/osal/mpp_log.cpp @@ -14,7 +14,7 @@ * limitations under the License. */ -#define MODULE_TAG "rk_log" +#define MODULE_TAG "mpp_log" #include #include @@ -28,40 +28,40 @@ extern "C" { #endif static RK_U32 mpp_log_flag = 0; -static void (*rk_log_callback)(const char*, const char*, va_list) = os_log; -static void (*rk_err_callback)(const char*, const char*, va_list) = os_err; +static void (*mpp_log_callback)(const char*, const char*, va_list) = os_log; +static void (*mpp_err_callback)(const char*, const char*, va_list) = os_err; // TODO: add log timing information and switch flag -void _rk_log(const char *tag, const char *fmt, ...) +void _mpp_log(const char *tag, const char *fmt, ...) { va_list args; va_start(args, fmt); if (NULL == tag) tag = MODULE_TAG; - rk_log_callback(tag, fmt, args); + mpp_log_callback(tag, fmt, args); va_end(args); return ; } -void _rk_err(const char *tag, const char *fmt, ...) +void _mpp_err(const char *tag, const char *fmt, ...) { va_list args; va_start(args, fmt); if (NULL == tag) tag = MODULE_TAG; - rk_err_callback(tag, fmt, args); + mpp_err_callback(tag, fmt, args); va_end(args); return ; } -void rk_set_log_flag(RK_U32 flag) +void mpp_set_log_flag(RK_U32 flag) { mpp_log_flag = flag; return ; } -RK_U32 rk_get_log_flag() +RK_U32 mpp_get_log_flag() { return mpp_log_flag; } diff --git a/osal/mpp_malloc.cpp b/osal/mpp_malloc.cpp index 5a9a15e2..a2595121 100644 --- a/osal/mpp_malloc.cpp +++ b/osal/mpp_malloc.cpp @@ -14,7 +14,7 @@ * limitations under the License. */ -#define MODULE_TAG "rk_malloc" +#define MODULE_TAG "mpp_malloc" #include @@ -57,11 +57,11 @@ static void get_osal_mem_flag() if (osal_mem_flag < 0) { RK_U32 val; osal_mem_flag = 0; - rk_get_env_u32(CONFIG_OSAL_MEM_LIST, &val, 0); + mpp_get_env_u32(CONFIG_OSAL_MEM_LIST, &val, 0); if (val) { osal_mem_flag |= OSAL_MEM_LIST_EN; } - rk_get_env_u32(CONFIG_OSAL_MEM_STUFF, &val, 0); + mpp_get_env_u32(CONFIG_OSAL_MEM_STUFF, &val, 0); if (val) { osal_mem_flag |= OSAL_MEM_STUFF_EN; } @@ -69,7 +69,7 @@ static void get_osal_mem_flag() } } -void *rk_mpp_malloc(char *tag, size_t size) +void *mpp_osal_malloc(char *tag, size_t size) { void *ptr; get_osal_mem_flag(); @@ -89,7 +89,7 @@ void *rk_mpp_malloc(char *tag, size_t size) return NULL; } -void rk_mpp_free(void *ptr) +void mpp_osal_free(void *ptr) { if (NULL == ptr) return; @@ -114,7 +114,7 @@ void rk_mpp_free(void *ptr) * dump memory status * this function need MODULE_TAG statistic information */ -void rk_mpp_show_mem_status() +void mpp_show_mem_status() { // TODO: add memory dump implement } diff --git a/osal/test/mpp_env_test.c b/osal/test/mpp_env_test.c index af0ca1af..5fbb1a64 100644 --- a/osal/test/mpp_env_test.c +++ b/osal/test/mpp_env_test.c @@ -14,7 +14,7 @@ * limitations under the License. */ -#define MODULE_TAG "rk_env_test" +#define MODULE_TAG "mpp_env_test" #include "mpp_env.h" #include "mpp_log.h" @@ -27,20 +27,20 @@ int main() RK_U32 env_debug_u32 = 0x100; char *env_string_str = env_test_string; - rk_set_env_u32(env_debug, env_debug_u32); - rk_set_env_str(env_string, env_string_str); - rk_log("set env: %s to %u\n", env_debug, env_debug_u32); - rk_log("set env: %s to %s\n", env_string, env_string_str); + mpp_set_env_u32(env_debug, env_debug_u32); + mpp_set_env_str(env_string, env_string_str); + mpp_log("set env: %s to %u\n", env_debug, env_debug_u32); + mpp_log("set env: %s to %s\n", env_string, env_string_str); env_debug_u32 = 0; env_string_str = NULL; - rk_log("clear local value to zero\n"); + mpp_log("clear local value to zero\n"); - rk_get_env_u32(env_debug, &env_debug_u32, 0); - rk_get_env_str(env_string, &env_string_str, NULL); + mpp_get_env_u32(env_debug, &env_debug_u32, 0); + mpp_get_env_str(env_string, &env_string_str, NULL); - rk_log("get env: %s is %u\n", env_debug, env_debug_u32); - rk_log("get env: %s is %s\n", env_string, env_string_str); + mpp_log("get env: %s is %u\n", env_debug, env_debug_u32); + mpp_log("get env: %s is %s\n", env_string, env_string_str); return 0; } diff --git a/osal/test/mpp_log_test.c b/osal/test/mpp_log_test.c index 7a462460..be144e18 100644 --- a/osal/test/mpp_log_test.c +++ b/osal/test/mpp_log_test.c @@ -14,7 +14,7 @@ * limitations under the License. */ -#define MODULE_TAG "rk_log_test" +#define MODULE_TAG "mpp_log_test" #include "mpp_log.h" @@ -22,17 +22,17 @@ int main() { RK_U32 flag = 0xffff; - rk_err("mpp error log test start\n"); + mpp_err("mpp error log test start\n"); - rk_log("mpp log flag: %08x\n", rk_get_log_flag()); + mpp_log("mpp log flag: %08x\n", mpp_get_log_flag()); - rk_log("set flag to %08x\n", flag); + mpp_log("set flag to %08x\n", flag); - rk_set_log_flag(flag); + mpp_set_log_flag(flag); - rk_log("mpp log flag: %08x\n", rk_get_log_flag()); + mpp_log("mpp log flag: %08x\n", mpp_get_log_flag()); - rk_err("mpp error log test done\n"); + mpp_err("mpp error log test done\n"); return 0; } diff --git a/osal/test/mpp_malloc_test.c b/osal/test/mpp_malloc_test.c index 28c1b3a0..7591154b 100644 --- a/osal/test/mpp_malloc_test.c +++ b/osal/test/mpp_malloc_test.c @@ -14,7 +14,7 @@ * limitations under the License. */ -#define MODULE_TAG "rk_malloc_test" +#define MODULE_TAG "mpp_malloc_test" #include "mpp_log.h" #include "mpp_env.h" @@ -24,13 +24,13 @@ int main() { - rk_set_env_u32("osal_mem_list", 1); - void *tmp = rk_malloc(int, 100); + mpp_set_env_u32("osal_mem_list", 1); + void *tmp = mpp_malloc(int, 100); if (tmp) { - rk_log("malloc success\n"); - rk_free(tmp); + mpp_log("malloc success\n"); + mpp_free(tmp); } else { - rk_log("malloc failed\n"); + mpp_log("malloc failed\n"); } return 0; diff --git a/osal/test/mpp_thread_test.c b/osal/test/mpp_thread_test.c index ff99f598..c2f33ed1 100644 --- a/osal/test/mpp_thread_test.c +++ b/osal/test/mpp_thread_test.c @@ -15,7 +15,7 @@ * limitations under the License. */ -#define MODULE_TAG "rk_thread_test" +#define MODULE_TAG "mpp_thread_test" #include #include @@ -32,9 +32,9 @@ void *thread_test(void *pdata) { int idx = *((int*)pdata); - rk_log("thread %d is running\n", idx); + mpp_log("thread %d is running\n", idx); sleep(1); - rk_log("thread %d done\n", idx); + mpp_log("thread %d done\n", idx); return NULL; } @@ -44,7 +44,7 @@ int main() int pdata[MAX_THREAD_NUM]; pthread_t threads[MAX_THREAD_NUM]; - rk_log("vpu test start\n"); + mpp_log("vpu test start\n"); pthread_attr_t attr; pthread_attr_init(&attr); pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE); @@ -62,7 +62,7 @@ int main() pthread_join(threads[i], &dummy); } - rk_log("vpu test end\n"); + mpp_log("vpu test end\n"); return 0; }