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 1
\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_Com.h"
\r
52 #include "PduR_CanIf.h"
\r
53 #include "PduR_LinIf.h"
\r
54 #include "PduR_CanTp.h"
\r
55 #include "PduR_Dcm.h"
\r
59 /* Contain the current state of the PDU router. The router is uninitialized
\r
60 * until PduR_Init has been run.
\r
62 PduR_StateType PduRState; // 960, 31 LINT: Borde åtgärdas
\r
64 extern const PduR_PBConfigType *PduRConfig;
\r
67 #if (PDUR_DEV_ERROR_DETECT == STD_ON)
\r
69 #define PDUR_DET_REPORTERROR(_x,_y,_z,_q) Det_ReportError(_x,_y,_z,_q)
\r
71 // Define macro for state, parameter and data pointer checks.
\r
72 // TODO Implement data range check if needed.
\r
73 #define PduR_DevCheck(PduId,PduPtr,ApiId,...) \
\r
74 if ((PduRState == PDUR_UNINIT) || (PduRState == PDUR_REDUCED)) { \
\r
75 PDUR_DET_REPORTERROR(MODULE_ID_PDUR, PDUR_INSTANCE_ID, ApiId, PDUR_E_INVALID_REQUEST); \
\r
76 return __VA_ARGS__; \
\r
78 if ((PduPtr == 0) && (PDUR_DEV_ERROR_DETECT)) { \
\r
79 PDUR_DET_REPORTERROR(MODULE_ID_PDUR, PDUR_INSTANCE_ID, ApiId, PDUR_E_DATA_PTR_INVALID); \
\r
80 return __VA_ARGS__; \
\r
82 if ((PduId >= PduRConfig->PduRRoutingTable->NRoutingPaths) && PDUR_DEV_ERROR_DETECT) { \
\r
83 PDUR_DET_REPORTERROR(MODULE_ID_PDUR, PDUR_INSTANCE_ID, ApiId, PDUR_E_PDU_ID_INVALID); \
\r
84 return __VA_ARGS__; \
\r
89 #define PDUR_DET_REPORTERROR(_x,_y,_z,_q)
\r
90 #define PduR_DevCheck(...)
\r
94 Std_ReturnType PduR_CancelTransmitRequest(
\r
95 PduR_CancelReasonType PduCancelReason, PduIdType PduId);
\r
96 void PduR_ChangeParameterRequest(PduR_ParameterValueType PduParameterValue,
\r
99 /* Zero Cost Operation function definitions
\r
100 * These macros replaces the original functions if zero cost
\r
101 * operation is desired. */
\r
102 #if PDUR_ZERO_COST_OPERATION == STD_ON
\r
103 #define PduR_Init(...)
\r
104 #define PduR_GetVersionInfo(...)
\r
105 #define PduR_GetConfigurationId(...) 0
\r
107 #else // Not zero cost operation
\r
109 void PduR_Init(const PduR_PBConfigType* ConfigPtr);
\r
110 void PduR_GetVersionInfo(Std_VersionInfoType* versionInfo);
\r
111 uint32 PduR_GetConfigurationId(void);
\r
113 void PduR_BufferInc(PduRTxBuffer_type *Buffer, uint8 **ptr);
\r
114 void PduR_BufferQueue(PduRTxBuffer_type *Buffer, const uint8 * SduPtr);
\r
115 void PduR_BufferDeQueue(PduRTxBuffer_type *Buffer, uint8 *SduPtr);
\r
116 void PduR_BufferFlush(PduRTxBuffer_type *Buffer);
\r
117 uint8 PduR_BufferIsFull(PduRTxBuffer_type *Buffer);
\r
118 void PduR_LoIfRxIndication(PduIdType PduId, const uint8* SduPtr);
\r
119 void PduR_LoIfTxConfirmation(PduIdType PduId);
\r
120 void PduR_LoIfTriggerTransmit(PduIdType PduId, uint8* SduPtr);
\r
125 #define setTxConfP(R) R->PduRDestPdu.TxBufferRef->TxConfP = 1
\r
126 #define clearTxConfP(R) R->PduRDestPdu.TxBufferRef->TxConfP = 0
\r
130 extern PduR_FctPtrType PduR_StdCanFctPtrs;
\r
131 extern PduR_FctPtrType PduR_StdLinFctPtrs;
\r
133 #endif /* _PDUR_H_ */
\r