checksum.c File Reference

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

Go to the source code of this file.

Functions

int cmd_checksum (int argc, char **argv)
 mycmd_init (checksum, cmd_checksum,"checksum","checksum address size")


Function Documentation

int cmd_checksum ( int  argc,
char **  argv 
)

Definition at line 1 of file checksum.c.

References code_inst_download, context_reg, context_restore(), context_save(), dMIPS32_NUM_DEBUG_REGISTERS, fMIPS32_ExecuteDebugModule(), help_addr, jtag_putmem(), miro_inst_2, tgt_compile, ui_datamem, and wait_address().

00002 {
00003         unsigned int addr,size;
00004         int context_reg[dMIPS32_NUM_DEBUG_REGISTERS];
00005         addr=strtoul(argv[1],0,0);
00006         size=strtoul(argv[2],0,0);
00007         size = (size+3)&~3;
00008         context_save(context_reg);
00009     
00010     {
00011             unsigned int code_inst_download[]=
00012 tgt_compile(\
00013 "move a2,zero;\n" \
00014 "1:lw v1,0(a0);\n" \
00015 "addu a2,v1;\n" \
00016 "addiu a1,-4;\n" \
00017 "bnez a1,1b;\n" \
00018 "addiu a0,a0,4;\n" \
00019 "nop\n" \
00020 "li v1,0xff200000;\n"
00021 "sw a2,(v1);\n" \
00022 "nop\n" \
00023 "1:li v1,0xff200200 ;\n" \
00024 "jr v1 ;\n" \
00025 "nop;\n" \
00026 );
00027 
00028 
00029         jtag_putmem(code_inst_download,help_addr,sizeof(code_inst_download));
00030     }
00031 
00032  {
00033 unsigned int miro_inst_2[]=
00034 tgt_compile(\
00035 "bal 1f;\n" \
00036 "nop;\n" \
00037 "param:\n" \
00038 ".space 16 \n" \
00039 "1:\n" \
00040 "lw v0,(ra);\n" \
00041 "lw a0,4(ra);\n" \
00042 "lw a1,8(ra);\n" \
00043 "jr v0;\n" \
00044 "nop ;\n" \
00045 "nop ;\n" \
00046 "nop ;\n" \
00047 );
00048             miro_inst_2[2]=help_addr;
00049             miro_inst_2[3]=addr;
00050             miro_inst_2[4]=size;
00051     fMIPS32_ExecuteDebugModule(miro_inst_2,sizeof(miro_inst_2),1);
00052 }
00053 
00054         ui_datamem[0]=-1;
00055         ui_datamem[1]=-1;
00056         wait_address(0xff200204,0,1);
00057         printf("checksum 0x%08x\n",ui_datamem[0]);
00058 
00059         context_restore(context_reg);
00060 
00061         return 0;
00062 }

Here is the call graph for this function:

mycmd_init ( checksum  ,
cmd_checksum  ,
"checksum"  ,
"checksum address size"   
)


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