forked from jiangjie87481/mcu_uds_protol
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathuds_support.h
126 lines (112 loc) · 3.06 KB
/
uds_support.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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
/***************************************************************************//**
\file uds-support.h
\author
\mail
\version 0
\date 2016-10-08
\description
*******************************************************************************/
#ifndef __UDS_SUPPORT_H_
#define __UDS_SUPPORT_H_
/*******************************************************************************
Include Files
*******************************************************************************/
#include <stdint.h>
#include "uds_type.h"
/*******************************************************************************
Type Definition
*******************************************************************************/
/* uds read/write data read-write mode */
typedef enum __UDS_RWDATA_RW__
{
UDS_RWDATA_RDONLY = 0,
UDS_RWDATA_RDWR,
UDS_RWDATA_RDWR_WRONCE,
UDS_RWDATA_RDWR_INBOOT
}uds_rwdata_rw;
/* uds read/write data read-write mode */
typedef enum __UDS_RWDATA_TYPE__
{
UDS_RWDATA_HEX = 0,
UDS_RWDATA_ASCII,
UDS_RWDATA_BCD
}uds_rwdata_type;
/* uds read/write data read-write mode */
typedef enum __UDS_RWDATA_STORE__
{
UDS_RWDATA_RAM = 0,
UDS_RWDATA_DFLASH,
UDS_RWDATA_EEPROM
}uds_rwdata_store;
/* uds read/write data typedef */
typedef struct __UDS_RWDATA_T__
{
uint16_t did; /* 0100 - EFFF and F010 - F0FF for vehicleManufacturerSpecific */
uint8_t *p_data;
uint8_t dlc;
uds_rwdata_rw rw_mode;
uds_rwdata_store rw_store;
}uds_rwdata_t;
/* uds io control type */
typedef struct __UDS_IOCTRL_T__
{
uint16_t did;
uint8_t *p_data;
uint8_t dlc;
uint8_t default_value;
uint8_t step;
bool_t enable;
void (* init_ioctrl) (void);
void (* stop_ioctrl) (void);
}uds_ioctrl_t;
/* uds routine control status */
typedef enum __UDS_ROUTINE_STATUS__
{
UDS_RT_ST_IDLE = 0,
UDS_RT_ST_RUNNING = 0x01,
UDS_RT_ST_SUCCESS = 0x02,
UDS_RT_ST_FAILED = 0x03
}uds_routine_status;
/* uds routine control */
typedef struct __UDS_RTCTROL_T__
{
uint16_t rid;
uds_routine_status rtst;
uint8_t (* init_routine) (void);
uint8_t (* run_routine) (void);
uint8_t (* stop_routine) (void);
}uds_rtctrl_t;
#define RWDATA_CNT 11
#define IOCTRL_CNT 5
#define RTCTRL_CNT 1
extern const uds_rwdata_t rwdata_list[RWDATA_CNT];
extern uds_ioctrl_t ioctrl_list[IOCTRL_CNT];
extern const uds_rtctrl_t rtctrl_list[RTCTRL_CNT];
#define RWDATA_NUM (sizeof(rwdata_list) / sizeof(uds_rwdata_t))
#define IOCTRL_NUM (sizeof(ioctrl_list) / sizeof(uds_ioctrl_t))
#define RTCTRL_NUM (sizeof(rtctrl_list) / sizeof(uds_rtctrl_t))
/*******************************************************************************
Function Definition
*******************************************************************************/
/**
* uds_ioctrl_allstop - main handle of io control
*
* @void :
*
* returns:
* void
*/
void
uds_ioctrl_allstop (void);
/**
* uds_load_rwdata - load read / write data from eeprom to ram
*
* @void :
*
* returns:
* void
*/
void
uds_load_rwdata (void);
#endif
/****************EOF****************/