mips32.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039 #ifndef dMIPS32_H
00040 #define dMIPS32_H
00041
00042
00043
00044
00045 int fMIPS32_EJTAG_Machine (void);
00046 unsigned int fMIPS32_ExecuteDebugModule(unsigned int *pui_module,unsigned int len,unsigned int runonce);
00047
00048
00049
00050
00051
00052
00053 #define dMIPS32_ECR_CPU_RESET_OCCURED 0x00000000 // Set to 1 if a reset occured
00054 #define dMIPS32_ECR_ACCESS_SIZE 0x60000000 // See below note 1
00055 #define dMIPS32_ECR_DOZE 0x00400000 // Set to 1 if processor is in low power mode
00056 #define dMIPS32_ECR_HALT 0x00200000 // Set to 1 if system bus clock is stopped
00057 #define dMIPS32_ECR_PERIPHERAL_RESET 0x00100000 // Set to 1 to reset peripherals (optional)
00058 #define dMIPS32_ECR_ACCESS_RW 0x00080000 // Set to 1 if pending access is write, 0 for read
00059 #define dMIPS32_ECR_ACCESS_PENDING 0x00040000 // Set to 1 to indicate access pending
00060 #define dMIPS32_ECR_CPU_RESET 0x00010000 // Set to 1 to reset CPU (optional)
00061 #define dMIPS32_ECR_PROBE_ENABLE 0x00008000 // Set to 1 to enable remote hosted memory
00062 #define dMIPS32_ECR_PROBE_VECTOR 0x00004000 // Set to 1 to use dmseg location for remote memory
00063 #define dMIPS32_ECR_EJTAG_BREAK 0x00001000 // Set to 1 to request a debug interrupt exception
00064 #define dMIPS32_ECR_IN_DEBUG_MODE 0x00000008 // Set to 1 to indicate in debug mode
00065
00066
00067
00068
00069 #define dMIPS32_ECR_ACCESS_BYTE 0x00000000 // 0 = 1 byte
00070 #define dMIPS32_ECR_ACCESS_HWORD 0x20000000 // 1 = 2 bytes
00071 #define dMIPS32_ECR_ACCESS_WORD 0x40000000 // 2 = 4 bytes
00072 #define dMIPS32_ECR_ACCESS_TRIPLE 0x60000000 // 3 = ? bytes
00073
00074
00075 #define dMIPS32_DERET_INSTRUCTION 0x4200001F // Big endian format
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086 #define dMIPS32_PSEUDO_STACK_ADDR 0xFF2001FC
00087
00088 #define dMIPS32_NUM_DEBUG_REGISTERS 38
00089
00090
00091 #define dMIPS32_PSEUDO_FIFO_ADDR 0xFF2001F8
00092 #define dMIPS32_PSEUDO_SERIAL_ADDR 0xFF2001F4
00093 #define dMIPS32_DATAMEM 0xFF200000
00094
00095
00096
00097 extern unsigned int ui_datamem[];
00098 extern unsigned int context_reg[];
00099 extern unsigned int uififo_raddr,uififo_waddr,*ui_fifomem,aui_readregisters_code[],ui_fifomem_size;
00100 extern unsigned int ui_ejtag_state;
00101 extern unsigned int ui_last_signal;
00102 extern unsigned int aui_writeregisters_code[];
00103
00104
00105
00106 #define dMIPS32_INST_BKPT_STATUS 0xFF301000
00107 #define dMIPS32_INST_BKPT_ADDR(X) 0xFF301100 + (X * 0x100)
00108 #define dMIPS32_INST_BKPT_ADDR_MSK(X) 0xFF301108 + (X * 0x100)
00109 #define dMIPS32_INST_BKPT_ASID(X) 0xFF301110 + (X * 0x100)
00110 #define dMIPS32_INST_BKPT_CONTROL(X) 0xFF301118 + (X * 0x100)
00111
00112 #define dMIPS32_DATA_BKPT_STATUS 0xFF302000
00113 #define dMIPS32_DATA_BKPT_ADDR(X) 0xFF302100 + (X * 0x100)
00114 #define dMIPS32_DATA_BKPT_ADDR_MSK(X) 0xFF302108 + (X * 0x100)
00115 #define dMIPS32_DATA_BKPT_ASID(X) 0xFF302110 + (X * 0x100)
00116 #define dMIPS32_DATA_BKPT_CONTROL(X) 0xFF302118 + (X * 0x100)
00117 #define dMIPS32_DATA_BKPT_VALUE(X) 0xFF302120 + (X * 0x100)
00118
00119
00120 #define dMIPS32_MAX_HARDWARE_BKPTS 0x10
00121
00122
00123
00124 #define dMIPS32_AU1500_HW_BKPT 0x17
00125
00126
00127 #define dMIPS32_EJTAG_WAIT_FOR_DEBUG_MODE 0x01
00128 #define dMIPS32_EJTAG_WAIT_FOR_CONTINUE 0x02
00129 #define dMIPS32_EJTAG_EXIT_DEBUG_MODE 0x03
00130 #define dMIPS32_EJTAG_FORCE_DEBUG_MODE 0x04
00131
00132
00133 #define dMIPS32_SW_BREAKPOINT_INSTRUCTION 0x7000003F
00134
00135
00136 #define dMIPS32_DEBUG_SW_BKPT 0x00000002
00137 #define dMIPS32_DEBUG_HW_INST_BKPT 0x00000010
00138 #define dMIPS32_DEBUG_HW_DATA_LD_BKPT 0x00000004
00139 #define dMIPS32_DEBUG_HW_DATA_ST_BKPT 0x00000008
00140 #define dMIPS32_DEBUG_HW_DATA_LD_IMP_BKPT 0x00040000
00141 #define dMIPS32_DEBUG_HW_DATA_ST_IMP_BKPT 0x00080000
00142 #define dMIPS32_DEBUG_SINGLE_STEP_BKPT 0x00000001
00143 #define dMIPS32_DEBUG_JTAG_BKPT 0x00000020
00144
00145
00146
00147
00148
00149 #define DRSEG_BASE 0xff300000
00150
00151 #define IBS_OFFSET 0x1000
00152
00153 #define IBAN_OFFSET(x) (0x1100+0x100*x)
00154
00155 #define IBMN_OFFESET(x) (0x1108+0x100*x)
00156
00157 #define IBASIDN_OFFSET(x) (0x1110+0x100*x)
00158
00159 #define IBCN_OFFSET(x) (0x1118+0x100*x)
00160 #define IBS (DRSEG_BASE+IBS_OFFSET)
00161 #define IBAN(x) (DRSEG_BASE+IBAN_OFFSET(x))
00162 #define IBMN(x) (DRSEG_BASE+IBMN_OFFSET(x))
00163 #define IBASIDN(x) (DRSEG_BASE+IBASIDN_OFFSET(x))
00164 #define IBCN(x) (DRSEG_BASE+IBCN_OFFSET(x))
00165
00166
00167 #define DBS_OFFSET 0x2000
00168
00169 #define DBAN_OFFSET(x) (0x2100+0x100*x)
00170
00171 #define DBMN_OFFSET(x) (0x2108+0x100*x)
00172
00173 #define DBASIDN_OFFSET(x) (0x2110+0x100*x)
00174
00175 #define DBCN_OFFSET(x) (0x2118+0x100*x)
00176
00177 #define DBVN_OFFSET(x) (0x2120+0x100*x)
00178 #define DBS (DRSEG_BASE+DBS_OFFSET)
00179 #define DBAN(x) (DRSEG_BASE+DBAN_OFFSET(x))
00180 #define DBMN(x) (DRSEG_BASE+DBMN_OFFSET(x))
00181 #define DBASIDN(x) (DRSEG_BASE+DBASIDN_OFFSET(x))
00182 #define DBCN(x) (DRSEG_BASE+DBCN_OFFSET(x))
00183 #define DBVN(x) (DRSEG_BASE+DBVN_OFFSET(x))
00184 #define HI_HALF_MASK 0x0000000c
00185 #define LO_HALF_MASK 0x00000003
00186 #define min(a,b) ((a)<(b)?(a):(b))
00187 #define tgt_compile(s) tgt_compile(s)
00188 #define tgt_exec(s,len) ({unsigned int codebuf[]=tgt_compile(s);fMIPS32_ExecuteDebugModule(codebuf,min(len,sizeof(codebuf)),1);})
00189 #define tgt_exec_safe(s,len) ({unsigned int codebuf[]=tgt_compile(s);fMIPS32_ExecuteDebugModule_safe(codebuf,min(len,sizeof(codebuf)),1);})
00190 unsigned char jtag_inb(unsigned long addr);
00191 unsigned short jtag_inw(unsigned long addr);
00192 unsigned int jtag_inl(unsigned long addr);
00193 void jtag_outb(unsigned long addr,unsigned char val);
00194 void jtag_outw(unsigned long addr,unsigned short val);
00195 void jtag_outl(unsigned long addr,unsigned int val);
00196
00197 #endif // #ifndef dMIPS32_H