]> rtime.felk.cvut.cz Git - arc.git/blob - include/CanTp_Types.h
Added support for STmin and improved readability and requirement tags. Added requirem...
[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 /** @req CANTP160 */\r
17 \r
18 #ifndef CANTP_TYPES_H_\r
19 #define CANTP_TYPES_H_\r
20 \r
21 #include "Platform_Types.h"\r
22 #include "ComStack_Types.h"\r
23 \r
24 // - - - - - - - - - - -\r
25 \r
26 typedef enum {\r
27         CANTP_NOT_LAST_ENTRY, CANTP_END_OF_LIST\r
28 } CanTp_ListItemType;\r
29 \r
30 \r
31 typedef enum {\r
32         CANTP_EXTENDED, CANTP_STANDARD\r
33 } CanTp_AddressingFormantType;\r
34 \r
35 typedef enum {\r
36         CANTP_OFF, CANTP_ON\r
37 } CanTp_StateType;\r
38 \r
39 typedef enum {  /* req: CanTp030 */\r
40         CANTP_RX_WAIT,\r
41         CANTP_RX_PROCESSING,\r
42         CANTP_TX_WAIT,\r
43         CANTP_TX_PROCESSING\r
44 } CanTp_TransferInstanceMode;\r
45 \r
46 \r
47 typedef enum {\r
48         CANTP_FUNCTIONAL, CANTP_PHYSICAL\r
49 } CanTp_TaTypeType;\r
50 \r
51 \r
52 typedef struct {\r
53         uint32 CanTpNSa; /** req: CanTp254 */\r
54 } CanTp_NSaType; /** req: CanTp256: .. */\r
55 \r
56 typedef struct {\r
57         uint32 CanTpNTa; /** req: CanTp255 */\r
58 } CanTp_NTaType;\r
59 \r
60 typedef struct {\r
61         const uint32 CanTpRxNPduId; /** req: CanTp258: */\r
62         const uint32 CanTpRxNPduRef; /** req: CanTp257: */\r
63 } CanTp_RxNPduType;\r
64 \r
65 typedef struct {\r
66         const uint32 CanTpTxNPduId; /** req: CanTp258: */\r
67         const uint32 CanTpTxNPduRef; /** req: CanTp257: */\r
68 } CanTp_TxNPduType;\r
69 \r
70 typedef struct {\r
71         const uint32 CanTpTxFcNPduRef; /** req: CanTp259: Reference to a PDU in the COM stack. */\r
72 } CanTp_TxFcNPduType;\r
73 \r
74 typedef struct {\r
75         const uint32 CanTpRxFcNPduRef; /** req: CanTp259: Reference to a PDU in the COM stack. */\r
76         const uint32 CanTpRxFcNPduId; /** req: CanTp274: */\r
77 } CanTp_RxFcNPduType;\r
78 \r
79 \r
80 typedef struct {\r
81         const int CanIf_FcPduId; // The polite CanIf PDU index.\r
82         const int PduR_PduId; // The polite PduR index.\r
83         const CanTp_AddressingFormantType CanTpAddressingFormant;\r
84         const uint32 CanTpBs; /** req: CanTp243: Sets the maximum number of messages of N-PDUs before flow control. */\r
85         const uint32 CanTpNar; /** req: CanTp244: Timeout for transmission of a CAN frame (ms). */\r
86         const uint32 CanTpNbr; /** req: CanTp245: ?? */\r
87         const uint32 CanTpNcr; /** req: CanTp246: Time out for consecutive frames (ms). */\r
88         const uint8 CanTpRxChannel; /* Connection to runtime variable index, see CanTp 266. */\r
89         const uint32 CanTpRxDI; /** req: CanTp248: Data length code for of this RxNsdu. */\r
90         CanTp_StateType CanTpRxPaddingActivation; /** req: CanTp249: Enable use of padding. */\r
91         CanTp_TaTypeType CanTpRxTaType; /** req: CanTp250: Functional or physical addressing. */\r
92         const uint8 CanTpWftMax; /** req: CanTp251: Max number FC wait that can be transmitted consecutively. */\r
93         const uint32 CanTpSTmin; /** req: CanTp252: Minimum time the sender shall wait between transmissions of two N-PDU. */\r
94         /*const uint32                                                  CanTpNSduRef ** req: CanTp241. This is PDU id - typeless enum. */\r
95         const CanTp_NSaType *CanTpNSa;\r
96         const CanTp_NTaType *CanTpNTa;\r
97         //CanTp_RxNPduType *CanTpRxNPdu;\r
98         //CanTp_TxFcNPduType *CanTpTxFcNPdu;\r
99         //const PduIdType CanTpRxPduId;\r
100 \r
101 } CanTp_RxNSduType;\r
102 \r
103 typedef struct {\r
104         const int CanIf_PduId; // The polite CanIf index.\r
105         const int PduR_PduId; // The polite PduR index.\r
106         const CanTp_AddressingFormantType CanTpAddressingMode; /** req: CanTp138: */\r
107         const uint8 CanTpNas; /** req: CanTp263: N_As timeout for transmission of any CAN frame. */\r
108         const uint8 CanTpNbs; /** req: CanTp264: N_Bs timeout of transmission until reception of next Flow Control. */\r
109         const uint8 CanTpNcs; /** req: CanTp265: N_Bs timeout of transmission until reception of next Flow Control. */\r
110         const uint8     CanTpTxChannel; /** req: CanTp266: Link to the TX connection channel (why?). */\r
111         const uint32 CanTpTxDI; /** req: CanTp267: Data length code for of this TxNsdu. */\r
112         /*const uint32                                          CanTpTxNSduId; / ** req: CanTp268: Data length code for of this TxNsdu. */\r
113         CanTp_StateType CanTpTxPaddingActivation; /** req: CanTp249: Enable use of padding. */\r
114         CanTp_TaTypeType CanTpTxTaType; /** req: CanTp270: Functional or physical addressing. */\r
115         /*const uint32                                          CanTpNSduRef ** req: CanTp261. This is PDU id - typeless enum. */\r
116         const CanTp_NSaType *CanTpNSa;\r
117         const CanTp_NTaType *CanTpNTa;\r
118         //CanTp_RxFcNPduType *CanTpRxFcNPdu;\r
119         //CanTp_TxNPduType *CanTpTxNPdu;\r
120         //PduIdType CanTpTxPduId;\r
121 \r
122 } CanTp_TxNSduType; /** req: CanTp138: */\r
123 \r
124 // - - - - - - - - - - -\r
125 \r
126 // These constants needs to move later.\r
127 #define CANTP_DEV_ERROR_DETECT                                  STD_ON  /** req: CanTp239, development error detection on/off. */\r
128 #define CANTP_MAIN_FUNCTION_PERIOD                              0.1250  /** req: CanTp240, allow to configure time for MainFunction. */\r
129 #define CANTP_TC                                                                STD_ON  /** req: CanTp242, enabling transmit Cancellation. */\r
130 \r
131 typedef struct {\r
132         uint32 main_function_period; /** req: CanTp240: ?? */\r
133 } CanTp_GeneralType;\r
134 \r
135 // - - - - - - - - - - -\r
136 \r
137 typedef enum {\r
138         IS015765_TRANSMIT, ISO15765_RECEIVE\r
139 } CanTp_DirectionType;\r
140 \r
141 \r
142 // - - - - - - - - - - -\r
143 \r
144 typedef struct {\r
145         const CanTp_DirectionType direction;\r
146         const CanTp_ListItemType listItemType;\r
147         union {\r
148                 const CanTp_RxNSduType  CanTpRxNSdu;\r
149                 const CanTp_TxNSduType  CanTpTxNSdu;\r
150         } configData;\r
151 } CanTp_NSduType;\r
152 \r
153 // - - - - - - - - - - -\r
154 \r
155 /** Top level config container for CANTP implementation. */\r
156 typedef struct {\r
157         /** General configuration paramters for the CANTP module. */\r
158         const CanTp_GeneralType *CanTpGeneral; // 10.2.3\r
159 \r
160         /** */\r
161         const CanTp_NSduType *CanTpNSduList;\r
162 \r
163         /**  */\r
164         //const CanTp_RxNSduType        *CanTpRxNSduList;\r
165 \r
166         /** This container contains the init parameters of the CAN Interface. */\r
167         //const CanTp_TxNSduType        *CanTpTxNSduList;\r
168 \r
169 } CanTp_ConfigType;\r
170 \r
171 #endif /* CANTP_TYPES_H_ */\r