]> rtime.felk.cvut.cz Git - arc.git/blob - include/CanTp_Types.h
Merge with other default
[arc.git] / include / CanTp_Types.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  *  General requirements\r
18  */\r
19 /** @req CANTP160 */\r
20 \r
21 /*\r
22  * Definitions generated by tools
23  */\r
24 /** @req CANTP239 */\r
25 /** @req CANTP242 */\r
26 \r
27 #ifndef CANTP_TYPES_H_\r
28 #define CANTP_TYPES_H_\r
29 \r
30 #include "Platform_Types.h"\r
31 #include "ComStack_Types.h"\r
32 \r
33 // - - - - - - - - - - -\r
34 \r
35 typedef enum {\r
36         CANTP_NOT_LAST_ENTRY, CANTP_END_OF_LIST\r
37 } CanTp_ListItemType;\r
38 \r
39 \r
40 typedef enum {\r
41         CANTP_EXTENDED, CANTP_STANDARD\r
42 } CanTp_AddressingFormantType;\r
43 \r
44 typedef enum {\r
45         CANTP_OFF, CANTP_ON\r
46 } CanTp_StateType;\r
47 \r
48 typedef enum {\r
49         CANTP_RX_WAIT,\r
50         CANTP_RX_PROCESSING,\r
51         CANTP_TX_WAIT,\r
52         CANTP_TX_PROCESSING\r
53 } CanTp_TransferInstanceMode;\r
54 \r
55 \r
56 typedef enum {\r
57         CANTP_FUNCTIONAL, CANTP_PHYSICAL\r
58 } CanTp_TaTypeType;\r
59 \r
60 \r
61 typedef struct {\r
62         uint32 CanTpNSa; /** @req CANTP254 */\r
63 } CanTp_NSaType; /** @req CANTP253 */\r
64 \r
65 typedef struct {\r
66         uint32 CanTpNTa; /** @req CANTP255 */\r
67 } CanTp_NTaType; /** @req CANTP139 */\r
68 \r
69 typedef struct {\r
70         const uint32 CanTpRxNPduId; /** @req CANTP258 */\r
71         const uint32 CanTpRxNPduRef; /** @req CANTP257 */\r
72 } CanTp_RxNPduType; /** @req CANTP256 */\r
73 \r
74 typedef struct {\r
75         const uint32 CanTpTxNPduId; /* TODO: Remove this? */\r
76         const uint32 CanTpTxNPduRef; /** @req CANTP275 */\r
77 } CanTp_TxNPduType; /** @req CANTP274 */\r
78 \r
79 typedef struct {\r
80         const uint32 CanTpTxFcNPduRef; /** @req CANTP260 */ /* Reference to a PDU in the COM stack. */\r
81 } CanTp_TxFcNPduType; /** @req CANTP259 */\r
82 \r
83 typedef struct {\r
84         const uint32 CanTpRxFcNPduRef; /** @req CANTP272 */ /* Reference to a PDU in the COM stack. */\r
85         const uint32 CanTpRxFcNPduId; /** @req CANTP273 */\r
86 } CanTp_RxFcNPduType; /** @req CANTP271 */\r
87 \r
88 \r
89 typedef struct {\r
90         const int CanIf_FcPduId; // The polite CanIf PDU index.\r
91         const int PduR_PduId; // The polite PduR index.\r
92         const CanTp_AddressingFormantType CanTpAddressingFormant;       /** @req CANTP242 */\r
93         const uint8 CanTpBs; /** @req CANTP243 */ /* Sets the maximum number of messages of N-PDUs before flow control. */\r
94         const uint16 CanTpNar; /** @req CANTP244 */ /* Timeout for transmission of a CAN frame (ms). */\r
95         const uint16 CanTpNbr; /** @req CANTP245 */\r
96         const uint16 CanTpNcr; /** @req CANTP246 */ /* Time out for consecutive frames (ms). */\r
97         const uint8 CanTpRxChannel; /** @req CANTP247 */ /* Connection to runtime variable index, see CanTp 266. */\r
98         const uint16 CanTpRxDI; /** @req CANTP248 */ /* Data length code for of this RxNsdu. */\r
99         CanTp_StateType CanTpRxPaddingActivation; /** @req CANTP249 */ /* Enable use of padding. */\r
100         CanTp_TaTypeType CanTpRxTaType; /** @req CANTP250 */ /* Functional or physical addressing. */\r
101         const uint8 CanTpWftMax; /** @req CANTP251 */ /* Max number FC wait that can be transmitted consecutively. */\r
102         const uint16 CanTpSTmin; /** @req CANTP252 */ /* Minimum time the sender shall wait between transmissions of two N-PDU. */\r
103         /*const uint32                                                  CanTpNSduRef ** req: CanTp241. This is PDU id - typeless enum. */\r
104         const CanTp_NSaType *CanTpNSa;\r
105         const CanTp_NTaType *CanTpNTa;\r
106         //CanTp_RxNPduType *CanTpRxNPdu;\r
107         //CanTp_TxFcNPduType *CanTpTxFcNPdu;\r
108         //const PduIdType CanTpRxPduId;\r
109 \r
110 } CanTp_RxNSduType; /** @req CANTP137 */\r
111 \r
112 typedef struct {\r
113         const int CanIf_PduId; // The polite CanIf index.\r
114         const int PduR_PduId; // The polite PduR index.\r
115         const CanTp_AddressingFormantType CanTpAddressingMode; /** @req CANTP262 */\r
116         const uint16 CanTpNas; /** @req CANTP263 */ /* N_As timeout for transmission of any CAN frame. */\r
117         const uint16 CanTpNbs; /** @req CANTP264 */ /* N_Bs timeout of transmission until reception of next Flow Control. */\r
118         const uint16 CanTpNcs; /** @req CANTP265 */ /* N_Bs timeout of transmission until reception of next Flow Control. */\r
119         const uint8     CanTpTxChannel; /** @req CANTP266 */ /* Link to the TX connection channel (why?). */\r
120         const uint16 CanTpTxDI; /** @req CANTP267 */ /* Data length code for of this TxNsdu. */\r
121         /*const uint32                                          CanTpTxNSduId; / ** req: CanTp268: Data length code for of this TxNsdu. */\r
122         CanTp_StateType CanTpTxPaddingActivation; /** @req CANTP269 */ /* Enable use of padding. */\r
123         CanTp_TaTypeType CanTpTxTaType; /** @req CANTP270 */ /* Functional or physical addressing. */\r
124         /*const uint32                                          CanTpNSduRef ** req: CanTp261. This is PDU id - typeless enum. */\r
125         const CanTp_NSaType *CanTpNSa;\r
126         const CanTp_NTaType *CanTpNTa;\r
127         //CanTp_RxFcNPduType *CanTpRxFcNPdu;\r
128         //CanTp_TxNPduType *CanTpTxNPdu;\r
129         //PduIdType CanTpTxPduId;\r
130 \r
131 } CanTp_TxNSduType; /** @req CANTP138 */\r
132 \r
133 // - - - - - - - - - - -\r
134 \r
135 typedef struct {\r
136         uint32 main_function_period; /** @req CANTP240 */\r
137 } CanTp_GeneralType; /** @req CANTP238 */\r
138 \r
139 // - - - - - - - - - - -\r
140 \r
141 typedef enum {\r
142         IS015765_TRANSMIT, ISO15765_RECEIVE\r
143 } CanTp_DirectionType;\r
144 \r
145 \r
146 // - - - - - - - - - - -\r
147 \r
148 typedef struct {\r
149         const CanTp_DirectionType direction;\r
150         const CanTp_ListItemType listItemType;\r
151         union {\r
152                 const CanTp_RxNSduType  CanTpRxNSdu;\r
153                 const CanTp_TxNSduType  CanTpTxNSdu;\r
154         } configData;\r
155 } CanTp_NSduType;\r
156 \r
157 // - - - - - - - - - - -\r
158 \r
159 /** Top level config container for CANTP implementation. */\r
160 typedef struct {\r
161         /** General configuration paramters for the CANTP module. */\r
162         const CanTp_GeneralType *CanTpGeneral; // 10.2.3\r
163 \r
164         /** */\r
165         const CanTp_NSduType *CanTpNSduList;\r
166 \r
167         /**  */\r
168         //const CanTp_RxNSduType        *CanTpRxNSduList;\r
169 \r
170         /** This container contains the init parameters of the CAN Interface. */\r
171         //const CanTp_TxNSduType        *CanTpTxNSduList;\r
172 \r
173 } CanTp_ConfigType;\r
174 \r
175 #endif /* CANTP_TYPES_H_ */\r