handle_t rsc_init(rsc_config_t *p_config) { u32 size = 0; rsc_main_t *p_rsc_info = NULL; p_rsc_info = (rsc_main_t *)mmi_alloc_buf(sizeof(rsc_main_t)); memset((void *)p_rsc_info, 0, sizeof(rsc_main_t)); p_rsc_info->p_charsto_dev = dev_find_identifier(NULL, DEV_IDT_TYPE, SYS_DEV_TYPE_CHARSTO); MT_ASSERT(p_rsc_info->p_charsto_dev != NULL); p_rsc_info->p_rsc_data_addr = (u8 *)p_config->rsc_data_addr; // init data heap MT_ASSERT(p_config->comm_buf_size > 0); size += ALIGN_TO_8BYTES(p_config->comm_buf_size); size += ALIGN_TO_8BYTES(p_config->strtab_buf_size); size += ALIGN_TO_8BYTES(p_config->font_buf_size); size += ALIGN_TO_8BYTES(p_config->pal_buf_size); size += ALIGN_TO_8BYTES(p_config->bmp_buf_size); size += ALIGN_TO_8BYTES(p_config->script_buf_size); p_rsc_info->p_heap_addr = mmi_create_memp(&p_rsc_info->heap, size); MT_ASSERT(p_rsc_info->p_heap_addr != NULL); /* common data buffer */ if(p_config->comm_buf_size > 0) { p_rsc_info->p_comm_buf_addr = rsc_alloc(p_rsc_info, p_config->comm_buf_size); MT_ASSERT(p_rsc_info->p_comm_buf_addr != 0); } p_rsc_info->comm_buf_size = p_config->comm_buf_size; /* bmp buffer */ init_rsc_comm_info((handle_t)p_rsc_info, RSC_COMM_BMP, p_config->bmp_buf_size); /* string table buffer */ init_rsc_comm_info((handle_t)p_rsc_info, RSC_COMM_STRTAB, p_config->strtab_buf_size); /* palette buffer */ init_rsc_comm_info((handle_t)p_rsc_info, RSC_COMM_PAL, p_config->pal_buf_size); /* font buffer */ init_rsc_comm_info((handle_t)p_rsc_info, RSC_COMM_FONT, p_config->font_buf_size); /* script buffer */ init_rsc_comm_info((handle_t)p_rsc_info, RSC_COMM_SCRIPT, p_config->script_buf_size); /*others*/ p_rsc_info->curn_language_id = RSC_INVALID_ID; p_rsc_info->curn_palette_id = RSC_INVALID_ID; p_rsc_info->p_rstyle_tab = p_config->p_rstyle_tab; p_rsc_info->rstyle_cnt = p_config->rstyle_cnt; p_rsc_info->p_fstyle_tab = p_config->p_fstyle_tab; p_rsc_info->fstyle_cnt = p_config->fstyle_cnt; p_rsc_info->flash_base = p_config->flash_base; return (handle_t)p_rsc_info; }
static rsconn_t *rsc_connect(const char *host, int port) { rsconn_t *c = rsc_alloc(); if (!c) return c; return rsc_connect_ex(host, port, c); }