/************************************************************* * File: mon/sdump.c * Purpose: Part of core Monitor * Author: Phil Bunce (pjb@carmel.com) * Revision History: * 970304 Start of revision history */ #include #include #include Optdesc sdump_opts[] = { {"addr size","send srecs to hostport"}, {0}}; /************************************************************* * sdump(ac,av) * the 'dump' command */ int sdump(int ac,char *av[]) { Ulong siz,len,i; char tmp[4]; char *uleof,*ulcr,*hostport; int fd,cs,v; struct termio tbuf; U64 rv; ADDR adr,a; if (!regChain) { printf("Target description driver not loaded\n"); return(1); } if(!get_rsa(&rv,av[1])) return(1); adr = rv.lo; if (!get_rsa(&rv,av[2])) return(1); siz = rv.lo; hostport = getMonEnv("hostport"); if (!hostport) { printf("ERROR: hostport not defined\n"); return(1); } fd = open(hostport,O_RDWR); if (fd == -1) { printf("ERROR: can't open %s\n",hostport); return(1); } ioctl(fd,TCGETA,&tbuf); tbuf.c_iflag &= ~IXANY; ioctl(fd,TCSETAF,&tbuf); uleof = getMonEnv("uleof"); if (!uleof) { printf("ERROR: uleof not defined\n"); return(1); } ulcr = getMonEnv("ulcr"); if (!ulcr) { printf("ERROR: ulcr not defined\n"); return(1); } while (siz > 0) { if (siz < 32) len = siz; else len = 32; cs = len+5; for (i=0;i<4;i++) cs += (adr>>(i*8))&0xff; sprintf(line,"S3%02X%08X",len+5,adr); for (a=adr,i=0;i