//***************************************************************************** // (C) Automotive Lighting Reutlingen GmbH // Tuebinger Strasse 123, 72762 Reutlingen, Germany // // Automotive Lighting Reutlingen GmbH owns all the rights to this work. // This work shall not be copied, reproduced, used, modified, transferred // or its information shall not be disclosed without the prior written // authorization of Automotive Lighting Reutlingen GmbH. //***************************************************************************** //----------------------------------------------------------------------------- /// \file CddEft.h /// /// \brief Access to EFT data /// /// \author OTT, Peter ALDE-RT/EES6 //----------------------------------------------------------------------------- #ifndef CDD_EFT_2021_07_02_H_ #define CDD_EFT_2021_07_02_H_ //============================================================================= // includes //============================================================================= #include #include #include #include //============================================================================= // defines //============================================================================= #define EFT_CRC_SIZE 0x08 #define EFT_CALIB_SIZE 0xF8 #define EFT_HWDESC_SIZE 0x80 #define EFT_ECUVARCFG_SIZE 0x180 #define EFT_CRC_ADDRESS 0x1020D100ul //EFT Checksum block (little endian) for the Area 0x1020D104 … 0x1020D3FF #define EFT_START_ADDRESS 0x1020D104ul //EFT block start address #define EFT_END_ADDRESS 0x1020D3FFul //EFT block end address #define EFT_CRC_INITIAL_VAL 0xFFFFFFFFul //EFT CRC calculation initial value //============================================================================= // interface for EFT data users //============================================================================= #define EFT_CALIB_Ncv78702 EftData.Eft_Calib.Val.Ncv78702 #define EFT_CALIB_Tps92520 EftData.Eft_Calib.Val.Tps92520 #define EFT_ECUVARCFG_Ncv78702 EftData.Eft_EcuVarCfg.Val.Ncv78702 #define EFT_ECUVARCFG_Tps92520 EftData.Eft_EcuVarCfg.Val.Tps92520 #define EFT_ECUVARCFG_HSSTYPE EftData.Eft_EcuVarCfg.Val.Hss #define EFT_ECUVARCFG_ADCFACTOR EftData.Eft_EcuVarCfg.Val.AdcFactor #define EFT_ECUVARCFG_VCCX3 EftData.Eft_EcuVarCfg.Val.ExtSupply3 #define EFT_ECUVARCFG_STP EftData.Eft_EcuVarCfg.Val.Stp //============================================================================= // type definitions //============================================================================= //----------------------------------------------------------------------------- // Structure tEft_Crc: CRC32 on tEft_Calib/tEft_HwDesc/tEft_EcuVarCfg //----------------------------------------------------------------------------- typedef struct { uint32 ulCrc; } tEft_Crc32; typedef struct { uint8 ucVersion; uint8 ucReserved1; uint8 ucReserved2; uint8 ucReserved3; } tEft_DocVers; typedef struct { tEft_Crc32 Crc32; tEft_DocVers Vers; } tEft_Crc; //----------------------------------------------------------------------------- // Structure tEft_Calib: ECU calibration //----------------------------------------------------------------------------- typedef struct { char acText[4]; // string "CALI" } tEft_Calib_Text; typedef struct { uint8 ucType; // EftCalib structure type uint8 ucReserved1; uint8 ucReserved2; uint8 ucReserved3; } tEft_Calib_Type; typedef struct { tEft_Calib_Text Text; // string "CALI" tEft_Calib_Type Type; // EftCalib structure type tCddTps92520_Eft_Calib Tps92520[CDDTPS92520_Cfg_NbOfDevices]; // LED driver tCddNcv78702_Eft_Calib Ncv78702[CDDNCV78702_Cfg_NbOfDevices]; // booster driver } tEft_Calib_Val; typedef union { tEft_Calib_Val Val; uint8 aucFill[EFT_CALIB_SIZE]; } tEft_Calib; //----------------------------------------------------------------------------- // Structure tEft_HwDesc: ECU identification //----------------------------------------------------------------------------- typedef struct { char acText[4]; // string "HWID" } tEft_HwDesc_Text; typedef struct { uint8 ucTypeAl; // Type AL uint8 ucTypeCust; // Type Customer uint8 ucReserved1; uint8 ucReserved2; } tEft_HwDesc_Type; typedef struct { uint8 aucYear [4]; uint8 aucMonth[2]; uint8 aucDay [2]; } tECUManufacturingDate; typedef struct { uint8 aucLine; uint8 aucEOL; uint8 ucReserved1; uint8 ucReserved2; uint8 aucCounter[4]; } tECUDynSN; typedef struct { uint8 aucECUPartnumber[12]; tECUManufacturingDate sECUManufacturingDate; tECUDynSN sECUDynSN; uint8 aucAL_ECR_Number[11]; uint8 ucReserved; uint8 aucReserved[16]; } tEft_HwId_AL; typedef struct { uint8 aucHWCust_TEXT[4]; // string "CUST" uint8 aucECU_HardwareVersionNumber[2]; uint8 aucHWNumber_LH[9]; uint8 aucHWNumber_RH[9]; uint8 aucTraceCode[18]; uint8 aucTestSerialNumber[6]; uint8 aucReserved[16]; } tEft_HwId_Cust; typedef struct { tEft_HwDesc_Text Text; // string "HWID" tEft_HwDesc_Type Type; // HwDesc structure type tEft_HwId_AL Al; // Identification AL tEft_HwId_Cust Cust; // Identification Customer } tEft_HwDesc_Val; typedef union { tEft_HwDesc_Val Val; uint8 aucFill[EFT_HWDESC_SIZE]; } tEft_HwDesc; //----------------------------------------------------------------------------- // Structure tEft_EcuVarCfg: characterizing ECU variant //----------------------------------------------------------------------------- typedef struct { char acText[4]; // string "VCFG" } tEft_EcuVarCfg_Text; typedef struct { uint8 ucType; // EcuVarCfg structure type uint8 ucReserved1; uint8 ucVariant; // HW design variant uint8 ucReserved2; } tEft_EcuVarCfg_Type; // preliminary typedefs for ECUVARCFG structures typedef struct { uint16 unFitting; // Fitting of NTC inputs uint16 unReserved; } tEft_EcuVarCfg_NTC; // naming TBD typedef struct { uint16 unG_Pullup; // conductance of R_Pullup uint16 unG_UpperLower; // conductance of R_Upper + R_Lower } tEft_EcuVarCfg_ADC_IN; // naming TBD typedef struct { uint8 ucType; // assembly uint8 ucReserved; } tEft_EcuVarCfg_DcOut; // naming TBD typedef struct { uint8 ucType; // assembly uint8 ucReserved; } tEft_EcuVarCfg_ExtSupply; // naming TBD typedef struct { uint8 unFitting; // assembly uint8 ucReserved; } tEft_EcuVarCfg_SwitchArray; // naming TBD typedef struct { uint8 ucType; // assembly uint8 ucReserved; } tEft_EcuVarCfg_Hss; typedef struct { uint8 ucType; // assembly uint8 ucReserved; } tEft_EcuVarCfg_Can; // naming TBD typedef struct { uint8 ucType; // assembly uint8 ucReserved; } tEft_EcuVarCfg_Lin; // naming TBD typedef struct { uint16 unFactor_PcbTemp; // PCB temperature uint16 unFactor_Ntc[14]; // NTC uint16 unFactor_Vbat; // VBAT uint16 unFactor_LrDetect; // Left right detection uint16 unFactor_HssSense_1_2; // HSS Sense for channel 1 and 2 uint16 unFactor_HssSense_3; // HSS Sense for channel 3 uint16 unFactor_PosSensor; // Position sensor uint16 unFactor_Vccx[3]; // VCC1, VCC2, VCC3 uint16 unFactor_In[4]; // ADIN1, ADIN2, ADIN3, ADIN4 uint16 unFactor_PosIn; // PosIn uint16 unFactor_OutFct; // OutFct uint16 unFactor_Vboost; // Vboost uint16 unFactor_Gpio1; // GPIO1 } tEft_EcuVarCfg_AdcFactor; typedef struct { tEft_EcuVarCfg_Text Text; // string "VCFG" tEft_EcuVarCfg_Type Type; // EcuVarCfg structure type tCddTps92520_Eft_EcuVarCfg Tps92520[CDDTPS92520_Cfg_NbOfDevices]; // LED driver tCddNcv78702_Eft_EcuVarCfg Ncv78702[CDDNCV78702_Cfg_NbOfDevices]; // Booster driver tEft_EcuVarCfg_NTC Ntc; // naming TBD tEft_EcuVarCfg_ADC_IN AdcIn; // naming TBD tCddStp_Eft_EcuVarCfg Stp[CDDSTP_Cfg_NbOfDevices]; // Stepper driver tEft_EcuVarCfg_DcOut DcOut; // naming TBD tEft_EcuVarCfg_ExtSupply ExtSupply2; // naming TBD tEft_EcuVarCfg_ExtSupply ExtSupply3; // naming TBD tEft_EcuVarCfg_SwitchArray SwitchArray; // naming TBD tEft_EcuVarCfg_Hss Hss[4]; // High side switch tEft_EcuVarCfg_Can Can2; // naming TBD tEft_EcuVarCfg_Can Can3; // naming TBD tEft_EcuVarCfg_Lin Lin; // naming TBD tEft_EcuVarCfg_AdcFactor AdcFactor; // ADC factor } tEft_EcuVarCfg_Val; typedef union { tEft_EcuVarCfg_Val Val; uint8 aucFill[EFT_ECUVARCFG_SIZE]; } tEft_EcuVarCfg; //----------------------------------------------------------------------------- // Structure tEftData: characterizing ECU variant //----------------------------------------------------------------------------- // EFT data struct typedef struct { tEft_Crc Eft_Crc; tEft_Calib Eft_Calib; tEft_HwDesc Eft_HwDesc; tEft_EcuVarCfg Eft_EcuVarCfg; } tEftData; //============================================================================= // prototypes //============================================================================= void CddEft_Init(void); boolean CddEft_DataValid(void); //============================================================================= // externals //============================================================================= #ifdef UNIT_TEST tEftData EftData; #else extern const tEftData EftData; #endif #endif // CDD_EFT_2021_07_02_H_