From ce2b5f1950cf9dbe8157cc377d7c84f14fef4a3c Mon Sep 17 00:00:00 2001 From: john Date: Tue, 11 Sep 2012 11:30:24 +0200 Subject: [PATCH] Partial of the delivered changes (20120911) commited. --- diagnostic/Dcm/Dcm_Dsp.c | 190 +++++++++++++++++---------------------- include/Dcm_Lcfg.h | 8 +- 2 files changed, 85 insertions(+), 113 deletions(-) diff --git a/diagnostic/Dcm/Dcm_Dsp.c b/diagnostic/Dcm/Dcm_Dsp.c index 9eb18ba8..a94a10db 100644 --- a/diagnostic/Dcm/Dcm_Dsp.c +++ b/diagnostic/Dcm/Dcm_Dsp.c @@ -2743,23 +2743,16 @@ void DspDynamicallyDefineDataIdentifier(const PduInfoType *pduRxData,PduInfoType static Dcm_NegativeResponseCodeType DspIOControlReturnControlToECU(const Dcm_DspDidType *DidPtr,const PduInfoType *pduRxData,PduInfoType *pduTxData) { Dcm_NegativeResponseCodeType responseCode = DCM_E_POSITIVERESPONSE; - if(DidPtr->DspDidInfoRef->DspDidAccess.DspDidControl->DspDidReturnControlToEcu == TRUE) + if(pduRxData->SduLength > 4) { - if(pduRxData->SduLength > 4) + if(DidPtr->DspDidInfoRef->DspDidAccess.DspDidControl != NULL) { - if(DidPtr->DspDidInfoRef->DspDidAccess.DspDidControl != NULL) + if(((DidPtr->DspDidInfoRef->DspDidAccess.DspDidControl->DspDidReturnControlToEcu->DspDidControlOptionRecordSize + 7) >> 3) == (pduRxData->SduLength - 4)) { - if(((DidPtr->DspDidControlRecordSize->DspDidControlRecordSize + 7) >> 3) == (pduRxData->SduLength - 4)) + if(DidPtr->DspDidReturnControlToEcuFnc != NULL) { - if(DidPtr->DspDidReturnControlToEcuFnc != NULL) - { - DidPtr->DspDidReturnControlToEcuFnc(NULL,&pduRxData->SduDataPtr[4],&pduTxData->SduDataPtr[4],&responseCode); - - } - else - { - responseCode = DCM_E_REQUESTOUTOFRANGE; - } + DidPtr->DspDidReturnControlToEcuFnc(NULL,&pduRxData->SduDataPtr[4],&pduTxData->SduDataPtr[4],&responseCode); + } else { @@ -2773,32 +2766,32 @@ static Dcm_NegativeResponseCodeType DspIOControlReturnControlToECU(const Dcm_Dsp } else { - if(DidPtr->DspDidReturnControlToEcuFnc != NULL) - { + responseCode = DCM_E_REQUESTOUTOFRANGE; + } + } + else + { + if(DidPtr->DspDidReturnControlToEcuFnc != NULL) + { - if(DidPtr->DspDidControlRecordSize != NULL) - { - DidPtr->DspDidReturnControlToEcuFnc(NULL,NULL,&pduTxData->SduDataPtr[4],&responseCode); - pduTxData->SduLength = DidPtr->DspDidControlRecordSize->DspDidControlStatusRecordSize + 4; - } - else - { - responseCode = DCM_E_REQUESTOUTOFRANGE; - } + if(DidPtr->DspDidControlRecordSize != NULL) + { + DidPtr->DspDidReturnControlToEcuFnc(NULL,NULL,&pduTxData->SduDataPtr[4],&responseCode); + pduTxData->SduLength = DidPtr->DspDidInfoRef->DspDidAccess.DspDidControl->DspDidReturnControlToEcu->DspDidControlStatusRecordSize + 4; } else { responseCode = DCM_E_REQUESTOUTOFRANGE; } } - } - else - { - responseCode = DCM_E_REQUESTOUTOFRANGE; + else + { + responseCode = DCM_E_REQUESTOUTOFRANGE; + } } if(responseCode == DCM_E_POSITIVERESPONSE) { - pduTxData->SduLength = DidPtr->DspDidControlRecordSize->DspDidControlStatusRecordSize + 4; + pduTxData->SduLength = DidPtr->DspDidInfoRef->DspDidAccess.DspDidControl->DspDidReturnControlToEcu->DspDidControlStatusRecordSize + 4; pduTxData->SduDataPtr[3] = DCM_RETURN_CONTROL_TO_ECU; } @@ -2808,22 +2801,15 @@ static Dcm_NegativeResponseCodeType DspIOControlReturnControlToECU(const Dcm_Dsp static Dcm_NegativeResponseCodeType DspIOControlResetToDefault(const Dcm_DspDidType *DidPtr,const PduInfoType *pduRxData,PduInfoType *pduTxData) { Dcm_NegativeResponseCodeType responseCode = DCM_E_POSITIVERESPONSE; - if(DidPtr->DspDidInfoRef->DspDidAccess.DspDidControl->DspDidResetToDefault == TRUE) + if(pduRxData->SduLength > 4) { - if(pduRxData->SduLength > 4) + if(DidPtr->DspDidInfoRef->DspDidAccess.DspDidControl != NULL) { - if(DidPtr->DspDidInfoRef->DspDidAccess.DspDidControl != NULL) + if(((DidPtr->DspDidInfoRef->DspDidAccess.DspDidControl->DspDidResetToDefault->DspDidControlOptionRecordSize + 7) >> 3) == (pduRxData->SduLength - 4)) { - if(((DidPtr->DspDidControlRecordSize->DspDidControlRecordSize + 7) >> 3) == (pduRxData->SduLength - 4)) + if(DidPtr->DspDidReturnControlToEcuFnc != NULL) { - if(DidPtr->DspDidReturnControlToEcuFnc != NULL) - { - DidPtr->DspDidResetToDeaultFnc(NULL,&pduRxData->SduDataPtr[4],&pduTxData->SduDataPtr[4],&responseCode); - } - else - { - responseCode = DCM_E_REQUESTOUTOFRANGE; - } + DidPtr->DspDidResetToDeaultFnc(NULL,&pduRxData->SduDataPtr[4],&pduTxData->SduDataPtr[4],&responseCode); } else { @@ -2837,32 +2823,32 @@ static Dcm_NegativeResponseCodeType DspIOControlResetToDefault(const Dcm_DspDidT } else { - if(DidPtr->DspDidResetToDeaultFnc != NULL) - { + responseCode = DCM_E_REQUESTOUTOFRANGE; + } + } + else + { + if(DidPtr->DspDidResetToDeaultFnc != NULL) + { - if(DidPtr->DspDidControlRecordSize != NULL) - { - DidPtr->DspDidResetToDeaultFnc(NULL,NULL,&pduTxData->SduDataPtr[4],&responseCode); - pduTxData->SduLength = DidPtr->DspDidControlRecordSize->DspDidControlStatusRecordSize + 4; - } - else - { - responseCode = DCM_E_REQUESTOUTOFRANGE; - } + if(DidPtr->DspDidControlRecordSize != NULL) + { + DidPtr->DspDidResetToDeaultFnc(NULL,NULL,&pduTxData->SduDataPtr[4],&responseCode); + pduTxData->SduLength = DidPtr->DspDidInfoRef->DspDidAccess.DspDidControl->DspDidResetToDefault->DspDidControlStatusRecordSize + 4; } else { responseCode = DCM_E_REQUESTOUTOFRANGE; } } - } - else - { - responseCode = DCM_E_REQUESTOUTOFRANGE; + else + { + responseCode = DCM_E_REQUESTOUTOFRANGE; + } } if(responseCode == DCM_E_POSITIVERESPONSE) { - pduTxData->SduLength = DidPtr->DspDidControlRecordSize->DspDidControlStatusRecordSize+4; + pduTxData->SduLength = DidPtr->DspDidInfoRef->DspDidAccess.DspDidControl->DspDidResetToDefault->DspDidControlStatusRecordSize+4; pduTxData->SduDataPtr[3] = DCM_RESET_TO_DEFAULT; } return responseCode; @@ -2874,22 +2860,15 @@ static Dcm_NegativeResponseCodeType DspIOControlResetToDefault(const Dcm_DspDidT static Dcm_NegativeResponseCodeType DspIOControlFreezeCurrentState(const Dcm_DspDidType *DidPtr,const PduInfoType *pduRxData,PduInfoType *pduTxData) { Dcm_NegativeResponseCodeType responseCode = DCM_E_POSITIVERESPONSE; - if(DidPtr->DspDidInfoRef->DspDidAccess.DspDidControl->DspDidFreezeCurrentState == TRUE) + if(pduRxData->SduLength > 4) { - if(pduRxData->SduLength > 4) + if(DidPtr->DspDidInfoRef->DspDidAccess.DspDidControl != NULL) { - if(DidPtr->DspDidInfoRef->DspDidAccess.DspDidControl != NULL) + if(((DidPtr->DspDidInfoRef->DspDidAccess.DspDidControl->DspDidFreezeCurrentState->DspDidControlOptionRecordSize + 7) >> 3) == (pduRxData->SduLength - 4)) { - if(((DidPtr->DspDidControlRecordSize->DspDidControlRecordSize + 7) >> 3) == (pduRxData->SduLength - 4)) + if(DidPtr->DspDidFreezeCurrentStateFnc != NULL) { - if(DidPtr->DspDidFreezeCurrentStateFnc != NULL) - { - DidPtr->DspDidFreezeCurrentStateFnc(NULL,&pduRxData->SduDataPtr[4],&pduTxData->SduDataPtr[4],&responseCode); - } - else - { - responseCode = DCM_E_REQUESTOUTOFRANGE; - } + DidPtr->DspDidFreezeCurrentStateFnc(NULL,&pduRxData->SduDataPtr[4],&pduTxData->SduDataPtr[4],&responseCode); } else { @@ -2903,32 +2882,32 @@ static Dcm_NegativeResponseCodeType DspIOControlFreezeCurrentState(const Dcm_Dsp } else { - if(DidPtr->DspDidFreezeCurrentStateFnc != NULL) - { + responseCode = DCM_E_REQUESTOUTOFRANGE; + } + } + else + { + if(DidPtr->DspDidFreezeCurrentStateFnc != NULL) + { - if(DidPtr->DspDidControlRecordSize != 0) - { - DidPtr->DspDidFreezeCurrentStateFnc(NULL,NULL,&pduTxData->SduDataPtr[4],&responseCode); - pduTxData->SduLength = DidPtr->DspDidControlRecordSize->DspDidControlStatusRecordSize + 4; - } - else - { - responseCode = DCM_E_REQUESTOUTOFRANGE; - } + if(DidPtr->DspDidControlRecordSize != 0) + { + DidPtr->DspDidFreezeCurrentStateFnc(NULL,NULL,&pduTxData->SduDataPtr[4],&responseCode); + pduTxData->SduLength = DidPtr->DspDidInfoRef->DspDidAccess.DspDidControl->DspDidFreezeCurrentState->DspDidControlStatusRecordSize + 4; } else { responseCode = DCM_E_REQUESTOUTOFRANGE; } } - } - else - { - responseCode = DCM_E_REQUESTOUTOFRANGE; + else + { + responseCode = DCM_E_REQUESTOUTOFRANGE; + } } if(responseCode == DCM_E_POSITIVERESPONSE) { - pduTxData->SduLength = DidPtr->DspDidControlRecordSize->DspDidControlStatusRecordSize + 4; + pduTxData->SduLength = DidPtr->DspDidInfoRef->DspDidAccess.DspDidControl->DspDidFreezeCurrentState->DspDidControlStatusRecordSize + 4; pduTxData->SduDataPtr[3] = DCM_FREEZE_CURRENT_STATE; } @@ -2938,41 +2917,34 @@ static Dcm_NegativeResponseCodeType DspIOControlFreezeCurrentState(const Dcm_Dsp static Dcm_NegativeResponseCodeType DspIOControlShortTeamAdjustment(const Dcm_DspDidType *DidPtr,const PduInfoType *pduRxData,PduInfoType *pduTxData) { Dcm_NegativeResponseCodeType responseCode = DCM_E_POSITIVERESPONSE; - uint8 didControlOptionRecordSize = DidPtr->DspDidControlRecordSize->DspDidControlOptionRecordSize; - if(DidPtr->DspDidInfoRef->DspDidAccess.DspDidControl->DspDidShortTermAdjustment == TRUE) + uint8 didControlOptionRecordSize = DidPtr->DspDidInfoRef->DspDidAccess.DspDidControl->DspDidShortTermAdjustment->DspDidControlOptionRecordSize; + if(pduRxData->SduLength > 4) { - if(pduRxData->SduLength > 4) + if(DidPtr->DspDidInfoRef->DspDidAccess.DspDidControl != NULL) { - if(DidPtr->DspDidInfoRef->DspDidAccess.DspDidControl != NULL) + if(((((DidPtr->DspDidInfoRef->DspDidAccess.DspDidControl->DspDidShortTermAdjustment->DspDidControlRecordSize + 7)) >> 3) + (didControlOptionRecordSize)) == (pduRxData->SduLength - 4)) { - if(((((DidPtr->DspDidControlRecordSize->DspDidControlRecordSize + 7)) >> 3) + (didControlOptionRecordSize)) == (pduRxData->SduLength - 4)) + if(DidPtr->DspDidShortTermAdjustmentFnc != NULL) { - if(DidPtr->DspDidShortTermAdjustmentFnc != NULL) - { - DidPtr->DspDidShortTermAdjustmentFnc(&pduRxData->SduDataPtr[4],&pduRxData->SduDataPtr[4 + didControlOptionRecordSize],&pduTxData->SduDataPtr[4],&responseCode); - } - else - { - responseCode = DCM_E_REQUESTOUTOFRANGE; - } + DidPtr->DspDidShortTermAdjustmentFnc(&pduRxData->SduDataPtr[4],&pduRxData->SduDataPtr[4 + didControlOptionRecordSize],&pduTxData->SduDataPtr[4],&responseCode); } - else if((didControlOptionRecordSize) == (pduRxData->SduLength - 4)) + else { - if(DidPtr->DspDidShortTermAdjustmentFnc != NULL) - { - DidPtr->DspDidShortTermAdjustmentFnc(&pduRxData->SduDataPtr[4],NULL,&pduTxData->SduDataPtr[4],&responseCode); - } - else - { - responseCode = DCM_E_REQUESTOUTOFRANGE; - } + responseCode = DCM_E_REQUESTOUTOFRANGE; + } + } + else if((didControlOptionRecordSize) == (pduRxData->SduLength - 4)) + { + if(DidPtr->DspDidShortTermAdjustmentFnc != NULL) + { + DidPtr->DspDidShortTermAdjustmentFnc(&pduRxData->SduDataPtr[4],NULL,&pduTxData->SduDataPtr[4],&responseCode); } else { responseCode = DCM_E_REQUESTOUTOFRANGE; } } - else + else { responseCode = DCM_E_REQUESTOUTOFRANGE; } @@ -2988,7 +2960,7 @@ static Dcm_NegativeResponseCodeType DspIOControlShortTeamAdjustment(const Dcm_Ds } if(responseCode == DCM_E_POSITIVERESPONSE) { - pduTxData->SduLength = DidPtr->DspDidControlRecordSize->DspDidControlStatusRecordSize + 4; + pduTxData->SduLength = DidPtr->DspDidInfoRef->DspDidAccess.DspDidControl->DspDidShortTermAdjustment->DspDidControlStatusRecordSize + 4; pduTxData->SduDataPtr[3] = DCM_SHORT_TERM_ADJUSTMENT; } diff --git a/include/Dcm_Lcfg.h b/include/Dcm_Lcfg.h index 2fc05fd3..20579139 100644 --- a/include/Dcm_Lcfg.h +++ b/include/Dcm_Lcfg.h @@ -131,10 +131,10 @@ typedef struct { typedef struct { const Dcm_DspSessionRowType **DspDidControlSessionRef; // (1..*) /** @req DCM621 */ const Dcm_DspSecurityRowType **DspDidControlSecurityLevelRef; // (1..*) /** @req DCM620 */ - const boolean DspDidFreezeCurrentState; // (0..1) /** @req DCM624 */ - const boolean DspDidResetToDefault; // (0..1) /** @req DCM623 */ - const boolean DspDidReturnControlToEcu; // (0..1) /** @req DCM622 */ - const boolean DspDidShortTermAdjustment; // (0..1) /** @req DCM625 */ + const Dcm_DspDidControlRecordSizesType *DspDidFreezeCurrentState; // (0..1) /** @req DCM624 */ + const Dcm_DspDidControlRecordSizesType *DspDidResetToDefault; // (0..1) /** @req DCM623 */ + const Dcm_DspDidControlRecordSizesType *DspDidReturnControlToEcu; // (0..1) /** @req DCM622 */ + const Dcm_DspDidControlRecordSizesType *DspDidShortTermAdjustment; // (0..1) /** @req DCM625 */ } Dcm_DspDidControlType; /** @req DCM619 */ // 10.2.27 -- 2.39.2