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 ------------------------------*/
23 #ifndef COM_TYPES_H_
\r
24 #define COM_TYPES_H_
\r
26 #include "ComStack_Types.h"
\r
27 #include "Com_Cfg.h"
\r
29 typedef uint8 Com_PduGroupIdType;
\r
30 typedef uint16 Com_SignalIdType;
\r
31 typedef uint8 Com_SignalGroupIdType;
\r
36 } Com_IPduSignalProcessingMode;
\r
41 } Com_IPduDirection;
\r
57 } ComTransferProperty_type;
\r
64 } ComTxModeMode_type;
\r
69 MASKED_NEW_DIFFERS_MASKED_OLD,
\r
70 MASKED_NEW_DIFFERS_X,
\r
71 MASKED_NEW_EQUALS_X,
\r
76 } ComFilterAlgorithm_type;
\r
82 } ComSignalEndianess_type;
\r
85 COM_TIMEOUT_DATA_ACTION_NONE,
\r
86 COM_TIMEOUT_DATA_ACTION_REPLACE
\r
87 } ComRxDataTimeoutAction_type;
\r
92 } ComTransmissionMode_type;
\r
96 #define M_BOOLEAN boolean
\r
97 #define M_UINT8 uint8
\r
98 #define M_UINT16 uint16
\r
99 #define M_UINT32 uint32
\r
100 #define M_UINT8_N uint8
\r
101 #define M_SINT8 sint8
\r
102 #define M_SINT16 sint16
\r
103 #define M_SINT32 sint32
\r
105 #define SignalTypeToSize(type,length) \
\r
106 (type == UINT8 ? sizeof(uint8) : \
\r
107 type == UINT16 ? sizeof(uint16) : \
\r
108 type == UINT32 ? sizeof(uint32) : \
\r
109 type == UINT8_N ? sizeof(uint8) * length : \
\r
110 type == SINT8 ? sizeof(sint8) : \
\r
111 type == SINT16 ? sizeof(sint16) : \
\r
112 type == SINT32 ? sizeof(sint32) : sizeof(boolean)) \
\r
116 ComFilterAlgorithm_type ComFilterAlgorithm;
\r
117 uint32 ComFilterMask;
\r
118 uint32 ComFilterMax;
\r
119 uint32 ComFilterMin;
\r
120 uint32 ComFilterOffset;
\r
121 uint32 ComFilterPeriodFactor;
\r
125 uint32 ComFilterArcN;
\r
126 uint32 ComFilterArcNewValue;
\r
127 uint32 ComFilterArcOldValue;
\r
133 /* Starting position (bit) of the signal within the IPDU.
\r
136 * - Send and receive.
\r
139 * Comment: Range 0 to 63.
\r
141 const uint8 ComBitPosition;
\r
143 /* The size of the signal in bits.
\r
146 * - Send and receive.
\r
149 * Comment: Range 0 to 64.
\r
151 const uint8 ComBitSize;
\r
153 /* Identifier for the signal.
\r
156 * - Send and receive.
\r
159 * Comment: Should be the same value as the index in the COM signal array.
\r
161 const uint8 ComHandleId;
\r
163 /* Callback function used when an invalid signal is received.
\r
169 // ComInvalidNotification;
\r
174 * - Send and receive.
\r
177 //uint8 ComSignalDataInvalidValue;
\r
179 /* Defines the endianess of the signal's network representation.
\r
182 * - Send and receive.
\r
185 const ComSignalEndianess_type ComSignalEndianess;
\r
188 * Value used to initialized this signal.
\r
194 const uint32 ComSignalInitValue;
\r
196 /* The number of bytes if the signal has type UINT8_N;
\r
199 * - Send and receive.
\r
200 * - Required if type of signal is UINT8_N
\r
202 * Comment: Range 1 to 8.
\r
204 const uint8 ComSignalLength;
\r
206 /* Defines the type of the signal
\r
209 * - Send and receive.
\r
212 const Com_SignalType ComSignalType;
\r
215 /* Filter for this signal
\r
221 const ComFilter_type ComFilter;
\r
223 /* Pointer to the shadow buffer of the signal group that this group signal is contained in.
\r
225 * Comment: This is initialized by Com_Init() and should not be configured.
\r
227 //void *Com_Arc_ShadowBuffer;
\r
230 /* IPDU id of the IPDU that this signal belongs to.
\r
232 * Comment: This is initialized by Com_Init() and should not be configured.
\r
235 //const uint8 ComIPduHandleId;
\r
236 //const uint8 ComSignalUpdated;
\r
238 const uint8 Com_Arc_EOL;
\r
239 } ComGroupSignal_type;
\r
243 /* Starting position (bit) of the signal within the IPDU.
\r
246 * - Send and receive.
\r
249 * Comment: Range 0 to 63.
251 const uint8 ComBitPosition;
\r
253 /* The size of the signal in bits.
\r
256 * - Send and receive.
\r
259 * Comment: Range 0 to 64.
261 const uint8 ComBitSize;
\r
264 /* Action to be taken if an invalid signal is received.
\r
269 // ComDataInvalidAction;
\r
271 /* Notification function for error notification.
\r
278 void (*ComErrorNotification) (void);
\r
280 /* First timeout period for deadline monitoring.
\r
286 const uint32 ComFirstTimeoutFactor;
\r
288 /* Identifier for the signal.
\r
291 * - Send and receive.
\r
294 * Comment: Should be the same value as the index in the COM signal array.
296 const uint8 ComHandleId;
\r
298 /* Callback function used when an invalid signal is received.
\r
304 // ComInvalidNotification;
\r
306 /* Tx and Rx notification function.
\r
309 * - Send and receive.
\r
312 void (*ComNotification) (void);
\r
314 /* Action to be performed when a reception timeout occurs.
\r
320 const ComRxDataTimeoutAction_type ComRxDataTimeoutAction;
\r
325 * - Send and receive.
\r
328 //uint8 ComSignalDataInvalidValue;
\r
330 /* Defines the endianess of the signal's network representation.
\r
333 * - Send and receive.
\r
336 const ComSignalEndianess_type ComSignalEndianess;
\r
339 * Value used to initialized this signal.
\r
345 const uint32 ComSignalInitValue;
\r
347 /* The number of bytes if the signal has type UINT8_N;
\r
350 * - Send and receive.
\r
351 * - Required if type of signal is UINT8_N
\r
353 * Comment: Range 1 to 8.
355 const uint8 ComSignalLength;
\r
357 /* Defines the type of the signal
\r
360 * - Send and receive.
\r
363 const Com_SignalType ComSignalType;
\r
365 /* Timeout period for deadline monitoring.
\r
371 //const uint32 Com_Arc_DeadlineCounter;
\r
372 const uint32 ComTimeoutFactor;
\r
374 /* Timeout notification function
\r
377 * - Receive and send
\r
380 void (*ComTimeoutNotification) (void);
\r
382 const ComTransferProperty_type ComTransferProperty;
\r
385 * The bit position in the PDU for this signals update bit.
\r
388 * - Send and receive.
\r
391 * Comment: Range 0 to 63. If update bit is used for this signal, then the corresponding parameter ComSignalArcUseUpdateBit
\r
392 * needs to be set to one.
394 const uint8 ComUpdateBitPosition;
\r
395 const uint8 ComSignalArcUseUpdateBit;
\r
397 /* Filter for this signal
\r
403 const ComFilter_type ComFilter;
\r
406 /**** SIGNAL GROUP DATA ****/
\r
407 const uint8 Com_Arc_IsSignalGroup;
\r
408 const ComGroupSignal_type *ComGroupSignal[COM_MAX_NR_SIGNALS_PER_SIGNAL_GROUP];
\r
409 //void *Com_Arc_ShadowBuffer;
\r
410 //void *Com_Arc_IPduDataPtr;
\r
413 /* Pointer to the data storage of this signals IPDU.
\r
415 * Comment: This is initialized by Com_Init() and should not be configured.
417 //const void *ComIPduDataPtr;
\r
419 /* IPDU id of the IPDU that this signal belongs to.
\r
421 * Comment: This is initialized by Com_Init() and should not be configured.
\r
424 //const uint8 ComIPduHandleId;
\r
425 //const uint8 ComSignalUpdated;
\r
428 const uint8 Com_Arc_EOL;
\r
433 /* Transmission mode for this IPdu.
\r
439 const ComTxModeMode_type ComTxModeMode;
\r
441 /* Defines the number of times this IPdu will be sent in each IPdu cycle.
\r
445 * - Required for transmission modes DIRECT/N-times and MIXED.
\r
447 * Comment: Should be set to 0 for DIRECT transmission mode and >0 for DIRECT/N-times mode.
449 const uint8 ComTxModeNumberOfRepetitions;
\r
451 /* Defines the period of the transmissions in DIRECT/N-times and MIXED
\r
452 * transmission modes.
\r
456 * - Required for DIRECT/N-times and MIXED transmission modes.
458 const uint32 ComTxModeRepetitionPeriodFactor;
\r
460 /* Time before first transmission of this IPDU. (i.e. between the ipdu group start
\r
461 * and this IPDU is sent for the first time.
\r
465 * - Required for all transmission modes except NONE.
467 const uint32 ComTxModeTimeOffsetFactor;
\r
469 /* Period of cyclic transmission.
\r
473 * - Required for CYCLIC and MIXED transmission mode.
475 const uint32 ComTxModeTimePeriodFactor;
\r
481 /* Minimum delay between successive transmissions of the IPdu.
\r
487 const uint32 ComTxIPduMinimumDelayFactor;
\r
489 /* COM will fill unused areas within an IPdu with this bit patter.
\r
495 const uint8 ComTxIPduUnusedAreasDefault;
\r
497 /* Transmission modes for this IPdu.
\r
503 * Comment: TMS is not implemented so only one static transmission
\r
506 const ComTxMode_type ComTxModeTrue;
\r
507 //ComTxMode_type ComTxModeFalse;
\r
513 uint8 ComTxIPduNumberOfRepetitionsLeft;
\r
514 uint32 ComTxModeRepetitionPeriodTimer;
\r
515 uint32 ComTxIPduMinimumDelayTimer;
\r
516 uint32 ComTxModeTimePeriodTimer;
\r
517 } ComTxIPduTimer_type;
\r
520 typedef struct ComIPduGroup_type {
\r
521 // ID of this group. 0-31.
\r
522 const uint8 ComIPduGroupHandleId;
\r
524 // reference to the group that this group possibly belongs to.
\r
525 //struct ComIPduGroup_type *ComIPduGroupRef;
\r
527 const uint8 Com_Arc_EOL;
\r
528 } ComIPduGroup_type;
\r
533 /* Callout function of this IPDU.
\r
534 * The callout function is an optional function used both on sender and receiver side.
\r
535 * If configured, it determines whether an IPdu is considered for further processing. If
\r
536 * the callout return false the IPdu will not be received/sent.
\r
539 * - Send and receive.
\r
542 boolean (*ComIPduCallout)(PduIdType PduId, const uint8 *IPduData);
\r
545 /* The ID of this IPDU.
\r
548 * - Send and receive.
\r
553 const uint8 ComIPduRxHandleId;
\r
555 /* Signal processing mode for this IPDU.
\r
561 const Com_IPduSignalProcessingMode ComIPduSignalProcessing;
\r
563 /* Size of the IPDU in bytes. 0-8 for CAN and LIN and 0-256 for FlexRay.
\r
566 * - Send and receive.
\r
569 const uint8 ComIPduSize;
\r
571 /* The direction of the IPDU. Receive or Send.
\r
574 * - Receive or send.
\r
577 const Com_IPduDirection ComIPduDirection;
\r
579 /* Reference to the IPDU group that this IPDU belongs to.
\r
582 * - Send and receive.
\r
585 const uint8 ComIPduGroupRef;
\r
587 /* Reference to global PDU structure. ???
\r
589 * No global PDU structure defined so this variable is left out.
593 /* Container of transmission related parameters.
\r
599 const ComTxIPdu_type ComTxIPdu;
\r
601 /* Transmission related timers and parameters.
\r
606 * - Not part of the AUTOSAR standard.
\r
608 * Comment: These are internal variables and should not be configured.
610 //ComTxIPduTimer_type Com_Arc_TxIPduTimers;
\r
612 /* Pointer to data storage of this IPDU.
\r
615 * - Send and receive.
\r
617 * Comment: this memory will be initialized dynamically in Com_Init();
619 //void *ComIPduDataPtr;
\r
621 /* References to all signals contained in this IPDU.
\r
624 * - Send and receive.
\r
627 * Comment: It probably makes little sense not to define at least one signal for each IPDU.
\r
629 //const uint8 Com_Arc_NIPduSignalGroupRef;
\r
630 const ComSignal_type *ComIPduSignalGroupRef[COM_MAX_NR_SIGNALS_PER_IPDU];
\r
633 /* References to all signals contained in this IPDU.
\r
636 * - Send and receive.
\r
639 * Comment: It probably makes little sense not to define at least one signal for each IPDU.
\r
641 //const uint8 NComIPduSignalRef;
\r
642 const ComSignal_type *ComIPduSignalRef[COM_MAX_NR_SIGNALS_PER_IPDU];
\r
645 * The following two variables are used to control the per I-PDU based Rx/Tx-deadline monitoring.
\r
647 //const uint32 Com_Arc_DeadlineCounter;
\r
648 //const uint32 Com_Arc_TimeoutFactor;
\r
650 const uint8 Com_Arc_EOL;
\r
655 // Contains configuration specific configuration parameters. Exists once per configuration.
\r
658 // The ID of this configuration. This is returned by Com_GetConfigurationId();
\r
659 const uint8 ComConfigurationId;
\r
662 * Signal Gateway mappings.
\r
663 * Not Implemented yet.
\r
664 ComGwMapping_type ComGwMapping[];
\r
667 // IPDU definitions. At least one
\r
668 const ComIPdu_type *ComIPdu;
\r
670 //uint16 Com_Arc_NIPdu;
\r
672 // IPDU group definitions
\r
673 const ComIPduGroup_type *ComIPduGroup;
\r
675 // Signal definitions
\r
676 const ComSignal_type *ComSignal;
\r
678 // Signal group definitions
\r
679 //ComSignalGroup_type *ComSignalGroup;
\r
681 // Group signal definitions
\r
682 const ComGroupSignal_type *ComGroupSignal;
\r
686 #endif /*COM_TYPES_H_*/
\r