⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sdump.c

📁 mips架构的bootloader,99左右的版本 但源代码现在没人更新了
💻 C
字号:
/************************************************************* * File: mon/sdump.c * Purpose: Part of core Monitor * Author: Phil Bunce (pjb@carmel.com) * Revision History: *	970304	Start of revision history */#include <termio.h>#include <fcntl.h>#include <mon.h>Optdesc sdump_opts[] = {	{"addr size","send srecs to hostport"},	{0}};/**************************************************************  sdump(ac,av)*	the 'dump' command */sdump(ac,av)int ac;char *av[];{Ulong adr,siz,len,i,a;char tmp[4];char *uleof,*ulcr,*hostport;int fd,cs,v;struct termio tbuf;if (!regChain) {	printf("Target description driver not loaded\n");	return(1);	}if(!get_rsa(&adr,av[1]) || !get_rsa(&siz,av[2])) return(1);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<len;a++,i++) {		v = read_target(XT_MEM,a,1);		cs += v;		sprintf(tmp,"%02X",v);		strcat(line,tmp);		}	sprintf(tmp,"%02X\n",(~cs)&0xff);	strcat(line,tmp);	if (strequ(ulcr,"on")) line[strlen(line)-1] = '\r';	write(fd,line,strlen(line));	adr += len;	siz -= len;	}strcpy(line,"S70500000000FA\n");if (strequ(ulcr,"on")) line[strlen(line)-1] = '\r';write(fd,line,strlen(line));*line = 0;write(fd,uleof,strlen(uleof));return(0);}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -