sget.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_sget (int argc, char **argv)
 mycmd_init (sget, cmd_sget,"sget","sget filename address size")


Function Documentation

int cmd_sget ( int  argc,
char **  argv 
)

Definition at line 5 of file sget.c.

References fd, and jtag_getmem().

00006 {
00007         unsigned long download_addr;
00008         char *buf;
00009         int fd;
00010         unsigned int size;
00011 
00012 if(argc<4)return -1;
00013 size=strtoul(argv[3],0,0);
00014 
00015 
00016 buf=malloc(size);
00017 if(!buf)printf("error allocate memory\n");
00018 
00019         download_addr=strtoul(argv[2],0,0);
00020 
00021         jtag_getmem(buf,download_addr,size);
00022 
00023 fd=open(argv[1],O_WRONLY|O_CREAT|O_TRUNC);
00024 if(fd){
00025 write(fd,buf,size);
00026 close(fd);
00027 }
00028 else
00029 {
00030 printf("open file %s for write error\n",argv[1]); 
00031 }
00032 
00033 free(buf);
00034 
00035         return 0;
00036 }

Here is the call graph for this function:

mycmd_init ( sget  ,
cmd_sget  ,
"sget"  ,
"sget filename address size"   
)


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