]> rtime.felk.cvut.cz Git - arc.git/blob - include/PduR_Types.h
Merge branch 'mikulka' of git@rtime.felk.cvut.cz:arc into mikulka
[arc.git] / include / PduR_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 /** @addtogroup PduR PDU Router\r
17  *  @{ */\r
18 \r
19 /** @file PduR_Types.h\r
20  * Type definitions for PDU Router.\r
21  */\r
22 \r
23 #ifndef PDUR_TYPES_H\r
24 #define PDUR_TYPES_H\r
25 \r
26 #include "ComStack_Types.h"\r
27 \r
28 typedef enum {\r
29         ARC_PDUR_UP_MODULES = 0,\r
30         ARC_PDUR_COM,\r
31         ARC_PDUR_DCM,\r
32 \r
33         ARC_PDUR_LOIF_MODULES,\r
34         ARC_PDUR_CANIF,\r
35         ARC_PDUR_LINIF,\r
36         ARC_PDUR_SOADIF,\r
37 \r
38         ARC_PDUR_LOTP_MODULES,\r
39         ARC_PDUR_CANTP,\r
40         ARC_PDUR_LINTP,\r
41         ARC_PDUR_SOADTP,\r
42         ARC_PDUR_SOAD,\r
43         ARC_PDUR_J1939TP,\r
44 \r
45         ARC_PDUR_END_OF_MODULES\r
46 \r
47 } ARC_PduR_ModuleType;\r
48 \r
49 /** PduR_StateType defines the states of which the PDU router can be in */\r
50 typedef enum {\r
51         PDUR_UNINIT, /**< PDU Router is not initialized. */\r
52         PDUR_ONLINE, /**< PDU Router initialized successfully. */\r
53         PDUR_REDUCED /**< PDU Router initialization did not succeed. Only minimum routing is provided. */\r
54 } PduR_StateType;\r
55 \r
56 typedef enum {\r
57         PDU_CNLDO, /**< Cancel transfer since data is outdated. */\r
58         PDU_CNLNB, /**< Cancel transfer since buffer is full. */\r
59         PDU_CNLOR  /**< Cancel transfer of another reason. */\r
60 } PduR_CancelReasonType;\r
61 \r
62 typedef uint8 PduR_ParameterValueType;\r
63 \r
64 typedef enum {\r
65         PDUR_NO_PROVISION, /**< No data provision. */\r
66         PDUR_TRIGGER_TRANSMIT, /**< Trigger transmit type. */\r
67         PDUR_DIRECT /**< Data provision type. */\r
68 } PduR_DataProvisionType;\r
69 \r
70 /*\r
71 typedef struct {\r
72 \r
73         uint16 BufferId;\r
74         PduR_DataProvisionType BufferType;\r
75         //uint8 SduLength;\r
76         uint8 *Last;\r
77         uint8 *First;\r
78         uint8 NrItems;\r
79         uint8 TxConfP;\r
80         // uint8 TxIdx; // This is the same as First, hence left out.\r
81         uint8 *Buffer;\r
82 \r
83 \r
84         uint8 Depth;\r
85 \r
86         uint8 Length;\r
87 \r
88 } PduRTxBuffer_type;\r
89 */\r
90 typedef uint8 *PduRTxBuffer_type;\r
91 \r
92 typedef enum {\r
93         PDUR_BUFFER_FREE = 0,\r
94         PDUR_BUFFER_RX_BUSY,\r
95         PDUR_BUFFER_TX_READY,\r
96         PDUR_BUFFER_TX_BUSY\r
97 } PduRTpBufferStatus_type;\r
98 \r
99 typedef struct {\r
100         PduInfoType *pduInfoPtr;\r
101         PduRTpBufferStatus_type status;\r
102         const uint16 bufferSize;\r
103 } PduRTpBufferInfo_type;\r
104 \r
105 typedef struct {\r
106 \r
107         /**\r
108          * Data provision mode for this PDU.\r
109          */\r
110         const PduR_DataProvisionType DataProvision;\r
111 \r
112         /**\r
113          * Reference to unique PDU identifier which shall\r
114          * be used by the PDU router instead of the source identifier.\r
115          */\r
116         const uint16 DestPduId;\r
117 \r
118         /**\r
119          * Reference to the assigned Tx buffer.\r
120          *\r
121          * Comment: Only required for non-TP gateway PDUs.\r
122          */\r
123         PduRTxBuffer_type * const TxBufferRef;\r
124 \r
125         const ARC_PduR_ModuleType DestModule;\r
126 \r
127 } PduRDestPdu_type;\r
128 \r
129 typedef struct {\r
130         uint8 ElementBytePosition;\r
131         uint8 DefaultValueElement[];\r
132 } PduRDefaultValueElement_type;\r
133 \r
134 \r
135 typedef struct {\r
136         uint8 PduR_Arc_Dummy; // Needed in order to compile without errors.\r
137         PduRDefaultValueElement_type *PduRDefaultValueElement;\r
138 } PduRDefaultValue_type;\r
139 \r
140 typedef struct {\r
141         /**\r
142          * Length of PDU data.\r
143          *\r
144          * Comment: Only required if a TX buffer is configured.\r
145          */\r
146         const uint16 SduLength;\r
147 \r
148         /**\r
149          * Chunk size for routing on the fly.\r
150          *\r
151          * Comment: Only required for TP gateway PDUs.\r
152          */\r
153         uint16 TpChunkSize;\r
154 \r
155         /**\r
156          * Specifies the default value of the PDU.\r
157          *\r
158          * Comment: Only require for gateway operation.\r
159          */\r
160         PduRDefaultValue_type PduRDefaultValue;\r
161 \r
162         /**\r
163          * Specifies the source ID of the PDU to be routed.\r
164          */\r
165         const uint16 SrcPduId;\r
166 \r
167         /**\r
168          * Specifies the source module for this route.
169          */\r
170         const ARC_PduR_ModuleType SrcModule;\r
171 \r
172         /**\r
173          * Specifies the destination(s) of the PDU to be routed.\r
174          */\r
175         const PduRDestPdu_type * const *PduRDestPdus;\r
176 \r
177 } PduRRoutingPath_type;\r
178 \r
179 typedef struct {\r
180         /**\r
181          * Unique configuration identifier.\r
182          */\r
183         uint8 PduRConfigurationId;\r
184 \r
185         uint8 NRoutingPaths;\r
186 \r
187         /**\r
188          * The routing table of this PDU router configuration.\r
189          */\r
190         const PduRRoutingPath_type * const*RoutingPaths;\r
191 \r
192         PduRTpBufferInfo_type *TpBuffers;\r
193         PduRTpBufferInfo_type **TpRouteBuffers;\r
194 \r
195 } PduR_PBConfigType;\r
196 \r
197 #endif\r
198 /** @} */\r