]> rtime.felk.cvut.cz Git - arc.git/blob - include/J1939Tp_ConfigTypes.h
Merge branch 'mikulka' of git@rtime.felk.cvut.cz:arc into mikulka
[arc.git] / include / J1939Tp_ConfigTypes.h
1 /* -------------------------------- Arctic Core ------------------------------\r
2  * Arctic Core - the open source AUTOSAR platform http://arccore.com\r
3  *\r
4  * Copyright (C) 2009  ArcCore AB <contact@arccore.com>\r
5  *\r
6  * This source code is free software; you can redistribute it and/or modify it\r
7  * under the terms of the GNU General Public License version 2 as published by the\r
8  * Free Software Foundation; See <http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt>.\r
9  *\r
10  * This program is distributed in the hope that it will be useful, but\r
11  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY\r
12  * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License\r
13  * for more details.\r
14  * -------------------------------- Arctic Core ------------------------------*/\r
15 \r
16 \r
17 #ifndef J1939TP_CONFIGTYPES_H_\r
18 #define J1939TP_CONFIGTYPES_H_\r
19 \r
20 #include "ComStack_Types.h"\r
21 \r
22 typedef enum {\r
23         J1939TP_PROTOCOL_BAM,\r
24         J1939TP_PROTOCOL_CMDT\r
25 } J1939Tp_ProtocolType;\r
26 \r
27 typedef enum {\r
28         J1939TP_RX,\r
29         J1939TP_TX\r
30 } J1939Tp_DirectionType;\r
31 \r
32 typedef enum {\r
33         J1939TP_TX_IDLE,\r
34         J1939TP_TX_WAIT_BAM_CANIF_CONFIRM,\r
35         J1939TP_TX_WAIT_RTS_CANIF_CONFIRM,\r
36         J1939TP_TX_WAITING_FOR_CTS,\r
37         J1939TP_TX_WAIT_DT_CANIF_CONFIRM,\r
38         J1939TP_TX_WAIT_DT_BAM_CANIF_CONFIRM,\r
39         J1939TP_TX_WAITING_FOR_BAM_DT_SEND_TIMEOUT,\r
40         J1939TP_TX_WAITING_FOR_END_OF_MSG_ACK\r
41 } J1939Tp_Internal_TxChannelStateType;\r
42 \r
43 typedef enum {\r
44         J1939TP_RX_IDLE,\r
45         J1939TP_RX_WAIT_CTS_CANIF_CONFIRM,\r
46         J1939TP_RX_RECEIVING_DT,\r
47         J1939TP_RX_WAIT_ENDOFMSGACK_CANIF_CONFIRM,\r
48 } J1939Tp_Internal_RxChannelStateType;\r
49 \r
50 typedef struct {\r
51         uint32 Timer;\r
52         uint32 TimerExpire;\r
53 } J1939Tp_Internal_TimerType;\r
54 typedef uint32 J1939Tp_Internal_PgnType;\r
55 typedef uint32 J1939Tp_Internal_DtPayloadSizeType;\r
56 \r
57 \r
58 typedef struct J1939Tp_ChannelType_ J1939Tp_ChannelType;\r
59 typedef struct J1939Tp_PgType_ J1939Tp_PgType;\r
60 typedef uint32 J1939Tp_PgnType;\r
61 \r
62 struct J1939Tp_PgType_ {\r
63         const boolean                                   DynLength;\r
64         const J1939Tp_PgnType                   Pgn;\r
65         const PduIdType                                 DirectNPdu; /** only set when DynLength = true */\r
66         const PduIdType                                 NSdu;\r
67         const J1939Tp_ChannelType*              Channel;\r
68 };\r
69 \r
70 \r
71 struct J1939Tp_ChannelType_ {\r
72         const J1939Tp_ProtocolType                              Protocol;\r
73         const PduIdType                                                 DtNPdu;\r
74         const PduIdType                                                 CmNPdu;\r
75         const PduIdType                                                 FcNPdu; /** only set when Protocol == J1939TP_PROTOCOL_CMDT */\r
76         const J1939Tp_DirectionType                     Direction;\r
77         const uint16                                                    PgCount;\r
78         const J1939Tp_PgType**                                  Pgs;\r
79 } ;\r
80 \r
81 typedef enum {\r
82         J1939TP_REVERSE_CM,\r
83         J1939TP_CM,\r
84         J1939TP_DT,\r
85         J1939TP_DIRECT\r
86 } J1939Tp_RxPduType;\r
87 \r
88 \r
89 typedef struct {\r
90         const J1939Tp_RxPduType         PacketType;\r
91         const uint8                                     ChannelIndex;\r
92         const J1939Tp_PgType* PgPtr;\r
93 } J1939Tp_RxPduInfoType;\r
94 \r
95 typedef struct {\r
96         const J1939Tp_RxPduInfoType** RxPdus;\r
97         const PduIdType RxPduCount;\r
98 } J1939Tp_RxPduInfoRelationsType;\r
99 \r
100 /** @req J1939TP0175 */\r
101 typedef struct {\r
102         const J1939Tp_RxPduInfoRelationsType* RxPduRelations;\r
103         const J1939Tp_ChannelType* Channels;\r
104         const J1939Tp_PgType* Pgs;\r
105 } J1939Tp_ConfigType;\r
106 \r
107 #endif\r