2 #include "lin_common.h"
4 const unsigned char sllin_id_parity_table[64] = {
5 0x80,0xc0,0x40,0x00,0xc0,0x80,0x00,0x40,
6 0x00,0x40,0xc0,0x80,0x40,0x00,0x80,0xc0,
7 0x40,0x00,0x80,0xc0,0x00,0x40,0xc0,0x80,
8 0xc0,0x80,0x00,0x40,0x80,0xc0,0x40,0x00,
9 0x00,0x40,0xc0,0x80,0x40,0x00,0x80,0xc0,
10 0x80,0xc0,0x40,0x00,0xc0,0x80,0x00,0x40,
11 0xc0,0x80,0x00,0x40,0x80,0xc0,0x40,0x00,
12 0x40,0x00,0x80,0xc0,0x00,0x40,0xc0,0x80
16 int sllin_setup_msg(struct sllin *sl, int mode, int id,
17 unsigned char *data, int len)
26 sl->tx_buff[SLLIN_BUFF_BREAK] = 0;
27 sl->tx_buff[SLLIN_BUFF_SYNC] = 0x55;
28 sl->tx_buff[SLLIN_BUFF_ID] = id | sllin_id_parity_table[id];
29 sl->tx_lim = SLLIN_BUFF_DATA;
31 if ((data != NULL) && len) {
36 memcpy(sl->tx_buff + SLLIN_BUFF_DATA, data, len);
37 /* compute data parity there */
38 for (i = SLLIN_BUFF_DATA; i < sl->tx_lim; i++) {
39 csum += sl->tx_buff[i];
44 sl->tx_buff[sl->tx_lim++] = csum;
47 sl->rx_lim += len + 1;