From f549db2020c9e68e37e89f3cb7a921e5a7f75954 Mon Sep 17 00:00:00 2001 From: hackbard Date: Mon, 30 Jul 2007 01:12:40 +0200 Subject: [PATCH] more fw2ram stuff (not yet finished) --- betty/lpcload.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) 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; } -- 2.39.2