📄 jtag.h
字号:
//*----------------------------------------------------------------------------
//* ATMEL Microcontroller Software Support - ROUSSET -
//*----------------------------------------------------------------------------
//* The software is delivered "AS IS" without warranty or condition of any
//* kind, either express, implied or statutory. This includes without
//* limitation any warranty or condition with respect to merchantability or
//* fitness for any particular purpose, or against the infringements of
//* intellectual property rights of others.
//*----------------------------------------------------------------------------
//* File Name : jtag.h
//* Object : Jtag Definition File.
//*
//* 1.0 27/02/02 NL : Creation
//*----------------------------------------------------------------------------
#ifndef jtag_h
#define jtag_h
#define READ_DEBUG_STATUS_MASK 0x9
#define PC_LOADED_MASK 0x8000
//* Define Watchdog
#define WATCHDOG 1000
#define TIMEOUT 100000
#define NB_TRY 10
#define ADD_WAIT_STATE 10000
//* Bug correction = add wait states
#define WAIT_STATE 1
#define NO_WAIT_STATE 0
//* Define registers
#define R0 0x0
#define R1 0x1
#define R2 0x2
#define R3 0x3
#define R4 0x4
#define R5 0x5
#define R6 0x6
#define R7 0x7
#define R8 0x8
#define R9 0x9
#define R10 0xA
#define R11 0xB
#define R12 0xC
#define SP 0xD
#define LR 0xE
#define PC 0xF
//* Define instructions
#define NOP 0xE1A00000
#define READ_REG 0xE58E0000
#define WRITE_REG 0xE59E0000
#define READ_MEM 0xE4901004
#define READ_MEM_HALFWORD 0xE0D010B4
#define WRITE_MEM 0xE4801004
#define WRITE_MEM_HALFWORD 0xE1C010B4
#define STM 0xE88E0000 //* or 0xE8AE0000
#define LDM 0xE89E0000
#define READ_CPSR 0xE10F0000
#define WRITE_CPSR 0xE12FF000
#define BRANCH_PC_5 0xEAFFFFFB
//* Size of Words to write
#define WORD 0
#define HALFWORD 1
//* Define mode
#define USER_MODE 0x10
#define FIQ_MODE 0x11
#define IRQ_MODE 0x12
#define SUPERVISOR_MODE 0x13
#define ABORT_MODE 0x17
#define UNDEF_MODE 0x1B
#define SYSTEM_MODE 0x1F
typedef enum irq_bit {IRQ, NO_IRQ} IRQ_BIT;
typedef enum fiq_bit {FIQ, NO_FIQ} FIQ_BIT;
typedef enum thumb_bit {ARM, THUMB} THUMB_BIT;
//* Global variables
extern u_int Current_Scan_Chain;
void JTAG_Select_Scan_Chain(u_int sc);
u_int JTAG_Read_Debug_Status(void);
u_int JTAG_Test_Is_Breaked(u_int value);
void JTAG_Execute(u_int instruction, u_int *data);
void JTAG_Nop(void);
void JTAG_Nop_System_Speed(void);
void JTAG_Read_Register(u_char index, u_int *value);
void JTAG_Write_Register(u_char index, u_int value);
void JTAG_Read_CPSR(u_int *value);
void JTAG_Write_CPSR(u_short mode, IRQ_BIT irq, FIQ_BIT fiq, THUMB_BIT thumb);
void JTAG_Analyse_CPSR(u_int value);
void JTAG_Read_Memory(u_int address, u_int *value, u_short halfword, u_short bug);
void JTAG_Write_Memory(u_int address, u_int value, u_short halfword, u_short bug);
void JTAG_Stop(void);
void JTAG_Write_ICEBreaker(u_char address, u_int data);
void JTAG_Read_ICEBreaker(u_char address, u_int *data);
void JTAG_Store_Multiple(u_int address, u_int mask);
void JTAG_Load_Multiple(u_int nb_data, u_int *data);
void JTAG_Go(u_int address);
void JTAG_Save_Context(u_int *context_tab);
u_int Com_Channel_Write_Data(u_int value);
u_int Com_Channel_Read_Data(u_int *value);
#endif /* jtag_h */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -