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
26 #define PDUR_VENDOR_ID 1
\r
27 #define PDUR_AR_MAJOR_VERSION 2
\r
28 #define PDUR_AR_MINOR_VERSION 2
\r
29 #define PDUR_AR_PATCH_VERSION 2
\r
30 #define PDUR_SW_MAJOR_VERSION 2
\r
31 #define PDUR_SW_MINOR_VERSION 0
\r
32 #define PDUR_SW_PATCH_VERSION 0
\r
37 #define PDUR_E_CONFIG_PTR_INVALID 0x06
\r
38 #define PDUR_E_INVALID_REQUEST 0x01
\r
39 #define PDUR_E_PDU_ID_INVALID 0x02
\r
40 #define PDUR_E_TP_TX_REQ_REJECTED 0x03
\r
41 #define PDUR_E_DATA_PTR_INVALID 0x05
\r
43 #define PDUR_INSTANCE_ID 0
\r
45 #include "Modules.h"
\r
47 #include "PduR_Cfg.h"
\r
48 #include "PduR_Types.h"
\r
49 #include "PduR_PbCfg.h"
\r
51 #include "PduR_If.h"
\r
53 #if PDUR_COM_SUPPORT == STD_ON
\r
54 #include "PduR_Com.h"
\r
56 #if PDUR_CANIF_SUPPORT == STD_ON
\r
57 #include "PduR_CanIf.h"
\r
59 #if PDUR_LINIF_SUPPORT == STD_ON
\r
60 #include "PduR_LinIf.h"
\r
62 #if PDUR_CANTP_SUPPORT == STD_ON
\r
63 #include "PduR_CanTp.h"
\r
65 #if PDUR_J1939TP_SUPPORT == STD_ON
\r
66 #include "PduR_J1939Tp.h"
\r
68 #if PDUR_DCM_SUPPORT == STD_ON
\r
69 #include "PduR_Dcm.h"
\r
71 #if PDUR_SOAD_SUPPORT == STD_ON
\r
72 #include "PduR_SoAd.h"
\r
74 #if PDUR_J1939TP_SUPPORT == STD_ON
\r
75 #include "PduR_J1939Tp.h"
\r
79 /* Contain the current state of the PDU router. The router is uninitialized
\r
80 * until PduR_Init has been run.
\r
82 //PduR_StateType PduRState;
\r
84 extern const PduR_PBConfigType *PduRConfig;
\r
87 * The state of the PDU router.
\r
89 extern PduR_StateType PduRState;
\r
91 #define PduR_IsUpModule(_mod) ((_mod > ARC_PDUR_UP_MODULES) && (_mod < ARC_PDUR_LOIF_MODULES))
\r
92 #define PduR_IsIfModule(_mod) ((_mod > ARC_PDUR_LOIF_MODULES) && (_mod < ARC_PDUR_LOTP_MODULES))
\r
93 #define PduR_IsTpModule(_mod) ((_mod > ARC_PDUR_LOTP_MODULES) && (_mod < ARC_PDUR_END_OF_MODULES))
\r
94 #define PduR_IsLoModule(_mod) (PduR_IsIfModule(_mod) || PduR_IsTpModule(_mod))
\r
97 #if (PDUR_DEV_ERROR_DETECT == STD_ON)
\r
99 #define PDUR_DET_REPORTERROR(_x,_y,_z,_o) Det_ReportError(_x,_y,_z,_o)
\r
101 #define PDUR_VALIDATE_INITIALIZED(_api,...) \
\r
102 if ((PduRState == PDUR_UNINIT) || (PduRState == PDUR_REDUCED)) { \
\r
103 Det_ReportError(MODULE_ID_PDUR, PDUR_INSTANCE_ID, _api, PDUR_E_INVALID_REQUEST); \
\r
104 return __VA_ARGS__; \
\r
107 #define PDUR_VALIDATE_PDUPTR(_api, _pduPtr, ...) \
\r
108 if ((_pduPtr == NULL) && (PDUR_DEV_ERROR_DETECT)) { \
\r
109 Det_ReportError(MODULE_ID_PDUR, PDUR_INSTANCE_ID, _api, PDUR_E_DATA_PTR_INVALID); \
\r
110 return __VA_ARGS__; \
\r
113 #define PDUR_VALIDATE_PDUID(_api, _pduId, ...) \
\r
114 if ((_pduId >= PduRConfig->NRoutingPaths) && PDUR_DEV_ERROR_DETECT) { \
\r
115 Det_ReportError(MODULE_ID_PDUR, PDUR_INSTANCE_ID, _api, PDUR_E_PDU_ID_INVALID); \
\r
116 return __VA_ARGS__; \
\r
121 #define PDUR_DET_REPORTERROR(_x,_y,_z,_o)
\r
122 #define PDUR_VALIDATE_INITIALIZED(_api,...)
\r
123 #define PDUR_VALIDATE_PDUPTR(_api, _pduPtr, ...)
\r
124 #define PDUR_VALIDATE_PDUID(_api, _pduId, ...)
\r
128 Std_ReturnType PduR_CancelTransmitRequest(
\r
129 PduR_CancelReasonType PduCancelReason, PduIdType PduId);
\r
130 void PduR_ChangeParameterRequest(PduR_ParameterValueType PduParameterValue,
\r
133 /* Zero Cost Operation function definitions
\r
134 * These macros replaces the original functions if zero cost
\r
135 * operation is desired. */
\r
136 #if PDUR_ZERO_COST_OPERATION == STD_ON
\r
137 #define PduR_Init(...)
\r
138 #define PduR_GetVersionInfo(...)
\r
139 #define PduR_GetConfigurationId(...) 0
\r
141 #else // Not zero cost operation
\r
143 void PduR_Init(const PduR_PBConfigType* ConfigPtr);
\r
144 void PduR_GetVersionInfo(Std_VersionInfoType* versionInfo);
\r
145 uint32 PduR_GetConfigurationId(void);
\r
147 void PduR_BufferInc(PduRTxBuffer_type *Buffer, uint8 **ptr);
\r
148 void PduR_BufferQueue(PduRTxBuffer_type *Buffer, const uint8 * SduPtr);
\r
149 void PduR_BufferDeQueue(PduRTxBuffer_type *Buffer, uint8 *SduPtr);
\r
150 void PduR_BufferFlush(PduRTxBuffer_type *Buffer);
\r
151 uint8 PduR_BufferIsFull(PduRTxBuffer_type *Buffer);
\r
152 void PduR_LoIfRxIndication(PduIdType PduId, const uint8* SduPtr);
\r
153 void PduR_LoIfTxConfirmation(PduIdType PduId);
\r
154 void PduR_LoIfTriggerTransmit(PduIdType PduId, uint8* SduPtr);
\r
159 #define setTxConfP(_B) (_B->TxConfP = 1)
\r
160 #define clearTxConfP(_B) (_B->TxConfP = 0)
\r
164 #endif /* PDUR_H */
\r