Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*----------------------------------------------------------------------------*/
- /**
- * \file
- *
- * \brief BMW stub MyDcm_Callbacks.c
- *
- * This file contains the implementation of the BMW stub MyDcm_Callbacks
- * for usage in the BMW AUTOSAR Core Example.
- *
- * \project BMW AUTOSAR Core
- *
- * \par To be changed by user:
- * [no]
- *
- * \copyright BMW AG 2015
- *
- * \remarks
- * DISCLAIMER:
- * As the program is not fully tested and qualified for series production
- * use, the user shall not be entitled to use the program in connection
- * with any series production. BMW provides the user with the program only
- * as sample application (for testing purposes).
- *
- */
- /*----------------------------------------------------------------------------*/
- #ifndef I_KNOW_THAT_THIS_CODE_IS_NOT_FOR_PRODUCTION
- #error "the program must not be used in connection with series production"
- #endif
- #include <MyDcm_Callbacks.h>
- #include <Rte_MyDcm.h>
- #include "Stubs.h"
- #include "Mcu.h"
- #include "EcuM.h"
- #include "BswM_Callouts.h"
- #define DCM_START_SEC_CODE
- #include <MemMap.h>
- /**********************************************************************************************************************
- ******************************* Global Variables *********************************************************************
- *********************************************************************************************************************/
- uint8 u8_IndicationConfirmation=0;
- uint8 u8_ModeReceived;
- extern uint8 reset_42_condition;
- extern uint8 reset_01_condition;
- extern uint8 Brief_Shutdown_ECU;
- extern FUNC(Std_ReturnType, RTE_CODE) Rte_Read_LowPowerMode_rDWAInternalStatus_u1DWAState (P2VAR(uint8, AUTOMATIC, RTE_APPL_DATA) data);
- FUNC(Std_ReturnType, RTE_APPL_CODE) MyDcm_Runnable_GEEDS_Temp_Mile_KM(P2VAR(uint8, AUTOMATIC, RTE_APPL_DATA) Data)
- {
- P2VAR(uint8, AUTOMATIC, RTE_APPL_DATA) LOC_pu8SGMILE_KM_816RValue = pu8SGMILE_KM_816RValue+2;
- *Data = (*LOC_pu8SGMILE_KM_816RValue);
- Data++;
- LOC_pu8SGMILE_KM_816RValue--;
- *Data = (*LOC_pu8SGMILE_KM_816RValue);
- Data++;
- LOC_pu8SGMILE_KM_816RValue--;
- *Data = (*LOC_pu8SGMILE_KM_816RValue);
- return RTE_E_OK;
- }
- FUNC(Std_ReturnType, RTE_APPL_CODE) MyDcm_Runnable_READ_BN(P2VAR(uint8, AUTOMATIC, RTE_APPL_DATA) Data)
- {
- *Data = u8BN_DEM;
- return RTE_E_OK;
- }
- FUNC(Std_ReturnType, RTE_APPL_CODE) MyDcm_Runnable_READ_TN(P2VAR(uint8, AUTOMATIC, RTE_APPL_DATA) Data)
- {
- Data[0] = u8TN_DEM[0];
- Data[1] = u8TN_DEM[1];
- Data[2] = u8TN_DEM[2];
- return RTE_E_OK;
- }
- FUNC(void, DCM_APPL_CODE) MyDcm_vidJumptoBL(void)
- {
- Srv_BootModeSet(SRV_BOOT_MODE_BOOTLOADER, (Dcm_ProgConditionsType*)&switchToProgrammingSessionNoResponse);
- User_ChangeShutdownTarget_To_Reset();
- BswM_On_Prep_Shutdown();
- }
- FUNC(Std_ReturnType, RTE_APPL_CODE) MyDcm_ManufacturerIndication(uint8 SID, P2CONST(uint8, AUTOMATIC, RTE_APPL_CONST) RequestData, uint16 DataSize, uint8 ReqType, uint16 SourceAddress, P2VAR(MyDcm_DCM_NegativeResponseCodeType, AUTOMATIC, RTE_APPL_DATA) ErrorCode)
- {
- uint8 returnValue = E_OK;
- uint8 u8DwaArmedState;
- // TS_PARAM_UNUSED(SID);
- // TS_PARAM_UNUSED(RequestData);
- TS_PARAM_UNUSED(DataSize);
- TS_PARAM_UNUSED(ReqType);
- TS_PARAM_UNUSED(SourceAddress);
- Rte_Read_LowPowerMode_rDWAInternalStatus_u1DWAState(&u8DwaArmedState);
- if ( u8DwaArmedState == (uint8)1)
- {
- if ((SID != (uint8)0x22) && (SID != (uint8)0x19))
- {
- if((SID == 0x31) && (RequestData[0]==0x01) && (RequestData[1]==0xaa) && (RequestData[2]==0x79))
- {
- returnValue = E_OK;
- }
- else
- {
- returnValue=E_NOT_OK;
- *ErrorCode=DCM_E_CONDITIONSNOTCORRECT;
- }
- }
- }
- if ((SID == 0x31) && (RequestData[0]==0x01) && (RequestData[1]==0x0F) && (RequestData[2]==0x0C))
- {
- if(u8_IndicationConfirmation == 0)
- {
- u8_IndicationConfirmation = 1;
- u8_ModeReceived = RequestData[3];
- }
- }
- return returnValue;
- }
- FUNC(Std_ReturnType, RTE_APPL_CODE) MyDcm_ManufacturerConfirmation(uint8 SID, uint8 ReqType, uint16 SourceAddress, MyDcm_DCM_ConfirmationStatusType ConfirmationStatus)
- {
- TS_PARAM_UNUSED(SID);
- TS_PARAM_UNUSED(ReqType);
- TS_PARAM_UNUSED(ConfirmationStatus);
- if(Brief_Shutdown_ECU==1)
- {
- EcuM_AL_SwitchOff();
- }
- /* if(reset_42_condition == 1)
- {
- reset_42_condition=0;
- Mcu_PerformReset();
- }*/
- if(reset_01_condition == 1)
- {
- reset_01_condition=0;
- EcuM_SelectShutdownTarget(ECUM_STATE_RESET,ECUM_RESET_WDG);
- /*EcuM_SelectShutdownTarget(ECUM_STATE_RESET,ECUM_STATE_OFF);*/
- BswM_On_Prep_Shutdown();
- }
- //Check if routine 0F0C is received and with a positive response
- if(u8_IndicationConfirmation == 1 && ConfirmationStatus== 0x00){
- u8_IndicationConfirmation = 0;
- switch(u8_ModeReceived)
- {
- case 0:
- BswM_RequestMode(RP_OMC_OperatingMode,OMC_MODE_ASSEMBLY);
- break;
- case 1:
- BswM_RequestMode(RP_OMC_OperatingMode,OMC_MODE_BMWFLASH);
- break;
- case 2:
- BswM_RequestMode(RP_OMC_OperatingMode,OMC_MODE_NORMAL);
- break;
- case 3:
- BswM_RequestMode(RP_OMC_OperatingMode,OMC_MODE_TRANSPORT);
- break;
- default:
- break;
- }
- }
- return E_OK;
- }
- FUNC(Std_ReturnType, DCM_CODE) Dcm_SetProgConditions
- (
- P2VAR(Dcm_ProgConditionsType, AUTOMATIC, DCM_APPL_DATA) myProgConditions
- )
- {
- Srv_BootModeSet(SRV_BOOT_MODE_BOOTLOADER, myProgConditions);
- return E_OK;
- }
- FUNC(Dcm_EcuStartModeType, DCM_CODE) Dcm_GetProgConditions
- (
- P2VAR(Dcm_ProgConditionsType, AUTOMATIC, DCM_APPL_DATA) myProgConditions
- )
- {
- return DCM_COLD_START;
- }
- FUNC(void, DCM_CALLOUT_CODE) Dcm_Confirmation(Dcm_IdContextType idContext, PduIdType dcmRxPduId, Dcm_ConfirmationStatusType status)
- {
- }
- #define DCM_STOP_SEC_CODE
- #include <MemMap.h>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement