#ifndef BMS_CONFIG_H_
#define BMS_CONFIG_H_

#ifdef __cplusplus
extern "C" {
#endif 

#include "bsp_number.h"

/***************************MCU配置*********************/
#define APP_CFG_FLASH_PAGE_SIZE        (1024*2)


/***************************中断优先级*********************/
#define APP_CFG_INT_PRIO_PWR_OFF        0u
#define APP_CFG_INT_PRIO_CAN1_RX        1u
#define APP_CFG_INT_PRIO_CAN1_TX        2u
#define APP_CFG_INT_PRIO_CAN2_RX        3u
#define APP_CFG_INT_PRIO_CAN2_TX        4u

#define APP_CFG_INT_PRIO_SYSTICK        5u
#define APP_CFG_INT_PRIO_UART2_RX       6u

/*************************Flash分区***************************************
    +-------+------+-------+-------+-------+--------+--------+--------+
    | BOOT  |  EE  |  EE_B |  EEE  | EEE_B |   APP  | BACKUP | E-TAG  |
    |  16K  |  16K |  16K  |  16K  |  64K  | 128K*3 | 128K*3 | 128K   |
    +-------+------+-------+-------+-------+--------+--------+--------+
*************************************************************************/

#define APP_CFG_BOOT_START_ADDR		    (0x08000000u)
#define APP_CFG_BOOT_FW_SIZE		    (0x4000u) //16K

#define APP_CFG_EEPROM_START_ADDR	    (APP_CFG_BOOT_START_ADDR + APP_CFG_BOOT_FW_SIZE) //0x08004000
#define APP_CFG_EEPROM_SIZE			    (0x4000 * 3 + 0x4000 * 4) //16K

#define APP_CFG_APP_START_ADDR		    (APP_CFG_EEPROM_START_ADDR + APP_CFG_EEPROM_SIZE) //0x08020000
#define APP_CFG_FIRMWARE_SIZE		    (0x4000 * 8 * 3) //384K

#define APP_CFG_BACKUP_START_ADDR	    (APP_CFG_APP_START_ADDR + APP_CFG_FIRMWARE_SIZE) //0x08080000

#define APP_CFG_E_TAG_ADDR			    (APP_CFG_BACKUP_START_ADDR + APP_CFG_FIRMWARE_SIZE) //0x080E0000
#define APP_CFG_E_TAG_SIZE              (0x1000u)

#define APP_CFG_TAG_OFFSET              (0x188u) //放在向量表结束 __Vectors_End 地址
#define APP_CFG_PRODUCT_NUMBER_OFFSET   (APP_CFG_TAG_OFFSET + 2)
/***************************继电器个数*********************/
#define APP_CFG_RELAY_NUM         10u
#define APP_CFG_BCU_MAX_NUM       20u //最大BCU个数

/***************************设备特性*********************/
#define APP_DEVICE_TYPE         NUMBER_TYPE_BCU
#define PRODUCT_NUMBER          NUMBER_ASSEMBLE(APP_DEVICE_TYPE, NUMBER_APPL_E, NUMBER_VER_C, NUMBER_BCU_1B)
#define HMI_SND_CAN_ID			(0x1C000000 | APP_DEVICE_TYPE)
#define HMI_RCV_CAN_ID1			(0x1C0000E0 | APP_DEVICE_TYPE)
#define HMI_RCV_CAN_ID2			(0x1C0000D0 | APP_DEVICE_TYPE)
#define HMI_RCV_CAN_RESERVE1	(0x1C0000C0 | APP_DEVICE_TYPE)


#ifdef __cplusplus
}
#endif

#endif
