]> hackdaworld.org Git - my-code/arm.git/commitdiff
more fw2ram stuff (not yet finished)
authorhackbard <hackbard@hackdaworld.org>
Sun, 29 Jul 2007 23:12:40 +0000 (01:12 +0200)
committerhackbard <hackbard@hackdaworld.org>
Sun, 29 Jul 2007 23:12:40 +0000 (01:12 +0200)
betty/lpcload.c

index 7c2db70b1546bfa9124dbf44d65c0dc8fd5e8d79..0bf3006aa7dd262c3ce0872bd309cd7e4c1626ed 100644 (file)
@@ -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;
 }