]> rtime.felk.cvut.cz Git - arc.git/blobdiff - diagnostic/Dcm/Dcm_Dsp.c
Updated Dcm (partially) after Lint check.
[arc.git] / diagnostic / Dcm / Dcm_Dsp.c
index 32a0b37361ff5ca7b60fc2006cdd84e617157131..7f91b24a33f9f255fce38702a01802a8adc37f9a 100644 (file)
@@ -73,38 +73,44 @@ void DspMain(void)
 }\r
 \r
 \r
-boolean DspCheckSessionLevel(const Dcm_DspSessionRowType **sessionLevelRefTable)\r
+boolean DspCheckSessionLevel(Dcm_DspSessionRowType const* const* sessionLevelRefTable)\r
 {\r
-       boolean returnStatus = TRUE;\r
+       Std_ReturnType returnStatus;\r
+       boolean levelFound = FALSE;\r
        Dcm_SesCtrlType currentSession;\r
 \r
-       DslGetSesCtrlType(&currentSession);\r
-       while ( ((*sessionLevelRefTable)->DspSessionLevel != currentSession) && (!(*sessionLevelRefTable)->Arc_EOL) ) {\r
-               sessionLevelRefTable++;\r
-       }\r
+       returnStatus = DslGetSesCtrlType(&currentSession);\r
+       if (returnStatus == E_OK) {\r
+               while ( ((*sessionLevelRefTable)->DspSessionLevel != currentSession) && (!(*sessionLevelRefTable)->Arc_EOL) ) {\r
+                       sessionLevelRefTable++;\r
+               }\r
 \r
-       if ((*sessionLevelRefTable)->Arc_EOL) {\r
-               returnStatus = FALSE;\r
+               if (!(*sessionLevelRefTable)->Arc_EOL) {\r
+                       levelFound = TRUE;\r
+               }\r
        }\r
 \r
-       return returnStatus;\r
+       return levelFound;\r
 }\r
 \r
 \r
-boolean DspCheckSecurityLevel(const Dcm_DspSecurityRowType     **securityLevelRefTable)\r
+boolean DspCheckSecurityLevel(Dcm_DspSecurityRowType const* const* securityLevelRefTable)\r
 {\r
-       boolean returnStatus = TRUE;\r
+       Std_ReturnType returnStatus;\r
+       boolean levelFound = FALSE;\r
        Dcm_SecLevelType currentSecurityLevel;\r
 \r
-       DslGetSecurityLevel(&currentSecurityLevel);\r
-       while ( ((*securityLevelRefTable)->DspSecurityLevel != currentSecurityLevel) && (!(*securityLevelRefTable)->Arc_EOL) ) {\r
-               securityLevelRefTable++;\r
-       }\r
-       if ((*securityLevelRefTable)->Arc_EOL) {\r
-               returnStatus = FALSE;\r
+       returnStatus = DslGetSecurityLevel(&currentSecurityLevel);\r
+       if (returnStatus == E_OK) {\r
+               while ( ((*securityLevelRefTable)->DspSecurityLevel != currentSecurityLevel) && (!(*securityLevelRefTable)->Arc_EOL) ) {\r
+                       securityLevelRefTable++;\r
+               }\r
+               if (!(*securityLevelRefTable)->Arc_EOL) {\r
+                       levelFound = TRUE;\r
+               }\r
        }\r
 \r
-       return returnStatus;\r
+       return levelFound;\r
 }\r
 \r
 \r
@@ -282,6 +288,8 @@ static Dcm_NegativeResponseCodeType udsReadDtcInfoSub_0x01_0x07_0x11_0x12(const
                Dem_ReturnGetNumberOfFilteredDTCType getNumerResult;\r
                uint16 numberOfFilteredDtc;\r
                uint8 dtcStatusMask;\r
+               //lint -e826    PC-Lint exception - Suspicious pointer conversion\r
+               //lint -e927    PC-Lint exception - Pointer to pointer cast\r
                TxDataType *txData = (TxDataType*)pduTxData->SduDataPtr;\r
 \r
                /** @req DCM376 */\r
@@ -361,6 +369,8 @@ static Dcm_NegativeResponseCodeType udsReadDtcInfoSub_0x02_0x0A_0x0F_0x13_0x15(c
 \r
        if (setDtcFilterResult == DEM_FILTER_ACCEPTED) {\r
                uint8 dtcStatusMask;\r
+               //lint -e826    PC-Lint exception - Suspicious pointer conversion\r
+               //lint -e927    PC-Lint exception - Pointer to pointer cast\r
                TxDataType *txData = (TxDataType*)pduTxData->SduDataPtr;\r
                Dem_ReturnGetNextFilteredDTCType getNextFilteredDtcResult;\r
                uint32 dtc;\r
@@ -393,7 +403,7 @@ static Dcm_NegativeResponseCodeType udsReadDtcInfoSub_0x02_0x0A_0x0F_0x13_0x15(c
                                responseCode = DCM_E_REQUESTOUTOFRANGE;\r
                        }\r
                }\r
-               pduTxData->SduLength = 3 + (nrOfDtcs * sizeof(dtcAndStatusRecordType));\r
+               pduTxData->SduLength = (PduLengthType)(3 + (nrOfDtcs * sizeof(dtcAndStatusRecordType)));\r
        }\r
        else {\r
                responseCode = DCM_E_REQUESTOUTOFRANGE;\r
@@ -403,7 +413,7 @@ static Dcm_NegativeResponseCodeType udsReadDtcInfoSub_0x02_0x0A_0x0F_0x13_0x15(c
 }\r
 \r
 // PC-Lint (715 etc): Remove errors until function is filled.\r
-//lint -save -e*\r
+//lint -save -e715 -e838 -e818         Symbol not referenced, responseCode not used, txData should be const\r
 static Dcm_NegativeResponseCodeType udsReadDtcInfoSub_0x08(const PduInfoType *pduRxData, PduInfoType *pduTxData)\r
 {\r
        Dcm_NegativeResponseCodeType responseCode = DCM_E_POSITIVERESPONSE;\r
@@ -417,7 +427,7 @@ static Dcm_NegativeResponseCodeType udsReadDtcInfoSub_0x08(const PduInfoType *pd
 \r
 \r
 // PC-Lint (715 etc): Remove errors until function is filled.\r
-//lint -save -e*\r
+//lint -save -e715 -e838 -e818         Symbol not referenced, responseCode not used, txData should be const\r
 static Dcm_NegativeResponseCodeType udsReadDtcInfoSub_0x09(const PduInfoType *pduRxData, PduInfoType *pduTxData)\r
 {\r
        Dcm_NegativeResponseCodeType responseCode = DCM_E_POSITIVERESPONSE;\r
@@ -482,7 +492,7 @@ static Dcm_NegativeResponseCodeType udsReadDtcInfoSub_0x06_0x10(const PduInfoTyp
                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
-                       uint16 recNum;\r
+                       uint8 recNum;\r
                        uint16 recLength;\r
                        uint16 txIndex = 6;\r
 \r
@@ -518,7 +528,7 @@ static Dcm_NegativeResponseCodeType udsReadDtcInfoSub_0x06_0x10(const PduInfoTyp
 \r
 \r
 // PC-Lint (715 etc): Remove errors until function is filled.\r
-//lint -save -e*\r
+//lint -save -e715 -e838 -e818         Symbol not referenced, responseCode not used, txData should be const\r
 static Dcm_NegativeResponseCodeType udsReadDtcInfoSub_0x03(const PduInfoType *pduRxData, PduInfoType *pduTxData)\r
 {\r
        Dcm_NegativeResponseCodeType responseCode = DCM_E_POSITIVERESPONSE;\r
@@ -532,7 +542,7 @@ static Dcm_NegativeResponseCodeType udsReadDtcInfoSub_0x03(const PduInfoType *pd
 \r
 \r
 // PC-Lint (715 etc): Remove errors until function is filled.\r
-//lint -save -e*\r
+//lint -save -e715 -e838 -e818         Symbol not referenced, responseCode not used, txData should be const\r
 static Dcm_NegativeResponseCodeType udsReadDtcInfoSub_0x04(const PduInfoType *pduRxData, PduInfoType *pduTxData)\r
 {\r
        Dcm_NegativeResponseCodeType responseCode = DCM_E_POSITIVERESPONSE;\r
@@ -546,7 +556,7 @@ static Dcm_NegativeResponseCodeType udsReadDtcInfoSub_0x04(const PduInfoType *pd
 \r
 \r
 // PC-Lint (715 etc): Remove errors until function is filled.\r
-//lint -save -e*\r
+//lint -save -e715 -e838 -e818         Symbol not referenced, responseCode not used, txData should be const\r
 static Dcm_NegativeResponseCodeType udsReadDtcInfoSub_0x05(const PduInfoType *pduRxData, PduInfoType *pduTxData)\r
 {\r
        Dcm_NegativeResponseCodeType responseCode = DCM_E_POSITIVERESPONSE;\r
@@ -560,7 +570,7 @@ static Dcm_NegativeResponseCodeType udsReadDtcInfoSub_0x05(const PduInfoType *pd
 \r
 \r
 // PC-Lint (715 etc): Remove errors until function is filled.\r
-//lint -save -e*\r
+//lint -save -e715 -e838 -e818         Symbol not referenced, responseCode not used, txData should be const\r
 static Dcm_NegativeResponseCodeType udsReadDtcInfoSub_0x0B_0x0C_0x0D_0x0E(const PduInfoType *pduRxData, PduInfoType *pduTxData)\r
 {\r
        Dcm_NegativeResponseCodeType responseCode = DCM_E_POSITIVERESPONSE;\r
@@ -574,7 +584,7 @@ static Dcm_NegativeResponseCodeType udsReadDtcInfoSub_0x0B_0x0C_0x0D_0x0E(const
 \r
 \r
 // PC-Lint (715 etc): Remove errors until function is filled.\r
-//lint -save -e*\r
+//lint -save -e715 -e838 -e818         Symbol not referenced, responseCode not used, txData should be const\r
 static Dcm_NegativeResponseCodeType udsReadDtcInfoSub_0x14(const PduInfoType *pduRxData, PduInfoType *pduTxData)\r
 {\r
        Dcm_NegativeResponseCodeType responseCode = DCM_E_POSITIVERESPONSE;\r
@@ -719,7 +729,7 @@ static Dcm_NegativeResponseCodeType readDidData(const Dcm_DspDidType *didPtr, Pd
                                                if ((*txPos + didLen + 2) <= pduTxData->SduLength) {\r
                                                        pduTxData->SduDataPtr[*txPos] = (didPtr->DspDidIdentifier >> 8) & 0xFFu;\r
                                                        (*txPos)++;\r
-                                                       pduTxData->SduDataPtr[*txPos] = (didPtr->DspDidIdentifier >> 0) & 0xFFu;\r
+                                                       pduTxData->SduDataPtr[*txPos] = didPtr->DspDidIdentifier & 0xFFu;\r
                                                        (*txPos)++;\r
                                                        result = didPtr->DspDidReadDataFnc(&pduTxData->SduDataPtr[*txPos]);     /** @req DCM437 */\r
                                                        *txPos += didLen;\r
@@ -767,7 +777,7 @@ void DspUdsReadDataByIdentifier(const PduInfoType *pduRxData, PduInfoType *pduTx
 {\r
        /** @req DCM253 */\r
        Dcm_NegativeResponseCodeType responseCode = DCM_E_POSITIVERESPONSE;\r
-       uint8 nrOfDids;\r
+       uint16 nrOfDids;\r
        uint16 didNr;\r
        const Dcm_DspDidType *didPtr = NULL;\r
 \r
@@ -813,7 +823,7 @@ static Dcm_NegativeResponseCodeType readDidScalingData(const Dcm_DspDidType *did
 \r
                        pduTxData->SduDataPtr[*txPos] = (didPtr->DspDidIdentifier >> 8) & 0xFFu;\r
                        (*txPos)++;\r
-                       pduTxData->SduDataPtr[*txPos] = (didPtr->DspDidIdentifier >> 0) & 0xFFu;\r
+                       pduTxData->SduDataPtr[*txPos] = didPtr->DspDidIdentifier & 0xFFu;\r
                        (*txPos)++;\r
                        result = didPtr->DspDidGetScalingInfoFnc(&pduTxData->SduDataPtr[*txPos], &errorCode);   /** @req DCM394 */\r
                        *txPos += scalingInfoLen;\r
@@ -888,7 +898,7 @@ static Dcm_NegativeResponseCodeType writeDidData(const Dcm_DspDidType *didPtr, c
 \r
                                        if (result == E_OK) {\r
                                                if (didLen == writeDidLen) {    /** @req DCM473 */\r
-                                                       result = didPtr->DspDidWriteDataFnc(&pduRxData->SduDataPtr[3], didLen, &errorCode);     /** @req DCM395 */\r
+                                                       result = didPtr->DspDidWriteDataFnc(&pduRxData->SduDataPtr[3], (uint8)didLen, &errorCode);      /** @req DCM395 */\r
                                                        if ((result != E_OK) || (errorCode != DCM_E_POSITIVERESPONSE)) {\r
                                                                responseCode = DCM_E_CONDITIONSNOTCORRECT;\r
                                                        }\r
@@ -941,7 +951,7 @@ void DspUdsWriteDataByIdentifier(const PduInfoType *pduRxData, PduInfoType *pduT
        if (responseCode == DCM_E_POSITIVERESPONSE) {\r
                pduTxData->SduLength = 3;\r
                pduTxData->SduDataPtr[1] = (didNr >> 8) & 0xFFu;\r
-               pduTxData->SduDataPtr[2] = (didNr >> 0) & 0xFFu;\r
+               pduTxData->SduDataPtr[2] = didNr & 0xFFu;\r
        }\r
 \r
        DsdDspProcessingDone(responseCode);\r