1 /* -------------------------------- Arctic Core ------------------------------
2 * Arctic Core - the open source AUTOSAR platform http://arccore.com
4 * Copyright (C) 2009 ArcCore AB <contact@arccore.com>
6 * This source code is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License version 2 as published by the
8 * Free Software Foundation; See <http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt>.
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * -------------------------------- Arctic Core ------------------------------*/
18 /** @addtogroup Com COM module
22 * Definitions of configuration types and parameters for the COM module.
27 #ifndef COM_TYPES_H_
\r
31 #include "ComStack_Types.h"
\r
33 typedef uint8 Com_PduGroupIdType;
\r
34 typedef uint16 Com_SignalIdType;
\r
35 typedef uint8 Com_SignalGroupIdType;
\r
40 } Com_IPduSignalProcessingMode;
\r
45 } Com_IPduDirection;
\r
58 #define COM_SIGNALTYPE_UNSIGNED FALSE
59 #define COM_SIGNALTYPE_SIGNED TRUE
\r
64 } ComTransferProperty_type;
\r
71 } ComTxModeMode_type;
\r
76 MASKED_NEW_DIFFERS_MASKED_OLD,
\r
77 MASKED_NEW_DIFFERS_X,
\r
78 MASKED_NEW_EQUALS_X,
\r
83 } ComFilterAlgorithm_type;
\r
89 } ComSignalEndianess_type;
\r
92 COM_TIMEOUT_DATA_ACTION_NONE,
\r
93 COM_TIMEOUT_DATA_ACTION_REPLACE
\r
94 } ComRxDataTimeoutAction_type;
\r
99 } ComTransmissionMode_type;
\r
103 #define M_BOOLEAN boolean
\r
104 #define M_UINT8 uint8
\r
105 #define M_UINT16 uint16
\r
106 #define M_UINT32 uint32
\r
107 #define M_UINT8_N uint8
\r
108 #define M_SINT8 sint8
\r
109 #define M_SINT16 sint16
\r
110 #define M_SINT32 sint32
\r
112 #define SignalTypeToSize(type,length) \
\r
113 (type == UINT8 ? sizeof(uint8) : \
\r
114 type == UINT16 ? sizeof(uint16) : \
\r
115 type == UINT32 ? sizeof(uint32) : \
\r
116 type == UINT8_N ? sizeof(uint8) * length : \
\r
117 type == SINT8 ? sizeof(sint8) : \
\r
118 type == SINT16 ? sizeof(sint16) : \
\r
119 type == SINT32 ? sizeof(sint32) : sizeof(boolean)) \
\r
121 #define SignalTypeSignedness(type) \
122 ((type == SINT8 || type == SINT16 || type == SINT32) ? \
123 COM_SIGNALTYPE_SIGNED : COM_SIGNALTYPE_UNSIGNED)
125 /** Filter configuration type.
129 /** The algorithm that this filter uses. */
130 ComFilterAlgorithm_type ComFilterAlgorithm;
132 uint32 ComFilterMask;
133 /** Max value for filter. */
135 /** Min value for filter. */
137 /** Offset for filter. */
138 uint32 ComFilterOffset;
\r
139 uint32 ComFilterPeriodFactor;
\r
141 uint32 ComFilterArcN;
\r
142 uint32 ComFilterArcNewValue;
\r
143 uint32 ComFilterArcOldValue;
\r
147 /** Configuration structure for group signals */
149 /** Starting position (bit) of the signal within the IPDU.
152 const uint8 ComBitPosition;
\r
154 /** The size of the signal in bits.
157 const uint8 ComBitSize;
\r
159 /** Identifier for the signal.
160 * Should be the same value as the index in the COM signal array.
162 const uint8 ComHandleId;
\r
164 /** Defines the endianess of the signal's network representation. */
165 const ComSignalEndianess_type ComSignalEndianess;
\r
167 /** Value used to initialize this signal. */
168 const void *ComSignalInitValue;
\r
170 /** Defines the type of the signal. */
171 const Com_SignalType ComSignalType;
\r
174 /** Filter for this signal.
177 const ComFilter_type ComFilter;
\r
179 /* Pointer to the shadow buffer of the signal group that this group signal is contained in.
\r
181 * This is initialized by Com_Init() and should not be configured.
183 //void *Com_Arc_ShadowBuffer;
\r
185 /* Callback function used when an invalid signal is received. */
186 // ComInvalidNotification;
187 //uint8 ComSignalDataInvalidValue;
189 /* IPDU id of the IPDU that this signal belongs to.
\r
191 * This is initialized by Com_Init() and should not be configured.
194 //const uint8 ComIPduHandleId;
\r
195 //const uint8 ComSignalUpdated;
\r
197 /** Marks the end of list for the configuration array. */
198 const uint8 Com_Arc_EOL;
\r
199 } ComGroupSignal_type;
\r
202 /** Configuration structure for signals and signal groups. */
205 /** Starting position (bit) of the signal within the IPDU.
208 const uint8 ComBitPosition;
\r
210 /** The size of the signal in bits.
213 const uint8 ComBitSize;
\r
215 /** Notification function for error notification. */
216 void (*ComErrorNotification) (void);
\r
218 /** First timeout period for deadline monitoring. */
219 const uint32 ComFirstTimeoutFactor;
\r
221 /** Identifier for the signal.
222 * Should be the same value as the index in the COM signal array.
224 const uint16 ComHandleId;
\r
226 /** Tx and Rx notification function. */
227 void (*ComNotification) (void);
\r
229 /** Action to be performed when a reception timeout occurs. */
230 const ComRxDataTimeoutAction_type ComRxDataTimeoutAction;
\r
232 /** Defines the endianess of the signal's network representation. */
233 const ComSignalEndianess_type ComSignalEndianess;
\r
235 /** Value used to initialized this signal. */
236 const void *ComSignalInitValue;
\r
238 /** The number of bytes if the signal has type UINT8_N;
241 const uint8 ComSignalLength;
\r
243 /** Defines the type of the signal. */
244 const Com_SignalType ComSignalType;
\r
246 /** Timeout period for deadline monitoring. */
247 const uint32 ComTimeoutFactor;
\r
249 /** Timeout notification function. */
250 void (*ComTimeoutNotification) (void);
\r
252 const ComTransferProperty_type ComTransferProperty;
\r
254 /** The bit position in the PDU for this signal's update bit.
256 * Only applicable if an update bit is used. NULL otherwise.
258 const uint8 ComUpdateBitPosition;
260 /** Marks if this signal uses an update bit.
261 * Should be set to one if an update bit is used.
263 const uint8 ComSignalArcUseUpdateBit;
\r
265 /** Filter for this signal.
268 const ComFilter_type ComFilter;
\r
270 /** Marks if this signal is a signal group.
271 * Should be set to 1 if the signal is a signal group.
273 const uint8 Com_Arc_IsSignalGroup;
275 /** Array of group signals.
276 * Only applicable if this signal is a signal group.
278 const ComGroupSignal_type **ComGroupSignal;
\r
281 //void *Com_Arc_ShadowBuffer;
\r
282 //void *Com_Arc_IPduDataPtr;
\r
284 /* Pointer to the data storage of this signals IPDU.
\r
285 * This is initialized by Com_Init() and should not be configured.
287 //const void *ComIPduDataPtr;
\r
289 /* IPDU id of the IPDU that this signal belongs to.
\r
290 * This is initialized by Com_Init() and should not be configured.
293 //const uint8 ComIPduHandleId;
\r
294 //const uint8 ComSignalUpdated;
\r
296 /* Callback function used when an invalid signal is received.
298 // ComInvalidNotification;
300 //uint8 ComSignalDataInvalidValue;
302 /* Action to be taken if an invalid signal is received.
304 // ComDataInvalidAction;
306 /** Marks the end of list for the signal configuration array. */
307 const uint8 Com_Arc_EOL;
\r
312 /** Configuration structure for Tx-mode for I-PDUs. */
315 /** Transmission mode for this IPdu. */
316 const ComTxModeMode_type ComTxModeMode;
\r
318 /** Defines the number of times this IPdu will be sent in each IPdu cycle.
319 * Should be set to 0 for DIRECT transmission mode and >0 for DIRECT/N-times mode.
321 const uint8 ComTxModeNumberOfRepetitions;
\r
323 /** Defines the period of the transmissions in DIRECT/N-times and MIXED transmission modes. */
324 const uint32 ComTxModeRepetitionPeriodFactor;
\r
326 /** Time before first transmission of this IPDU. (i.e. between the ipdu group start and this IPDU is sent for the first time. */
327 const uint32 ComTxModeTimeOffsetFactor;
\r
329 /** Period of cyclic transmission. */
330 const uint32 ComTxModeTimePeriodFactor;
\r
333 /** Extra configuration structure for Tx I-PDUs. */
336 /** Minimum delay between successive transmissions of the IPdu. */
337 const uint32 ComTxIPduMinimumDelayFactor;
\r
339 /** COM will fill unused areas within an IPdu with this bit patter.
341 const uint8 ComTxIPduUnusedAreasDefault;
\r
343 /** Transmission modes for the IPdu.
344 * TMS is not implemented so only one static transmission mode is supported.
346 const ComTxMode_type ComTxModeTrue;
\r
348 //ComTxMode_type ComTxModeFalse;
\r
352 /** Configuration structure for I-PDU groups */
353 typedef struct ComIPduGroup_type {
\r
354 /** ID of this group.
357 const uint8 ComIPduGroupHandleId;
\r
359 // reference to the group that this group possibly belongs to.
\r
360 //struct ComIPduGroup_type *ComIPduGroupRef;
\r
362 /** Marks the end of list for the I-PDU group configuration array. */
363 const uint8 Com_Arc_EOL;
\r
364 } ComIPduGroup_type;
\r
367 /** Configuration structure for an I-PDU. */
370 /** Callout function of this IPDU.
371 * The callout function is an optional function used both on sender and receiver side.
\r
372 * If configured, it determines whether an IPdu is considered for further processing. If
\r
373 * the callout return false the IPdu will not be received/sent.
\r
375 boolean (*ComIPduCallout)(PduIdType PduId, const uint8 *IPduData);
\r
378 /** The ID of this IPDU. */
379 const uint8 ComIPduRxHandleId;
381 /** The outgoing PDU id. For polite PDU id handling. */
382 const uint8 ArcIPduOutgoingId;
\r
384 /** Signal processing mode for this IPDU. */
385 const Com_IPduSignalProcessingMode ComIPduSignalProcessing;
\r
387 /** Size of the IPDU in bytes.
388 * Range 0-8 for CAN and LIN and 0-256 for FlexRay.
390 const uint8 ComIPduSize;
\r
392 /** The direction of the IPDU. Receive or Send. */
393 const Com_IPduDirection ComIPduDirection;
\r
395 /** Reference to the IPDU group that this IPDU belongs to. */
396 const uint8 ComIPduGroupRef;
\r
398 /** Container of transmission related parameters. */
399 const ComTxIPdu_type ComTxIPdu;
\r
401 /** References to all signals and signal groups contained in this IPDU.
402 * It probably makes little sense not to define at least one signal or signal group for each IPDU.
404 const ComSignal_type **ComIPduSignalRef;
\r
407 * The following two variables are used to control the per I-PDU based Rx/Tx-deadline monitoring.
\r
409 //const uint32 Com_Arc_DeadlineCounter;
\r
410 //const uint32 Com_Arc_TimeoutFactor;
412 /* Transmission related timers and parameters.
413 * These are internal variables and should not be configured.
415 //ComTxIPduTimer_type Com_Arc_TxIPduTimers;
\r
417 /** Marks the end of list for this configuration array. */
418 const uint8 Com_Arc_EOL;
\r
423 /** Top-level configuration container for COM. Exists once per configuration. */
426 /** The ID of this configuration. This is returned by Com_GetConfigurationId(); */
427 const uint8 ComConfigurationId;
\r
430 * Signal Gateway mappings.
\r
431 * Not Implemented yet.
\r
432 ComGwMapping_type ComGwMapping[];
\r
435 /** IPDU definitions */
436 const ComIPdu_type *ComIPdu;
\r
438 //uint16 Com_Arc_NIPdu;
\r
440 /** IPDU group definitions */
441 const ComIPduGroup_type *ComIPduGroup;
\r
443 /** Signal definitions */
444 const ComSignal_type *ComSignal;
\r
446 // Signal group definitions
\r
447 //ComSignalGroup_type *ComSignalGroup;
\r
449 /** Group signal definitions */
450 const ComGroupSignal_type *ComGroupSignal;
\r
454 #endif /*COM_TYPES_H_*/