Ejemplo n.º 1
0
INT32 map_city_check_input_name(UINT16* uni_name)
{
	char ansi_name[30],new_name[60];
	UINT16 unicode_tmp[MAP_CITY_NAME_LEN];
	OBJLIST* ol;
	UINT16 i,page,index,curitem,valid_idx;
	UINT8 back_saved;
	SYSTEM_DATA* sys_data = sys_data_get();

	if (ComUniStrLen(uni_name) == 0)
	{
		win_compopup_init(WIN_POPUP_TYPE_OK);
		win_compopup_set_msg(NULL,NULL, RS_MSG_NAME_EMPTY);
		win_compopup_open_ext(&back_saved);
		return -2;
	}
	
	memset((void *)unicode_tmp,0x0,sizeof(unicode_tmp));
	memcpy((void *)unicode_tmp,(void *)uni_name,(sizeof(unicode_tmp[0]) * (MAP_CITY_NAME_LEN - 1)) );
	ComUniStrToAsc((UINT8*)unicode_tmp,ansi_name);
	
	for(i=0;i<MAP_CITY_MAX_NUM;i++)
	{
		ComUniStrToAsc((UINT8*)sys_data->map_city_name[i],new_name);
		if(STRCMP(ansi_name, new_name) == 0)
		{
			win_compopup_init(WIN_POPUP_TYPE_OK);
			win_compopup_set_msg(NULL,NULL, RS_DISPLAY_NAME_EXIST);
			win_compopup_open_ext(&back_saved);
			return -1;
		}
	}

	return 0;
}
Ejemplo n.º 2
0
static PRESULT  netping_item_edf_callback(POBJECT_HEAD pObj, VEVENT event, UINT32 param1, UINT32 param2)
{
	PRESULT ret = PROC_PASS;
	UINT8 bID;
	UINT8 status;
	EDIT_FIELD* edf;
	UINT8 back_save;
	UINT32 value;
	char strTmp[30];

	bID = OSD_GetObjID(pObj);

	edf = (EDIT_FIELD*)pObj;
	//libc_printf("pObj=%xh, event=%x, param1=%x, param2=%x\n",pObj, event, param1, param2);

	switch(event)
	{
	case EVN_KEY_GOT:
		if(bID == IDC_NETPING_URL/* && net_remote_cfg.url_type != 0*/)
		{
	#ifdef EAGLE_REQ
		UINT32 value;
		SYSTEM_DATA* sys_data;
    		sys_data = sys_data_get();
	#endif
			ret = mobile_input_proc(edf,(VACTION)(param1>>16), param1 & 0xFFFF, param2);
	#ifdef EAGLE_REQ
		value = OSD_GetEditFieldContent(&netping_item_url);
		ComUniStrToAsc((UINT8 *)value,sys_data->internet_ping_str);
	#endif
		}
		break;
		
	case EVN_PRE_CHANGE:
		break;
		
	case EVN_POST_CHANGE:
		//libc_printf("POST: ip %xh, get value = %xh\n",param1,OSD_GetEditFieldContent((PEDIT_FIELD)pObj));
		break;

	case EVN_FOCUS_PRE_GET:
	case EVN_PARENT_FOCUS_PRE_GET:
		netping_mobile_input_init(bID);
		break;

	case EVN_FOCUS_PRE_LOSE:
	case EVN_PARENT_FOCUS_PRE_LOSE:
		//netping_mobile_input_init(bID);
		break;

	case EVN_DATA_INVALID:
		win_compopup_init(WIN_POPUP_TYPE_OK);
		ComUniStrToAsc((UINT8 *)OSD_GetUnicodeString(RS_INVALID_ADDRESS_NUMBER),strTmp);
        win_compopup_set_msg(strTmp, NULL, 0);
		win_compopup_open_ext(&back_save);
		ret = PROC_LOOP;
		break;
	}
Ejemplo n.º 3
0
static UINT8 news_edit_check_input(void)
{
    EDIT_FIELD	*eft;
    UINT32 value = 0;
    char temp_name[NEWS_ADDR_NAME_LEN + 1] = {0};
    char temp_url[NEWS_ADDR_URL_LEN + 1] = {0};
    int i = 0;
    SYSTEM_DATA *p_sys_data = NULL;
    int num = 0;
    UINT8 new_name[60];

    eft = &edt_news_edit_item1;
    value = OSD_GetEditFieldContent(eft);
    ComUniStrToAsc((UINT8 *)value, temp_name);

    if (!STRLEN(temp_name))
    {
        return 1;
    }

    eft = &edt_news_edit_item2;
    value = OSD_GetEditFieldContent(eft);
    ComUniStrToAsc((UINT8 *)value, temp_url);

    if (!STRLEN(temp_url))
    {
        return 2;
    }

    p_sys_data = sys_data_get();
    num = news_addr_get_num();

    for (i = 0; i < num; i++)
    {
        ComUniStrToAsc(p_sys_data->news_addr[i].news_addr_name,new_name);
        if (!STRCMP(new_name, temp_name))
            //if (!STRCMP(p_sys_data->news_addr[i].news_addr_name, temp_name))
        {
            return 3;
        }
        else if (!STRCMP(p_sys_data->news_addr[i].news_addr_url, temp_url))
        {
            return 4;
        }
    }

    return 0;
}
Ejemplo n.º 4
0
static INT32 command_transfer (INT32 index, void (*callback)(INT32 type, INT32 process, UINT8 *str))
{
	UINT32 id,transLen=0;
	UINT32 chunk_pos;
	BYTE *p = NULL;
	char strTmp[30];
	struct sto_device* sto_dev = NULL;

	id = pblock_list[index].id;
	chunk_pos = sto_chunk_goto(&id, 0xFFFFFFFF, 1);

	transLen = sto_fetch_long(chunk_pos + CHUNK_OFFSET);
	if(transLen == 0)
		transLen = sto_fetch_long(chunk_pos + CHUNK_LENGTH) + 16;

	if (chunk_pos == (UINT32)ERR_PARA || chunk_pos == (UINT32)ERR_FAILUE)
	{
		ComUniStrToAsc((UINT8 *)OSD_GetUnicodeString(RS_ERROR_601),strTmp);
		callback(2,0,strTmp);
		return !SUCCESS;
	}

	p = ((unsigned char *)FLASH_BASE) + chunk_pos;
	
	
	return (INT32)cmd_transfer(p, transLen, UpgradeProgress, get_exit_key);
}
Ejemplo n.º 5
0
static BOOL ConvertIP2int2(UINT16 *pString, UINT32 *pValue)
{
	//strings: "192.168.9.1"
	char asc_str[32];
	UINT32 i, j, data,temp;
	UINT32 pos[4];
	
	ComUniStrToAsc((UINT8*)pString, asc_str);
	data = 0;
	for(i = 0, j = 0; i < STRLEN(asc_str); i++)
	{
		if(!IS_NUMBER_CHAR(asc_str[i]))
			pos[j++] = i; 
	}

	ASSERT(j == 3);
	for(i = 0, j = 0, data = 0; i < 4; i++)
	{
		temp = ATOI(&asc_str[j]);
		if(temp > 0xff)
		{
			*pValue = temp;
			return FALSE;
		}
		data += (temp<<((3-i)*8));
		j = pos[i]+1;
	}

	//libc_printf("asc_str = %s, data = %x\n", asc_str, data);
	*pValue = data;
	return TRUE;
}
Ejemplo n.º 6
0
static void nc_save_serinfo(UINT8 seridx)
{
	UINT32 value;
	UINT8 idx = seridx-1;
	UINT8 deskey[DESKEY_WITH_SEP_LEN+1]={0};
	UINT8 i,len;
	UINT8 keyvalue;


	value = OSD_GetEditFieldContent(&sp_item_edit6);
	ComUniStrToAsc((UINT8*)value, deskey);
	libc_printf("770 deskey=%s  %d\n",deskey,DESKEY_WITH_SEP_LEN);

#if  defined(ORDER_GZ1204004)||defined(ORDER_GZ1204005)
	for(i=0,len=0;len<20;i++,len++)
	{
		CccamNewcamdData.spidercam[len]=deskey[i];
	
	}
#else
	for(i=0,len=0;len<20;i++,len++)
	{
		CccamNewcamdData.spidercam[len]=deskey[i];
		i++;//跳过空格
	}
#endif
	CccamNewcamdSave();
}
Ejemplo n.º 7
0
UINT8 win_map_search_input_menu_open(char *string)
{
	CONTAINER	*win;
	PRESULT ret = PROC_LOOP;
	UINT32 hkey;
	TEXT_FIELD	*txt;
	EDIT_FIELD	*eft;
	UINT16 strID;
	UINT32 value = 0;
	UINT8 input_string[MAP_SEARCH_INPUT_LEN];

	BOOL old_value = ap_enable_key_task_get_key(TRUE);
	
	bMapSearchInputOK = FALSE;
	
 	txt = &txt_map_search_input_title;
 	
	strID = RS_HELP_SEARCH;
		
	OSD_SetTextFieldContent(txt, STRING_ID,(UINT32)strID);

	eft = &edt_map_search_input_item;
	OSD_SetEditFieldContent(eft, STRING_ANSI, "");

	win = &g_win_map_search_input;
	OSD_SetContainerFocus(win, 1);

	OSD_SetTextFieldContent(&txt_map_search_input_caps,STRING_ANSI,(UINT32)btn_txt_strs[0]);
	OSD_SetTextFieldContent(&txt_map_search_input_del,STRING_ANSI,(UINT32)btn_txt_strs[1]);
	OSD_SetTextFieldContent(&txt_map_search_input_ok,STRING_ANSI,(UINT32)btn_txt_strs[2]);	
	OSD_SetTextFieldContent(&txt_map_search_input_cancel,STRING_ANSI,(UINT32)btn_txt_strs[3]);

	wincom_backup_region(&(win->head.frame));

	OSD_ObjOpen((POBJECT_HEAD)win, 0);
	
	while(ret != PROC_LEAVE)
	{
	    hkey = ap_get_key_msg();
        if(hkey == INVALID_HK || hkey == INVALID_MSG)
            continue;

		ret = OSD_ObjProc((POBJECT_HEAD)win, (MSG_TYPE_KEY<<16),hkey, 0);
	}

	if (bMapSearchInputOK)
	{
		eft = &edt_map_search_input_item;
		value = OSD_GetEditFieldContent(eft);
		ComUniStrToAsc((UINT8 *)value, input_string);
		map_search_input_get_string(string, input_string);
	}

	wincom_restore_region();

    	ap_enable_key_task_get_key(old_value);
    	
	return bMapSearchInputOK;
}
Ejemplo n.º 8
0
static UINT8 map_search_input_check_input(void)
{
	EDIT_FIELD	*eft;
	UINT32 value = 0;
	char temp_name[MAP_SEARCH_INPUT_LEN + 1] = {0};
	
	eft = &edt_map_search_input_item;
	value = OSD_GetEditFieldContent(eft);
	ComUniStrToAsc((UINT8 *)value, temp_name);

	if (!STRLEN(temp_name))
	{
		return 1;
	}

	return 0;
}
Ejemplo n.º 9
0
UINT8 map_city_get_num(void)
{
	SYSTEM_DATA *p_sys_data = sys_data_get();
	int i = 0;
	int num = 0;
	UINT8 new_name[60];
	
	for (i = 0; i < MAP_CITY_MAX_NUM; i++)
	{
		ComUniStrToAsc(p_sys_data->map_city_name[i],new_name);
		if (STRLEN(new_name))
		{
			num++;
		}
	}

	return num;
}
Ejemplo n.º 10
0
INT32 favgrp_check_input_name(UINT16* uni_name)
{
	char ansi_name[30];
	UINT16 unicode_tmp[FAV_GRP_NAME_LEN];
	OBJLIST* ol;
	UINT16 i,top,cnt,page,index,curitem,valid_idx;
	UINT8 back_saved;

    if (ComUniStrLen(uni_name) == 0)
    {
		win_compopup_init(WIN_POPUP_TYPE_OK);
		win_compopup_set_msg(NULL,NULL, RS_MSG_NAME_EMPTY);
		win_compopup_open_ext(&back_saved);
        return -2;
    }

	SYSTEM_DATA* sys_data = sys_data_get();
	
	ol = &favgrplist_olist;

	cnt = OSD_GetObjListCount(ol);
	page = OSD_GetObjListPage(ol); 
	top = OSD_GetObjListTop(ol);
	curitem = OSD_GetObjListNewPoint(ol);

	memset((void *)unicode_tmp,0x0,sizeof(unicode_tmp));
	memcpy((void *)unicode_tmp,(void *)uni_name,(sizeof(unicode_tmp[0]) * (FAV_GRP_NAME_LEN - 1)) );
	ComUniStrToAsc((UINT8*)unicode_tmp,ansi_name);
	for(i=0;i<MAX_FAVGROUP_NUM;i++)
	{
		if(i==curitem)
			continue;

		if(STRCMP(ansi_name,sys_data->favgrp_names[i]) == 0)
		{
			win_compopup_init(WIN_POPUP_TYPE_OK);
			win_compopup_set_msg(NULL,NULL, RS_DISPLAY_NAME_EXIST);
			win_compopup_open_ext(&back_saved);
			return -1;		
		}			
	}

	return 0;
}
Ejemplo n.º 11
0
static void  win_favgrplst_set_display(void)
{
    CONTAINER* con;
    TEXT_FIELD* text;
	OBJLIST* ol;
	UINT16 i,top,cnt,page,index,curitem,valid_idx;	
    SYSTEM_DATA* sys_data = sys_data_get();

	ol = &favgrplist_olist;
char ee[30];
	cnt = OSD_GetObjListCount(ol);
	page = OSD_GetObjListPage(ol); 
	top = OSD_GetObjListTop(ol);
	curitem = OSD_GetObjListNewPoint(ol);
	

	for(i=0;i<page;i++)
    {
        con = (CONTAINER*)favgrplist_items[i];
		index = top + i;
		
		if(index< cnt)
			valid_idx = 1;
		else
			valid_idx = 0;		

        /* IDX */
        text = (TEXT_FIELD*)OSD_GetContainerNextObj(con); 
		if(valid_idx)
			OSD_SetTextFieldContent(text, STRING_NUMBER, index+ 1);
		else
			OSD_SetTextFieldContent(text, STRING_ANSI, (UINT32)"");
 
        /* Name**/
        text = (TEXT_FIELD*)OSD_GetObjpNext(text);
		ComUniStrToAsc(sys_data->favgrp_names[index],ee);
		libc_printf("\n88888888===%s\n",ee);
		if(valid_idx)
			OSD_SetTextFieldContent(text, STRING_UNICODE, (UINT32)sys_data->favgrp_names[index]);
		else
			OSD_SetTextFieldContent(text, STRING_ANSI, (UINT32)"");
        
	}    
}
Ejemplo n.º 12
0
UINT8 weathercitylst_get_num(void)
{
	SYSTEM_DATA *p_sys_data = sys_data_get();
	int i = 0;
	int num = 0;
	UINT8 new_name[60];

	for (i = 0; i < WEATHER_CITY_MAX_NUM; i++)
	{
		ComUniStrToAsc(p_sys_data->weather_city_name[i],new_name);

		if (STRLEN(new_name))
		{
			num++;
		}
	}

	return num;
}
Ejemplo n.º 13
0
static PRESULT favgrplst_list_callback(POBJECT_HEAD pObj, VEVENT event, UINT32 param1, UINT32 param2)
{
	PRESULT ret = PROC_PASS;
	VACTION unact;
	UINT16 uni_name[30];
	UINT8* new_name;
	OBJLIST* ol;
	UINT16 curitem;
    SYSTEM_DATA* sys_data = sys_data_get();

	ol = &favgrplist_olist;
	curitem = OSD_GetObjListNewPoint(ol);

	switch(event)
	{
	case EVN_PRE_DRAW:
		win_favgrplst_set_display();
		break;
	case EVN_UNKNOWN_ACTION:
		unact = (VACTION)(param1>>16);
		if(unact== VACT_FAV_EDIT)
		{
			ComAscStr2Uni(sys_data->favgrp_names[curitem], uni_name);
#ifndef KEYBOARD_SUPPORT
			if(win_rename_open(uni_name,&new_name,favgrp_check_input_name))
#else
			if(win_keyboard_rename_open(uni_name,&new_name,favgrp_check_input_name))
#endif
			{
				ComUniStrToAsc(new_name,sys_data->favgrp_names[curitem]);
			}
			OSD_TrackObject((POBJECT_HEAD)&g_win_favgrplst, C_DRAW_SIGN_EVN_FLG | C_UPDATE_ALL);
		//	wincom_open_title(pObj,RS_FAVORITE,0);
			wincom_open_subtitle(pObj,RS_FAVORITE,0);
		}
		break;
	}

	return ret;
}
Ejemplo n.º 14
0
BOOL win_tplist_set_search_pid_callback(P_NODE* node)
{
	UINT32 i;

	if(node->video_pid != tp_VPid)
		return FALSE;
	if(node->pcr_pid != tp_PPid)
		return FALSE;

	for(i=0;i<node->audio_count;i++)
	{
		if(node->audio_pid[i] == tp_APid)
			break;
	}
	if(i==node->audio_count)
		return FALSE;

	UINT8 str[60];
	ComUniStrToAsc(node->service_name, str);
	//soc_printf("v/a/p pid:%d/%d/%d %s\n",node->video_pid,node->audio_pid[i],node->pcr_pid,str);
	
	return TRUE;
}
Ejemplo n.º 15
0
static INT32 SlaveReorg(void (*callback)(INT32 type, INT32 process, UINT8 *str))
{
	UINT32 len,offset;
//	UINT8* p;
	UINT32 chunk_pos;
	INT32 i,j; 
	BOOL all_upg_flag = TRUE;
	char strTmp[30];
	char strTmp1[30];
#ifdef FORCE_UPGRADE_OLD_PROTOCOL_BOOTLOADER
	BOOL force_upgrade = FALSE;
#endif

	slave_reorg_size = 0;
	slave_burn_size = 0;

#ifdef FORCE_UPGRADE_OLD_PROTOCOL_BOOTLOADER
	// if upgrade protocol version is old protocol version 
	// and upgrade chunk include maincode or second loader
	// force upgrade bootloader
	if(g_protocol_version < NEW_PROTOCOL_VERSION)
	{
		for(i=1; i<block_number; i++)
		{
			if(pblock_list[i].upg_flag && 
				(((pblock_list[i].id & 0xFFFF0000) == 0x01FE0000)
				|| ((pblock_list[i].id & 0xFFFF0000) == 0x00FF0000)))
			{
				force_upgrade = TRUE;
				break;
			}
		}
		if(force_upgrade)
			pblock_list[0].upg_flag = 1;
	}

#endif

	for(i=1; i<block_number; i++)
	{
		if(pblock_list[i].upg_flag != 1)
		{
			all_upg_flag = FALSE;
			break;
		}
	}
	if((block_number != slave_blocks_number) && (!all_upg_flag))
	{
		return !SUCCESS;
	}
	if(all_upg_flag)
	{
		slave_reorg_number = block_number;

		pslave_reorg_list = (CHUNK_LIST2 *)MALLOC(sizeof(CHUNK_LIST2)*slave_reorg_number);
		if(pslave_reorg_list == NULL) return !SUCCESS;

		chunk_pos = sto_chunk_goto(&pblock_list[0].id, 0xFFFFFFFF, 1);
		offset = sto_fetch_long(chunk_pos + CHUNK_OFFSET);

		pslave_reorg_list[0].type = 1;  //move
		pslave_reorg_list[0].index= 0;
		pslave_reorg_list[0].offset = offset;

		for(i=1; i<block_number; i++)
		{
			chunk_pos = sto_chunk_goto(&pblock_list[i].id, 0xFFFFFFFF, 1);
			offset = sto_fetch_long(chunk_pos + CHUNK_OFFSET);
			pslave_reorg_list[i].type = 2;  //transfer
			pslave_reorg_list[i].index= i;
			pslave_reorg_list[i].offset = offset;
		}
	}
	else
	{
		slave_reorg_number = slave_blocks_number;
		for(i=1; i<block_number; i++)
		{
			if(pblock_list[i].upg_flag)
			{
				if(IsInSlave(pblock_list[i].id) != SUCCESS)
				{	
					return !SUCCESS;//slave_reorg_number++;   //add chunk
				}
			}
			else
			{
				if(slave_status != 0)
				{
					ComUniStrToAsc((UINT8 *)OSD_GetUnicodeString(RS_SLAVEDATA_DESTROY_UPDATE_ALLCODE),strTmp);
					callback(2,0,strTmp);
					return !SUCCESS;
				}
			}
		}

		pslave_reorg_list = (CHUNK_LIST2 *)MALLOC(sizeof(CHUNK_LIST2)*slave_reorg_number);
		if(pslave_reorg_list == NULL) return !SUCCESS;

		/*init pslave_reorg_list*/
		for(i=0; i<slave_reorg_number; i++)
		{
			pslave_reorg_list[i].type = 1;  //move chunk
			pslave_reorg_list[i].index= i;
			pslave_reorg_list[i].offset = pslave_list[i].offset;
		}

		for(i=1; i<block_number; i++)
		{
			if(pblock_list[i].upg_flag)
			{
				chunk_pos = sto_chunk_goto(&pblock_list[i].id, 0xFFFFFFFF, 1);
				offset = sto_fetch_long(chunk_pos + CHUNK_OFFSET);

				/*replace chunk*/
				for(j=0; j<slave_blocks_number; j++)
				{
					if(pslave_reorg_list[j].type == 1 && pslave_list[pslave_reorg_list[j].index].id == pblock_list[i].id)
					{
	                /*
	                //frank disnable
#if (SYS_CHIP_MODULE == ALI_M3327C && SYS_SDRAM_SIZE == 2)
						if(ID_TYPE(pblock_list[i].id)!=TEMPDB_ID || slave_status!=0)
#endif
	                */
						{
							pslave_reorg_list[j].type = 2;  //transfer
							pslave_reorg_list[j].index= i;
							pslave_reorg_list[j].offset = offset;
						}
						break;
					}
				}
			}
		}
	}
	/*upgrade bootloader*/
	if(((IsUpgBootloader(pslave_list[0].version)==SUCCESS) || m_allcode_include_bootloader) && (pblock_list[0].upg_flag==1))
	{
		chunk_pos = sto_chunk_goto(&pblock_list[0].id, 0xFFFFFFFF, 1);
		offset = sto_fetch_long(chunk_pos + CHUNK_OFFSET);

		pslave_reorg_list[0].type = 2;  //transfer
		pslave_reorg_list[0].index= 0;
		pslave_reorg_list[0].offset = offset;

		slave_reorg_size += offset;
		slave_burn_size += offset;
	}

	for(i=1; i<slave_reorg_number; i++)
	{
		if(pslave_reorg_list[i].type  == 1) //move
		{
            // Jie Wu, disable below line to let the progress bar move smoothly.
			//slave_reorg_size += pslave_list[pslave_reorg_list[i].index].len+16;
			if(pslave_reorg_list[i].offset == 0)
				slave_burn_size += pslave_list[pslave_reorg_list[i].index].len+16;
			else
				slave_burn_size += pslave_reorg_list[i].offset;
		}
		else //transfer
		{
			chunk_pos = sto_chunk_goto(&pblock_list[pslave_reorg_list[i].index].id, 0xFFFFFFFF, 1);
			len = sto_fetch_long(chunk_pos + CHUNK_OFFSET);
			if(len == 0)
				len = sto_fetch_long(chunk_pos + CHUNK_LENGTH) + 16;
			slave_reorg_size += len;

			if(pslave_reorg_list[i].offset == 0)
				slave_burn_size += len ;
			else
				slave_burn_size += pslave_reorg_list[i].offset;
		}
	}

	if(pslave_reorg_list[0].type == 2)  //transfer bootloader
	{
		if(slave_burn_size > slave_Flash_type)
		{
			ComUniStrToAsc((UINT8 *)OSD_GetUnicodeString(RS_UPDATE_DATE_LARGE_FAILED),strTmp1);
			callback(2,0,strTmp1);
			return !SUCCESS;
		}
	}
	else
	{
		if(pslave_list[0].offset+slave_burn_size > slave_Flash_type)
		{
			ComUniStrToAsc((UINT8 *)OSD_GetUnicodeString(RS_UPDATE_DATE_LARGE_FAILED),strTmp1);
			callback(2,0,strTmp1);
			return !SUCCESS;
		}
	}
	return SUCCESS;
}
Ejemplo n.º 16
0
static BOOL init_slave()
{
    UINT8 *ptr_data_buf, *ptr_temp_buf;
    UINT32 ptr_zip_pos;
    UINT8 zero_buf[16];
    UINT32 slave_addr;
    UINT32 total_len, len, chid;
    int ret;
    UINT32 i;
    char strTmp[30];
    char strTmp1[30];

	ComUniStrToAsc((UINT8 *)OSD_GetUnicodeString(RS_INIT_SLAVER),strTmp);
    callback_fun(2, 0, strTmp);
    P2PUPG_DBG("init_slave\n");

//     init slave sdram
    for(i=0; i<sizeof(m_SlaveConfig)/sizeof(m_SlaveConfig[0]); i++)
    {
        osal_task_sleep(50);
//        if(0xb8000029 == m_SlaveConfig[i].Address)
//        {
//		if(sys_ic_is_M3101())
//			m_SlaveConfig[i].Data = *((volatile UINT8 *)m_SlaveConfig[i].Address) & 0x07;
//		else
//			m_SlaveConfig[i].Data = *((volatile UINT8 *)m_SlaveConfig[i].Address) & 0x1c;
//        }
        erom_wm(m_SlaveConfig[i].Address, &m_SlaveConfig[i].Data, 1, 0);
    }

//     set upgrade param
    init_upgrade_param();
    for(i=0; i<sizeof(EROM_UPGRADE_PARAM); i+=sizeof(UINT32))
    {
        if(!send_upgrade_param(i))
        {
        	ComUniStrToAsc((UINT8 *)OSD_GetUnicodeString(RS_SEND_UPGRADE_PARAM_FAILED),strTmp1);
            callback_fun(2, 0,strTmp1);
            return FALSE;
        }
            

    }
    P2PUPG_DBG("send_upgrade_param OK\n");

    unsigned long chunk_id = g_upge_feature_config.chip_flashwr;
    ptr_zip_pos = (UINT8 *)sto_chunk_goto(&chunk_id, 0xFFFFFFFF, 1);
    unsigned long zip_size = sto_fetch_long(ptr_zip_pos + CHUNK_LENGTH);
    ptr_zip_pos += CHUNK_HEADER_SIZE;
    ptr_data_buf = (UINT8 *)bk_buff;   // 48KB for unzip buffer
    ptr_temp_buf = (UINT8 *)(bk_buff + 0xC000);    // 16KB for temp buffer
    P2PUPG_DBG("ptr_zip_pos = 0x%x\n ptr_data_buf = 0x%x\n ptr_temp_buf = 0x%x\n",ptr_zip_pos,ptr_data_buf,ptr_temp_buf);
    if(g_upge_feature_config.enable_lzma_out_read == TRUE)
        ret = un7zip(ptr_zip_pos+SYS_FLASH_BASE_ADDR, zip_size, ptr_temp_buf, 0x4000, ptr_data_buf, 0xC000, NULL);
    else
        ret = un7zip(ptr_zip_pos+SYS_FLASH_BASE_ADDR, ptr_data_buf, ptr_temp_buf);
    P2PUPG_DBG("un7zip ret=%d\n",ret);
    if(ret)
        return FALSE;
    P2PUPG_DBG("un7zip OK");
    MEMCPY(&total_len, ptr_temp_buf, sizeof(unsigned int));
    P2PUPG_DBG("total_len =%d\n",total_len);

    uart_high_speed_config(UART_SPEED_NORMAL);
    // download flashwr
    erom_download(FLASHWR_RUN_ADDR, ptr_data_buf, total_len);
    // init slave config buffer
        P2PUPG_DBG("erom_download1 OK\n");

    MEMSET(zero_buf, 0, sizeof(zero_buf));
    erom_download(FWCFG_START_ADDR, zero_buf, sizeof(zero_buf));
            P2PUPG_DBG("erom_download2 OK\n");

    // download config chunk
    chid = g_upge_feature_config.chip_config;
    if((chid!=0)&&(chid!=0xFFFFFFFF))
    {
        ptr_data_buf = sto_chunk_goto(&chid, 0xFFFFFFFF, 1);
        P2PUPG_DBG("ptr_data_buf=0x%x\n",ptr_data_buf);

        if(ptr_data_buf != NULL)
        {
            total_len = sto_fetch_long((unsigned long)(ptr_data_buf+CHUNK_OFFSET));
            erom_download(FWCFG_START_ADDR, ptr_data_buf, total_len);
        }
    }


    if(UPGRADE_SINGLE == upgrade_mode)
    {
        erom_setpc(FLASHWR_RUN_ADDR);
        osal_task_sleep(50);
        sci_mode_set(p2p_uart_id, 115200, SCI_PARITY_EVEN);
        osal_task_sleep(100);
        config_uart_speed(UART_DOWNLOAD_SPEED);
    }

    return TRUE;
}
Ejemplo n.º 17
0
static void cti_mat_display(BOOL update)
{
	char str[100];
	cas_sc_t cardinfo;
	UINT8 *uniStr=NULL;

	memset(&cardinfo,0,sizeof(cas_sc_t));
	cas_get_sc_info_req(&cardinfo);

	if(cardinfo.sc_status==0)
	{
		memset(str,0,sizeof(str));
		//sprintf(str,"%s","Maturity Level");
		uniStr = OSD_GetUnicodeString(RS_CTI_MATURITY_RATING);
		ComUniStrToAsc(uniStr,str);
		OSD_SetTextFieldContent(&cti_mat_item_txt1, STRING_ANSI, (UINT32)(str));

		memset(str,0,sizeof(str));
		//sprintf(str,"%s","Input PIN to modify");
		uniStr = OSD_GetUnicodeString(RS_CTI_INPUT_PIN);
		ComUniStrToAsc(uniStr,str);
		OSD_SetTextFieldContent(&cti_mat_item_txt2, STRING_ANSI, (UINT32)(str));

		OSD_SetMultiselSel(&cti_mat_item_select, cardinfo.parental_rating);

		memset(str,0,sizeof(str));
		sprintf(str,"%s","--------");
		input_pin_char_cnt=0;
		memset(input_pin_chars,0,sizeof(input_pin_chars));
		OSD_SetTextFieldContent(&cti_mat_item_pin, STRING_ANSI, (UINT32)(str));
		OSD_SetContainerFocus(&g_win_cti_set_maturity,1);

	}
	else
	{
		memset(str,0,sizeof(str));
		if(cardinfo.sc_insert==1)//card in ,reading card
			sprintf(str,"%s","Reading smart card.");
		else
			sprintf(str,"%s","Smart card error!");
		OSD_SetTextFieldContent(&cti_mat_item_txt1, STRING_ANSI, (UINT32)(str));

		memset(str,0,sizeof(str));
		sprintf(str,"%s","");
		OSD_SetTextFieldContent(&cti_mat_item_txt2, STRING_ANSI, (UINT32)(str));

		OSD_SetMultiselSel(&cti_mat_item_select, MATURITY_LEVEL_COUNT);

		memset(str,0,sizeof(str));
		sprintf(str,"%s","");
		input_pin_char_cnt=0;
		memset(input_pin_chars,0,sizeof(input_pin_chars));
		OSD_SetTextFieldContent(&cti_mat_item_pin, STRING_ANSI, (UINT32)(str));

		OSD_SetContainerFocus(&g_win_cti_set_maturity,0);

	}

	if(update)
	{
		OSD_DrawObject((POBJECT_HEAD )&cti_mat_item_con1,C_UPDATE_ALL);
		OSD_DrawObject((POBJECT_HEAD )&cti_mat_item_con2,C_UPDATE_ALL);
		if(cardinfo.sc_status==0)
		{
			OSD_TrackObject((POBJECT_HEAD )&cti_mat_item_con1,C_DRAW_SIGN_EVN_FLG| C_UPDATE_ALL);
		}
	}

}
Ejemplo n.º 18
0
static void nc_save_serinfo(UINT8 seridx)
{
	UINT32 value;
	UINT8 idx = seridx-1;
	UINT8 deskey[DESKEY_WITH_SEP_LEN+1]={0};
	UINT8 i,len;
	UINT8 keyvalue;

	// get sel value
	newcamd_serinfo[idx].bActive= OSD_GetMultiselSel(&nc_item_selt1);
	newcamd_serinfo[idx].bDNS_enable= OSD_GetMultiselSel(&nc_item_selt2);
	newcamd_serinfo[idx].bAutouser= OSD_GetMultiselSel(&nc_item_selt3);

	// get sername
	//value = OSD_GetEditFieldContent(&nc_item_edit1);
	//ComUniStrToAsc((UINT8 *)value,newcamd_serinfo[idx].name );
		
	// get url
	value = OSD_GetEditFieldContent(&nc_item_edit2);
	if(newcamd_serinfo[idx].use_ip_domain== 0)
		newcamd_serinfo[idx].ip = htonl(value);
	else
		ComUniStrToAsc((UINT8 *)value,newcamd_serinfo[idx].domain);

	//get port 
	newcamd_serinfo[idx].port= OSD_GetEditFieldContent(&nc_item_edit3);
	
	// get user name
	value = OSD_GetEditFieldContent(&nc_item_edit4);
	ComUniStrToAsc((UINT8*)value, newcamd_serinfo[idx].username);

	// get user password
	value = OSD_GetEditFieldContent(&nc_item_edit5);
	ComUniStrToAsc((UINT8*)value, newcamd_serinfo[idx].userpwd);

	value = OSD_GetEditFieldContent(&nc_item_edit6);
	ComUniStrToAsc((UINT8*)value, deskey);

	for(i=0,len=0; i<DESKEY_WITH_SEP_LEN; i++)
	{
		if((i%(SEPERATE_MODE+1))==SEPERATE_MODE) continue;
		keyvalue=0;

		if( ( deskey[i]>='0' && deskey[i]<='9' ))// ||(deskey[i]>='a' && deskey[i]<='f') || (deskey[i]>='A' && deskey[i]<='F') )
		{
			keyvalue = deskey[i]-'0';
		}
		else if(deskey[i]>='A' && deskey[i]<='F')
		{
			keyvalue = deskey[i]-'A'+10;
		}
		else if(deskey[i]>='a' && deskey[i]<='f')
		{
			keyvalue = deskey[i]-'a'+10;
		}

		if((len%2)==0)
		{
			newcamd_serinfo[idx].deskey[len/2]=keyvalue<<4;
		}
		else if(len%2==1)
		{
			newcamd_serinfo[idx].deskey[len/2]|=keyvalue;
		}
		len++;
	}
}
Ejemplo n.º 19
0
INT32 sys_upgrade_process(void (*callback)(INT32 type, INT32 process, UINT16 *str), UINT32 (*GetExitKey)(void), int nType)
{
	UINT32 result = SUCCESS;
	INT32 i;
	INT32 retry_count=0;
	BOOL bReboot = TRUE;
	BOOL bBurn = TRUE;
	char strTmp[30];
	char strTmp1[30];
	char strTmp2[30];
	char strTmp3[30];
	char strTmp4[30];
	char strTmp5[30];
	char strTmp6[30];
	char strTmp7[30];
	char strTmp8[30];
	char strTmp9[30];
	char strTmp10[30];
	char strTmp11[30];
	char strTmp12[30];
	char strTmp13[30];
	char strTmp14[30];

	if(nType == 2 || nType == 3)
		bReboot = FALSE;
	
	if(nType == 3)
		bBurn = FALSE;
	
	get_exit_key = GetExitKey;
	callback_fun = callback;
	
	LV_pPanDev = (struct pan_device *) dev_get_by_type(NULL, HLD_DEV_TYPE_PAN);
	if(NULL == LV_pPanDev)
	{
		PRINTF("dev_get_by_name failed\n");
		return !SUCCESS;
	}
	if(pan_open(LV_pPanDev)!=SUCCESS)
	{
		PRINTF("pan_open failed\n");
		return !SUCCESS;
	}

	//pan_display(LV_pPanDev,  "up9 ", 4);
#ifdef THREE_DIGITS_PANEL
	pan_display(LV_pPanDev,  " up9", 4);
#else
	pan_display(LV_pPanDev,  "up9 ", 4);
#endif

#ifdef ENABLE_EROM
    init_buffer();
//    uart_reset();
    osal_task_sleep(100);
    uart_high_speed_config(UART_SPEED_NORMAL);
    do
    {
        if(!sync_slave((UPGRADE_MULTI==upgrade_mode)?M2S_MODE:P2P_MODE, 1000))
            return !SUCCESS; ;
        //uart_high_speed_config(UART_HIGH_SPEED_2M);
        if(!init_slave()) // after init slave, uart 6M high bitrate is applied
            return !SUCCESS;;
    }while(0);
#endif

	MG_Setup_CRC_Table();

	/* Check sci port */
	ComUniStrToAsc((UINT8 *)OSD_GetUnicodeString(RS_MSG_UPGRADE_CHECK_SERIAL_PORT),strTmp);
	callback(3,0,strTmp);

	result = cmd_comtest(&g_protocol_version, NULL, GetExitKey);
	if(result != SUCCESS)
	{
		pan_display_error(result);
		ComUniStrToAsc((UINT8 *)OSD_GetUnicodeString(RS_CONNECT_FAILED),strTmp1);
		callback(2,0,strTmp1);
		return !SUCCESS;
	}

    	p2p_delay();
    ComUniStrToAsc((UINT8 *)OSD_GetUnicodeString(RS_COLLECTING_VERSION_INFO),strTmp2);
	callback(2,0,strTmp2);
	if((result = cmd_version(&g_protocol_version)) != SUCCESS)
	{
		pan_display_error(result);
		ComUniStrToAsc((UINT8 *)OSD_GetUnicodeString(RS_UPDATE_FAILED_TRY_AGAIN),strTmp3);
		callback(2, 0, strTmp3);
		return !SUCCESS;
	}
	
	
	p2p_delay();
	ComUniStrToAsc((UINT8 *)OSD_GetUnicodeString(RS_COMPARE_SLAVE_REORG),strTmp4);
	callback(2,0,strTmp4);
	if((result =SlaveReorg(callback)) != SUCCESS)
	{
		ComUniStrToAsc((UINT8 *)OSD_GetUnicodeString(RS_UPDATE_FAILED_TRY_AGAIN),strTmp5);
		callback(2,0,strTmp5);
		return !SUCCESS;
	}

	p2p_delay();

	UINT32 addr = 0x0;
	if(pslave_reorg_list[0].type == 2)  //transfer bootloader
	{
		addr = 0x0;
	}
	else
	{
#if (SYS_PROJECT_FE	== PROJECT_FE_DVBT && SYS_SDRAM_SIZE == 2)
		addr = 0x7800;
#else
#if (SYS_CHIP_MODULE == ALI_M3327C && SYS_SDRAM_SIZE == 2)
		//addr = 0xc000;
		//add logo data, so the address is changed
        addr = 0x8000;
#else
		addr = pslave_list[0].offset;
#endif
#endif
	}
	if((result = cmd_address(addr)) != SUCCESS)
	{
		pan_display_error(result);
		ComUniStrToAsc((UINT8 *)OSD_GetUnicodeString(RS_UPDATE_FAILED_TRY_AGAIN),strTmp6);
		callback(2, 0, strTmp6);
		return !SUCCESS;
	}

	trans_size = 0;
	prog = 0;
	ComUniStrToAsc((UINT8 *)OSD_GetUnicodeString(RS_TRANSFERING_DATA),strTmp7);
	callback(3,0,strTmp7);
#if (SYS_CHIP_MODULE != ALI_M3327C || SYS_SDRAM_SIZE != 2)
	pan_display(LV_pPanDev,  "u0  ", 4);
#endif
	for(i=0; i<slave_reorg_number;i++)
	{
		p2p_delay();

		if(pslave_reorg_list[i].type==1) //move
		{
			if(i==0)  continue;
			result = command_move(pslave_reorg_list[i].index, pslave_reorg_list[i].offset, callback);
			if(result != SUCCESS)
			{
				pan_display_error(result);
				ComUniStrToAsc((UINT8 *)OSD_GetUnicodeString(RS_MOVE_FAILED_TRY_AGAIN),strTmp8);
				callback(2,0,strTmp8);
				return !SUCCESS;
			}
			
		}
		else //transfer
		{
			result = command_transfer(pslave_reorg_list[i].index,callback);
			if(result != SUCCESS)
			{
				pan_display_error(result);
				ComUniStrToAsc((UINT8 *)OSD_GetUnicodeString(RS_TRANSFER_FAILED_TRY_AGAIN),strTmp9);
				callback(2,0,strTmp9);
				return !SUCCESS;
			}
		}
	}
#if (SYS_CHIP_MODULE != ALI_M3327C || SYS_SDRAM_SIZE != 2)
	pan_display(LV_pPanDev,  "100 ", 4);
#endif

    	p2p_delay();
	/* Send command to burn flash */
	ComUniStrToAsc((UINT8 *)OSD_GetUnicodeString(RS_MSG_UPGRADE_BURN_FLASH),strTmp10);
	callback(3,0,strTmp10);
	pan_display(LV_pPanDev,  "burn ", 4);
		
#if (SYS_CHIP_MODULE != ALI_M3327C || SYS_SDRAM_SIZE != 2)
	pan_display(LV_pPanDev,  "b0  ", 4);
#endif

	if((result = command_burn_new(callback, bBurn)) != SUCCESS)
	{
		pan_display_error(result);
		ComUniStrToAsc((UINT8 *)OSD_GetUnicodeString(RS_UPDATE_FAILED_TRY_AGAIN),strTmp11);
		callback(2,0,strTmp11);
		return !SUCCESS;
	}
		
#if (SYS_CHIP_MODULE != ALI_M3327C || SYS_SDRAM_SIZE != 2)
	pan_display(LV_pPanDev,  "100 ", 4);
#endif
	pan_display(LV_pPanDev,  "end ", 4);
	/*reboot slaver*/
	if(bReboot)
	{
		ComUniStrToAsc((UINT8 *)OSD_GetUnicodeString(RS_REBOOTING_SLAVER),strTmp12);
		callback(2,0,strTmp12);
	    if(command_reboot(callback) != SUCCESS)
	    {
	    	ComUniStrToAsc((UINT8 *)OSD_GetUnicodeString(RS_UPDATE_FAILED_TRY_AGAIN),strTmp13);
	        callback(2,0,strTmp13);
	        return !SUCCESS;
	    }
	}
	ComUniStrToAsc((UINT8 *)OSD_GetUnicodeString(RS_UPDATE_SUCCESSFUL),strTmp14);
	callback(2, 0, strTmp14);

	return SUCCESS;
}
Ejemplo n.º 20
0
static PRESULT netping_item_con_callback(POBJECT_HEAD pObj, VEVENT event, UINT32 param1, UINT32 param2)
{
    PRESULT ret = PROC_PASS;
    VACTION unact;
#ifdef EAGLE_REQ
	SYSTEM_DATA* sys_data;

    	sys_data = sys_data_get();
#endif
    UINT8 bID = OSD_GetObjID(pObj);

	switch(event)
	{
		case EVN_UNKNOWN_ACTION:
		unact = (VACTION)(param1 >> 16);
		/*if ((unact == VACT_ABORT) && (download_started == 1))
		{
		    libnet_download_abort(upgrade_handle);
		    upgrade_handle = 0;
		    download_started = 0;
		    win_netupg_msg_update("User abort!");
		}*/
		if ((bID == IDC_NETPING_START) &&(unact == VACT_ENTER) && (download_started == 0))
		{
			UINT32 value;
			int packet_num,timeout;
			char msg[128];
			UINT8 back_saved;

			/*	sprintf(msg, "Connecting,please wait!");
				win_compopup_init(WIN_POPUP_TYPE_SMSG);
				win_compopup_set_frame(510,330,370,180); 
				win_compopup_set_msg_ext(msg, NULL, 0);
				win_compopup_open_ext(&back_saved);	
			*/
		    	download_started = 1;
		    	//ping_start();//netupg_start();

			value = OSD_GetEditFieldContent(&netping_item_url);
			/*if(net_remote_cfg.url_type == 0)
				net_remote_cfg.url_int = htonl(value);
			else*/
			ComUniStrToAsc((UINT8 *)value,net_remote_cfg.url_str);
			//soc_printf("\n==url_str==%s\n",net_remote_cfg.url_str);
			
			if(netping_item_tcpip_type.nSel==0)
				packet_num=0xffffffff;
			else
				packet_num=5;
			
			timeout=(netping_item_url_type.nSel+1)*1000;

			/*{
				char msg[128];
				sprintf(msg, "Ping %s %s,every %d seconds",net_remote_cfg.url_str,packet_num==5?"5 times":"forever",netping_item_url_type.nSel+1);
				win_netping_msg_update(msg);
			}*/
			libnet_flag=1;
			#ifdef EAGLE_REQ
			libnet_start_ping(sys_data->internet_ping_str,64, packet_num, timeout);
			#else
			libnet_start_ping(net_remote_cfg.url_str,64, packet_num, timeout);
			#endif
		}      
		break;

		default:
		break;
	}
	
    return ret;
}
Ejemplo n.º 21
0
/* Updata whole flash with LED support only */
INT32 sys_upgrade4(char* ledstr,void (*callback)(INT32 type, INT32 process, UINT8 *str), UINT32 (*GetExitKey)(void))
{
	UINT32 result = SUCCESS;
	INT32 i;
	INT32 retry_count=0;
	char strTmp[30];
	char strTmp1[30];
	char strTmp2[30];
	char strTmp3[30];
	char strTmp4[30];
	char strTmp5[30];
	char strTmp6[30];
	char strTmp7[30];
	char strTmp8[30];
	char strTmp9[30];
	
	get_exit_key = GetExitKey;
	callback_fun = callback;

	
	LV_pPanDev = (struct pan_device *) dev_get_by_type(NULL, HLD_DEV_TYPE_PAN);
	if(NULL == LV_pPanDev)
	{
		PRINTF("dev_get_by_name failed\n");
		return !SUCCESS;
	}
	if(pan_open(LV_pPanDev)!=SUCCESS)
	{
		PRINTF("pan_open failed\n");
		return !SUCCESS;
	}

	//pan_display(LV_pPanDev,  "up9 ", 4);
#ifdef THREE_DIGITS_PANEL
	pan_display(LV_pPanDev,  " up9", 4);
#else
	pan_display(LV_pPanDev,  "up9 ", 4);
#endif

	MG_Setup_CRC_Table();

	/* Check sci port */
	ComUniStrToAsc((UINT8 *)OSD_GetUnicodeString(RS_MSG_UPGRADE_CHECK_SERIAL_PORT),strTmp);
	callback(3,0,strTmp);

	result = cmd_comtest(&g_protocol_version, NULL, GetExitKey);
	if(result != SUCCESS)
	{
		pan_display_error(result);
		ComUniStrToAsc((UINT8 *)OSD_GetUnicodeString(RS_CONNECT_FAILED),strTmp1);
		callback(2,0,strTmp1);
		return !SUCCESS;
	}

    	p2p_delay();
    ComUniStrToAsc((UINT8 *)OSD_GetUnicodeString(RS_COLLECTING_VERSION_INFO),strTmp2);
	callback(2,0,strTmp2);
	if((result = cmd_version(&g_protocol_version)) != SUCCESS)
	{
		pan_display_error(result);
		ComUniStrToAsc((UINT8 *)OSD_GetUnicodeString(RS_UPDATE_FAILED_TRY_AGAIN),strTmp3);
		callback(2, 0, strTmp3);
		return !SUCCESS;
	}
	
	p2p_delay();


	if((result = cmd_address(0x0)) != SUCCESS)
	{
		pan_display_error(result);
		ComUniStrToAsc((UINT8 *)OSD_GetUnicodeString(RS_UPDATE_FAILED_TRY_AGAIN),strTmp4);
		callback(2, 0, strTmp4);
		return !SUCCESS;
	}

	trans_size = 0;
	prog = 0;
	ComUniStrToAsc((UINT8 *)OSD_GetUnicodeString(RS_TRANSFERING_DATA),strTmp5);
	callback(3,0,strTmp5);
#if (SYS_CHIP_MODULE != ALI_M3327C || SYS_SDRAM_SIZE != 2)
	pan_display(LV_pPanDev,  "u0  ", 4);
#endif
	result = command_transferraw(callback);
	if(result != SUCCESS)
   	{
		ComUniStrToAsc((UINT8 *)OSD_GetUnicodeString(RS_UPDATE_FAILED_TRY_AGAIN),strTmp6);
		callback(2, 0, strTmp6);
		return !SUCCESS;
   	}
#if (SYS_CHIP_MODULE != ALI_M3327C || SYS_SDRAM_SIZE != 2)
	pan_display(LV_pPanDev,  "u100 ", 4);
#endif

    	p2p_delay();
	/* Send command to burn flash */
	ComUniStrToAsc((UINT8 *)OSD_GetUnicodeString(RS_BURNING_FLASH),strTmp7);
	callback(3,0,strTmp7);
#if (SYS_CHIP_MODULE != ALI_M3327C || SYS_SDRAM_SIZE != 2)
	pan_display(LV_pPanDev,  "b0  ", 4);
#endif
	if((result = command_burn_new(callback, FALSE)) != SUCCESS)
	{
		pan_display_error(result);
		ComUniStrToAsc((UINT8 *)OSD_GetUnicodeString(RS_UPDATE_FAILED_TRY_AGAIN),strTmp8);
		callback(2,0,strTmp8);
		return !SUCCESS;
	}

#if (SYS_CHIP_MODULE != ALI_M3327C || SYS_SDRAM_SIZE != 2)
	pan_display(LV_pPanDev,  "100 ", 4);
#endif
	ComUniStrToAsc((UINT8 *)OSD_GetUnicodeString(RS_UPDATE_SUCCESSFUL),strTmp9);
	callback(2, 0,strTmp9);

	return SUCCESS;
}
Ejemplo n.º 22
0
static void dm_disk_show_hint(UINT32 dev_type, UINT32 dev_id, UINT32 hint_type)
{
	UINT8 i;
	UINT16 hint[128]={0};
	char strUsb[128];
	char strA[128];
	char strCon[128];
	char strUcon[128];
	char strSd[128];
	char strIde[128];
	char strSata[128];
	UINT8 back_saved;
	UINT16 *unistr=NULL;
	
#ifdef SUPPORT_CAS9
	if(get_mmi_showed()!=0)//mmi pri is high than this popup
		return;
#endif

#ifndef _SYSTEM_DVBC
	switch (dev_type)
	{
		case MNT_TYPE_USB:
			//sprintf(hint, "USB disk %c", dev_id+'A');
			ComUniStrToAsc((UINT8 *)OSD_GetUnicodeString(RS_USB_DISK),strUsb);
			ComUniStrToAsc((UINT8 *)OSD_GetUnicodeString(RS_KEY_A),strA);
			sprintf(hint," %c ",dev_id);
			strcat(strUsb,hint);
			strcat(strUsb,strA);
			strcat(strUsb," ");
			STRCPY(hint,strUsb);
			break;
		case MNT_TYPE_SD:
			ComUniStrToAsc((UINT8 *)OSD_GetUnicodeString(RS_SD_CARD),strSd);
			sprintf(hint, strSd);
			break;
		case MNT_TYPE_IDE:
			ComUniStrToAsc((UINT8 *)OSD_GetUnicodeString(RS_IDE_DISK),strIde);
			sprintf(hint, strIde);
			break;
		case MNT_TYPE_SATA:
			ComUniStrToAsc((UINT8 *)OSD_GetUnicodeString(RS_SATA_DISK),strSata);
			sprintf(hint, strSata);
			break;
		default:
			return;
	}

	switch (hint_type)
	{
		case DM_HINT_CONNECT:
			ComUniStrToAsc((UINT8 *)OSD_GetUnicodeString(RS_CONNECTED),strCon);
			strcat(hint,strCon);
			break;
		case DM_HINT_DISCONNECT:
			ComUniStrToAsc((UINT8 *)OSD_GetUnicodeString(RS_DISCONNECTED),strUcon);
			strcat(hint,strUcon);
			break;
		default:
			return;
	}
	DM_DEBUG("%s() show message: %s\n", __FUNCTION__, hint);
	win_compopup_init(WIN_POPUP_TYPE_SMSG);
	win_compopup_set_msg_ext(hint, NULL,  0);
	
#else

	if(hint_type==DM_HINT_CONNECT)
	{
		if(dev_type==MNT_TYPE_USB)
		{
			unistr=OSD_GetUnicodeString(RS_USB_DISK_CONNECTED);
			ComUniStrCopyChar(&hint,(UINT16 *)unistr);
			
		}
		else if(dev_type==MNT_TYPE_SD)
		{
			unistr=OSD_GetUnicodeString(RS_SD_CARD_CONNECTED);
			ComUniStrCopyChar(&hint,(UINT16 *)unistr);
		}
		else if(dev_type==MNT_TYPE_IDE)
		{
			unistr=OSD_GetUnicodeString(RS_IDE_DISK_CONNECTED);
			ComUniStrCopyChar(&hint,(UINT16 *)unistr);
		}
		else if(dev_type==MNT_TYPE_SATA)
		{
			unistr=OSD_GetUnicodeString(RS_SATA_DISK_CONNECTED);
			ComUniStrCopyChar(&hint,(UINT16 *)unistr);
		}

	}
	else if(hint_type==DM_HINT_DISCONNECT)
	{
		if(dev_type==MNT_TYPE_USB)
		{
			unistr=OSD_GetUnicodeString(RS_USB_DISK_DISCONNECTED);
			ComUniStrCopyChar(&hint,(UINT16 *)unistr);
			
		}
		else if(dev_type==MNT_TYPE_SD)
		{
			unistr=OSD_GetUnicodeString(RS_SD_CARD_DISCONNECTED);
			ComUniStrCopyChar(&hint,(UINT16 *)unistr);
		}
		else if(dev_type==MNT_TYPE_IDE)
		{
			unistr=OSD_GetUnicodeString(RS_IDE_DISK_DISCONNECTED);
			ComUniStrCopyChar(&hint,(UINT16 *)unistr);
		}
		else if(dev_type==MNT_TYPE_SATA)
		{
			unistr=OSD_GetUnicodeString(RS_SATA_DISK_DISCONNECTED);
			ComUniStrCopyChar(&hint,(UINT16 *)unistr);
		}
	}
	DM_DEBUG("%s() show message: %s\n", __FUNCTION__, hint);
	win_compopup_init(WIN_POPUP_TYPE_SMSG);
	win_compopup_set_msg_ext(NULL,hint,  0);
#endif

    #ifdef SUPPORT_CAS9
        win_compopup_set_frame(290, 250, 448, 100);
    #endif

	win_compopup_open_ext(&back_saved);	
	osal_task_sleep(1000);
	win_compopup_smsg_restoreback();
}
Ejemplo n.º 23
0
static PRESULT weather_msg_proc(UINT32 msg_type, UINT32 msg_code)
{
	PRESULT ret = PROC_LOOP;
	char msg[128];
	UINT8 back_saved;
	INT32 parse_ret = 0;
	char strTmp[30];
	char strTmp1[30];
	char strTmp2[30];
	char strTmp3[30];
	char strTmp4[30];

	switch(msg_type)
	{
	    case CTRL_MSG_SUBTYPE_STATUS_DOWNLOAD_FINISH:
	    		weath=0;
			if((int)msg_code >= 0)
			{
				win_compopup_smsg_restoreback();

				MEMSET(&weather_city,0,sizeof(weather_city));
				
				parse_ret = weather_parse(&weather_city);

				if (parse_ret == 0)
				{
					if(OSD_ObjOpen((POBJECT_HEAD)&g_win_internet_weather, 0xFFFFFFFF) != PROC_LEAVE)
					{	
						wincom_close_help();
						menu_stack_push((POBJECT_HEAD)&g_win_internet_weather);
					}
				}
				else
				{
			    		weather_terminate();

					win_compopup_smsg_restoreback();
					win_compopup_init(WIN_POPUP_TYPE_OK);		
					ComUniStrToAsc((UINT8 *)OSD_GetUnicodeString(RS_ERROR),strTmp);
					win_compopup_set_msg((UINT8*)strTmp,NULL,0);
					win_compopup_open_ext(&back_saved);
				}
			}
			else
			{
				weather_terminate();

				win_compopup_smsg_restoreback();
				win_compopup_init(WIN_POPUP_TYPE_OK);		
				
				switch (-msg_code)
				{
					case NET_ERR_CONNECT_FAILED:
					//ComUniStrToAsc((UINT8 *)OSD_GetUnicodeString(RS_CONNECT_TO_SERVER_FAILED),strTmp1);
					//STRCPY(msg, strTmp1);
					win_compopup_set_msg(NULL/*(UINT8*)msg*/,NULL,RS_CONNECT_TO_SERVER_FAILED);
						break;
					case NET_ERR_USER_ABORT:
					//ComUniStrToAsc((UINT8 *)OSD_GetUnicodeString(RS_USER_ABORT),strTmp2);
					//STRCPY(msg, strTmp2);
					win_compopup_set_msg(NULL/*(UINT8*)msg*/,NULL,RS_USER_ABORT);
						break;
					case NET_ERR_LOGIN_FAILED:
					//ComUniStrToAsc((UINT8 *)OSD_GetUnicodeString(RS_INVALID_USER_PASSWORD),strTmp3);
					//STRCPY(msg, strTmp3);
					win_compopup_set_msg(NULL/*(UINT8*)msg*/,NULL,RS_INVALID_USER_PASSWORD);
						break;
					default:
					//ComUniStrToAsc((UINT8 *)OSD_GetUnicodeString(RS_ERROR),strTmp4);
					//STRCPY(msg, strTmp4);
					win_compopup_set_msg(NULL/*(UINT8*)msg*/,NULL,RS_ERROR);
						break;
				}
				
				win_compopup_open_ext(&back_saved);
			}            

	        break;
	}
	
	return ret;
}
Ejemplo n.º 24
0
static PRESULT ci_info_win_callback(POBJECT_HEAD pObj, VEVENT event, UINT32 param1, UINT32 param2)
{
	PRESULT ret = PROC_PASS;
	UINT8	unact;
    
	switch(event)
	{
		case EVN_PRE_OPEN:
#if 0
            if (api_ci_get_mmi_enablestatus() == 0)
            {
                ret = PROC_LEAVE;
                break;
            }
#endif
			ci_info_init();
			break;
		case EVN_POST_OPEN:
			if(win_ci_info_modal == WIN_CI_INFO_SHOW_IN_MAINMENU)
			{
				//enter the menu
				api_ci_enter_menu(ci_slot);

				//show reading dialog
				//reading_dlg_shown = 0;
				if(!reading_dlg_shown)
					//reading_dlg_open("Reading data");
				 reading_dlg_open_strid(RS_READING_DATA);

			}
            else
            {
                win_ci_info_show = 1;
            }
            api_ci_set_mmi_visualstatus(1);
			break;

        case EVN_PRE_CLOSE:
            /* Make OSD not flickering */
            if(!api_is_sd_color_mode())
            {
			    *((UINT32*)param2) &= ~C_CLOSE_CLRBACK_FLG;
            }
            break;
	    case EVN_POST_CLOSE:
            api_ci_set_mmi_visualstatus(0);
            win_ci_info_show = 0;
			break;

		case EVN_MSG_GOT:
			ret = ci_info_event_proc(pObj,param1,param2);
			break;			
		case EVN_UNKNOWN_ACTION:
			unact = (VACTION)(param1>>16) ;
			if(unact == VACT_EXIT_CI_MENU)	
			{
				if(!reading_dlg_shown)
					//reading_dlg_open("Reading data");
					reading_dlg_open_strid(RS_READING_DATA);
				api_ci_menu_cancel(ci_slot);
			}
			else if(unact == VACT_CI_EQY_DLG_OK)
			{
				static UINT8 ci_enquiry_str[CI_ENQUIRY_MSG_LENGTH + 1];
				ci_enquiry_dlg_close();
				ComUniStrToAsc((UINT8*)ci_enqury_edit_sting, ci_enquiry_str);
				api_ci_enquiry_reply(ci_slot, ci_enquiry_str);
				
			}
			else if(unact == VACT_CI_EQY_DLG_CANCEL)
			{
				ci_enquiry_dlg_close();
				api_ci_enquiry_cancel(ci_slot);
			}
			ret = PROC_LOOP;
			
			break;
		default:
			break;
			
	}
	return ret;
	
}
Ejemplo n.º 25
0
static BOOL sync_slave(UINT8 mode, UINT32 sync_tmo)
{
    INT32 result, user_int, retry_count = 0;
    char strTmp[30];
	char strTmp1[30];
    char strTmp2[30];
	char strTmp3[30];
	char strTmp4[30];
	char strTmp5[30];
	
    if(UPGRADE_MULTI == upgrade_mode)
    {
    	ComUniStrToAsc((UINT8 *)OSD_GetUnicodeString(RS_SLAVES_OK_TO_CONTINUE),strTmp);
        callback_fun(3, 0,strTmp);
    }
    else
    {
    	ComUniStrToAsc((UINT8 *)OSD_GetUnicodeString(RS_SYNCHRONIZING),strTmp);
	    callback_fun(3, 0, strTmp1);
	}

    while(1)
    {
        sync_twinkle();
        result = erom_sync(sync_tmo, mode);
	    if(SUCCESS == result && UPGRADE_MULTI != upgrade_mode)
	    {
	    	ComUniStrToAsc((UINT8 *)OSD_GetUnicodeString(RS_SYNCHRONIZING_OK),strTmp1);
	        callback_fun(3, 0, strTmp1);
            break;
        }
        else
        {
         	ComUniStrToAsc((UINT8 *)OSD_GetUnicodeString(RS_PLEASE_RESET_TARGET),strTmp2);
           callback_fun(3, 0,strTmp2);  
		}
        user_int = get_exit_key();
		if(1 == user_int)
		{
			ComUniStrToAsc((UINT8 *)OSD_GetUnicodeString(RS_UPGRADE_ABORTE),strTmp3);
			callback_fun(2, 0, strTmp3);
			return FALSE;
		}

        if(UPGRADE_MULTI == upgrade_mode)
        {
            if(2 == user_int)
                break;
        }
        else
        {
    		retry_count++;
    		if(retry_count > MAX_RETRY_NUM*10)
    		{
    			ComUniStrToAsc((UINT8 *)OSD_GetUnicodeString(RS_SYNCHRONIZATION_FAILED),strTmp4);
    			callback_fun(2, 0,strTmp4);
    			return FALSE;
    		}
    		if(!(retry_count%10))
    		{
    			ComUniStrToAsc((UINT8 *)OSD_GetUnicodeString(RS_SYNCHRONIZATION_TIMEOUT_RETRY),strTmp5);
    			sprintf(msg, " %d", retry_count/10);
    			strcat(strTmp5,msg);
    			callback_fun(2, 0, strTmp5);
    		}
        }
    }
//    unsigned char data8 = 0x6;
//    erom_wm(0xB800009B,&data8,1,0);
    return TRUE;
}
Ejemplo n.º 26
0
static void maildetail_fill_content(void)
{
	UINT8 i;
	UINT32 iret=0;
	cas_bmail_u mail;
	char title[256] = {0};
	char from[256] = {0};
	char send_time[32]= {0};
	UINT16 content[1025] = {0};
	INT32 mail_get_success;
	
	UINT16 StrTemp[2048]={0};
	
	memset(&mail,0,sizeof(cas_bmail_u));

	mail_get_success =cas_get_bmail_by_pos(&mail,g_mail_curPos-1,TRUE);	
#if 1
	iret =0; //to get mail content
	if(iret==0)
	{//get mail content success

//		ComUniStrToAsc(mail.from_context,from);
//		ComUniStrToAsc(mail.title_context,title);
		sprintf(send_time,"%d/%02d/%02d %d:%02d:%02d",\
							mail.send_time.year,mail.send_time.month,mail.send_time.day,\
							mail.send_time.hour,mail.send_time.minute,mail.send_time.second);
		
		memset(StrTemp,0,sizeof(StrTemp));	
		sprintf(title,"%s","[Title:]");
		ComAscStr2Uni(title,StrTemp);
		ComUniStrCat(StrTemp,mail.title_context);
		OSD_SetTextFieldContent(&txt_mail_title, STRING_UNICODE, (UINT32)StrTemp);
		
		memset(StrTemp,0,sizeof(StrTemp));	
		sprintf(from,"%s","[From:]");
		ComAscStr2Uni(from,StrTemp);
		ComUniStrCat(StrTemp,mail.from_context);
		OSD_SetTextFieldContent(&txt_mail_from, STRING_UNICODE, (UINT32)StrTemp);

		memset(StrTemp,0,sizeof(StrTemp));	
		sprintf(StrTemp,"[Time:]%s",send_time);
		OSD_SetTextFieldContent(&txt_mail_time, STRING_ANSI, (UINT32)StrTemp);

		memcpy(content,mail.body_context,mail.body_len*2);
		mail_content[0].text.pString = mail.body_context;

//		ComUniStrToAsc(content,Strprint);
//		libc_printf("conten:%s\n",Strprint);
	
	}
#else  //test show
	if(iret==0)
	{//get mail content success

		ComUniStrToAsc(mail.from_context,from);
		ComUniStrToAsc(mail.title_context,title);
		sprintf(send_time,"%d-%02d-%02d %d:%02d:%02d",\
							mail.send_time.year,mail.send_time.month,mail.send_time.day,\
							mail.send_time.hour,mail.send_time.minute,mail.send_time.second);
		
		memset(StrTemp,0,sizeof(StrTemp));	
//		sprintf(StrTemp,"[From:]%s","Test mail from");
		OSD_SetTextFieldContent(&txt_mail_title, STRING_ANSI, (UINT32)StrTemp);
		
		memset(StrTemp,0,sizeof(StrTemp));	
//		sprintf(StrTemp,"[Title:]%s-%d","test mail title",g_mail_curPos-1);
		OSD_SetTextFieldContent(&txt_mail_from, STRING_ANSI, (UINT32)StrTemp);
		
		memset(StrTemp,0,sizeof(StrTemp));	
//		sprintf(StrTemp,"[Time:]%s","2010/03/08 12:30:18");
		OSD_SetTextFieldContent(&txt_mail_time, STRING_ANSI, (UINT32)StrTemp);

		memset(StrTemp,0,sizeof(StrTemp));	
//		sprintf(StrTemp,"[content:]Youth is not a time of life, it is a state of mind; it is not matter of rosy cheeks, red lips and supple knees, it is a matter of the will, a quality of the imagination. a rigor of the emotions; it is the freshness of the deep spring of life.Youth means a temperamental predominance of courage over timidity, of the appetite for adventure over the love of ease. This often exists in a man of 60 more than a boy of 20. Nobody grows old merely by a number of years. Years may wrinkle the skin. but to give up enthusiasm wrinkles the soul,worry,fear,self-distrust bows the heart and turns the spirit back to dust.Whether 60 or 16, there is in every human being's heart the lure of wonder, the unfailing child like appetite of what's next and the joy of the game of living. In the center of your heart and my heart there is a wireless station, So long as it receives messages of beauty hope,courage and power from men and from the infinite, so long are you young.");
		ComAscStr2Uni(StrTemp,content);
		mail_content[0].text.pString = content;
		
	}
#endif
	return iret;
	
}
Ejemplo n.º 27
0
static void cti_PPID_display(BOOL update)
{
	cas_sc_t cardinfo;
	//cas_PPID_list_t PPID_list;
	UINT8 i=0,j=0;
	char itemSN[50];
	char itemPPID[50];
	char itemName[50];
	UINT8 maxID=1;
	int ret=0;
	POSD_RECT pRECT=NULL;
	UINT8 *uniStr=NULL;

	//soc_printf("count=%d,ID=%d,idx=%d\n",g_PPID_count,g_PPID_curID,g_PPID_itemIdx);
	if(g_PPID_count<0)
	{
		memset(itemSN,0,sizeof(itemSN));
		memset(itemPPID,0,sizeof(itemPPID));
		memset(itemName,0,sizeof(itemName));
		
		//sprintf(itemSN,"%s","Smart card error!");
		uniStr = OSD_GetUnicodeString(RS_CTI_READ_SMC_ERROR);
		ComUniStrToAsc(uniStr,itemSN);
		pRECT = &cti_PPID_SN0.head.frame;
		OSD_SetRect(pRECT, pRECT->uLeft,pRECT->uTop,TXTN_W,pRECT->uHeight);
		OSD_SetTextFieldContent(&cti_PPID_SN0, STRING_ANSI, (UINT32)(itemSN));
		
		sprintf(itemPPID,"%s","");
		OSD_SetTextFieldContent(&cti_PPID_ID0, STRING_ANSI, (UINT32)(itemPPID));
		
		sprintf(itemName,"%s","");
		OSD_SetTextFieldContent(&cti_PPID_name0, STRING_ANSI, (UINT32)(itemName));
	}
	else
	{
		memset(itemSN,0,sizeof(itemSN));
		memset(itemPPID,0,sizeof(itemPPID));
		memset(itemName,0,sizeof(itemName));
		
		//sprintf(itemSN,"%s",title_str[0]);
		uniStr = OSD_GetUnicodeString(RS_CTI_INDEX);
		ComUniStrToAsc(uniStr,itemSN);
		pRECT = &cti_PPID_SN0.head.frame;
		OSD_SetRect(pRECT, pRECT->uLeft,pRECT->uTop,TXT1_W,pRECT->uHeight);
		OSD_SetTextFieldContent(&cti_PPID_SN0, STRING_ANSI, (UINT32)(itemSN));
		
		//sprintf(itemPPID,"%s",title_str[1]);
		uniStr = OSD_GetUnicodeString(RS_CTI_PROVIDER_ID);
		ComUniStrToAsc(uniStr,itemPPID);
		OSD_SetTextFieldContent(&cti_PPID_ID0, STRING_ANSI, (UINT32)(itemPPID));
		
		//sprintf(itemName,"%s",title_str[2]);
		uniStr = OSD_GetUnicodeString(RS_CTI_PROVIDER_NAME);
		ComUniStrToAsc(uniStr,itemName);
		OSD_SetTextFieldContent(&cti_PPID_name0, STRING_ANSI, (UINT32)(itemName));
		
		maxID = (g_PPID_count>MAX_ITEM_COUNT)?(MAX_ITEM_COUNT):(g_PPID_count);

		j=g_PPID_curID-g_PPID_itemIdx+1;
		if(j<1)	
		{
			j=1;
		}
		j-=1;
		for(i=1;i<=maxID;i++)
		{
			memset(itemSN,0,sizeof(itemSN));
			memset(itemPPID,0,sizeof(itemPPID));
			memset(itemName,0,sizeof(itemName));

			sprintf(itemSN,"%d",i);
			OSD_SetTextFieldContent(pPPID_item_txt[i][0], STRING_ANSI, (UINT32)(itemSN));
		
			sprintf(itemPPID,"%02X%02X%02X",cti_PPID_list.info[j].id[0],cti_PPID_list.info[j].id[1],cti_PPID_list.info[j].id[2]);
			OSD_SetTextFieldContent(pPPID_item_txt[i][1], STRING_ANSI, (UINT32)(itemPPID));

			//ComUniStrToAsc((UINT8*)cti_PPID_list.info[i-1].PPID_label,itemName);
			OSD_SetTextFieldContent(pPPID_item_txt[i][2], STRING_UNICODE, (UINT32)(cti_PPID_list.info[j].PPID_label));
			j++;
		}	

	}

	if(update)
	{
		for(i=0; i< MAX_ITEM_COUNT+1; i++)
		{
			OSD_DrawObject((POBJECT_HEAD )pPPID_item_con[i],C_UPDATE_ALL);
		}
		if(g_PPID_itemIdx!=0)
		{
			i=g_PPID_itemIdx;
			OSD_TrackObject((POBJECT_HEAD )pPPID_item_con[i],C_DRAW_SIGN_EVN_FLG| C_UPDATE_ALL);
		}
	}
	
}
Ejemplo n.º 28
0
static void win_rs232upg_load_chunk_info()
{
	CHUNK_HEADER blk_header;
	UINT32 id,mask;
	UINT8 chunk_number;
	UINT8 i;
	char strTmp[30];
	char strTmp1[30];
	char strTmp2[30];
	char strTmp3[30];
	char strTmp4[30];
	char strTmp5[30];
	char strTmp6[30];
	char strTmp7[30];
	char strTmp8[30];
#if (defined HDCP_IN_FLASH ||defined DIVX_CERT_ENABLE)
	UINT32 Block_id = 0, HDCP_key_ID = 0,divx_key_ID = 0,ciplus_key_ID = 0;
	UINT8 hdcp_chunk_index = 0;
   	UINT8 cipluskey_chunk_index = 0;
    
	BOOL has_hdcp_chunk = FALSE;
    	BOOL has_cipluskey_chunk = FALSE;
	UINT8 divx_chunk_index = 0;
	BOOL has_divx_chunk = FALSE;	
	UINT32 special_type =0;

#endif
//-a by wangyang del seecode upgrade {{
	UINT32 seecode_key_ID = 0;
	UINT8 seecode_chunk_index = 0;
    	BOOL has_seecodekey_chunk = FALSE;
//-a by wangyang del seecode upgrade }}

	chunk_number = sto_chunk_count(0,0);

	if(chunk_number == 0)
		return;

	if(InitBlockList() != SUCCESS)
		return;

	if(rs232upg_upgtype_chars != NULL)
		FREE(rs232upg_upgtype_chars);
	rs232upg_upgtype_chars = (UINT16**)MALLOC(sizeof(UINT16*)*chunk_number);
	if(rs232upg_upgtype_chars == NULL)
		ASSERT(0);
	for(i=0; i<chunk_number; i++)
	{
		rs232upg_upgtype_chars[i] = (UINT16*)MALLOC(16*sizeof(UINT16));
		if(rs232upg_upgtype_chars[i] == NULL)
			ASSERT(0);
	}
	
	
//	STRCPY(rs232upg_upgtype_chars[0],"allcode");
	{
			UINT16 *unistr=NULL;
         		unistr=OSD_GetUnicodeString(RS_TOTAL_FLASH);
            		ComUniStrCopyChar(rs232upg_upgtype_chars[0],(UINT16 *)unistr);
			//ComUniStrToAsc((UINT8 *)OSD_GetUnicodeString(RS_TOTAL_FLASH),strTmp);
			//STRCPY(rs232upg_upgtype_chars[0],strTmp);
        }
	
	for(i=1; i<chunk_number; i++)
	{
		id = mask = 0;
		sto_chunk_goto(&id,mask,i + 1);
		sto_get_chunk_header(id, &blk_header);

#if (defined HDCP_IN_FLASH ||defined DIVX_CERT_ENABLE || defined CI_PLUS_SUPPORT )
         special_type = 0;
#ifdef HDCP_IN_FLASH
		HDCP_key_ID = HDCPKEY_CHUNK_ID;
		if(((UINT32)blk_header.id) == HDCP_key_ID)
		{
			hdcp_chunk_index = i;
			has_hdcp_chunk = TRUE;
			special_type = 1;
		}
#endif
#ifdef DIVX_CERT_ENABLE
		divx_key_ID = DIVX_CHUCK_ID;
		if(((UINT32)blk_header.id) == divx_key_ID)
		{
			divx_chunk_index = i;
			has_divx_chunk = TRUE;
			special_type = 1;
		}
#endif
#ifdef CI_PLUS_SUPPORT
        ciplus_key_ID = CIPLUSKEY_CHUNK_ID;
        if(((UINT32)blk_header.id) == ciplus_key_ID)
        {
            cipluskey_chunk_index = i;
            has_cipluskey_chunk = TRUE;
            special_type = 1;
        }
#endif
//-a by wangyang del seecode upgrade {{
	seecode_key_ID =SEECODE_CHUNK_ID
        if(((UINT32)blk_header.id) == ciplus_key_ID)
        {
            seecode_chunk_index = i;
            has_seecodekey_chunk = TRUE;
            special_type = 1;
        }
//-a by wangyang del seecode upgrade }}
		if(special_type != 1)
			{
			STRCPY(rs232upg_upgtype_chars[i], blk_header.name);
//-a by wangyang del seecode upgrade {{
		if(i==1)
		{
			ComUniStrToAsc((UINT8 *)OSD_GetUnicodeString(RS_FIRMWARE),strTmp1);
			STRCPY(rs232upg_upgtype_chars[i], strTmp1);
		}
		else if (i == 2)
		{
			ComUniStrToAsc((UINT8 *)OSD_GetUnicodeString(RS_SEECODE),strTmp2);
			STRCPY(rs232upg_upgtype_chars[i],strTmp2);
		}
		else if (i == 3)
		{
			ComUniStrToAsc((UINT8 *)OSD_GetUnicodeString(RS_LOGO),strTmp3);
			STRCPY(rs232upg_upgtype_chars[i], strTmp3);
		}
		else if (i == 4)
		{
			ComUniStrToAsc((UINT8 *)OSD_GetUnicodeString(RS_CCCAM_PRIO),strTmp4);
			STRCPY(rs232upg_upgtype_chars[i], strTmp4);
		}
		else if (i == 5)
		{
			ComUniStrToAsc((UINT8 *)OSD_GetUnicodeString(RS_CCCAM_NEWCAM),strTmp5);
			STRCPY(rs232upg_upgtype_chars[i], strTmp5);
		}
		else if (i == 6)
		{
			ComUniStrToAsc((UINT8 *)OSD_GetUnicodeString(RS_DEFAULT_DATA),strTmp6);
			STRCPY(rs232upg_upgtype_chars[i], strTmp6);
		}
		else if (i == 7)
		{
			ComUniStrToAsc((UINT8 *)OSD_GetUnicodeString(RS_USER_DATA),strTmp7);
			STRCPY(rs232upg_upgtype_chars[i], strTmp7);
		}
//-a by wangyang del seecode upgrade }}
	}

#else
		STRCPY(rs232upg_upgtype_chars[i],blk_header.name);
//-a by wangyang del seecode upgrade {{
	seecode_key_ID =SEECODE_CHUNK_ID;
        if(((UINT32)blk_header.id) == seecode_key_ID)
        {
            seecode_chunk_index = i;
            has_seecodekey_chunk = TRUE;
            //special_type = 1;
        }
		if(i==1)
		{
			UINT16 *unistr=NULL;
         		unistr=OSD_GetUnicodeString(RS_FIRMWARE);
            		ComUniStrCopyChar(rs232upg_upgtype_chars[1],(UINT16 *)unistr);
			//ComUniStrToAsc((UINT8 *)OSD_GetUnicodeString(RS_FIRMWARE),strTmp1);
			//STRCPY(rs232upg_upgtype_chars[1], strTmp1);
        	}
		
		else if (i == 2)
		{
	//		ComUniStrToAsc((UINT8 *)OSD_GetUnicodeString(RS_SEECODE),strTmp2);
	//		STRCPY(rs232upg_upgtype_chars[i], strTmp2);
		}
		else if (i == 3)
		{
	//		ComUniStrToAsc((UINT8 *)OSD_GetUnicodeString(RS_LOGO),strTmp3);
	//		STRCPY(rs232upg_upgtype_chars[i],strTmp3);
		}
		else if (i == 4)
		{
	//		ComUniStrToAsc((UINT8 *)OSD_GetUnicodeString(RS_CCCAM_PRIO),strTmp4);
	//		STRCPY(rs232upg_upgtype_chars[i], strTmp4);
		}
		else if (i == 5)
		{
	//		ComUniStrToAsc((UINT8 *)OSD_GetUnicodeString(RS_CCCAM_NEWCAM),strTmp5);
	//		STRCPY(rs232upg_upgtype_chars[i], strTmp5);
		}
		else if (i == 6)
		{
		//	ComUniStrToAsc((UINT8 *)OSD_GetUnicodeString(RS_DEFAULT_DATA),strTmp6);
		//	STRCPY(rs232upg_upgtype_chars[i], strTmp6);
		}
		else if (i == 9)
		{
		//	ComUniStrToAsc((UINT8 *)OSD_GetUnicodeString(RS_USER_DATA),strTmp7);
		//	STRCPY(rs232upg_upgtype_chars[2],strTmp7);
		}
//-a by wangyang del seecode upgrade }}

#endif
	}
//-a by wangyang del seecode upgrade {{

	if(has_seecodekey_chunk == TRUE)
	{
		FREE(rs232upg_upgtype_chars[seecode_chunk_index]);
		for(i=seecode_chunk_index; i<chunk_number;i++)
			rs232upg_upgtype_chars[i] = rs232upg_upgtype_chars[i+1];
		chunk_number--;
  #ifdef HDCP_IN_FLASH
      if( (has_seecodekey_chunk == TRUE) && seecode_chunk_index < hdcp_chunk_index)
            hdcp_chunk_index --;
        if( (has_divx_chunk == TRUE) && seecode_chunk_index < cipluskey_chunk_index)
            cipluskey_chunk_index --;
        if( (has_divx_chunk == TRUE) && seecode_chunk_index < divx_chunk_index)
            divx_chunk_index --;
  #endif
      
	}
//-a by wangyang del seecode upgrade }}

	
#ifdef HDCP_IN_FLASH
	if(has_hdcp_chunk == TRUE)
	{
		FREE(rs232upg_upgtype_chars[hdcp_chunk_index]);
		for(i=hdcp_chunk_index; i<chunk_number;i++)
			rs232upg_upgtype_chars[i] = rs232upg_upgtype_chars[i+1];
		chunk_number--;
        if( (has_cipluskey_chunk == TRUE) && hdcp_chunk_index < cipluskey_chunk_index)
            cipluskey_chunk_index --;
        if( (has_divx_chunk == TRUE) && hdcp_chunk_index < divx_chunk_index)
            divx_chunk_index --;
        
	}
#endif

#ifdef DIVX_CERT_ENABLE
	if(has_divx_chunk == TRUE)
	{
		FREE(rs232upg_upgtype_chars[divx_chunk_index]);
		for(i=divx_chunk_index; i<chunk_number;i++)
			rs232upg_upgtype_chars[i] = rs232upg_upgtype_chars[i+1];
		chunk_number--;
        if( (has_cipluskey_chunk == TRUE) && divx_chunk_index < cipluskey_chunk_index)
            cipluskey_chunk_index --;
	}
#endif

#ifdef CI_PLUS_SUPPORT
        if(has_cipluskey_chunk == TRUE)
        {
            FREE(rs232upg_upgtype_chars[cipluskey_chunk_index]);
            for(i=cipluskey_chunk_index; i<chunk_number;i++)
                rs232upg_upgtype_chars[i] = rs232upg_upgtype_chars[i+1];
            chunk_number--;
        }
#endif

#if (defined HDCP_IN_FLASH ||defined DIVX_CERT_ENABLE || defined CI_PLUS_SUPPORT )
	OSD_SetMultiselSelTable(&rs232upg_sel_upgrade_type,rs232upg_upgtype_chars);
	OSD_SetMultiselCount(&rs232upg_sel_upgrade_type, chunk_number);
#else
	OSD_SetMultiselSelTable(&rs232upg_sel_upgrade_type,rs232upg_upgtype_chars);
	OSD_SetMultiselCount(&rs232upg_sel_upgrade_type, 2);
#endif
	
}
Ejemplo n.º 29
0
static PRESULT map_city_list_unact_proc(VACTION act)
{
	PRESULT ret = PROC_PASS;
	OBJLIST* ol;
	UINT16 curitem;
	UINT8 back_saved;
 	SYSTEM_DATA* p_sys_data = sys_data_get();
	UINT16 uni_name[30];
	UINT8* new_name;
	char strTmp[30];
	char strTmp1[30];
	char strTmp2[30];
	
	ol = &ol_map_city;
	curitem = OSD_GetObjListNewPoint(ol);
	
	switch (act)
	{
		case VACT_MAP_CITY_EDIT:
			//ComAscStr2Uni(p_sys_data->map_city_name[curitem], uni_name);
			MEMCPY(uni_name,(UINT16*)p_sys_data->map_city_name[curitem],(MAP_CITY_NAME_LEN + 1));
			wincom_close_help();
#ifndef KEYBOARD_SUPPORT
			if(win_rename_open(uni_name,&new_name,map_city_check_input_name))
#else
#if (defined(GZ1105002)||defined(GZ1105003)||defined(GZ1105004)||defined(GZ1105005)||defined(GZ1105006))	
			if(win_rename_open(uni_name,&new_name,map_city_check_input_name))
#else
			if(win_keyboard_rename_open(uni_name,&new_name,map_city_check_input_name))
#endif				
#endif
			{
				//ComUniStrToAsc(new_name,p_sys_data->map_city_name[curitem]);
				ComUniStrCopyChar(p_sys_data->map_city_name[curitem], new_name);
			}		
			wincom_open_help_OK_list_small((POBJECT_HEAD)&g_win_map_city, map_city_helpinfo, HELP_CNT);
			OSD_TrackObject(ol, C_DRAW_SIGN_EVN_FLG | C_UPDATE_ALL);
			break;
		case VACT_MAP_CITY_ADD:
			if (OSD_GetObjListCount(ol) == MAP_CITY_MAX_NUM)
			{
				win_compopup_init(WIN_POPUP_TYPE_OK);
				ComUniStrToAsc((UINT8 *)OSD_GetUnicodeString(RS_THE_LIST_IS_FULL),strTmp);
				win_compopup_set_msg((UINT8*)strTmp,NULL,0);
				win_compopup_open_ext(&back_saved);
				break;
			}
			
			memset(uni_name, 0x0, sizeof(uni_name));
			wincom_close_help();
#ifndef KEYBOARD_SUPPORT
			if(win_rename_open(uni_name,&new_name, map_city_check_input_name))
#else
#if (defined(GZ1105002)||defined(GZ1105003)||defined(GZ1105004)||defined(GZ1105005)||defined(GZ1105006))	
			if(win_rename_open(uni_name,&new_name, map_city_check_input_name))
#else
			if(win_keyboard_rename_open(uni_name,&new_name,map_city_check_input_name))
#endif
#endif
			{
				//ComUniStrToAsc(new_name, p_sys_data->map_city_name[OSD_GetObjListCount(ol)]);
				ComUniStrCopyChar(p_sys_data->map_city_name[OSD_GetObjListCount(ol)],new_name);
			}
			
			map_city_list_load();
			wincom_open_help_OK_list_small((POBJECT_HEAD)&g_win_map_city, map_city_helpinfo, HELP_CNT);
			OSD_TrackObject(ol, C_DRAW_SIGN_EVN_FLG | C_UPDATE_ALL);
			break;
		case VACT_MAP_CITY_DEL:
			map_city_delete(curitem);
			map_city_list_load();
			OSD_TrackObject(ol, C_DRAW_SIGN_EVN_FLG | C_UPDATE_ALL);
			break;			
		case VACT_MAP_CITY_DOWNLOAD:
			city_index = curitem;
			s_mapdl_handle = map_download(p_sys_data->map_city_name[curitem], 14);
			bMapDownloading = TRUE;
			win_compopup_init(WIN_POPUP_TYPE_SMSG);
			//ComUniStrToAsc((UINT8 *)OSD_GetUnicodeString(RS_CONNECTINF_WAITE),strTmp1);
			win_compopup_set_msg(/*(UINT8*)strTmp1*/NULL,NULL,RS_CONNECTINF_WAITE);
			win_compopup_open_ext(&back_saved);
			break;
		case VACT_MAP_SEARCH:
			memset(search_string, 0x0, sizeof(search_string));
			wincom_close_help();
			if (win_map_search_input_menu_open(search_string))
			{
				s_mapdl_handle = map_download(search_string, 14);
				bMapDownloading = FALSE;
				win_compopup_init(WIN_POPUP_TYPE_SMSG);
				//ComUniStrToAsc((UINT8 *)OSD_GetUnicodeString(RS_CONNECTINF_WAITE),strTmp2);
				win_compopup_set_msg(/*(UINT8*)strTmp2*/NULL,NULL,RS_CONNECTINF_WAITE);
				win_compopup_open_ext(&back_saved);
			}
			wincom_open_help_OK_list_small((POBJECT_HEAD)&g_win_map_city, map_city_helpinfo, HELP_CNT);
			break;

		default:
			break;
	}

	return ret;
}
Ejemplo n.º 30
0
UINT32 GetChunk(BYTE *buffer, UINT32 nLen)
{
	UINT8 *p, *pblock;
	UINT32 chunk_pos;
	struct sto_device *sto_dev = NULL;
	UINT8 sVer[16], hVer[16];
	INT32 i = 0;
	char strTmp[30];
#if (defined HDCP_IN_FLASH ||defined DIVX_CERT_ENABLE)
	INT32 temp_slave_blocks_number=0;
	CHUNK_HEADER *temp_pslave_list = NULL;
#endif
	
	switch((unsigned int)buffer[0])
	{
		case 1:
		case 2:
		case 7:
		case 10:
			slave_Flash_type = 0x80000;	//flash size
			break;
		case 3:
		case 4:
		case 8:
		case 9:
		case 11:
		case 13:
			slave_Flash_type = 0x100000;
			break;
		case 5:
		case 6:
		case 12:
		case 14:
		case 15:
		case 16:
		case 25:
		case 28:
		case 30:
			slave_Flash_type = 0x200000;
			break;
		case 17:
		case 18:
		case 19:
		case 33:
			slave_Flash_type = 0x400000;
			break;
		default:
			slave_Flash_type = 0x200000;/*For unkown flash type,default is 2M*/
			//return !SUCCESS;
	}

	slave_status = (unsigned int)buffer[1];
	if(slave_status==0)
		slave_blocks_number = (nLen -2)/CHUNK_HEADER_SIZE;
	else
		slave_blocks_number = 1;

	pslave_list= (CHUNK_HEADER *)MALLOC(sizeof(CHUNK_HEADER)*slave_blocks_number);
	if (pslave_list == NULL)
		return !SUCCESS;
	MEMSET((void *)pslave_list,0,sizeof(CHUNK_HEADER)*slave_blocks_number);

#if (defined HDCP_IN_FLASH ||defined DIVX_CERT_ENABLE)
#ifdef  HDCP_IN_FLASH
	if(m_allcode_include_bootloader==0)
#endif		
		{
			temp_pslave_list= (CHUNK_HEADER *)MALLOC(sizeof(CHUNK_HEADER)*slave_blocks_number);
			if (temp_pslave_list == NULL)
				return !SUCCESS;
			MEMSET((void *)temp_pslave_list,0,sizeof(CHUNK_HEADER)*slave_blocks_number);
		}
#endif

	pblock = &buffer[2];
	for(i=0; i<slave_blocks_number; i++)
	{
		p = pblock + CHUNK_ID;
		pslave_list[i].id = (*p<<24)+(*(p+1)<<16)+(*(p+2)<<8)+(*(p+3)<<0);

		p = pblock + CHUNK_LENGTH;
		pslave_list[i].len = (*p<<24)+(*(p+1)<<16)+(*(p+2)<<8)+(*(p+3)<<0);

		p = pblock + CHUNK_OFFSET;
		pslave_list[i].offset = (*p<<24)+(*(p+1)<<16)+(*(p+2)<<8)+(*(p+3)<<0);

		p = pblock + CHUNK_CRC;
		pslave_list[i].crc = (*p<<24)+(*(p+1)<<16)+(*(p+2)<<8)+(*(p+3)<<0);

		p = pblock + CHUNK_NAME;
		STRCPY((char *)pslave_list[i].name, (char *)p);

		p = pblock + CHUNK_VERSION;
		STRCPY((char *)pslave_list[i].version, (char *)p);

		p = pblock + CHUNK_TIME;
		STRCPY((char *)pslave_list[i].time, (char *)p);

#if (defined HDCP_IN_FLASH ||defined DIVX_CERT_ENABLE)
#ifdef HDCP_IN_FLASH
		if(m_allcode_include_bootloader==0)
#endif		
		{
			UINT32 special_type = 0;

#ifdef HDCP_IN_FLASH		
			if(pslave_list[i].id == HDCPKEY_CHUNK_ID)
			{
				special_type =1;
			}
#endif			
#ifdef DIVX_CERT_ENABLE		
			if(pslave_list[i].id == DIVX_CHUCK_ID)
			{
				special_type =1;
			}
#endif			
			if(special_type!=1)
			{
				MEMCPY((temp_pslave_list+temp_slave_blocks_number),(pslave_list+i),sizeof(CHUNK_HEADER));
				temp_slave_blocks_number++;			
			}
			else
			{ 
				if(i > 0)
				{
					temp_pslave_list[i-1].offset=(temp_pslave_list[i-1].offset+pslave_list[i].offset);
				}
			}
		}
#endif

		pblock += CHUNK_HEADER_SIZE;
	}

#if (defined HDCP_IN_FLASH ||defined DIVX_CERT_ENABLE)
#ifdef  HDCP_IN_FLASH
		if(m_allcode_include_bootloader==0)
#endif		
		{
			FREE(pslave_list);
			slave_blocks_number=temp_slave_blocks_number;
			pslave_list = (CHUNK_HEADER *)MALLOC(sizeof(CHUNK_HEADER)*slave_blocks_number);
			MEMCPY(pslave_list,temp_pslave_list,sizeof(CHUNK_HEADER)*slave_blocks_number);
			FREE(temp_pslave_list);
		}
#endif


	STRCPY(sVer, pslave_list[0].version);
	chunk_pos = sto_chunk_goto(&pblock_list[0].id, 0xFFFFFFFF, 1);
	sto_dev = (struct sto_device*)dev_get_by_id(HLD_DEV_TYPE_STO, 0);
	sto_open(sto_dev);
	sto_lseek(sto_dev, chunk_pos+CHUNK_VERSION, STO_LSEEK_SET);
	sto_read(sto_dev, hVer, 16);
	//sto_close(sto_dev);

#ifdef FORCE_UPGRADE_OLD_PROTOCOL_BOOTLOADER
	if(g_protocol_version < NEW_PROTOCOL_VERSION)
		return SUCCESS;
#endif
	if(CheckVersion(sVer, hVer) != SUCCESS)
	{
		ComUniStrToAsc((UINT8 *)OSD_GetUnicodeString(RS_STB_VERSION_NOT_COMPATIBLE),strTmp);
		callback_fun(2,0,strTmp);
		return !SUCCESS;
	}
}