#ifndef CDD_MLC_CFG_2019_08_13_H_ #define CDD_MLC_CFG_2019_08_13_H_ //#ifndef UNIT_TEST #include <../Cdd/CddMlc/Cfg/CddMlc_Cfg.h> //#endif #include #include /****************************************************************************************/ /* User Config */ /****************************************************************************************/ //Driver defines //ToDo: Defines namespace should be consistent (CDDMLC_x) #ifdef UNIT_TEST_W #define CDDMLC_SUPPORTED_MLCs (sizeof(CddMlcGenCodingDataValue.ucMlcCanUartAddress)/sizeof(CddMlcGenCodingDataValue.ucMlcCanUartAddress[0])) //#define CDD_MLC_CHIPS (CddMlcGenCodingDataValue.ucMlcMatrixCount) #define CFG_MAX_NO_OF_MLC 3U #define CFG_MAX_NO_OF_ADDRS_MLC 8U #define CDDMLC_POWER_ON() \ IoHwAbUser_SetTgtHSS1(32768u) #define CDDMLC_POWER_OFF() \ IoHwAbUser_SetTgtHSS1(0u) #define CDDMLC_IS_POWERED() \ ( Dio_ReadChannel(DioConf_DioChannel_DioChannel_HSS_IN2) == (Dio_LevelType)STD_HIGH ? TRUE : FALSE) //wrapper #define CDDMLC_CODING_GET_MLC_CAN_UART_ADDRESS(pADDRS) { \ for (uint8 ucDevice=0U; ucDevice < CFG_MAX_NO_OF_MLC; ucDevice++) \ { \ *pADDRS.ucMlcCanUartAddress[ucDevice] = *(&applicationCodingData.LmmConfig.LMM_Config_Diagnosis.ucLMM_01_UART_CAN_ADDRESS + ucDevice);\ }\ } #define CDDMLC_CODING_GET_MLC_CAN_UART_INTERFACE(pInt) (*pInt.ucMlcCanUartInterface = CDDMLC_GEN_CODING_MATRIX_INTERFACE_PRIVATE_CAN ) #define CDDMLC_CODING_GET_MLC_TYPE(pType) (*pType.ucMlcMatrixType = applicationCodingData.LmmConfig.LMM_Config_Diagnosis.ucLMM_CHIP_TYPE) #define CDDMLC_RTE_READ_CODING_DATA_STATUS(pStatus) (*pStatus = CodingParameters.eCodingState) //(void)Rte_Read_CodM_CddMlc_Para(pTarget) //from CodM #define CDDMLC_RTE_READ_CODING_PARAMETERS(pTarget) (void)Rte_Read_CodM_CddMlc_Para(pTarget) #define CDD_MLC_CODING_DATA_CONNECTED_DEVICES (CddMlcGenCodingDataValue.ucMlcMatrixCount) #define CDD_MLC_CODING_DATA_ACTIVE_CAN_BUS (CddMlcGenCodingDataValue.ucMlcCanUartInterface) #define CDD_MLC_PHY_CHIP_ID ((uint8*)&(CddMlcGenCodingDataValue.ucMlcCanUartAddress[0U])) #endif #define MLC_UART_BUS 0U #define MLC_CAN_BUS 1U #define MLC_UART_TEST_MODE 2U #define MLC_USED_BUS MLC_CAN_BUS //ToDo: Use of this define must be clarified #ifndef CFG_MAX_NO_OF_MLC #define CFG_MAX_NO_OF_MLC 8U //ToDo: Use proper general macro coming from RTE when it is available #endif #ifndef CFG_MAX_NO_OF_ADDRS_MLC #define CFG_MAX_NO_OF_ADDRS_MLC 8U //ToDo: Use proper general macro coming from RTE when it is available #endif #define CDDMLC_MAX_SEGMENT_PER_DEVICE 16U #define CDD_MLC_MAX_SUPPORTED_ELEMENTS CDDMLC_MAX_SEGMENT_PER_DEVICE * CFG_MAX_NO_OF_ADDRS_MLC //Costumer options #define MLC_DEV_ADDR_NOT_CONNECTED 0xFFU #define CDDMLC_POWERUP_CYCLE_GUARD 5U //50ms (cyclic period x 5 ) #define CDDMLC_READREG_REQUEST_TIMEOUT 5U //50ms (cyclic period x 5 ) #define CDDMLC_DEVCOM_DEBOUNCE 50U //500ms: Communication debounce as per SWRS-33149 //Debug Options #define CDDMLC_DEBUG_REITERATIVE_MODE STD_OFF #define CDDMLC_DEBUG_CODE_INSTRUMENTATION STD_OFF #define CDDMLC_DEBUG_ITM_ENABLE STD_OFF //Used for communication error and CRC error #define COMM_ERR 0x01U #define CRC_ERR 0x02U #define NO_COM_CRCERR 0x00U #define CDD_MLC_ZERO 0x00U #define CDD_MLC_INVALID_ADDR 0xFFU /****************************************************************************************/ /* PROTOTYPES */ /****************************************************************************************/ void CddMlc_Init(void); void CddMlc_Cycle(void); void CddMlcNxp_Init(void) ; void CddMlcNxp_Cycle(void) ; #endif //ToDo: Multi-inclusion has to be handled in a proper way #include /****************************************************************************************/ /* CONFIGURATION */ /****************************************************************************************/ BEGIN_MLC_DEVICE_CONFIGURATION MLC_DEVICE_CONFIG(MLC_DEVICE_TI, COM_UART_OVER_CAN, CddMlc_Init, CddMlc_Cycle) MLC_DEVICE_CONFIG(MLC_DEVICE_NXP, COM_CAN, CddMlcNxp_Init, CddMlcNxp_Cycle) END_MLC_DEVICE_CONFIGURATION