mips32.c File Reference

#include <errno.h>
#include <signal.h>
#include <stdio.h>
#include <unistd.h>
#include <sys/time.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/wait.h>
#include <netinet/in.h>
#include <netdb.h>
#include "mips32.h"
#include "jtag.h"
#include <sys/stat.h>
#include <fcntl.h>
#include "ejtag.h"
#include <time.h>
#include <string.h>
#include "singlestepclear.h"
#include <cmdparser.h>
#include "readregisters.h"
#include "writeregisters.h"

Include dependency graph for mips32.c:

Go to the source code of this file.

Defines

#define CP0_DEBUG_SST_EN   (1<<8)
#define min(a, b)   (a<b?a:b)
#define PACK_SIZE   0x100000
#define STATE_CONNECTING   0
#define STATE_RUN   2
#define STATE_WAITING   1

Functions

int check_ejtag (char *buf, int *debug_reg)
static int cmd_timer (int argc, char **argv)
unsigned int context_restore (int *context_reg)
unsigned int context_save (int *context_reg)
unsigned int feed_acc (int data)
int fMIPS32_EJTAG_Machine (void)
unsigned int fMIPS32_ExecuteDebugModule (unsigned int *pui_module, unsigned int len, unsigned int flags)
unsigned int fMIPS32_ExecuteDebugModule_safe (unsigned int *pui_module, unsigned int len, unsigned int flags)
static unsigned int fMIPS32_ExitDebugMode (void)
static unsigned int fMIPS32_HandleRead (unsigned int ui_address)
static void fMIPS32_HandleWrite (unsigned int ui_address, unsigned int ui_data, int accesstype)
void fMIPS32_Init (void)
unsigned int fMIPS32_Transfer (unsigned int *pui_module, unsigned int len)
unsigned int fMIPS32_USB_DownloadModule (unsigned int *pui_module, unsigned int len)
unsigned int force_acc ()
unsigned int get_acc (unsigned int *op, int *address, int *data)
unsigned int get_DR (unsigned int upload_len)
unsigned int get_DR2 (void)
void jtag_crc_down (unsigned long addr_download)
void jtag_crc_table_down (unsigned long addr_download)
void jtag_download_crc_checksum (unsigned long addr_download, unsigned int buf_crc_checksum)
void jtag_download_length (unsigned long addr_download, unsigned int buf_length)
void jtag_getmem (char *dst, unsigned long addr, unsigned int len)
unsigned char jtag_inb (unsigned long addr)
unsigned int jtag_inl (unsigned long addr)
unsigned short jtag_inw (unsigned long addr)
void jtag_outb (unsigned long addr, unsigned char val)
void jtag_outl (unsigned long addr, unsigned int val)
void jtag_outw (unsigned long addr, unsigned short val)
void jtag_putmem (char *src, unsigned long addr, unsigned int len)
void jtag_quit ()
void jtag_self_down (unsigned long addr_download)
void jtag_self_down_crc (unsigned long addr_download)
void jtag_self_down_up (unsigned long addr_download)
unsigned int jtag_wait_k0_flag (unsigned long addr_readreg)
void * md_disasm (char *dest, void *addr, unsigned int inst)
 mycmd_init (timer, cmd_timer,"timer ms","set timer")
static int set_timer (int ms)
static void timer_handler (int sig)
void USB_UPLOAD_FAST (unsigned int upload_len)
unsigned int wait_address (unsigned int address, int write, int waitacc)

Variables

unsigned int code_inst_crc [100]
unsigned int code_inst_crc_old [100]
unsigned int code_inst_download []
unsigned int code_inst_download_crc [100]
unsigned int code_inst_upload [100]
unsigned int context_reg [dMIPS32_NUM_DEBUG_REGISTERS] = {0}
static const unsigned int crc32_table_down [256]
unsigned int debug_reg = 0
int Ejtag_boot_flag = 0
int ejtag_in_debug_mode = 0
int enable_timer
static int fMIPS32_inited = 0
int log_disasm
unsigned int miro_download_os_ret_inst []
unsigned int miro_initcp0_inst []
unsigned int miro_initsdram_inst []
unsigned int miro_initsdram_inst_2 []
unsigned int miro_inst []
unsigned int miro_inst_2 []
unsigned int miro_runcrc_inst []
unsigned int miro_savedepc_inst []
unsigned int timer_val = 1000
unsigned int ui_datamem [0x80]
unsigned int ui_ejtag_state
unsigned int * ui_fifomem
unsigned int ui_fifomem_size = 0x2000
unsigned int ui_last_signal
unsigned int ui_stack [32]
unsigned int ui_stack_index = 0
unsigned int uififo_raddr
unsigned int uififo_waddr


Define Documentation

#define CP0_DEBUG_SST_EN   (1<<8)

Definition at line 90 of file mips32.c.

#define min ( a,
b   )     (a<b?a:b)

Definition at line 1334 of file mips32.c.

#define PACK_SIZE   0x100000

Definition at line 800 of file mips32.c.

Referenced by fMIPS32_USB_DownloadModule().

#define STATE_CONNECTING   0

Definition at line 267 of file mips32.c.

Referenced by fMIPS32_ExecuteDebugModule(), and fMIPS32_Transfer().

#define STATE_RUN   2

Definition at line 269 of file mips32.c.

Referenced by fMIPS32_ExecuteDebugModule(), and fMIPS32_Transfer().

#define STATE_WAITING   1

Definition at line 268 of file mips32.c.

Referenced by fMIPS32_ExecuteDebugModule(), and fMIPS32_Transfer().


Function Documentation

int check_ejtag ( char *  buf,
int *  debug_reg 
)

Definition at line 104 of file mips32.c.

References dJTAG_REGISTER_CONTROL, dMIPS32_DEBUG_HW_DATA_LD_BKPT, dMIPS32_DEBUG_HW_DATA_LD_IMP_BKPT, dMIPS32_DEBUG_HW_DATA_ST_BKPT, dMIPS32_DEBUG_HW_DATA_ST_IMP_BKPT, dMIPS32_DEBUG_HW_INST_BKPT, dMIPS32_DEBUG_JTAG_BKPT, dMIPS32_DEBUG_SINGLE_STEP_BKPT, dMIPS32_DEBUG_SW_BKPT, dMIPS32_ECR_ACCESS_PENDING, dMIPS32_ECR_CPU_RESET_OCCURED, dMIPS32_ECR_IN_DEBUG_MODE, dMIPS32_ECR_PROBE_ENABLE, dMIPS32_ECR_PROBE_VECTOR, fJTAG_Data(), fJTAG_Instruction(), fMIPS32_ExecuteDebugModule(), md_disasm(), tgt_compile, and tgt_exec.

Referenced by cmd_si(), and timer_handler().

00105 {
00106         unsigned int ui_result,debug_reg1;
00107         char *p = buf;
00108         *p=0;
00109 
00110         ui_result = dMIPS32_ECR_CPU_RESET_OCCURED | dMIPS32_ECR_ACCESS_PENDING |
00111                 dMIPS32_ECR_PROBE_ENABLE | dMIPS32_ECR_PROBE_VECTOR;
00112 
00113         fJTAG_Instruction(dJTAG_REGISTER_CONTROL);
00114         ui_result = fJTAG_Data(ui_result);
00115 
00116         // Check for debug mode
00117         if (ui_result & dMIPS32_ECR_IN_DEBUG_MODE)
00118         {
00119 
00120                 // Read out the debug register to determine the cause
00121                 static int codebuf[100] =tgt_compile(
00122                                 "1:\n" 
00123                                 "mtc0   ra, $31;\n" 
00124                                 "bal 2f;\n"
00125                                 "nop;\n"
00126                                 ".word 0;\n"  /*v0*/
00127                                 ".word 0;\n"  /*debug reg*/
00128                                 ".word 0;\n"  /*depc*/
00129                                 ".word 0;\n"  /*inst*/
00130                                 "2:sw   v0,  0(ra);\n" 
00131                                 "mfc0   v0,  $23;\n" 
00132                                 "sw     v0,  4(ra);\n" 
00133                                 "mfc0   v0, $24;\n" 
00134                                 "sw     v0,  8(ra);\n" 
00135                                 "mfc0   v0, $24;\n" 
00136                                 "lw             v0,(v0)\n"
00137                                 "sw     v0,  12(ra);\n" 
00138                                 "lw     v0,  0(ra);\n" 
00139                                 "mfc0   ra, $31 ;\n" 
00140                                 "b 1b;\n" 
00141                                 "nop;\n" 
00142                                 );
00143 
00144                 fMIPS32_ExecuteDebugModule(codebuf,0x8000,1);
00145                 debug_reg1 = codebuf[4];
00146 
00147                 p += sprintf(p,"debug:%08x #",debug_reg1);
00148 
00149                 if (debug_reg1 & dMIPS32_DEBUG_SW_BKPT)
00150                         p += sprintf(p,"i");
00151 
00152                 if (debug_reg1 & dMIPS32_DEBUG_HW_INST_BKPT)
00153                         p += sprintf(p,"I ");
00154 
00155                 if (debug_reg1 & dMIPS32_DEBUG_HW_DATA_LD_BKPT)
00156                         p += sprintf(p,"l");
00157 
00158                 if (debug_reg1 & dMIPS32_DEBUG_HW_DATA_ST_BKPT)
00159                         p += sprintf(p,"s");
00160 
00161                 if (debug_reg1 & dMIPS32_DEBUG_HW_DATA_LD_IMP_BKPT)
00162                         p += sprintf(p,"L");
00163 
00164                 if (debug_reg1 & dMIPS32_DEBUG_HW_DATA_ST_IMP_BKPT)
00165                         p += sprintf(p,"S");
00166 
00167                 if(debug_reg1 & (dMIPS32_DEBUG_HW_DATA_LD_BKPT|dMIPS32_DEBUG_HW_DATA_ST_BKPT|dMIPS32_DEBUG_HW_DATA_LD_IMP_BKPT|dMIPS32_DEBUG_HW_DATA_ST_IMP_BKPT))
00168                 {
00169                 /*clear data breakpoint*/
00170                         tgt_exec(
00171                                         "1:\n" 
00172                                         "mtc0    $15, $31;\n" 
00173                                         "lui    $15,0xFF30;\n" 
00174                                         "sw $0,0x2000($15);\n"
00175                                         "mfc0    $15, $31;\n" 
00176                                         "b 1b;\n" \
00177                                         "nop;\n" \
00178                                         ,0x80000);
00179                 }
00180 
00181                 if (debug_reg1 & dMIPS32_DEBUG_SINGLE_STEP_BKPT)
00182                         p += sprintf(p," step");
00183 
00184                 if (debug_reg1 & dMIPS32_DEBUG_JTAG_BKPT)
00185                         p += sprintf(p,"user ");
00186                 if (debug_reg1 & 0x100000)
00187                         p += sprintf(p," exp");
00188 
00189                 p += sprintf(p,"\n");
00190                 md_disasm (p, codebuf[5], codebuf[6]);
00191         *debug_reg = debug_reg1;
00192 
00193         }
00194         else 
00195         {
00196                 p += sprintf(p,"not in debug mode");
00197         *debug_reg = 0;
00198         }
00199 
00200         
00201         return ui_result;
00202 }

Here is the call graph for this function:

static int cmd_timer ( int  argc,
char **  argv 
) [static]

Definition at line 249 of file mips32.c.

References set_timer().

00250 {
00251         if(argc != 2)return -1;
00252         set_timer(strtoul(argv[1],0,0));
00253         return 0;
00254 }

Here is the call graph for this function:

unsigned int context_restore ( int *  context_reg  ) 

Definition at line 1774 of file mips32.c.

References aui_writeregisters_code, dMIPS32_NUM_DEBUG_REGISTERS, fMIPS32_ExecuteDebugModule(), ui_fifomem, uififo_raddr, and uififo_waddr.

Referenced by cmd_checksum(), cmd_fget(), cmd_fput(), cmd_fputflash(), cmd_get(), cmd_program(), cmd_put(), cmd_restore(), cmd_test_erase_spi_area(), and cmd_test_program_spi().

01775 {
01776         int i=0;
01777           uififo_raddr=0;
01778           uififo_waddr=0;
01779         for(i=0;i<dMIPS32_NUM_DEBUG_REGISTERS;i++)
01780         {
01781                 ui_fifomem[i]=context_reg[i];
01782         }
01783         fMIPS32_ExecuteDebugModule(aui_writeregisters_code,0x80000,1);
01784         return 0;
01785         
01786 }

Here is the call graph for this function:

unsigned int context_save ( int *  context_reg  ) 

Definition at line 1758 of file mips32.c.

References aui_readregisters_code, dMIPS32_NUM_DEBUG_REGISTERS, fMIPS32_ExecuteDebugModule(), ui_fifomem, uififo_raddr, and uififo_waddr.

Referenced by cmd_checksum(), cmd_fget(), cmd_fput(), cmd_fputflash(), cmd_get(), cmd_program(), cmd_put(), cmd_save(), cmd_test_erase_spi_area(), and cmd_test_program_spi().

01759 {
01760         int i=0;
01761           uififo_raddr=0;
01762           uififo_waddr=0;
01763           memset(ui_fifomem,0,38*4);
01764         fMIPS32_ExecuteDebugModule(aui_readregisters_code,0x80000,1);
01765         
01766         for(i=0;i<dMIPS32_NUM_DEBUG_REGISTERS;i++)
01767         {
01768                 context_reg[i]=ui_fifomem[i];
01769         }
01770         return 0;
01771         
01772 }

Here is the call graph for this function:

unsigned int feed_acc ( int  data  ) 

Definition at line 325 of file mips32.c.

References dJTAG_REGISTER_CONTROL, dJTAG_REGISTER_DATA, dMIPS32_ECR_CPU_RESET_OCCURED, dMIPS32_ECR_PROBE_ENABLE, dMIPS32_ECR_PROBE_VECTOR, fJTAG_Data(), and fJTAG_Instruction().

Referenced by cmd_goback().

00326 {
00327         int ui_result,ui_data = data;
00328         fJTAG_Instruction(dJTAG_REGISTER_DATA);
00329         ui_data = fJTAG_Data(ui_data);
00330         // Clear the access pending bit (let the processor eat!)
00331         ui_result = dMIPS32_ECR_CPU_RESET_OCCURED | dMIPS32_ECR_PROBE_ENABLE | 
00332                 dMIPS32_ECR_PROBE_VECTOR;
00333 
00334         fJTAG_Instruction(dJTAG_REGISTER_CONTROL);
00335         ui_result = fJTAG_Data(ui_result);
00336         return ui_result;
00337 }

Here is the call graph for this function:

int fMIPS32_EJTAG_Machine ( void   ) 

Definition at line 1015 of file mips32.c.

References aui_singlestepclear_code, dJTAG_REGISTER_CONTROL, dMIPS32_AU1500_HW_BKPT, dMIPS32_DEBUG_HW_DATA_LD_BKPT, dMIPS32_DEBUG_HW_DATA_LD_IMP_BKPT, dMIPS32_DEBUG_HW_DATA_ST_BKPT, dMIPS32_DEBUG_HW_DATA_ST_IMP_BKPT, dMIPS32_DEBUG_HW_INST_BKPT, dMIPS32_DEBUG_JTAG_BKPT, dMIPS32_DEBUG_SINGLE_STEP_BKPT, dMIPS32_DEBUG_SW_BKPT, dMIPS32_ECR_ACCESS_PENDING, dMIPS32_ECR_CPU_RESET_OCCURED, dMIPS32_ECR_EJTAG_BREAK, dMIPS32_ECR_IN_DEBUG_MODE, dMIPS32_ECR_PROBE_ENABLE, dMIPS32_ECR_PROBE_VECTOR, dMIPS32_EJTAG_EXIT_DEBUG_MODE, dMIPS32_EJTAG_FORCE_DEBUG_MODE, dMIPS32_EJTAG_WAIT_FOR_CONTINUE, dMIPS32_EJTAG_WAIT_FOR_DEBUG_MODE, fJTAG_Data(), fJTAG_Instruction(), fMIPS32_ExecuteDebugModule(), fMIPS32_ExitDebugMode(), tgt_exec, ui_datamem, ui_ejtag_state, and ui_last_signal.

Referenced by fGDBRDP_Handler().

01016 {
01017   unsigned int ui_result;
01018 
01019   // Need to handle resets here on each execution.
01020   ui_result = dMIPS32_ECR_CPU_RESET_OCCURED | dMIPS32_ECR_ACCESS_PENDING |
01021               dMIPS32_ECR_PROBE_ENABLE | dMIPS32_ECR_PROBE_VECTOR;
01022 
01023   fJTAG_Instruction(dJTAG_REGISTER_CONTROL);
01024   ui_result = fJTAG_Data(ui_result);
01025 
01026   // Check for reset
01027   if (ui_result & dMIPS32_ECR_CPU_RESET_OCCURED)
01028   {
01029     // Reset occured - Must acknowlege this before EJTAG will work
01030     printf("JTAGEMUL: Processor was reset.\n");
01031     
01032     // Clear the reset and set our bits
01033     ui_result = dMIPS32_ECR_ACCESS_PENDING | dMIPS32_ECR_PROBE_ENABLE | 
01034                 dMIPS32_ECR_PROBE_VECTOR;
01035 
01036     ui_result = fJTAG_Data(ui_result);
01037   }
01038   
01039   switch(ui_ejtag_state)
01040   {
01041     case dMIPS32_EJTAG_WAIT_FOR_DEBUG_MODE:
01042       // Check to see if we have entered debug mode
01043 
01044       ui_result = dMIPS32_ECR_CPU_RESET_OCCURED | dMIPS32_ECR_ACCESS_PENDING |
01045                   dMIPS32_ECR_PROBE_ENABLE | dMIPS32_ECR_PROBE_VECTOR;
01046 
01047       fJTAG_Instruction(dJTAG_REGISTER_CONTROL);
01048       ui_result = fJTAG_Data(ui_result);
01049       
01050       // Check for debug mode
01051       if (ui_result & dMIPS32_ECR_IN_DEBUG_MODE)
01052       {
01053         // We have entered debug mode.
01054         ui_ejtag_state = dMIPS32_EJTAG_WAIT_FOR_CONTINUE;
01055         
01056         printf("JTAGEMUL: Debug exception!\n");
01057 
01058         // Turn on the debug mode LED
01059 //        fMIPS32_ExecuteDebugModule(aui_led_code,0x80000);
01060 
01061         // Read out the debug register to determine the cause
01062  tgt_exec(\
01063 "1:\n" \
01064 "       mtc0    $15, $31;\n" \
01065 "       lui     $15, 0xFF20;\n" \
01066 "       sw      $2,  0x1fc($15);\n" \
01067 "       mfc0    $2,  $23;\n" \
01068 "       sw      $2,  0($15);\n" \
01069 "       lw      $2,  0x1fc($15);\n" \
01070 "       mfc0    $15, $31 ;\n" \
01071 "       b 1b;\n" \
01072 "       nop;\n" \
01073 ,0x8000);
01074 
01075         // We're done with ui_result at this point - Use it as a count
01076         // of how many exceptions matched.  We only ever want to match
01077         // one exception at any given time.
01078         ui_result = 0x00;
01079                 printf("ui_datamem[0]=%x\n",ui_datamem[0]);
01080 
01081         if (ui_datamem[0] & dMIPS32_DEBUG_SW_BKPT)
01082         {
01083           ui_result++;
01084           ui_last_signal=SIGTRAP; // Breakpoint
01085         }
01086         if (ui_datamem[0] & dMIPS32_DEBUG_HW_INST_BKPT)
01087         {
01088           ui_result++;
01089           ui_last_signal=SIGTRAP; // Breakpoint
01090         }
01091         if (ui_datamem[0] & dMIPS32_DEBUG_HW_DATA_LD_BKPT)
01092         {
01093           ui_result++;
01094           ui_last_signal=SIGTRAP; // Breakpoint
01095         }
01096         if (ui_datamem[0] & dMIPS32_DEBUG_HW_DATA_ST_BKPT)
01097         {
01098           ui_result++;
01099           ui_last_signal=SIGTRAP; // Breakpoint
01100         }
01101         if (ui_datamem[0] & dMIPS32_DEBUG_HW_DATA_LD_IMP_BKPT)
01102         {
01103           ui_result++;
01104           ui_last_signal=SIGTRAP; // Breakpoint
01105         }
01106         if (ui_datamem[0] & dMIPS32_DEBUG_HW_DATA_ST_IMP_BKPT)
01107         {
01108           ui_result++;
01109           ui_last_signal=SIGTRAP; // Breakpoint
01110         }
01111         if (ui_datamem[0] & dMIPS32_DEBUG_SINGLE_STEP_BKPT)
01112         {
01113           ui_result++;
01114           ui_last_signal=SIGTRAP; // Breakpoint
01115           
01116           // We need to clear the single step bit
01117           fMIPS32_ExecuteDebugModule(aui_singlestepclear_code,0x80000,1);
01118         }
01119         if (ui_datamem[0] & dMIPS32_DEBUG_JTAG_BKPT)
01120         {
01121           ui_result++;
01122           ui_last_signal=SIGTSTP; // User stop
01123         }
01124 
01125         // Check for AU1500 specific hardware breakpoint
01126         ui_datamem[0] = ui_datamem[0] >> 10;
01127         ui_datamem[0] &= 0x1F;
01128         if (dMIPS32_AU1500_HW_BKPT == ui_datamem[0])
01129         {
01130           ui_result++;
01131           ui_last_signal=SIGTRAP; // Breakpoint
01132         }
01133 
01134         if (ui_result == 0x00)
01135         {
01136           printf("JTAGEMUL ERROR: Unknown debug exception = 0x%08X\n", ui_datamem[0]);
01137         }
01138         if (ui_result > 0x01)
01139         {
01140           printf("JTAGEMUL ERROR: Multiple debug exceptions = 0x%08X\n", ui_datamem[0]);
01141         }
01142 
01143         return(-1); // Tell GDBRDP we entered debug mode
01144       }
01145       
01146       break;
01147 
01148     case dMIPS32_EJTAG_WAIT_FOR_CONTINUE:
01149       // Check to see if we have stayed in debug mode
01150 
01151       ui_result = dMIPS32_ECR_CPU_RESET_OCCURED | dMIPS32_ECR_ACCESS_PENDING |
01152                   dMIPS32_ECR_PROBE_ENABLE | dMIPS32_ECR_PROBE_VECTOR;
01153 
01154       fJTAG_Instruction(dJTAG_REGISTER_CONTROL);
01155       ui_result = fJTAG_Data(ui_result);
01156       
01157       // Check for debug mode
01158       if (!(ui_result & dMIPS32_ECR_IN_DEBUG_MODE))
01159       {
01160         // Program got away from us and is RUNNING!?!?!?! ARGH!
01161         printf("JTAGEMUL: Program got away, currently running!\n");
01162 
01163         ui_ejtag_state = dMIPS32_EJTAG_WAIT_FOR_DEBUG_MODE;
01164       }
01165       
01166       break;
01167       
01168     case dMIPS32_EJTAG_EXIT_DEBUG_MODE:
01169       if (!fMIPS32_ExitDebugMode()) 
01170       {
01171         printf("JTAGEMUL ERROR: Could not resume!\n");
01172       }
01173 
01174       ui_ejtag_state = dMIPS32_EJTAG_WAIT_FOR_DEBUG_MODE;
01175       break;
01176 
01177     case dMIPS32_EJTAG_FORCE_DEBUG_MODE:
01178       // Force debug break  
01179       ui_result = dMIPS32_ECR_CPU_RESET_OCCURED | dMIPS32_ECR_ACCESS_PENDING |
01180                   dMIPS32_ECR_PROBE_ENABLE | dMIPS32_ECR_PROBE_VECTOR |
01181                   dMIPS32_ECR_EJTAG_BREAK;
01182   
01183       fJTAG_Instruction(dJTAG_REGISTER_CONTROL);
01184       ui_result = fJTAG_Data(ui_result);
01185 
01186       ui_ejtag_state = dMIPS32_EJTAG_WAIT_FOR_DEBUG_MODE;
01187       break;
01188     
01189     default:
01190       // Should never get here
01191       ui_ejtag_state = dMIPS32_EJTAG_WAIT_FOR_DEBUG_MODE;
01192       printf("JTAGEMUL ERROR: Corrupted debug mode catcher state!\n");
01193       break;  
01194   }
01195   
01196   return(1);
01197 }

Here is the call graph for this function:

unsigned int fMIPS32_ExecuteDebugModule ( unsigned int *  pui_module,
unsigned int  len,
unsigned int  flags 
)

Definition at line 473 of file mips32.c.

References dJTAG_REGISTER_ADDRESS, dJTAG_REGISTER_CONTROL, dJTAG_REGISTER_DATA, dJTAG_REGISTER_EJTAG_BOOT, dJTAG_REGISTER_FASTDATA, dMIPS32_ECR_ACCESS_PENDING, dMIPS32_ECR_ACCESS_RW, dMIPS32_ECR_CPU_RESET_OCCURED, dMIPS32_ECR_EJTAG_BREAK, dMIPS32_ECR_IN_DEBUG_MODE, dMIPS32_ECR_PROBE_ENABLE, dMIPS32_ECR_PROBE_VECTOR, Ejtag_boot_flag, fJTAG_Data(), fJTAG_FastData(), fJTAG_Instruction(), fMIPS32_HandleRead(), fMIPS32_HandleWrite(), fMIPS32_Init(), log_disasm, md_disasm(), STATE_CONNECTING, STATE_RUN, and STATE_WAITING.

Referenced by __cp0syscall1(), __cp0syscall2(), check_ejtag(), cmd_cache(), cmd_cacheflush(), cmd_checksum(), cmd_erase(), cmd_erase_area(), cmd_fget(), cmd_fput(), cmd_fputflash(), cmd_get(), cmd_program(), cmd_put(), cmd_run(), cmd_set(), cmd_si(), cmd_test_erase_spi_area(), cmd_test_program_spi(), context_restore(), context_save(), fGDBRDP_CommandInterpreter(), fMIPS32_EJTAG_Machine(), fMIPS32_ExecuteDebugModule_safe(), and help_access().

00474 {
00475   unsigned int ui_result;
00476   unsigned int ui_address;
00477   unsigned int ui_data;
00478   unsigned int ui_finished;
00479   unsigned int start_address;
00480   unsigned int end_address;
00481   unsigned int state=STATE_CONNECTING;
00482   unsigned int download_size=0;
00483   unsigned int init_do=0;
00484     //time_t *time_start=malloc(sizeof(time_t));
00485     //time_t *time_end=malloc(sizeof(time_t));
00486     time_t time_start;
00487     time_t time_end;
00488     time_t  time_deta=0;
00489         int runonce=flags&1;
00490         int waitacc=!(flags&2);
00491         int allowbefore=flags&4;
00492     
00493 
00494   fprintf(stderr,"JTAGEMUL: Executing a module.\n");
00495   fMIPS32_Init();
00496 
00497   fprintf(stderr,"connecting...\n");
00498 #if 0
00499   if(!Ejtag_boot_flag)
00500   {
00501         fprintf(stderr,"===============dJTAG_REGISTER_EJTAG_BOOT ==========\n");
00502         Ejtag_boot_flag=1;      
00503         fJTAG_Instruction(dJTAG_REGISTER_EJTAG_BOOT);
00504   }
00505          fprintf(stderr,"dJTAG_REGISTER_EJTAG_BOOT done\n");
00506 #endif
00507   
00508 while(1)
00509 {
00510   ui_result = dMIPS32_ECR_CPU_RESET_OCCURED|dMIPS32_ECR_ACCESS_PENDING|dMIPS32_ECR_PROBE_ENABLE | dMIPS32_ECR_PROBE_VECTOR ;
00511   fJTAG_Instruction(dJTAG_REGISTER_CONTROL);
00512   ui_result = fJTAG_Data(ui_result);
00513 
00514 if(!(ui_result&dMIPS32_ECR_IN_DEBUG_MODE))  {
00515     ui_result = dMIPS32_ECR_PROBE_ENABLE | dMIPS32_ECR_PROBE_VECTOR |dMIPS32_ECR_EJTAG_BREAK;
00516   fJTAG_Instruction(dJTAG_REGISTER_CONTROL);
00517   ui_result = fJTAG_Data(ui_result);
00518   continue;
00519   }
00520   fprintf(stderr,"connected\n");
00521   state=STATE_RUN;
00522   break;
00523 }
00524 
00525     fJTAG_Instruction(dJTAG_REGISTER_ADDRESS);
00526     start_address = fJTAG_Data(0x00)|0xff000000;
00527         end_address=start_address+len;
00528     ui_finished    = 0x00;
00529           fprintf(stderr,"start_address=%x,end_address=%x\n",start_address,end_address);
00530 
00531 
00532   // Feed that chip
00533   while (1)
00534   {
00535     // Read the control register.  Make sure an access is requested, then 
00536     // do it.
00537     ui_result = dMIPS32_ECR_CPU_RESET_OCCURED | dMIPS32_ECR_ACCESS_PENDING |
00538                 dMIPS32_ECR_PROBE_ENABLE | dMIPS32_ECR_PROBE_VECTOR;
00539   
00540     fJTAG_Instruction(dJTAG_REGISTER_CONTROL);
00541     ui_result = fJTAG_Data(ui_result);
00542         if(!(ui_result & dMIPS32_ECR_IN_DEBUG_MODE))
00543         {
00544       fprintf(stderr,"not in debug mode!\n");
00545     //            printf("not in debug mode!\n");
00546           return 0;
00547         }
00548     
00549     if (!(ui_result & dMIPS32_ECR_ACCESS_PENDING))
00550     {
00551           if(!waitacc)return -1;
00552           if(state!=STATE_WAITING)printf("waiting\n");
00553           state=STATE_WAITING;
00554           continue;
00555     }
00556         state=STATE_RUN;
00557 
00558         
00559     fJTAG_Instruction(dJTAG_REGISTER_ADDRESS);
00560     ui_address = fJTAG_Data(0x00)|0xff000000;
00561    
00562      if(ui_address<0xff200000|| ui_address>=0xff300000)
00563      {
00564      fprintf(stderr,"JTAGEMUL: %s to unknown location 0x%08X.\n", (ui_result & dMIPS32_ECR_ACCESS_RW)?"write":"read",ui_address);
00565      return 0;
00566      }
00567 
00568    //fprintf(stderr,"%s ui_address=%x,accesstype=%x\n",(ui_result & dMIPS32_ECR_ACCESS_RW)?"write":"read",ui_address,(ui_result>>29)&3);
00569     // Check for read or write
00570     if (ui_result & dMIPS32_ECR_ACCESS_RW) // Bit set for a WRITE
00571     {
00572       unsigned data0,data1,mask;
00573       int accesstype=(ui_result>>29)&3;
00574       // Read the data out
00575 #ifdef USE_FASTDATA
00576       fJTAG_Instruction(dJTAG_REGISTER_FASTDATA);
00577       ui_data = fJTAG_FastData(0x00);
00578 #else
00579           fJTAG_Instruction(dJTAG_REGISTER_DATA);
00580       ui_data = fJTAG_Data(0x00);
00581       // Clear the access pending bit (let the processor eat!)
00582       ui_result = dMIPS32_ECR_CPU_RESET_OCCURED | dMIPS32_ECR_PROBE_ENABLE | 
00583                   dMIPS32_ECR_PROBE_VECTOR;
00584   
00585       fJTAG_Instruction(dJTAG_REGISTER_CONTROL);
00586       ui_result = fJTAG_Data(ui_result);
00587 #endif
00588 
00589         if(ui_address >= 0xFF200200)
00590         {
00591        data0=pui_module[(ui_address - start_address) / 4];
00592        data1=ui_data;
00593 
00594         switch(accesstype)
00595         {
00596         case 0:
00597         mask=0xff<<((ui_address&3)*8); break;
00598         case 1:
00599         mask=0xffff<<(((ui_address>>1)&1)*16); break;
00600         case 2: mask=0xffffffff;break;
00601         default: mask=0xffffff<<((ui_address&1)*8);break;
00602         }
00603 
00604         ui_data=(data1&mask)|(data0&~mask);
00605         }
00606 
00607       // Processor is writing to us
00608       if (ui_address >= 0xFF200200)
00609         pui_module[(ui_address - start_address) / 4]=ui_data;
00610       else
00611       {
00612         // Data out to the real world
00613         //fprintf(stderr,"JTAGEMUL: Write 0x%08X to address 0x%08X.\n", ui_data, ui_address);
00614         fMIPS32_HandleWrite(ui_address, ui_data, accesstype);
00615       }
00616     }
00617     else
00618     {
00619       // Check to see if its reading at the debug vector.  The first pass through
00620       // the module is always read at the vector, so the first one we allow.  When
00621       // the second read from the vector occurs we are done and just exit.
00622       if ((start_address == ui_address)&&runonce)
00623       {
00624         if (ui_finished++) // Allows ONE pass
00625         {
00626                 ui_finished=0;
00627          // fprintf(stderr,"JTAGEMUL: Finished module.\n");
00628           return ui_address;
00629         }
00630       }
00631 
00632       // Processor is reading from us
00633       if (ui_address >= 0xFF200200)
00634       {
00635             if(ui_address>=end_address|| ( ui_address<start_address && !allowbefore))return ui_address;
00636         // Reading an instruction from our module
00637 
00638         // Fetch the instruction from the module
00639         //fprintf(stderr,"JTAGEMUL: Instruction read at 0x%08X ", ui_address); fflush(stdout);
00640         ui_data = (ui_address - start_address) / 4;
00641         //fprintf(stderr,"offset -> %04d ", ui_data); fflush(stdout);
00642         ui_data = *(unsigned int *)(pui_module + ui_data);
00643         //fprintf(stderr,"data -> 0x%08X\n", ui_data); fflush(stdout);
00644         
00645         if(log_disasm)
00646         {
00647         char buf[256];
00648         md_disasm (buf, ui_address, ui_data);
00649         fprintf(stderr,"%s\n",buf);
00650         }
00651 
00652         // Send the data out
00653 #ifdef USE_FASTDATA
00654         fJTAG_Instruction(dJTAG_REGISTER_FASTDATA);
00655         ui_data = fJTAG_Data(ui_data);
00656 #else
00657           fJTAG_Instruction(dJTAG_REGISTER_DATA);
00658       ui_data = fJTAG_Data(ui_data);
00659         // Clear the access pending bit (let the processor eat!)
00660         ui_result = dMIPS32_ECR_CPU_RESET_OCCURED | dMIPS32_ECR_PROBE_ENABLE | 
00661                     dMIPS32_ECR_PROBE_VECTOR;
00662   
00663         fJTAG_Instruction(dJTAG_REGISTER_CONTROL);
00664         ui_result = fJTAG_Data(ui_result);
00665 #endif
00666       }
00667       else
00668       {
00669         // A read from dmseg virtual registers
00670         ui_data = fMIPS32_HandleRead(ui_address);
00671       
00672 
00673         //fprintf(stderr,"JTAGEMUL: Read address 0x%08X result = 0x%08X.\n", ui_address, ui_data);
00674 
00675         // Send the data out
00676 #ifdef USE_FASTDATA
00677         fJTAG_Instruction(dJTAG_REGISTER_FASTDATA);
00678         ui_data = fJTAG_Data(ui_data);
00679 #else
00680           fJTAG_Instruction(dJTAG_REGISTER_DATA);
00681       ui_data = fJTAG_Data(ui_data);
00682         // Clear the access pending bit (let the processor eat!)
00683         ui_result = dMIPS32_ECR_CPU_RESET_OCCURED | dMIPS32_ECR_PROBE_ENABLE | 
00684                     dMIPS32_ECR_PROBE_VECTOR;
00685   
00686         fJTAG_Instruction(dJTAG_REGISTER_CONTROL);
00687         ui_result = fJTAG_Data(ui_result);
00688 #endif
00689       }
00690     }    
00691   }  
00692 }

Here is the call graph for this function:

unsigned int fMIPS32_ExecuteDebugModule_safe ( unsigned int *  pui_module,
unsigned int  len,
unsigned int  flags 
)

Definition at line 422 of file mips32.c.

References fMIPS32_ExecuteDebugModule(), and tgt_compile.

00423 {
00424         /*safe exec jtag code,if exception report,revert depc*/
00425         unsigned int depc;
00426         unsigned int volatile codebuf[] = tgt_compile(
00427                         "1:mtc0 ra,$31;\n"
00428                         "bal 2f;\n"
00429                         "nop;\n"
00430                         ".space 12;\n"
00431                         "2:sw v0,(ra);\n"
00432                         "mfc0 v0,$24;\n"
00433                         "sw v0,4(ra);\n"
00434                         "lw v0,(ra);\n"
00435                         "mfc0 ra,$31;\n"
00436                         "b 1b;\n"
00437                         "nop;\n"
00438                         );      
00439 
00440         volatile unsigned int codebuf1[] = tgt_compile(
00441                         "1:mtc0 ra,c0_desave;\n"
00442                         "bal 2f;\n"
00443                         "nop;\n"
00444                         ".space 16;\n"
00445                         "2:sw v0,(ra);\n"
00446                         "sw v1,4(ra);\n"
00447                         "mfc0 v0,c0_debug;\n"
00448                         "sw v0,8(ra);\n"
00449                         "lui v1,1<<4;\n"
00450                         "and v1,v0;\n"
00451                         "beqz v1,3f;\n"
00452                         "nop;\n"
00453                         "lw v0,12(ra);\n"
00454                         "mtc0 v0,c0_depc;\n"
00455                         "3:lw v1,4(ra);\n"
00456                         "lw v0,(ra);\n"
00457                         "mfc0 ra,c0_desave;\n"
00458                         "b 1b;\n"
00459                         "nop;\n"
00460                         );      
00461 
00462         fMIPS32_ExecuteDebugModule(codebuf,0x8000,1);
00463         depc = codebuf[4];
00464         fMIPS32_ExecuteDebugModule(pui_module,len,flags);
00465         codebuf1[6] = depc;
00466         fMIPS32_ExecuteDebugModule(codebuf1,0x8000,1);
00467         if(codebuf1[5]&(1<<20))
00468                 printf("exception in ejtag code!!!\n");
00469 
00470         return (codebuf1[5]&(1<<20))?1:0;
00471 }

Here is the call graph for this function:

static unsigned int fMIPS32_ExitDebugMode ( void   )  [static]

Definition at line 955 of file mips32.c.

References dJTAG_REGISTER_CONTROL, dJTAG_REGISTER_DATA, dMIPS32_DERET_INSTRUCTION, dMIPS32_ECR_ACCESS_PENDING, dMIPS32_ECR_ACCESS_RW, dMIPS32_ECR_CPU_RESET_OCCURED, dMIPS32_ECR_PROBE_ENABLE, dMIPS32_ECR_PROBE_VECTOR, fJTAG_Data(), and fJTAG_Instruction().

Referenced by fMIPS32_EJTAG_Machine().

00956 {
00957   unsigned int ui_result;
00958 
00959   // Feed the processor a DERET instruction.
00960 
00961   // Read the control register and make sure processor is attempting to 
00962   // read from dmseg.
00963   ui_result = dMIPS32_ECR_CPU_RESET_OCCURED | dMIPS32_ECR_ACCESS_PENDING |
00964               dMIPS32_ECR_PROBE_ENABLE | dMIPS32_ECR_PROBE_VECTOR;
00965 
00966   fJTAG_Instruction(dJTAG_REGISTER_CONTROL);
00967   ui_result = fJTAG_Data(ui_result);
00968 
00969   if (ui_result & dMIPS32_ECR_ACCESS_PENDING)
00970   {
00971     // Make sure processor is not writing
00972     if (ui_result & dMIPS32_ECR_ACCESS_RW) // Bit set for a WRITE
00973     {
00974       // Chip is writing, need to clear the write
00975       printf("EJTAGEMUL ERROR: Processor writing on debug exit.\n");  
00976       return(0);
00977     }
00978 
00979     // Chip is reading from instruction space - feed it a DERET
00980     // Write the DERET instruction into the data register            
00981     fJTAG_Instruction(dJTAG_REGISTER_DATA);
00982     fJTAG_Data(dMIPS32_DERET_INSTRUCTION);
00983 
00984     // Now finish the processor access by clearing the access pending bit
00985     fJTAG_Instruction(dJTAG_REGISTER_CONTROL);
00986 
00987     ui_result = dMIPS32_ECR_CPU_RESET_OCCURED | dMIPS32_ECR_PROBE_ENABLE | 
00988                 dMIPS32_ECR_PROBE_VECTOR;
00989 
00990     ui_result = fJTAG_Data(ui_result);
00991 
00992     // At this point we are done.  Even if the chip didn't exit debug mode
00993     // the debug mode catcher will grab it and report the reason to GDB.
00994 //    printf("JTAGEMUL: Processor exited debug mode.\n");
00995     return(1);
00996   }
00997   else
00998   {
00999     // ERROR!  What to do if the processor is not accessing?
01000     printf("EJTAGEMUL ERROR: Processor not accessing for debug exit.\n");
01001     return(0);
01002   }
01003 
01004   // Should never get here!  
01005   return(0);
01006 }

Here is the call graph for this function:

static unsigned int fMIPS32_HandleRead ( unsigned int  ui_address  )  [static]

Definition at line 934 of file mips32.c.

References dMIPS32_DATAMEM, dMIPS32_PSEUDO_FIFO_ADDR, dMIPS32_PSEUDO_STACK_ADDR, ui_datamem, ui_fifomem, ui_stack, ui_stack_index, and uififo_raddr.

Referenced by fMIPS32_ExecuteDebugModule(), and wait_address().

00935 {
00936   switch(ui_address)
00937   {
00938     case dMIPS32_PSEUDO_FIFO_ADDR: return ui_fifomem[uififo_raddr++];        break;
00939     case dMIPS32_PSEUDO_STACK_ADDR: return ui_stack[(--ui_stack_index)&0x1f]; break;
00940     default:
00941           if((ui_address>=dMIPS32_DATAMEM)&&(ui_address<dMIPS32_DATAMEM+0x400))
00942             return ui_datamem[(ui_address-dMIPS32_DATAMEM)>>2];
00943            else
00944       fprintf(stderr,"JTAGEMUL: Read to unknown location 0x%08X.\n", ui_address);
00945       break;
00946   }
00947   
00948   return(0);
00949 }

static void fMIPS32_HandleWrite ( unsigned int  ui_address,
unsigned int  ui_data,
int  accesstype 
) [static]

Definition at line 890 of file mips32.c.

References dMIPS32_DATAMEM, dMIPS32_PSEUDO_FIFO_ADDR, dMIPS32_PSEUDO_SERIAL_ADDR, dMIPS32_PSEUDO_STACK_ADDR, ui_datamem, ui_fifomem, ui_stack, ui_stack_index, and uififo_waddr.

Referenced by fMIPS32_ExecuteDebugModule(), and wait_address().

00891 {
00892   unsigned int data0,data1,mask;
00893   int index;
00894   switch(ui_address)
00895   {
00896     case dMIPS32_PSEUDO_SERIAL_ADDR:   /*simple put char*/
00897             putchar(ui_data);
00898             break;
00899     case dMIPS32_PSEUDO_SERIAL_ADDR+1:  /*printf predefined strings with argument*/
00900             index = (ui_data>>8)&0xff;
00901             printf(ui_datamem[index],ui_datamem[index+1],ui_datamem[index+2],ui_datamem[index+3],ui_datamem[index+4],ui_datamem[index+5],ui_datamem[index+6],ui_datamem[index+7],ui_datamem[index+8],ui_datamem[index+9],ui_datamem[index+10]);
00902             break;
00903     case dMIPS32_PSEUDO_FIFO_ADDR: 
00904             ui_fifomem[uififo_waddr++]=ui_data;        break;
00905     case dMIPS32_PSEUDO_STACK_ADDR:
00906                 ui_stack[ui_stack_index] = ui_data;
00907                 ui_stack_index=(ui_stack_index+1)&0x1f;
00908                 break;
00909     default:
00910                 data0=ui_datamem[(ui_address-dMIPS32_DATAMEM)>>2];
00911                 data1=ui_data;
00912 
00913                 switch(accesstype)
00914                 {
00915                         case 0:
00916                                 mask=0xff<<((ui_address&3)*8); break;
00917                         case 1:
00918                                 mask=0xffff<<(((ui_address>>1)&1)*16); break;
00919                         case 2: mask=0xffffffff;break;
00920                         default: mask=0xffffff<<((ui_address&1)*8);break;
00921                 }
00922 
00923                 ui_data=(data1&mask)|(data0&~mask);
00924                 ui_datamem[(ui_address-dMIPS32_DATAMEM)>>2]=ui_data;
00925       break;
00926   }
00927 }

void fMIPS32_Init ( void   ) 

Definition at line 224 of file mips32.c.

References enable_timer, fJTAG_Init(), fMIPS32_inited, set_timer(), timer_handler(), and timer_val.

Referenced by cmd_gdbserver(), cmd_goback(), cmd_waitfacc(), fMIPS32_ExecuteDebugModule(), fMIPS32_Transfer(), fMIPS32_USB_DownloadModule(), jtaginit(), jtagregs(), and waitreg().

00225 {
00226 if(fMIPS32_inited)return;
00227 
00228   fJTAG_Init();
00229 
00230   fMIPS32_inited=1;
00231 
00232   signal(SIGALRM, timer_handler);
00233 
00234   if(enable_timer != -1)
00235     set_timer(timer_val);
00236 
00237   return;
00238 }

Here is the call graph for this function:

unsigned int fMIPS32_Transfer ( unsigned int *  pui_module,
unsigned int  len 
)

Definition at line 694 of file mips32.c.

References dJTAG_REGISTER_ADDRESS, dJTAG_REGISTER_CONTROL, dJTAG_REGISTER_DATA, dJTAG_REGISTER_FASTDATA, dMIPS32_ECR_ACCESS_PENDING, dMIPS32_ECR_ACCESS_RW, dMIPS32_ECR_CPU_RESET_OCCURED, dMIPS32_ECR_EJTAG_BREAK, dMIPS32_ECR_IN_DEBUG_MODE, dMIPS32_ECR_PROBE_ENABLE, dMIPS32_ECR_PROBE_VECTOR, fJTAG_Data(), fJTAG_FastData(), fJTAG_Instruction(), fMIPS32_Init(), STATE_CONNECTING, STATE_RUN, and STATE_WAITING.

Referenced by cmd_fget(), cmd_fput(), and cmd_fputflash().

00695 {
00696   unsigned int ui_result;
00697   unsigned int ui_address;
00698   unsigned int ui_data;
00699   unsigned int ui_finished;
00700   unsigned int start_address;
00701   unsigned int end_address;
00702   unsigned int state=STATE_CONNECTING;
00703   int i;
00704 
00705   fMIPS32_Init();
00706 
00707   
00708 while(1)
00709 {
00710   ui_result = dMIPS32_ECR_CPU_RESET_OCCURED|dMIPS32_ECR_ACCESS_PENDING|dMIPS32_ECR_PROBE_ENABLE | dMIPS32_ECR_PROBE_VECTOR ;
00711   fJTAG_Instruction(dJTAG_REGISTER_CONTROL);
00712   ui_result = fJTAG_Data(ui_result);
00713 
00714 if(!(ui_result&dMIPS32_ECR_IN_DEBUG_MODE))  {
00715     ui_result = dMIPS32_ECR_PROBE_ENABLE | dMIPS32_ECR_PROBE_VECTOR |dMIPS32_ECR_EJTAG_BREAK;
00716   fJTAG_Instruction(dJTAG_REGISTER_CONTROL);
00717   ui_result = fJTAG_Data(ui_result);
00718   continue;
00719   }
00720   fprintf(stderr,"connected\n");
00721   state=STATE_RUN;
00722   break;
00723 }
00724 
00725 
00726   // Feed that chip
00727   for(i=0;len;)
00728   {
00729     // Read the control register.  Make sure an access is requested, then 
00730     // do it.
00731     ui_result = dMIPS32_ECR_CPU_RESET_OCCURED | dMIPS32_ECR_ACCESS_PENDING |
00732                 dMIPS32_ECR_PROBE_ENABLE | dMIPS32_ECR_PROBE_VECTOR;
00733   
00734     fJTAG_Instruction(dJTAG_REGISTER_CONTROL);
00735     ui_result = fJTAG_Data(ui_result);
00736         if(!(ui_result & dMIPS32_ECR_IN_DEBUG_MODE))
00737         {
00738       fprintf(stderr,"not in debug mode!\n");
00739           return 0;
00740         }
00741     
00742     if (!(ui_result & dMIPS32_ECR_ACCESS_PENDING))
00743     {
00744           if(state!=STATE_WAITING)printf("waiting\n");
00745           state=STATE_WAITING;
00746           continue;
00747     }
00748         state=STATE_RUN;
00749 
00750 #if 0
00751     fJTAG_Instruction(dJTAG_REGISTER_ADDRESS);
00752     start_address = fJTAG_Data(0x00)|0xff000000;
00753     printf("start_address=0x%x\n",start_address);
00754 #endif
00755         
00756     if (ui_result & dMIPS32_ECR_ACCESS_RW) // Bit set for a WRITE
00757     {
00758       // Read the data out
00759 #ifdef USE_FASTDATA
00760       fJTAG_Instruction(dJTAG_REGISTER_FASTDATA);
00761       ui_data = fJTAG_FastData(0x00);
00762 #else
00763           fJTAG_Instruction(dJTAG_REGISTER_DATA);
00764       ui_data = fJTAG_Data(0x00);
00765       // Clear the access pending bit (let the processor eat!)
00766       ui_result = dMIPS32_ECR_CPU_RESET_OCCURED | dMIPS32_ECR_PROBE_ENABLE | 
00767                   dMIPS32_ECR_PROBE_VECTOR;
00768   
00769       fJTAG_Instruction(dJTAG_REGISTER_CONTROL);
00770       ui_result = fJTAG_Data(ui_result);
00771 #endif
00772 
00773         pui_module[i++]=ui_data;
00774         len-=4;
00775     }
00776     else
00777     {
00778         ui_data = pui_module[i++];
00779         len -= 4;
00780         // Send the data out
00781 #ifdef USE_FASTDATA
00782         fJTAG_Instruction(dJTAG_REGISTER_FASTDATA);
00783         ui_data = fJTAG_Data(ui_data);
00784 #else
00785           fJTAG_Instruction(dJTAG_REGISTER_DATA);
00786       ui_data = fJTAG_Data(ui_data);
00787         // Clear the access pending bit (let the processor eat!)
00788         ui_result = dMIPS32_ECR_CPU_RESET_OCCURED | dMIPS32_ECR_PROBE_ENABLE | 
00789                     dMIPS32_ECR_PROBE_VECTOR;
00790   
00791         fJTAG_Instruction(dJTAG_REGISTER_CONTROL);
00792         ui_result = fJTAG_Data(ui_result);
00793 #endif
00794       }
00795     }    
00796 }

Here is the call graph for this function:

unsigned int fMIPS32_USB_DownloadModule ( unsigned int *  pui_module,
unsigned int  len 
)

Definition at line 801 of file mips32.c.

References dJTAG_REGISTER_FASTDATA, fJTAG_DBTX(), fJTAG_Instruction(), fMIPS32_Init(), and PACK_SIZE.

Referenced by cmd_put().

00802 {
00803   unsigned int ui_result;
00804   unsigned int ui_address;
00805   unsigned int ui_data;
00806   unsigned int ui_finished;
00807   unsigned int start_address;
00808   unsigned int end_address;
00809   unsigned int download_ram_size=0;
00810   unsigned int init_do=0;
00811   unsigned int pack_num=0;
00812   unsigned int pack_num_1=0;
00813   unsigned int i=0;
00814     //time_t *time_start=malloc(sizeof(time_t));
00815     //time_t *time_end=malloc(sizeof(time_t));
00816     time_t time_start;
00817     time_t time_end;
00818     time_t  time_deta=0;
00819     
00820 
00821   fprintf(stderr,"JTAGEMUL: Executing a module.\n");
00822   fMIPS32_Init();
00823 
00824 
00825   fprintf(stderr,"connecting...\n");
00826 #if 1
00827         if(!init_do)
00828         {
00829                 time_start = (time(&time_start))&0xffffffff;
00830                 printf("time_start : %x \n",time_start);
00831                 init_do = 1;
00832                 download_ram_size=0;
00833         }
00834         else
00835         {
00836                 if(!(download_ram_size%0x10000))
00837                 {
00838                 time_end = (time(&time_end))&0xffffffff;
00839                 printf("time_end : %x \n",time_end);
00840                 time_deta= time_end - time_start;
00841                 if(time_deta == 0)
00842                         time_deta++ ;
00843                 printf("time : 0x%x, download_size : %x, download rate=%d B/S\n",time_deta,download_ram_size,((download_ram_size/time_deta)));
00844                 }
00845         }
00846 #endif
00847         pack_num = len/PACK_SIZE ;
00848         printf("len : %d , pack_num : %d \n",len,pack_num);
00849         if(len % PACK_SIZE)
00850                 pack_num_1=1;
00851         //zgj-20090627  fJTAG_Instruction(dJTAG_REGISTER_DBTX);
00852         fJTAG_Instruction(dJTAG_REGISTER_FASTDATA);
00853          // ui_data = fJTAG_DBTX(ui_data);
00854 #if 1
00855         for(i=0;i<pack_num;i++)//20090628
00856         { //20090628
00857                 printf("pack_num : %d \n",i);
00858                 printf("pui_module addr 0x%x :%x \n", pui_module,*pui_module);
00859                 fJTAG_DBTX(PACK_SIZE,pui_module+i*(PACK_SIZE/4));
00860                 //fJTAG_DBTX(len,pui_module);
00861         }//20090628
00862         if(pack_num_1)
00863         {       
00864                 printf("LAST pui_module addr 0x%x :%x  i= %d \n", pui_module+i*PACK_SIZE,*(pui_module+i*PACK_SIZE/4),i);
00865                 fJTAG_DBTX(len - i*PACK_SIZE , pui_module + i*(PACK_SIZE/4));
00866         }
00867 #else
00868         printf("pui_module addr 0x%x :%x \n", pui_module,*pui_module);
00869         fJTAG_DBTX(len,pui_module);
00870 #endif    
00871          download_ram_size = len;
00872                 time_end = (time(&time_end))&0xffffffff;
00873                 printf("=<<<==time_end : %x \n",time_end);
00874                 time_deta= time_end - time_start;
00875                 if(time_deta == 0)
00876                         time_deta++ ;
00877                 printf("=<<<==time : %d, download_size : %x, download rate=%d B/S\n",time_deta,download_ram_size,((download_ram_size/time_deta)));
00878 }

Here is the call graph for this function:

unsigned int force_acc (  ) 

Definition at line 272 of file mips32.c.

References dJTAG_REGISTER_CONTROL, dMIPS32_ECR_ACCESS_PENDING, dMIPS32_ECR_CPU_RESET_OCCURED, dMIPS32_ECR_EJTAG_BREAK, dMIPS32_ECR_PROBE_ENABLE, dMIPS32_ECR_PROBE_VECTOR, fJTAG_Data(), and fJTAG_Instruction().

Referenced by cmd_gdbserver(), cmd_goback(), and cmd_waitfacc().

00273 {
00274         unsigned int ui_result;
00275         ui_result = dMIPS32_ECR_CPU_RESET_OCCURED | dMIPS32_ECR_ACCESS_PENDING |
00276               dMIPS32_ECR_PROBE_ENABLE | dMIPS32_ECR_PROBE_VECTOR |
00277               dMIPS32_ECR_EJTAG_BREAK;
00278         fJTAG_Instruction(dJTAG_REGISTER_CONTROL);
00279         ui_result = fJTAG_Data(ui_result);
00280         return ui_result;
00281 }

Here is the call graph for this function:

unsigned int get_acc ( unsigned int *  op,
int *  address,
int *  data 
)

Definition at line 283 of file mips32.c.

References dJTAG_REGISTER_ADDRESS, dJTAG_REGISTER_CONTROL, dJTAG_REGISTER_DATA, dMIPS32_ECR_ACCESS_PENDING, dMIPS32_ECR_CPU_RESET_OCCURED, dMIPS32_ECR_IN_DEBUG_MODE, dMIPS32_ECR_PROBE_ENABLE, dMIPS32_ECR_PROBE_VECTOR, fJTAG_Data(), and fJTAG_Instruction().

Referenced by cmd_goback(), and cmd_waitfacc().

00284 {
00285         unsigned int ui_result;
00286         unsigned int ui_address;
00287         unsigned int ui_data;
00288         int ret;
00289         int connecting = 0;
00290 
00291         // Read the control register.  Make sure an access is requested, then 
00292         // do it.
00293         ui_result = dMIPS32_ECR_CPU_RESET_OCCURED | dMIPS32_ECR_ACCESS_PENDING |
00294                 dMIPS32_ECR_PROBE_ENABLE | dMIPS32_ECR_PROBE_VECTOR;
00295 
00296         fJTAG_Instruction(dJTAG_REGISTER_CONTROL);
00297         ui_result = fJTAG_Data(ui_result);
00298 
00299         *op = ui_result;
00300 
00301         if(!(ui_result&dMIPS32_ECR_IN_DEBUG_MODE))  {
00302                 return 0;
00303         }
00304 
00305 
00306         if (!(ui_result & dMIPS32_ECR_ACCESS_PENDING))
00307         {
00308                 return 1;
00309         }
00310 
00311         fJTAG_Instruction(dJTAG_REGISTER_ADDRESS);
00312         ui_address = fJTAG_Data(0x00)|0xff000000;
00313         fJTAG_Data(ui_address);
00314 
00315         *address = ui_address;
00316 
00317         fJTAG_Instruction(dJTAG_REGISTER_DATA);
00318         ui_data = fJTAG_Data(0x00);
00319         fJTAG_Data(ui_data);
00320 
00321         *data = ui_data;
00322         return 3;
00323 }

Here is the call graph for this function:

unsigned int get_DR ( unsigned int  upload_len  ) 

Definition at line 1803 of file mips32.c.

References dJTAG_REGISTER_CONTROL, dJTAG_REGISTER_DATA, dMIPS32_ECR_CPU_RESET_OCCURED, dMIPS32_ECR_PROBE_ENABLE, dMIPS32_ECR_PROBE_VECTOR, fJTAG_Data(), and fJTAG_Instruction().

01804 {
01805       unsigned int ui_data=0 ;
01806       unsigned int ui_result=0 ;
01807 
01808 #if 1 //20090703-zgj
01809 
01810       // Clear the access pending bit (let the processor eat!)
01811 
01812       ui_result = dMIPS32_ECR_CPU_RESET_OCCURED | dMIPS32_ECR_PROBE_ENABLE | dMIPS32_ECR_PROBE_VECTOR;
01813 
01814       fJTAG_Instruction(dJTAG_REGISTER_CONTROL);
01815       ui_result = fJTAG_Data(ui_result);
01816 #endif
01817 
01818        fJTAG_Instruction(dJTAG_REGISTER_DATA);
01819        ui_data = fJTAG_Data(0x00);
01820 
01821 
01822       return ui_data;
01823 }

Here is the call graph for this function:

unsigned int get_DR2 ( void   ) 

Definition at line 1789 of file mips32.c.

References dJTAG_REGISTER_CONTROL, dMIPS32_ECR_CPU_RESET_OCCURED, dMIPS32_ECR_PROBE_ENABLE, dMIPS32_ECR_PROBE_VECTOR, fJTAG_Data(), and fJTAG_Instruction().

01790 {
01791       unsigned int ui_data=0 ;
01792       unsigned int ui_result=0 ;
01793 
01794 #if 1
01795       // Clear the access pending bit (let the processor eat!)
01796 
01797       ui_result = dMIPS32_ECR_CPU_RESET_OCCURED | dMIPS32_ECR_PROBE_ENABLE | dMIPS32_ECR_PROBE_VECTOR;
01798       fJTAG_Instruction(dJTAG_REGISTER_CONTROL);
01799       ui_result = fJTAG_Data(ui_result);
01800 #endif
01801 }

Here is the call graph for this function:

void jtag_crc_down ( unsigned long  addr_download  ) 

Definition at line 1644 of file mips32.c.

References code_inst_crc, and jtag_putmem().

01645 {
01646         int i=0;
01647         unsigned long ui_address=addr_download;
01648         printf("download self download to %p\n",addr_download);
01649         jtag_putmem(code_inst_crc,addr_download,sizeof(code_inst_crc));
01650         printf("jtag CRC code download over!\n");
01651 }

Here is the call graph for this function:

void jtag_crc_table_down ( unsigned long  addr_download  ) 

Definition at line 1714 of file mips32.c.

References crc32_table_down, and jtag_putmem().

01715 {
01716         int i=0;
01717         unsigned long ui_address=addr_download;
01718         printf("download self download to %p\n",addr_download);
01719         jtag_putmem(crc32_table_down,addr_download,sizeof(crc32_table_down));
01720         printf("jtag CRC code download over!\n");
01721 }

Here is the call graph for this function:

void jtag_download_crc_checksum ( unsigned long  addr_download,
unsigned int  buf_crc_checksum 
)

Definition at line 1490 of file mips32.c.

References jtag_outl().

01491 {
01492                 printf("download buf CRC32 checksum download to %p , CRC :0x%x \n",addr_download,buf_crc_checksum);
01493                 jtag_outl(addr_download,buf_crc_checksum);
01494 }

Here is the call graph for this function:

void jtag_download_length ( unsigned long  addr_download,
unsigned int  buf_length 
)

Definition at line 1497 of file mips32.c.

References jtag_outl().

01498 {
01499                 jtag_outl(addr_download,buf_length);
01500 }

Here is the call graph for this function:

void jtag_getmem ( char *  dst,
unsigned long  addr,
unsigned int  len 
)

Definition at line 1335 of file mips32.c.

References min, tgt_exec, ui_datamem, ui_fifomem, ui_fifomem_size, uififo_raddr, and uififo_waddr.

Referenced by cmd_sget().

01336 {
01337           int once;
01338      while(len)
01339      {
01340           uififo_raddr=0;
01341           uififo_waddr=0;
01342           once=min(len,ui_fifomem_size);
01343           if(once<4)once=4;
01344       ui_datamem[0]=addr&~3;
01345       ui_datamem[1]=(addr+once-4)&~3;
01346       once=ui_datamem[1]-ui_datamem[0]+4-(addr&3);
01347 
01348           tgt_exec(\
01349           ".set noat;\n" \
01350           ".set noreorder;\n" \
01351           "1:\n" \
01352           "mtc0    $15, $31;\n" \
01353           "li    $15,0xFF200000;\n" \
01354           "sw    $1, 0x1FC($15);\n" \
01355           "sw    $2, 0x1FC($15);\n" \
01356           "sw    $3, 0x1FC($15);\n" \
01357           "lw    $1, ($15);\n" \
01358           "lw    $2, 0x4($15);\n" \
01359           "2:\n" \
01360           "lw    $3, ($1);\n" \
01361           "sw    $3, 0x1F8($15);\n" \
01362           "bne   $1,$2,2b;\n" \
01363           "addu  $1, 4;\n" \
01364           "lw    $3, ($15);\n" \
01365           "lw    $2, ($15);\n" \
01366           "lw    $1, ($15);\n" \
01367           "mfc0    $15, $31;\n" \
01368           "b 1b;\n" \
01369           "nop;\n" \
01370           ,0x80000);
01371           once=min(once,len);
01372           memcpy(dst,(char *)ui_fifomem+(addr&3),once);
01373           len-=once;
01374           dst+=once;
01375           addr+=once;
01376    }
01377 
01378 }

unsigned char jtag_inb ( unsigned long  addr  ) 

Definition at line 1199 of file mips32.c.

References tgt_exec, and ui_datamem.

Referenced by __syscall1().

01200 {
01201       ui_datamem[0]=addr;
01202           tgt_exec(\
01203           ".set noat;\n" \
01204           "1:\n" \
01205           "mtc0    $15, $31;\n" \
01206           "li    $15,0xFF200000;\n" \
01207           "sw    $2, 0x1fc($15);\n" \
01208           "sw    $3, 0x1fc($15);\n" \
01209           "lw    $2, ($15);\n" \
01210           "lb    $3, ($2);\n" \
01211           "sb    $3, 4($15);\n" \
01212           "lw    $3, 0x1fc($15);\n" \
01213           "lw    $2, 0x1fc($15);\n" \
01214           "mfc0    $15, $31;\n" \
01215           "b 1b;\n" \
01216           "nop;\n" \
01217           ,0x80000);
01218           return (unsigned char)(ui_datamem[1]&0xff);
01219 }

unsigned int jtag_inl ( unsigned long  addr  ) 

Definition at line 1243 of file mips32.c.

References tgt_exec, and ui_datamem.

Referenced by __syscall1(), and cmd_disas().

01244 {
01245       ui_datamem[0]=addr;
01246           tgt_exec(\
01247           ".set noat;\n" \
01248           "1:\n" \
01249           "mtc0    $15, $31;\n" \
01250           "li    $15,0xFF200000;\n" \
01251           "sw    $2, 0x1fc($15);\n" \
01252           "sw    $3, 0x1fc($15);\n" \
01253           "lw    $2, ($15);\n" \
01254           "lw    $3, ($2);\n" \
01255           "sw    $3, 4($15);\n" \
01256           "lw    $3, 0x1fc($15);\n" \
01257           "lw    $2, 0x1fc($15);\n" \
01258           "mfc0    $15, $31;\n" \
01259           "b 1b;\n" \
01260           "nop;\n" \
01261           ,0x80000);
01262           return (unsigned int)ui_datamem[1];
01263 }

unsigned short jtag_inw ( unsigned long  addr  ) 

Definition at line 1221 of file mips32.c.

References tgt_exec, and ui_datamem.

Referenced by __syscall1().

01222 {
01223       ui_datamem[0]=addr;
01224           tgt_exec(\
01225           ".set noat;\n" \
01226           "1:\n" \
01227           "mtc0    $15, $31;\n" \
01228           "li    $15,0xFF200000;\n" \
01229           "sw    $2, 0x1fc($15);\n" \
01230           "sw    $3, 0x1fc($15);\n" \
01231           "lw    $2, ($15);\n" \
01232           "lh    $3, ($2);\n" \
01233           "sh    $3, 4($15);\n" \
01234           "lw    $3, 0x1fc($15);\n" \
01235           "lw    $2, 0x1fc($15);\n" \
01236           "mfc0    $15, $31;\n" \
01237           "b 1b;\n" \
01238           "nop;\n" \
01239           ,0x80000);
01240           return (unsigned short)(ui_datamem[1]&0xffff);
01241 }

void jtag_outb ( unsigned long  addr,
unsigned char  val 
)

Definition at line 1265 of file mips32.c.

References tgt_exec, and ui_datamem.

Referenced by __syscall2().

01266 {
01267       ui_datamem[0]=addr;
01268       ui_datamem[1]=val;
01269 
01270           tgt_exec(\
01271           ".set noat;\n" \
01272           "1:\n" \
01273           "mtc0    $15, $31;\n" \
01274           "li    $15,0xFF200000;\n" \
01275           "sw    $2, 0x1fc($15);\n" \
01276           "sw    $3, 0x1fc($15);\n" \
01277           "lw    $2, ($15);\n" \
01278           "lw    $3, 0x4($15);\n" \
01279           "sb    $3, ($2);\n" \
01280           "lw    $3, 0x1fc($15);\n" \
01281           "lw    $2, 0x1fc($15);\n" \
01282           "mfc0    $15, $31;\n" \
01283           "b 1b;\n" \
01284           "nop;\n" \
01285           ,0x80000);
01286 }

void jtag_outl ( unsigned long  addr,
unsigned int  val 
)

Definition at line 1310 of file mips32.c.

References tgt_exec, and ui_datamem.

Referenced by __syscall2(), jtag_download_crc_checksum(), and jtag_download_length().

01311 {
01312       ui_datamem[0]=addr;
01313       ui_datamem[1]=val;
01314 
01315           tgt_exec(\
01316           ".set noat;\n" \
01317           "1:\n" \
01318           "mtc0    $15, $31;\n" \
01319           "li    $15,0xFF200000;\n" \
01320           "sw    $2, 0x1fc($15);\n" \
01321           "sw    $3, 0x1fc($15);\n" \
01322           "lw    $2, ($15);\n" \
01323           "lw    $3, 0x4($15);\n" \
01324           "sw    $3, ($2);\n" \
01325           "lw    $3, 0x1fc($15);\n" \
01326           "lw    $2, 0x1fc($15);\n" \
01327           "mfc0    $15, $31;\n" \
01328           "b 1b;\n" \
01329           "nop;\n" \
01330           ,0x80000);
01331 
01332 }

void jtag_outw ( unsigned long  addr,
unsigned short  val 
)

Definition at line 1288 of file mips32.c.

References tgt_exec, and ui_datamem.

Referenced by __syscall2().

01289 {
01290       ui_datamem[0]=addr;
01291       ui_datamem[1]=val;
01292           tgt_exec(\
01293           ".set noat;\n" \
01294           "1:\n" \
01295           "mtc0    $15, $31;\n" \
01296           "li    $15,0xFF200000;\n" \
01297           "sw    $2, 0x1fc($15);\n" \
01298           "sw    $3, 0x1fc($15);\n" \
01299           "lw    $2, ($15);\n" \
01300           "lw    $3, 0x4($15);\n" \
01301           "sh    $3, ($2);\n" \
01302           "lw    $3, 0x1fc($15);\n" \
01303           "lw    $2, 0x1fc($15);\n" \
01304           "mfc0    $15, $31;\n" \
01305           "b 1b;\n" \
01306           "nop;\n" \
01307           ,0x80000);
01308 }

void jtag_putmem ( char *  src,
unsigned long  addr,
unsigned int  len 
)

Definition at line 1380 of file mips32.c.

References min, tgt_exec, ui_datamem, ui_fifomem, ui_fifomem_size, uififo_raddr, and uififo_waddr.

Referenced by cmd_checksum(), cmd_fget(), cmd_fput(), cmd_fputflash(), cmd_get(), cmd_karg(), cmd_program(), cmd_put(), cmd_sput(), jtag_crc_down(), jtag_crc_table_down(), jtag_self_down(), jtag_self_down_crc(), and jtag_self_down_up().

01381 {
01382           int once;
01383      while(len)
01384      {
01385           uififo_raddr=0;
01386           uififo_waddr=0;
01387           once=min(len,ui_fifomem_size);
01388           if(once<4)once=4;
01389       ui_datamem[0]=addr&~3;
01390       ui_datamem[1]=(addr+once-4)&~3;
01391       once=ui_datamem[1]-ui_datamem[0]+4-(addr&3);
01392       printf("addr=%x,len=%x\n",addr,len);
01393 
01394           memcpy((char *)ui_fifomem+(addr&3),src,once);
01395 
01396           tgt_exec(\
01397           ".set noat;\n" \
01398           ".set noreorder;\n" \
01399           "1:\n" \
01400           "mtc0    $15, $31;\n" \
01401           "li    $15,0xFF200000;\n" \
01402           "sw    $1, 0x1FC($15);\n" \
01403           "sw    $2, 0x1FC($15);\n" \
01404           "sw    $3, 0x1FC($15);\n" \
01405           "lw    $1, ($15);\n" \
01406           "lw    $2, 0x4($15);\n" \
01407           "2:\n" \
01408           "lw    $3, 0x1F8($15);\n" \
01409           "sw    $3, ($1);\n" \
01410           "bne   $1,$2,2b;\n" \
01411           "addu  $1, 4;\n" \
01412           "lw    $3, ($15);\n" \
01413           "lw    $2, ($15);\n" \
01414           "lw    $1, ($15);\n" \
01415           "mfc0    $15, $31;\n" \
01416           "b 1b;\n" \
01417           "nop;\n" \
01418           ,0x80000);
01419           once=min(once,len);
01420           len-=once;
01421           src+=once;
01422           addr+=once;
01423         }
01424 }

void jtag_quit (  ) 

Definition at line 1426 of file mips32.c.

References debug_reg, and tgt_exec.

Referenced by cmd_cont(), cmd_si(), and jtag_wait_k0_flag().

01427 {
01428 tgt_exec("deret;",4); 
01429 debug_reg = 0;
01430 }

void jtag_self_down ( unsigned long  addr_download  ) 

Definition at line 1528 of file mips32.c.

References code_inst_download, and jtag_putmem().

01529 {
01530         int i=0;
01531         unsigned long ui_address=addr_download;
01532         printf("download self download to %p\n",addr_download);
01533         jtag_putmem(code_inst_download,addr_download,sizeof(code_inst_download));
01534         printf("jtag client download over!\n");
01535 }

Here is the call graph for this function:

void jtag_self_down_crc ( unsigned long  addr_download  ) 

Definition at line 1480 of file mips32.c.

References code_inst_download_crc, and jtag_putmem().

01481 {
01482         printf("download self download to %p\n",addr_download);
01483         jtag_putmem(code_inst_download_crc,addr_download,sizeof(code_inst_download_crc));
01484         printf("jtag client len and crc download over!\n");
01485 }

Here is the call graph for this function:

void jtag_self_down_up ( unsigned long  addr_download  ) 

Definition at line 1554 of file mips32.c.

References code_inst_upload, and jtag_putmem().

01555 {
01556         printf("download self download to %p\n",addr_download);
01557         jtag_putmem(code_inst_upload,addr_download,sizeof(code_inst_upload));
01558 
01559         printf("jtag client download over!\n");
01560 }

Here is the call graph for this function:

unsigned int jtag_wait_k0_flag ( unsigned long  addr_readreg  ) 

Definition at line 1725 of file mips32.c.

References jtag_quit(), tgt_exec, and ui_datamem.

01726 {
01727         unsigned int k0_val=0;
01728         unsigned int k1_val=0;
01729         int i=0;
01730         unsigned long ui_address = addr_readreg;
01731 
01732         printf("======>>>>k0_val : 0x%x \n",k0_val);
01733         do
01734         {
01735         tgt_exec(\
01736           ".set noat;\n" \
01737           "1:\n" \
01738           "mtc0    $15, $31;\n" \
01739           "li    $15,0xFF200000;\n" \
01740           "sw    k0, ($15);\n" \
01741           "sw    k1,4($15);\n" \
01742           "mfc0    $15, $31;\n" \
01743           "b 1b;\n" \
01744           "nop;\n" \
01745           ,0x80000);
01746           jtag_quit();
01747 
01748       k0_val=ui_datamem[0];
01749                 sleep(2);
01750                 printf("======>>>>>>>>>>>>>>>>k0_val : 0x%x \n",k0_val);
01751         }while(k0_val != 0x86801125) ;
01752 
01753         k1_val = ui_datamem[1];
01754         return k1_val;
01755 }

Here is the call graph for this function:

void* md_disasm ( char *  dest,
void *  addr,
unsigned int  inst 
)

Definition at line 511 of file disassemble.c.

References BPCODE, c0, c0ft, c1, c1ft, c2, CACHE_OP, cc1, cc2, cn, cnft, COFUN, comma, CP_OFF, fd, fs, FS_FD_D, FS_FD_L, FS_FD_S, FS_FD_W, ft, FT_FS_D, FT_FS_FD_D, FT_FS_FD_S, FT_FS_S, get_distbl(), imm(), IMM_, JALR, JR, LDSTC0, LDSTC1, LDSTCN, LOAD_STORE, mkcomment(), NONE, OFF, RD, rd, RD_, RD_RS, RD_RS_RT, RD_RT, RD_RT_RS, RD_RT_SFT, RS, rs, RS_OFF, RS_RT, RS_RT_OFF, RS_SIMM, rt, RT_, RT_C0, RT_C0_TO, RT_C1, RT_C1_TO, RT_C2, RT_CC1, RT_CC1_TO, RT_CC2, RT_CN, RT_CN_TO, RT_IMM, RT_RD, RT_RD_TO, RT_RS_IMM, RT_RS_SIMM, RT_SIMM, SHAMT_, simm(), STORE, STOREC1, STORECN, DISTBL.str, strccat(), TARGET, DISTBL.type, v1, and WORD.

Referenced by check_ejtag(), cmd_disas(), and fMIPS32_ExecuteDebugModule().

00516 {
00517     const DISTBL   *pt;
00518     char           tmp[40];
00519     long            v, v1, w;
00520     int             i;
00521 
00522         regname = regs_sw;
00523         c0reg = regs_c0;
00524         inst = instcode;
00525 
00526         sprintf (dest, "%08x", addr);
00527     sprintf (tmp, " %08x ", inst);
00528     strcat (dest, tmp);
00529 
00530     pt = get_distbl (inst);
00531     i = strlen (pt->str);
00532     strcat (dest, pt->str);
00533     do_rt = 0;
00534     do_rs = 0;
00535 
00536 
00537     while (i++ < 8)
00538         strcat (dest, " ");
00539     switch (pt->type) {
00540     case FT_FS_FD_D:
00541         fd (); comma (); fs (); comma (); ft ();
00542         break;
00543     case FT_FS_FD_S:
00544         fd (); comma (); fs (); comma (); ft ();
00545         break;
00546     case FS_FD_D:
00547         fd (); comma (); fs ();
00548         break;
00549     case FS_FD_S:
00550         fd (); comma (); fs ();
00551         break;
00552     case FS_FD_W:
00553         fd (); comma (); fs ();
00554         break;
00555     case FS_FD_L:
00556         fd (); comma (); fs ();
00557         break;
00558     case FT_FS_D:
00559         fs (); comma (); ft ();
00560         break;
00561     case FT_FS_S:
00562         fs (); comma (); ft ();
00563         break;
00564     case RT_RS_IMM:
00565         rt (); comma (); rs (); comma (); imm (dest);
00566         if (rflag )
00567         {
00568             sprintf (tmp, " rs=0x%x", rsvalue);
00569             strcat (dest, tmp);
00570         }
00571         break;
00572     case RT_RS_SIMM:
00573         rt (); comma (); rs (); comma (); simm (dest);
00574         if (rflag )
00575         {
00576             sprintf (tmp, " rs=0x%x", rsvalue);
00577             strcat (dest, tmp);
00578         }
00579         break;
00580     case RT_IMM:
00581         rt (); comma (); imm (dest);
00582         break;
00583     case RT_SIMM:
00584         rt (); comma (); simm (dest);
00585         break;
00586     case RS_SIMM:
00587         rs (); comma (); simm (dest);
00588         if (rflag )
00589         {
00590             sprintf (tmp, " rs=0x%x", rsvalue);
00591             strcat (dest, tmp);
00592         }
00593         break;
00594     case RT_RD:
00595         rt (); comma (); rd();
00596         break;
00597     case RT_RD_TO:
00598         rt (); comma (); rd();
00599         if (rflag )
00600             mkcomment( dest, "# rt=0x%x", rtvalue);
00601         break;
00602     case RD:
00603         rd ();
00604         break;
00605     case RD_RS:
00606         rd (); comma (); rs ();
00607         if (rflag )
00608             mkcomment( dest, "# rs=0x%x", rsvalue);
00609         break;
00610     case RT_C0:
00611         rt (); comma (); c0 ();
00612         break;
00613     case RT_C0_TO:
00614         rt (); comma (); c0 ();
00615         if (rflag )
00616             mkcomment( dest, "# rt=0x%x", rtvalue);
00617         break;
00618     case RT_C1:
00619         rt (); comma (); c1 ();
00620         break;
00621     case RT_C1_TO:
00622         rt (); comma (); c1 ();
00623         if (rflag )
00624             mkcomment( dest, "# rt=0x%x", rtvalue);
00625         break;
00626     case RT_C2:
00627         rt (); comma (); c2 ();
00628         break;
00629     case RT_CN:
00630         rt (); comma (); cn ();
00631         break;
00632     case RT_CN_TO:
00633         rt (); comma (); cn ();
00634         if (rflag )
00635             mkcomment( dest, "# rt=0x%x", rtvalue);
00636         break;
00637     case RT_CC1:
00638         rt (); comma (); cc1 ();
00639         break;
00640     case RT_CC1_TO:
00641         rt (); comma (); cc1 ();
00642         if (rflag )
00643             mkcomment( dest, "# rt=0x%x", rtvalue);
00644         break;
00645     case RT_CC2:
00646         rt (); comma (); cc2 ();
00647         break;
00648     case RD_RT_RS:
00649         rd (); comma (); rt (); comma (); rs();
00650         if (rflag )
00651         {
00652             mkcomment( dest, "# rt=0x%x", rtvalue);
00653             sprintf (tmp, " rs=0x%x", rsvalue);
00654             strcat (dest, tmp);
00655         }
00656         break;
00657     case JR:
00658     case RS:
00659         rs ();
00660         if (rflag )
00661             mkcomment( dest, "# rs=0x%x", rsvalue);
00662         break;
00663     case RD_RS_RT:
00664         rd (); comma ();
00665     case RS_RT:
00666         rs (); comma (); rt ();
00667         if (rflag )
00668         {
00669             mkcomment( dest, "# rs=0x%x ", rsvalue);
00670             sprintf (tmp, " rt=0x%x", rtvalue);
00671             strcat (dest, tmp);
00672         }
00673         break;
00674     case RD_RT:
00675         rd (); comma (); rt ();
00676         if (rflag )
00677             mkcomment( dest, "# rt=0x%x", rtvalue);
00678         break;
00679     case RD_RT_SFT:
00680         rd (); comma (); rt (); comma ();
00681         sprintf (tmp, "0x%x", SHAMT_ (inst));
00682         strcat (dest, tmp);
00683         mkcomment (dest, "# %d", SHAMT_ (inst));
00684         if (rflag )
00685         {
00686             sprintf (tmp, " rt=0x%x", rtvalue);
00687             strcat (dest, tmp);
00688         }
00689         break;
00690     case RS_RT_OFF:
00691     case RS_OFF:
00692         rs (); comma ();
00693         do_rs = 1;
00694         if (pt->type == RS_RT_OFF)
00695         {
00696             rt (); comma ();
00697             if (rflag )
00698                 do_rt = 1;
00699         }
00700     case CP_OFF:
00701     case OFF:
00702         v = IMM_ (inst);
00703         if (v & (1L << 15))
00704             v |= 0xffff0000L;
00705         v1 = (long)addr + 4 + (v << 2);
00706             sprintf (tmp, "%x", v1);
00707         strcat (dest, tmp);
00708         mkcomment (dest, "# 0x%08x", v1);
00709         if (rflag && do_rs )
00710         {
00711             sprintf (tmp, " rs=0x%x", rsvalue);
00712             strcat (dest, tmp);
00713             do_rs = 0;
00714         }
00715         if (rflag && do_rt )
00716         {
00717             sprintf (tmp, " rt=0x%x", rtvalue);
00718             strcat (dest, tmp);
00719             do_rt = 0;
00720         }
00721         break;
00722     case BPCODE:
00723         sprintf (tmp, "%d", (inst >> 16) & 0x3ff);
00724         strcat (dest, tmp);
00725         break;
00726     case COFUN:
00727         sprintf (tmp, "0x%x", inst & 0x01ffffffL);
00728         strcat (dest, tmp);
00729         break;
00730     case NONE:
00731         break;
00732     case TARGET:
00733         v = (inst & 0x03ffffff) << 2;
00734         v |= ((int)addr & 0xf0000000);
00735             sprintf (tmp, "%x", v);
00736         strcat (dest, tmp);
00737         mkcomment (dest, "# 0x%08x", v);
00738         break;
00739     case JALR:
00740         if (RD_ (inst) != 31L)
00741             rd (); comma ();
00742         rs ();
00743         if (rflag )
00744             mkcomment( dest, "# rs=0x%x", rsvalue);
00745         break;
00746     case LDSTC0:
00747         v = IMM_ (inst);
00748         if (v & (1L << 15))
00749             v |= 0xffff0000L;
00750         c0ft (); comma ();
00751         sprintf (tmp, "%d", v);
00752         strcat (dest, tmp);
00753         strcat (dest, "(");
00754         rs ();
00755         strcat (dest, ")");
00756         mkcomment (dest, "# 0x%x", v);
00757         if (rflag )
00758         {
00759             /* If wanting register contents, then add this too */
00760             sprintf (tmp, " addr=0x%x", (int)(v + rsvalue));
00761             strcat (dest, tmp);
00762         }
00763         break;
00764     case LDSTC1:
00765     case STOREC1:
00766         v = IMM_ (inst);
00767         if (v & (1L << 15))
00768             v |= 0xffff0000L;
00769         c1ft (); comma ();
00770         sprintf (tmp, "%d", v);
00771         strcat (dest, tmp);
00772         strcat (dest, "(");
00773         rs ();
00774         strcat (dest, ")");
00775         mkcomment (dest, "# 0x%x", v);
00776         if (rflag )
00777         {
00778             /* If wanting register contents, then add this too */
00779             sprintf (tmp, " addr=0x%x", (int)(v + rsvalue));
00780             strcat (dest, tmp);
00781         }
00782         break;
00783     case LDSTCN:
00784     case STORECN:
00785         v = IMM_ (inst);
00786         if (v & (1L << 15))
00787             v |= 0xffff0000L;
00788         cnft (); comma ();
00789         sprintf (tmp, "%d", v);
00790         strcat (dest, tmp);
00791         strcat (dest, "(");
00792         rs ();
00793         strcat (dest, ")");
00794         mkcomment (dest, "# 0x%x", v);
00795         if (rflag )
00796         {
00797             /* If wanting register contents, then add this too */
00798             sprintf (tmp, " addr=0x%x", (int)(v + rsvalue));
00799             strcat (dest, tmp);
00800         }
00801         break;
00802     case LOAD_STORE:
00803     case STORE:
00804         rt (); comma ();
00805     load_store:
00806         v = IMM_ (inst);
00807         if (v & (1L << 15))
00808             v |= 0xffff0000L;
00809         sprintf (tmp, "%d", v);
00810         strcat (dest, tmp);
00811         strcat (dest, "(");
00812         rs ();
00813         strcat (dest, ")");
00814         if (rflag )
00815         {
00816             /* If wanting register contents, then add this too */
00817             mkcomment( dest, "# addr=0x%x", (int)(v + rsvalue));
00818             if (pt->type == STORE )
00819             {
00820                 sprintf (tmp, " rt=0x%x", (int)rtvalue);
00821                 strcat (dest, tmp);
00822             }
00823         }
00824         else
00825         mkcomment (dest, "# 0x%x", v);
00826         break;
00827     case CACHE_OP:
00828         sprintf (tmp, "%d,", RT_(inst));
00829         strcat (dest, tmp);
00830         goto load_store;
00831     case WORD:
00832         sprintf (tmp, "%08x", inst);
00833         strcat (dest, tmp);
00834         strcat (dest, "      # ");
00835         w = (long)addr;
00836         for (i = 0; i < 4; i++) {
00837             v = ((char *)&inst)[i];
00838             w++;
00839             if (isprint (v))
00840                 strccat (dest, v);
00841             else
00842                 strccat (dest, '.');
00843         }
00844         break;
00845     }
00846     return (addr + 4L);
00847 }

Here is the call graph for this function:

mycmd_init ( timer  ,
cmd_timer  ,
"timer ms"  ,
"set timer"   
)

static int set_timer ( int  ms  )  [static]

Definition at line 240 of file mips32.c.

Referenced by cmd_timer(), and fMIPS32_Init().

00241 {
00242           struct itimerval value,oval;
00243           value.it_interval.tv_sec = ms/1000;
00244           value.it_interval.tv_usec = (ms%1000)*1000;
00245           value.it_value = value.it_interval;
00246           setitimer(ITIMER_REAL,&value,&oval);
00247 }

static void timer_handler ( int  sig  )  [static]

Definition at line 205 of file mips32.c.

References check_ejtag(), debug_reg, dMIPS32_ECR_IN_DEBUG_MODE, ejtag_in_debug_mode, and enable_timer.

Referenced by fMIPS32_Init().

00206 {
00207         static char buf[256];
00208         static int ui_result;
00209         int debug_reg1;
00210 
00211         ejtag_in_debug_mode = !!(ui_result & dMIPS32_ECR_IN_DEBUG_MODE);
00212         if(enable_timer == 1)
00213         {
00214                 check_ejtag(buf,&debug_reg1);
00215 
00216         if(debug_reg1 != debug_reg )
00217                 printf("\n%s\n",buf);
00218         debug_reg = debug_reg1;
00219         }
00220 }

Here is the call graph for this function:

void USB_UPLOAD_FAST ( unsigned int  upload_len  ) 

Definition at line 1825 of file mips32.c.

References dJTAG_REGISTER_FASTDATA, fJTAG_FAST_UPLOAD(), and fJTAG_Instruction().

01826 {
01827         fJTAG_Instruction(dJTAG_REGISTER_FASTDATA);
01828         fJTAG_FAST_UPLOAD(upload_len);
01829 }

Here is the call graph for this function:

unsigned int wait_address ( unsigned int  address,
int  write,
int  waitacc 
)

Definition at line 339 of file mips32.c.

References dJTAG_REGISTER_ADDRESS, dJTAG_REGISTER_CONTROL, dJTAG_REGISTER_DATA, dMIPS32_ECR_ACCESS_PENDING, dMIPS32_ECR_ACCESS_RW, dMIPS32_ECR_CPU_RESET_OCCURED, dMIPS32_ECR_IN_DEBUG_MODE, dMIPS32_ECR_PROBE_ENABLE, dMIPS32_ECR_PROBE_VECTOR, fJTAG_Data(), fJTAG_Instruction(), fMIPS32_HandleRead(), and fMIPS32_HandleWrite().

Referenced by cmd_checksum(), cmd_fget(), cmd_fput(), cmd_fputflash(), cmd_get(), and cmd_put().

00340 {
00341   unsigned int ui_result;
00342   unsigned int ui_address;
00343   unsigned int ui_data;
00344   int accesstype;
00345   while (1)
00346   {
00347     // Read the control register.  Make sure an access is requested, then 
00348     // do it.
00349     ui_result = dMIPS32_ECR_CPU_RESET_OCCURED | dMIPS32_ECR_ACCESS_PENDING |
00350                 dMIPS32_ECR_PROBE_ENABLE | dMIPS32_ECR_PROBE_VECTOR;
00351   
00352     fJTAG_Instruction(dJTAG_REGISTER_CONTROL);
00353     ui_result = fJTAG_Data(ui_result);
00354     accesstype=(ui_result>>29)&3;
00355         if(!(ui_result & dMIPS32_ECR_IN_DEBUG_MODE))
00356         {
00357       fprintf(stderr,"not in debug mode!\n");
00358     //            printf("not in debug mode!\n");
00359           return 0;
00360         }
00361     
00362     if (!(ui_result & dMIPS32_ECR_ACCESS_PENDING))
00363     {
00364           if(!waitacc)return -1;
00365           continue;
00366     }
00367 
00368         
00369     fJTAG_Instruction(dJTAG_REGISTER_ADDRESS);
00370     ui_address = fJTAG_Data(0x00)|0xff000000;
00371     fJTAG_Instruction(dJTAG_REGISTER_DATA);
00372     ui_data = fJTAG_Data(0x00);
00373 //      printf("ui_address =%08x\n",ui_address);
00374     if (ui_result & dMIPS32_ECR_ACCESS_RW) // Bit set for a WRITE
00375     {
00376         // Clear the access pending bit (let the processor eat!)
00377         ui_result = dMIPS32_ECR_CPU_RESET_OCCURED | dMIPS32_ECR_PROBE_ENABLE | 
00378                     dMIPS32_ECR_PROBE_VECTOR;
00379         if (ui_address < 0xFF200200)
00380         fMIPS32_HandleWrite(ui_address, ui_data, accesstype);
00381         
00382                 if(address!=ui_address || !write || ui_address < 0xFF200200)
00383                 {
00384         fJTAG_Instruction(dJTAG_REGISTER_CONTROL);
00385         ui_result = fJTAG_Data(ui_result);
00386                 }
00387 
00388                 if(address==ui_address && write)break;
00389         }
00390         else
00391         {
00392         // Clear the access pending bit (let the processor eat!)
00393         ui_result = dMIPS32_ECR_CPU_RESET_OCCURED | dMIPS32_ECR_PROBE_ENABLE | 
00394                     dMIPS32_ECR_PROBE_VECTOR;
00395 
00396           fJTAG_Instruction(dJTAG_REGISTER_DATA);
00397       if (ui_address >= 0xFF200200)
00398                 ui_data = 0;
00399           else
00400         ui_data = fMIPS32_HandleRead(ui_address);
00401         ui_data = fJTAG_Data(ui_data);
00402 
00403                 if(address!=ui_address || write || ui_address < 0xFF200200)
00404                 {
00405         fJTAG_Instruction(dJTAG_REGISTER_CONTROL);
00406         ui_result = fJTAG_Data(ui_result);
00407                 }
00408 
00409                 if(address==ui_address && !write)break;
00410         }
00411 
00412 }
00413 
00414     fJTAG_Instruction(dJTAG_REGISTER_ADDRESS);
00415     fJTAG_Data(ui_address);
00416 
00417         return 0;
00418   
00419 
00420 }

Here is the call graph for this function:


Variable Documentation

unsigned int code_inst_crc[100]

Definition at line 1564 of file mips32.c.

Referenced by jtag_crc_down().

unsigned int code_inst_crc_old[100]

Definition at line 1606 of file mips32.c.

unsigned int code_inst_download[]

Initial value:

tgt_compile(
"bal 1f;\n" 
"nop;\n" 
"param:\n" 
".space 40 \n" 
"1:\n" 
"lw t4,0(ra);\n" 
"lw t5,4(ra);\n" 
"move t3,zero;\n" 
"lui t6,0xff20;\n" 
"ori t6,t6,0xfe04;\n" 
"1:lw t7,0(t6);\n" 
"sw t7,0(t5);\n" 
"addu t3,t3,4;\n" 
"slt at,t3,t4;\n" 
"bnez at,1b;\n" 
"addi t5,t5,4;\n" 
"nop ;\n" 
)

Definition at line 1507 of file mips32.c.

Referenced by cmd_checksum(), cmd_fget(), cmd_fput(), cmd_fputflash(), cmd_get(), cmd_put(), and jtag_self_down().

unsigned int code_inst_download_crc[100]

Definition at line 1437 of file mips32.c.

Referenced by jtag_self_down_crc().

unsigned int code_inst_upload[100]

Initial value:

tgt_compile(
"lui t6,0xa530;\n" 
"lw t4,0(t6);\n" 
"lui t5,0xbfc0;\n" 
"add t4,t4,t5;\n" 
"lui t6,0xff2f;\n" 
"ori t6,t6,0xfe04;\n" 
"1:lw t7,0(t5);\n" 
"sw t7,0(t6);\n" 
"bne t4,t5,1b;\n" 
"addi t5,t5,4;\n" 
"nop ;\n" 
)

Definition at line 1538 of file mips32.c.

Referenced by jtag_self_down_up().

unsigned int context_reg[dMIPS32_NUM_DEBUG_REGISTERS] = {0}

const unsigned int crc32_table_down[256] [static]

Definition at line 1658 of file mips32.c.

Referenced by jtag_crc_table_down().

unsigned int debug_reg = 0

Definition at line 204 of file mips32.c.

Referenced by cmd_si(), jtag_quit(), and timer_handler().

int Ejtag_boot_flag = 0

Definition at line 98 of file mips32.c.

Referenced by fMIPS32_ExecuteDebugModule().

Definition at line 102 of file mips32.c.

Referenced by cmd_cont(), and timer_handler().

Definition at line 100 of file mips32.c.

Referenced by fMIPS32_Init(), main(), and timer_handler().

int fMIPS32_inited = 0 [static]

Definition at line 99 of file mips32.c.

Referenced by fMIPS32_Init().

Definition at line 17 of file main.c.

Referenced by fMIPS32_ExecuteDebugModule(), and main().

unsigned int miro_download_os_ret_inst[]

Initial value:

tgt_compile(
"mtc0 t7,c0_desave;\n" 
"mfc0 t7,c0_taghi;\n" 
"mtc0 t7,c0_depc;\n" 
"nop ;\n" 
"mfc0 t7,c0_desave;\n" 
"nop ;\n" 
"deret ;\n" 
"nop ;\n" 
)

Definition at line 1893 of file mips32.c.

unsigned int miro_initcp0_inst[]

Initial value:

tgt_compile(
"1:mtc0 zero,c0_status;\n" 
"mtc0 zero,c0_cause;\n" 
"lui t0,0x40;\n" 
"mtc0 t0,c0_status;\n" 
"lui sp,0x8100;\n" 
"addiu sp,sp,-16384;\n" 
"lui gp,0x8106;\n" 
"addiu gp,gp,-11248;\n" 
"b 1b;\n" 
"nop ;\n" 
)

Definition at line 1930 of file mips32.c.

unsigned int miro_initsdram_inst[]

Initial value:

tgt_compile(
"1:mtc0 t7,c0_desave;\n" 
"lui a2,0xbf00;\n" 
"lui a1,0xc40;\n" 
"ori a1,a1,0x2d4;\n" 
"sw a1,0(a2);\n" 
"lui a1,0x2098;\n" 
"ori a1,a1,0xcd;\n" 
"sw a1,4(a2);\n" 
"mfc0 t7,c0_desave;\n" 
"nop ;\n" 
"b 1b;\n" 
"nop ;\n" 
"nop ;\n" 
)

Definition at line 1860 of file mips32.c.

unsigned int miro_initsdram_inst_2[]

Initial value:

tgt_compile(
"mtc0 t7,c0_desave;\n" 
"mfc0 t7,c0_depc;\n" 
"mtc0 t7,c0_taghi;\n" 
"lui t7,0xa020;\n" 
"mtc0 t7,c0_depc;\n" 
"nop ;\n" 
"mfc0 t7,c0_desave;\n" 
"nop ;\n" 
"deret ;\n" 
"nop ;\n" 
)

Definition at line 1878 of file mips32.c.

unsigned int miro_inst[]

Initial value:

tgt_compile(
".set mips32\n" 
"1:mtc0 t7,c0_desave;\n" 
"mfc0 t7,$16,6;\n" 
"xori t7,t7,0x220;\n" 
"mtc0 t7,$16,6;\n" 
"mfc0 t7,c0_desave;\n" 
"nop ;\n" 
"b 1b;\n" 
"nop ;\n" 
)

Definition at line 1831 of file mips32.c.

unsigned int miro_inst_2[]

Initial value:

tgt_compile(
".set mips32;\n" 
"mtc0 t7,c0_desave;\n" 
"lui t7,0xa500;\n" 
"mtc0 t7,c0_depc;\n" 
"nop ;\n" 
"mfc0 t7,c0_desave;\n" 
"mfc0 t7,c0_depc;\n" 
"nop ;\n" 
"jr t7;\n" 
"nop ;\n" 
)

Definition at line 1845 of file mips32.c.

Referenced by cmd_checksum(), cmd_fget(), cmd_fput(), cmd_fputflash(), cmd_get(), cmd_program(), and cmd_put().

unsigned int miro_runcrc_inst[]

Initial value:

tgt_compile(
"mtc0 t7,c0_desave;\n" 
"lui t7,0xa540;\n" 
"mtc0 t7,c0_depc;\n" 
"nop ;\n" 
"mfc0 t7,c0_desave;\n" 
"nop ;\n" 
"deret ;\n" 
"nop ;\n" 
)

Definition at line 1917 of file mips32.c.

unsigned int miro_savedepc_inst[]

Initial value:

tgt_compile(
"mtc0 t7,c0_desave;\n" 
"mfc0 t7,c0_depc;\n" 
"mtc0 t7,c0_taghi;\n" 
"nop ;\n" 
"mfc0 t7,c0_desave;\n" 
"nop ;\n" 
"deret ;\n" 
"nop ;\n" 
)

Definition at line 1905 of file mips32.c.

unsigned int timer_val = 1000

Definition at line 101 of file mips32.c.

Referenced by fMIPS32_Init(), and main().

unsigned int ui_datamem[0x80]

unsigned int ui_ejtag_state

unsigned int* ui_fifomem

unsigned int ui_fifomem_size = 0x2000

Definition at line 88 of file mips32.c.

Referenced by jtag_getmem(), jtag_putmem(), and main().

unsigned int ui_last_signal

unsigned int ui_stack[32]

Definition at line 264 of file mips32.c.

Referenced by fMIPS32_HandleRead(), and fMIPS32_HandleWrite().

unsigned int ui_stack_index = 0

Definition at line 265 of file mips32.c.

Referenced by fMIPS32_HandleRead(), and fMIPS32_HandleWrite().

unsigned int uififo_raddr

unsigned int uififo_waddr


Generated on Fri Nov 5 07:24:51 2010 for ejtag debug tools for loongson 232 cpu by  doxygen 1.5.6