static int state_fun( int sockfd, msg_head_t *pMsgHead, char *msg_data ) { int res = -1; char *cmd = "log oemstatus ontime 1\r\n"; #if 0 struct tm *timer; #endif if ( !pMsgHead ) { return ERR; } if ( pMsgHead->msg_type != MSG_TYPE( CATEGORY_GUIDE,STATE ) ) { logi( "msg_type( %d, %d ) wrong\n", MSG_CATEGORY( pMsgHead->msg_type ), MSG_OPCODE( pMsgHead->msg_type ) ); return ERR; } if((res = write(cmdfd,cmd,strlen(cmd))) == -1){ logi("write error"); return ERR; } pthread_mutex_lock(&lock); msg_head[0] = *pMsgHead; sock = sockfd; pthread_mutex_unlock(&lock); return OK; }
static void console_command_compile(ConsoleServer& cs, TCPSocket client, const char* json) { TempAllocator4096 ta; JsonObject obj(ta); DynamicString id(ta); DynamicString data_dir(ta); DynamicString platform(ta); sjson::parse(json, obj); sjson::parse_string(obj["id"], id); sjson::parse_string(obj["data_dir"], data_dir); sjson::parse_string(obj["platform"], platform); { TempAllocator512 ta; StringStream ss(ta); ss << "{\"type\":\"compile\",\"id\":\"" << id.c_str() << "\",\"start\":true}"; cs.send(client, string_stream::c_str(ss)); } logi("Compiling '%s'", id.c_str()); bool succ = device()->data_compiler()->compile(data_dir.c_str(), platform.c_str()); if (succ) logi("Compiled '%s'", id.c_str()); else loge("Error while compiling '%s'", id.c_str()); { TempAllocator512 ta; StringStream ss(ta); ss << "{\"type\":\"compile\",\"id\":\"" << id.c_str() << "\",\"success\":" << (succ ? "true" : "false") << "}"; cs.send(client, string_stream::c_str(ss)); } }
/* ====================================================================== FUNCTION OMX_FreeHandle DESCRIPTION Destructs the component handles. PARAMETERS None RETURN VALUE Error None. ========================================================================== */ OMX_API OMX_ERRORTYPE OMX_APIENTRY OMX_FreeHandle(OMX_IN OMX_HANDLETYPE hComp) { OMX_ERRORTYPE eRet = OMX_ErrorNone; int err = 0, i = 0; logi("OMXCORE API : Free Handle %x\n",(unsigned) hComp); // 0. Check that we have an active instance if((i= is_cmp_handle_exists(hComp)) >=0) { // 1. Delete the component if ((eRet = aw_omx_component_deinit(hComp)) == OMX_ErrorNone) { clear_cmp_handle(hComp); /* Unload component library */ check_lib_unload(i); } else { logi(" OMX_FreeHandle failed on %x\n",(unsigned) hComp); return eRet; } } else { logi("OMXCORE Warning: Free Handle called with no active instances\n"); } return OMX_ErrorNone; }
static int vpp_close(struct file *file) { logi("in vpp_close\n"); s_vpp_count--; logi("in vpp_close s_vpp_count = %d\n",s_vpp_count); if (s_vpp_count > 0)//TODO: < 0, 试一下 { logi("don't need to close device, the open count is %d\n", s_vpp_count); return 0; } inter_close(HAL_LAYER_VIDEO1); inter_deinit(); if ( NULL != s_clk) { clk_disable(s_clk); logi(" clock is disable \n"); } else { loge("the s_clk is null\n"); } /*disable vdec regulator*/ if( NULL != s_vdec_vcc) { regulator_disable(s_vdec_vcc); } return 0; }
static int setdir_fun(int sockfd,msg_head_t *pMsgHead,char *msg_data){ int res = -1; char cmd[1024],basebool; utab_t *utab; char *mode[] ={ "snb","swb","dnb","swb" }; if(!msg_data || !pMsgHead) return ERR; if(pMsgHead->msg_type != MSG_TYPE(CATEGORY_CONFIG,DIRSET)){ logi("msg_type(A%d,%d) wrong\n",MSG_CATEGORY(pMsgHead->msg_type), MSG_OPCODE(pMsgHead->msg_type)); return -1; } utab = (utab_t*)msg_data; basebool = utab->baseline == 0.0 ? 0 : 1; if(basebool) sprintf(cmd,"set %s %f\r\n",mode[utab->type+basebool],utab->baseline); else sprintf(cmd,"set %s\r\n",mode[utab->type+basebool]); if((res = write(cmdfd,cmd,strlen(cmd))) == -1){ logi("write error"); return -1; } return OK; }
static int action_fun( int sockfd, msg_head_t *pMsgHead, char *msg_data ) { int res = -1; char *cmd = "log satinfo ontime 1\r\n"; if ( !pMsgHead ) { return ERR; } if ( pMsgHead->msg_type != MSG_TYPE( CATEGORY_GUIDE,ACTION) ) { logi( "msg_type( %d, %d ) wrong\n", MSG_CATEGORY( pMsgHead->msg_type ), MSG_OPCODE( pMsgHead->msg_type ) ); return ERR; } if((res = write(cmdfd,cmd,strlen(cmd))) == -1){ logi("write error"); return ERR; } pthread_mutex_lock(&lock); msg_head[1] = *pMsgHead; sock = sockfd; pthread_mutex_unlock(&lock); return OK; }
/* ====================================================================== FUNCTION check_lib_unload DESCRIPTION Check if any component instance is using the library PARAMETERS index: Component Index in core array. RETURN VALUE 1: Library Unused and can be unloaded. 0: Library used and shouldnt be unloaded. ========================================================================== */ static int check_lib_unload(int index) { unsigned i=0; int rc = 1; int err; pthread_mutex_lock(&g_mutex_core_info); for(i=0; i< OMX_COMP_MAX_INST; i++) { if(core[index].inst[i]) { rc = 0; logi("Library Used \n"); break; } } if(rc == 1) { //logd(" Unloading the dynamic library for %s\n", core[index].name); err = dlclose(core[index].so_lib_handle); if(err) { logi("Error %d in dlclose of lib %s\n", err,core[index].name); } core[index].so_lib_handle = NULL; core[index].fn_ptr = NULL; } pthread_mutex_unlock(&g_mutex_core_info); return rc; }
int RequestVideoStreamBuffer(VideoDecoder* pDecoder, int nRequireSize, char** ppBuf, int* pBufSize, char** ppRingBuf, int* pRingBufSize, int nStreamBufIndex) { char* pStart; char* pStreamBufEnd; char* pMem; int nFreeSize; Sbm* pSbm; VideoDecoderContext* p; logi("RequestVideoStreamBuffer, pDecoder=%p, nRequireSize=%d, nStreamBufIndex=%d", pDecoder, nRequireSize, nStreamBufIndex); p = (VideoDecoderContext*)pDecoder; *ppBuf = NULL; *ppRingBuf = NULL; *pBufSize = 0; *pRingBufSize = 0; pSbm = p->pSbm; if(pSbm == NULL) { logw("pSbm of video stream %d is NULL, RequestVideoStreamBuffer fail.", nStreamBufIndex); return -1; } //* sometimes AVI parser will pass empty stream frame to help pts calculation. //* in this case give four bytes even the parser does not need. if(nRequireSize == 0) nRequireSize = 4; //* we've filled partial frame data but not added to the SBM before, //* we need to calculate the actual buffer pointer by self. nRequireSize += p->partialStreamDataInfo.nLength; if(SbmRequestBuffer(pSbm, nRequireSize, &pMem, &nFreeSize) < 0) { logi("request stream buffer fail, %d bytes valid data in SBM[%d], total buffer size is %d bytes.", SbmStreamDataSize(pSbm), nStreamBufIndex, SbmBufferSize(pSbm)); return -1; } //* check the free buffer is larger than the partial data we filled before. if(nFreeSize <= p->partialStreamDataInfo.nLength) { logi("require stream buffer get %d bytes, but this buffer has been filled with partial \ frame data of %d bytes before, nStreamBufIndex=%d.", nFreeSize, p->partialStreamDataInfo.nLength, nStreamBufIndex); return -1; }
/* ====================================================================== FUNCTION get_cmp_handle DESCRIPTION Get component handle. PARAMETERS None RETURN VALUE Error None. ========================================================================== */ void* get_cmp_handle(char *cmp_name) { unsigned i =0,j=0; logi("get_cmp_handle \n"); for(i=0; i< SIZE_OF_CORE; i++) { if(!strcmp(cmp_name, core[i].name)) { for(j=0; j< OMX_COMP_MAX_INST; j++) { if(core[i].inst[j]) { logi("get_cmp_handle match\n"); return core[i].inst[j]; } } } } logi("get_cmp_handle returning NULL \n"); return NULL; }
static int l_fs_read (lua_State *L) { unsigned int fd = lua_tonumber(L, 1); unsigned int count = lua_tonumber(L, 2); size_t cur = lseek(fd, 0, SEEK_CUR); size_t end = lseek(fd, 0, SEEK_END); lseek(fd, cur, SEEK_SET); if(count > end - cur) count = end - cur; void* buf = malloc(count); size_t res = read(fd, buf, count); logm("read("); logi(fd); logm(") bytes:"); logi(res); logm(" of "); logi(count); logn(""); if(res > 0) { lua_pushlstring(L, buf, res); free(buf); return 1; } free(buf); return 0; }
void dump_packet(struct rpc_packet *r) { logi("packet header:\n"); dump_buffer(&r->header, (int)sizeof(struct rpc_header)); logi("packet data:\n"); dump_buffer(r->payload, r->header.payload_len); }
static int hi3620_digital_new(struct snd_card *card, struct snd_soc_dai *dai, struct snd_pcm *pcm) { int ret = 0; IN_FUNCTION; if (!card->dev->dma_mask) { logi("%s : dev->dma_mask not set\n", __FUNCTION__); card->dev->dma_mask = &hi3620_digital_dmamask; } if (!card->dev->coherent_dma_mask) { logi("%s : dev->coherent_dma_mask not set\n", __FUNCTION__); card->dev->coherent_dma_mask = hi3620_digital_dmamask; } ret = snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, pcm->card->dev, HI3620_MAX_BUFFER_SIZE, HI3620_MAX_BUFFER_SIZE); if (ret) { loge("snd_pcm_lib_preallocate_pages_for_all error : %d\n", ret); return ret; } logi("%s: pcm->device = 0\n", __FUNCTION__); ret = request_irq(g_hi3620_asp_irq_line, hi3620_intr_handle_digital, IRQF_SHARED, "ASP", pcm); if (ret) { loge("request_irq error : %d\n", ret); snd_pcm_lib_preallocate_free_for_all(pcm); } OUT_FUNCTION; return ret; }
static int setrov_fun( int sockfd, msg_head_t *pMsgHead, char *msg_data ) { printf("setrov\n"); int res = -1; char *cmd = "fix none\r\n"; if ( !pMsgHead ) { return ERR; } if ( pMsgHead->msg_type != MSG_TYPE( CATEGORY_CONFIG,SETROV) ) { logi( "msg_type( %d, %d ) wrong\n", MSG_CATEGORY( pMsgHead->msg_type ), MSG_OPCODE( pMsgHead->msg_type ) ); return ERR; } if((res = write(cmdfd,cmd,strlen(cmd))) == -1){ logi("write error"); return ERR; } // cmd_response_massage(sockfd,pMsgHead,"ok",strlen("ok")); #if 0 printf("setrov successfully\n"); #endif return OK; }
static int vpp_open(struct file *file) { int ret = -EFAULT; logi("in vpp_open\n"); logi("vpp_phymem = 0x%x, camera_phymem = 0x%x, codec_phymem = 0x%x\n", hisi_reserved_vpp_phymem, hisi_reserved_camera_phymem, hisi_reserved_codec_phymem); if ( s_vpp_count > 0 ) { logi("don't need to open device, the open count is %d\n", s_vpp_count); s_vpp_count++; return 0; } if (0 != regulator_enable(s_vdec_vcc)) { loge("failed to enable vdec-vcc regulator.\n"); return -1; } if (NULL != s_clk) { ret = clk_enable(s_clk); if (ret) { loge("clk_enable failed ret = %#x\n",ret); } else { logi(" clock is enable \n"); ret = clk_set_rate(s_clk, 140000000); if (ret) { loge("clk_set_rate failed ret = %#x\n",ret); } else { logi(" clock set rate success \n"); } } } else { loge("%s,the s_clk is null\n",__FUNCTION__); } ret = inter_init(); if(K3_SUCCESS != ret) { loge("vpp init failed ret = %#x\n",ret); return -EFAULT; } inter_open(HAL_LAYER_VIDEO1); hal_set_int_enable(HAL_INTMSK_VTEINT); s_vpp_count++; return 0; }
void logt(const char *message) { struct timeval tp; gettimeofday(&tp, NULL); logm("["); logi(tp.tv_sec - logStart); logm("+"); logi(tp.tv_usec); logm("]"); logm(message); }
void thread_print_info(struct thread *t) { pthread_mutex_lock(&t->mutex); logi("========\n"); logi("thread name = %s\n", t->name); logi("thread id = %ld\n", t->tid); logi("thread status=%s\n", t->is_run?"running":"stopped"); logi("========\n"); pthread_mutex_unlock(&t->mutex); }
static int setio_fun(int sockfd,msg_head_t *pMsgHead,char *msg_data){ int res = -1,i,cmdn = 0; char cmd[10][1024]; data_t *data; char *raw[4][10] = { { "ranged","gpsephemb","bdsephemb","gloephemb"}, { "rtcm1033","rtcm1005","rtcm1006","rtcm1004b", "rtcm1104b","rtcm1012b" }, { "rtcm1033","rtcm1005","rtcm1006","rtcm1074b", "rtcm1124b","rtcm1084b" }, { "gpgga","gpgsv","gprmc","gpgsr","gpgsa", "gputa","gpgll","gpzda","gpvtg","gpgst"} }; #if 0 char buff[1024]; int len; #endif if(!msg_data || !pMsgHead) return ERR; if(pMsgHead->msg_type != MSG_TYPE(CATEGORY_CONFIG,IOSET)){ logi("msg_type(A%d,%d) wrong\n",MSG_CATEGORY(pMsgHead->msg_type), MSG_OPCODE(pMsgHead->msg_type)); return -1; } data = (data_t*)msg_data; if(data->clientbool){ sprintf(cmd[0],"setclient %s\r\n",data->ipport); if((res = write(cmdfd,cmd[0],strlen(cmd[0]))) == -1){ logi("write error"); return -1; } } for(i = 0;i < 10;i++) if(data->datatime[i] != 0) sprintf(cmd[cmdn++],"log %s ontime %f\r\n",raw[(int)data->datatype][i], data->datatime[i]); for(i = 0;i < cmdn;i++) if((res = write(cmdfd,cmd[i],strlen(cmd[i]))) == -1){ logi("write error"); return -1; } #if 0 while((len=read(profd,buff,1024)) > 0){ buff[len] = '\0'; printf("%s\n",buff); } #endif return OK; }
/** * @brief file lock set * * @author hankejia * @date 2012-07-05 * @param[in] fd file fd * @param[in] type type, file r/w lock or r/w unlock * @param[in] whence lock file is position, SEEK_SET, SEEK_CUR, SEEK_END * @param[in] nlen lock len, lock data from whence to whence + nlen. * @param[in] time_ms time out ms * @return T_S32 * @retval if return 0 success, otherwise failed */ T_S32 flock_set( T_S32 fd, T_U32 type, T_U32 whence, T_U32 nlen, T_U32 time_ms ) { struct flock lock; T_U32 delay_ms_once = 10 * 1000UL, delay_ms = 0; lock.l_type = type; lock.l_whence = whence; lock.l_start = 0; lock.l_len = nlen; if ( time_ms > 0 ) //timeout wait { //Since there is no timeout API for fcntl(), So use while loop //to implement time out waiting. while( fcntl( fd, F_SETLK, &lock ) < 0 ) { delay_loop( 0, delay_ms ); // delay 10 ms delay_ms += delay_ms_once; if ( delay_ms >= time_ms ) { return 1; // return 1, time out } } } else if ( time_ms == 0 ) { if ( fcntl( fd, F_SETLK, &lock ) < 0 ) { if ( fcntl( fd, F_GETLK, &lock ) < 0 ) { loge( "fcntl set %d unknown error! %s\n", type, strerror(errno) ); return -1; } if ( lock.l_type == F_RDLCK ) { logi( "read lock already set by %d\n", lock.l_pid ); return 2; //return 2 the operation already set by another program } if ( lock.l_type == F_WRLCK ) { logi( "write lock already set by %d\n", lock.l_pid ); return 2;//return 2 the operation already set by another program } loge( "fcntl set %d unknown error! %s\n", type, strerror(errno) ); return -1; } } else //block wait { if ( fcntl( fd, F_SETLKW, &lock ) < 0 ) { loge( "fcntl set %d block error! %s\n", type, strerror(errno) ); return -1; } } return 0; }
void *malloc_call_d(int line, const char *file_name, const char *func_name, size_t size) { logi("malloc>\n"); void *addr = malloc(size); logi("malloc> 0x%0lX (%d:%s '%s')\n", addr, line, func_name, file_name); struct mlist_t *file_el = find_list(file_name); add_malloc(&(file_el->addr), addr, line, file_name, func_name, size); return addr; }
/*! * \brief performs any initialization needed for this light control * \param pLightControl a pointer to the LightControl to intialize * \note this puts the pins in the correct state for manipulation, must be called whenever pin bindings are changed. * \note pins should not be reused unless you really know what you're doing! */ void LightControl_setup(struct LightControl* pLightControl) { pinMode(pLightControl->r, OUTPUT); pinMode(pLightControl->g, OUTPUT); pinMode(pLightControl->b, OUTPUT); logsz("Light Control initialized (", kLogLevel_Debug); logi(pLightControl->r, kLogLevel_Debug); logsz(", ", kLogLevel_Debug); logi(pLightControl->g, kLogLevel_Debug); logsz(", ", kLogLevel_Debug); logi(pLightControl->b, kLogLevel_Debug); logsz(")\n", kLogLevel_Debug); }
/****************************************************************************** * Function: hdcp_on * Description: Switch hdcp on. * Data Accessed: * Data Updated: * Input: * Output: * Return: * Others: *******************************************************************************/ static void hdcp_on(void) { u8 uReg_TPI_HW_DBG1 = 0; u8 uReg_TPI_HW_DBG3 = 0; u8 uTimeOut = 100; u32 regdata_hdcp_con; IN_FUNCTION; logd("TPI_SYSTEM_CONTROL_DATA_REG(0x1A):0x%x\n",tpi_read_reg(TPI_SYSTEM_CONTROL_DATA_REG)); regdata_hdcp_con= tpi_read_reg(TPI_HDCP_CONTROL_DATA_REG); logd("pre regdata_hdcp_con is 0x%x.\n",regdata_hdcp_con); regdata_hdcp_con= tpi_read_reg(TPI_HDCP_CONTROL_DATA_REG); logd("after regdata_hdcp_con is 0x%x.\n",regdata_hdcp_con); //Step 1: Enable HDCP. Drive hardware to read BKSV. if (hdcp_para.started == false) { logi("HDCP -> Started\n"); tpi_modify_reg(TPI_HDCP_CONTROL_DATA_REG, PROTECTION_LEVEL_MASK, PROTECTION_LEVEL_MAX); //Step 2: Tell if read BKSV successfully. while ((!((uReg_TPI_HW_DBG1 & BIT0) | (uReg_TPI_HW_DBG3 & BIT0))) && uTimeOut) { mdelay(10); uReg_TPI_HW_DBG1 = tpi_read_reg(TPI_HW_DBG1_ADDR); uReg_TPI_HW_DBG3 = tpi_read_reg(TPI_HW_DBG3_ADDR); uTimeOut--; } if (0x00 == uTimeOut) { loge("HDCP->Read BKSV Timeout.\n"); hdcp_para.started = false; } else if (uReg_TPI_HW_DBG1 & BIT0) { logi("HDCP->Read BKSV Done. Sink does supports HDCP.\n"); hdcp_para.started = true; } else if (uReg_TPI_HW_DBG3 & BIT0) { logi("HDCP->Read BKSV Error. Sink Does NOT supports HDCP.\n"); hdcp_para.started = false; } if (false == hdcp_para.started) { HdcpToggleTmdsForHdcpAuthentication(); hdcp_para.link_protection_level= EXTENDED_LINK_PROTECTION_NONE | LOCAL_LINK_PROTECTION_NONE; } } OUT_FUNCTION; }
static int on_peer_post_msg_resp(struct rpc *r, void *arg, int len) { pthread_t tid; struct p2p *p2p = _p2p; uint32_t peer_id; char localip[MAX_ADDR_STRING]; char reflectip[MAX_ADDR_STRING]; struct sockaddr_in si; logi("on_peer_post_msg_resp len = %d\n", len); struct nat_info *nat = (struct nat_info *)arg; logi("get nat info from peer\n"); logi("nat.uuid = 0x%08x\n", nat->uuid); skt_addr_ntop(localip, nat->local.ip); skt_addr_ntop(reflectip, nat->reflect.ip); logi("nat.type = %d\n", nat->type); logi("nat.local_addr %s:%d\n", localip, nat->local.port); logi("nat.reflect_addr %s:%d\n", reflectip, nat->reflect.port); p2p->ps = ptcp_socket_by_fd(p2p->nat.fd); if (p2p->ps == NULL) { loge("error!\n"); return -1; } if (p2p->rpc_state == P2P_RPC_SYN_SENT) {//client logi("as p2p client\n"); sleep(1); if (_p2p_connect(p2p, localip, nat->local.port)) { loge("_p2p_connect nat.local failed, try nat.reflect\n"); if (_p2p_connect(p2p, reflectip, nat->reflect.port)) { logi("_p2p_connect nat.reflect failed too\n"); return -1; } } return 0; } //server logi("as p2p server\n"); peer_id = nat->uuid; p2p_connect(p2p, peer_id); si.sin_family = AF_INET; si.sin_addr.s_addr = inet_addr(_local_ip); si.sin_port = htons(_local_port); logi("ptcp_bind %s:%d\n", _local_ip, _local_port); ptcp_bind(p2p->ps, (struct sockaddr*)&si, sizeof(si)); ptcp_listen(p2p->ps, 0); pthread_create(&tid, NULL, tmp_thread, p2p); return 0; }
static void console_command_reload(ConsoleServer& /*cs*/, TCPSocket /*client*/, const char* json) { TempAllocator4096 ta; JsonObject obj(ta); DynamicString type(ta); DynamicString name(ta); sjson::parse(json, obj); sjson::parse_string(obj["resource_type"], type); sjson::parse_string(obj["resource_name"], name); logi("Reloading resource '%s.%s'", name.c_str(), type.c_str()); device()->reload(ResourceId(type.c_str()), ResourceId(name.c_str())); logi("Reloaded resource '%s.%s'", name.c_str(), type.c_str()); }
int _p2p_connect(struct p2p *p2p, char *ip, uint16_t port) { struct sockaddr_in si; si.sin_family = AF_INET; si.sin_addr.s_addr = inet_addr(ip); si.sin_port = htons(port); logi("ptcp_connect %s:%d\n", ip, port); if (0 != ptcp_connect(p2p->ps, (struct sockaddr*)&si, sizeof(si))) { logi("ptcp_connect timeout\n"); return -1; } else { logi("ptcp_connect success\n"); } return 0; }
int main() { const Pin pins_stack[] = {PINS_STACK}; PIO_Configure(pins_stack, PIO_LISTSIZE(pins_stack)); brick_hardware_version[0] = BRICK_HARDWARE_VERSION_MAJOR; brick_hardware_version[1] = BRICK_HARDWARE_VERSION_MINOR; brick_hardware_version[2] = BRICK_HARDWARE_VERSION_REVISION; brick_init(); wdt_restart(); #ifdef PROFILING profiling_init(); #endif if(usb_is_connected()) { logi("Configure as USB device\n\r"); usb_init(); wdt_restart(); xTaskCreate(usb_message_loop, (signed char *)"usb_ml", 2000, NULL, 1, (xTaskHandle *)NULL); } else { usb_first_connection = false; logi("Configure as Stack Participant (SPI)\n\r"); spi_stack_slave_init(); wdt_restart(); xTaskCreate(spi_stack_slave_message_loop, (signed char *)"spi_ml", 2500, NULL, 1, (xTaskHandle *)NULL); } dc_init(); wdt_restart(); brick_init_start_tick_task(); wdt_restart(); vTaskStartScheduler(); }
static int process_msg(struct ipc *ipc, void *buf, size_t len) { ipc_handler_t handler; uint32_t func_id = 0; char out_arg[1024]; size_t out_len; size_t ret_len; struct ipc_packet *pkt = (struct ipc_packet *)buf; if (-1 == unpack_msg(pkt, &func_id, &out_arg, &out_len)) { logd("unpack_msg failed!\n"); return -1; } if (find_ipc_handler(func_id, &handler) == 0 ) { handler.cb(ipc, out_arg, out_len, _arg_buf, &ret_len);//direct call cb is not good, will be change to workq } else { logi("no callback for this MSG ID in process_msg\n"); } if (ret_len > 0) { if (0 > pack_msg(pkt, func_id, _arg_buf, ret_len)) { loge("pack_msg failed!\n"); return -1; } ipc->ops->send(ipc, pkt, sizeof(ipc_packet_t) + ret_len); } return 0; }
void free_call_d(int line, const char *file_name, const char *function, void *addr) { struct mlist_t *list = find_list(file_name); if (!rm_malloc(list, addr)) { list = files_list; while (list != NULL) { if (rm_malloc(list, addr)) { free(addr); return; } list = list->next; } } else { logi("free addr 0x%08lX (%d:%s '%s')\n", addr, line, function, file_name); free(addr); return; } LOGW("cannot free element!!! 0x%08lX (%d:%s '%s')\n", addr, line, function, file_name); }
void sochifi_watchdog_send_event(void) { hifi_dump_panic_log(); logi("soc hifi watchdog coming, now reset mediaserver \n"); char *envp[2] = {"hifi_watchdog", NULL}; kobject_uevent_env(&s_misc_data.dev->kobj, KOBJ_CHANGE, envp); }
static int get_comp_handle_index(char *cmp_name) { unsigned i=0,j=0; int rc = -1; pthread_mutex_lock(&g_mutex_core_info); for(i=0; i< SIZE_OF_CORE; i++) { if(!strcmp(cmp_name, core[i].name)) { for(j=0; j< OMX_COMP_MAX_INST; j++) { if(NULL == core[i].inst[j]) { rc = j; logi("free handle slot exists %d\n", rc); pthread_mutex_unlock(&g_mutex_core_info); return rc; } } break; } } pthread_mutex_unlock(&g_mutex_core_info); return rc; }
void foo() { logi("xxx\n"); struct yuv *yuv = je_yuv_new(YUV420, WIDTH, HEIGH); get_yuv_file(yuv, "test_1920x1080.yuv"); struct jpeg *jpeg = je_jpeg_new(WIDTH, HEIGH); //get_yuv_buffer(yuv); logi("xxx\n"); je_encode_yuv_to_jpeg(yuv, jpeg, 60); logi("xxx\n"); save_jpeg_file("720x480.jpeg", jpeg); //use jpeg je_yuv_free(yuv); je_jpeg_free(jpeg); logi("xxx\n"); }