jtagtest.c File Reference

#include <linux/types.h>
#include <myconfig.h>

Include dependency graph for jtagtest.c:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

static int __jtagreg_syscall1 (int type, unsigned long long addr, union commondata *mydata)
static int __jtagreg_syscall2 (int type, unsigned long long addr, union commondata *mydata)
static int cmd_waitfacc (int argc, char **argv)
static int jtaginit (int argc, char **argv)
static int jtagregs (int argc, char **argv)
 mycmd_init (jtaginit, jtaginit,"jtaginit [speed]","jtaginit [speed]")
 mycmd_init (waitfacc, cmd_waitfacc,"waitfacc ","wait first acc after reset")
 mycmd_init (waitreg, waitreg,"waitreg reg data","waitreg reg equal to be data")
 mycmd_init (jtagregs, jtagregs,"jtagregs","jtagregs")
 myconfig_init ("jtagregs.jtagdata.val", config_jtagregs_jtagdata_val, CONFIG_I,"jtagregs input data'svalue")
 myconfig_init ("jtagregs.jtagdata", config_jtagregs_jtagdata, CONFIG_I,"jtagregs d1 will input special data")
static int waitreg (int argc, char **argv)

Variables

static int config_jtagregs_jtagdata = 0
static int config_jtagregs_jtagdata_val = 0


Function Documentation

static int __jtagreg_syscall1 ( int  type,
unsigned long long  addr,
union commondata *  mydata 
) [static]

Definition at line 7 of file jtagtest.c.

References config_jtagregs_jtagdata, config_jtagregs_jtagdata_val, commondata.data4, fJTAG_Data(), and fJTAG_Instruction().

Referenced by jtagregs().

00008 {
00009     int code = addr&0x1f;
00010     unsigned int data;
00011     if(type!=4)return -1;
00012     switch(code)
00013     {
00014             case 0xa: data=0x4c000; break;
00015                 case 0xb:mydata->data4 =0;return 0;break;
00016             default: data=0; break;
00017     }
00018         if(config_jtagregs_jtagdata)data=config_jtagregs_jtagdata_val;
00019     fJTAG_Instruction(code);
00020     mydata->data4 = fJTAG_Data(data);
00021     fJTAG_Data(mydata->data4);
00022 return 0;
00023 }

Here is the call graph for this function:

static int __jtagreg_syscall2 ( int  type,
unsigned long long  addr,
union commondata *  mydata 
) [static]

Definition at line 25 of file jtagtest.c.

References commondata.data4, fJTAG_Data(), and fJTAG_Instruction().

Referenced by jtagregs().

00026 {
00027     int code = addr&0x1f;
00028     unsigned int data;
00029     if(type!=4)return -1;
00030     fJTAG_Instruction(code);
00031     data=fJTAG_Data(mydata->data4);
00032     printf("\n%02x: %02x<->",code,data);
00033     data=fJTAG_Data(mydata->data4);
00034     printf("%02x\n",data);
00035 return 0;
00036 }

Here is the call graph for this function:

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

Definition at line 74 of file jtagtest.c.

References fMIPS32_Init(), force_acc(), and get_acc().

00075 {
00076 int op,address,data,state=3;
00077 
00078  fMIPS32_Init();
00079 
00080 while(1)
00081 {
00082  int ret;
00083  ret=get_acc(&op,&address,&data);
00084  if(!(ret&1)){force_acc();fprintf(stderr,"conneting\n");state=0;continue;}
00085  if(state<1){fprintf(stderr,"conneted\n");state=1;}
00086 
00087  if(!(ret&2)){fprintf(stderr,"waiting\n");state=1;continue;}
00088  if (state<2) {fprintf(stderr,"acc\n"); state=2;}
00089  if(address==0xff200200)break;
00090 }
00091 
00092 return 0;
00093 }

Here is the call graph for this function:

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

Definition at line 95 of file jtagtest.c.

References fMIPS32_Init().

00096 {
00097  fMIPS32_Init();
00098  if(argc>1)
00099  setenv("put_speed",argv[1],0);
00100  return 0;
00101 }

Here is the call graph for this function:

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

Definition at line 39 of file jtagtest.c.

References __jtagreg_syscall1(), __jtagreg_syscall2(), fMIPS32_Init(), syscall1, syscall2, and syscall_addrwidth.

00040 {
00041 syscall1=__jtagreg_syscall1;
00042 syscall2=__jtagreg_syscall2;
00043 syscall_addrwidth=4;
00044 fMIPS32_Init();
00045 return 0;       
00046 }

Here is the call graph for this function:

mycmd_init ( jtaginit  ,
jtaginit  ,
"jtaginit "  [speed],
"jtaginit "  [speed] 
)

mycmd_init ( waitfacc  ,
cmd_waitfacc  ,
"waitfacc "  ,
"wait first acc after reset"   
)

mycmd_init ( waitreg  ,
waitreg  ,
"waitreg reg data"  ,
"waitreg reg equal to be data"   
)

mycmd_init ( jtagregs  ,
jtagregs  ,
"jtagregs"  ,
"jtagregs"   
)

myconfig_init ( "jtagregs.jtagdata.val"  ,
config_jtagregs_jtagdata_val  ,
CONFIG_I  ,
"jtagregs input data'svalue"   
)

myconfig_init ( "jtagregs.jtagdata"  ,
config_jtagregs_jtagdata  ,
CONFIG_I  ,
"jtagregs d1 will input special data"   
)

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

Definition at line 48 of file jtagtest.c.

References fJTAG_Data(), fJTAG_Instruction(), and fMIPS32_Init().

00049 {
00050     int reg;
00051     unsigned int data,data0,wantdata;
00052         if(argc!=3)return -1;
00053 
00054         fMIPS32_Init();
00055 
00056         reg = strtoul(argv[1],0,0) & 0x1f;
00057         wantdata = strtoul(argv[2],0,0);
00058         
00059     switch(reg)
00060     {
00061             case 0xa: data0=0x4c000; break;
00062             default: data0=0; break;
00063     }
00064 
00065   do{
00066     fJTAG_Instruction(reg);
00067     data = fJTAG_Data(data0);
00068     fJTAG_Data(data);
00069         } while(data != wantdata);
00070 
00071 return 0;
00072 }

Here is the call graph for this function:


Variable Documentation

int config_jtagregs_jtagdata = 0 [static]

Definition at line 3 of file jtagtest.c.

Referenced by __jtagreg_syscall1().

int config_jtagregs_jtagdata_val = 0 [static]

Definition at line 4 of file jtagtest.c.

Referenced by __jtagreg_syscall1().


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