From: hackbard Date: Sun, 29 Jul 2007 23:12:40 +0000 (+0200) Subject: more fw2ram stuff (not yet finished) X-Git-Url: https://hackdaworld.org/gitweb/?a=commitdiff_plain;h=f549db2020c9e68e37e89f3cb7a921e5a7f75954;p=my-code%2Farm.git more fw2ram stuff (not yet finished) --- diff --git a/betty/lpcload.c b/betty/lpcload.c index 7c2db70..0bf3006 100644 --- a/betty/lpcload.c +++ b/betty/lpcload.c @@ -371,7 +371,27 @@ int write_to_ram(t_lpc *lpc,u8 *buf,int addr,int len) { int firmware_to_ram(t_lpc *lpc) { + char line[BUFSIZE]; + char buf[BUFSIZE]; + + /* read file */ + while(ret) { + /* read line */ + while(ret) { + ret=read(lpc->fwfd,line,1); + if(line[0]!=':') { + printf("fw to ram: no ihex format\n"); + return -1; + } + ret=read(lpc->fwfd,line+1,2); + line[3]='\0'; + len=atoi(line+1); + ret=read(lpc->fwfd,line+3,4); + line[7]='\0'; + addr=strtol(line+3); + } + } return 0; }