📄 config_page2.cpp.svn-base
字号:
// Config_Page2.cpp : implementation file
//
#include "stdafx.h"
#include "burnNAND.h"
#include "ConfigDlg.h"
#include "Config_Page2.h"
#include "burn.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CConfig_Page2 property page
extern configuration config;
extern UINT hex2int(const char *str);
IMPLEMENT_DYNCREATE(CConfig_Page2, CPropertyPage)
CConfig_Page2::CConfig_Page2() : CPropertyPage(CConfig_Page2::IDD)
{
//{{AFX_DATA_INIT(CConfig_Page2)
//}}AFX_DATA_INIT
init = FALSE;
// m_bPieceSelect_loop = FALSE;
// m_bPieceSelect_define = FALSE;
}
CConfig_Page2::~CConfig_Page2()
{
}
void CConfig_Page2::DoDataExchange(CDataExchange* pDX)
{
CPropertyPage::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CConfig_Page2)
DDX_Control(pDX, IDC_LIST_CHIP, m_list_chip);
DDX_Control(pDX, IDC_LIST_NANDFLASH_PARAMETER, m_list_nandflash_parameter);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CConfig_Page2, CPropertyPage)
//{{AFX_MSG_MAP(CConfig_Page2)
ON_BN_CLICKED(IDC_RADIO_GPIO, OnRadioGpio)
ON_BN_CLICKED(IDC_RADIO_REGISTER, OnRadioRegister)
ON_CBN_SELCHANGE(IDC_LIST_CHIP, OnSelchangeListChip)
ON_BN_CLICKED(IDC_RADIO_LOOP, OnRadioLoop)
ON_BN_CLICKED(IDC_RADIO_DEFINE, OnRadioDefine)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CConfig_Page2 message handlers
BOOL CConfig_Page2::OnInitDialog()
{
CPropertyPage::OnInitDialog();
// TODO: Add extra initialization here
ListView_SetExtendedListViewStyle(m_list_nandflash_parameter.m_hWnd, LVS_EX_GRIDLINES | LVS_EX_FULLROWSELECT);
m_list_nandflash_parameter.InsertColumn(0, "序号", LVCFMT_LEFT, 40);
m_list_nandflash_parameter.InsertColumn(1, "ChipID", LVCFMT_LEFT, 90);
m_list_nandflash_parameter.InsertColumn(2, "Page Size", LVCFMT_LEFT, 90);
m_list_nandflash_parameter.InsertColumn(3, "Page of one block", LVCFMT_LEFT, 90);
m_list_nandflash_parameter.InsertColumn(4, "Total block number", LVCFMT_LEFT, 90);
m_list_nandflash_parameter.InsertColumn(5, "Group block number", LVCFMT_LEFT, 90);
m_list_nandflash_parameter.InsertColumn(6, "Plane block number", LVCFMT_LEFT, 90);
m_list_nandflash_parameter.InsertColumn(7, "Spare size", LVCFMT_LEFT, 90);
m_list_nandflash_parameter.InsertColumn(8, "Column address cycle", LVCFMT_LEFT, 90);
m_list_nandflash_parameter.InsertColumn(9, "Last column addrress cycle mask bit", LVCFMT_LEFT, 90);
m_list_nandflash_parameter.InsertColumn(10, "Row address cycle", LVCFMT_LEFT, 90);
m_list_nandflash_parameter.InsertColumn(11, "Last row address cycle mask bit", LVCFMT_LEFT, 90);
m_list_nandflash_parameter.InsertColumn(12, "Custom nandflash", LVCFMT_LEFT, 90);
m_list_nandflash_parameter.InsertColumn(13, "Flag", LVCFMT_LEFT, 90);
m_list_nandflash_parameter.InsertColumn(14, "Command length", LVCFMT_LEFT, 90);
m_list_nandflash_parameter.InsertColumn(15, "Data length", LVCFMT_LEFT, 90);
m_list_nandflash_parameter.InsertColumn(16, "Descriptor string", LVCFMT_LEFT, 90);
//m_bPieceSelect_loop = TRUE;
//m_bPieceSelect_define = FALSE;
SetConfigItem();
init = TRUE;
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
bool CConfig_Page2::Get_ConfigData()
{
CString str;
GetDlgItemText(IDC_LIST_CHIP, str);
if(str == __T("AK_3223"))
{
config.chip_type = CHIP_3223;
config.bUBoot = false;
}
else if(str == __T("AK_3224"))
{
config.chip_type = CHIP_3224;
config.bUBoot = true;
}
else if(str == __T("AK_3225"))
{
config.chip_type = CHIP_3225;
config.bUBoot = true;
}
else
{
config.chip_type = CHIP_36XX;
config.bUBoot = true;
}
/* int check = ((CButton *)GetDlgItem(IDC_CHECK_UBOOT))->GetCheck();
if(check)
{
config.bUBoot = true;
}
else
{
config.bUBoot = false;
}
*/
GetDlgItemText(IDC_EDIT_NAND_RES_BLOCKS, str);
config.res_blocks = atoi(str);
//support auto download
int check = ((CButton *)GetDlgItem(IDC_CHECK_AUTO_DOWNLOAD))->GetCheck();
if(check)
{
config.bAutoDownload = true;
}
else
{
config.bAutoDownload = false;
}
//select the piece 0
check = ((CButton *)GetDlgItem(IDC_CHECK_PIECE_SELECT_ZERO))->GetCheck();
if(check == 1)
{
config.bHavePieceZero = true;
}
else
{
config.bHavePieceZero = false;
}
//select the piece 1
check = ((CButton *)GetDlgItem(IDC_CHECK_PIECE_SELECT_ONE))->GetCheck();
if(check == 1)
{
config.bHavePieceOne = true;
}
else
{
config.bHavePieceOne = false;
}
//select the piece 2
check = ((CButton *)GetDlgItem(IDC_CHECK_PIECE_SELECT_TWO))->GetCheck();
if(check == 1)
{
config.bHavePieceTwo = true;
}
else
{
config.bHavePieceTwo = false;
}
//select the piece 3
check = ((CButton *)GetDlgItem(IDC_CHECK_PIECE_SELECT_THREE))->GetCheck();
if(check == 1)
{
config.bHavePieceThree = true;
}
else
{
config.bHavePieceThree = false;
}
GetDlgItemText(IDC_EDIT_SYSTEM_CLOCK, str);
config.system_clock = atoi(str);
GetDlgItemText(IDC_EDIT_RAM_SIZE, str);
config.ram_size = atoi(str);
GetDlgItemText(IDC_COMBO_MEMORY_SIZE, str);
config.ram_size = atoi(str);
GetDlgItemText(IDC_COMBO_MEMORY_BANK, str);
config.ram_banks = atoi(str);
GetDlgItemText(IDC_COMBO_MEMORY_ROW, str);
config.ram_row = atoi(str);
GetDlgItemText(IDC_COMBO_MEMORY_COLUMN, str);
config.ram_column = atoi(str);
GetDlgItemText(IDC_COMBO_MEMORY_TYPE, str);
if(str == __T("SDRAM"))
config.memory_type = MEMORY_TYPE_SDRAM;
else
config.memory_type = MEMORY_TYPE_SRAM;
GetDlgItemText(IDC_EDIT_POWER_OFF_GPIO, str);
config.power_off_gpio = atoi(str);
check = ((CButton *)GetDlgItem(IDC_CHECK_NANDFLASH))->GetCheck();
if(check == 1)
{
config.bHaveNandflash = true;
}
else
{
config.bHaveNandflash = false;
}
check = ((CButton *)GetDlgItem(IDC_RADIO_GPIO))->GetCheck();
if(check == 1)//check gpio
{
config.init_usb = INIT_USB_GPIIO;
GetDlgItemText(IDC_EDIT_USB_GPIO, str);
config.init_usb_gpio_number = atoi(str);
}
else
{
config.init_usb = INIT_USB_REGISTER;
GetDlgItemText(IDC_EDIT_USB_REGISTER, str);
config.init_usb_register = hex2int(str);
GetDlgItemText(IDC_EDIT_USB_REGISTER_BIT, str);
config.init_usb_register_bit = atoi(str);
}
int count = m_list_nandflash_parameter.GetItemCount();
config.nandflash_parameter_count = count;
if(config.nandflash_parameter != NULL)
free(config.nandflash_parameter);
config.nandflash_parameter = (T_NAND_PHY_INFO* )malloc(sizeof(T_NAND_PHY_INFO) * config.nandflash_parameter_count);
memset(config.nandflash_parameter, 0, sizeof(T_NAND_PHY_INFO) * config.nandflash_parameter_count);
for(int i = 0; i < count; i++)
{
str = m_list_nandflash_parameter.GetItemText(i, 1);
config.nandflash_parameter[i].chip_id = hex2int(str);
str = m_list_nandflash_parameter.GetItemText(i, 2);
config.nandflash_parameter[i].page_size = atoi(str);
str = m_list_nandflash_parameter.GetItemText(i, 3);
config.nandflash_parameter[i].page_per_blk = atoi(str);
str = m_list_nandflash_parameter.GetItemText(i, 4);
config.nandflash_parameter[i].blk_num = atoi(str);
str = m_list_nandflash_parameter.GetItemText(i, 5);
config.nandflash_parameter[i].group_blk_num = atoi(str);
str = m_list_nandflash_parameter.GetItemText(i, 6);
config.nandflash_parameter[i].plane_blk_num = atoi(str);
str = m_list_nandflash_parameter.GetItemText(i, 7);
config.nandflash_parameter[i].spare_size = atoi(str);
str = m_list_nandflash_parameter.GetItemText(i, 8);
config.nandflash_parameter[i].col_cycle = atoi(str);
str = m_list_nandflash_parameter.GetItemText(i, 9);
config.nandflash_parameter[i].lst_col_mask = atoi(str);
str = m_list_nandflash_parameter.GetItemText(i, 10);
config.nandflash_parameter[i].row_cycle = atoi(str);
str = m_list_nandflash_parameter.GetItemText(i, 11);
config.nandflash_parameter[i].last_row_mask = atoi(str);
str = m_list_nandflash_parameter.GetItemText(i, 12);
config.nandflash_parameter[i].custom_nd = atoi(str);
str = m_list_nandflash_parameter.GetItemText(i, 13);
config.nandflash_parameter[i].flag = hex2int(str);
str = m_list_nandflash_parameter.GetItemText(i, 14);
config.nandflash_parameter[i].cmd_len = hex2int(str);
str = m_list_nandflash_parameter.GetItemText(i, 15);
config.nandflash_parameter[i].data_len = hex2int(str);
m_list_nandflash_parameter.GetItemText(i, 16,
(char *)config.nandflash_parameter[i].des_str, 255);
}
return true;
}
void CConfig_Page2::CleanListItem()
{
m_list_nandflash_parameter.DeleteAllItems();
}
void CConfig_Page2::SetConfigItem()
{
CString str;
CleanListItem();
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -