Lines Matching refs:crc8

107 		struct cgw_csum_crc8 crc8;  member
111 void (*crc8)(struct can_frame *cf, struct cgw_csum_crc8 *crc8); member
255 static void cgw_csum_crc8_rel(struct can_frame *cf, struct cgw_csum_crc8 *crc8) in cgw_csum_crc8_rel() argument
257 int from = calc_idx(crc8->from_idx, cf->can_dlc); in cgw_csum_crc8_rel()
258 int to = calc_idx(crc8->to_idx, cf->can_dlc); in cgw_csum_crc8_rel()
259 int res = calc_idx(crc8->result_idx, cf->can_dlc); in cgw_csum_crc8_rel()
260 u8 crc = crc8->init_crc_val; in cgw_csum_crc8_rel()
267 for (i = crc8->from_idx; i <= crc8->to_idx; i++) in cgw_csum_crc8_rel()
268 crc = crc8->crctab[crc^cf->data[i]]; in cgw_csum_crc8_rel()
270 for (i = crc8->from_idx; i >= crc8->to_idx; i--) in cgw_csum_crc8_rel()
271 crc = crc8->crctab[crc^cf->data[i]]; in cgw_csum_crc8_rel()
274 switch (crc8->profile) { in cgw_csum_crc8_rel()
277 crc = crc8->crctab[crc^crc8->profile_data[0]]; in cgw_csum_crc8_rel()
281 crc = crc8->crctab[crc^crc8->profile_data[cf->data[1] & 0xF]]; in cgw_csum_crc8_rel()
285 crc = crc8->crctab[crc^(cf->can_id & 0xFF)^ in cgw_csum_crc8_rel()
291 cf->data[crc8->result_idx] = crc^crc8->final_xor_val; in cgw_csum_crc8_rel()
294 static void cgw_csum_crc8_pos(struct can_frame *cf, struct cgw_csum_crc8 *crc8) in cgw_csum_crc8_pos() argument
296 u8 crc = crc8->init_crc_val; in cgw_csum_crc8_pos()
299 for (i = crc8->from_idx; i <= crc8->to_idx; i++) in cgw_csum_crc8_pos()
300 crc = crc8->crctab[crc^cf->data[i]]; in cgw_csum_crc8_pos()
302 switch (crc8->profile) { in cgw_csum_crc8_pos()
305 crc = crc8->crctab[crc^crc8->profile_data[0]]; in cgw_csum_crc8_pos()
309 crc = crc8->crctab[crc^crc8->profile_data[cf->data[1] & 0xF]]; in cgw_csum_crc8_pos()
313 crc = crc8->crctab[crc^(cf->can_id & 0xFF)^ in cgw_csum_crc8_pos()
318 cf->data[crc8->result_idx] = crc^crc8->final_xor_val; in cgw_csum_crc8_pos()
321 static void cgw_csum_crc8_neg(struct can_frame *cf, struct cgw_csum_crc8 *crc8) in cgw_csum_crc8_neg() argument
323 u8 crc = crc8->init_crc_val; in cgw_csum_crc8_neg()
326 for (i = crc8->from_idx; i >= crc8->to_idx; i--) in cgw_csum_crc8_neg()
327 crc = crc8->crctab[crc^cf->data[i]]; in cgw_csum_crc8_neg()
329 switch (crc8->profile) { in cgw_csum_crc8_neg()
332 crc = crc8->crctab[crc^crc8->profile_data[0]]; in cgw_csum_crc8_neg()
336 crc = crc8->crctab[crc^crc8->profile_data[cf->data[1] & 0xF]]; in cgw_csum_crc8_neg()
340 crc = crc8->crctab[crc^(cf->can_id & 0xFF)^ in cgw_csum_crc8_neg()
345 cf->data[crc8->result_idx] = crc^crc8->final_xor_val; in cgw_csum_crc8_neg()
422 if (gwj->mod.csumfunc.crc8) in can_can_gw_rcv()
423 (*gwj->mod.csumfunc.crc8)(cf, &gwj->mod.csum.crc8); in can_can_gw_rcv()
551 if (gwj->mod.csumfunc.crc8) { in cgw_put_job()
553 &gwj->mod.csum.crc8) < 0) in cgw_put_job()
725 nla_memcpy(&mod->csum.crc8, tb[CGW_CS_CRC8], in cgw_parse_attr()
734 mod->csumfunc.crc8 = cgw_csum_crc8_rel; in cgw_parse_attr()
736 mod->csumfunc.crc8 = cgw_csum_crc8_pos; in cgw_parse_attr()
738 mod->csumfunc.crc8 = cgw_csum_crc8_neg; in cgw_parse_attr()