#include <Mcu.h>
#include <OsIf.h>
#include <Siul2_Port_Ip.h>
#include <Gpt.h>
#include <Adc.h>
#include <Can_43_FLEXCAN.h>
#include <Spi.h>
#include <Mcl.h>
#include <Pwm.h>
#include <Icu.h>
#include <CDD_Uart.h>
#include <Lin_43_LPUART_FLEXIO.h>
#include <LinIf.h>
#include <Platform.h>

/* Define Default project Callbacks as weak to not throw a build error for
 * projects which are not using the the following callbacks */
__attribute__((weak))void Gpt_PitNotification(void) {}

__attribute__((weak))void MBDT_Step_Handler(void) {}

__attribute__((weak))void Adc_Adc1Group0Notification(void) {}

__attribute__((weak))void Adc_Adc1Group1Notification(void) {}

__attribute__((weak))void Adc_Adc1WdogNotification(void) {}

__attribute__((weak))void Adc1_CtuNewDataNotification(void) {}

__attribute__((weak))void Adc1_CtuDataOverrunNotification(void) {}

__attribute__((weak))void Adc1_CtuListLastNotification(void) {}

__attribute__((weak))void Adc_Fifo1_UnderrunNotification(void) {}

__attribute__((weak))void Adc_Fifo1_WaterMarkNotification(void) {}

__attribute__((weak))void Adc_Fifo1_OverrunNotification(void) {}

__attribute__((weak))void CanIf_ControllerBusOff(uint8 ControllerId) {}

__attribute__((weak))void CanIf_ControllerModeIndication(uint8 ControllerId, Can_ControllerStateType ControllerMode) {}

__attribute__((weak))void CanIf_TxConfirmation(PduIdType CanTxPduId) {}

__attribute__((weak))void CanIf_RxIndication(const Can_HwType* Mailbox, const PduInfoType* PduInfoPtr) {}

__attribute__((weak))void MBDT_FlexCAN0_FifoOverflowNotif(void) {}

__attribute__((weak))void MBDT_SPI_end_sequence1_callback(void) {}

__attribute__((weak))void MBDT_SPI_end_job0_callback(void) {}

__attribute__((weak))void PwmChannel_0_Callback(void) {}

__attribute__((weak))void PwmChannel_1_Callback(void) {}

__attribute__((weak))void PwmChannel_2_Callback(void) {}

__attribute__((weak))void PwmChannel_3_Callback(void) {}

__attribute__((weak))void PwmChannel_4_Callback(void) {}

__attribute__((weak))void PwmChannel_5_Callback(void) {}

__attribute__((weak))void PwmChannel_6_Callback(void) {}

__attribute__((weak))void PwmChannel_7_Callback(void) {}

__attribute__((weak))void MBDT_USER_SW0_callback(void) {}

__attribute__((weak))void MBDT_Uart_Callback(uint8 Channel, Uart_EventType Event) {}

__attribute__((weak))void LinIf_TxConfirmation(NetworkHandleType Channel) {}

__attribute__((weak))void LinIf_RxIndication(NetworkHandleType Channel, uint8* Lin_SduPtr) {}

__attribute__((weak))void LinIf_LinErrorIndication(NetworkHandleType Channel, Lin_SlaveErrorType ErrorStatus) {}

__attribute__((weak))Std_ReturnType LinIf_HeaderIndication(NetworkHandleType Channel, Lin_PduType * PduPtr) {}


void board_init(void)
{
    Mcu_Init(NULL_PTR);
    Mcu_InitClock(McuClockSettingConfig_0);
    #if (MCU_NO_PLL==STD_OFF)
    while ( MCU_PLL_LOCKED != Mcu_GetPllStatus() )
    {
        /* wait until all enabled PLLs are locked */
    }
    /* switch system clock tree to PLL */
    Mcu_DistributePllClock();
    #endif
    Mcu_SetMode(McuModeSettingConf_0);
    OsIf_Init(NULL_PTR);
    Siul2_Port_Ip_Init(NUM_OF_CONFIGURED_PINS0,g_pin_mux_InitConfigArr0);
    Gpt_Init(&Gpt_Config_MBDT);
    Adc_Init(&Adc_Config_MBDT);
    Can_43_FLEXCAN_Init(&Can_43_FLEXCAN_Config_MBDT);
    Spi_Init(&Spi_Config_MBDT);
    Mcl_Init(&Mcl_Config_MBDT);
    Pwm_Init(&Pwm_Config_MBDT);
    Icu_Init(&Icu_Config_MBDT);
    Uart_Init(&Uart_xConfig_MBDT);
    Lin_43_LPUART_FLEXIO_Init(&Lin_43_LPUART_FLEXIO_Config_MBDT);
    Platform_Init(NULL_PTR);
}
