⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 config_page1.cpp.svn-base

📁 vc环境下编译的一个对USB设备进行烧录的驱动程序
💻 SVN-BASE
📖 第 1 页 / 共 3 页
字号:
			m_list_file.GetItemText(i, 4, config.download_files[i].file_flash_path, 255);
		}
		
		str = m_list_file.GetItemText(i, 5);
		config.download_files[i].file_run_address = hex2int(str);
		
	}

	count = m_list_register.GetItemCount();
	
	config.set_register_count = count;
	if(config.set_registers != NULL)
		free(config.set_registers);
	config.set_registers = (set_register *) malloc(sizeof(set_register) * config.set_register_count);
	
	memset(config.set_registers, 0, sizeof(set_register) * config.set_register_count);
	
	
	for(i = 0; i < count; i++)
	{
		str = m_list_register.GetItemText(i, 1);
		config.set_registers[i].address = hex2int(str);
	
		str = m_list_register.GetItemText(i, 2);
		config.set_registers[i].value = hex2int(str);
	}

	count = m_list_erase.GetItemCount();

	config.erase_count = count;
	if(config.erases != NULL)
		free(config.erases);
	config.erases = (T_ERASE_DATA *)malloc(sizeof(T_ERASE_DATA) * config.erase_count);

	memset(config.erases, 0 , sizeof(T_ERASE_DATA) * config.erase_count);

	for(i = 0; i< count; i++)
	{
        
        str = m_list_erase.GetItemText(i, 1);
        if(str == __T("NANDFLASH"))
            config.erases[i].type = ERASE_NANDFLASH;
        else if(str == __T("NORFLASH"))
            config.erases[i].type = ERASE_NORFLASH;
        else
            config.erases[i].type = ERASE_SFLASH;

		str = m_list_erase.GetItemText(i, 2);
		config.erases[i].Start_Address = hex2int(str);

		str = m_list_erase.GetItemText(i, 3);
		config.erases[i].End_Address = hex2int(str);
	}

	count = m_list_format.GetItemCount();

	config.format_count = count;
	if(config.formats != NULL)
		free(config.formats);
	config.formats = (T_FORMAT_DATA *)malloc(sizeof(T_FORMAT_DATA) * config.format_count);

	memset(config.formats, 0, sizeof(T_FORMAT_DATA) * config.format_count);

	for(i = 0; i < config.format_count; i++)
	{
		str = m_list_format.GetItemText(i, 1);
        str.MakeUpper();
		config.formats[i].Disk_Name = *str.GetBuffer(1);

        str = m_list_format.GetItemText(i, 2);

        if(str == "是")
		{
			config.formats[i].bOpenZone = TRUE;
		}
		else
		{
			config.formats[i].bOpenZone = FALSE;
		}

        str = m_list_format.GetItemText(i, 3);

        if(str == "NORMAL")
        {
            config.formats[i].ProtectType = MEDIUM_PORTECT_LEVEL_NORMAL;
        }
        else if(str == "CHECK")
        {
            config.formats[i].ProtectType = MEDIUM_PORTECT_LEVEL_CHECK;
        }
        else
        {
            config.formats[i].ProtectType = MEDIUM_PORTECT_LEVEL_READONLY;
        }

        
        str = m_list_format.GetItemText(i, 4);

        if(str == "MMI")
        {
            config.formats[i].ZoneType = ZT_MMI;
        }
        else if(str == "MMIBACKUP")
        {
            config.formats[i].ZoneType = ZT_MMI_BK;
        }
        else if(str == "UNSTANDARD")
        {
            config.formats[i].ZoneType = ZT_UNSTANDARD;
        }
        else if(str == "UNSTANDARDBACKUP")
        {
            config.formats[i].ZoneType = ZT_UNSTANDARD_BK;
        }
        else if(str == "STANDARD")
        {
            config.formats[i].ZoneType = ZT_STANDARD;
        }
        else
        {
            config.formats[i].ZoneType = ZT_FAKE;
        }


		str = m_list_format.GetItemText(i, 5);
		config.formats[i].Start_Address = hex2int(str);

		str = m_list_format.GetItemText(i, 6);
		config.formats[i].End_Address = hex2int(str);
	}

	count = m_list_image.GetItemCount();

	config.download_fat_image_count = count;
	if(config.images != NULL)
		free(config.images);
	config.images = (download_fat_image *)malloc(sizeof(download_fat_image) * config.download_fat_image_count);

	memset(config.images, 0, sizeof(download_fat_image) * config.download_fat_image_count);


	for(i = 0; i < config.download_fat_image_count; i++)
	{
		str = m_list_image.GetItemText(i, 1);
		config.images[i].Disk_Name = *str.GetBuffer(1);
		
		m_list_image.GetItemText(i, 2, config.images[i].file_pc_path, 255);
		
		str = m_list_image.GetItemText(i, 3);
		config.images[i].File_Size = hex2int(str);
	}

    return true;
}

void CConfig_Page1::CleanListItem()
{
	m_list_file.DeleteAllItems();

	m_list_register.DeleteAllItems();

	m_list_erase.DeleteAllItems();

	m_list_format.DeleteAllItems();

}

void CConfig_Page1::SetConfigItem()
{
	CString str;

	if(config.bNandBoot)
	{
		((CButton *)GetDlgItem(IDC_CHECK_NANDBOOT))->SetCheck(BST_CHECKED);

		SetDlgItemText(IDC_EDIT_NANDBOOT_PATH, config.nandboot_path);

        SetDlgItemText(IDC_EDIT_BIOS_PATH, config.bios_path);

		//str.Format("%d", config.bios_main_version);
        str.Format("%d", 1);
		SetDlgItemText(IDC_EDIT_MAIN_VERSION, str);

		//str.Format("%d", config.bios_sub_version);
        str.Format("%d", 0);
		SetDlgItemText(IDC_EDIT_SUB_VERSION, str);

		str.Format("0x%x", config.bios_start_address);
		SetDlgItemText(IDC_EDIT_BIOS_START_ADDRESS, str);

		str.Format("0x%x", config.bios_end_address);
		SetDlgItemText(IDC_EDIT_BIOS_END_ADDRESS, str);

        str.Format("0x%x", config.bios_backup_start_address);
		SetDlgItemText(IDC_EDIT_BIOS_BACKUP_START_ADDRESS, str);

        str.Format("0x%x", config.bios_backup_end_address);
		SetDlgItemText(IDC_EDIT_BIOS_BACKUP_END_ADDRESS, str);

		str.Format("0x%x", config.bios_run_address);
		SetDlgItemText(IDC_EDIT_BIOS_RUN_ADDRESS, str);

		GetDlgItem(IDC_BUTTON_BROWSE_NANDBOOT)->EnableWindow(TRUE);
        GetDlgItem(IDC_BUTTON_BROWSE_BIOS)->EnableWindow(TRUE);
		GetDlgItem(IDC_EDIT_NANDBOOT_PATH)->EnableWindow(TRUE);
        GetDlgItem(IDC_EDIT_BIOS_PATH)->EnableWindow(TRUE);
		GetDlgItem(IDC_EDIT_MAIN_VERSION)->EnableWindow(TRUE);
		GetDlgItem(IDC_EDIT_SUB_VERSION)->EnableWindow(TRUE);
		GetDlgItem(IDC_EDIT_BIOS_START_ADDRESS)->EnableWindow(TRUE);
		GetDlgItem(IDC_EDIT_BIOS_END_ADDRESS)->EnableWindow(TRUE);
        GetDlgItem(IDC_EDIT_BIOS_BACKUP_START_ADDRESS)->EnableWindow(TRUE);
		GetDlgItem(IDC_EDIT_BIOS_BACKUP_END_ADDRESS)->EnableWindow(TRUE);
		GetDlgItem(IDC_EDIT_BIOS_RUN_ADDRESS)->EnableWindow(TRUE);

	}
	else
	{
		((CButton *)GetDlgItem(IDC_CHECK_NANDBOOT))->SetCheck(BST_UNCHECKED);

		GetDlgItem(IDC_BUTTON_BROWSE_NANDBOOT)->EnableWindow(FALSE);
        GetDlgItem(IDC_BUTTON_BROWSE_BIOS)->EnableWindow(FALSE);
		GetDlgItem(IDC_EDIT_NANDBOOT_PATH)->EnableWindow(FALSE);
        GetDlgItem(IDC_EDIT_BIOS_PATH)->EnableWindow(FALSE);
		GetDlgItem(IDC_EDIT_MAIN_VERSION)->EnableWindow(FALSE);
		GetDlgItem(IDC_EDIT_SUB_VERSION)->EnableWindow(FALSE);
		GetDlgItem(IDC_EDIT_BIOS_START_ADDRESS)->EnableWindow(FALSE);
		GetDlgItem(IDC_EDIT_BIOS_END_ADDRESS)->EnableWindow(FALSE);
        GetDlgItem(IDC_EDIT_BIOS_BACKUP_START_ADDRESS)->EnableWindow(FALSE);
		GetDlgItem(IDC_EDIT_BIOS_BACKUP_END_ADDRESS)->EnableWindow(FALSE);
		GetDlgItem(IDC_EDIT_BIOS_RUN_ADDRESS)->EnableWindow(FALSE);
	}

	str.Format("%s", config.mobile_type);
	SetDlgItemText(IDC_EDIT_MOBILE_TYPE, str);

	str.Format("%d", config.equipment_count);
	SetDlgItemText(IDC_EDIT_EQUIPMENT_COUNT, str);

	if(config.bOpenCom)
	{
		((CButton *)GetDlgItem(IDC_CHECK_COM))->SetCheck(BST_CHECKED);
		if(config.chip_type == CHIP_3223)
		{
			GetDlgItem(IDC_CHECK_COM)->EnableWindow(FALSE);
		}

		str.Format("%d", config.com_count);
		SetDlgItemText(IDC_EDIT_COM_COUNT, str);

		str.Format("%d", config.base_com);
		SetDlgItemText(IDC_EDIT_BASE_COM, str);

		str.Format("%d", config.BaudRate);
		SetDlgItemText(IDC_EDIT_BAUDRATE, str);

		if(config.chip_type == CHIP_3223)
		{
			GetDlgItem(IDC_EDIT_COM_COUNT)->EnableWindow(FALSE);
		}
		else
		{
			GetDlgItem(IDC_EDIT_COM_COUNT)->EnableWindow(TRUE);
		}
		
        GetDlgItem(IDC_EDIT_BASE_COM)->EnableWindow(TRUE);
		GetDlgItem(IDC_EDIT_BAUDRATE)->EnableWindow(TRUE);
    }
    else
    {
        ((CButton *)GetDlgItem(IDC_CHECK_COM))->SetCheck(BST_UNCHECKED);

		GetDlgItem(IDC_EDIT_COM_COUNT)->EnableWindow(FALSE);
        GetDlgItem(IDC_EDIT_BASE_COM)->EnableWindow(FALSE);
		GetDlgItem(IDC_EDIT_BAUDRATE)->EnableWindow(FALSE);
    }

		
	if(config.memory_type == MEMORY_TYPE_SRAM)
		str = "SRAM";
	else
		str = "SDRAM";
	SetDlgItemText(IDC_EDIT_MEMORY_TYPE, str);

	str.Format("%s", config.loadfile_path);
	SetDlgItemText(IDC_EDIT_LOADFILE_PATH, str);

	str.Format("0x%x", config.loadfile_destination_address);
	SetDlgItemText(IDC_EDIT_LOADFILE_DESTINATION_ADDRESS, str);


	for(int i = 0; i < config.download_file_count; i++)
	{
		CString strIndex;
		
		strIndex.Format("%d", i+1);
		m_list_file.InsertItem(i, strIndex);

		if(config.download_files[i].compare)
		{
			m_list_file.SetItemText(i, 1, "是");
		}
		else
		{
			m_list_file.SetItemText(i, 1, "否");
		}

		TCHAR * relative_path = config.download_files[i].file_pc_path;


		if((relative_path = strstr(config.download_files[i].file_pc_path, Current_DirectoryBuffer)) != NULL)
		{
			relative_path = config.download_files[i].file_pc_path + strlen(Current_DirectoryBuffer) + 1;
			m_list_file.SetItemText(i, 3, relative_path);
		}
		else
		{
			m_list_file.SetItemText(i, 3, config.download_files[i].file_pc_path);
		}

		//m_list_file.SetItemText(i, 2, config.download_files[i].file_pc_path);

		if(config.download_files[i].download_type == DOWNLOAD_TO_NANDFLASH)
		{
			m_list_file.SetItemText(i, 2, "NANDFLASH");
			str.Format("0x%x", config.download_files[i].start_destination_address);
			m_list_file.SetItemText(i, 6, str);
			str.Format("0x%x", config.download_files[i].end_destination_address);
			m_list_file.SetItemText(i, 7, str);
			str.Format("0x%x", config.download_files[i].backup_start_destination_address);
			m_list_file.SetItemText(i, 8, str);
			str.Format("0x%x", config.download_files[i].backup_end_destination_address);
			m_list_file.SetItemText(i, 9, str);
		}
		else if(config.download_files[i].download_type == DOWNLOAD_TO_NORFLASH)
		{
			m_list_file.SetItemText(i, 2, "NORFLASH");
			str.Format("0x%x", config.download_files[i].start_destination_address);
			m_list_file.SetItemText(i, 6, str);
			str.Format("0x%x", config.download_files[i].end_destination_address);
			m_list_file.SetItemText(i, 7, str);
		}
		else if(config.download_files[i].download_type == DOWNLOAD_TO_SFLASH)
		{
			m_list_file.SetItemText(i, 2, "S-FLASH");
			str.Format("0x%x", config.download_files[i].start_destination_address);
			m_list_file.SetItemText(i, 6, str);
			str.Format("0x%x", config.download_files[i].end_destination_address);
			m_list_file.SetItemText(i, 7, str);
		}
		else
		{

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -