]> rtime.felk.cvut.cz Git - linux-lin.git/blob - lin_config/src/pcl_config.h
70b1b16e4e217b7dd1ddf577943eff237837b334
[linux-lin.git] / lin_config / src / pcl_config.h
1 #ifndef _PCL_CONFIG_H_
2 #define _PCL_CONFIG_H_
3
4 #include <inttypes.h>
5 #include "lin_config.h"
6
7 #define PCL_ACTIVE                              1
8 #define PCL_UNACTIVE                            0
9
10 #define PCL_PKT_MAX_SIZE                        16
11 #define PCL_HEADERS_SIZE                        2 /* There are 2 bytes of headers */
12 #define PCL_CHECKSUM_SIZE                       1
13 #define PCL_STX_SIZE                            1
14 #define PCL_PACKET_OVERHEAD                     (PCL_HEADERS_SIZE + PCL_CHECKSUM_SIZE)
15
16 #define PCL_STX                                 0x2
17
18 #define PCL_SEQ_NO_ofs                          4
19 #define PCL_SEQ_FRLEN_ofs                       0
20 #define PCL_CTRL_TIFACE_ofs                     6
21 #define PCL_CTRL_COMC_ofs                       0
22
23 #define PCL_SEQ_FRLEN_msk                       0xF
24
25 #define PCL_PACKET_LIN_IFACE                    0x2
26 #define PCL_PACKET_MODULE_IFACE                 0x3
27
28 /* Logical representation of a packet sent to PCAN-LIN converter via RS232 */
29 typedef struct {
30         uint8_t stx;        /* Start transmission; Always set to 0x2 */
31         uint8_t seq_no;     /* Sequence number */
32         uint8_t seq_frlen;  /* Frame length */
33         uint8_t ctrl_tiface;/* Target interface */
34         uint8_t ctrl_comc;  /* Command code */
35         uint8_t parms[8];   /* Parameters; Number of parameters depends
36                                 on the frame length */
37         uint8_t chks;       /* Checksum; Bitwise XOR of all bytes except STX */
38 } pcl_packet_t;
39
40 int pcl_config(struct linc_lin_state *linc_lin_state);
41
42 #endif /* _PCL_CONFIG_H_ */