Changeset 134
 Timestamp:
 Sep 27, 2010, 2:55:23 PM (9 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

Deliverables/D4.1/IntelHex.ml
r133 r134 200 200 aux (full_add hd bs cry) tl 201 201 in 202 aux (false, (vect_of_int 0 `Four)) r 202 aux (false, (vect_of_int 0 `Eight)) r 203 204 (* DPM: Non exhaustive pattern as we always check list length is even! *) 205 let rec lift_to_bytes = 206 function 207 [] > [] 208  hd::hd'::tl > 209 (mk_byte hd hd')::(lift_to_bytes tl) 203 210 204 211 let checksum_valid hex_entry = … … 207 214 else 208 215 let chk_1, chk_2 = hex_entry.data_checksum in 209 let _, cs_total = half_add chk_1 chk_2 in 210 (* let len_1, len_2 = hex_entry.record_length in 211 let _, ln_total = half_add len_1 len_2 in 216 let checksum = mk_byte chk_1 chk_2 in 217 let len_1, len_2 = hex_entry.record_length in 218 let ln_total = mk_byte len_1 len_2 in 219 let ty_total = (flip vect_of_int $ `Eight) $ int_of_intel_hex_type hex_entry.record_type in 212 220 let adr_1, adr_2, adr_3, adr_4 = hex_entry.record_addr in 213 let _, ad_total1 = half_addadr_1 adr_2 in214 let _, ad_total2 = half_add adr_3 adr_4 in*)215 let _, dt_total = add_bytes hex_entry.data_field in216 (* let _, total = add_bytes [cs_total; ln_total; ad_total1; ad_total2; dt_total] in *) 217 let total = complement dt_total in218 c s_total= total221 let ad_total1 = mk_byte adr_1 adr_2 in 222 let ad_total2 = mk_byte adr_3 adr_4 in 223 let _, dt_total = add_bytes <*> lift_to_bytes $ hex_entry.data_field in 224 let _, total = add_bytes [ln_total; ad_total1; ad_total2; ty_total; dt_total] in 225 let _,total = half_add (vect_of_int 1 `Eight) $ complement total in 226 checksum = total 219 227 220 228 (* DPM: Debug
Note: See TracChangeset
for help on using the changeset viewer.