/****************************************************************************************************************/ /* COPYRIGHT */ /* Interface Microsystems (c) 2021 */ /****************************************************************************************************************/ /* File name :Ecumain.h */ /* Module :MM9Z1_BatterySensor_V1/Sources/BSW/services/Ecumain.h */ /*--------------------------------------------------------------------------------------------------------------*/ /* Description : */ /****************************************************************************************************************/ /* History */ /*--------------------------------------------------------------------------------------------------------------*/ /* Date | Revised By | Rev. No. | Description */ /*--------------------------------------------------------------------------------------------------------------*/ /* July 20, 2021 */ /****************************************************************************************************************/ #ifndef ECUMAIN_H_ #define ECUMAIN_H_ /****************************************************************************************************************/ /* Includes */ /****************************************************************************************************************/ /****************************************************************************************************************/ /* Defines */ /****************************************************************************************************************/ /* Macros that define SHADOW segments */ #define SHADOW_ROM_ADD 0xFFFA00 #define SHADOW_RAM_ADD 0x001000 #define FLASH_START_ADD 0xFE0000 #define FLASH_SECTORS_TO_ERASE 191 /* 256 total - 1 interrupt vector - 64 (32k) for Bootloader = 191. Each sector is 512 bytes */ #define FLASH_SECTOR_SIZE 512 #define FLASH_VECTOR_SECTOR_ADD 0xFFFE00 /* The last sector holds the memory protection bit and the interrupt vector */ #define SHADOW_SIZE_IN_WORDS 512 /* Shadow segment size in words 512/2 */ #define BOOTLOADER_START_ADD (UINT32)((UINT32)FLASH_START_ADD + ((UINT32)FLASH_SECTORS_TO_ERASE * (UINT32)FLASH_SECTOR_SIZE)) /* Bootloader start addres, to avoid programming over the bootloader */ #define APPLICATION_START_ADD 0xFE0000 /* User configurable application pointer, recommend Flash start */ /****************************************************************************************************************/ /* Enumeration */ /***************************************************************************************************************/ typedef enum { START_EXTEND_DIAG_SESSION , UNLOCK_ECU , START_PROG_DIAG_SESSION , SET_BOOT_FLAG_REQ , CONFIRM_BOOT_FLAG_SET , ERASE_FLASH_REQ , START_FLASH_ERASE , REQ_DOWNLOAD , TRANSFER_DATA , TRANSFER_EXIT , COMPUTE_CHECKSUM_REQ , CLEAR_BOOT_FLAG_REQ , CONFIRM_BOOT_FLAG_CLEAR , ECU_RESET_REQ , ECU_RESET }ECU_BOOT_STATES; typedef union { word WORD; struct { byte msb; byte lsb; }BYTE; }WORD; struct DWORD { union { byte b[4]; word w[2]; dword l; } data; }; extern ECU_BOOT_STATES ECU_Boot_State; extern boolean EE_WRITE_CHECK_F; extern boolean EE_WRITE_ERR_F; extern boolean FLASH_UNLOCKED_F; extern boolean CHECKSUM_MATCHED_F; extern boolean BOOT_POC_F; extern boolean SCI_TC_F; extern boolean SCI_TC_OVER_F; extern WORD ee_data_1, ee_data_2, ee_data_3, ee_data_4; extern u32 MemreturnCode; void ECUM_INIT(void); void Copy_Shadow(void); pt2Func Get_RAM_Ptr (pt2Func ptr); void Jump_Main_Application(void); /****************************************************************************************************************/ /* End of file Ecumain.h */ /****************************************************************************************************************/ #endif