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

📄 ezmr.h

📁 FX2 68013的控制面板源程序
💻 H
字号:
////////////////////////////////////////////////////////////////////////////////
// EzMr.h : main header file for the EZMR application
// $Header: /USB/Util/EzMr/EzMr.h 13    3/07/02 11:18p Tpm $
// Copyright (c) 2000 Cypress Semiconductor. May not be reproduced without permission.
// See the EzUsb Developer's Kit license agreement for more details.
////////////////////////////////////////////////////////////////////////////////


#if !defined(AFX_EZMR_H__48EF15A5_65B1_11D1_8E2A_0060089D04CA__INCLUDED_)
#define AFX_EZMR_H__48EF15A5_65B1_11D1_8E2A_0060089D04CA__INCLUDED_

#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000

#ifndef __AFXWIN_H__
	#error include 'stdafx.h' before including this file for PCH
#endif

#include "resource.h"       // main symbols

/////////////////////////////////////////////////////////////////////////////
// CEzMrApp:
// See EzMr.cpp for the implementation of this class
//

/*
// Usb Device Descriptor information class
#define MAX_PIPES 16
#define PIPE_OUT 0
#define PIPE_IN 1
class UsbDevDesc
{
// Attributes
public:
	int m_nPipeEnds;
	CString m_strPipeEnds[MAX_PIPES];
	int m_nPipeDir[MAX_PIPES];
// Operations
public:

}
*/
#define MAX_PIPES 30
#define MAX_USB_DEV_NUMBER 32
#define MAX_OPS_PENDING MAX_PIPES

#define TGT_IMG_SIZE 0x10000 //64KB (65,536 Byte) target image
#define TGT_SEG_SIZE 16		//16 byte segments

struct MemSeg
{
	DWORD TAddr; //Target Address
	DWORD HAddr; //Host Address
	DWORD Size;  //block size
	DWORD Stat;  //status
	PCHAR pData; //data bytes
};

struct TMemImg
{
	CHAR data[TGT_IMG_SIZE]; //target image store
};

struct TMemCache
{
	TMemImg* pImg;	//pointer to image
	int nSeg;		//segment count
	MemSeg pSeg[TGT_IMG_SIZE/TGT_SEG_SIZE]; //info about segments
};

// ThreadInfo class
struct CThreadInfo
{
//	char* pcDriverName;
	CRichEditCtrl* hOutputBox;
	HWND hDlg;
	UINT message;
	WPARAM wParam;
	LPARAM lParam;
	void* pParentFrame;
	void* pView;
	void* pApp;
	int OpIndex;
	HANDLE m_hEventOpDone;
	CString strpcDriverName;
	CString strIoctlOut;
	int m_hOpPended;
	char* pBuf;
	int length;
	int pipeNum;
	UINT data;
	int interfaceNum;
	int alternateSetting;
	int packets;
	int bufCount;
	int pakPer;
	DWORD dldOffset;
	DWORD request;
	DWORD value;
	DWORD index;
	int direction;
	int bFX2;
};


class CEzMrApp : public CWinApp
{
public:
	virtual BOOL OnIdle(LONG lCount);
	CEzMrApp();
	void CEzMrApp::report_error(const char *fmt, ...);

	CString m_strPathExe;
	CString m_strMonFileName;
	CString m_strTargetName;
	CString m_strHexEdFileName;
	CString m_strLoopTestFileName;
	CString m_strExtLdrFile;
	CString m_strPathUSBRoot;
	int m_nTarg;
	CToolBar* pm_wndToolBar;

	CMultiDocTemplate* m_pUSBDocTemplate;
	CMultiDocTemplate* m_pHxEdDocTemplate;
	CMultiDocTemplate* m_pUsbDevsTemplate;
	CMultiDocTemplate* m_pUsbBldTemplate;
	CString m_strUSBDevs;
	CDocument* m_pUSBDoc[MAX_USB_DEV_NUMBER];

	TMemCache m_MemCache;	//target mem cache info
	TMemImg m_MemImg;		//target memory image

	int m_nVerbose;
	int m_nPopUpOps;
	int m_nAutoHoldRun;
	int m_bThreaded;
	int m_nMaxOpsPending;
	int m_nPollPorts;

	int m_nStringIndex;

	UCHAR m_uInterfaceInfo[1024];
	UCHAR m_uDevDescInfo[128+32];
	CThreadInfo m_recalcThreadInfo;

	int m_nLooping;
	int m_nTimerId; //next unique timer ID index
	int m_nQuietMode;

	int m_nUseNoLoader;
	int m_nUseUserDefinedLoader;

// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CEzMrApp)
	public:
	virtual BOOL InitInstance();
	virtual int ExitInstance();
	//}}AFX_VIRTUAL

// Implementation

	//{{AFX_MSG(CEzMrApp)
	afx_msg void OnAppAbout();
	afx_msg void OnOptionsEdithexfile();
	afx_msg void OnFileOpenAllDevs();
	afx_msg void OnFileGpifTool();
	afx_msg void OnFileUpdateAllDevs();
	afx_msg void OnOptionsRunCableTest();
	afx_msg void OnHelpGotoupdateonweb();
	afx_msg void OnHelpContactanchorchips();
	afx_msg void OnHelpContentsandtutorial();
	afx_msg void OnHelpControlpaneluserguide();
	afx_msg void OnUpdateFileGpiftool(CCmdUI* pCmdUI);
	afx_msg void OnOptionsFx2();
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()

};

//Global instances
extern CEzMrApp theApp;

//Global defs
#define MAX_IOCTL_BUFF 512
#define MAX_FILE_SIZE (1024*64)
#define MAX_EP0_XFER_SIZE (1024*4) // 4K Control EP0 transfer limit imposed by OS 
#define MAX_ISO_SIZE (256*256*16) // 1 Meg Iso buffer

#define IDS_USB_OPS_UNARY "Get Dev Desc\nGet Config Desc\nGet Pipe Info\n"
#define IDS_USB_OPS_VEN "Vendor Request\n"
#define IDS_USB_OPS_BULK "Bulk Byte Transfer\nBulk File Transfer\n"
#define IDS_USB_OPS_ANCHOR "Anchor Download\n"
#define IDS_USB_OPS_RES "Reset Pipe\nAbort Pipe\n"
#define IDS_USB_OPS_ISO "ISO Transfer\n"
#define IDS_USB_OPS_SET "Set Interface\n"

#define IDS_USB_EE_RAW     "FF FF FF FF FF FF FF"
#define IDS_USB_EE_DEV     "B0 47 05 80 00 01 00"
#define IDS_USB_EE_EZLINK  "B0 47 05 10 27 01 00"
#define IDS_USB_EE_EXAMPLE "B0 47 05 02 10 01 00"

#define OP_GET_DEVDES 0
#define OP_GET_CONDES 1
#define OP_GET_PIPINF 2
#define OP_VEND_REQST 3
#define OP_RW_BLK_BYT 4
#define OP_ANCHOR_DLD 5
#define OP_RESET_PIPE 6
#define OP_ABORT_PIPE 7
#define OP_ISO_TRANSF 8
#define OP_SET_INTERF 9
#define OP_8051__HOLD 10
#define OP_8051___RUN 11
#define OP_GETURBSTAT 12
#define OP_GET_CFRAME 13
#define OP_GET_STRING 14
#define OP_RESET_PORT 15
#define MAX_OP_NUMBER 16	//TPM: Also update below
							//TPM: Update InitEzMrCtrlBars()
							//TPM: Update g_strIoctl[]
							//TPM: Update SendOpThread() (if there are parameters)
							//TPM: SendOp()

// Translate to driver interface typedefs (in EzMain)
#define IDC_GETDEVICEDESCRIPTOR	OP_GET_DEVDES
#define IDC_GETCONFIGDESCRIPTOR	OP_GET_CONDES
#define IDC_GET_PIPE_INFO		OP_GET_PIPINF
#define IDC_VEND_REQUEST		OP_VEND_REQST
#define IDC_TRAN_BULK_DATA		OP_RW_BLK_BYT
#define IDC_ANCHOR_DOWNLOAD		OP_ANCHOR_DLD
#define IDC_RESETPIPE			OP_RESET_PIPE
#define IDC_ABORTPIPE			OP_ABORT_PIPE
#define IDC_ISO_TRANSFER		OP_ISO_TRANSF
#define IDC_SETINTERFACE		OP_SET_INTERF
#define IDC_RESET_HLD			OP_8051__HOLD
#define IDC_RESET_RLS			OP_8051___RUN
#define IDC_GET_LAST_ERROR		OP_GETURBSTAT
#define IDC_GET_CURRENT_FRAME	OP_GET_CFRAME
#define IDC_GETSTRINGDESCRIPTOR	OP_GET_STRING
#define IDC_RESET_PORT			OP_RESET_PORT
#define MAX_OP_ID				MAX_OP_NUMBER


//Global functions
	//BOOL CALLBACK bMainDlgProc(char* pcDriverName, HWND hOutputBox, HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);
	BOOL CALLBACK bMainDlgProc(LPVOID pThread, HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);



/////////////////////////////////////////////////////////////////////////////

//{{AFX_INSERT_LOCATION}}
// Microsoft Developer Studio will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_EZMR_H__48EF15A5_65B1_11D1_8E2A_0060089D04CA__INCLUDED_)

⌨️ 快捷键说明

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