]> rtime.felk.cvut.cz Git - arc.git/blob - include/PduR_Types.h
Changes to comply with new PduR generators. Updated buffer handling.
[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         const uint16 bufferSize;\r
102 } PduRTpBufferInfo_type;\r
103 \r
104 typedef struct {\r
105 \r
106         /**\r
107          * Data provision mode for this PDU.\r
108          */\r
109         const PduR_DataProvisionType DataProvision;\r
110 \r
111         /**\r
112          * Reference to unique PDU identifier which shall\r
113          * be used by the PDU router instead of the source identifier.\r
114          */\r
115         const uint16 DestPduId;\r
116 \r
117         /**\r
118          * Reference to the assigned Tx buffer.\r
119          *\r
120          * Comment: Only required for non-TP gateway PDUs.\r
121          */\r
122         PduRTxBuffer_type * const TxBufferRef;\r
123 \r
124         const ARC_PduR_ModuleType DestModule;\r
125 \r
126 } PduRDestPdu_type;\r
127 \r
128 typedef struct {\r
129         uint8 ElementBytePosition;\r
130         uint8 DefaultValueElement[];\r
131 } PduRDefaultValueElement_type;\r
132 \r
133 \r
134 typedef struct {\r
135         uint8 PduR_Arc_Dummy; // Needed in order to compile without errors.\r
136         PduRDefaultValueElement_type *PduRDefaultValueElement;\r
137 } PduRDefaultValue_type;\r
138 \r
139 typedef struct {\r
140         /**\r
141          * Length of PDU data.\r
142          *\r
143          * Comment: Only required if a TX buffer is configured.\r
144          */\r
145         const uint16 SduLength;\r
146 \r
147         /**\r
148          * Chunk size for routing on the fly.\r
149          *\r
150          * Comment: Only required for TP gateway PDUs.\r
151          */\r
152         uint16 TpChunkSize;\r
153 \r
154         /**\r
155          * Specifies the default value of the PDU.\r
156          *\r
157          * Comment: Only require for gateway operation.\r
158          */\r
159         PduRDefaultValue_type PduRDefaultValue;\r
160 \r
161         /**\r
162          * Specifies the source ID of the PDU to be routed.\r
163          */\r
164         const uint16 SrcPduId;\r
165 \r
166         /**\r
167          * Specifies the source module for this route.
168          */\r
169         const ARC_PduR_ModuleType SrcModule;\r
170 \r
171         /**\r
172          * Specifies the destination(s) of the PDU to be routed.\r
173          */\r
174         const PduRDestPdu_type * const *PduRDestPdus;\r
175 \r
176 } PduRRoutingPath_type;\r
177 \r
178 typedef struct {\r
179         /**\r
180          * Unique configuration identifier.\r
181          */\r
182         uint8 PduRConfigurationId;\r
183 \r
184         uint8 NRoutingPaths;\r
185 \r
186         /**\r
187          * The routing table of this PDU router configuration.\r
188          */\r
189         const PduRRoutingPath_type * const*RoutingPaths;\r
190 \r
191         PduRTpBufferInfo_type *TpBuffers;\r
192         PduRTpBufferInfo_type **TpRouteBuffers;\r
193 \r
194 } PduR_PBConfigType;\r
195 \r
196 #endif\r
197 /** @} */\r