/*
 * Copyright (c) 2022, Shenzhen CVA Innovation CO.,LTD
 * All rights reserved.
 *
 * Shenzhen CVA Innovation CO.,LTD (CVA chip) is supplying this file for use
 * exclusively with CVA's microcontroller products. This file can be freely
 * distributed within development tools that are supporting such microcontroller
 * products.
 *
 * THIS SOFTWARE IS PROVIDED "AS IS".  NO WARRANTIES, WHETHER EXPRESS, IMPLIED
 * OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE.
 * CVA SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL,
 * OR CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
 */

#ifndef _MCU_H_
#define _MCU_H_

/*! \brief Contains public interface to various functions related
 *         to the MCAL (MCU Abstract Layer) module
 */

/*******************************************************************************
 * the includes
 ******************************************************************************/

#include <stdint.h>
#include <stdbool.h>
#include "CVM012x_features.h"
#include "drivers/adc/adc_drv.h"
#include "drivers/clock/clock_drv.h"
#include "drivers/cmu/cmu_drv.h"
#include "drivers/cpu/cpu_drv.h"
#include "drivers/crc/crc_drv.h"
#include "drivers/edma/edma_drv.h"
#include "drivers/eim/eim_drv.h"
#include "drivers/erm/erm_drv.h"
#include "drivers/fhu/fhu_drv.h"
#include "drivers/flash/flash_drv.h"
#include "drivers/flexcan/flexcan_drv.h"
#include "drivers/i2c/i2c_drv.h"
#include "drivers/lpit/lpit_drv.h"
#include "drivers/lptmr/lptmr_drv.h"
#include "drivers/mft/mft_drv.h"
#include "drivers/mpu/mpu_drv.h"
#include "drivers/pdb/pdb_drv.h"
#include "drivers/pins/pins_drv.h"
#include "drivers/power/power_drv.h"
#include "drivers/pwmlite/pwmlite_drv.h"
#include "drivers/rtc/rtc_drv.h"
#include "drivers/reset/reset_drv.h"
#include "drivers/spi/spi_drv.h"
#include "drivers/trgmux/trgmux_drv.h"
#include "drivers/uart/uart_drv.h"
#include "drivers/wdg/wdg_drv.h"

#ifdef __cplusplus
extern "C" {
#endif

/*******************************************************************************
 * the defines
 ******************************************************************************/

/*******************************************************************************
 * the typedefs
 ******************************************************************************/

/*! \brief Definition of MCU prototype
 */
typedef struct _McuType_
{
    AdcDrvType     adcDrv;
    ClockDrvType   clockDrv;
    CmuDrvType     cmuPllDrv;
    CmuDrvType     cmuSoscDrv;
    CrcDrvType     crcDrv;
    EDmaDrvType    edmaDrv;
    EimDrvType     eimDrv;
    ErmDrvType     ermDrv;
    FhuDrvType     fhuDrv;
    FlashDrvType   flashDrv;
    FlexCanDrvType flexCanDrv;
    I2cDrvType     i2cDrv0;
    LpitDrvType    lpitDrv;
    LptmrDrvType   lptmrDrv;
    MftDrvType     mftDrv0;
    MftDrvType     mftDrv1;
    MpuDrvType     mpuDrv;
    PdbDrvType     pdbDrv;
    PinsDrvType    pta;
    PinsDrvType    ptb;
    PinsDrvType    ptc;
    PowerDrvType   powerDrv;
    PwmLiteDrvType pwmLiteDrv0;
    PwmLiteDrvType pwmLiteDrv1;
    ResetDrvType   resetDrv;
    RtcDrvType     rtcDrv;
    SpiDrvType     spiDrv0;
    SpiDrvType     spiDrv1;
    TrgMuxDrvType  trgMuxDrv;
    UartDrvType    uartDrv0;
    UartDrvType    uartDrv1;
    WdgDrvType     wdgDrv;
} McuType;

/*******************************************************************************
 * the globals
 ******************************************************************************/

/*******************************************************************************
 * the function prototypes
 ******************************************************************************/

/*! \brief Initializes the MCU
 *
 * This function initializes MCU by setting up all the peripheral drivers
 *
 * \param[in] obj : pointer to MCU instance
 */
extern void Mcu_Init(McuType *obj);

#ifdef __cplusplus
}
#endif /* extern "C" */

#endif /* _MCU_H_ */
