Lines Matching refs:crc8

107 		struct cgw_csum_crc8 crc8;  member
111 void (*crc8)(struct can_frame *cf, struct cgw_csum_crc8 *crc8); member
256 static void cgw_csum_crc8_rel(struct can_frame *cf, struct cgw_csum_crc8 *crc8) in cgw_csum_crc8_rel() argument
258 int from = calc_idx(crc8->from_idx, cf->can_dlc); in cgw_csum_crc8_rel()
259 int to = calc_idx(crc8->to_idx, cf->can_dlc); in cgw_csum_crc8_rel()
260 int res = calc_idx(crc8->result_idx, cf->can_dlc); in cgw_csum_crc8_rel()
261 u8 crc = crc8->init_crc_val; in cgw_csum_crc8_rel()
268 for (i = crc8->from_idx; i <= crc8->to_idx; i++) in cgw_csum_crc8_rel()
269 crc = crc8->crctab[crc^cf->data[i]]; in cgw_csum_crc8_rel()
271 for (i = crc8->from_idx; i >= crc8->to_idx; i--) in cgw_csum_crc8_rel()
272 crc = crc8->crctab[crc^cf->data[i]]; in cgw_csum_crc8_rel()
275 switch (crc8->profile) { in cgw_csum_crc8_rel()
278 crc = crc8->crctab[crc^crc8->profile_data[0]]; in cgw_csum_crc8_rel()
282 crc = crc8->crctab[crc^crc8->profile_data[cf->data[1] & 0xF]]; in cgw_csum_crc8_rel()
286 crc = crc8->crctab[crc^(cf->can_id & 0xFF)^ in cgw_csum_crc8_rel()
292 cf->data[crc8->result_idx] = crc^crc8->final_xor_val; in cgw_csum_crc8_rel()
295 static void cgw_csum_crc8_pos(struct can_frame *cf, struct cgw_csum_crc8 *crc8) in cgw_csum_crc8_pos() argument
297 u8 crc = crc8->init_crc_val; in cgw_csum_crc8_pos()
300 for (i = crc8->from_idx; i <= crc8->to_idx; i++) in cgw_csum_crc8_pos()
301 crc = crc8->crctab[crc^cf->data[i]]; in cgw_csum_crc8_pos()
303 switch (crc8->profile) { in cgw_csum_crc8_pos()
306 crc = crc8->crctab[crc^crc8->profile_data[0]]; in cgw_csum_crc8_pos()
310 crc = crc8->crctab[crc^crc8->profile_data[cf->data[1] & 0xF]]; in cgw_csum_crc8_pos()
314 crc = crc8->crctab[crc^(cf->can_id & 0xFF)^ in cgw_csum_crc8_pos()
319 cf->data[crc8->result_idx] = crc^crc8->final_xor_val; in cgw_csum_crc8_pos()
322 static void cgw_csum_crc8_neg(struct can_frame *cf, struct cgw_csum_crc8 *crc8) in cgw_csum_crc8_neg() argument
324 u8 crc = crc8->init_crc_val; in cgw_csum_crc8_neg()
327 for (i = crc8->from_idx; i >= crc8->to_idx; i--) in cgw_csum_crc8_neg()
328 crc = crc8->crctab[crc^cf->data[i]]; in cgw_csum_crc8_neg()
330 switch (crc8->profile) { in cgw_csum_crc8_neg()
333 crc = crc8->crctab[crc^crc8->profile_data[0]]; in cgw_csum_crc8_neg()
337 crc = crc8->crctab[crc^crc8->profile_data[cf->data[1] & 0xF]]; in cgw_csum_crc8_neg()
341 crc = crc8->crctab[crc^(cf->can_id & 0xFF)^ in cgw_csum_crc8_neg()
346 cf->data[crc8->result_idx] = crc^crc8->final_xor_val; in cgw_csum_crc8_neg()
423 if (gwj->mod.csumfunc.crc8) in can_can_gw_rcv()
424 (*gwj->mod.csumfunc.crc8)(cf, &gwj->mod.csum.crc8); in can_can_gw_rcv()
557 if (gwj->mod.csumfunc.crc8) { in cgw_put_job()
559 &gwj->mod.csum.crc8) < 0) in cgw_put_job()
732 nla_memcpy(&mod->csum.crc8, tb[CGW_CS_CRC8], in cgw_parse_attr()
741 mod->csumfunc.crc8 = cgw_csum_crc8_rel; in cgw_parse_attr()
743 mod->csumfunc.crc8 = cgw_csum_crc8_pos; in cgw_parse_attr()
745 mod->csumfunc.crc8 = cgw_csum_crc8_neg; in cgw_parse_attr()