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