From: mahi Date: Thu, 13 Sep 2012 06:12:16 +0000 (+0200) Subject: EcuM/Mcu integration fixes X-Git-Url: https://rtime.felk.cvut.cz/gitweb/arc.git/commitdiff_plain/6042885259e7a6fe561311e5d2297e3f7c129b65 EcuM/Mcu integration fixes --- diff --git a/arch/generic/linux/drivers/Mcu.c b/arch/generic/linux/drivers/Mcu.c index 90017fc8..86065387 100644 --- a/arch/generic/linux/drivers/Mcu.c +++ b/arch/generic/linux/drivers/Mcu.c @@ -36,6 +36,9 @@ void Mcu_Init(const Mcu_ConfigType *configPtr) } +void Mcu_SetMode( Mcu_ModeType McuMode ) { + (void)McuMode; +} /** * Get the system clock in Hz. It calculates the clock from the diff --git a/boards/board_common.mk b/boards/board_common.mk index f52e4e79..76e7e6dd 100644 --- a/boards/board_common.mk +++ b/boards/board_common.mk @@ -37,7 +37,7 @@ endif obj-$(USE_ECUM) += EcuM.o obj-$(USE_ECUM) += EcuM_Main.o obj-$(USE_ECUM) += EcuM_PBcfg.o -ifneq ($(filter EcuM_Callout_Stubs.o,$(obj-y)),) +ifeq ($(filter EcuM_Callout_Stubs.o,$(obj-y)),) obj-$(USE_ECUM) += EcuM_Callout_Stubs.o endif obj-$(USE_ECUM)-$(CFG_ECUM_USE_SERVICE_COMPONENT) += EcuM_ServiceComponent.o @@ -61,7 +61,7 @@ inc-$(USE_DMA) += $(ROOTDIR)/$(ARCH_PATH-y)/drivers # Mcu obj-$(USE_MCU) += Mcu.o obj-$(USE_MCU) += Mcu_Cfg.o -obj-$(USE_MCU) += Mcu_Sleep.o +obj-$(USE_MCU)-$(CFG_PPC) += Mcu_Sleep.o #obj-$(CFG_MPC55XX)-$(USE_MCU) += Mcu_Exceptions.o # Flash diff --git a/boards/generic/EcuM_Callout_Stubs.c b/boards/generic/EcuM_Callout_Stubs.c index a56f1f28..30680323 100644 --- a/boards/generic/EcuM_Callout_Stubs.c +++ b/boards/generic/EcuM_Callout_Stubs.c @@ -95,6 +95,14 @@ #include "WdgM.h" #endif +#define VALIDATE_STATE(_state) \ + do { \ + EcuM_StateType ecuMState; \ + EcuM_GetState(&ecuMState); \ + assert(ecuMState == (_state) ); \ + } while(0) + + void EcuM_AL_DriverInitZero(void) { Det_Init();/** @req EcuM2783 */ @@ -330,3 +338,71 @@ void EcuM_AL_SwitchOff(void) { } + +void EcuM_CheckWakeup(EcuM_WakeupSourceType source) { +} + +void EcuM_EnableWakeupSources( EcuM_WakeupSourceType source ) { +} + +void EcuM_DisableWakeupSources(EcuM_WakeupSourceType wakeupSource) { +} + + +/** + * + * + * + * @param wakeupSource + */ +void EcuM_StartWakeupSources(EcuM_WakeupSourceType wakeupSource) { + VALIDATE_STATE( ECUM_STATE_WAKEUP_VALIDATION ); + +} + + +/** + * Restart drivers.. + */ +void EcuM_AL_DriverRestart( void ) { + + VALIDATE_STATE( ECUM_STATE_WAKEUP_VALIDATION ); + +} + + +/** + * + * @param wact + * @return + */ +EcuM_WakeupReactionType EcuM_OnWakeupReaction( EcuM_WakeupReactionType wact ) { + + VALIDATE_STATE( ECUM_STATE_WAKEUP_REACTION ); + + return wact; +} + +/** + * Generate RAM hash. + * We are in ECUM_STATE_SLEEP here. + * + */ +void EcuM_GenerateRamHash( void ) { + VALIDATE_STATE( ECUM_STATE_SLEEP ); +} + +/** + * Check RAM hash. + * We are still in ECUM_STATE_SLEEP here. + * + * @return + */ +uint8 EcuM_CheckRamHash( void ) { + VALIDATE_STATE( ECUM_STATE_SLEEP ); + + return 0; +} + + + diff --git a/boards/linux/examples/os_simple/config/Mcu_Cfg.h b/boards/linux/examples/os_simple/config/Mcu_Cfg.h index 7379328e..839ccc8f 100644 --- a/boards/linux/examples/os_simple/config/Mcu_Cfg.h +++ b/boards/linux/examples/os_simple/config/Mcu_Cfg.h @@ -22,7 +22,6 @@ #ifndef MCU_CFG_H_ #define MCU_CFG_H_ - #define MCU_DEV_ERROR_DETECT STD_ON #define MCU_PERFORM_RESET_API STD_ON #define MCU_VERSION_INFO_API STD_ON diff --git a/include/generic/Cpu.h b/include/generic/Cpu.h index 96f35859..02ee398a 100644 --- a/include/generic/Cpu.h +++ b/include/generic/Cpu.h @@ -33,4 +33,6 @@ typedef uint32_t imask_t; #define Irq_SuspendOs() Irq_Disable() #define Irq_ResumeOs() Irq_Enable() +#define ilog2(_x) __builtin_ffs(_x) + #endif /* CPU_H */ diff --git a/system/EcuM/EcuM_Generated_Types.h b/system/EcuM/EcuM_Generated_Types.h new file mode 100644 index 00000000..77f283dc --- /dev/null +++ b/system/EcuM/EcuM_Generated_Types.h @@ -0,0 +1,182 @@ +/* +* Configuration of module: EcuM (EcuM_Generated_Types.h) +* +* Created by: +* Copyright: +* +* Configured for (MCU): MPC551x +* +* Module vendor: ArcCore +* Generator version: 2.1.9 +* +* Generated by Arctic Studio (http://arccore.com) +*/ + + +#if !(((ECUM_SW_MAJOR_VERSION == 2) && (ECUM_SW_MINOR_VERSION == 0)) ) +#error EcuM: Configuration file expected BSW module version to be 2.0.* +#endif + + +#ifndef _ECUM_GENERATED_TYPES_H_ +#define _ECUM_GENERATED_TYPES_H_ + +#ifdef CFG_ECUM_USE_SERVICE_COMPONENT +#include "Rte_EcuM.h" +#endif + +#include "EcuM_Types.h" + +#if defined(USE_MCU) +#include "Mcu.h" +#endif +#if defined(USE_PORT) +#include "Port.h" +#endif +#if defined(USE_CAN) +#include "Can.h" +#endif +#if defined(USE_CANIF) +#include "CanIf.h" +#endif +#if defined(USE_PWM) +#include "Pwm.h" +#endif +#if defined(USE_COM) +#include "Com.h" +#endif +#if defined(USE_PDUR) +#include "PduR.h" +#endif +#if defined(USE_DMA) +#include "Dma.h" +#endif +#if defined(USE_ADC) +#include "Adc.h" +#endif +#if defined(USE_GPT) +#include "Gpt.h" +#endif +#if defined(USE_COMM) +#include "ComM.h" +#endif +#if defined(USE_NM) +#include "Nm.h" +#endif +#if defined(USE_CANNM) +#include "CanNm.h" +#endif +#if defined(USE_CANSM) +#include "CanSM.h" +#endif +#if defined(USE_J1939TP) +#include "J1939Tp.h" +#endif +#if defined(USE_UDPNM) +#include "UdpNm.h" +#endif +#if defined(USE_LINSM) +#include "LinSM.h" +#endif +#if defined(USE_FLS) +#include "Fls.h" +#endif +#if defined(USE_EEP) +#include "Eep.h" +#endif +#if defined(USE_SPI) +#include "Spi.h" +#endif +#if defined(USE_WDG) +#include "Wdg.h" +#endif +#if defined(USE_WDGM) +#include "WdgM.h" +#endif +#if defined(USE_WDGIF) +#include "WdgIf.h" +#endif + + +typedef struct +{ + EcuM_StateType EcuMDefaultShutdownTarget; + uint8 EcuMDefaultSleepMode; + AppModeType EcuMDefaultAppMode; + uint32 EcuMRunMinimumDuration; + uint32 EcuMNvramReadAllTimeout; + uint32 EcuMNvramWriteAllTimeout; +#if defined(USE_WDGM) + const EcuM_WdgMType *EcuMWdgMConfig; +#endif + const EcuM_SleepModeType *EcuMSleepModeConfig; + +#if defined(USE_MCU) + const Mcu_ConfigType* McuConfig; +#endif +#if defined(USE_PORT) + const Port_ConfigType* PortConfig; +#endif +#if defined(USE_CAN) + const Can_ConfigType* CanConfig; +#endif +#if defined(USE_CANIF) + const CanIf_ConfigType* CanIfConfig; +#endif +#if defined(USE_CANSM) + const CanSM_ConfigType* CanSMConfig; +#endif +#if defined(USE_NM) + const Nm_ConfigType* NmConfig; +#endif +#if defined(USE_CANNM) + const CanNm_ConfigType* CanNmConfig; +#endif +#if defined(USE_UDPNM) + const UdpNm_ConfigType* UdpNmConfig; +#endif +#if defined(USE_COMM) + const ComM_ConfigType* ComMConfig; +#endif +#if defined(USE_COM) + const Com_ConfigType* ComConfig; +#endif +#if defined(USE_J1939TP) + const J1939Tp_ConfigType* J1939TpConfig; +#endif +#if defined(USE_PDUR) + const PduR_PBConfigType* PduRConfig; +#endif +#if defined(USE_PWM) + const Pwm_ConfigType* PwmConfig; +#endif +#if defined(USE_DMA) + const Dma_ConfigType* DmaConfig; +#endif +#if defined(USE_ADC) + const Adc_ConfigType* AdcConfig; +#endif +#if defined(USE_GPT) + const Gpt_ConfigType* GptConfig; +#endif +#if defined(USE_FLS) + const Fls_ConfigType* FlashConfig; +#endif +#if defined(USE_EEP) + const Eep_ConfigType* EepConfig; +#endif +#if defined(USE_SPI) + const Spi_ConfigType* SpiConfig; +#endif +#if defined(USE_WDG) + const Wdg_ConfigType* WdgConfig; +#endif +#if defined(USE_WDGIF) + const WdgIf_ConfigType* WdgIfConfig; +#endif +#if defined(USE_WDGM) + const WdgM_ConfigType* WdgMConfig; +#endif +} EcuM_ConfigType; + +#endif /*_ECUM_GENERATED_TYPES_H_*/ diff --git a/system/EcuM/EcuM_Main.c b/system/EcuM/EcuM_Main.c index 128a871d..10a9aef2 100644 --- a/system/EcuM/EcuM_Main.c +++ b/system/EcuM/EcuM_Main.c @@ -27,6 +27,7 @@ #include "NvM.h" #endif + static uint32 internal_data_run_state_timeout = 0; #if defined(USE_NVM) static uint32 internal_data_go_off_one_state_timeout = 0;