diff options
-rwxr-xr-x | vmeta_lib.c | 77 | ||||
-rwxr-xr-x | vmeta_lib.h | 2 |
2 files changed, 40 insertions, 39 deletions
diff --git a/vmeta_lib.c b/vmeta_lib.c index de0fb53..dd588d2 100755 --- a/vmeta_lib.c +++ b/vmeta_lib.c @@ -48,10 +48,10 @@ static SIGN32 vmeta_private_unlock(); static SIGN32 vdec_os_api_get_ks(kernel_share **pp_ks);//get kernel shared resources // global variable -vdec_os_driver_cb_t *vdec_iface = NULL; -UNSG32 globalDbgLevel = VDEC_DEBUG_NONE; -UNSG32 syncTimeout = 500; -pthread_mutex_t pmt = PTHREAD_MUTEX_INITIALIZER; +static vdec_os_driver_cb_t *vdec_iface = NULL; +static UNSG32 globalDbgLevel = VDEC_DEBUG_NONE; +static UNSG32 syncTimeout = 500; +static pthread_mutex_t pmt = PTHREAD_MUTEX_INITIALIZER; static inline int get_bit(int nr, unsigned int *addr) { @@ -333,7 +333,7 @@ SIGN32 vdec_os_api_sync_event() //End of mem mmap #define VMETA_VERSION_PREFIX "build-" -int get_version(char *msg) +static int get_version(char *msg) { int ret; int version; @@ -355,7 +355,7 @@ int get_version(char *msg) return version; } -UNSG32 get_mem_size(char *msg) +static UNSG32 get_mem_size(char *msg) { int ret; UNSG32 result; @@ -376,7 +376,7 @@ UNSG32 get_mem_size(char *msg) return result; } -UNSG32 get_mem_addr(char *msg) +static UNSG32 get_mem_addr(char *msg) { UNSG32 result; int ret; @@ -558,7 +558,7 @@ SIGN32 vdec_os_driver_clean(void) } /* display debug message */ -int dbg_printf(UNSG32 dbglevel, const char* format, ...) { +static int dbg_printf(UNSG32 dbglevel, const char* format, ...) { char dbgBuf[256] = {'\0'}; va_list var; #if VMETA_LOG_ON @@ -590,7 +590,7 @@ DBG_PRINT: #if VMETA_LOG_ON fprintf(fp_log,dbgBuf); #else - printf(dbgBuf); + printf("%s", dbgBuf); #endif DBG_EXIT: @@ -601,7 +601,8 @@ DBG_EXIT: } /* vdec driver get cb */ -vdec_os_driver_cb_t *vdec_driver_get_cb(void) { +vdec_os_driver_cb_t *vdec_driver_get_cb(void) +{ return vdec_iface; } @@ -730,7 +731,7 @@ get_vos_fail: return ret; } -int find_user_id(id_instance *list)//return unoccupied id +static int find_user_id(id_instance *list)//return unoccupied id { int i; for(i=0; i<MAX_VMETA_INSTANCE; i++) { @@ -820,8 +821,9 @@ SIGN32 vdec_os_api_free_user_id(SIGN32 user_id) return VDEC_OS_DRIVER_OK; } -int vmeta_thread_monitor(struct monitor_data * pmd) +static void *vmeta_thread_monitor(void *_data) { + struct monitor_data *pmd = _data; kernel_share *p_ks; unsigned int *ret; vdec_os_driver_cb_t *p_cb = vdec_driver_get_cb(); @@ -837,7 +839,7 @@ int vmeta_thread_monitor(struct monitor_data * pmd) free(pmd); pthread_detach(pthread_self()); pthread_mutex_unlock(&pmt); - return -1; + return (void *)-1; } p_md = malloc(sizeof(struct monitor_data)); @@ -846,7 +848,7 @@ int vmeta_thread_monitor(struct monitor_data * pmd) free(pmd); pthread_detach(pthread_self()); pthread_mutex_unlock(&pmt); - return -1; + return (void *)-1; } memcpy(p_md,pmd,sizeof(struct monitor_data)); @@ -908,7 +910,7 @@ int vmeta_thread_monitor(struct monitor_data * pmd) dbg_printf(VDEC_DEBUG_MEM,"thread monitor exit\n"); pthread_detach(pthread_self()); pthread_mutex_unlock(&pmt); - return 0; + return NULL; tag_monitor_fail: pthread_mutex_unlock(&pmt); @@ -917,12 +919,11 @@ tag_monitor_fail: pthread_detach(pthread_self()); pthread_attr_destroy(&pat); - return -1; - + return (void *)-1; } - SIGN32 vdec_os_api_register_user_id(SIGN32 user_id) - { +SIGN32 vdec_os_api_register_user_id(SIGN32 user_id) +{ kernel_share *p_ks; vdec_os_driver_cb_t *p_cb = vdec_driver_get_cb(); pthread_t tmp; @@ -963,10 +964,10 @@ tag_monitor_fail: return VDEC_OS_DRIVER_OK; - } +} - SIGN32 vdec_os_api_unregister_user_id(SIGN32 user_id) - { +SIGN32 vdec_os_api_unregister_user_id(SIGN32 user_id) +{ kernel_share *p_ks; vdec_os_driver_cb_t *p_cb = vdec_driver_get_cb(); @@ -993,23 +994,23 @@ tag_monitor_fail: p_ks->ref_count--; return VDEC_OS_DRIVER_OK; - } +} - SIGN32 vmeta_private_lock() - { +static SIGN32 vmeta_private_lock() +{ ioctl(vdec_iface->uiofd,VMETA_CMD_PRIV_LOCK,(unsigned long)0xffffffff); return 0; - } +} - SIGN32 vmeta_private_unlock() - { +static SIGN32 vmeta_private_unlock() +{ ioctl(vdec_iface->uiofd,VMETA_CMD_PRIV_UNLOCK); return 0; - } +} - SIGN32 vdec_os_api_get_user_count(void) - { +SIGN32 vdec_os_api_get_user_count(void) +{ vdec_os_driver_cb_t *p_cb = vdec_driver_get_cb(); kernel_share *p_ks; @@ -1030,10 +1031,10 @@ tag_monitor_fail: dbg_printf(VDEC_DEBUG_ALL, "get_user_count=%d \n",p_ks->ref_count); return p_ks->ref_count; - } +} - SIGN32 vdec_os_api_lock(SIGN32 user_id, long to_ms) - { +SIGN32 vdec_os_api_lock(SIGN32 user_id, long to_ms) +{ vdec_os_driver_cb_t *p_cb = vdec_driver_get_cb(); kernel_share* p_ks; struct timespec ts; @@ -1069,10 +1070,10 @@ tag_monitor_fail: vmeta_private_unlock(); return LOCK_RET_OHTERS_NORM; - } +} - SIGN32 vdec_os_api_unlock(SIGN32 user_id) - { +SIGN32 vdec_os_api_unlock(SIGN32 user_id) +{ vdec_os_driver_cb_t *p_cb = vdec_driver_get_cb(); kernel_share* p_ks; int ret; @@ -1104,7 +1105,7 @@ tag_monitor_fail: } return LOCK_RET_OHTERS_NORM; - } +} SIGN32 vdec_os_api_power_on(void) { diff --git a/vmeta_lib.h b/vmeta_lib.h index cfad352..c2367e1 100755 --- a/vmeta_lib.h +++ b/vmeta_lib.h @@ -173,7 +173,7 @@ typedef enum _LOCK_RET_CODE { /* display debug message */ #define VMETA_LOG_ON 0 #define VMETA_LOG_FILE "/data/vmeta_dbg.log" -int dbg_printf(UNSG32 dbglevel, const char* format, ...); +static int dbg_printf(UNSG32 dbglevel, const char* format, ...); typedef sem_t lock_t; //--------------------------------------------------------------------------- |