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
17 * NB! This file is for COM internal use only and may only be included from COM C-files!
\r
22 #ifndef COM_INTERNAL_H_
\r
23 #define COM_INTERNAL_H_
\r
25 #include "Com_Arc_Types.h"
\r
27 extern const Com_ConfigType *ComConfig;
\r
28 extern Com_Arc_Config_type Com_Arc_Config;
\r
32 #if COM_DEV_ERROR_DETECT == STD_ON
\r
35 #define DET_REPORTERROR(_x,_y,_z,_q) Det_ReportError(_x,_y,_z,_q)
\r
38 // Define macro for parameter check.
\r
39 #define PDU_ID_CHECK(PduId,ApiId,...) \
\r
40 if (PduId >= COM_N_IPDUS) { \
\r
41 DET_REPORTERROR(COM_MODULE_ID, COM_INSTANCE_ID, ApiId, COM_INVALID_PDU_ID); \
\r
42 return __VA_ARGS__; \
\r
45 #define VALIDATE_SIGNAL(SignalId, ApiId, ...) \
\r
46 if (SignalId >= COM_N_SIGNALS) { \
\r
47 DET_REPORTERROR(COM_MODULE_ID, COM_INSTANCE_ID, ApiId, COM_INVALID_SIGNAL_ID); \
\r
48 return __VA_ARGS__; \
\r
54 #define DET_REPORTERROR(_x,_y,_z,_q)
\r
56 #define PDU_ID_CHECK(PduId,ApiId,...)
\r
57 #define VALIDATE_SIGNAL(PduId, ApiId, ...)
\r
61 #define TESTBIT(source,bit) ( *( (uint8 *)source + (bit / 8) ) & (uint8)(1u << (bit % 8)) )
\r
62 #define SETBIT(dest,bit) ( *( (uint8 *)dest + (bit / 8) ) |= (uint8)(1u << (bit % 8)) )
\r
63 #define CLEARBIT(dest,bit) ( *( (uint8 *)dest + (bit / 8) ) &= (uint8)~(uint8)(1u << (bit % 8)) )
\r
66 #define GET_Signal(SignalId) \
\r
67 (&ComConfig->ComSignal[SignalId])
\r
69 #define GET_ArcSignal(SignalId) \
\r
70 (&Com_Arc_Config.ComSignal[SignalId])
\r
72 #define GET_IPdu(IPduId) \
\r
73 (&ComConfig->ComIPdu[IPduId])
\r
75 #define GET_ArcIPdu(IPduId) \
\r
76 (&Com_Arc_Config.ComIPdu[IPduId])
\r
78 #define GET_GroupSignal(GroupSignalId) \
\r
79 (&ComConfig->ComGroupSignal[GroupSignalId])
\r
81 #define GET_ArcGroupSignal(GroupSignalId) \
\r
82 (&Com_Arc_Config.ComGroupSignal[GroupSignalId])
\r
86 #endif /* COM_INTERNAL_H_ */
\r