1 /* -------------------------------- Arctic Core ------------------------------
\r
2 * Arctic Core - the open source AUTOSAR platform http://arccore.com
\r
4 * Copyright (C) 2009 ArcCore AB <contact@arccore.com>
\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
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
14 * -------------------------------- Arctic Core ------------------------------*/
\r
18 /** @addtogroup Com COM module
\r
21 /** @file Com_Types.h
\r
22 * Definitions of configuration types and parameters for the COM module.
\r
27 #ifndef COM_TYPES_H_
\r
28 #define 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
36 typedef uint16 Com_BitPositionType;
\r
40 } Com_IPduSignalProcessingMode;
\r
45 } Com_IPduDirection;
\r
59 #define COM_SIGNALTYPE_UNSIGNED FALSE
\r
60 #define COM_SIGNALTYPE_SIGNED TRUE
\r
65 } ComTransferProperty_type;
\r
72 } ComTxModeMode_type;
\r
77 MASKED_NEW_DIFFERS_MASKED_OLD,
\r
78 MASKED_NEW_DIFFERS_X,
\r
79 MASKED_NEW_EQUALS_X,
\r
84 } ComFilterAlgorithm_type;
\r
90 } ComSignalEndianess_type;
\r
93 COM_TIMEOUT_DATA_ACTION_NONE,
\r
94 COM_TIMEOUT_DATA_ACTION_REPLACE
\r
95 } ComRxDataTimeoutAction_type;
\r
100 } ComTransmissionMode_type;
\r
104 #define M_BOOLEAN boolean
\r
105 #define M_UINT8 uint8
\r
106 #define M_UINT16 uint16
\r
107 #define M_UINT32 uint32
\r
108 #define M_UINT8_N uint8
\r
109 #define M_SINT8 sint8
\r
110 #define M_SINT16 sint16
\r
111 #define M_SINT32 sint32
\r
113 #define SignalTypeToSize(type,length) \
\r
114 (type == UINT8 ? sizeof(uint8) : \
\r
115 type == UINT16 ? sizeof(uint16) : \
\r
116 type == UINT32 ? sizeof(uint32) : \
\r
117 type == UINT8_N ? sizeof(uint8) * length : \
\r
118 type == SINT8 ? sizeof(sint8) : \
\r
119 type == SINT16 ? sizeof(sint16) : \
\r
120 type == SINT32 ? sizeof(sint32) : sizeof(boolean)) \
\r
122 #define SignalTypeSignedness(type) \
\r
123 (( (type == SINT8) || (type == SINT16) || (type == SINT32) ) ? \
\r
124 COM_SIGNALTYPE_SIGNED : COM_SIGNALTYPE_UNSIGNED)
\r
126 /** Filter configuration type.
\r
130 /** The algorithm that this filter uses. */
\r
131 ComFilterAlgorithm_type ComFilterAlgorithm;
\r
132 /** Filter mask. */
\r
133 uint32 ComFilterMask;
\r
134 /** Max value for filter. */
\r
135 uint32 ComFilterMax;
\r
136 /** Min value for filter. */
\r
137 uint32 ComFilterMin;
\r
138 /** Offset for filter. */
\r
139 uint32 ComFilterOffset;
\r
140 uint32 ComFilterPeriodFactor;
\r
142 uint32 ComFilterArcN;
\r
143 uint32 ComFilterArcNewValue;
\r
144 uint32 ComFilterArcOldValue;
\r
148 /** Configuration structure for group signals */
\r
150 /** Starting position (bit) of the signal within the IPDU.
\r
153 const Com_BitPositionType ComBitPosition;
\r
155 /** The size of the signal in bits.
\r
158 const uint8 ComBitSize;
\r
160 /** Identifier for the signal.
\r
161 * Should be the same value as the index in the COM signal array.
\r
163 const uint8 ComHandleId;
\r
165 /** Defines the endianess of the signal's network representation. */
\r
166 const ComSignalEndianess_type ComSignalEndianess;
\r
168 /** Value used to initialize this signal. */
\r
169 const void *ComSignalInitValue;
\r
171 /** Defines the type of the signal. */
\r
172 const Com_SignalType ComSignalType;
\r
175 /** Filter for this signal.
\r
178 //const ComFilter_type ComFilter;
\r
180 /* Pointer to the shadow buffer of the signal group that this group signal is contained in.
\r
182 * This is initialized by Com_Init() and should not be configured.
\r
184 //void *Com_Arc_ShadowBuffer;
\r
186 /* Callback function used when an invalid signal is received. */
\r
187 // ComInvalidNotification;
\r
188 //uint8 ComSignalDataInvalidValue;
\r
190 /* IPDU id of the IPDU that this signal belongs to.
\r
192 * This is initialized by Com_Init() and should not be configured.
\r
195 //const uint8 ComIPduHandleId;
\r
196 //const uint8 ComSignalUpdated;
\r
198 /** Marks the end of list for the configuration array. */
\r
199 const uint8 Com_Arc_EOL;
\r
200 } ComGroupSignal_type;
\r
203 /** Configuration structure for signals and signal groups. */
\r
206 /** Starting position (bit) of the signal within the IPDU.
\r
209 const Com_BitPositionType ComBitPosition;
\r
211 /** The size of the signal in bits.
\r
214 const uint8 ComBitSize;
\r
216 /** Notification function for error notification. */
\r
217 void (*ComErrorNotification) (void);
\r
219 /** First timeout period for deadline monitoring. */
\r
220 const uint32 ComFirstTimeoutFactor;
\r
222 /** Identifier for the signal.
\r
223 * Should be the same value as the index in the COM signal array.
\r
225 const uint16 ComHandleId;
\r
227 /** Tx and Rx notification function. */
\r
228 void (*ComNotification) (void);
\r
230 /** Action to be performed when a reception timeout occurs. */
\r
231 const ComRxDataTimeoutAction_type ComRxDataTimeoutAction;
\r
233 /** Defines the endianess of the signal's network representation. */
\r
234 const ComSignalEndianess_type ComSignalEndianess;
\r
236 /** Value used to initialized this signal. */
\r
237 const void *ComSignalInitValue;
\r
239 /** The number of bytes if the signal has type UINT8_N;
\r
242 //const uint8 ComSignalLength;
\r
244 /** Defines the type of the signal. */
\r
245 const Com_SignalType ComSignalType;
\r
247 /** Timeout period for deadline monitoring. */
\r
248 const uint32 ComTimeoutFactor;
\r
250 /** Timeout notification function. */
\r
251 void (*ComTimeoutNotification) (void);
\r
253 const ComTransferProperty_type ComTransferProperty;
\r
255 /** The bit position in the PDU for this signal's update bit.
\r
257 * Only applicable if an update bit is used. NULL otherwise.
\r
259 const Com_BitPositionType ComUpdateBitPosition;
\r
261 /** Marks if this signal uses an update bit.
\r
262 * Should be set to one if an update bit is used.
\r
264 const uint8 ComSignalArcUseUpdateBit;
\r
266 /** Filter for this signal.
\r
269 //const ComFilter_type ComFilter;
\r
271 /** Marks if this signal is a signal group.
\r
272 * Should be set to 1 if the signal is a signal group.
\r
274 const uint8 Com_Arc_IsSignalGroup;
\r
276 /** Array of group signals.
\r
277 * Only applicable if this signal is a signal group.
\r
279 const ComGroupSignal_type * const *ComGroupSignal;
\r
282 const void *Com_Arc_ShadowBuffer;
\r
283 //void *Com_Arc_IPduDataPtr;
\r
285 /* Pointer to the data storage of this signals IPDU.
\r
286 * This is initialized by Com_Init() and should not be configured.
\r
288 //const void *ComIPduDataPtr;
\r
290 /* IPDU id of the IPDU that this signal belongs to.
\r
291 * This is initialized by Com_Init() and should not be configured.
\r
294 const uint16 ComIPduHandleId;
\r
295 //const uint8 ComSignalUpdated;
\r
297 /* Callback function used when an invalid signal is received.
\r
299 // ComInvalidNotification;
\r
301 //uint8 ComSignalDataInvalidValue;
\r
303 /* Action to be taken if an invalid signal is received.
\r
305 // ComDataInvalidAction;
\r
307 /** Marks the end of list for the signal configuration array. */
\r
308 const uint8 Com_Arc_EOL;
\r
313 /** Configuration structure for Tx-mode for I-PDUs. */
\r
316 /** Transmission mode for this IPdu. */
\r
317 const ComTxModeMode_type ComTxModeMode;
\r
319 /** Defines the number of times this IPdu will be sent in each IPdu cycle.
\r
320 * Should be set to 0 for DIRECT transmission mode and >0 for DIRECT/N-times mode.
\r
322 const uint8 ComTxModeNumberOfRepetitions;
\r
324 /** Defines the period of the transmissions in DIRECT/N-times and MIXED transmission modes. */
\r
325 const uint32 ComTxModeRepetitionPeriodFactor;
\r
327 /** Time before first transmission of this IPDU. (i.e. between the ipdu group start and this IPDU is sent for the first time. */
\r
328 const uint32 ComTxModeTimeOffsetFactor;
\r
330 /** Period of cyclic transmission. */
\r
331 const uint32 ComTxModeTimePeriodFactor;
\r
334 /** Extra configuration structure for Tx I-PDUs. */
\r
337 /** Minimum delay between successive transmissions of the IPdu. */
\r
338 const uint32 ComTxIPduMinimumDelayFactor;
\r
340 /** COM will fill unused areas within an IPdu with this bit patter.
\r
342 const uint8 ComTxIPduUnusedAreasDefault;
\r
344 /** Transmission modes for the IPdu.
\r
345 * TMS is not implemented so only one static transmission mode is supported.
\r
347 const ComTxMode_type ComTxModeTrue;
\r
349 //ComTxMode_type ComTxModeFalse;
\r
353 /** Configuration structure for I-PDU groups */
\r
354 typedef struct ComIPduGroup_type {
\r
355 /** ID of this group.
\r
358 const uint8 ComIPduGroupHandleId;
\r
360 // reference to the group that this group possibly belongs to.
\r
361 //struct ComIPduGroup_type *ComIPduGroupRef;
\r
363 /** Marks the end of list for the I-PDU group configuration array. */
\r
364 const uint8 Com_Arc_EOL;
\r
365 } ComIPduGroup_type;
\r
368 /** Configuration structure for an I-PDU. */
\r
371 /** Callout function of this IPDU.
\r
372 * The callout function is an optional function used both on sender and receiver side.
\r
373 * If configured, it determines whether an IPdu is considered for further processing. If
\r
374 * the callout return false the IPdu will not be received/sent.
\r
376 boolean (*ComIPduCallout)(PduIdType PduId, const uint8 *IPduData);
\r
379 /** The outgoing PDU id. For polite PDU id handling. */
\r
380 const uint8 ArcIPduOutgoingId;
\r
382 /** Signal processing mode for this IPDU. */
\r
383 const Com_IPduSignalProcessingMode ComIPduSignalProcessing;
\r
385 /** Size of the IPDU in bytes.
\r
386 * Range 0-8 for CAN and LIN and 0-256 for FlexRay.
\r
388 const uint8 ComIPduSize;
\r
390 /** The direction of the IPDU. Receive or Send. */
\r
391 const Com_IPduDirection ComIPduDirection;
\r
393 /** Reference to the IPDU group that this IPDU belongs to. */
\r
394 const uint8 ComIPduGroupRef;
\r
396 /** Container of transmission related parameters. */
\r
397 const ComTxIPdu_type ComTxIPdu;
\r
399 /** Reference to the actual pdu data storage */
\r
400 void *const ComIPduDataPtr;
\r
401 void *const ComIPduDeferredDataPtr;
\r
403 /** References to all signals and signal groups contained in this IPDU.
\r
404 * It probably makes little sense not to define at least one signal or signal group for each IPDU.
\r
406 const ComSignal_type * const *ComIPduSignalRef;
\r
408 const ComSignal_type * const ComIPduDynSignalRef;
\r
411 * The following two variables are used to control the per I-PDU based Rx/Tx-deadline monitoring.
\r
413 //const uint32 Com_Arc_DeadlineCounter;
\r
414 //const uint32 Com_Arc_TimeoutFactor;
\r
416 /* Transmission related timers and parameters.
\r
417 * These are internal variables and should not be configured.
\r
419 //ComTxIPduTimer_type Com_Arc_TxIPduTimers;
\r
421 /** Marks the end of list for this configuration array. */
\r
422 const uint8 Com_Arc_EOL;
\r
427 /** Top-level configuration container for COM. Exists once per configuration. */
\r
430 /** The ID of this configuration. This is returned by Com_GetConfigurationId(); */
\r
431 const uint8 ComConfigurationId;
\r
434 * Signal Gateway mappings.
\r
435 * Not Implemented yet.
\r
436 ComGwMapping_type ComGwMapping[];
\r
439 /** IPDU definitions */
\r
440 const ComIPdu_type *ComIPdu;
\r
442 //uint16 Com_Arc_NIPdu;
\r
444 /** IPDU group definitions */
\r
445 const ComIPduGroup_type *ComIPduGroup;
\r
447 /** Signal definitions */
\r
448 const ComSignal_type *ComSignal;
\r
450 // Signal group definitions
\r
451 //ComSignalGroup_type *ComSignalGroup;
\r
453 /** Group signal definitions */
\r
454 const ComGroupSignal_type *ComGroupSignal;
\r
458 #endif /*COM_TYPES_H_*/
\r