/*
 * 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 _CVM011X_FEATURES_H_
#define _CVM011X_FEATURES_H_

/*! \brief Contains public interface to various functions related
 *         to the features definition of CVM011x series chips
 */

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

#ifdef __cplusplus
extern "C" {
#endif

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

#if defined(MCU_CVM0118FMLF) || defined(MCU_CVM0118LMLF)

#ifdef FEATURE_PFLASH_SIZE
#undef FEATURE_PFLASH_SIZE
#endif
#define FEATURE_PFLASH_SIZE (0x38000)

#ifdef FEATURE_RAM_SIZE
#undef FEATURE_RAM_SIZE
#endif
#define FEATURE_RAM_SIZE (0x6400)

#ifdef FEATURE_DFLASH_SIZE
#undef FEATURE_DFLASH_SIZE
#endif
#define FEATURE_DFLASH_SIZE (0x8000)

#ifdef FEATURE_EEPROM_SIZE
#undef FEATURE_EEPROM_SIZE
#endif
#define FEATURE_EEPROM_SIZE (0x800)

#ifdef FEATURE_CAN_FD_INSTANCE_NUM
#undef FEATURE_CAN_FD_INSTANCE_NUM
#endif
#define FEATURE_CAN_FD_INSTANCE_NUM (1)

#ifdef FEATURE_CAN_2_0_INSTANCE_NUM
#undef FEATURE_CAN_2_0_INSTANCE_NUM
#endif
#define FEATURE_CAN_2_0_INSTANCE_NUM (0)

#ifdef FEATURE_UART_INSTANCE_NUM
#undef FEATURE_UART_INSTANCE_NUM
#endif
#define FEATURE_UART_INSTANCE_NUM (3)

#elif defined(MCU_CVM0118BMLF) || defined(MCU_CVM0118AMLF)

#ifdef FEATURE_PFLASH_SIZE
#undef FEATURE_PFLASH_SIZE
#endif
#define FEATURE_PFLASH_SIZE (0x38000)

#ifdef FEATURE_RAM_SIZE
#undef FEATURE_RAM_SIZE
#endif
#define FEATURE_RAM_SIZE (0x6400)

#ifdef FEATURE_DFLASH_SIZE
#undef FEATURE_DFLASH_SIZE
#endif
#define FEATURE_DFLASH_SIZE (0x8000)

#ifdef FEATURE_EEPROM_SIZE
#undef FEATURE_EEPROM_SIZE
#endif
#define FEATURE_EEPROM_SIZE (0x800)

#ifdef FEATURE_CAN_FD_INSTANCE_NUM
#undef FEATURE_CAN_FD_INSTANCE_NUM
#endif
#define FEATURE_CAN_FD_INSTANCE_NUM (0)

#ifdef FEATURE_CAN_2_0_INSTANCE_NUM
#undef FEATURE_CAN_2_0_INSTANCE_NUM
#endif
#define FEATURE_CAN_2_0_INSTANCE_NUM (1)

#ifdef FEATURE_UART_INSTANCE_NUM
#undef FEATURE_UART_INSTANCE_NUM
#endif
#define FEATURE_UART_INSTANCE_NUM (3)

#elif defined(MCU_CVM0118FMFM) || defined(MCU_CVM0118LMFM)

#ifdef FEATURE_PFLASH_SIZE
#undef FEATURE_PFLASH_SIZE
#endif
#define FEATURE_PFLASH_SIZE (0x38000)

#ifdef FEATURE_RAM_SIZE
#undef FEATURE_RAM_SIZE
#endif
#define FEATURE_RAM_SIZE (0x6400)

#ifdef FEATURE_DFLASH_SIZE
#undef FEATURE_DFLASH_SIZE
#endif
#define FEATURE_DFLASH_SIZE (0x8000)

#ifdef FEATURE_EEPROM_SIZE
#undef FEATURE_EEPROM_SIZE
#endif
#define FEATURE_EEPROM_SIZE (0x800)

#ifdef FEATURE_CAN_FD_INSTANCE_NUM
#undef FEATURE_CAN_FD_INSTANCE_NUM
#endif
#define FEATURE_CAN_FD_INSTANCE_NUM (1)

#ifdef FEATURE_CAN_2_0_INSTANCE_NUM
#undef FEATURE_CAN_2_0_INSTANCE_NUM
#endif
#define FEATURE_CAN_2_0_INSTANCE_NUM (0)

#ifdef FEATURE_UART_INSTANCE_NUM
#undef FEATURE_UART_INSTANCE_NUM
#endif
#define FEATURE_UART_INSTANCE_NUM (2)

#elif defined(MCU_CVM0118BMFM) || defined(MCU_CVM0118AMFM)

#ifdef FEATURE_PFLASH_SIZE
#undef FEATURE_PFLASH_SIZE
#endif
#define FEATURE_PFLASH_SIZE (0x38000)

#ifdef FEATURE_RAM_SIZE
#undef FEATURE_RAM_SIZE
#endif
#define FEATURE_RAM_SIZE (0x6400)

#ifdef FEATURE_DFLASH_SIZE
#undef FEATURE_DFLASH_SIZE
#endif
#define FEATURE_DFLASH_SIZE (0x8000)

#ifdef FEATURE_EEPROM_SIZE
#undef FEATURE_EEPROM_SIZE
#endif
#define FEATURE_EEPROM_SIZE (0x800)

#ifdef FEATURE_CAN_FD_INSTANCE_NUM
#undef FEATURE_CAN_FD_INSTANCE_NUM
#endif
#define FEATURE_CAN_FD_INSTANCE_NUM (0)

#ifdef FEATURE_CAN_2_0_INSTANCE_NUM
#undef FEATURE_CAN_2_0_INSTANCE_NUM
#endif
#define FEATURE_CAN_2_0_INSTANCE_NUM (1)

#ifdef FEATURE_UART_INSTANCE_NUM
#undef FEATURE_UART_INSTANCE_NUM
#endif
#define FEATURE_UART_INSTANCE_NUM (2)

#elif defined(MCU_CVM0116FMFM) || defined(MCU_CVM0116LMFM)

#ifdef FEATURE_PFLASH_SIZE
#undef FEATURE_PFLASH_SIZE
#endif
#define FEATURE_PFLASH_SIZE (0x20000)

#ifdef FEATURE_RAM_SIZE
#undef FEATURE_RAM_SIZE
#endif
#define FEATURE_RAM_SIZE (0x4400)

#ifdef FEATURE_DFLASH_SIZE
#undef FEATURE_DFLASH_SIZE
#endif
#define FEATURE_DFLASH_SIZE (0x8000)

#ifdef FEATURE_EEPROM_SIZE
#undef FEATURE_EEPROM_SIZE
#endif
#define FEATURE_EEPROM_SIZE (0x800)

#ifdef FEATURE_CAN_FD_INSTANCE_NUM
#undef FEATURE_CAN_FD_INSTANCE_NUM
#endif
#define FEATURE_CAN_FD_INSTANCE_NUM (1)

#ifdef FEATURE_CAN_2_0_INSTANCE_NUM
#undef FEATURE_CAN_2_0_INSTANCE_NUM
#endif
#define FEATURE_CAN_2_0_INSTANCE_NUM (0)

#ifdef FEATURE_UART_INSTANCE_NUM
#undef FEATURE_UART_INSTANCE_NUM
#endif
#define FEATURE_UART_INSTANCE_NUM (2)

#elif defined(MCU_CVM0116BMFM) || defined(MCU_CVM0116AMFM)

#ifdef FEATURE_PFLASH_SIZE
#undef FEATURE_PFLASH_SIZE
#endif
#define FEATURE_PFLASH_SIZE (0x20000)

#ifdef FEATURE_RAM_SIZE
#undef FEATURE_RAM_SIZE
#endif
#define FEATURE_RAM_SIZE (0x4400)

#ifdef FEATURE_DFLASH_SIZE
#undef FEATURE_DFLASH_SIZE
#endif
#define FEATURE_DFLASH_SIZE (0x8000)

#ifdef FEATURE_EEPROM_SIZE
#undef FEATURE_EEPROM_SIZE
#endif
#define FEATURE_EEPROM_SIZE (0x800)

#ifdef FEATURE_CAN_FD_INSTANCE_NUM
#undef FEATURE_CAN_FD_INSTANCE_NUM
#endif
#define FEATURE_CAN_FD_INSTANCE_NUM (0)

#ifdef FEATURE_CAN_2_0_INSTANCE_NUM
#undef FEATURE_CAN_2_0_INSTANCE_NUM
#endif
#define FEATURE_CAN_2_0_INSTANCE_NUM (1)

#ifdef FEATURE_UART_INSTANCE_NUM
#undef FEATURE_UART_INSTANCE_NUM
#endif
#define FEATURE_UART_INSTANCE_NUM (2)

#elif defined(MCU_CVM0114BMFM)

#ifdef FEATURE_PFLASH_SIZE
#undef FEATURE_PFLASH_SIZE
#endif
#define FEATURE_PFLASH_SIZE (0x10000)

#ifdef FEATURE_RAM_SIZE
#undef FEATURE_RAM_SIZE
#endif
#define FEATURE_RAM_SIZE (0x4400)

#ifdef FEATURE_DFLASH_SIZE
#undef FEATURE_DFLASH_SIZE
#endif
#define FEATURE_DFLASH_SIZE (0x8000)

#ifdef FEATURE_EEPROM_SIZE
#undef FEATURE_EEPROM_SIZE
#endif
#define FEATURE_EEPROM_SIZE (0x800)

#ifdef FEATURE_CAN_FD_INSTANCE_NUM
#undef FEATURE_CAN_FD_INSTANCE_NUM
#endif
#define FEATURE_CAN_FD_INSTANCE_NUM (0)

#ifdef FEATURE_CAN_2_0_INSTANCE_NUM
#undef FEATURE_CAN_2_0_INSTANCE_NUM
#endif
#define FEATURE_CAN_2_0_INSTANCE_NUM (1)

#ifdef FEATURE_UART_INSTANCE_NUM
#undef FEATURE_UART_INSTANCE_NUM
#endif
#define FEATURE_UART_INSTANCE_NUM (2)

#elif defined(MCU_CVM0118TVLF)

#ifdef FEATURE_PFLASH_SIZE
#undef FEATURE_PFLASH_SIZE
#endif
#define FEATURE_PFLASH_SIZE (0x38000)

#ifdef FEATURE_RAM_SIZE
#undef FEATURE_RAM_SIZE
#endif
#define FEATURE_RAM_SIZE (0x6400)

#ifdef FEATURE_DFLASH_SIZE
#undef FEATURE_DFLASH_SIZE
#endif
#define FEATURE_DFLASH_SIZE (0x8000)

#ifdef FEATURE_EEPROM_SIZE
#undef FEATURE_EEPROM_SIZE
#endif
#define FEATURE_EEPROM_SIZE (0x800)

#ifdef FEATURE_CAN_FD_INSTANCE_NUM
#undef FEATURE_CAN_FD_INSTANCE_NUM
#endif
#define FEATURE_CAN_FD_INSTANCE_NUM (0)

#ifdef FEATURE_CAN_2_0_INSTANCE_NUM
#undef FEATURE_CAN_2_0_INSTANCE_NUM
#endif
#define FEATURE_CAN_2_0_INSTANCE_NUM (1)

#ifdef FEATURE_UART_INSTANCE_NUM
#undef FEATURE_UART_INSTANCE_NUM
#endif
#define FEATURE_UART_INSTANCE_NUM (2)

#else
#error "No correct chip defined"
#endif

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

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

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

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

#endif /* _CVM011X_FEATURES_H_ */
