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