return 0;
}
+int uuencode(char *in,char *out) {
+
+ out[0]=0x20+((in[0]>>2)&0x3f);
+ out[1]=0x20+(((in[0]<<4)|(in[1]>>4))&0x3f);
+ out[2]=0x20+(((in[1]<<2)|(in[2]>>6))&0x3f);
+ out[3]=0x20+(in[2]&0x3f);
+
+ return 0;
+}
+
+int write_to_ram(t_lpc *lpc,char *buf,int addr,int len) {
+
+ int lcount;
+ u8 checksum;
+
+ if(len%4) {
+ printf("ram write: not a multiple of 4\n");
+ return -1;
+ }
+
+ while(1) {
+ if(!(lcount%20)) {
+ /* send checksum */
+ if(lcount!=0) {
+
+ }
+ /* reset checksum */
+ checksum=0;
+ }
+
+ lcount+=1;
+ }
+
+ return 0;
+}
+
+int firmware_to_ram(t_lpc *lpc) {
+
+
+
+ return 0;
+}
+
int main(int argc,char **argv) {
t_lpc lpc;
}
/* open serial port */
- open_serial_device(&lpc);
+ if(open_serial_device(&lpc)<0)
+ goto end;
/* boot loader init */
printf("boot loader init ...\n");
printf("boot code version: %02x %02x\n",lpc.bcv[0],lpc.bcv[1]);
// to be continued ... (parsing fw file and poking it to ram)
+ if(open_firmware(&lpc)<0)
+ goto end;
+ firmware_to_ram(&lpc);
-//end:
+end:
close(lpc.sfd);
+ close(lpc.fwfd);
return 0;
}