#ifndef __HEAD_H
#define __HEAD_H

//定义布尔变量值 

#define BYTE unsigned char 
#define WORD unsigned short 
#define DWORD unsigned int 
#define DDWORD unsigned long long

#define UINT  unsigned short 
#define SINT  short 
#ifndef TRUE
#define TRUE true
#endif
#ifndef FALSE
#define FALSE false
#endif

#ifdef CPU_AM335X
#define strtol simple_strtol
#define strtoul simple_strtoul
#define PARITY_NONE1 	PARITY_NONE
#include <linux/kmod.h>
#endif

#include "defineSys.h"	//bsp中有部分.h文件使用defineSys.h的宏定义,所以defineSys.h需前置至bsp.h前面,避免编译报错

#ifdef CPU_FUXI
#define sys_open			rt_file_open
#define sys_read			read
#define sys_write(a,b,c)	rt_file_write(a,b,c,0)
#define sys_close(x)		rt_file_close(x,0)
#define sys_ioctl			ioctl

#define printk				rt_printf

#endif

/*下面是BSP相关的头文件*/  
#include "bsp.h"
/*下面是系统配置相关的头文件*/   

#define IEC104_TOTAL_SOCKETS   (CFG_ETH_MAX_LOGIC) // IEC104最大通道数

#define COMM_CHANNEL_INDEX_UART 	0
#define COMM_CHANNEL_INDEX_EHTER 	(CFG_UART_NUM_MAX)
#define COMM_CHANNEL_NUM			(CFG_UART_NUM_MAX+IEC104_TOTAL_SOCKETS)

#ifdef LINUX_KERNEL_APP
#include <linux/kmod.h>
#endif

//#include "defineSys.h"
#include "sh_name.h"
#include "rt.h"
#include "m.h"
#include "app.h"
#include "sysTime.h"
#include "func.h"
#include "gen.h"
#include "floatspc.h"
#include "timer_user.h"
#include "oc.h"
#include "FA_g.h"
#include "Appconfig.h"
#include "switch.h"
#include "Sys.h"
#include "auth.h"
#include "factor.h"
#include "dcfactor.h"
#include "fft.h"
#include "led.h"
#include "SOE.h"
#include "dido.h"
#include "Down.h"
#include "down_panel_prog.h"
#include "equ.h"
#include "Maintain.h"
#include "net_debug.h"
#include "history_db.h"
#include "history_rcd.h"
#include "history_file.h"
#ifdef CPU_FUXI
#include "fuxi_shm_app.h"
#endif

/*下面是保护逻辑相关的头文件*/
#include "run_status.h"
#include "samint.h"
#include "UnitsLib.h"
#include "mea.h"
#include "reclose.h"
#include "vol.h"
//#include "vol_ls.h"
#include "fsx.h"
#include "FA.h"
#include "bzt.h"
#ifdef FUN_JDXX 
#include "jdxx.h"
#endif
#include "protect.h"
#include "xdljd.h"
#include "wavelib.h"

#include "get_keyword.h"
#include "sys_api.h"

#include "set.h"
/*下面是菜单驱动相关的头文件*/

#include "Fmt.h"
#include "LcdComm.h"
#include "MmiDrv.h"

#include "MmiData.h"

/*通信及其他头文件*/
#include "iectable.h"
#include "IECComm.h"
#include "IECLINK.h"
#include "IEC101.h"
#include "IEC101_FILE.h"
#include "IEC104.h"
#include "Modbus.h"
#include "gps_uart.h"
#include "record.h"
#include "Net.h"
#include "SM2.h"
#include "pda.h"
#include "uart_comm.h"
#include "myconf.h"
#include "protocol.h"
#ifdef FUN_GPRS
#include  "gprs_aux.h"
#endif
#include  "plc.h"
#include "battery.h"
#include "sxyb.h"
#include "sntp.h"
#include "FA_g.h"
#include "CommPowerModule.h"
#ifdef FUNC_SEL_BAT_MODULE
#include "ptl_pwrm.h"
#endif
#include "bluetooth.h"

// 线损相关头文件
#ifdef CAN_SLAVE_BOARD
#include "can_board.h"
#include "can_metering_app.h"
#include "CommPowerModule.h"
#include "csv_rw.h"
#include "energy_curve.h"
#include "lineloss.h"
#endif

 // x509证书解析
#include "x509.h"

#include "sc1161y.h"
#include "encrypt_core.h"

#include "debug_print.h"

extern u32 g_tick_secs;
extern u32 g_restart_count;

int check_rtc(struct rtc_time_t  *pct);

void s_stat_tx(int chnl, int bytes);
void s_stat_rx(int chnl, int bytes);
void s_stat_rx_err(int chnl, int bytes);
void s_stat_rx_frame(int chnl);
void s_stat_tx_frame(int chnl);
void s_stat_rx_errframe(int chnl);
int s_stat_rx_errframe_rc(int chnl);

void s_stat_tx_errframe(int chnl);
void s_stat_protocol(int chnl, int protocol);
void s_stat_reset(int all);
int s_stat_display(void);


#endif

/*******************endfile*******************************/

