Lines Matching full:record
49 char error; /* true if an error occurred parsing this record */
51 u8 max_len; /* maximum record length in whole ihex */
77 * returns true if record is available, false otherwise.
78 * iff an error occurred, false will be returned and record->error will be true.
80 static bool usb6fire_fw_ihex_next_record(struct ihex_record *record) in usb6fire_fw_ihex_next_record() argument
86 record->error = false; in usb6fire_fw_ihex_next_record()
88 /* find begin of record (marked by a colon) */ in usb6fire_fw_ihex_next_record()
89 while (record->txt_offset < record->txt_length in usb6fire_fw_ihex_next_record()
90 && record->txt_data[record->txt_offset] != ':') in usb6fire_fw_ihex_next_record()
91 record->txt_offset++; in usb6fire_fw_ihex_next_record()
92 if (record->txt_offset == record->txt_length) in usb6fire_fw_ihex_next_record()
96 record->txt_offset++; in usb6fire_fw_ihex_next_record()
97 if (record->txt_offset + 8 > record->txt_length) { in usb6fire_fw_ihex_next_record()
98 record->error = true; in usb6fire_fw_ihex_next_record()
102 record->len = usb6fire_fw_ihex_hex(record->txt_data + in usb6fire_fw_ihex_next_record()
103 record->txt_offset, &crc); in usb6fire_fw_ihex_next_record()
104 record->txt_offset += 2; in usb6fire_fw_ihex_next_record()
105 record->address = usb6fire_fw_ihex_hex(record->txt_data + in usb6fire_fw_ihex_next_record()
106 record->txt_offset, &crc) << 8; in usb6fire_fw_ihex_next_record()
107 record->txt_offset += 2; in usb6fire_fw_ihex_next_record()
108 record->address |= usb6fire_fw_ihex_hex(record->txt_data + in usb6fire_fw_ihex_next_record()
109 record->txt_offset, &crc); in usb6fire_fw_ihex_next_record()
110 record->txt_offset += 2; in usb6fire_fw_ihex_next_record()
111 type = usb6fire_fw_ihex_hex(record->txt_data + in usb6fire_fw_ihex_next_record()
112 record->txt_offset, &crc); in usb6fire_fw_ihex_next_record()
113 record->txt_offset += 2; in usb6fire_fw_ihex_next_record()
116 if (record->txt_offset + 2 * (record->len + 1) > record->txt_length) { in usb6fire_fw_ihex_next_record()
117 record->error = true; in usb6fire_fw_ihex_next_record()
120 for (i = 0; i < record->len; i++) { in usb6fire_fw_ihex_next_record()
121 record->data[i] = usb6fire_fw_ihex_hex(record->txt_data in usb6fire_fw_ihex_next_record()
122 + record->txt_offset, &crc); in usb6fire_fw_ihex_next_record()
123 record->txt_offset += 2; in usb6fire_fw_ihex_next_record()
125 usb6fire_fw_ihex_hex(record->txt_data + record->txt_offset, &crc); in usb6fire_fw_ihex_next_record()
127 record->error = true; in usb6fire_fw_ihex_next_record()
131 if (type == 1 || !record->len) /* eof */ in usb6fire_fw_ihex_next_record()
136 record->error = true; in usb6fire_fw_ihex_next_record()
142 struct ihex_record *record) in usb6fire_fw_ihex_init() argument
144 record->txt_data = fw->data; in usb6fire_fw_ihex_init()
145 record->txt_length = fw->size; in usb6fire_fw_ihex_init()
146 record->txt_offset = 0; in usb6fire_fw_ihex_init()
147 record->max_len = 0; in usb6fire_fw_ihex_init()
148 /* read all records, if loop ends, record->error indicates, in usb6fire_fw_ihex_init()
150 while (usb6fire_fw_ihex_next_record(record)) in usb6fire_fw_ihex_init()
151 record->max_len = max(record->len, record->max_len); in usb6fire_fw_ihex_init()
152 if (record->error) in usb6fire_fw_ihex_init()
154 record->txt_offset = 0; in usb6fire_fw_ihex_init()