System_Monitor.h 3.23 KB
Newer Older
李俭双's avatar
李俭双 committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49

#ifndef SYSTEM__MONITOR__H
#define SYSTEM__MONITOR__H


/* #define Platform_16Bit
 #define Platform_32Bit*/

#ifdef Platform_16Bit
    #define monitorlib_uint8_t  unsigned char
    #define monitorlib_uint16_t unsigned int
    #define monitorlib_uint32_t unsigned long

#else

    #define monitorlib_uint8_t  unsigned char
    #define monitorlib_uint16_t unsigned short
    #define monitorlib_uint32_t unsigned int
    #define monitorlib_uint64_t unsigned long long
#endif

/*
     0 ----1st-------6500   不可运行   1
  6500 ----2st-------7000   回差段     2

  7000 ----3st-------9000   低压段     3
  9000 ----4st-------9500   回差段     4
  9500-----5st------16000   正常段     5
  16000----6st------16500   回差段     6

  16500----7st------18000   高压段     7
  18000----8st------18500   回差段     8
  18500----9st------65535   高压段     9

    0-----6.5   不可运行--ALL----------限制
  6.5-----9     除电机外均可运行--------正常
    9-----16.5  均可运行---------------正常
 16.5-----18.5  只有CAN可运行----------限制
 18.8-----65535 不可运行--ALL----------限制

6.5-18.5  CAN 可运行区间

*/
typedef monitorlib_uint8_t (*Get_Voltage_Vaild)(void);
typedef monitorlib_uint16_t (*Get_Voltage_Value)(void);
typedef monitorlib_uint8_t (*Get_LineInStatus)(void);
typedef void (*COMMON_Delay)(monitorlib_uint32_t mMs);
typedef void (*pfunLogic)(void);

50
typedef struct __attribute__((aligned(4)))
李俭双's avatar
李俭双 committed
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96
{
    Get_Voltage_Vaild SysGet_KL30_Valid;
    Get_Voltage_Vaild SysGet_KL15_Valid;
    Get_Voltage_Value SysGet_KL30_value_Force;
    Get_Voltage_Value SysGet_KL15_value_Force;
    Get_Voltage_Value SysGet_KL30_value;
    Get_Voltage_Value SysGet_KL15_value;
    Get_LineInStatus  SysGet_KL15Line;
    COMMON_Delay      COM_Delay;
    pfunLogic         SysMonitorLogic;
} MonitorExt_st;

/* SYS RUN Status */
#define SYS_OPR_STAT_RUN  ((System_FUN_KL30_Status_Get( ) > 1u) && (System_FUN_KL30_Status_Get( ) < 7u))
#define SYS_OPR_STAT_HALT ((System_FUN_KL30_Status_Get( ) == 1u) || (System_FUN_KL30_Status_Get( ) > 7u))

#define SYS_OPR_STAT_LIM_LVP (System_FUN_KL30_Status_Get( ) == 1U)
#define SYS_OPR_STAT_LIM_OVP (System_FUN_KL30_Status_Get( ) > 7u)

/*fun status*/
#define SYS_OPR_STAT_IGN_ON  (System_FUN_KL15_Status_Get( ) == 1U)
#define SYS_OPR_STAT_IGN_OFF (System_FUN_KL15_Status_Get( ) == 0U)

/*nm run status*/
#define SYS_OPR_STAT_IGN_ON_NM  (System_NM_KL15_Status_Get( ) == 1U)
#define SYS_OPR_STAT_IGN_OFF_NM (System_NM_KL15_Status_Get( ) == 0U)

/*nm status*/
#define SYS_OPR_STAT_RUN_NM  ((System_NM_KL30_Status_Get( ) > 1u) && (System_NM_KL30_Status_Get( ) < 9u))
#define SYS_OPR_STAT_HALT_NM ((System_NM_KL30_Status_Get( ) == 9u) || (System_NM_KL30_Status_Get( ) == 1u))

monitorlib_uint8_t  Read_KL30_ConvertFinish(void);
monitorlib_uint16_t Get_Sysmonitor_Version(void);

void Sys_Status_Update_Service(void);
void Sys_Set_Pata(const monitorlib_uint16_t FUN_Vol [], MonitorExt_st *pfunc);
void System_Monitor_KL30Init(void);
void System_Monitor_WakeupInit(void);
void System_XHY_CheckWakeup(void);

monitorlib_uint8_t System_FUN_KL30_Status_Get(void);
monitorlib_uint8_t System_FUN_KL15_Status_Get(void);
monitorlib_uint8_t System_NM_KL15_Status_Get(void);
monitorlib_uint8_t System_NM_KL30_Status_Get(void);

#endif