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 ------------------------------*/
26 #include "Std_Types.h"
\r
27 #include "Com_Types.h"
\r
28 #include "Com_EcoreTypes.h"
\r
31 #ifdef COM_DEV_ERROR_DETECT
\r
35 #include "Com_Cfg.h"
\r
36 #include "Com_PbCfg.h"
\r
37 #include "Com_Com.h"
\r
38 #include "Com_Sched.h"
\r
40 const Com_ConfigType * ComConfig;
\r
42 ComEcoreConfig_type ComEcoreConfig;
\r
46 #ifdef COM_DEV_ERROR_DETECT
\r
48 #undef DET_REPORTERROR
\r
49 #define DET_REPORTERROR(_x,_y,_z,_q) Det_ReportError(_x,_y,_z,_q)
\r
52 // Define macro for parameter check.
\r
53 #define PduIdCheck(PduId,ApiId,...) \
\r
54 if (PduId >= ComEcoreConfig.ComNIPdu) { \
\r
55 DET_REPORTERROR(COM_MODULE_ID, COM_INSTANCE_ID, ApiId, COM_INVALID_PDU_ID); \
\r
56 return __VA_ARGS__; \
\r
59 #define COM_VALIDATE_SIGNAL(SignalId, ApiId, ...) \
\r
60 if (ComConfig->ComSignal[SignalId].ComEcoreIsSignalGroup) { \
\r
61 DET_REPORTERROR(COM_MODULE_ID, COM_INSTANCE_ID, ApiId, COM_ERROR_SIGNAL_IS_SIGNALGROUP); \
\r
62 return __VA_ARGS__; \
\r
68 #undef DET_REPORTERROR
\r
69 #define DET_REPORTERROR(_x,_y,_z,_q)
\r
71 #define PduIdCheck(PduId,ApiId,...)
\r
72 #define COM_VALIDATE_SIGNAL(PduId, ApiId, ...)
\r
76 #define testBit(source,bit) (*((uint8 *)source + (bit / 8)) & (1 << (bit % 8)))
\r
77 #define setBit(dest,bit) *((uint8 *)dest + (bit / 8)) |= (1 << (bit % 8))
\r
78 #define clearBit(dest,bit) *((uint8 *)dest + (bit / 8)) &= ~(1 << (bit % 8))
\r
80 #define ComGetSignal(SignalId) \
\r
81 const ComSignal_type * Signal = &ComConfig->ComSignal[SignalId]\
\r
83 #define ComGetEcoreSignal(SignalId) \
\r
84 ComEcoreSignal_type * EcoreSignal = &ComEcoreConfig.ComSignal[SignalId]\
\r
86 #define ComGetIPdu(IPduId) \
\r
87 const ComIPdu_type *IPdu = &ComConfig->ComIPdu[IPduId]\
\r
89 #define ComGetEcoreIPdu(IPduId) \
\r
90 ComEcoreIPdu_type *EcoreIPdu = &ComEcoreConfig.ComIPdu[IPduId]\
\r
92 #define ComGetGroupSignal(GroupSignalId) \
\r
93 const ComGroupSignal_type *GroupSignal = &ComConfig->ComGroupSignal[GroupSignalId]\
\r
95 #define ComGetEcoreGroupSignal(GroupSignalId) \
\r
96 ComEcoreGroupSignal_type *EcoreGroupSignal = &ComEcoreConfig.ComGroupSignal[GroupSignalId]\
\r
98 //-------------------------------------------------------------------
\r
99 // From OSEK_VDX spec...
\r
101 //typedef uint32 MessageIdentifier;
\r
102 // TODO: Have no idea here..
\r
103 //typedef void * ApplicationDataRef;
\r
110 //-------------------------------------------------------------------
\r
114 /* The service SendMessage updates the message object identified by
\r
115 * <Message> with the application message referenced by the
\r
116 * <DataRef> parameter.
\r
118 * Internal communication:
\r
119 * The message <Message> is routed to the receiving part of the IL.
\r
121 // Update 2008-10-30, SendMessage and ReceiveMessage should not be required. ensured by RTE. COM013
\r
122 //StatusType SendMessage(MessageIdentifier , ApplicationDataRef );
\r
124 // The service ReceiveMessage updates the application message
\r
125 // referenced by <DataRef> with the data in the message object
\r
126 // identified by <Message>. It resets all flags (Notification classes 1 and
\r
127 // 3) associated with <Message>.
\r
128 //StatusType ReceiveMessage ( MessageIdentifier , ApplicationDataRef );
\r
132 void Com_Init( const Com_ConfigType * ConfigPtr);
\r
133 void Com_DeInit( void );
\r
135 void Com_IpduGroupStart(Com_PduGroupIdType IpduGroupId, boolean Initialize);
\r
136 void Com_IpduGroupStop(Com_PduGroupIdType IpduGroupId);
\r