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