X-Git-Url: http://rtime.felk.cvut.cz/gitweb/linux-lin.git/blobdiff_plain/f26efeb44ceb061f34a1977abca05fc84b658b70..27e6d6f028fb37070fcfbed9c6b68f2161740bfb:/lin_config/src/pcl_config.h diff --git a/lin_config/src/pcl_config.h b/lin_config/src/pcl_config.h new file mode 100644 index 0000000..0b8deee --- /dev/null +++ b/lin_config/src/pcl_config.h @@ -0,0 +1,42 @@ +#ifndef _PCL_CONFIG_H_ +#define _PCL_CONFIG_H_ + +#include +#include "lin_config.h" + +#define PCL_ACTIVE 1 +#define PCL_UNACTIVE 0 + +#define PCL_PKT_MAX_SIZE 16 +#define PCL_HEADERS_SIZE 2 /* There are 2 bytes of headers */ +#define PCL_CHECKSUM_SIZE 1 +#define PCL_STX_SIZE 1 +#define PCL_PACKET_OVERHEAD (PCL_HEADERS_SIZE + PCL_CHECKSUM_SIZE) + +#define PCL_STX 0x2 + +#define PCL_SEQ_NO_ofs 4 +#define PCL_SEQ_FRLEN_ofs 0 +#define PCL_CTRL_TIFACE_ofs 6 +#define PCL_CTRL_COMC_ofs 0 + +#define PCL_SEQ_FRLEN_msk 0xF + +#define PCL_PACKET_LIN_IFACE 0x2 +#define PCL_PACKET_MODULE_IFACE 0x3 + +/* Logical representation of a packet sent to PCAN-LIN converter via RS232 */ +typedef struct { + uint8_t stx; /* Start transmission; Always set to 0x2 */ + uint8_t seq_no; /* Sequence number */ + uint8_t seq_frlen; /* Frame length */ + uint8_t ctrl_tiface;/* Target interface */ + uint8_t ctrl_comc; /* Command code */ + uint8_t parms[8]; /* Parameters; Number of parameters depends + on the frame length */ + uint8_t chks; /* Checksum; Bitwise XOR of all bytes except STX */ +} pcl_packet_t; + +int pcl_config(struct linc_lin_state *linc_lin_state, unsigned int flags); + +#endif /* _PCL_CONFIG_H_ */