?? 復件 jtag.h
字號:
#if !defined(AFX_JTAG_H__2FDAC7FB_82FB_4B21_9613_33685D007824__INCLUDED_)
#define AFX_JTAG_H__2FDAC7FB_82FB_4B21_9613_33685D007824__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// jtag.h : header file
//
/*
DB25的2-9腳做為輸出端,對應D0-D7
TCK,TMS,TDI腳均選擇其中的某一個引腳
*/
#include "C8051.h"
#include "stdafx.h"
/////////////////////////////////////////////////////////////////////////////
// jtag window
class jtag : public CButton
{
// Construction
public:
jtag();
//TCK引腳;對PC而言,輸出引腳D0-D7;以下輸入輸出均對于PC
WORD m_woTCKPin;
//TMS引腳;輸出
WORD m_woTMSPin;
//TDI引腳;輸出
WORD m_woTDIPin;
//TDO 引腳;輸入
WORD m_wiTDOPin;
//TDO引腳所在的基地址偏移量
int m_iTDOAddP;
//電纜型號;
int m_iCcabletype;
//獲得數據端口地址
WORD m_nPort;
//獲得要寫入數據端口的值WriteValue(數據范圍為0~255)
unsigned char m_ucWriteValue;
// Attributes
public:
//返回TDO引腳的信息
bool TDO(void);
//TDI引腳波形發生函數
void TDI(bool bValue);
//TCK函數,生成TCK,參數為TCK的高 or 低
void TCK(bool bValue);
//TMS函數.生產TMS信號
void TMS(bool bValue);
// Operations
public:
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(jtag)
//}}AFX_VIRTUAL
// Implementation
public:
//設置電纜
unsigned char CableSetup();
//------------------------------------------------------------------------------------
// JTAG_Reset
//------------------------------------------------------------------------------------
// This routine places the JTAG state machine on the target system in
// the Test Logic Reset state by strobing TCK 5 times while leaving
// TMS high. Leaves the JTAG state machine in the Run_Test/Idle state.
void JTAG_Reset (void);
virtual ~jtag();
// Generated message map functions
//------------------------------------------------------------------------------------
// FLASH_ByteRead
//------------------------------------------------------------------------------------
// This routine reads the byte at <addr> and stores it at the address pointed to by
// <pdat>.
// Returns TRUE if the operation was successful; FALSE otherwise (page read-protected).
int FLASH_ByteRead (unsigned int addr, unsigned char *pdat);
//------------------------------------------------------------------------------------
// FLASH_PageErase
//------------------------------------------------------------------------------------
// This routine performs an erase of the page in which <addr> is contained.
// This routine assumes that no FLASH operations are currently in progress.
// This routine exits with no FLASH operations currently in progress.
// Returns TRUE if the operation was successful; FALSE otherwise (page protected).
int FLASH_PageErase (unsigned int addr);
//------------------------------------------------------------------------------------
// FLASH_ByteWrite
//------------------------------------------------------------------------------------
// This routine writes the data <dat> to FLASH at the address <addr>.
// Returns TRUE if the operation was successful; FALSE otherwise (page
// write-protected).
int FLASH_ByteWrite (unsigned int addr, unsigned char dat);
//------------------------------------------------------------------------------------
// JTAG_IRead
//------------------------------------------------------------------------------------
// This routine performs an indirect read of register <ireg>, of <num_bits> in length.
// It follows the read operation with a polling operation, and returns when the
// operation is completed. Note: the polling implemented here refers to the JTAG
// register read operation being completed, NOT the FLASH read operation.
// Polling for the FLASH read operation is handled at a higher level.
// Examples of valid indirect registers are:
// FLCN - FLASH Control
// FLSC - FLASH Scale
// FLA - FLASH Address
// FLD - FLASH Data
// Leaves in the Run_Test/Idle state.
unsigned long JTAG_IRead (unsigned int ireg, int num_bits);
//------------------------------------------------------------------------------------
// JTAG_IWrite
//------------------------------------------------------------------------------------
// This routine performs an indirect write to register <ireg>, containing <dat>, of
// <num_bits> in length. It follows the write operation with a polling operation, and
// returns when the operation is completed. Note: the polling implemented here refers
// to the JTAG register write operation being completed, NOT the FLASH write operation.
// Polling for the FLASH write operation is handled at a higher level
// Examples of valid indirect registers are:
// FLCN - FLASH Control
// FLSC - FLASH Scale
// FLA - FLASH Address
// FLD - FLASH Data
// Leaves in the Run_Test/Idle state.
void JTAG_IWrite (unsigned int ireg, unsigned long dat, int num_bits);
//------------------------------------------------------------------------------------
// JTAG_DR_Scan
//------------------------------------------------------------------------------------
// This routine shifts <num_bits> of <data> into the Data Register, and returns
// up to 32-bits of data read from the Data Register.
// Leaves in the Run_Test/Idle state.
// Assumes the JTAG state machine starts in the Run_Test/Idle state.
unsigned long JTAG_DR_Scan (unsigned long dat, int num_bits);
//------------------------------------------------------------------------------------
// JTAG_IR_Scan
//------------------------------------------------------------------------------------
// This routine loads the supplied <instruction> of <num_bits> length into the JTAG
// Instruction Register on the target system. Leaves in the Run_Test/Idle state.
// The return value is the n-bit value read from the IR.
// Assumes the JTAG state machine starts in the Run_Test/Idle state.
unsigned int JTAG_IR_Scan (unsigned int instruction, int num_bits);
//{{AFX_MSG(jtag)
// NOTE - the ClassWizard will add and remove member functions here.
//}}AFX_MSG
protected:
DECLARE_MESSAGE_MAP()
private:
//------------------------------------------------------------------------------------
// JTAG_StrobeTCK
//------------------------------------------------------------------------------------
// This routine strobes the TCK pin (brings high then back low again)
// on the target system.
void JTAG_StrobeTCK(void);
};
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_JTAG_H__2FDAC7FB_82FB_4B21_9613_33685D007824__INCLUDED_)
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -