Lines Matching full:record

54 static void file_record(struct ihex_binrec *record);
134 struct ihex_binrec *record; in process_ihex() local
145 /* search for the start of record character */ in process_ihex()
151 /* Minimum record length would be about 10 characters */ in process_ihex()
153 fprintf(stderr, "Can't find valid record at line %d\n", line); in process_ihex()
162 record_size = ALIGN(sizeof(*record) + len, 4); in process_ihex()
163 record = malloc(record_size); in process_ihex()
164 if (!record) { in process_ihex()
168 memset(record, 0, record_size); in process_ihex()
169 record->len = len; in process_ihex()
172 if (i + 8 + (record->len * 2) > size) { in process_ihex()
173 fprintf(stderr, "Not enough data to read complete record at line %d\n", in process_ihex()
178 record->addr = hex(data + i, &crc) << 8; i += 2; in process_ihex()
179 record->addr |= hex(data + i, &crc); i += 2; in process_ihex()
182 for (j = 0; j < record->len; j++, i += 2) in process_ihex()
183 record->data[j] = hex(data + i, &crc); in process_ihex()
193 /* Done reading the record */ in process_ihex()
196 /* old style EOF record? */ in process_ihex()
197 if (!record->len) in process_ihex()
200 record->addr += offset; in process_ihex()
201 file_record(record); in process_ihex()
204 case 1: /* End-Of-File Record */ in process_ihex()
205 if (record->addr || record->len) { in process_ihex()
206 fprintf(stderr, "Bad EOF record (type 01) format at line %d", in process_ihex()
212 case 2: /* Extended Segment Address Record (HEX86) */ in process_ihex()
213 case 4: /* Extended Linear Address Record (HEX386) */ in process_ihex()
214 if (record->addr || record->len != 2) { in process_ihex()
215 fprintf(stderr, "Bad HEX86/HEX386 record (type %02X) at line %d\n", in process_ihex()
222 offset = record->data[0] << 8 | record->data[1]; in process_ihex()
226 case 3: /* Start Segment Address Record */ in process_ihex()
227 case 5: /* Start Linear Address Record */ in process_ihex()
228 if (record->addr || record->len != 4) { in process_ihex()
229 fprintf(stderr, "Bad Start Address record (type %02X) at line %d\n", in process_ihex()
234 memcpy(&data32, &record->data[0], sizeof(data32)); in process_ihex()
236 memcpy(&record->data[0], &data32, sizeof(data32)); in process_ihex()
239 * starts. If requested output this as a record. */ in process_ihex()
241 file_record(record); in process_ihex()
245 fprintf(stderr, "Unknown record (type %02X)\n", type); in process_ihex()
254 static void file_record(struct ihex_binrec *record) in file_record() argument
258 while ((*p) && (!sort_records || (*p)->addr < record->addr)) in file_record()
261 record->next = *p; in file_record()
262 *p = record; in file_record()
284 /* EOF record is zero length, since we don't bother to represent in output_records()