Lines Matching refs: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)
86 record->error = false;
88 /* find begin of record (marked by a colon) */
89 while (record->txt_offset < record->txt_length
90 && record->txt_data[record->txt_offset] != ':')
91 record->txt_offset++;
92 if (record->txt_offset == record->txt_length)
96 record->txt_offset++;
97 if (record->txt_offset + 8 > record->txt_length) {
98 record->error = true;
102 record->len = usb6fire_fw_ihex_hex(record->txt_data +
103 record->txt_offset, &crc);
104 record->txt_offset += 2;
105 record->address = usb6fire_fw_ihex_hex(record->txt_data +
106 record->txt_offset, &crc) << 8;
107 record->txt_offset += 2;
108 record->address |= usb6fire_fw_ihex_hex(record->txt_data +
109 record->txt_offset, &crc);
110 record->txt_offset += 2;
111 type = usb6fire_fw_ihex_hex(record->txt_data +
112 record->txt_offset, &crc);
113 record->txt_offset += 2;
116 if (record->txt_offset + 2 * (record->len + 1) > record->txt_length) {
117 record->error = true;
120 for (i = 0; i < record->len; i++) {
121 record->data[i] = usb6fire_fw_ihex_hex(record->txt_data
122 + record->txt_offset, &crc);
123 record->txt_offset += 2;
125 usb6fire_fw_ihex_hex(record->txt_data + record->txt_offset, &crc);
127 record->error = true;
131 if (type == 1 || !record->len) /* eof */
136 record->error = true;
142 struct ihex_record *record)
144 record->txt_data = fw->data;
145 record->txt_length = fw->size;
146 record->txt_offset = 0;
147 record->max_len = 0;
148 /* read all records, if loop ends, record->error indicates,
150 while (usb6fire_fw_ihex_next_record(record))
151 record->max_len = max(record->len, record->max_len);
152 if (record->error)
154 record->txt_offset = 0;