]> rtime.felk.cvut.cz Git - arc.git/blobdiff - diagnostic/Dcm/Dcm_Dsl.c
Dcm, Fixed problem in read / write memory functions (refactored) that made it inpossi...
[arc.git] / diagnostic / Dcm / Dcm_Dsl.c
index 445e11bfeef6a377e0472711ee9a42778613540e..caca1aa53cfb9d8363eec171013ab6ff3aa54dac 100644 (file)
@@ -20,7 +20,6 @@
 \r
 \r
 #include <string.h>\r
-#include "McuExtensions.h"\r
 #include "Dcm.h"\r
 #include "Dcm_Internal.h"\r
 #include "MemMap.h"\r
@@ -29,6 +28,7 @@
 #endif\r
 #include "PduR_Dcm.h"\r
 #include "ComStack_Types.h"\r
+#include "Cpu.h"\r
 //#define USE_DEBUG_PRINTF\r
 #include "debug.h"\r
 \r
@@ -94,6 +94,8 @@ static void changeDiagnosticSession(Dcm_DslRunTimeProtocolParametersType *runtim
 \r
        switch (runtime->sessionControl) {\r
        case DCM_DEFAULT_SESSION: // "default".\r
+               /* to set the dsp buffer to default*/\r
+               DspInit();\r
                break;\r
 \r
        case DCM_PROGRAMMING_SESSION:\r
@@ -105,7 +107,7 @@ static void changeDiagnosticSession(Dcm_DslRunTimeProtocolParametersType *runtim
 \r
        default:\r
                DET_REPORTERROR(MODULE_ID_DCM, 0, DCM_CHANGE_DIAGNOSTIC_SESSION_ID, DCM_E_PARAM);\r
-               DEBUG(DEBUG_MEDIUM, "Old session invalid");\r
+               //DEBUG(DEBUG_MEDIUM, "Old session invalid");\r
                break;\r
        }\r
 \r
@@ -120,7 +122,7 @@ static void changeDiagnosticSession(Dcm_DslRunTimeProtocolParametersType *runtim
 \r
        default:\r
                DET_REPORTERROR(MODULE_ID_DCM, 0, DCM_CHANGE_DIAGNOSTIC_SESSION_ID, DCM_E_PARAM);\r
-               DEBUG(DEBUG_MEDIUM, "New session invalid");\r
+               //DEBUG(DEBUG_MEDIUM, "New session invalid");\r
                break;\r
        }\r
 }\r
@@ -302,23 +304,24 @@ void DslDsdProcessingDone(PduIdType rxPduIdRef, DsdProcessingDoneResultType resp
        const Dcm_DslProtocolRowType *protocolRow = NULL;\r
        Dcm_DslRunTimeProtocolParametersType *runtime = NULL;\r
 \r
-       DEBUG( DEBUG_MEDIUM, "DslDsdProcessingDone rxPduIdRef=%d\n", rxPduIdRef);\r
+//     DEBUG( DEBUG_MEDIUM, "DslDsdProcessingDone rxPduIdRef=%d\n", rxPduIdRef);\r
 \r
        if (findRxPduIdParentConfigurationLeafs(rxPduIdRef, &protocolRx, &mainConnection, &connection, &protocolRow, &runtime)) {\r
-               imask_t state = McuE_EnterCriticalSection();\r
+           imask_t state;\r
+           Irq_Save(state);\r
                switch (responseResult) {\r
                case DSD_TX_RESPONSE_READY:\r
                        runtime->externalTxBufferStatus = DSD_PENDING_RESPONSE_SIGNALED; /** @req DCM114 */\r
                        break;\r
                case DSD_TX_RESPONSE_SUPPRESSED: /** @req DCM238 */\r
-                       DEBUG( DEBUG_MEDIUM, "DslDsdProcessingDone called with DSD_TX_RESPONSE_SUPPRESSED.\n");\r
+                       //DEBUG( DEBUG_MEDIUM, "DslDsdProcessingDone called with DSD_TX_RESPONSE_SUPPRESSED.\n");\r
                        releaseExternalRxTxBuffersHelper(rxPduIdRef);\r
                        break;\r
                default:\r
-                       DEBUG( DEBUG_MEDIUM, "Unknown response result from DslDsdProcessingDone!\n");\r
+                       //DEBUG( DEBUG_MEDIUM, "Unknown response result from DslDsdProcessingDone!\n");\r
                        break;\r
                }\r
-               McuE_ExitCriticalSection(state);\r
+           Irq_Restore(state);\r
        }\r
 }\r
 \r
@@ -337,9 +340,10 @@ static void sendResponse(const Dcm_DslProtocolRowType *protocol,
        const Dcm_DslProtocolRowType *protocolRow = NULL;\r
        Dcm_DslRunTimeProtocolParametersType *runtime = NULL;\r
        Std_ReturnType transmitResult;\r
+    imask_t state;\r
 \r
+    Irq_Save(state);\r
        /** @req DCM119 */\r
-       imask_t state = McuE_EnterCriticalSection();\r
        if (findRxPduIdParentConfigurationLeafs(protocol->DslRunTimeProtocolParameters->diagReqestRxPduId, &protocolRx, &mainConnection, &connection, &protocolRow, &runtime)) {\r
                if (runtime->localTxBuffer.status == NOT_IN_USE) {\r
                        runtime->localTxBuffer.status = PROVIDED_TO_DSD;\r
@@ -355,7 +359,7 @@ static void sendResponse(const Dcm_DslProtocolRowType *protocol,
                        }\r
                }\r
        }\r
-       McuE_ExitCriticalSection(state);\r
+    Irq_Restore(state);\r
 }\r
 \r
 // - - - - - - - - - - -\r
@@ -410,9 +414,45 @@ void DslInit(void) {
 }\r
 \r
 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -\r
-//     Implements 'void Dcm_MainFunction(void)' for DSL.\r
+//     Implements 'void DslInternal_ResponseOnOneDataByPeriodicId(uint8 PericodID)' for simulator a periodic did data.\r
 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -\r
 \r
+Std_ReturnType DslInternal_ResponseOnOneDataByPeriodicId(uint8 PericodID)\r
+{\r
+       Std_ReturnType ret = E_NOT_OK;\r
+       const Dcm_DslProtocolRowType *protocolRowEntry;\r
+       Dcm_DslRunTimeProtocolParametersType *runtime = NULL;\r
+    PduInfoType  *pPeriodData;\r
+       protocolRowEntry = DCM_Config.Dsl->DslProtocol->DslProtocolRowList;\r
+       while (protocolRowEntry->Arc_EOL == FALSE) \r
+       {\r
+       runtime = protocolRowEntry->DslRunTimeProtocolParameters;\r
+        if(runtime != NULL)    // find the runtime\r
+        {\r
+               if( BUFREQ_OK == DslProvideRxBufferToPdur(runtime->diagReqestRxPduId, 3, (const PduInfoType **)&pPeriodData)){\r
+                pPeriodData->SduDataPtr[0] = 0x2a;\r
+                pPeriodData->SduDataPtr[1] = 0;\r
+                pPeriodData->SduDataPtr[2] = PericodID;\r
+                pPeriodData->SduLength = 3;\r
+                DslRxIndicationFromPduR(0, NTFRSLT_OK);\r
+                ret = E_OK;\r
+                       break;\r
+               }\r
+               else {\r
+                       ret = E_NOT_OK;\r
+               }\r
+\r
+               }\r
+       protocolRowEntry++;\r
+       }\r
+\r
+       return ret;\r
+}\r
+\r
+\r
+// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -\r
+//     Implements 'void Dcm_MainFunction(void)' for DSL.\r
+// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -\r
 void DslMain(void) {\r
        const Dcm_DslProtocolRowType *protocolRowEntry;\r
        const Dcm_DslProtocolTimingRowType *timeParams = NULL;\r
@@ -434,10 +474,8 @@ void DslMain(void) {
                                //DEBUG( DEBUG_MEDIUM, "state NOT_IN_USE!\n");\r
                                break;\r
                        case PROVIDED_TO_DSD: {\r
-                               DEBUG( DEBUG_MEDIUM, "debug_count=%d\n", debug_count);\r
                                DECREMENT(runtime->stateTimeoutCount);\r
                                if (runtime->stateTimeoutCount == 0) {\r
-                                       DEBUG( DEBUG_MEDIUM, "State PROVIDED_TO_DSD timed out!", debug_count);\r
                                        timeParams = protocolRowEntry->DslProtocolTimeLimit;\r
                                        runtime->stateTimeoutCount = DCM_CONVERT_MS_TO_MAIN_CYCLES(timeParams->TimStrP2ServerMax); /* Reinitiate timer, see 9.2.2. */\r
                                        if (DCM_Config.Dsl->DslDiagResp != NULL) {\r
@@ -450,7 +488,7 @@ void DslMain(void) {
                                                                releaseExternalRxTxBuffers(protocolRowEntry, runtime);\r
                                                        }\r
                                                } else {\r
-                                                       DEBUG( DEBUG_MEDIUM, "Not configured to send response pending, now sending general reject!\n");\r
+                               //                      DEBUG( DEBUG_MEDIUM, "Not configured to send response pending, now sending general reject!\n");\r
                                                        sendResponse(protocolRowEntry, DCM_E_GENERALREJECT);\r
                                                        releaseExternalRxTxBuffers(protocolRowEntry, runtime);\r
                                                }\r
@@ -463,7 +501,7 @@ void DslMain(void) {
                                // Make sure that response pending or general reject have not been issued,\r
                                // if so we can not transmit to PduR because we would not know from where\r
                                // the Tx confirmation resides later.\r
-                               DEBUG( DEBUG_MEDIUM, "state DSD_PENDING_RESPONSE_SIGNALED!\n");\r
+                       //      DEBUG( DEBUG_MEDIUM, "state DSD_PENDING_RESPONSE_SIGNALED!\n");\r
                                if (runtime->localTxBuffer.status == NOT_IN_USE) { // Make sure that no TxConfirm could be sent by the local buffer and mixed up with this transmission.\r
                                        const Dcm_DslProtocolRxType *protocolRx = NULL;\r
                                        const Dcm_DslMainConnectionType *mainConnection = NULL;\r
@@ -473,18 +511,18 @@ void DslMain(void) {
 \r
                                        if (findRxPduIdParentConfigurationLeafs(runtime->diagReqestRxPduId, &protocolRx, &mainConnection, &connection, &protocolRow, &runtime)) {\r
                                                const PduIdType txPduId = mainConnection->DslProtocolTx->DcmDslProtocolTxPduId;\r
-                                               DEBUG( DEBUG_MEDIUM, "runtime->externalTxBufferStatus enter state DCM_TRANSMIT_SIGNALED.\n" );\r
+                                       //      DEBUG( DEBUG_MEDIUM, "runtime->externalTxBufferStatus enter state DCM_TRANSMIT_SIGNALED.\n" );\r
                                                runtime->externalTxBufferStatus = DCM_TRANSMIT_SIGNALED;\r
                                                transmitResult = PduR_DcmTransmit(txPduId, &runtime->diagnosticResponseFromDsd); /** @req DCM237 *//* Will trigger PduR (CanTP) to call DslProvideTxBuffer(). */\r
                                                if (transmitResult != E_OK) {\r
                                                        // TODO: What to do here?\r
                                                }\r
                                        } else {\r
-                                               DEBUG( DEBUG_MEDIUM, "***** WARNING, THIS IS UNEXPECTED !!! ********.\n" );\r
+                                       //      DEBUG( DEBUG_MEDIUM, "***** WARNING, THIS IS UNEXPECTED !!! ********.\n" );\r
                                                const PduIdType txPduId = protocolRowEntry->DslConnection->DslMainConnection->DslProtocolTx->DcmDslProtocolTxPduId;\r
-                                               DEBUG( DEBUG_MEDIUM, "runtime->externalTxBufferStatus enter state DSD_PENDING_RESPONSE_SIGNALED.\n", txPduId);\r
+                                       //      DEBUG( DEBUG_MEDIUM, "runtime->externalTxBufferStatus enter state DSD_PENDING_RESPONSE_SIGNALED.\n", txPduId);\r
                                                runtime->externalTxBufferStatus = DCM_TRANSMIT_SIGNALED;\r
-                                               DEBUG( DEBUG_MEDIUM, "Calling PduR_DcmTransmit with txPduId = %d from DslMain\n", txPduId);\r
+                                       //      DEBUG( DEBUG_MEDIUM, "Calling PduR_DcmTransmit with txPduId = %d from DslMain\n", txPduId);\r
                                                transmitResult = PduR_DcmTransmit(txPduId, &runtime->diagnosticResponseFromDsd); /** @req DCM237 *//* Will trigger PduR (CanTP) to call DslProvideTxBuffer(). */\r
                                                if (transmitResult != E_OK) {\r
                                                        // TODO: What to do here?\r
@@ -521,14 +559,14 @@ BufReq_ReturnType DslProvideRxBufferToPdur(PduIdType dcmRxPduId, PduLengthType t
        const Dcm_DslConnectionType *connection = NULL;\r
        const Dcm_DslProtocolRowType *protocolRow = NULL;\r
        Dcm_DslRunTimeProtocolParametersType *runtime = NULL;\r
-\r
-       DEBUG( DEBUG_MEDIUM, "DslProvideRxBufferToPdur(dcmRxPduId=%d) called!\n", dcmRxPduId);\r
-       imask_t state = McuE_EnterCriticalSection();\r
+    imask_t state;\r
+//     DEBUG( DEBUG_MEDIUM, "DslProvideRxBufferToPdur(dcmRxPduId=%d) called!\n", dcmRxPduId);  \r
+    Irq_Save(state);\r
        if (findRxPduIdParentConfigurationLeafs(dcmRxPduId, &protocolRx, &mainConnection, &connection, &protocolRow, &runtime)) {\r
                const Dcm_DslBufferType *externalRxBuffer = protocolRow->DslProtocolRxBufferID;\r
                if (externalRxBuffer->pduInfo.SduLength >= tpSduLength) { /** @req DCM443 */\r
                        if ((runtime->externalRxBufferStatus == NOT_IN_USE) && (externalRxBuffer->externalBufferRuntimeData->status == BUFFER_AVAILABLE)) {\r
-                               DEBUG( DEBUG_MEDIUM, "External buffer available!\n");\r
+                       //      DEBUG( DEBUG_MEDIUM, "External buffer available!\n");\r
                                // ### EXTERNAL BUFFER IS AVAILABLE; GRAB IT AND REMEBER THAT WE OWN IT! ###\r
                                externalRxBuffer->externalBufferRuntimeData->status = BUFFER_BUSY;\r
                                runtime->diagnosticRequestFromTester.SduDataPtr = externalRxBuffer->pduInfo.SduDataPtr;\r
@@ -537,7 +575,6 @@ BufReq_ReturnType DslProvideRxBufferToPdur(PduIdType dcmRxPduId, PduLengthType t
                                runtime->externalRxBufferStatus = PROVIDED_TO_PDUR; /** @req DCM342 */\r
                                ret = BUFREQ_OK;\r
                        } else {\r
-                               DEBUG( DEBUG_MEDIUM, "Local buffer available!\n");\r
                                if (runtime->externalRxBufferStatus == PROVIDED_TO_DSD) {\r
                                        // ### EXTERNAL BUFFER IS IN USE BY THE DSD, TRY TO USE LOCAL BUFFER! ###\r
                                        if (runtime->localRxBuffer.status == NOT_IN_USE) {\r
@@ -565,7 +602,7 @@ BufReq_ReturnType DslProvideRxBufferToPdur(PduIdType dcmRxPduId, PduLengthType t
                        stopS3SessionTimer(runtime); /** @req DCM141 */\r
                }\r
        }\r
-       McuE_ExitCriticalSection(state);\r
+    Irq_Restore(state);\r
        return ret;\r
 }\r
 \r
@@ -593,7 +630,7 @@ void DslRxIndicationFromPduR(PduIdType dcmRxPduId, NotifResultType result) {
                // We need to find out in what buffer we can find our Rx data (it can\r
                // be either in the normal RX-buffer or the 'extra' buffer for implementing\r
                // the Concurrent "Test Present" functionality.\r
-               state = McuE_EnterCriticalSection();\r
+           Irq_Save(state);\r
                if (runtime->externalRxBufferStatus == PROVIDED_TO_PDUR) {\r
                        if ( result == NTFRSLT_OK ) { /** @req DCM111 */\r
                                if (isTesterPresentCommand(&(protocolRow->DslProtocolRxBufferID->pduInfo))) {\r
@@ -611,7 +648,7 @@ void DslRxIndicationFromPduR(PduIdType dcmRxPduId, NotifResultType result) {
                                        if (runtime->protocolStarted == TRUE) {\r
                                                if (runtime->diagnosticActiveComM == FALSE) {\r
 #if defined(USE_COMM)\r
-                                                       ComM_DCM_ActivateDiagnostic(); /** @req DCM163 */\r
+                                                       ComM_DCM_ActiveDiagnostic(); /** @req DCM163 */\r
 #endif\r
                                                        runtime->diagnosticActiveComM = TRUE;\r
                                                }\r
@@ -619,16 +656,17 @@ void DslRxIndicationFromPduR(PduIdType dcmRxPduId, NotifResultType result) {
                                                runtime->stateTimeoutCount = DCM_CONVERT_MS_TO_MAIN_CYCLES(timeParams->TimStrP2ServerMax); /* See 9.2.2. */\r
                                                runtime->externalRxBufferStatus = PROVIDED_TO_DSD; /** @req DCM241 */\r
                                                if (runtime->externalTxBufferStatus == NOT_IN_USE) {\r
-                                                       DEBUG( DEBUG_MEDIUM, "External Tx buffer available, we can pass it to DSD.\n");\r
+                                               //      DEBUG( DEBUG_MEDIUM, "External Tx buffer available, we can pass it to DSD.\n");\r
                                                } else {\r
-                                                       DEBUG( DEBUG_MEDIUM, "External buffer not available, a response is being transmitted?\n");\r
+                                                       //DEBUG( DEBUG_MEDIUM, "External buffer not available, a response is being transmitted?\n");\r
                                                }\r
                                                runtime->externalTxBufferStatus = PROVIDED_TO_DSD; /** @req DCM241 */\r
                                                runtime->responsePendingCount = DCM_Config.Dsl->DslDiagResp->DslDiagRespMaxNumRespPend;\r
                                                runtime->diagnosticResponseFromDsd.SduDataPtr = protocolRow->DslProtocolTxBufferID->pduInfo.SduDataPtr;\r
                                                runtime->diagnosticResponseFromDsd.SduLength = protocolRow->DslProtocolTxBufferID->pduInfo.SduLength;\r
-                                               DEBUG( DEBUG_MEDIUM, "DsdDslDataIndication(DcmDslProtocolTxPduId=%d, dcmRxPduId=%d)\n", mainConnection->DslProtocolTx->DcmDslProtocolTxPduId, dcmRxPduId);\r
+                                       //      DEBUG( DEBUG_MEDIUM, "DsdDslDataIndication(DcmDslProtocolTxPduId=%d, dcmRxPduId=%d)\n", mainConnection->DslProtocolTx->DcmDslProtocolTxPduId, dcmRxPduId);\r
                                                runtime->diagReqestRxPduId = dcmRxPduId;\r
+                                       //      DEBUG(DEBUG_MEDIUM,"\n\n runtime->diagnosticRequestFromTester.SduDataPtr[2]  %x\n\n ",runtime->diagnosticRequestFromTester.SduDataPtr[2]);\r
                                                DsdDslDataIndication(  // qqq: We are inside a critical section.\r
                                                                &(runtime->diagnosticRequestFromTester),\r
                                                                protocolRow->DslProtocolSIDTable,       /** @req DCM035 */\r
@@ -656,7 +694,7 @@ void DslRxIndicationFromPduR(PduIdType dcmRxPduId, NotifResultType result) {
                                runtime->localRxBuffer.status = NOT_IN_USE;\r
                        }\r
                }\r
-               McuE_ExitCriticalSection(state);\r
+           Irq_Restore(state);\r
        }\r
 }\r
 \r
@@ -679,7 +717,7 @@ BufReq_ReturnType DslProvideTxBuffer(PduIdType dcmTxPduId, const PduInfoType **p
        Dcm_DslRunTimeProtocolParametersType *runtime = NULL;\r
 \r
        (void)length;           // Currently not used, this is only to remove compilation warnings\r
-       DEBUG( DEBUG_MEDIUM, "DslProvideTxBuffer=%d\n", dcmTxPduId);\r
+//     DEBUG( DEBUG_MEDIUM, "DslProvideTxBuffer=%d\n", dcmTxPduId);\r
        if (findTxPduIdParentConfigurationLeafs(dcmTxPduId, &protocolTx, &mainConnection, &connection, &protocolRow, &runtime)) {\r
                switch (runtime->externalTxBufferStatus) { // ### EXTERNAL TX BUFFER ###\r
                case DCM_TRANSMIT_SIGNALED: {\r
@@ -690,7 +728,7 @@ BufReq_ReturnType DslProvideTxBuffer(PduIdType dcmTxPduId, const PduInfoType **p
                        break;\r
                }\r
                default:\r
-                       DEBUG( DEBUG_MEDIUM, "DCM_TRANSMIT_SIGNALED was not signaled in the external buffer\n");\r
+                       //DEBUG( DEBUG_MEDIUM, "DCM_TRANSMIT_SIGNALED was not signaled in the external buffer\n");\r
                        ret = BUFREQ_NOT_OK;\r
                        break;\r
                }\r
@@ -705,7 +743,7 @@ BufReq_ReturnType DslProvideTxBuffer(PduIdType dcmTxPduId, const PduInfoType **p
                                break;\r
                        }\r
                        default:\r
-                               DEBUG( DEBUG_MEDIUM, "DCM_TRANSMIT_SIGNALED was not signaled for the local buffer either\n");\r
+                               //DEBUG( DEBUG_MEDIUM, "DCM_TRANSMIT_SIGNALED was not signaled for the local buffer either\n");\r
                                ret = BUFREQ_NOT_OK;\r
                                break;\r
                        }\r
@@ -729,21 +767,21 @@ void DslTxConfirmation(PduIdType dcmTxPduId, NotifResultType result) {
        Dcm_DslRunTimeProtocolParametersType *runtime = NULL;\r
        imask_t state;\r
 \r
-       DEBUG( DEBUG_MEDIUM, "DslTxConfirmation=%d, result=%d\n", dcmTxPduId, result);\r
+//     DEBUG( DEBUG_MEDIUM, "DslTxConfirmation=%d, result=%d\n", dcmTxPduId, result);\r
        if (findTxPduIdParentConfigurationLeafs(dcmTxPduId, &protocolTx, &mainConnection, &connection, &protocolRow, &runtime)) {\r
                boolean externalBufferReleased = FALSE;\r
 \r
                // Free the buffer and free the Pdu runtime data buffer.\r
-               state = McuE_EnterCriticalSection();\r
+           Irq_Save(state);\r
                switch (runtime->externalTxBufferStatus) { // ### EXTERNAL TX BUFFER ###\r
                case PROVIDED_TO_PDUR: {\r
 #if defined(USE_COMM)\r
-                       ComM_DCM_InactivateDiagnostic(); /** @req DCM164 */\r
+                       ComM_DCM_InactiveDiagnostic(); /** @req DCM164 */\r
 #endif\r
                        startS3SessionTimer(runtime, protocolRow); /** @req DCM141 */\r
                        releaseExternalRxTxBuffers(protocolRow, runtime); /** @req DCM118 *//** @req DCM352 *//** @req DCM353 *//** @req DCM354 */\r
                        externalBufferReleased = TRUE;\r
-                       DEBUG( DEBUG_MEDIUM, "Released external buffer OK!\n");\r
+               //      DEBUG( DEBUG_MEDIUM, "Released external buffer OK!\n");\r
                        DsdDataConfirmation(mainConnection->DslProtocolTx->DcmDslProtocolTxPduId, result); /** @req DCM117 *//** @req DCM235 */\r
                        break;\r
                }\r
@@ -753,15 +791,15 @@ void DslTxConfirmation(PduIdType dcmTxPduId, NotifResultType result) {
                if (!externalBufferReleased) {\r
                        switch (runtime->localTxBuffer.status) { // ### LOCAL TX BUFFER ###\r
                        case PROVIDED_TO_PDUR:\r
-                               DEBUG( DEBUG_MEDIUM, "Released local buffer buffer OK!\n");\r
+                       //      DEBUG( DEBUG_MEDIUM, "Released local buffer buffer OK!\n");\r
                                runtime->localTxBuffer.status = DCM_IDLE;\r
                                break;\r
                        default:\r
-                               DEBUG( DEBUG_MEDIUM, "WARNING! DslTxConfirmation could not release external or local buffer!\n");\r
+                       //      DEBUG( DEBUG_MEDIUM, "WARNING! DslTxConfirmation could not release external or local buffer!\n");\r
                                break;\r
                        }\r
                }\r
-               McuE_ExitCriticalSection(state);\r
+           Irq_Restore(state);\r
        }\r
 }\r
 \r