]> rtime.felk.cvut.cz Git - arc.git/commitdiff
Changed parameter passing between DSL, DSD and DSP.
authorpete <devnull@localhost>
Tue, 30 Mar 2010 08:41:00 +0000 (10:41 +0200)
committerpete <devnull@localhost>
Tue, 30 Mar 2010 08:41:00 +0000 (10:41 +0200)
diagnostic/Dcm/Dcm_Dsd.c
diagnostic/Dcm/Dcm_Dsl.c
diagnostic/Dcm/Dcm_Dsp.c
diagnostic/Dcm/Dcm_Internal.h

index 94c477c6aa08df9fa23bb2f519195d1d81a4a5a3..6c8f4d17c4cbd6d6832da740c8c19683b335d9e5 100644 (file)
 #include "Det.h"\r
 #include "MemMap.h"\r
 \r
+typedef struct {\r
+       const PduInfoType                               *pduRxData;\r
+       PduInfoType                                     *pduTxData;\r
+       const Dcm_DsdServiceTableType   *serviceTable;\r
+       Dcm_ProtocolAddrTypeType                addrType;\r
+       PduIdType                                               txPduId;\r
+} MsgDataType;\r
+\r
 // In "queue" to DSD\r
 static boolean dsdDslDataIndication = FALSE;\r
+static MsgDataType msgData;\r
 \r
-\r
-static uint8 currentSid;\r
+static uint8   currentSid;\r
+static boolean suppressPosRspMsg;\r
 \r
 void DsdInit(void)\r
 {\r
@@ -46,14 +55,12 @@ void DsdMain(void)
 boolean DsdLookupSid(uint8 sid, Dcm_DsdServiceType **sidPtr)\r
 {\r
        boolean returnStatus = TRUE;\r
-       Dcm_DsdServiceTableType *currentServiceTable;\r
        uint16 i;\r
 \r
-       DslGetCurrentServiceTable(&currentServiceTable);\r
-       for (i = 0; (currentServiceTable->DsdService[i].DsdSidTabServiceId != sid) && !currentServiceTable->DsdService[i].Arc_EOL; i++);\r
+       for (i = 0; (msgData.serviceTable->DsdService[i].DsdSidTabServiceId != sid) && !msgData.serviceTable->DsdService[i].Arc_EOL; i++);\r
 \r
-       if (!currentServiceTable->DsdService[i].Arc_EOL) {\r
-               *sidPtr = (Dcm_DsdServiceType*)&currentServiceTable->DsdService[i];\r
+       if (!msgData.serviceTable->DsdService[i].Arc_EOL) {\r
+               *sidPtr = (Dcm_DsdServiceType*)&msgData.serviceTable->DsdService[i];\r
        }\r
        else {\r
                returnStatus = FALSE;\r
@@ -119,19 +126,19 @@ void DsdSelectServiceFunction(uint8 sid)
        switch (sid)     /** @req DCM221 **/\r
        {\r
        case SID_DIAGNOSTIC_SESSION_CONTROL:\r
-               DspUdsDiagnosticSessionControl();\r
+               DspUdsDiagnosticSessionControl(msgData.pduRxData, msgData.pduTxData);\r
                break;\r
 \r
        case SID_ECU_RESET:\r
-               DspUdsEcuReset();\r
+               DspUdsEcuReset(msgData.pduRxData, msgData.txPduId, msgData.pduTxData);\r
                break;\r
 \r
        case SID_CLEAR_DIAGNOSTIC_INFORMATION:\r
-               DspUdsClearDiagnosticInformation();\r
+               DspUdsClearDiagnosticInformation(msgData.pduRxData, msgData.pduTxData);\r
                break;\r
 \r
        case SID_READ_DTC_INFORMATION:\r
-               DspUdsReadDtcInformation();\r
+               DspUdsReadDtcInformation(msgData.pduRxData, msgData.pduTxData);\r
                break;\r
 \r
        case SID_READ_DATA_BY_IDENTIFIER:\r
@@ -141,7 +148,7 @@ void DsdSelectServiceFunction(uint8 sid)
                break;\r
 \r
        case SID_SECURITY_ACCESS:\r
-               DspUdsSecurityAccess();\r
+               DspUdsSecurityAccess(msgData.pduRxData, msgData.pduTxData);\r
                break;\r
 \r
        case SID_READ_DATA_BY_PERIODIC_IDENTIFIER:\r
@@ -160,11 +167,11 @@ void DsdSelectServiceFunction(uint8 sid)
                break;\r
 \r
        case SID_TESTER_PRESENT:\r
-               DspUdsTesterPresent();\r
+               DspUdsTesterPresent(msgData.pduRxData, msgData.pduTxData);\r
                break;\r
 \r
        case SID_CONTROL_DTC_SETTING:\r
-               DspUdsControlDtcSetting();\r
+               DspUdsControlDtcSetting(msgData.pduRxData, msgData.pduTxData);\r
                break;\r
 \r
        default:\r
@@ -175,12 +182,12 @@ void DsdSelectServiceFunction(uint8 sid)
 \r
 void DsdCreateAndSendNcr(Dcm_NegativeResponseCodeType responseCode)\r
 {\r
-       if (!(((dslMsgData.activePduId == DCM_PDU_ID_UDS_FUNC_RX) || (dslMsgData.activePduId == DCM_PDU_ID_OBD_FUNC_RX))\r
+       if (!((msgData.addrType == DCM_PROTOCOL_FUNCTIONAL_ADDR_TYPE)\r
                  && ((responseCode == DCM_E_SERVICENOTSUPPORTED) || (responseCode == DCM_E_SUBFUNCTIONNOTSUPPORTED) || (responseCode == DCM_E_REQUESTOUTOFRANGE)))) {   /** @req DCM001 **/\r
-               dslMsgData.pduTxData->SduDataPtr[0] = SID_NEGATIVE_RESPONSE;\r
-               dslMsgData.pduTxData->SduDataPtr[1] = currentSid;\r
-               dslMsgData.pduTxData->SduDataPtr[2] = responseCode;\r
-               dslMsgData.pduTxData->SduLength = 3;\r
+               msgData.pduTxData->SduDataPtr[0] = SID_NEGATIVE_RESPONSE;\r
+               msgData.pduTxData->SduDataPtr[1] = currentSid;\r
+               msgData.pduTxData->SduDataPtr[2] = responseCode;\r
+               msgData.pduTxData->SduLength = 3;\r
                DslDsdPduTransmit();    /** @req DCM114 **/ /** @req DCM232.1 **/\r
        }\r
        else {\r
@@ -195,26 +202,26 @@ void DsdHandleRequest(void)
        Dcm_DsdServiceType *sidConfPtr = NULL;\r
 \r
        /** @req DCM178 **/\r
-       if (DCM_RESPOND_ALL_REQUEST || ((dslMsgData.pduRxData->SduDataPtr[0] & 0x7F) < 0x40)) {         /** @req DCM084 **/\r
-               if (DsdLookupSid(dslMsgData.pduRxData->SduDataPtr[0], &sidConfPtr)) {           /** @req DCM192 **/ /** @req DCM193 **/ /** @req DCM196 **/\r
+       if (DCM_RESPOND_ALL_REQUEST || ((msgData.pduRxData->SduDataPtr[0] & 0x7F) < 0x40)) {            /** @req DCM084 **/\r
+               if (DsdLookupSid(msgData.pduRxData->SduDataPtr[0], &sidConfPtr)) {              /** @req DCM192 **/ /** @req DCM193 **/ /** @req DCM196 **/\r
                        // SID found!\r
                        if (DsdCheckSessionLevel(sidConfPtr->DsdSidTabSessionLevelRef) || (sidConfPtr->DsdSidTabServiceId == SID_DIAGNOSTIC_SESSION_CONTROL)) {          /** @req DCM211 **/\r
                                if (DsdCheckSecurityLevel(sidConfPtr->DsdSidTabSecurityLevelRef)) {      /** @req DCM217 **/\r
                                        if (DCM_REQUEST_INDICATION_ENABLED) {    /** @req DCM218 **/\r
-                                                result = DsdAskApplicationForServicePermission(dslMsgData.pduRxData->SduDataPtr, dslMsgData.pduRxData->SduLength);\r
+                                                result = DsdAskApplicationForServicePermission(msgData.pduRxData->SduDataPtr, msgData.pduRxData->SduLength);\r
                                        }\r
                                        if (!DCM_REQUEST_INDICATION_ENABLED || result == E_OK) {\r
                                                // Yes! All conditions met!\r
-                                               currentSid = dslMsgData.pduRxData->SduDataPtr[0];       /** @req DCM198 **/\r
+                                               currentSid = msgData.pduRxData->SduDataPtr[0];  /** @req DCM198 **/\r
 \r
                                                // Check if response shall be suppressed\r
-                                               if (sidConfPtr->DsdSidTabSubfuncAvail && (dslMsgData.pduRxData->SduDataPtr[1] & SUPPRESS_POS_RESP_BIT)) {       /** @req DCM204 **/\r
-                                                       dslMsgData.suppressPosRspMsg = TRUE;    /** @req DCM202 **/\r
-                                                       dslMsgData.pduRxData->SduDataPtr[1] &= ~SUPPRESS_POS_RESP_BIT;  /** @req DCM201 **/\r
+                                               if (sidConfPtr->DsdSidTabSubfuncAvail && (msgData.pduRxData->SduDataPtr[1] & SUPPRESS_POS_RESP_BIT)) {  /** @req DCM204 **/\r
+                                                       suppressPosRspMsg = TRUE;       /** @req DCM202 **/\r
+                                                       msgData.pduRxData->SduDataPtr[1] &= ~SUPPRESS_POS_RESP_BIT;     /** @req DCM201 **/\r
                                                }\r
                                                else\r
                                                {\r
-                                                       dslMsgData.suppressPosRspMsg = FALSE;   /** @req DCM202 **/\r
+                                                       suppressPosRspMsg = FALSE;      /** @req DCM202 **/\r
                                                }\r
                                                DsdSelectServiceFunction(currentSid);\r
                                        }\r
@@ -248,13 +255,13 @@ void DsdHandleRequest(void)
 void DsdDspProcessingDone(Dcm_NegativeResponseCodeType responseCode)\r
 {\r
        if (responseCode == DCM_E_POSITIVERESPONSE) {\r
-               if (!dslMsgData.suppressPosRspMsg) {    /** @req DCM200 **/ /** @req DCM231 **/\r
+               if (!suppressPosRspMsg) {       /** @req DCM200 **/ /** @req DCM231 **/\r
                        /** @req DCM222 **/\r
-                       dslMsgData.pduTxData->SduDataPtr[0] = currentSid | SID_RESPONSE_BIT;    /** @req DCM223 **/ /** @req DCM224 **/\r
+                       msgData.pduTxData->SduDataPtr[0] = currentSid | SID_RESPONSE_BIT;       /** @req DCM223 **/ /** @req DCM224 **/\r
                        DslDsdPduTransmit();    /** @req DCM114 **/ /** @req DCM225 **/ /** @req DCM232.2 **/\r
                }\r
                else {\r
-                       DspDcmConfirmation(dslMsgData.activePduId);     /** @req DCM236 **/ /** @req DCM240 **/\r
+                       DspDcmConfirmation(msgData.txPduId);    /** @req DCM236 **/ /** @req DCM240 **/\r
                        DslResponseSuppressed();\r
                }\r
        }\r
@@ -271,8 +278,13 @@ void DsdDataConfirmation(PduIdType confirmPduId)
 }\r
 \r
 \r
-void DsdDslDataIndication(void)\r
+void DsdDslDataIndication(const PduInfoType *pduRxData, const Dcm_DsdServiceTableType *protocolSIDTable, Dcm_ProtocolAddrTypeType addrType, PduIdType txPduId, PduInfoType *pduTxData)\r
 {\r
+       msgData.txPduId = txPduId;\r
+       msgData.pduRxData = pduRxData;\r
+       msgData.pduTxData = pduTxData;\r
+       msgData.addrType = addrType;\r
+       msgData.serviceTable = protocolSIDTable;\r
+\r
        dsdDslDataIndication = TRUE;\r
 }\r
-\r
index e851ab0c13a6aa9a7ea98be2b30c9d19656d3756..fb87ec4a302c016291d68652d4fa937c1bd7dd9a 100644 (file)
@@ -40,7 +40,9 @@ typedef struct {
 \r
 PduIdProtocolCrossRefListType PduIdProtocolCrossRefList[MAX_NR_OF_PDUID];\r
 \r
-DslMsgDataType dslMsgData;\r
+PduIdType      activePduId;\r
+PduInfoType *pduRxData;\r
+PduInfoType *pduTxData;\r
 \r
 // Setup buffers\r
 static uint8 udsFuncRxBuffer[DCM_UDS_FUNC_RX_BUFFER_SIZE];\r
@@ -80,7 +82,7 @@ static PduInfoType *txBufferPointer = NULL;
 static boolean dslDsdPduTransmit = FALSE;\r
 \r
 // Global service table, set by DSL used by DSD\r
-Dcm_DsdServiceTableType *DslCurrentServiceTable = NULL;\r
+//Dcm_DsdServiceTableType *DslCurrentServiceTable = NULL;\r
 \r
 \r
 void DslInit(void)\r
@@ -88,9 +90,9 @@ void DslInit(void)
        const Dcm_DslProtocolType *dslProtocol = DCM_Config.Dsl->DslProtocol;\r
        uint16 i;\r
 \r
-       dslMsgData.activePduId = DCM_PDU_ID_NONE;\r
-       dslMsgData.pduRxData = NULL;\r
-       dslMsgData.pduTxData = NULL;\r
+       activePduId = DCM_PDU_ID_NONE;\r
+       pduRxData = NULL;\r
+       pduTxData = NULL;\r
 \r
        activeProtocol = NULL;\r
        securityLevel = DCM_SEC_LEV_LOCKED;             /** @req DCM033 **/\r
@@ -134,12 +136,6 @@ void DslResetSessionTimeoutTimer(void)
 }\r
 \r
 \r
-void DslGetCurrentServiceTable(Dcm_DsdServiceTableType **currentServiceTable)\r
-{\r
-       *currentServiceTable = DslCurrentServiceTable;\r
-}\r
-\r
-\r
 boolean DslCheckIfOkToStartProtocol(Dcm_ProtocolType protocolId)\r
 {\r
        boolean returnCode = TRUE;\r
@@ -163,7 +159,7 @@ BufReq_ReturnType DslProvideRxBuffer(PduIdType dcmRxPduId, PduLengthType tpSduLe
 \r
        *pduInfoPtr = NULL;\r
 \r
-       if (dcmRxPduId != dslMsgData.activePduId) {\r
+       if (dcmRxPduId != activePduId) {\r
                switch (dcmRxPduId)\r
                {\r
                case DCM_PDU_ID_UDS_FUNC_RX:\r
@@ -216,7 +212,7 @@ void DslRxIndication(PduIdType dcmRxPduId, NotifResultType result)
                                DslResetSessionTimeoutTimer();  /** @req DCM112 **/ /** @req DCM113 **/\r
                        }\r
                        else {\r
-                               if (dslMsgData.activePduId == DCM_PDU_ID_NONE) {        /** @req DCM241 **/\r
+                               if (activePduId == DCM_PDU_ID_NONE) {   /** @req DCM241 **/\r
                                        if (activeProtocol != protocolUdsOnCan) {\r
                                                if (DslCheckIfOkToStartProtocol(DCM_UDS_ON_CAN)) {              /** @req DCM036 **/\r
                                                        // TODO: Set default timing parameters (Dcm144)\r
@@ -224,7 +220,7 @@ void DslRxIndication(PduIdType dcmRxPduId, NotifResultType result)
                                                        activeProtocolId = DCM_UDS_ON_CAN;\r
                                                        securityLevel = DCM_SEC_LEV_LOCKED;             /** @req DCM146 **/\r
                                                        sessionControlType = DCM_DEFAULT_SESSION;       /** @req147 **/\r
-                                                       DslCurrentServiceTable = (Dcm_DsdServiceTableType*)activeProtocol->DslProtocolSIDTable; /** @req DCM195 **/ /** @req DCM035 **/ /** @req DCM145 **/\r
+//                                                     DslCurrentServiceTable = (Dcm_DsdServiceTableType*)activeProtocol->DslProtocolSIDTable; /** @req DCM195 **/ /** @req DCM035 **/ /** @req DCM145 **/\r
                                                }\r
                                                else {\r
                                                        // Protocol was not allowed to start\r
@@ -232,25 +228,26 @@ void DslRxIndication(PduIdType dcmRxPduId, NotifResultType result)
                                                        break;\r
                                                }\r
                                        }\r
-                                       dslMsgData.activePduId = dcmRxPduId;\r
+                                       activePduId = dcmRxPduId;\r
                                        // TODO: Start the response pending timer\r
                                        // Forward message to DSD\r
-                                       dslMsgData.pduRxData = &udsFuncRxPduInfo;\r
-                                       dslMsgData.pduTxData = &physPduInfo;\r
-                                       DsdDslDataIndication();\r
+                                       pduRxData = &udsFuncRxPduInfo;\r
+                                       pduTxData = &physPduInfo;\r
+//                                     DsdDslDataIndication();\r
+                                       DsdDslDataIndication(&udsFuncRxPduInfo, activeProtocol->DslProtocolSIDTable, DCM_PROTOCOL_FUNCTIONAL_ADDR_TYPE, DCM_PDU_ID_UDS_FUNC_RX, &physPduInfo);\r
                                }\r
                        }\r
                        break;\r
 \r
                case DCM_PDU_ID_UDS_PHYS_RX:\r
-                       if (dslMsgData.activePduId == DCM_PDU_ID_NONE) {        /** @req DCM241 **/\r
+                       if (activePduId == DCM_PDU_ID_NONE) {   /** @req DCM241 **/\r
                                if (activeProtocol != protocolUdsOnCan) {\r
                                        if (DslCheckIfOkToStartProtocol(DCM_UDS_ON_CAN)) {              /** @req DCM036 **/\r
                                                activeProtocol = protocolUdsOnCan;\r
                                                activeProtocolId = DCM_UDS_ON_CAN;\r
                                                securityLevel = DCM_SEC_LEV_LOCKED;             /** @req DCM146 **/\r
                                                sessionControlType = DCM_DEFAULT_SESSION;       /** @req147 **/\r
-                                               DslCurrentServiceTable = (Dcm_DsdServiceTableType*)activeProtocol->DslProtocolSIDTable; /** @req DCM195 **/ /** @req DCM035 **/ /** @req DCM145 **/\r
+//                                             DslCurrentServiceTable = (Dcm_DsdServiceTableType*)activeProtocol->DslProtocolSIDTable; /** @req DCM195 **/ /** @req DCM035 **/ /** @req DCM145 **/\r
                                        }\r
                                        else {\r
                                                // Protocol was not allowed to start\r
@@ -258,12 +255,13 @@ void DslRxIndication(PduIdType dcmRxPduId, NotifResultType result)
                                                break;\r
                                        }\r
                                }\r
-                               dslMsgData.activePduId = dcmRxPduId;\r
+                               activePduId = dcmRxPduId;\r
                                // TODO: Start the response pending timer\r
                                // Forward message to DSD\r
-                               dslMsgData.pduRxData = &physPduInfo;\r
-                               dslMsgData.pduTxData = &physPduInfo;\r
-                               DsdDslDataIndication();\r
+                               pduRxData = &physPduInfo;\r
+                               pduTxData = &physPduInfo;\r
+//                             DsdDslDataIndication();\r
+                               DsdDslDataIndication(&physPduInfo, activeProtocol->DslProtocolSIDTable, DCM_PROTOCOL_PHYSICAL_ADDR_TYPE, DCM_PDU_ID_UDS_PHYS_RX, &physPduInfo);\r
                        }\r
                        break;\r
 \r
@@ -328,7 +326,7 @@ Std_ReturnType DslGetSesCtrlType(Dcm_SesCtrlType *sesCtrlType)
 \r
 void DslHandleResponseTransmission(void)\r
 {\r
-       switch (dslMsgData.activePduId)\r
+       switch (activePduId)\r
        {\r
        case DCM_PDU_ID_UDS_FUNC_RX:\r
        case DCM_PDU_ID_UDS_PHYS_RX:\r
@@ -344,8 +342,8 @@ void DslHandleResponseTransmission(void)
                break;\r
        }\r
 \r
-       if (pduTxId != DCM_PDU_ID_NONE && dslMsgData.pduTxData != NULL) {\r
-               txBufferPointer = dslMsgData.pduTxData;         // Save this for the Dcm_ProvideTxBuffer call\r
+       if (pduTxId != DCM_PDU_ID_NONE && pduTxData != NULL) {\r
+               txBufferPointer = pduTxData;            // Save this for the Dcm_ProvideTxBuffer call\r
                Pdur_DcmTransmit(pduTxId, txBufferPointer);     /** @req DCM237 **/\r
        }\r
        else {\r
@@ -375,9 +373,9 @@ void DslTxConfirmation(PduIdType dcmTxPduId, NotifResultType result)
 {\r
        if (result == NTFRSLT_OK) {\r
                // Lets clean up\r
-               dslMsgData.activePduId = DCM_PDU_ID_NONE;\r
-               dslMsgData.pduRxData = NULL;\r
-               dslMsgData.pduTxData = NULL;\r
+               activePduId = DCM_PDU_ID_NONE;\r
+               pduRxData = NULL;\r
+               pduTxData = NULL;\r
 \r
                pduTxId = DCM_PDU_ID_NONE;\r
                txBufferPointer = NULL;\r
@@ -394,9 +392,9 @@ void DslTxConfirmation(PduIdType dcmTxPduId, NotifResultType result)
 void DslResponseSuppressed(void)\r
 {\r
        // Lets clean up\r
-       dslMsgData.activePduId = DCM_PDU_ID_NONE;\r
-       dslMsgData.pduRxData = NULL;\r
-       dslMsgData.pduTxData = NULL;\r
+       activePduId = DCM_PDU_ID_NONE;\r
+       pduRxData = NULL;\r
+       pduTxData = NULL;\r
 \r
        pduTxId = DCM_PDU_ID_NONE;\r
        txBufferPointer = NULL;\r
index 101e5dc0123fb3770070bcc81033d7db52c01100..26f7df7c7237ff5c896f08233035f0c44f1f0f32 100644 (file)
@@ -34,6 +34,7 @@
 #define DTC_MID_BYTE(dtc)                      (((dtc)>> 8) & 0xFF)\r
 #define DTC_LOW_BYTE(dtc)                      ((dtc) & 0xFF)\r
 \r
+\r
 typedef struct {\r
        boolean resetPending;\r
        PduIdType resetPduId;\r
@@ -85,15 +86,15 @@ Std_ReturnType AskApplicationForSessionPermission(Dcm_SesCtrlType newSessionLeve
 }\r
 \r
 \r
-void DspUdsDiagnosticSessionControl(void)\r
+void DspUdsDiagnosticSessionControl(const PduInfoType *pduRxData, PduInfoType *pduTxData)\r
 {\r
        // @req DCM250 **/\r
        Dcm_SesCtrlType reqSessionType;\r
        Std_ReturnType result;\r
        uint16  i;\r
 \r
-       if (dslMsgData.pduRxData->SduLength == 2) {\r
-               reqSessionType = dslMsgData.pduRxData->SduDataPtr[1];\r
+       if (pduRxData->SduLength == 2) {\r
+               reqSessionType = pduRxData->SduDataPtr[1];\r
                // Check if type exist in session table\r
                for (i = 0; (DCM_Config.Dsp->DspSession->DspSessionRow[i].DspSessionLevel != reqSessionType) && !DCM_Config.Dsp->DspSession->DspSessionRow[i].Arc_EOL;i++);\r
 \r
@@ -103,8 +104,8 @@ void DspUdsDiagnosticSessionControl(void)
                                DslSetSesCtrlType(reqSessionType);              /** @req DCM311 **/\r
                                // Create positive response\r
                                /** @req DCM039.2 **/\r
-                               dslMsgData.pduTxData->SduDataPtr[1] = reqSessionType;\r
-                               dslMsgData.pduTxData->SduLength = 2;\r
+                               pduTxData->SduDataPtr[1] = reqSessionType;\r
+                               pduTxData->SduLength = 2;\r
                                DsdDspProcessingDone(DCM_E_POSITIVERESPONSE); /** @req DCM269.2 **/\r
                        }\r
                        else {\r
@@ -123,13 +124,13 @@ void DspUdsDiagnosticSessionControl(void)
 }\r
 \r
 \r
-void DspUdsEcuReset(void)\r
+void DspUdsEcuReset(const PduInfoType *pduRxData, PduIdType txPduId, PduInfoType *pduTxData)\r
 {\r
        // @req DCM260 **/\r
        uint8 reqResetType;\r
 \r
-       if (dslMsgData.pduRxData->SduLength == 2) {\r
-               reqResetType = dslMsgData.pduRxData->SduDataPtr[1];\r
+       if (pduRxData->SduLength == 2) {\r
+               reqResetType = pduRxData->SduDataPtr[1];\r
 \r
                switch (reqResetType)\r
                {\r
@@ -138,12 +139,12 @@ void DspUdsEcuReset(void)
 \r
                        // Schedule the reset\r
                        dspUdsEcuResetData.resetPending = TRUE;\r
-                       dspUdsEcuResetData.resetPduId = DCM_PDU_ID_UDS_TX;\r
+                       dspUdsEcuResetData.resetPduId = txPduId;\r
 \r
                        // Create positive response\r
                        /** @req DCM039.1 **/\r
-                       dslMsgData.pduTxData->SduDataPtr[1] = reqResetType;\r
-                       dslMsgData.pduTxData->SduLength = 2;\r
+                       pduTxData->SduDataPtr[1] = reqResetType;\r
+                       pduTxData->SduLength = 2;\r
                        DsdDspProcessingDone(DCM_E_POSITIVERESPONSE); /** @req DCM269.3 **/\r
                        break;\r
 \r
@@ -159,13 +160,13 @@ void DspUdsEcuReset(void)
 }\r
 \r
 \r
-void DspUdsClearDiagnosticInformation(void)\r
+void DspUdsClearDiagnosticInformation(const PduInfoType *pduRxData, PduInfoType *pduTxData)\r
 {\r
        uint32 dtc;\r
        Dem_ReturnClearDTCType result;\r
 \r
-       if (dslMsgData.pduRxData->SduLength == 4) {\r
-               dtc = BYTES_TO_DTC(dslMsgData.pduRxData->SduDataPtr[1], dslMsgData.pduRxData->SduDataPtr[2], dslMsgData.pduRxData->SduDataPtr[3]);\r
+       if (pduRxData->SduLength == 4) {\r
+               dtc = BYTES_TO_DTC(pduRxData->SduDataPtr[1], pduRxData->SduDataPtr[2], pduRxData->SduDataPtr[3]);\r
 \r
                result = Dem_ClearDTC(dtc, DEM_DTC_KIND_ALL_DTCS, DEM_DTC_ORIGIN_PRIMARY_MEMORY);\r
 \r
@@ -174,7 +175,7 @@ void DspUdsClearDiagnosticInformation(void)
                case DEM_CLEAR_OK:\r
                        // Create positive response\r
                        /** @req DCM039.1 **/\r
-                       dslMsgData.pduTxData->SduLength = 1;\r
+                       pduTxData->SduLength = 1;\r
                        DsdDspProcessingDone(DCM_E_POSITIVERESPONSE); /** @req DCM269.4 **/\r
                        break;\r
 \r
@@ -190,7 +191,7 @@ void DspUdsClearDiagnosticInformation(void)
 }\r
 \r
 \r
-Dcm_NegativeResponseCodeType DspUdsReadDtcInfoSub_0x01_0x07_0x11_0x12(void)\r
+Dcm_NegativeResponseCodeType DspUdsReadDtcInfoSub_0x01_0x07_0x11_0x12(const PduInfoType *pduRxData, PduInfoType *pduTxData)\r
 {\r
        typedef struct {\r
                uint8           SID;\r
@@ -205,22 +206,22 @@ Dcm_NegativeResponseCodeType DspUdsReadDtcInfoSub_0x01_0x07_0x11_0x12(void)
        Dem_ReturnSetDTCFilterType setDtcFilterResult;\r
 \r
        // Setup the DTC filter\r
-       switch (dslMsgData.pduRxData->SduDataPtr[1])    /** @reg DCM293 **/\r
+       switch (pduRxData->SduDataPtr[1])       /** @reg DCM293 **/\r
        {\r
        case 0x01:      // reportNumberOfDTCByStatusMask\r
-               setDtcFilterResult = Dem_SetDTCFilter(dslMsgData.pduRxData->SduDataPtr[2], DEM_DTC_KIND_ALL_DTCS, DEM_DTC_ORIGIN_PRIMARY_MEMORY, DEM_FILTER_WITH_SEVERITY_NO, VALUE_IS_NOT_USED, DEM_FILTER_FOR_FDC_NO);\r
+               setDtcFilterResult = Dem_SetDTCFilter(pduRxData->SduDataPtr[2], DEM_DTC_KIND_ALL_DTCS, DEM_DTC_ORIGIN_PRIMARY_MEMORY, DEM_FILTER_WITH_SEVERITY_NO, VALUE_IS_NOT_USED, DEM_FILTER_FOR_FDC_NO);\r
                break;\r
 \r
        case 0x07:      // reportNumberOfDTCBySeverityMaskRecord\r
-               setDtcFilterResult = Dem_SetDTCFilter(dslMsgData.pduRxData->SduDataPtr[3], DEM_DTC_KIND_ALL_DTCS, DEM_DTC_ORIGIN_PRIMARY_MEMORY, DEM_FILTER_WITH_SEVERITY_YES, dslMsgData.pduRxData->SduDataPtr[2], DEM_FILTER_FOR_FDC_NO);\r
+               setDtcFilterResult = Dem_SetDTCFilter(pduRxData->SduDataPtr[3], DEM_DTC_KIND_ALL_DTCS, DEM_DTC_ORIGIN_PRIMARY_MEMORY, DEM_FILTER_WITH_SEVERITY_YES, pduRxData->SduDataPtr[2], DEM_FILTER_FOR_FDC_NO);\r
                break;\r
 \r
        case 0x11:      // reportNumberOfMirrorMemoryDTCByStatusMask\r
-               setDtcFilterResult = Dem_SetDTCFilter(dslMsgData.pduRxData->SduDataPtr[2], DEM_DTC_KIND_ALL_DTCS, DEM_DTC_ORIGIN_MIRROR_MEMORY, DEM_FILTER_WITH_SEVERITY_NO, VALUE_IS_NOT_USED, DEM_FILTER_FOR_FDC_NO);\r
+               setDtcFilterResult = Dem_SetDTCFilter(pduRxData->SduDataPtr[2], DEM_DTC_KIND_ALL_DTCS, DEM_DTC_ORIGIN_MIRROR_MEMORY, DEM_FILTER_WITH_SEVERITY_NO, VALUE_IS_NOT_USED, DEM_FILTER_FOR_FDC_NO);\r
                break;\r
 \r
        case 0x12:      // reportNumberOfEmissionRelatedOBDDTCByStatusMask\r
-               setDtcFilterResult = Dem_SetDTCFilter(dslMsgData.pduRxData->SduDataPtr[2], DEM_DTC_KIND_EMISSON_REL_DTCS, DEM_DTC_ORIGIN_PRIMARY_MEMORY, DEM_FILTER_WITH_SEVERITY_NO, VALUE_IS_NOT_USED, DEM_FILTER_FOR_FDC_NO);\r
+               setDtcFilterResult = Dem_SetDTCFilter(pduRxData->SduDataPtr[2], DEM_DTC_KIND_EMISSON_REL_DTCS, DEM_DTC_ORIGIN_PRIMARY_MEMORY, DEM_FILTER_WITH_SEVERITY_NO, VALUE_IS_NOT_USED, DEM_FILTER_FOR_FDC_NO);\r
                break;\r
 \r
        default:\r
@@ -234,7 +235,7 @@ Dcm_NegativeResponseCodeType DspUdsReadDtcInfoSub_0x01_0x07_0x11_0x12(void)
        if (setDtcFilterResult == DEM_FILTER_ACCEPTED) {\r
                uint16 numberOfFilteredDtc;\r
                uint8 dtcStatusMask;\r
-               TxDataType *txData = (TxDataType*)dslMsgData.pduTxData->SduDataPtr;\r
+               TxDataType *txData = (TxDataType*)pduTxData->SduDataPtr;\r
 \r
                /** @reg DCM376 **/\r
                Dem_GetNumberOfFilteredDtc(&numberOfFilteredDtc);\r
@@ -242,12 +243,12 @@ Dcm_NegativeResponseCodeType DspUdsReadDtcInfoSub_0x01_0x07_0x11_0x12(void)
 \r
                // Create positive response (ISO 14229-1 table 251)\r
                /** @req DCM039.0x19 **/\r
-               txData->reportType = dslMsgData.pduRxData->SduDataPtr[1];                       // reportType\r
+               txData->reportType = pduRxData->SduDataPtr[1];                  // reportType\r
                txData->dtcStatusAvailabilityMask = dtcStatusMask;                                      // DTCStatusAvailabilityMask\r
                txData->dtcFormatIdentifier = Dem_GetTranslationType();                         // DTCFormatIdentifier\r
                txData->dtcCountHighByte = (numberOfFilteredDtc >> 8);                          // DTCCount high byte\r
                txData->dtcCountLowByte = (numberOfFilteredDtc & 0xFF);                         // DTCCount low byte\r
-               dslMsgData.pduTxData->SduLength = 6;\r
+               pduTxData->SduLength = 6;\r
        }\r
        else {\r
                responseCode = DCM_E_REQUESTOUTOFRANGE;\r
@@ -257,7 +258,7 @@ Dcm_NegativeResponseCodeType DspUdsReadDtcInfoSub_0x01_0x07_0x11_0x12(void)
 }\r
 \r
 \r
-Dcm_NegativeResponseCodeType DspUdsReadDtcInfoSub_0x02_0x0A_0x0F_0x13_0x15(void)\r
+Dcm_NegativeResponseCodeType DspUdsReadDtcInfoSub_0x02_0x0A_0x0F_0x13_0x15(const PduInfoType *pduRxData, PduInfoType *pduTxData)\r
 {\r
        Dcm_NegativeResponseCodeType responseCode = DCM_E_POSITIVERESPONSE;\r
        Dem_ReturnSetDTCFilterType setDtcFilterResult;\r
@@ -277,10 +278,10 @@ Dcm_NegativeResponseCodeType DspUdsReadDtcInfoSub_0x02_0x0A_0x0F_0x13_0x15(void)
        } TxDataType;\r
 \r
        // Setup the DTC filter\r
-       switch (dslMsgData.pduRxData->SduDataPtr[1])    /** @reg DCM378 **/\r
+       switch (pduRxData->SduDataPtr[1])       /** @reg DCM378 **/\r
        {\r
        case 0x02:      // reportDTCByStatusMask\r
-               setDtcFilterResult = Dem_SetDTCFilter(dslMsgData.pduRxData->SduDataPtr[2], DEM_DTC_KIND_ALL_DTCS, DEM_DTC_ORIGIN_PRIMARY_MEMORY, DEM_FILTER_WITH_SEVERITY_NO, VALUE_IS_NOT_USED, DEM_FILTER_FOR_FDC_NO);\r
+               setDtcFilterResult = Dem_SetDTCFilter(pduRxData->SduDataPtr[2], DEM_DTC_KIND_ALL_DTCS, DEM_DTC_ORIGIN_PRIMARY_MEMORY, DEM_FILTER_WITH_SEVERITY_NO, VALUE_IS_NOT_USED, DEM_FILTER_FOR_FDC_NO);\r
                break;\r
 \r
        case 0x0A:      // reportSupportedDTC\r
@@ -288,11 +289,11 @@ Dcm_NegativeResponseCodeType DspUdsReadDtcInfoSub_0x02_0x0A_0x0F_0x13_0x15(void)
                break;\r
 \r
        case 0x0F:      // reportMirrorMemoryDTCByStatusMask\r
-               setDtcFilterResult = Dem_SetDTCFilter(dslMsgData.pduRxData->SduDataPtr[2], DEM_DTC_KIND_ALL_DTCS, DEM_DTC_ORIGIN_MIRROR_MEMORY, DEM_FILTER_WITH_SEVERITY_NO, VALUE_IS_NOT_USED, DEM_FILTER_FOR_FDC_NO);\r
+               setDtcFilterResult = Dem_SetDTCFilter(pduRxData->SduDataPtr[2], DEM_DTC_KIND_ALL_DTCS, DEM_DTC_ORIGIN_MIRROR_MEMORY, DEM_FILTER_WITH_SEVERITY_NO, VALUE_IS_NOT_USED, DEM_FILTER_FOR_FDC_NO);\r
                break;\r
 \r
        case 0x13:      // reportEmissionRelatedOBDDTCByStatusMask\r
-               setDtcFilterResult = Dem_SetDTCFilter(dslMsgData.pduRxData->SduDataPtr[2], DEM_DTC_KIND_EMISSON_REL_DTCS, DEM_DTC_ORIGIN_PRIMARY_MEMORY, DEM_FILTER_WITH_SEVERITY_NO, VALUE_IS_NOT_USED, DEM_FILTER_FOR_FDC_NO);\r
+               setDtcFilterResult = Dem_SetDTCFilter(pduRxData->SduDataPtr[2], DEM_DTC_KIND_EMISSON_REL_DTCS, DEM_DTC_ORIGIN_PRIMARY_MEMORY, DEM_FILTER_WITH_SEVERITY_NO, VALUE_IS_NOT_USED, DEM_FILTER_FOR_FDC_NO);\r
                break;\r
 \r
        case 0x15:      // reportDTCWithPermanentStatus\r
@@ -309,7 +310,7 @@ Dcm_NegativeResponseCodeType DspUdsReadDtcInfoSub_0x02_0x0A_0x0F_0x13_0x15(void)
 \r
        if (setDtcFilterResult == DEM_FILTER_ACCEPTED) {\r
                uint8 dtcStatusMask;\r
-               TxDataType *txData = (TxDataType*)dslMsgData.pduTxData->SduDataPtr;\r
+               TxDataType *txData = (TxDataType*)pduTxData->SduDataPtr;\r
                Dem_ReturnGetNextFilteredDTCType getNextFilteredDtcResult;\r
                uint32 dtc;\r
                Dem_EventStatusExtendedType dtcStatus;\r
@@ -320,7 +321,7 @@ Dcm_NegativeResponseCodeType DspUdsReadDtcInfoSub_0x02_0x0A_0x0F_0x13_0x15(void)
 \r
                // Create positive response (ISO 14229-1 table 252)\r
                /** @req DCM039.0x19 **/\r
-               txData->reportType = dslMsgData.pduRxData->SduDataPtr[1];\r
+               txData->reportType = pduRxData->SduDataPtr[1];\r
                txData->dtcStatusAvailabilityMask = dtcStatusMask;\r
 \r
                if (dtcStatusMask != 0x00) {    /** @req DCM008 **/\r
@@ -338,7 +339,7 @@ Dcm_NegativeResponseCodeType DspUdsReadDtcInfoSub_0x02_0x0A_0x0F_0x13_0x15(void)
                                responseCode = DCM_E_REQUESTOUTOFRANGE;\r
                        }\r
                }\r
-               dslMsgData.pduTxData->SduLength = 3 + nrOfDtcs * sizeof(dtcAndStatusRecordType);\r
+               pduTxData->SduLength = 3 + nrOfDtcs * sizeof(dtcAndStatusRecordType);\r
        }\r
        else {\r
                responseCode = DCM_E_REQUESTOUTOFRANGE;\r
@@ -348,7 +349,7 @@ Dcm_NegativeResponseCodeType DspUdsReadDtcInfoSub_0x02_0x0A_0x0F_0x13_0x15(void)
 }\r
 \r
 \r
-Dcm_NegativeResponseCodeType DspUdsReadDtcInfoSub_0x08(void)\r
+Dcm_NegativeResponseCodeType DspUdsReadDtcInfoSub_0x08(const PduInfoType *pduRxData, PduInfoType *pduTxData)\r
 {\r
        Dcm_NegativeResponseCodeType responseCode = DCM_E_POSITIVERESPONSE;\r
 \r
@@ -359,7 +360,7 @@ Dcm_NegativeResponseCodeType DspUdsReadDtcInfoSub_0x08(void)
 }\r
 \r
 \r
-Dcm_NegativeResponseCodeType DspUdsReadDtcInfoSub_0x09(void)\r
+Dcm_NegativeResponseCodeType DspUdsReadDtcInfoSub_0x09(const PduInfoType *pduRxData, PduInfoType *pduTxData)\r
 {\r
        Dcm_NegativeResponseCodeType responseCode = DCM_E_POSITIVERESPONSE;\r
 \r
@@ -370,7 +371,7 @@ Dcm_NegativeResponseCodeType DspUdsReadDtcInfoSub_0x09(void)
 }\r
 \r
 \r
-Dcm_NegativeResponseCodeType DspUdsReadDtcInfoSub_0x06_0x10(void)\r
+Dcm_NegativeResponseCodeType DspUdsReadDtcInfoSub_0x06_0x10(const PduInfoType *pduRxData, PduInfoType *pduTxData)\r
 {\r
        Dcm_NegativeResponseCodeType responseCode = DCM_E_POSITIVERESPONSE;\r
        Dem_DTCOriginType dtcOrigin;\r
@@ -378,7 +379,7 @@ Dcm_NegativeResponseCodeType DspUdsReadDtcInfoSub_0x06_0x10(void)
        uint8 endRecNum;\r
 \r
        // Switch on sub function\r
-       switch (dslMsgData.pduRxData->SduDataPtr[1])    /** @reg DCM378 **/\r
+       switch (pduRxData->SduDataPtr[1])       /** @reg DCM378 **/\r
        {\r
        case 0x06:      // reportDTCExtendedDataRecordByDTCNumber\r
                dtcOrigin = DEM_DTC_ORIGIN_PRIMARY_MEMORY;\r
@@ -397,7 +398,7 @@ Dcm_NegativeResponseCodeType DspUdsReadDtcInfoSub_0x06_0x10(void)
        }\r
 \r
        // Switch on record number\r
-       switch (dslMsgData.pduRxData->SduDataPtr[5])\r
+       switch (pduRxData->SduDataPtr[5])\r
        {\r
        case 0xFF:      // Report all Extended Data Records for a particular DTC\r
                startRecNum = 0x00;\r
@@ -410,7 +411,7 @@ Dcm_NegativeResponseCodeType DspUdsReadDtcInfoSub_0x06_0x10(void)
                break;\r
 \r
        default:        // Report one specific Extended Data Records for a particular DTC\r
-               startRecNum = dslMsgData.pduRxData->SduDataPtr[5];\r
+               startRecNum = pduRxData->SduDataPtr[5];\r
                endRecNum = startRecNum;\r
                break;\r
        }\r
@@ -420,7 +421,7 @@ Dcm_NegativeResponseCodeType DspUdsReadDtcInfoSub_0x06_0x10(void)
                uint32 dtc;\r
                Dem_EventStatusExtendedType statusOfDtc;\r
 \r
-               dtc = BYTES_TO_DTC(dslMsgData.pduRxData->SduDataPtr[2], dslMsgData.pduRxData->SduDataPtr[3], dslMsgData.pduRxData->SduDataPtr[4]);\r
+               dtc = BYTES_TO_DTC(pduRxData->SduDataPtr[2], pduRxData->SduDataPtr[3], pduRxData->SduDataPtr[4]);\r
                getStatusOfDtcResult = Dem_GetStatusOfDTC(dtc, DEM_DTC_KIND_ALL_DTCS, dtcOrigin, &statusOfDtc); /** @req DCM295 **/ /** @req DCM475 **/\r
                if (getStatusOfDtcResult == DEM_STATUS_OK) {\r
                        Dem_ReturnGetExtendedDataRecordByDTCType getExtendedDataRecordByDtcResult;\r
@@ -429,17 +430,17 @@ Dcm_NegativeResponseCodeType DspUdsReadDtcInfoSub_0x06_0x10(void)
                        uint16 txIndex = 6;\r
 \r
                        /** @req DCM297 **/ /** @req DCM474 **/ /** @req DCM386 **/\r
-                       dslMsgData.pduTxData->SduDataPtr[1] = dslMsgData.pduRxData->SduDataPtr[1];      // Sub function\r
-                       dslMsgData.pduTxData->SduDataPtr[2] = DTC_HIGH_BYTE(dtc);                                       // DTC high byte\r
-                       dslMsgData.pduTxData->SduDataPtr[3] = DTC_MID_BYTE(dtc);                                        // DTC mid byte\r
-                       dslMsgData.pduTxData->SduDataPtr[4] = DTC_LOW_BYTE(dtc);                                        // DTC low byte\r
-                       dslMsgData.pduTxData->SduDataPtr[5] = statusOfDtc;                                                      // DTC status\r
+                       pduTxData->SduDataPtr[1] = pduRxData->SduDataPtr[1];                    // Sub function\r
+                       pduTxData->SduDataPtr[2] = DTC_HIGH_BYTE(dtc);                                  // DTC high byte\r
+                       pduTxData->SduDataPtr[3] = DTC_MID_BYTE(dtc);                                   // DTC mid byte\r
+                       pduTxData->SduDataPtr[4] = DTC_LOW_BYTE(dtc);                                   // DTC low byte\r
+                       pduTxData->SduDataPtr[5] = statusOfDtc;                                                 // DTC status\r
                        for (recNum = startRecNum; recNum <= endRecNum; recNum++) {\r
                                recLength = DCM_PHYS_BUFFER_SIZE - txIndex -1;  // Calculate what's left in buffer\r
                                /** @req DCM296 **/ /** @req DCM476 **/ /** @req DCM382 **/\r
-                               getExtendedDataRecordByDtcResult = Dem_GetExtendedDataRecordByDTC(dtc, DEM_DTC_KIND_ALL_DTCS, dtcOrigin, recNum, &dslMsgData.pduTxData->SduDataPtr[txIndex+1], &recLength);\r
+                               getExtendedDataRecordByDtcResult = Dem_GetExtendedDataRecordByDTC(dtc, DEM_DTC_KIND_ALL_DTCS, dtcOrigin, recNum, &pduTxData->SduDataPtr[txIndex+1], &recLength);\r
                                if (getExtendedDataRecordByDtcResult == DEM_RECORD_OK) {\r
-                                       dslMsgData.pduTxData->SduDataPtr[txIndex++] = recNum;\r
+                                       pduTxData->SduDataPtr[txIndex++] = recNum;\r
                                        /* Instead of calling Dem_GetSizeOfExtendedDataRecordByDTC() the result from Dem_GetExtendedDataRecordByDTC() is used */\r
                                        /** @req DCM478 **/ /** @req DCM479 **/ /** @req DCM480 **/\r
                                        txIndex += recLength;\r
@@ -448,7 +449,7 @@ Dcm_NegativeResponseCodeType DspUdsReadDtcInfoSub_0x06_0x10(void)
                                        // TODO: What to do here?\r
                                }\r
                        }\r
-                       dslMsgData.pduTxData->SduLength = txIndex;\r
+                       pduTxData->SduLength = txIndex;\r
                }\r
                else {\r
                        responseCode = DCM_E_REQUESTOUTOFRANGE;\r
@@ -459,7 +460,7 @@ Dcm_NegativeResponseCodeType DspUdsReadDtcInfoSub_0x06_0x10(void)
 }\r
 \r
 \r
-Dcm_NegativeResponseCodeType DspUdsReadDtcInfoSub_0x03(void)\r
+Dcm_NegativeResponseCodeType DspUdsReadDtcInfoSub_0x03(const PduInfoType *pduRxData, PduInfoType *pduTxData)\r
 {\r
        Dcm_NegativeResponseCodeType responseCode = DCM_E_POSITIVERESPONSE;\r
 \r
@@ -470,7 +471,7 @@ Dcm_NegativeResponseCodeType DspUdsReadDtcInfoSub_0x03(void)
 }\r
 \r
 \r
-Dcm_NegativeResponseCodeType DspUdsReadDtcInfoSub_0x04(void)\r
+Dcm_NegativeResponseCodeType DspUdsReadDtcInfoSub_0x04(const PduInfoType *pduRxData, PduInfoType *pduTxData)\r
 {\r
        Dcm_NegativeResponseCodeType responseCode = DCM_E_POSITIVERESPONSE;\r
 \r
@@ -481,7 +482,7 @@ Dcm_NegativeResponseCodeType DspUdsReadDtcInfoSub_0x04(void)
 }\r
 \r
 \r
-Dcm_NegativeResponseCodeType DspUdsReadDtcInfoSub_0x05(void)\r
+Dcm_NegativeResponseCodeType DspUdsReadDtcInfoSub_0x05(const PduInfoType *pduRxData, PduInfoType *pduTxData)\r
 {\r
        Dcm_NegativeResponseCodeType responseCode = DCM_E_POSITIVERESPONSE;\r
 \r
@@ -492,7 +493,7 @@ Dcm_NegativeResponseCodeType DspUdsReadDtcInfoSub_0x05(void)
 }\r
 \r
 \r
-Dcm_NegativeResponseCodeType DspUdsReadDtcInfoSub_0x0B_0x0C_0x0D_0x0E(void)\r
+Dcm_NegativeResponseCodeType DspUdsReadDtcInfoSub_0x0B_0x0C_0x0D_0x0E(const PduInfoType *pduRxData, PduInfoType *pduTxData)\r
 {\r
        Dcm_NegativeResponseCodeType responseCode = DCM_E_POSITIVERESPONSE;\r
 \r
@@ -503,7 +504,7 @@ Dcm_NegativeResponseCodeType DspUdsReadDtcInfoSub_0x0B_0x0C_0x0D_0x0E(void)
 }\r
 \r
 \r
-Dcm_NegativeResponseCodeType DspUdsReadDtcInfoSub_0x14(void)\r
+Dcm_NegativeResponseCodeType DspUdsReadDtcInfoSub_0x14(const PduInfoType *pduRxData, PduInfoType *pduTxData)\r
 {\r
        Dcm_NegativeResponseCodeType responseCode = DCM_E_POSITIVERESPONSE;\r
 \r
@@ -514,7 +515,7 @@ Dcm_NegativeResponseCodeType DspUdsReadDtcInfoSub_0x14(void)
 }\r
 \r
 \r
-void DspUdsReadDtcInformation(void)\r
+void DspUdsReadDtcInformation(const PduInfoType *pduRxData, PduInfoType *pduTxData)\r
 {\r
        /** @reg DCM248 **/\r
        // Sub function number         0  1  2  3  4  5  6  7  8  9  A  B  C  D  E  F 10 11 12 13 14 15\r
@@ -522,18 +523,18 @@ void DspUdsReadDtcInformation(void)
 \r
        Dcm_NegativeResponseCodeType responseCode = DCM_E_POSITIVERESPONSE;\r
 \r
-       uint8 subFunctionNumber = dslMsgData.pduRxData->SduDataPtr[1];\r
+       uint8 subFunctionNumber = pduRxData->SduDataPtr[1];\r
 \r
        // Check length\r
        if (subFunctionNumber <= 0x15) {\r
-               if (dslMsgData.pduRxData->SduLength == sduLength[subFunctionNumber]) {\r
+               if (pduRxData->SduLength == sduLength[subFunctionNumber]) {\r
                        switch (subFunctionNumber)\r
                        {\r
                        case 0x01:      // reportNumberOfDTCByStatusMask\r
                        case 0x07:      // reportNumberOfDTCBySeverityMaskRecord\r
                        case 0x11:      // reportNumberOfMirrorMemoryDTCByStatusMask\r
                        case 0x12:      // reportNumberOfEmissionRelatedOBDDTCByStatusMask\r
-                               responseCode = DspUdsReadDtcInfoSub_0x01_0x07_0x11_0x12();\r
+                               responseCode = DspUdsReadDtcInfoSub_0x01_0x07_0x11_0x12(pduRxData, pduTxData);\r
                                break;\r
 \r
                        case 0x02:      // reportDTCByStatusMask\r
@@ -541,43 +542,43 @@ void DspUdsReadDtcInformation(void)
                        case 0x0F:      // reportMirrorMemoryDTCByStatusMask\r
                        case 0x13:      // reportEmissionRelatedOBDDTCByStatusMask\r
                        case 0x15:      // reportDTCWithPermanentStatus\r
-                               responseCode = DspUdsReadDtcInfoSub_0x02_0x0A_0x0F_0x13_0x15();\r
+                               responseCode = DspUdsReadDtcInfoSub_0x02_0x0A_0x0F_0x13_0x15(pduRxData, pduTxData);\r
                                break;\r
 \r
                        case 0x08:      // reportDTCBySeverityMaskRecord\r
-                               responseCode = DspUdsReadDtcInfoSub_0x08();\r
+                               responseCode = DspUdsReadDtcInfoSub_0x08(pduRxData, pduTxData);\r
                                break;\r
 \r
                        case 0x09:      // reportSeverityInformationOfDTC\r
-                               responseCode = DspUdsReadDtcInfoSub_0x09();\r
+                               responseCode = DspUdsReadDtcInfoSub_0x09(pduRxData, pduTxData);\r
                                break;\r
 \r
                        case 0x06:      // reportDTCExtendedDataRecordByDTCNumber\r
                        case 0x10:      // reportMirrorMemoryDTCExtendedDataRecordByDTCNumber\r
-                               responseCode = DspUdsReadDtcInfoSub_0x06_0x10();\r
+                               responseCode = DspUdsReadDtcInfoSub_0x06_0x10(pduRxData, pduTxData);\r
                                break;\r
 \r
                        case 0x03:      // reportDTCSnapshotIdentidication\r
-                               responseCode = DspUdsReadDtcInfoSub_0x03();\r
+                               responseCode = DspUdsReadDtcInfoSub_0x03(pduRxData, pduTxData);\r
                                break;\r
 \r
                        case 0x04:      // reportDTCSnapshotByDtcNumber\r
-                               responseCode = DspUdsReadDtcInfoSub_0x04();\r
+                               responseCode = DspUdsReadDtcInfoSub_0x04(pduRxData, pduTxData);\r
                                break;\r
 \r
                        case 0x05:      // reportDTCSnapshotRecordNumber\r
-                               responseCode = DspUdsReadDtcInfoSub_0x05();\r
+                               responseCode = DspUdsReadDtcInfoSub_0x05(pduRxData, pduTxData);\r
                                break;\r
 \r
                        case 0x0B:      // reportFirstTestFailedDTC\r
                        case 0x0C:      // reportFirstConfirmedDTC\r
                        case 0x0D:      // reportMostRecentTestFailedDTC\r
                        case 0x0E:      // reportMostRecentConfirmedDTC\r
-                               responseCode = DspUdsReadDtcInfoSub_0x0B_0x0C_0x0D_0x0E();\r
+                               responseCode = DspUdsReadDtcInfoSub_0x0B_0x0C_0x0D_0x0E(pduRxData, pduTxData);\r
                                break;\r
 \r
                        case 0x14:      // reportDTCFaultDetectionCounter\r
-                               responseCode = DspUdsReadDtcInfoSub_0x14();\r
+                               responseCode = DspUdsReadDtcInfoSub_0x14(pduRxData, pduTxData);\r
                                break;\r
 \r
                        default:\r
@@ -600,15 +601,15 @@ void DspUdsReadDtcInformation(void)
 }\r
 \r
 \r
-void DspUdsSecurityAccess(void)\r
+void DspUdsSecurityAccess(const PduInfoType *pduRxData, PduInfoType *pduTxData)\r
 {\r
        /** @req DCM252 **/\r
        Dcm_NegativeResponseCodeType responseCode = DCM_E_POSITIVERESPONSE;\r
 \r
        // Check sub function range (0x01 to 0x42)\r
-       if ((dslMsgData.pduRxData->SduDataPtr[1] >= 0x01) && (dslMsgData.pduRxData->SduDataPtr[1] <= 0x42)) {\r
-               boolean isRequestSeed = dslMsgData.pduRxData->SduDataPtr[1] & 0x01;\r
-               Dcm_SecLevelType requestedSecurityLevel = (dslMsgData.pduRxData->SduDataPtr[1]-1)/2;\r
+       if ((pduRxData->SduDataPtr[1] >= 0x01) && (pduRxData->SduDataPtr[1] <= 0x42)) {\r
+               boolean isRequestSeed = pduRxData->SduDataPtr[1] & 0x01;\r
+               Dcm_SecLevelType requestedSecurityLevel = (pduRxData->SduDataPtr[1]-1)/2;\r
                Std_ReturnType getSeedResult;\r
                Dcm_NegativeResponseCodeType getSeedErrorCode;\r
                uint16 i;\r
@@ -621,23 +622,23 @@ void DspUdsSecurityAccess(void)
                        if (!DCM_Config.Dsp->DspSecurity->DspSecurityRow[i].Arc_EOL) {\r
                                const Dcm_DspSecurityRowType *requestedSecurity = &DCM_Config.Dsp->DspSecurity->DspSecurityRow[i];\r
                                // Check length\r
-                               if (dslMsgData.pduRxData->SduLength == (2 + requestedSecurity->DspSecurityADRSize)) {   /** @req DCM321.1 **/\r
+                               if (pduRxData->SduLength == (2 + requestedSecurity->DspSecurityADRSize)) {      /** @req DCM321.1 **/\r
                                        Dcm_SecLevelType activeSecLevel;\r
                                        Dcm_GetSecurityLevel(&activeSecLevel);\r
                                        if (requestedSecurityLevel == activeSecLevel) {         /** @req DCM323 **/\r
                                                // If same level set the seed to zeroes\r
                                                for (i = 0; i < requestedSecurity->DspSecuritySeedSize; i++) {\r
-                                                       dslMsgData.pduTxData->SduDataPtr[2+i] = 0;\r
-                                                       dslMsgData.pduTxData->SduLength = 2 + requestedSecurity->DspSecuritySeedSize;\r
+                                                       pduTxData->SduDataPtr[2+i] = 0;\r
+                                                       pduTxData->SduLength = 2 + requestedSecurity->DspSecuritySeedSize;\r
                                                }\r
                                        }\r
                                        else {\r
                                                // New security level ask for seed\r
-                                               getSeedResult = requestedSecurity->GetSeed(&dslMsgData.pduRxData->SduDataPtr[2], &dslMsgData.pduTxData->SduDataPtr[2], &getSeedErrorCode);\r
+                                               getSeedResult = requestedSecurity->GetSeed(&pduRxData->SduDataPtr[2], &pduTxData->SduDataPtr[2], &getSeedErrorCode);\r
                                                if ((getSeedResult == E_OK) && (getSeedErrorCode == E_OK)) {\r
                                                        // Everything ok add sub function to tx message and send it.\r
-                                                       dslMsgData.pduTxData->SduDataPtr[1] = dslMsgData.pduRxData->SduDataPtr[1];\r
-                                                       dslMsgData.pduTxData->SduLength = 2 + requestedSecurity->DspSecuritySeedSize;\r
+                                                       pduTxData->SduDataPtr[1] = pduRxData->SduDataPtr[1];\r
+                                                       pduTxData->SduLength = 2 + requestedSecurity->DspSecuritySeedSize;\r
 \r
                                                        dspUdsSecurityAccesData.reqSecLevel = requestedSecurityLevel;\r
                                                        dspUdsSecurityAccesData.reqSecLevelRef = &DCM_Config.Dsp->DspSecurity->DspSecurityRow[i];\r
@@ -663,17 +664,17 @@ void DspUdsSecurityAccess(void)
                else {\r
                        // sendKey message\r
                        if (dspUdsSecurityAccesData.reqInProgress) {\r
-                               if (dslMsgData.pduRxData->SduLength == (2 + dspUdsSecurityAccesData.reqSecLevelRef->DspSecurityKeySize)) {      /** @req DCM321 **/\r
+                               if (pduRxData->SduLength == (2 + dspUdsSecurityAccesData.reqSecLevelRef->DspSecurityKeySize)) { /** @req DCM321 **/\r
                                        if (requestedSecurityLevel == dspUdsSecurityAccesData.reqSecLevel) {\r
                                                Std_ReturnType compareKeyResult;\r
-                                               compareKeyResult = dspUdsSecurityAccesData.reqSecLevelRef->CompareKey(&dslMsgData.pduRxData->SduDataPtr[2]);\r
+                                               compareKeyResult = dspUdsSecurityAccesData.reqSecLevelRef->CompareKey(&pduRxData->SduDataPtr[2]);\r
                                                if (compareKeyResult == E_OK) {\r
                                                        // Request accepted\r
                                                        // Kill timer\r
                                                        DslSetSecurityLevel(dspUdsSecurityAccesData.reqSecLevelRef->DspSecurityLevel);\r
                                                        dspUdsSecurityAccesData.reqInProgress = FALSE;\r
-                                                       dslMsgData.pduTxData->SduDataPtr[1] = dslMsgData.pduRxData->SduDataPtr[1];\r
-                                                       dslMsgData.pduTxData->SduLength = 2;\r
+                                                       pduTxData->SduDataPtr[1] = pduRxData->SduDataPtr[1];\r
+                                                       pduTxData->SduLength = 2;\r
                                                }\r
                                                else {\r
                                                        responseCode = DCM_E_CONDITIONSNOTCORRECT;\r
@@ -702,17 +703,17 @@ void DspUdsSecurityAccess(void)
 }\r
 \r
 \r
-void DspUdsTesterPresent(void)\r
+void DspUdsTesterPresent(const PduInfoType *pduRxData, PduInfoType *pduTxData)\r
 {\r
-       if (dslMsgData.pduRxData->SduLength == 2) {\r
-               switch (dslMsgData.pduRxData->SduDataPtr[1])\r
+       if (pduRxData->SduLength == 2) {\r
+               switch (pduRxData->SduDataPtr[1])\r
                {\r
                case ZERO_SUB_FUNCTION:\r
                        DslResetSessionTimeoutTimer();\r
                        // Create positive response\r
                        /** @req DCM039.1 **/\r
-                       dslMsgData.pduTxData->SduDataPtr[1] = ZERO_SUB_FUNCTION;\r
-                       dslMsgData.pduTxData->SduLength = 2;\r
+                       pduTxData->SduDataPtr[1] = ZERO_SUB_FUNCTION;\r
+                       pduTxData->SduLength = 2;\r
                        DsdDspProcessingDone(DCM_E_POSITIVERESPONSE); /** @req DCM269.1 **/\r
                        break;\r
 \r
@@ -728,18 +729,18 @@ void DspUdsTesterPresent(void)
 }\r
 \r
 \r
-void DspUdsControlDtcSetting(void)\r
+void DspUdsControlDtcSetting(const PduInfoType *pduRxData, PduInfoType *pduTxData)\r
 {\r
        Dem_ReturnControlDTCStorageType resultCode;\r
 \r
-       if (dslMsgData.pduRxData->SduLength == 2) {\r
-               switch (dslMsgData.pduRxData->SduDataPtr[1])\r
+       if (pduRxData->SduLength == 2) {\r
+               switch (pduRxData->SduDataPtr[1])\r
                {\r
                case 0x01:      // ON   /** @req DCM249.1 **/\r
                        resultCode = Dem_EnableDTCStorage(DEM_DTC_GROUP_ALL_DTCS, DEM_DTC_KIND_ALL_DTCS);               /** @req DCM304 **/\r
                        if (resultCode == DEM_CONTROL_DTC_STORAGE_OK) {\r
-                               dslMsgData.pduTxData->SduDataPtr[1] = 0x01;\r
-                               dslMsgData.pduTxData->SduLength = 2;\r
+                               pduTxData->SduDataPtr[1] = 0x01;\r
+                               pduTxData->SduLength = 2;\r
                                DsdDspProcessingDone(DCM_E_POSITIVERESPONSE);\r
                        }\r
                        else {\r
@@ -750,8 +751,8 @@ void DspUdsControlDtcSetting(void)
                case 0x02:      // OFF  /** @req DCM249.2 **/\r
                        resultCode = Dem_DisableDTCStorage(DEM_DTC_GROUP_ALL_DTCS, DEM_DTC_KIND_ALL_DTCS);              /** @req DCM406 **/\r
                        if (resultCode == DEM_CONTROL_DTC_STORAGE_OK) {\r
-                               dslMsgData.pduTxData->SduDataPtr[1] = 0x02;\r
-                               dslMsgData.pduTxData->SduLength = 2;\r
+                               pduTxData->SduDataPtr[1] = 0x02;\r
+                               pduTxData->SduLength = 2;\r
                                DsdDspProcessingDone(DCM_E_POSITIVERESPONSE);\r
                        }\r
                        else {\r
index dc53371afdaf2a644656f9d664be0d0c3128ee94..dafea8413bf95242fca386d393650f941b05a639 100644 (file)
  */\r
 void DspInit(void);\r
 void DspMain(void);\r
-void DspUdsDiagnosticSessionControl(void);\r
-void DspUdsEcuReset(void);\r
-void DspUdsClearDiagnosticInformation(void);\r
-void DspUdsSecurityAccess(void);\r
-void DspUdsTesterPresent(void);\r
-void DspUdsReadDtcInformation(void);\r
-void DspUdsControlDtcSetting(void);\r
+void DspUdsDiagnosticSessionControl(const PduInfoType *pduRxData, PduInfoType *pduTxData);\r
+void DspUdsEcuReset(const PduInfoType *pduRxData, PduIdType txPduId, PduInfoType *pduTxData);\r
+void DspUdsClearDiagnosticInformation(const PduInfoType *pduRxData, PduInfoType *pduTxData);\r
+void DspUdsSecurityAccess(const PduInfoType *pduRxData, PduInfoType *pduTxData);\r
+void DspUdsTesterPresent(const PduInfoType *pduRxData, PduInfoType *pduTxData);\r
+void DspUdsReadDtcInformation(const PduInfoType *pduRxData, PduInfoType *pduTxData);\r
+void DspUdsControlDtcSetting(const PduInfoType *pduRxData, PduInfoType *pduTxData);\r
 void DspDcmConfirmation(PduIdType confirmPduId);\r
 \r
 \r
@@ -71,22 +71,12 @@ void DsdMain(void);
 void DsdHandleRequest(void);\r
 void DsdDspProcessingDone(Dcm_NegativeResponseCodeType responseCode);\r
 void DsdDataConfirmation(PduIdType confirmPduId);\r
-void DsdDslDataIndication(void);\r
+void DsdDslDataIndication(const PduInfoType *pduRxData, const Dcm_DsdServiceTableType *protocolSIDTable, Dcm_ProtocolAddrTypeType addrType, PduIdType txPduId, PduInfoType *pduTxData);\r
 \r
 \r
 /*\r
  * DSL
  */\r
-typedef struct {\r
-       PduIdType       activePduId;\r
-       boolean         suppressPosRspMsg;\r
-       PduInfoType *pduRxData;\r
-       PduInfoType *pduTxData;\r
-} DslMsgDataType;\r
-\r
-extern DslMsgDataType dslMsgData;\r
-\r
-\r
 void DslInit(void);\r
 void DslMain(void);\r
 void DslHandleResponseTransmission(void);\r
@@ -106,4 +96,5 @@ BufReq_ReturnType DslProvideTxBuffer(PduIdType dcmTxPduId, PduInfoType **pduInfo
 void DslTxConfirmation(PduIdType dcmTxPduId, NotifResultType result);\r
 void DslResetSessionTimeoutTimer(void);\r
 \r
+\r
 #endif /* DCM_INTERNAL_H_ */\r