-
Notifications
You must be signed in to change notification settings - Fork 33
/
open_lin_types.h
65 lines (51 loc) · 1.54 KB
/
open_lin_types.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
/**
* @file open_lin_types.h
* @brief LIN slave data layer implementation
*/
#ifndef OPEN_LIN_OPEN_LIN_TYPES_H_
#define OPEN_LIN_OPEN_LIN_TYPES_H_
#include "open_lin_cfg.h"
#include <string.h>
#include <stdbool.h>
#define OPEN_LIN_MAX_FRAME_LEN 8u
#define OPEN_LIN_MAX_FRAME_CHECK_SUM_SIZE 1u
typedef bool l_bool;
typedef uint8_t l_u8 ;
typedef uint16_t l_u16;
#define l_true true
#define l_false false
#define OPEN_LIN_MAX_FRAME_LENGTH 0x8u
#define OPEN_LIN_SYNCH_BYTE 0x55u
#define OPEN_LIN_GET_PID_BIT(x,y) (((x) >> (y)) & 0x01u)
#define OPEN_LIN_ID_MASK 0x3Fu
#define OPEN_LIN_P0_FLAG 6
#define OPEN_LIN_P1_FLAG 7
#define OPEN_LIN_DIAG_REQUEST 0x3C
#define OPEN_LIN_DIAG_RESPONSE 0x3D
#define open_lin_memcpy memcpy
typedef l_u8 open_lin_pid_t;
typedef l_u8 open_lin_checksum_t;
typedef enum {
OPEN_LIN_FRAME_TYPE_TRANSMIT,
OPEN_LIN_FRAME_TYPE_RECEIVE
} open_lin_frame_type_t;
typedef enum {
OPEN_LIN_NO_ERROR,
OPEN_LIN_SLAVE_ERROR_INVALID_DATA_RX,
OPEN_LIN_SLAVE_ERROR_INVALID_CHECKSUM,
OPEN_LIN_SLAVE_ERROR_PID_PARITY,
OPEN_LIN_SLAVE_ERROR_INVALID_SYNCH,
OPEN_LIN_SLAVE_ERROR_INVALID_BREAK,
OPEN_LIN_SLAVE_ERROR_ID_NOT_FOUND,
OPEN_LIN_SLAVE_ERROR_HW_TX,
OPEN_LIN_MASTER_ERROR_CHECKSUM,
OPEN_LIN_MASTER_ERROR_HEADER_TX,
OPEN_LIN_MASTER_ERROR_DATA_TX,
OPEN_LIN_MASTER_ERROR_DATA_RX,
OPEN_LIN_MASTER_ERROR_DATA_RX_TIMEOUT
} t_open_lin_error;
/**
* @brief error handler function
*/
void open_lin_error_handler(t_open_lin_error error_code);
#endif /* OPEN_LIN_OPEN_LIN_TYPES_H_ */