]> rtime.felk.cvut.cz Git - arc.git/blob - diagnostic/Dcm/Dcm_Internal.h
#ifdef:ed all Det includes
[arc.git] / diagnostic / Dcm / Dcm_Internal.h
1 /* -------------------------------- Arctic Core ------------------------------\r
2  * Arctic Core - the open source AUTOSAR platform http://arccore.com\r
3  *\r
4  * Copyright (C) 2009  ArcCore AB <contact@arccore.com>\r
5  *\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
9  *\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
13  * for more details.\r
14  * -------------------------------- Arctic Core ------------------------------*/\r
15 \r
16 /*\r
17  * NB! This file is for DCM internal use only and may only be included from DCM C-files!\r
18  */\r
19 \r
20 \r
21 \r
22 #ifndef DCM_INTERNAL_H_\r
23 #define DCM_INTERNAL_H_\r
24 \r
25 \r
26 #if  ( DCM_DEV_ERROR_DETECT == STD_ON )\r
27 #if defined(USE_DET)\r
28 #include "Det.h"\r
29 #endif\r
30 #define VALIDATE(_exp,_api,_err ) \\r
31         if( !(_exp) ) { \\r
32           Det_ReportError(MODULE_ID_DCM, 0, _api, _err); \\r
33           return E_NOT_OK; \\r
34         }\r
35 \r
36 #define VALIDATE_RV(_exp,_api,_err,_rv ) \\r
37         if( !(_exp) ) { \\r
38           Det_ReportError(MODULE_ID_DCM, 0, _api, _err); \\r
39           return _rv; \\r
40         }\r
41 \r
42 #define VALIDATE_NO_RV(_exp,_api,_err ) \\r
43   if( !(_exp) ) { \\r
44           Det_ReportError(MODULE_ID_DCM, 0, _api, _err); \\r
45           return; \\r
46         }\r
47 #define DET_REPORTERROR(_x,_y,_z,_q) Det_ReportError(_x, _y, _z, _q)\r
48 \r
49 #else\r
50 #define VALIDATE(_exp,_api,_err )\r
51 #define VALIDATE_RV(_exp,_api,_err,_rv )\r
52 #define VALIDATE_NO_RV(_exp,_api,_err )\r
53 #define DET_REPORTERROR(_x,_y,_z,_q)\r
54 #endif\r
55 \r
56 \r
57 // SID table\r
58 #define SID_DIAGNOSTIC_SESSION_CONTROL                  0x10\r
59 #define SID_ECU_RESET                                                   0x11\r
60 #define SID_CLEAR_DIAGNOSTIC_INFORMATION                0x14\r
61 #define SID_READ_DTC_INFORMATION                                0x19\r
62 #define SID_READ_DATA_BY_IDENTIFIER                             0x22\r
63 #define SID_READ_MEMORY_BY_ADDRESS                              0x23\r
64 #define SID_READ_SCALING_DATA_BY_IDENTIFIER             0x24\r
65 #define SID_SECURITY_ACCESS                                             0x27\r
66 #define SID_READ_DATA_BY_PERIODIC_IDENTIFIER    0x2A\r
67 #define SID_DYNAMICALLY_DEFINE_DATA_IDENTIFIER  0x2C\r
68 #define SID_WRITE_DATA_BY_IDENTIFIER                    0x2E\r
69 #define SID_INPUT_OUTPUT_CONTROL_BY_IDENTIFIER  0x2F\r
70 #define SID_ROUTINE_CONTROL                                             0x31\r
71 #define SID_WRITE_MEMORY_BY_ADDRESS                             0x3D\r
72 #define SID_TESTER_PRESENT                                              0x3E\r
73 #define SID_NEGATIVE_RESPONSE                                   0x7F\r
74 #define SID_CONTROL_DTC_SETTING                                 0x85\r
75 \r
76 // Misc definitions\r
77 #define SUPPRESS_POS_RESP_BIT           (uint8)0x80\r
78 #define SID_RESPONSE_BIT                        (uint8)0x40\r
79 #define VALUE_IS_NOT_USED                       (uint8)0x00\r
80 \r
81 typedef enum {\r
82         DSD_TX_RESPONSE_READY,\r
83         DSD_TX_RESPONSE_SUPPRESSED\r
84 } DsdProcessingDoneResultType;\r
85 \r
86 /*\r
87  * DSP\r
88  */\r
89 void DspInit(void);\r
90 void DspMain(void);\r
91 void DspUdsDiagnosticSessionControl(const PduInfoType *pduRxData, PduIdType txPduId, PduInfoType *pduTxData);\r
92 void DspUdsEcuReset(const PduInfoType *pduRxData, PduIdType txPduId, PduInfoType *pduTxData);\r
93 void DspUdsClearDiagnosticInformation(const PduInfoType *pduRxData, PduInfoType *pduTxData);\r
94 void DspUdsSecurityAccess(const PduInfoType *pduRxData, PduInfoType *pduTxData);\r
95 void DspUdsTesterPresent(const PduInfoType *pduRxData, PduInfoType *pduTxData);\r
96 void DspUdsReadDtcInformation(const PduInfoType *pduRxData, PduInfoType *pduTxData);\r
97 void DspUdsReadDataByIdentifier(const PduInfoType *pduRxData, PduInfoType *pduTxData);\r
98 void DspUdsReadScalingDataByIdentifier(const PduInfoType *pduRxData, PduInfoType *pduTxData);\r
99 void DspUdsWriteDataByIdentifier(const PduInfoType *pduRxData, PduInfoType *pduTxData);\r
100 void DspUdsControlDtcSetting(const PduInfoType *pduRxData, PduInfoType *pduTxData);\r
101 void DspUdsRoutineControl(const PduInfoType *pduRxData, PduInfoType *pduTxData);\r
102 void DspDcmConfirmation(PduIdType confirmPduId);\r
103 void DspUdsReadMemoryByAddress(const PduInfoType *pduRxData, PduInfoType *pduTxData);\r
104 void DspUdsWriteMemoryByAddress(const PduInfoType *pduRxData, PduInfoType *pduTxData);\r
105 void DspReadDataByPeriodicIdentifier(const PduInfoType *pduRxData,PduInfoType *pduTxData);\r
106 void DspDynamicallyDefineDataIdentifier(const PduInfoType *pduRxData,PduInfoType *pduTxData);\r
107 void DspIOControlByDataIdentifier(const PduInfoType *pduRxData,PduInfoType *pduTxData);\r
108 boolean DspCheckSessionLevel(Dcm_DspSessionRowType const* const* sessionLevelRefTable);\r
109 boolean DspCheckSecurityLevel(Dcm_DspSecurityRowType const* const* securityLevelRefTable);\r
110 void DspCancelPendingRequests(void);\r
111 \r
112 /*\r
113  * DSD\r
114  */\r
115 void DsdInit(void);\r
116 void DsdMain(void);\r
117 void DsdHandleRequest(void);\r
118 void DsdDspProcessingDone(Dcm_NegativeResponseCodeType responseCode);\r
119 void DsdDataConfirmation(PduIdType confirmPduId, NotifResultType result);\r
120 void DsdDslDataIndication(const PduInfoType *pduRxData, const Dcm_DsdServiceTableType *protocolSIDTable, Dcm_ProtocolAddrTypeType addrType, PduIdType txPduId, PduInfoType *pduTxData, PduIdType rxContextPduId);\r
121 \r
122 \r
123 /*\r
124  * DSL\r
125  */\r
126 void DslInit(void);\r
127 void DslMain(void);\r
128 void DslHandleResponseTransmission(void);\r
129 void DslDsdProcessingDone(PduIdType rxPduIdRef, DsdProcessingDoneResultType responseResult);\r
130 void DslGetCurrentServiceTable(const Dcm_DsdServiceTableType **currentServiceTable);\r
131 \r
132 BufReq_ReturnType DslProvideRxBufferToPdur(PduIdType dcmRxPduId, PduLengthType tpSduLength, const PduInfoType **pduInfoPtr);\r
133 void DslRxIndicationFromPduR(PduIdType dcmRxPduId, NotifResultType result);\r
134 Std_ReturnType DslGetActiveProtocol(Dcm_ProtocolType *protocolId);\r
135 void DslSetSecurityLevel(Dcm_SecLevelType secLevel);\r
136 Std_ReturnType DslGetSecurityLevel(Dcm_SecLevelType *secLevel);\r
137 void DslSetSesCtrlType(Dcm_SesCtrlType sesCtrl);\r
138 Std_ReturnType DslGetSesCtrlType(Dcm_SesCtrlType *sesCtrlType);\r
139 BufReq_ReturnType DslProvideTxBuffer(PduIdType dcmTxPduId, const PduInfoType **pduInfoPtr, PduLengthType length);\r
140 void DslTxConfirmation(PduIdType dcmTxPduId, NotifResultType result);\r
141 Std_ReturnType DslInternal_ResponseOnOneDataByPeriodicId(uint8 PericodID);\r
142 void DslResetSessionTimeoutTimer(void);\r
143 \r
144 \r
145 \r
146 #endif /* DCM_INTERNAL_H_ */\r