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

📄 config_page2.cpp.svn-base

📁 vc环境下编译的一个对USB设备进行烧录的驱动程序
💻 SVN-BASE
📖 第 1 页 / 共 2 页
字号:

	switch(config.chip_type)
	{
	case CHIP_3223:
		SetDlgItemText(IDC_LIST_CHIP, __T("AK_3223"));
		break;

	case CHIP_3224:
		SetDlgItemText(IDC_LIST_CHIP, __T("AK_3224"));
		break;

	case CHIP_3225:
		SetDlgItemText(IDC_LIST_CHIP, __T("AK_3225"));
		break;

	case CHIP_36XX:
		SetDlgItemText(IDC_LIST_CHIP, __T("AK_36XX"));
		break;

	default:
		break;
	}

	if(config.bPiece_Select_Loop)
	{
		((CButton *)GetDlgItem(IDC_RADIO_LOOP))->SetCheck(1);
		((CButton *)GetDlgItem(IDC_RADIO_DEFINE))->SetCheck(0);

		GetDlgItem(IDC_CHECK_PIECE_SELECT_ZERO)->EnableWindow(FALSE);
		GetDlgItem(IDC_CHECK_PIECE_SELECT_ONE)->EnableWindow(FALSE);
		GetDlgItem(IDC_CHECK_PIECE_SELECT_TWO)->EnableWindow(FALSE);
		GetDlgItem(IDC_CHECK_PIECE_SELECT_THREE)->EnableWindow(FALSE);

		((CButton *)GetDlgItem(IDC_CHECK_PIECE_SELECT_ZERO))->SetCheck(BST_UNCHECKED);
		((CButton *)GetDlgItem(IDC_CHECK_PIECE_SELECT_ONE))->SetCheck(BST_UNCHECKED);
		((CButton *)GetDlgItem(IDC_CHECK_PIECE_SELECT_TWO))->SetCheck(BST_UNCHECKED);
		((CButton *)GetDlgItem(IDC_CHECK_PIECE_SELECT_THREE))->SetCheck(BST_UNCHECKED);
	}
	else
	{
		((CButton *)GetDlgItem(IDC_RADIO_LOOP))->SetCheck(0);
		((CButton *)GetDlgItem(IDC_RADIO_DEFINE))->SetCheck(1);
	}

/*	if(config.bUBoot)
	{
		((CButton *)GetDlgItem(IDC_CHECK_UBOOT))->SetCheck(BST_CHECKED);
	}
*/
	if(config.bAutoDownload)
	{
		((CButton *)GetDlgItem(IDC_CHECK_AUTO_DOWNLOAD))->SetCheck(BST_CHECKED);
	}
	
	if(config.chip_type == CHIP_3224 || config.chip_type == CHIP_3225 || config.chip_type == CHIP_36XX)
	{
		((CButton *)GetDlgItem(IDC_CHECK_AUTO_DOWNLOAD))->SetCheck(BST_UNCHECKED);
		GetDlgItem(IDC_CHECK_AUTO_DOWNLOAD)->EnableWindow(FALSE);
	}
	
	//select the piece 0
	if(config.bHavePieceZero)
	{
		((CButton *)GetDlgItem(IDC_CHECK_PIECE_SELECT_ZERO))->SetCheck(BST_CHECKED);
    }
	else
    {
		((CButton *)GetDlgItem(IDC_CHECK_PIECE_SELECT_ZERO))->SetCheck(BST_UNCHECKED);
	}

	//select the piece 1
	if(config.bHavePieceOne)
	{
		((CButton *)GetDlgItem(IDC_CHECK_PIECE_SELECT_ONE))->SetCheck(BST_CHECKED);
    }
	else
    {
		((CButton *)GetDlgItem(IDC_CHECK_PIECE_SELECT_ONE))->SetCheck(BST_UNCHECKED);
	}

	//select the piece 2
	if(config.bHavePieceTwo)
	{
		((CButton *)GetDlgItem(IDC_CHECK_PIECE_SELECT_TWO))->SetCheck(BST_CHECKED);
    }
	else
    {
		((CButton *)GetDlgItem(IDC_CHECK_PIECE_SELECT_TWO))->SetCheck(BST_UNCHECKED);
	}

	//select the piece 3
	if(config.bHavePieceThree)
	{
		((CButton *)GetDlgItem(IDC_CHECK_PIECE_SELECT_THREE))->SetCheck(BST_CHECKED);
    }
	else
    {
		((CButton *)GetDlgItem(IDC_CHECK_PIECE_SELECT_THREE))->SetCheck(BST_UNCHECKED);
	}

	str.Format("%d", config.system_clock);
	SetDlgItemText(IDC_EDIT_SYSTEM_CLOCK, str);

	str.Format("%d", config.ram_size);
	SetDlgItemText(IDC_EDIT_RAM_SIZE, str);

    if(config.memory_type == MEMORY_TYPE_SDRAM)
        SetDlgItemText(IDC_COMBO_MEMORY_TYPE, __T("SDRAM"));
    else
        SetDlgItemText(IDC_COMBO_MEMORY_TYPE, __T("SRAM"));

    str.Format("%d", config.ram_size);
    SetDlgItemText(IDC_COMBO_MEMORY_SIZE, str);

    str.Format("%d", config.ram_banks);
    SetDlgItemText(IDC_COMBO_MEMORY_BANK, str);

    str.Format("%d", config.ram_row);
    SetDlgItemText(IDC_COMBO_MEMORY_ROW, str);

    str.Format("%d", config.ram_column);
    SetDlgItemText(IDC_COMBO_MEMORY_COLUMN, str);

    str.Format("%d", config.power_off_gpio);
    SetDlgItemText(IDC_EDIT_POWER_OFF_GPIO, str);

	str.Format("%d", config.res_blocks);
	SetDlgItemText(IDC_EDIT_NAND_RES_BLOCKS, str);
	
    if(config.bHaveNandflash)
	{
		((CButton *)GetDlgItem(IDC_CHECK_NANDFLASH))->SetCheck(BST_CHECKED);
    }
	else
    {
		((CButton *)GetDlgItem(IDC_CHECK_NANDFLASH))->SetCheck(BST_UNCHECKED);
	}

	if(config.init_usb == INIT_USB_GPIIO)
	{
		((CButton *)GetDlgItem(IDC_RADIO_GPIO))->SetCheck(1);
		((CButton *)GetDlgItem(IDC_RADIO_REGISTER))->SetCheck(0);

		
		str.Format("%d", config.init_usb_gpio_number);
		SetDlgItemText(IDC_EDIT_USB_GPIO, str);

		GetDlgItem(IDC_EDIT_USB_REGISTER)->EnableWindow(FALSE);
		GetDlgItem(IDC_EDIT_USB_REGISTER_BIT)->EnableWindow(FALSE);
	}
	else
	{
		((CButton *)GetDlgItem(IDC_RADIO_GPIO))->SetCheck(0);
		((CButton *)GetDlgItem(IDC_RADIO_REGISTER))->SetCheck(1);

		str.Format("0x%x", config.init_usb_register);
		SetDlgItemText(IDC_EDIT_USB_REGISTER, str);

		str.Format("%d", config.init_usb_register_bit);
		SetDlgItemText(IDC_EDIT_USB_REGISTER_BIT, str);

		GetDlgItem(IDC_EDIT_USB_GPIO)->EnableWindow(FALSE);
	}

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

		str.Format("0x%x", config.nandflash_parameter[i].chip_id);
		m_list_nandflash_parameter.SetItemText(i, 1, str);

		str.Format("%d", config.nandflash_parameter[i].page_size);
		m_list_nandflash_parameter.SetItemText(i, 2, str);

		str.Format("%d", config.nandflash_parameter[i].page_per_blk);
		m_list_nandflash_parameter.SetItemText(i, 3, str);

		str.Format("%d", config.nandflash_parameter[i].blk_num);
		m_list_nandflash_parameter.SetItemText(i, 4, str);

		str.Format("%d", config.nandflash_parameter[i].group_blk_num);
		m_list_nandflash_parameter.SetItemText(i, 5, str);

		str.Format("%d", config.nandflash_parameter[i].plane_blk_num);
		m_list_nandflash_parameter.SetItemText(i, 6, str);

		str.Format("%d", config.nandflash_parameter[i].spare_size);
		m_list_nandflash_parameter.SetItemText(i, 7, str);

		str.Format("%d", config.nandflash_parameter[i].col_cycle);
		m_list_nandflash_parameter.SetItemText(i, 8, str);

		str.Format("%d", config.nandflash_parameter[i].lst_col_mask);
		m_list_nandflash_parameter.SetItemText(i, 9, str);

		str.Format("%d", config.nandflash_parameter[i].row_cycle);
		m_list_nandflash_parameter.SetItemText(i, 10, str);

		str.Format("%d", config.nandflash_parameter[i].last_row_mask);
		m_list_nandflash_parameter.SetItemText(i, 11, str);

		str.Format("%d", config.nandflash_parameter[i].custom_nd);
		m_list_nandflash_parameter.SetItemText(i, 12, str);

		str.Format("0x%.8X", config.nandflash_parameter[i].flag);
		m_list_nandflash_parameter.SetItemText(i, 13, str);
		
		str.Format("0x%.8X", config.nandflash_parameter[i].cmd_len);
		m_list_nandflash_parameter.SetItemText(i, 14, str);

		str.Format("0x%.8X", config.nandflash_parameter[i].data_len);
		m_list_nandflash_parameter.SetItemText(i, 15, str);

		m_list_nandflash_parameter.SetItemText(i, 16, 
			(char *)config.nandflash_parameter[i].des_str);
		
	}

}

void CConfig_Page2::OnRadioGpio() 
{
	CString str;

	((CButton *)GetDlgItem(IDC_RADIO_REGISTER))->SetCheck(0);
	
	str.Format("%d", config.init_usb_gpio_number);
	SetDlgItemText(IDC_EDIT_USB_GPIO, str);

	SetDlgItemText(IDC_EDIT_USB_REGISTER, "");
	SetDlgItemText(IDC_EDIT_USB_REGISTER_BIT, "");	
	GetDlgItem(IDC_EDIT_USB_REGISTER)->EnableWindow(FALSE);
	GetDlgItem(IDC_EDIT_USB_REGISTER_BIT)->EnableWindow(FALSE);

	GetDlgItem(IDC_EDIT_USB_GPIO)->EnableWindow(TRUE);

}

void CConfig_Page2::OnRadioRegister() 
{
	CString str;

	((CButton *)GetDlgItem(IDC_RADIO_GPIO))->SetCheck(0);

	str.Format("0x%x", config.init_usb_register);
	SetDlgItemText(IDC_EDIT_USB_REGISTER, str);

	str.Format("%d", config.init_usb_register_bit);
	SetDlgItemText(IDC_EDIT_USB_REGISTER_BIT, str);

	SetDlgItemText(IDC_EDIT_USB_GPIO, "");
	GetDlgItem(IDC_EDIT_USB_GPIO)->EnableWindow(FALSE);

	GetDlgItem(IDC_EDIT_USB_REGISTER)->EnableWindow(TRUE);
	GetDlgItem(IDC_EDIT_USB_REGISTER_BIT)->EnableWindow(TRUE);
	
}

void CConfig_Page2::OnSelchangeListChip() 
{
	// TODO: Add your control notification handler code here
	int sel;
	CString str;

	CConfigDlg *pConfig = (CConfigDlg *)GetParentOwner();
	CWnd *pCom = (pConfig->m_page1.GetDlgItem(IDC_CHECK_COM));
	CWnd *pEquipCount = (pConfig->m_page1.GetDlgItem(IDC_EDIT_EQUIPMENT_COUNT));
	CWnd *pComCount = (pConfig->m_page1.GetDlgItem(IDC_EDIT_COM_COUNT));
		
	sel = m_list_chip.GetCurSel();
	m_list_chip.GetLBText(sel, str);
	
	if(str == __T("AK_3223"))
	{
		GetDlgItem(IDC_CHECK_AUTO_DOWNLOAD)->EnableWindow(TRUE);

		((CButton *)GetDlgItem(IDC_CHECK_AUTO_DOWNLOAD))->SetCheck(BST_CHECKED);
		
		((CButton *)pCom)->SetCheck(BST_CHECKED);
		pCom->EnableWindow(FALSE);
		
		pConfig->m_page1.CheckCom(true);

		pEquipCount->GetWindowText(str);
		pComCount->SetWindowText(str);

		pComCount->EnableWindow(FALSE);
	}
	else if(str == _T("AK_3224") || str == __T("AK_3225") || str == __T("AK_36XX"))
	{
		((CButton *)GetDlgItem(IDC_CHECK_AUTO_DOWNLOAD))->SetCheck(BST_UNCHECKED);
		GetDlgItem(IDC_CHECK_AUTO_DOWNLOAD)->EnableWindow(FALSE);

		pCom->EnableWindow(TRUE);

		pComCount->EnableWindow(TRUE);
	}
}

void CConfig_Page2::OnRadioLoop() 
{
	// TODO: Add your control notification handler code here
	((CButton *)GetDlgItem(IDC_RADIO_DEFINE))->SetCheck(0);

	GetDlgItem(IDC_CHECK_PIECE_SELECT_ZERO)->EnableWindow(FALSE);
	GetDlgItem(IDC_CHECK_PIECE_SELECT_ONE)->EnableWindow(FALSE);
	GetDlgItem(IDC_CHECK_PIECE_SELECT_TWO)->EnableWindow(FALSE);
	GetDlgItem(IDC_CHECK_PIECE_SELECT_THREE)->EnableWindow(FALSE);

	((CButton *)GetDlgItem(IDC_CHECK_PIECE_SELECT_ZERO))->SetCheck(BST_UNCHECKED);
	((CButton *)GetDlgItem(IDC_CHECK_PIECE_SELECT_ONE))->SetCheck(BST_UNCHECKED);
	((CButton *)GetDlgItem(IDC_CHECK_PIECE_SELECT_TWO))->SetCheck(BST_UNCHECKED);
	((CButton *)GetDlgItem(IDC_CHECK_PIECE_SELECT_THREE))->SetCheck(BST_UNCHECKED);

	config.bPiece_Select_Loop = true;
//	chip_para.b_piece_select_loop = config.bPiece_Select_Loop;
}

void CConfig_Page2::OnRadioDefine() 
{
	// TODO: Add your control notification handler code here
	((CButton *)GetDlgItem(IDC_RADIO_LOOP))->SetCheck(0);

	GetDlgItem(IDC_CHECK_PIECE_SELECT_ZERO)->EnableWindow(TRUE);
	GetDlgItem(IDC_CHECK_PIECE_SELECT_ONE)->EnableWindow(TRUE);
	GetDlgItem(IDC_CHECK_PIECE_SELECT_TWO)->EnableWindow(TRUE);
	GetDlgItem(IDC_CHECK_PIECE_SELECT_THREE)->EnableWindow(TRUE);

	config.bPiece_Select_Loop = false;
//	chip_para.b_piece_select_loop = config.bPiece_Select_Loop;
}

⌨️ 快捷键说明

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