comparison loadtools/flutil.c @ 62:6fb41cfa773d

fc-loadtool: flash erase implemented, compiles
author Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
date Thu, 27 Jun 2013 04:56:17 +0000
parents a10491da8c3a
children a7da6648a7f8
comparison
equal deleted inserted replaced
61:a10491da8c3a 62:6fb41cfa773d
97 printf("Offset Size\n"); 97 printf("Offset Size\n");
98 for (sp = bi->sectors; sp->size; sp++) 98 for (sp = bi->sectors; sp->size; sp++)
99 printf("%08lX %lx\n", (u_long) sp->start, (u_long) sp->size); 99 printf("%08lX %lx\n", (u_long) sp->start, (u_long) sp->size);
100 return(0); 100 return(0);
101 } 101 }
102
103 get_flash_sector_range(bi, useroff, userlen, startp, endp)
104 struct flash_bank_info *bi;
105 u_long useroff, userlen;
106 struct sector_info **startp, **endp;
107 {
108 struct sector_info *sp;
109 uint32_t remlen;
110
111 for (sp = bi->sectors; sp->size; sp++)
112 if (sp->start == useroff)
113 break;
114 if (!sp->size) {
115 fprintf(stderr,
116 "error: specified offset not aligned to a flash sector boundary\n");
117 return(-1);
118 }
119 *startp = sp;
120 for (remlen = userlen; remlen; ) {
121 if (remlen < sp->size) {
122 fprintf(stderr,
123 "error: specified length not aligned to a flash sector boundary\n");
124 return(-1);
125 }
126 remlen -= sp->size;
127 sp++;
128 }
129 *endp = sp;
130 return(0);
131 }