#ifndef MODBUSSEIDEFS_H
#define MODBUSSEIDEFS_H


#define SEI_MODBUS_ZT_DATA_BASE_REG  2000
#define SEI_MODBUS_ZT_TABLE_DATA_SIZE 28

#define SEI_MODBUS_SEI_DATA_BASE_REG  2037
#define SEI_MODBUS_SEI_TABLE_DATA_SIZE 2

#define SEI_MODBUS_ZT_WATCHDOG_REG  2027
#define SEI_MODBUS_SEI_WATCHDOG_REG 2038
#define SEI_MODBUS_SEI_WATCHDOG_MASK 0x0001

#define SEI_MODBUS_SEI_ALARMS_RESET_REG 2037
#define SEI_MODBUS_SEI_ZT1_ALARM_RESET_MASK 0X0001
#define SEI_MODBUS_SEI_ZT2_ALARM_RESET_MASK 0X0002


////Flags definitions for HR2000
//#define SEI_ZT1_PP_INT_FLAG_MASK_1    0x0001
//#define SEI_ZT1_PP_INT_FLAG_MASK_2    0x0002
//#define SEI_ZT1_PP_INT_FLAG_MASK_3    0x0004
//#define SEI_ZT1_PP_INT_FLAG_MASK_4    0x0008
//#define SEI_ZT1_PP_EXT_FLAG_MASK_1    0x0010
//#define SEI_ZT1_PP_EXT_FLAG_MASK_2    0x0020
//#define SEI_ZT1_PP_EXT_FLAG_MASK_3    0x0040
//#define SEI_ZT1_PP_EXT_FLAG_MASK_4    0x0080
//#define SEI_ZT1_PG_FLAG_MASK_1        0x0100
//#define SEI_ZT1_PG_FLAG_MASK_2        0x0200
//#define SEI_ZT1_PG_FLAG_MASK_3        0x0400
//#define SEI_ZT1_PG_FLAG_MASK_4        0x0800
//#define SEI_ZT1_FN_FLAG_MASK_1        0x1000
//#define SEI_ZT1_FN_FLAG_MASK_2        0x2000
//#define SEI_ZT1_FN_FLAG_MASK_3        0x4000
//#define SEI_ZT1_FN_FLAG_MASK_4        0x8000

////Flags definitions for HR2017
//#define SEI_ZT2_PP_INT_FLAG_MASK_1    0x0001
//#define SEI_ZT2_PP_INT_FLAG_MASK_2    0x0002
//#define SEI_ZT2_PP_INT_FLAG_MASK_3    0x0004
//#define SEI_ZT2_PP_INT_FLAG_MASK_4    0x0008
//#define SEI_ZT2_PP_EXT_FLAG_MASK_1    0x0010
//#define SEI_ZT2_PP_EXT_FLAG_MASK_2    0x0020
//#define SEI_ZT2_PP_EXT_FLAG_MASK_3    0x0040
//#define SEI_ZT2_PP_EXT_FLAG_MASK_4    0x0080

////
//// ///UNUSED FLAGS NECESSARY FOR CC IMPLEMENTATION.  MUST ALWAYS BE 0
////#define ZT2_PG_DUMMY_MASK_1       0x0100    //UNUSED FLAG NECESSARY FOR CC IMPLEMENTATION.  MUST ALWAYS BE 0
////#define ZT2_PG_DUMMY_MASK_2       0x0200    //UNUSED FLAG NECESSARY FOR CC IMPLEMENTATION.  MUST ALWAYS BE 0
////#define ZT2_PG_DUMMY_MASK_3       0x0400    //UNUSED FLAG NECESSARY FOR CC IMPLEMENTATION.  MUST ALWAYS BE 0
////#define ZT2_PG_DUMMY_MASK_4       0x0800    //UNUSED FLAG NECESSARY FOR CC IMPLEMENTATION.  MUST ALWAYS BE 0
////#define ZT2_FN_DUMMY_MASK_5       0x1000    //UNUSED FLAG NECESSARY FOR CC IMPLEMENTATION.  MUST ALWAYS BE 0
////#define ZT2_FN_DUMMY_MASK_6       0x2000    //UNUSED FLAG NECESSARY FOR CC IMPLEMENTATION.  MUST ALWAYS BE 0
////#define ZT2_FN_DUMMY_MASK_7       0x4000    //UNUSED FLAG NECESSARY FOR CC IMPLEMENTATION.  MUST ALWAYS BE 0
////#define ZT2_FV_DUMMY_MASK_8       0x8000    //UNUSED FLAG NECESSARY FOR CC IMPLEMENTATION.  MUST ALWAYS BE 0
////                                            ////////////////////////////////////////////////////////////////////

////Flags definitions for HR2026
//#define SEI_ZT1_V00_ALARM_FLAG_MASK   0x0001
//#define SEI_ZT1_PEQ1_ALARM_FLAG_MASK  0x0002
//#define SEI_ZT1_ALARM_ITI_FLAG_MASK   0x8000
//#define SEI_ZT2_V02_ALARM_FLAG_MASK   0x0004
//#define SEI_ZT2_PEQ2_ALARM_FLAG_MASK  0x0008
//#define SEI_ZT2_ACTIVATED_ITI_DUMMY_MASK  0x4000 //UNUSED FLAG NECESSARY FOR CC IMPLEMENTATION.  MUST ALWAYS BE 0
//#define SEI_ZT_ACTIVATED_ITI_FLAG_MASK  0x8000

////Flags definitions for HR2027
//#define ZT_WATCHDOG_ON_VALUE      0x8000
//#define ZT_WATCHDOG_OFF_VALUE     0x0000


////Register addressing
////Outgoing
//#define SEI_MODBUS_ZT_DATA_BASE_REG             2000
//#define SEI_MODBUS_ZT_TABLE_DATA_SIZE           36  //Taille de la table en écriture = 36 registres (2000 à 2035)    //28      //Taille de la table en écriture = 28 registres (2000 à 2027)

//#define SEI_MODBUS_ZT1_ALARM_DATA_BASE_REG_ADD  2000
//#define SEI_MODBUS_ZT2_ALARM_DATA_BASE_REG_ADD  2017
//#define SEI_MODBUS_MISC_DATA_BASE_REG_ADD       2026
//#define SEI_MODBUS_ZT_WATCHDOG_REG_ADD          2027

//#define MODBUS_ZT1_ALARM_RANKS_BASE_ADD     2001
//#define MODBUS_ZT1_RANK_PP_INT_1_REG_ADD    2001
//#define MODBUS_ZT1_RANK_PP_INT_2_REG_ADD    2002
//#define MODBUS_ZT1_RANK_PP_INT_3_REG_ADD    2003
//#define MODBUS_ZT1_RANK_PP_INT_4_REG_ADD    2004
//#define MODBUS_ZT1_RANK_PP_EXT_1_REG_ADD    2005
//#define MODBUS_ZT1_RANK_PP_EXT_2_REG_ADD    2006
//#define MODBUS_ZT1_RANK_PP_EXT_3_REG_ADD    2007
//#define MODBUS_ZT1_RANK_PP_EXT_4_REG_ADD    2008
//#define MODBUS_ZT1_RANK_PG_1_REG_ADD        2009
//#define MODBUS_ZT1_RANK_PG_2_REG_ADD        2010
//#define MODBUS_ZT1_RANK_PG_3_REG_ADD        2011
//#define MODBUS_ZT1_RANK_PG_4_REG_ADD        2012
//#define MODBUS_ZT1_RANK_FN_1_REG_ADD        2013
//#define MODBUS_ZT1_RANK_FN_2_REG_ADD        2014
//#define MODBUS_ZT1_RANK_FN_3_REG_ADD        2015
//#define MODBUS_ZT1_RANK_FN_4_REG_ADD        2016

//#define MODBUS_ZT2_ALARM_RANKS_BASE_ADD     2018
//#define MODBUS_ZT2_RANK_PP_INT_1_REG_ADD    2018
//#define MODBUS_ZT2_RANK_PP_INT_2_REG_ADD    2019
//#define MODBUS_ZT2_RANK_PP_INT_3_REG_ADD    2020
//#define MODBUS_ZT2_RANK_PP_INT_4_REG_ADD    2021
//#define MODBUS_ZT2_RANK_PP_EXT_1_REG_ADD    2022
//#define MODBUS_ZT2_RANK_PP_EXT_2_REG_ADD    2023
//#define MODBUS_ZT2_RANK_PP_EXT_3_REG_ADD    2024
//#define MODBUS_ZT2_RANK_PP_EXT_4_REG_ADD    2025


///////UNUSED FLAGS NECESSARY FOR CC IMPLEMENTATION.  MUST ALWAYS BE 0
////#define MODBUS_ZT2_DUMMY_RK_PG_1_REG_ADD    2028    //UNUSED FLAG NECESSARY FOR CC IMPLEMENTATION.  MUST ALWAYS BE 0
////#define MODBUS_ZT2_DUMMY_RK_PG_2_REG_ADD    2029    //UNUSED FLAG NECESSARY FOR CC IMPLEMENTATION.  MUST ALWAYS BE 0
////#define MODBUS_ZT2_DUMMY_RK_PG_3_REG_ADD    2030    //UNUSED FLAG NECESSARY FOR CC IMPLEMENTATION.  MUST ALWAYS BE 0
////#define MODBUS_ZT2_DUMMY_RK_PG_4_REG_ADD    2031    //UNUSED FLAG NECESSARY FOR CC IMPLEMENTATION.  MUST ALWAYS BE 0
////#define MODBUS_ZT2_DUMMY_FN_PG_1_REG_ADD    2032    //UNUSED FLAG NECESSARY FOR CC IMPLEMENTATION.  MUST ALWAYS BE 0
////#define MODBUS_ZT2_DUMMY_FN_PG_2_REG_ADD    2033    //UNUSED FLAG NECESSARY FOR CC IMPLEMENTATION.  MUST ALWAYS BE 0
////#define MODBUS_ZT2_DUMMY_FN_PG_3_REG_ADD    2034    //UNUSED FLAG NECESSARY FOR CC IMPLEMENTATION.  MUST ALWAYS BE 0
////#define MODBUS_ZT2_DUMMY_FN_PG_4_REG_ADD    2035    //UNUSED FLAG NECESSARY FOR CC IMPLEMENTATION.  MUST ALWAYS BE 0
////                                                    ///////////////////////////////////////////////////////////////////


////Incoming
//#define MODBUS_CC_FCYCLE_ZT1_FLAG_MASK   0x0001
//#define MODBUS_CC_FCYCLE_ZT2_FLAG_MASK   0x0002
//#define MODBUS_CC_INHIBIT_ZT1_FLAG_MASK  0x0004
//#define MODBUS_CC_INHIBIT_ZT2_FLAG_MASK  0x0008
//#define MODBUS_CC_CLK_UPDATE_FLAG_MASK   0x8000

//#define MODBUS_CC_DATA_BASE_REG_ADD         2036//2028
//#define MODBUS_CC_TABLE_DATA_SIZE           15      //Taille de la table en lecture = 15 registres  (2036 à 2050  ///(2028 à 2042)


//#define MODBUS_CC_WATCHDOG_BASE_REG_ADD     2036
//#define MODBUS_CC_AN_BASE_REG_ADD           2037
//#define MODBUS_CC_ZT1_TRAIN_TYPE_REG_ADD    2038
//#define MODBUS_CC_ZT2_TRAIN_TYPE_REG_ADD    2039
//#define MODBUS_CC_ZT1_TRAIN_ID_1_REG_ADD    2040
//#define MODBUS_CC_ZT1_TRAIN_ID_2_REG_ADD    2041
//#define MODBUS_CC_ZT1_TRAIN_ID_3_REG_ADD    2042
//#define MODBUS_CC_ZT2_TRAIN_ID_1_REG_ADD    2043
//#define MODBUS_CC_ZT2_TRAIN_ID_2_REG_ADD    2044
//#define MODBUS_CC_ZT2_TRAIN_ID_3_REG_ADD    2045
//#define MODBUS_CC_CLK_UPDATE_BASE_REG_ADD   2046
//#define MODUBS_CC_CLK_SEC_BASE_REG_ADD      2047
//#define MODUBS_CC_CLK_HR_MIN_BASE_REG_ADD   2048
//#define MODUBS_CC_CLK_MNT_DAY_BASE_REG_ADD  2049
//#define MODUBS_CC_CLK_YEAR_BASE_REG_ADD     2050

#endif // MODBUSSEIDEFS_H
