__s32 dsk_radio_send_open(void) { __s32 result = 0; if(h_radio == NULL) { __msg("radio not open!\n"); return EPDK_FAIL; } if(dsk_radio_send) { return EPDK_OK; } dsk_radio_send = (dsk_radio_send_t *)esMEMS_Malloc(0,sizeof(dsk_radio_send_t)); if(dsk_radio_send == NULL) { __msg("dsk_radio_send malloc error!\n"); return EPDK_FAIL; } eLIBs_memset(dsk_radio_send,0,sizeof(dsk_radio_send_t)); //h_radio->fm_drv = fm_drv; result = eLIBs_fioctrl(h_radio->fm_drv , DRV_FM_CMD_SEND_INIT, 0, 0); if(result == -1) { return EPDK_FAIL; } return EPDK_OK; }
void * SimpleSliderNew(SimpleSliderClass * cls, int * bmps) { SimpleSliderDesc * create; __size_t sz; sz = sizeof(SimpleSliderDesc) + (cls->bmp_nr * sizeof(int)); create = (SimpleSliderDesc *)esMEMS_Malloc(0, sz); if (create) { eLIBs_memcpy((void *)&create->cls, (void *)cls, sizeof(SimpleSliderClass)); create->drew_position = -1; create->puzzleDataSize = BYTESPERPIXEL * cls->puzzle.width * cls->puzzle.height; create->puzzleData = esMEMS_Malloc(0, create->puzzleDataSize); if (NULL == create->puzzleData) { esMEMS_Mfree(0, create); return NULL; } eLIBs_memcpy((void *)&create->bmps[0], (void *)bmps, (cls->bmp_nr * sizeof(int))); } else { return NULL; } return (void *)create; }
txtEncodeParser *utf16big_parserNew(void) { txtEncodeParser *utf16big_parser; utf16big_parser = esMEMS_Malloc(0, sizeof(txtEncodeParser)); if(!utf16big_parser) { __inf("%s %d : utf16big_parser_new malloc error \n", __FUNCTION__, __LINE__); return NULL; } eLIBs_memset(utf16big_parser, 0, sizeof(txtEncodeParser)); utf16big_parser->config = utf16big_config; utf16big_parser->start_seek = utf16big_start; utf16big_parser->next = utf16big_next; utf16big_parser->prev = utf16big_prev; utf16big_parser->analysis = utf16big_analysis; utf16big_parser->dispstr = utf16big_dispstr; utf16big_parser->destroy = utf16big_destroy; utf16big_parser->bufferTxt = esMEMS_Palloc(2*BufferLenght/1024, 0); //分配2*8个页面,每个页面大小1kbytes return utf16big_parser; }
void *malloc(size_t size) { return (void *)esMEMS_Malloc(NULL,size); }
static HomeDescriptor * homeWndInit(__gui_msg_t * msg) { HomeDescriptor * hdp; gg_handler domUIConfig; gg_handler node; char ** attr; int i; gg_handler toiteNode; gg_char * langid; int langid_int; hdp = esMEMS_Malloc(0, sizeof(HomeDescriptor)); if (NULL == hdp) { LogE("Malloc failed"); return NULL; } eLIBs_memset(hdp, 0, sizeof(HomeDescriptor)); media_player_main("e:\\liu.mp3"); /* UI config */ domUIConfig = (gg_handler)GUI_WinGetAttr(msg->h_deswin); node = GG_DOMGetRoot(domUIConfig); if (0 == eLIBs_strcmp(GG_DOMGetNodeName(node), "config")) { LogE("UI config XML root node ok"); } else { LogE("UI config XML root node error"); return NULL; } toiteNode = GG_DOMGetRoot(domUIConfig); toiteNode = GG_DOMGetFirstChild(toiteNode); toiteNode = GG_DOMGetBrotherElementByTagName(toiteNode, "langid"); langid = GG_DOMGetNodeValue(toiteNode); // Set the volume dsk_volume_set(100); homeSysTimeInit(); GUI_SetScnDir(GUI_SCNDIR_NORMAL); dsk_display_set_lcd_bright(LION_BRIGHT_LEVEL15); hdp->ewii.magic = EWIN_INFO_MAGIC; hdp->ewii.desktop = msg->h_deswin; hdp->ewii.hWnd = hdp->ewii.desktop; GUI_GetScreenSize((__s32 *)&hdp->ewii.desktopSize.width, (__s32 *)&hdp->ewii.desktopSize.height); GG_FillRect(&hdp->ewii.wndRect, 0, 0, hdp->ewii.desktopSize.width, hdp->ewii.desktopSize.height); // Initiate the font module hdp->ewii.gdi.font = GUI_SFT_CreateFont(CP_SYS_FONT_SIZE, CP_SYS_FONT_PATH); hdp->ewii.gdi.fontSize = CP_SYS_FONT_SIZE; hdp->ewii.gestureArgs.htimer = hdp->ewii.desktop; hdp->ewii.gestureArgs.timerid = HOME_GESTURE_TIMER; hdp->inertia = GG_GestureOpen(); /* UI config */ node = GG_DOMGetFirstChild(node); //node = GG_DOMGetBrotherElementByTagName(node, "window"); if (node) { hdp->ewii.langid = SLIB_atoi(langid); //LogMI("hdp->ewii.langid %d",hdp->ewii.langid); hdp->hFocusWin = SCR_ScrollingHostBuilder(&hdp->ewii, ScrollingCreate_V0001, node); esDEV_Plugin("\\drv\\touchpanel.drv", 0, 0, 1); } else { LogE("No window node in XML file"); return NULL; } Uart_inf_ini(); slider_thread(); return hdp; }
/* ********************************************************************************************************************** * _spinbox_ctrl_proc * * author: * * date: 2009-8-4 * * Description: spinboxctrlproc * * parameters: * * return: if success return ERDK_OK * if fail return the number of fail * modify history: ********************************************************************************************************************** */ static int _spinbox_ctrl_proc (__gui_msg_t *msg) { __u32 dwStyle; spinbox_data_t* pData; dwStyle = GUI_WinGetStyle(msg->h_deswin); switch(msg->id) { case GUI_MSG_CREATE: pData = (spinbox_data_t*) esMEMS_Malloc( 0, sizeof(spinbox_data_t) ); if (pData == NULL) { return EPDK_FAIL; } pData->draw_sts = 0; pData->status = 0; pData->draw_flag = 0; pData->hmem = 0; pData->data = (__u32)GUI_WinGetAttr(msg->h_deswin); GUI_CtrlWinSetAddData(msg->h_deswin,(__u32)pData); return 0; case GUI_MSG_DESTROY: pData = (spinbox_data_t*)GUI_CtrlWinGetAddData(msg->h_deswin); esMEMS_Mfree ( 0, (void *)GUI_CtrlWinGetAddData(msg->h_deswin) ); return 0; case GUI_MSG_ENABLE: if (msg->dwAddData1 && (dwStyle & WS_DISABLED)) { dwStyle &= ~WS_DISABLED; GUI_WinSetStyle(msg->h_deswin,dwStyle); } else if (!msg->dwAddData1 && !(dwStyle & WS_DISABLED)) { dwStyle |= WS_DISABLED; GUI_WinSetStyle(msg->h_deswin,dwStyle); } else { return 0; } return 0; case GUI_MSG_SET_UNFOCUS: if(SPINBOX_STATUS(msg->h_deswin) & BST_FOCUS) { SPINBOX_STATUS(msg->h_deswin) &= (~BST_FOCUS); GUI_InvalidateRect (msg->h_deswin, NULL, EPDK_TRUE); } return 0; case GUI_MSG_SET_FOCUS: if(!(SPINBOX_STATUS(msg->h_deswin) & BST_FOCUS)) { SPINBOX_STATUS(msg->h_deswin) |= BST_FOCUS; GUI_InvalidateRect (msg->h_deswin, NULL, EPDK_TRUE); } return 0; case GUI_MSG_KEY: _key_proc(msg); return 0; case GUI_MSG_TOUCH: _touch_proc(msg); return 0; case GUI_MSG_PAINT: _spinbox_ctrl_paint(msg); return 0; default: break; } return GUI_CtrlWinDefaultProc (msg); }