Kinetis Bootloader Host  2.0.0
Host Tools for Kinetis devices
KinetisFlashToolDlg.h
1 /*
2 * Copyright (c) 2013-15, Freescale Semiconductor, Inc.
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without modification,
6 * are permitted provided that the following conditions are met:
7 *
8 * o Redistributions of source code must retain the above copyright notice, this list
9 * of conditions and the following disclaimer.
10 *
11 * o Redistributions in binary form must reproduce the above copyright notice, this
12 * list of conditions and the following disclaimer in the documentation and/or
13 * other materials provided with the distribution.
14 *
15 * o Neither the name of Freescale Semiconductor, Inc. nor the names of its
16 * contributors may be used to endorse or promote products derived from this
17 * software without specific prior written permission.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
20 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
21 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
23 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
24 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
25 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
26 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
28 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */
30 
31 // KinetisFlashToolDlg.h : header file
32 //
33 #pragma once
34 
35 #include "afxwin.h"
36 #include "afxcmn.h"
37 #include <Setupapi.h>
38 #include "UpdateDlg.h"
39 #include "FlashDlg.h"
40 #include "ConfigDlg.h"
41 #include "../../common/blfwkdll/blfwkdll.h"
42 
43 // class CKinetisFlashToolDlgAutoProxy;
44 
45 // CKinetisFlashToolDlg dialog
49 class CKinetisFlashToolDlg : public CDialogEx
50 {
51  DECLARE_DYNAMIC(CKinetisFlashToolDlg);
52  // friend class CKinetisFlashToolDlgAutoProxy;
53 
54  // Construction
55 public:
57  CKinetisFlashToolDlg(CWnd *pParent = NULL); // standard constructor
58 
60  virtual ~CKinetisFlashToolDlg();
61 
62  // Dialog Data
63  enum
64  {
65  IDD = IDD_KINETISFLASHTOOL_DIALOG
66  };
67 
68 protected:
69  virtual void DoDataExchange(CDataExchange *pDX); // DDX/DDV support
70 
71  // Implementation
72 protected:
73  // CKinetisFlashToolDlgAutoProxy* m_pAutoProxy;
74  HICON m_hIcon;
75 
76  BOOL CanExit();
77 
79  virtual BOOL OnInitDialog();
80  afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
81  afx_msg void OnPaint();
82  afx_msg HCURSOR OnQueryDragIcon();
83  afx_msg void OnClose();
84  virtual void OnOK();
85  virtual void OnCancel();
87 
88 
89  void RefreshComPortList();
90 
92  void RefreshBaudrateList();
93 
95  void RefreshPidList();
96 
98  void RefreshVidList();
99 
103  void AppendLog(CString log);
104 
106  void Reset();
107 
109  void Connect();
110 
111 public:
113  afx_msg void OnBnClickedRadio();
114  afx_msg void OnCbnSelchangeComboPortVid();
115  afx_msg void OnCbnSelchangeComboBaudPid();
116  afx_msg void OnKillfocusComboPortVid();
117  afx_msg void OnKillfocusComboBaudPid();
118  afx_msg void OnClickedButtonCntReset();
119  afx_msg void OnTcnSelchangeTabFunc(NMHDR *pNMHDR, LRESULT *pResult);
120  afx_msg void OnTimer(UINT_PTR nIDEvent);
121  afx_msg BOOL OnDeviceChange(UINT nEventType, DWORD_PTR dwData);
122 
124  afx_msg LRESULT OnUpdateLog(WPARAM wParam, LPARAM lParam);
125  afx_msg LRESULT OnChangeConnection(WPARAM wParam, LPARAM lParam);
126  afx_msg LRESULT OnUpdateStatus(WPARAM wParam, LPARAM lParam);
127 
129  void GetPeripheralConfig(blfwkdll::Updater::PeripheralConfig *config);
130 
133 
134  CComboBox m_comboPortOrVID;
135  CComboBox m_comboBaudOrPID;
138  CString m_securityState;
139  CString m_flashSize;
140  CString m_flashSector;
141  CString m_ramSize;
145  CString m_rsvRgnRamEnd;
146  CTabCtrl m_tabFunc;
147  CString m_log;
148  CEdit m_logCtrl;
152  HDEVNOTIFY m_devNotify;
153 };
CTabCtrl m_tabFunc
Control variable for tab control.
Definition: KinetisFlashToolDlg.h:146
FlashDlg class is the UI Dialog class for the Flash utilities tab page.
Definition: FlashDlg.h:39
void Connect()
Connect operation.
Definition: KinetisFlashToolDlg.cpp:490
CEdit m_logCtrl
Control variable for log textbox.
Definition: KinetisFlashToolDlg.h:148
void AppendLog(CString log)
Append a new log string to the log textbox.
Definition: KinetisFlashToolDlg.cpp:431
CString m_securityState
Variable for device info.
Definition: KinetisFlashToolDlg.h:138
void RefreshPidList()
Refresh PID list.
Definition: KinetisFlashToolDlg.cpp:405
DECLARE_MESSAGE_MAP() void RefreshComPortList()
Scan COM port and update it to UI.
CString m_rsvRgnRamStart
Variable for device info.
Definition: KinetisFlashToolDlg.h:144
CString m_log
Variable for log text box.
Definition: KinetisFlashToolDlg.h:147
CString m_ramSize
Variable for device info.
Definition: KinetisFlashToolDlg.h:141
CString m_flashSector
Variable for device info.
Definition: KinetisFlashToolDlg.h:140
CString m_bootloaderVersion
Variable for device info.
Definition: KinetisFlashToolDlg.h:136
CKinetisFlashToolDlg(CWnd *pParent=NULL)
Generated standard constructor.
Definition: KinetisFlashToolDlg.cpp:90
void RegisterUsbDeviceInterface()
Register usb device interface.
Definition: KinetisFlashToolDlg.cpp:351
void RefreshVidList()
Refresh VID list.
Definition: KinetisFlashToolDlg.cpp:418
void RefreshBaudrateList()
Refresh baud rate list.
Definition: KinetisFlashToolDlg.cpp:392
virtual BOOL OnInitDialog()
Generated message map functions.
CString m_flashSize
Variable for device info.
Definition: KinetisFlashToolDlg.h:139
CComboBox m_comboBaudOrPID
Control variable for Baud rate/PID combox.
Definition: KinetisFlashToolDlg.h:135
void Reset()
Reset operation.
Definition: KinetisFlashToolDlg.cpp:499
afx_msg void OnBnClickedRadio()
Generated message map functions.
Definition: KinetisFlashToolDlg.cpp:506
FlashDlg m_flashDlg
Variable for flash utility tab page.
Definition: KinetisFlashToolDlg.h:150
CString m_rsvRgnFlashStart
Variable for device info.
Definition: KinetisFlashToolDlg.h:142
CString m_protoclVersion
Variable for device info.
Definition: KinetisFlashToolDlg.h:137
UpdateDlg m_updateDlg
Variable for update tab page.
Definition: KinetisFlashToolDlg.h:149
CComboBox m_comboPortOrVID
Control variable for Com port/VID combox.
Definition: KinetisFlashToolDlg.h:134
afx_msg LRESULT OnUpdateLog(WPARAM wParam, LPARAM lParam)
User defined message map functions.
Definition: KinetisFlashToolDlg.cpp:881
CKinetisFlashToolDlg class is the UI Dialog class for the main page.
Definition: KinetisFlashToolDlg.h:49
CString m_rsvRgnRamEnd
Variable for device info.
Definition: KinetisFlashToolDlg.h:145
CString m_rsvRgnFlashEnd
Variable for device info.
Definition: KinetisFlashToolDlg.h:143
ConfigDlg class is the UI Dialog class for the BCA utilities tab page.
Definition: ConfigDlg.h:39
ConfigDlg m_bootloaderConfigDLg
Variable for config tab page.
Definition: KinetisFlashToolDlg.h:151
HDEVNOTIFY m_devNotify
Handler for device change notify.
Definition: KinetisFlashToolDlg.h:152
virtual ~CKinetisFlashToolDlg()
Generated standard destructor.
Definition: KinetisFlashToolDlg.cpp:109
void GetPeripheralConfig(blfwkdll::Updater::PeripheralConfig *config)
Get the PeripheralConfig of bootloader.
Definition: KinetisFlashToolDlg.cpp:440
UpdateDlg class is the UI Dialog class for the Update tab page.
Definition: UpdateDlg.h:39