[all]: rename function names

git-svn-id: https://10.10.10.66:8443/svn/MediaProcessPlatform/trunk/mpp@60 6e48237b-75ef-9749-8fc9-41990f28c85a
This commit is contained in:
ChenHengming
2015-08-07 09:14:00 +00:00
parent 1b5d44e56e
commit 848f7d93fe
15 changed files with 162 additions and 161 deletions

View File

@@ -48,32 +48,32 @@ static RK_CHIP_TYPE chip_version(void)
{ {
RK_CHIP_TYPE type = NONE; RK_CHIP_TYPE type = NONE;
char *value = NULL; 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 (0 == ret) {
if (strstr(value, "rk29")) { if (strstr(value, "rk29")) {
rk_log("rk29 board found in board property"); mpp_log("rk29 board found in board property");
type = RK29; type = RK29;
} else if (strstr(value, "rk30")) { } else if (strstr(value, "rk30")) {
rk_log("rk30 board found in board property"); mpp_log("rk30 board found in board property");
type = RK30; type = RK30;
} }
} }
if (NONE == type) { 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 (0 == ret) {
if (strstr(value, "rk29")) { if (strstr(value, "rk29")) {
rk_log("rk29 board found in platform property"); mpp_log("rk29 board found in platform property");
type = RK29; type = RK29;
} else if (strstr(value, "rk30")) { } else if (strstr(value, "rk30")) {
rk_log("rk30 board found in platform property"); mpp_log("rk30 board found in platform property");
type = RK30; type = RK30;
} }
} }
} }
if (NONE == type) { if (NONE == type) {
rk_log("can not found matched chip type"); mpp_log("can not found matched chip type");
} }
return type; return type;
} }
@@ -92,7 +92,7 @@ mpp_info::mpp_info()
void mpp_info::show_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() RK_CHIP_TYPE get_chip_type()

View File

@@ -21,7 +21,7 @@
int main() int main()
{ {
rk_log("mpp revision is %d\n", get_mpp_revision()); mpp_log("mpp revision is %d\n", get_mpp_revision());
return 0; return 0;
} }

View File

@@ -23,11 +23,11 @@
extern "C" { extern "C" {
#endif #endif
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);
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);
RK_S32 rk_set_env_u32(const char *name, RK_U32 value); RK_S32 mpp_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_str(const char *name, char *value);
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@@ -30,11 +30,11 @@
// desctructor of list node // desctructor of list node
typedef void *(*node_destructor)(void *); typedef void *(*node_destructor)(void *);
struct rk_list_node; struct mpp_list_node;
class rk_list { class mpp_list {
public: public:
rk_list(node_destructor func); mpp_list(node_destructor func);
~rk_list(); ~mpp_list();
// for FIFO or FILO implement // for FIFO or FILO implement
// adding functions support simple structure like C struct or C++ class pointer, // adding functions support simple structure like C struct or C++ class pointer,
@@ -61,14 +61,14 @@ public:
private: private:
pthread_mutex_t mutex; pthread_mutex_t mutex;
node_destructor destroy; node_destructor destroy;
struct rk_list_node *head; struct mpp_list_node *head;
RK_S32 count; RK_S32 count;
static RK_U32 keys; static RK_U32 keys;
static RK_U32 get_key(); static RK_U32 get_key();
rk_list(); mpp_list();
rk_list(const rk_list &); mpp_list(const mpp_list &);
rk_list &operator=(const rk_list &); mpp_list &operator=(const mpp_list &);
}; };
#endif #endif

View File

@@ -26,26 +26,26 @@
extern "C" { extern "C" {
#endif #endif
void rk_set_log_flag(RK_U32 flag); void mpp_set_log_flag(RK_U32 flag);
RK_U32 rk_get_log_flag(); RK_U32 mpp_get_log_flag();
#define rk_log(fmt, ...) _rk_log(MODULE_TAG, fmt, ## __VA_ARGS__) #define mpp_log(fmt, ...) _mpp_log(MODULE_TAG, fmt, ## __VA_ARGS__)
#define rk_err(fmt, ...) _rk_err(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 { \ do { \
if (debug & flag) { \ if (debug & flag) { \
_rk_log(MODULE_TAG, fmt, ## __VA_ARGS__); \ _mpp_log(MODULE_TAG, fmt, ## __VA_ARGS__); \
} \ } \
} while(0) } while(0)
/* /*
* Send the specified message to the log * Send the specified message to the log
* _rk_log : general log function, send log to stdout * _mpp_log : general log function, send log to stdout
* _rk_err : log function for error information, send log to stderr * _mpp_err : log function for error information, send log to stderr
*/ */
void _rk_log(const char *tag, const char *fmt, ...); void _mpp_log(const char *tag, const char *fmt, ...);
void _rk_err(const char *tag, const char *fmt, ...); void _mpp_err(const char *tag, const char *fmt, ...);
/* /*
* debug flag usage: * debug flag usage:
@@ -58,17 +58,17 @@ void _rk_err(const char *tag, const char *fmt, ...);
*/ */
/* /*
* dynamic debug function * dynamic debug function
* rk_dbg_add_flag : add a new debug flag associated with module name * mpp_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 * mpp_dbg_set_flag : set a existing debug flag associated with module name
* rk_dbg_show_flag : show all existing debug flags * 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: * submodules suggest to use macro as below:
* #define h264d_dbg(flag, const char *fmt, ...) \ * #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 #ifdef __cplusplus

View File

@@ -21,21 +21,21 @@
#include "rk_type.h" #include "rk_type.h"
#define rk_malloc_tagged(type, count, tag) \ #define mpp_malloc_tagged(type, count, tag) \
(type*)rk_mpp_malloc(tag, sizeof(type) * (count)) (type*)mpp_osal_malloc(tag, sizeof(type) * (count))
#define rk_malloc(type, count) \ #define mpp_malloc(type, count) \
(type*)rk_mpp_malloc(MODULE_TAG, sizeof(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 #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
void rk_mpp_show_mem_status(); void mpp_show_mem_status();
void *rk_mpp_malloc(char *tag, size_t size); void *mpp_osal_malloc(char *tag, size_t size);
void rk_mpp_free(void *ptr); void mpp_osal_free(void *ptr);
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@@ -15,7 +15,7 @@
*/ */
/* /*
* File : rk_thread.h * File : mpp_thread.h
* Description : thread library for different OS * Description : thread library for different OS
* Author : herman.chen@rock-chips.com * Author : herman.chen@rock-chips.com
* Date : 9:47 2015/7/27 * Date : 9:47 2015/7/27

View File

@@ -19,22 +19,22 @@
// TODO: add previous value compare to save call times // 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); 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); 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); 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); return os_set_env_str(name, value);
} }

View File

@@ -14,7 +14,8 @@
* limitations under the License. * limitations under the License.
*/ */
#define MODULE_TAG "rk_list" #define MODULE_TAG "mpp_list"
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <stdarg.h> #include <stdarg.h>
@@ -24,33 +25,33 @@
#include "mpp_list.h" #include "mpp_list.h"
#define LIST_DEBUG(fmt, ...) rk_log(fmt, ## __VA_ARGS__) #define LIST_DEBUG(fmt, ...) mpp_log(fmt, ## __VA_ARGS__)
#define LIST_ERROR(fmt, ...) rk_err(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 { typedef struct mpp_list_node {
rk_list_node* prev; mpp_list_node* prev;
rk_list_node* next; mpp_list_node* next;
RK_U32 key; RK_U32 key;
RK_S32 size; 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; 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); list_node_init(node);
node->key = key; node->key = key;
node->size = size; 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) { if (node) {
void *dst = (void*)(node + 1); void *dst = (void*)(node + 1);
list_node_init_with_key_and_size(node, key, size); 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; 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; next->prev = _new;
_new->next = next; _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; 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; RK_S32 ret = -EINVAL;
pthread_mutex_lock(&mutex); pthread_mutex_lock(&mutex);
if (head) { if (head) {
rk_list_node *node = create_list(data, size, 0); mpp_list_node *node = create_list(data, size, 0);
if (node) { if (node) {
rk_list_add(node, head); mpp_list_add(node, head);
count++; count++;
ret = 0; ret = 0;
} else { } else {
@@ -97,14 +98,14 @@ RK_S32 rk_list::add_at_head(void *data, RK_S32 size)
return ret; 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; RK_S32 ret = -EINVAL;
pthread_mutex_lock(&mutex); pthread_mutex_lock(&mutex);
if (head) { if (head) {
rk_list_node *node = create_list(data, size, 0); mpp_list_node *node = create_list(data, size, 0);
if (node) { if (node) {
rk_list_add_tail(node, head); mpp_list_add_tail(node, head);
count++; count++;
ret = 0; ret = 0;
} else { } else {
@@ -115,7 +116,7 @@ RK_S32 rk_list::add_at_tail(void *data, RK_S32 size)
return ret; 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); void *src = (void*)(node + 1);
if (node->size == size) { if (node->size == size) {
@@ -128,30 +129,30 @@ static void release_list(rk_list_node*node, void *data, RK_S32 size)
free(node); 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; next->prev = prev;
prev->next = next; 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); 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; 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); 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; RK_S32 ret = -EINVAL;
pthread_mutex_lock(&mutex); pthread_mutex_lock(&mutex);
@@ -164,7 +165,7 @@ RK_S32 rk_list::del_at_head(void *data, RK_S32 size)
return ret; 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; RK_S32 ret = -EINVAL;
pthread_mutex_lock(&mutex); pthread_mutex_lock(&mutex);
@@ -178,7 +179,7 @@ RK_S32 rk_list::del_at_tail(void *data, RK_S32 size)
return ret; return ret;
} }
RK_S32 rk_list::list_is_empty() RK_S32 mpp_list::list_is_empty()
{ {
pthread_mutex_lock(&mutex); pthread_mutex_lock(&mutex);
RK_S32 ret = (count == 0); RK_S32 ret = (count == 0);
@@ -186,7 +187,7 @@ RK_S32 rk_list::list_is_empty()
return ret; return ret;
} }
RK_S32 rk_list::list_size() RK_S32 mpp_list::list_size()
{ {
pthread_mutex_lock(&mutex); pthread_mutex_lock(&mutex);
RK_S32 ret = count; RK_S32 ret = count;
@@ -194,16 +195,16 @@ RK_S32 rk_list::list_size()
return ret; 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; RK_S32 ret = 0;
pthread_mutex_lock(&mutex); pthread_mutex_lock(&mutex);
if (head) { if (head) {
RK_U32 list_key = get_key(); RK_U32 list_key = get_key();
*key = list_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) { if (node) {
rk_list_add_tail(node, head); mpp_list_add_tail(node, head);
count++; count++;
ret = 0; ret = 0;
} else { } else {
@@ -214,12 +215,12 @@ RK_S32 rk_list::add_by_key(void *data, RK_S32 size, RK_U32 *key)
return ret; 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; RK_S32 ret = 0;
pthread_mutex_lock(&mutex); pthread_mutex_lock(&mutex);
if (head && count) { if (head && count) {
struct rk_list_node *tmp = head->next; struct mpp_list_node *tmp = head->next;
ret = -EINVAL; ret = -EINVAL;
while (tmp->next != head) { while (tmp->next != head) {
if (tmp->key == key) { 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; RK_S32 ret = -EINVAL;
(void)data; (void)data;
@@ -242,13 +243,13 @@ RK_S32 rk_list::show_by_key(void *data, RK_U32 key)
return ret; return ret;
} }
RK_S32 rk_list::flush() RK_S32 mpp_list::flush()
{ {
pthread_mutex_lock(&mutex); pthread_mutex_lock(&mutex);
if (head) { if (head) {
while (count) { while (count) {
rk_list_node* node = head->next; mpp_list_node* node = head->next;
rk_list_del_init(node); mpp_list_del_init(node);
if (destroy) { if (destroy) {
destroy((void*)(node + 1)); destroy((void*)(node + 1));
} }
@@ -260,12 +261,12 @@ RK_S32 rk_list::flush()
return 0; return 0;
} }
RK_U32 rk_list::get_key() RK_U32 mpp_list::get_key()
{ {
return keys++; return keys++;
} }
rk_list::rk_list(node_destructor func) mpp_list::mpp_list(node_destructor func)
: destroy(NULL), : destroy(NULL),
head(NULL), head(NULL),
count(0) count(0)
@@ -276,7 +277,7 @@ rk_list::rk_list(node_destructor func)
pthread_mutex_init(&mutex, &attr); pthread_mutex_init(&mutex, &attr);
pthread_mutexattr_destroy(&attr); pthread_mutexattr_destroy(&attr);
destroy = func; destroy = func;
head = (rk_list_node*)malloc(sizeof(rk_list_node)); head = (mpp_list_node*)malloc(sizeof(mpp_list_node));
if (NULL == head) { if (NULL == head) {
LIST_ERROR("failed to allocate list header"); LIST_ERROR("failed to allocate list header");
} else { } else {
@@ -284,7 +285,7 @@ rk_list::rk_list(node_destructor func)
} }
} }
rk_list::~rk_list() mpp_list::~mpp_list()
{ {
flush(); flush();
if (head) free(head); if (head) free(head);
@@ -306,19 +307,19 @@ rk_list::~rk_list()
volatile int err = 0; 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; int count;
VPUMemLinear_t m; VPUMemLinear_t m;
for (count = 0; count < COUNT_ADD; count++) { for (count = 0; count < COUNT_ADD; count++) {
err |= VPUMallocLinear(&m, 100); err |= VPUMallocLinear(&m, 100);
if (err) { if (err) {
printf("VPUMallocLinear in rk_list_fifo_test\n"); printf("VPUMallocLinear in mpp_list_fifo_test\n");
break; break;
} }
err |= list_0->add_at_head(&m, sizeof(m)); err |= list_0->add_at_head(&m, sizeof(m));
if (err) { if (err) {
printf("add_at_head in rk_list_fifo_test\n"); printf("add_at_head in mpp_list_fifo_test\n");
break; break;
} }
} }
@@ -327,12 +328,12 @@ static int rk_list_fifo_test(rk_list *list_0)
for (count = 0; count < COUNT_DEL; count++) { for (count = 0; count < COUNT_DEL; count++) {
err |= list_0->del_at_tail(&m, sizeof(m)); err |= list_0->del_at_tail(&m, sizeof(m));
if (err) { if (err) {
printf("del_at_tail in rk_list_fifo_test\n"); printf("del_at_tail in mpp_list_fifo_test\n");
break; break;
} }
err |= VPUFreeLinear(&m); err |= VPUFreeLinear(&m);
if (err) { if (err) {
printf("VPUFreeLinear in rk_list_fifo_test\n"); printf("VPUFreeLinear in mpp_list_fifo_test\n");
break; break;
} }
} }
@@ -340,7 +341,7 @@ static int rk_list_fifo_test(rk_list *list_0)
return err; return err;
} }
static int rk_list_filo_test(rk_list *list_0) static int mpp_list_filo_test(mpp_list *list_0)
{ {
int count; int count;
VPUMemLinear_t m; VPUMemLinear_t m;
@@ -348,23 +349,23 @@ static int rk_list_filo_test(rk_list *list_0)
if (count & 1) { if (count & 1) {
err |= list_0->del_at_head(&m, sizeof(m)); err |= list_0->del_at_head(&m, sizeof(m));
if (err) { if (err) {
printf("del_at_head in rk_list_filo_test\n"); printf("del_at_head in mpp_list_filo_test\n");
break; break;
} }
err |= VPUFreeLinear(&m); err |= VPUFreeLinear(&m);
if (err) { if (err) {
printf("VPUFreeLinear in rk_list_fifo_test\n"); printf("VPUFreeLinear in mpp_list_fifo_test\n");
break; break;
} }
} else { } else {
err |= VPUMallocLinear(&m, 100); err |= VPUMallocLinear(&m, 100);
if (err) { if (err) {
printf("VPUMallocLinear in rk_list_filo_test\n"); printf("VPUMallocLinear in mpp_list_filo_test\n");
break; break;
} }
err |= list_0->add_at_head(&m, sizeof(m)); err |= list_0->add_at_head(&m, sizeof(m));
if (err) { if (err) {
printf("add_at_head in rk_list_fifo_test\n"); printf("add_at_head in mpp_list_fifo_test\n");
break; 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; 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++) { 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; if (err) break;
} }
@@ -393,27 +394,27 @@ void *rk_list_test_loop_0(void *pdata)
return NULL; return NULL;
} }
int rk_list_test_0() int mpp_list_test_0()
{ {
int i, err = 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_t mThread;
pthread_attr_t attr; pthread_attr_t attr;
pthread_attr_init(&attr); pthread_attr_init(&attr);
pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE); 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); pthread_attr_destroy(&attr);
for (i = 0; i < LOOP_RK_LIST; i++) { 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) break;
} }
if (err) { if (err) {
printf("main : found rk_list operation err %d\n", err); printf("main : found mpp_list operation err %d\n", err);
} else { } else {
printf("main : test done and found no err\n"); printf("main : test done and found no err\n");
} }
@@ -421,7 +422,7 @@ int rk_list_test_0()
void *dummy; void *dummy;
pthread_join(mThread, &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; delete list_0;
return err; return err;
} }
@@ -430,7 +431,7 @@ int rk_list_test_0()
typedef int (*RK_LIST_TEST_FUNC)(void); typedef int (*RK_LIST_TEST_FUNC)(void);
RK_LIST_TEST_FUNC test_func[TOTAL_RK_LIST_TEST_COUNT] = { 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[]) int main(int argc, char *argv[])

View File

@@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
#define MODULE_TAG "rk_log" #define MODULE_TAG "mpp_log"
#include <stdio.h> #include <stdio.h>
#include <stdarg.h> #include <stdarg.h>
@@ -28,40 +28,40 @@ extern "C" {
#endif #endif
static RK_U32 mpp_log_flag = 0; static RK_U32 mpp_log_flag = 0;
static void (*rk_log_callback)(const char*, const char*, va_list) = os_log; static void (*mpp_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_err_callback)(const char*, const char*, va_list) = os_err;
// TODO: add log timing information and switch flag // 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_list args;
va_start(args, fmt); va_start(args, fmt);
if (NULL == tag) if (NULL == tag)
tag = MODULE_TAG; tag = MODULE_TAG;
rk_log_callback(tag, fmt, args); mpp_log_callback(tag, fmt, args);
va_end(args); va_end(args);
return ; return ;
} }
void _rk_err(const char *tag, const char *fmt, ...) void _mpp_err(const char *tag, const char *fmt, ...)
{ {
va_list args; va_list args;
va_start(args, fmt); va_start(args, fmt);
if (NULL == tag) if (NULL == tag)
tag = MODULE_TAG; tag = MODULE_TAG;
rk_err_callback(tag, fmt, args); mpp_err_callback(tag, fmt, args);
va_end(args); va_end(args);
return ; return ;
} }
void rk_set_log_flag(RK_U32 flag) void mpp_set_log_flag(RK_U32 flag)
{ {
mpp_log_flag = flag; mpp_log_flag = flag;
return ; return ;
} }
RK_U32 rk_get_log_flag() RK_U32 mpp_get_log_flag()
{ {
return mpp_log_flag; return mpp_log_flag;
} }

View File

@@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
#define MODULE_TAG "rk_malloc" #define MODULE_TAG "mpp_malloc"
#include <string.h> #include <string.h>
@@ -57,11 +57,11 @@ static void get_osal_mem_flag()
if (osal_mem_flag < 0) { if (osal_mem_flag < 0) {
RK_U32 val; RK_U32 val;
osal_mem_flag = 0; 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) { if (val) {
osal_mem_flag |= OSAL_MEM_LIST_EN; 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) { if (val) {
osal_mem_flag |= OSAL_MEM_STUFF_EN; 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; void *ptr;
get_osal_mem_flag(); get_osal_mem_flag();
@@ -89,7 +89,7 @@ void *rk_mpp_malloc(char *tag, size_t size)
return NULL; return NULL;
} }
void rk_mpp_free(void *ptr) void mpp_osal_free(void *ptr)
{ {
if (NULL == ptr) if (NULL == ptr)
return; return;
@@ -114,7 +114,7 @@ void rk_mpp_free(void *ptr)
* dump memory status * dump memory status
* this function need MODULE_TAG statistic information * this function need MODULE_TAG statistic information
*/ */
void rk_mpp_show_mem_status() void mpp_show_mem_status()
{ {
// TODO: add memory dump implement // TODO: add memory dump implement
} }

View File

@@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
#define MODULE_TAG "rk_env_test" #define MODULE_TAG "mpp_env_test"
#include "mpp_env.h" #include "mpp_env.h"
#include "mpp_log.h" #include "mpp_log.h"
@@ -27,20 +27,20 @@ int main()
RK_U32 env_debug_u32 = 0x100; RK_U32 env_debug_u32 = 0x100;
char *env_string_str = env_test_string; char *env_string_str = env_test_string;
rk_set_env_u32(env_debug, env_debug_u32); mpp_set_env_u32(env_debug, env_debug_u32);
rk_set_env_str(env_string, env_string_str); mpp_set_env_str(env_string, env_string_str);
rk_log("set env: %s to %u\n", env_debug, env_debug_u32); mpp_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_log("set env: %s to %s\n", env_string, env_string_str);
env_debug_u32 = 0; env_debug_u32 = 0;
env_string_str = NULL; 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); mpp_get_env_u32(env_debug, &env_debug_u32, 0);
rk_get_env_str(env_string, &env_string_str, NULL); mpp_get_env_str(env_string, &env_string_str, NULL);
rk_log("get env: %s is %u\n", env_debug, env_debug_u32); mpp_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 %s\n", env_string, env_string_str);
return 0; return 0;
} }

View File

@@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
#define MODULE_TAG "rk_log_test" #define MODULE_TAG "mpp_log_test"
#include "mpp_log.h" #include "mpp_log.h"
@@ -22,17 +22,17 @@ int main()
{ {
RK_U32 flag = 0xffff; 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; return 0;
} }

View File

@@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
#define MODULE_TAG "rk_malloc_test" #define MODULE_TAG "mpp_malloc_test"
#include "mpp_log.h" #include "mpp_log.h"
#include "mpp_env.h" #include "mpp_env.h"
@@ -24,13 +24,13 @@
int main() int main()
{ {
rk_set_env_u32("osal_mem_list", 1); mpp_set_env_u32("osal_mem_list", 1);
void *tmp = rk_malloc(int, 100); void *tmp = mpp_malloc(int, 100);
if (tmp) { if (tmp) {
rk_log("malloc success\n"); mpp_log("malloc success\n");
rk_free(tmp); mpp_free(tmp);
} else { } else {
rk_log("malloc failed\n"); mpp_log("malloc failed\n");
} }
return 0; return 0;

View File

@@ -15,7 +15,7 @@
* limitations under the License. * limitations under the License.
*/ */
#define MODULE_TAG "rk_thread_test" #define MODULE_TAG "mpp_thread_test"
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
@@ -32,9 +32,9 @@
void *thread_test(void *pdata) void *thread_test(void *pdata)
{ {
int idx = *((int*)pdata); int idx = *((int*)pdata);
rk_log("thread %d is running\n", idx); mpp_log("thread %d is running\n", idx);
sleep(1); sleep(1);
rk_log("thread %d done\n", idx); mpp_log("thread %d done\n", idx);
return NULL; return NULL;
} }
@@ -44,7 +44,7 @@ int main()
int pdata[MAX_THREAD_NUM]; int pdata[MAX_THREAD_NUM];
pthread_t threads[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_t attr;
pthread_attr_init(&attr); pthread_attr_init(&attr);
pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE); pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE);
@@ -62,7 +62,7 @@ int main()
pthread_join(threads[i], &dummy); pthread_join(threads[i], &dummy);
} }
rk_log("vpu test end\n"); mpp_log("vpu test end\n");
return 0; return 0;
} }