#ifndef _WEB_SERVER_H #define _WEB_SERVER_H #include "config.h" #include "lcd_task.h" #include "type.h" #define MAX_USER_NUM 10 //记录访问IP地址数目 #define WEB_TASK_DEBUG 1 #if WEB_TASK_DEBUG #define web_printf printf #else #define web_printf(p,...) do{;}while(0) #endif #define MII_MODE #ifdef MII_MODE //phy 使用的是外部25M钟,不用mcu提供 //#define PHY_CLOCK_MCO #endif typedef enum { WEB_LOGIN = 0, WEB_STATUS, WEB_SET, WEB_RF, WEB_MODE, WEB_TS, WEB_LATCH, WEB_NET, WEB_LOG, WEB_PSIP, WEB_STATUS_1, WEB_SET_1, WEB_RF_1, WEB_MODE_1, WEB_TS_1, WEB_LATCH_1, WEB_NET_1, WEB_INDEX_END, WEB_SET_FREQ, CGI_CTTB_WEB_TS2IP_1, CGI_CTTB_SYS_ADMIN_IPCFG, WEB_IP_CFG, WEB_TS2IP1, } WEB_FLAG_INDEX; typedef struct { uint8 ip[4]; // 本地IP uint8 mask[4]; // 子网掩码 uint8 gateway[4]; // 网关 uint8 multi_address[4]; // 组播地址 uint16 port; // 本地端口号 uint16 udp_rtp; uint16 packet_len; uint16 receive_type; uint32 update_flag; }S_CGITS_PARA,*PS_CGITS_PARA; #define MAX_NO_OP_TIME (60*60*SYSTICKHZ) //最大无操作时间, 60分*60秒*100tick typedef struct { uint8 input0; uint8 input; uint8 status; uint8 agc; uint32 temp; uint32 ts_rate; uint32 ts_mh; uint32 ts_under; uint8 mode; uint8 tsnr; uint8 l_imd; uint8 u_imd; int8 rssi; uint8 rsnr; uint8 hz_10m; uint8 syserr; uint8 fwd; uint8 amp; uint8 txfreq; uint8 hz_; // 0表示整数 1表示负数 uint32 hz; uint8 ntp_en; // sntp uint8 ntp_sip[4]; uint8 ntp_date[SNTP_DATE_STRING_LEN]; uint8 ntp_time[SNTP_TIME_STRING_LEN]; uint16 tcp_seg; uint16 tcp_occupy; uint8 a_fssi; uint8 b_fssi; uint8 temp_unit; uint8 agc_state; int agc_adj; }S_CGI_STATUS,*PS_CGI_STATUS; typedef struct { uint8 gps_use; uint8 gps_lock; uint8 status; uint8 gps_1pps; uint8 freq[2]; uint8 reserved[2]; }S_CGI_GPS,*PS_CGI_GPS; #if ATSC_USA_AMP typedef struct { uint32 vol_9v; uint32 vol_12v; uint32 vol_50v; uint32 cur1_50v; uint32 cur2_50v; uint32 cur3_50v; uint32 cur4_50v; uint32 pa_in; uint32 gv_881; //前级栅极电压 uint32 pa_fwd; //发射功率 uint32 pa_reflect; //反射功率 uint32 vswr; //驻波比 uint32 temp_pa; //功放温度 uint8 signal_reflect; //反射功率异常信号; uint8 signal_fwd; //发射功率异常信号 uint8 signal_temp; //温度异常信号 uint8 pac_lev; //功率等级 }S_CGI_AMP,*PS_CGI_AMP; #endif typedef struct { uint8 init_status; uint8 lock_status; int8 rssi; uint8 resevd1; uint32 rsnr; uint32 rxfreq; //M }S_CGI_TUNER; #if ERR_TO_LCM typedef struct { uint8 reset; uint8 u1; uint8 u2; uint8 rf; uint8 gps; uint8 ts; uint8 sys; uint8 m_1pps; uint8 sfn; uint8 reserved[3]; }S_CGI_LATCH,*PS_CGI_LATCH; #endif typedef struct { IPV4 ip; IPV4 mask; IPV4 gateway; uint8 mac[4]; //另外3字节固定,实际使用前3字节,方便对齐, }S_NET_PARA; typedef struct { uint8 ip[4]; // local network uint8 mask[4]; uint8 gateway[4]; uint8 dns[4]; }LOCAL_NETWORK_CFG; typedef struct { uint8 input; uint8 net; uint8 adpc; uint8 reserverd1; uint8 adpc_err; uint8 mode; uint8 gps; uint8 mon; uint8 cor; uint8 ctrl; uint8 reserved[2]; uint8 web_title[ATSC_TITLE_LEN]; uint8 sntp_en; // 0:dis 1:en uint8 sntp_sip[4]; // sntp 的服务器ip LOCAL_NETWORK_CFG netcfg; uint8 fwd_cal; uint64 sn; uint8 pdt; uint8 pa_link_ctrl_rf; uint8 sys_reset;//@NEED_ADD_FUNC uint16 dpd_tst; uint8 roll_off_sel; uint8 ab_mode; uint16 gl; // gain limit uint8 agc_att; uint16 adrv9009_att; uint8 orx_manu_gain; }S_CGI_SET,*PS_CGI_SET; typedef struct { //uint32 hz_; // 0表示整数 1表示负数 //uint32 hz; uint8 power[4]; //byte 1 0:正数 1负数 byte2 整数部分 byte3 小数部分 uint8 rxfreq; uint8 txfreq; uint8 cw; uint8 rf; uint8 agc; uint8 rc_cmd; uint8 tx; uint8 reserved[2]; }S_CGI_RF,*PS_CGI_RF; typedef struct { uint32 freq; }S_CGI_FREQ_PARA,*PS_CGI_FREQ_PARA; typedef struct { uint32 delay; uint16 txid; uint16 netid; uint8 bratio; uint8 reserved[3]; }S_CGI_NET,*PS_CGI_NET; typedef struct { uint16 pid_det; uint8 sync; uint8 tcp_c; uint8 zp1f; uint8 reserved[3]; }S_CGI_MODE,*PS_CGI_MODE; typedef struct { uint32 ip_addr; //访问端IP地址 uint32 pw_state; //访问端密码校验状态 uint32 url_reset; //刚登陆成功时,需要重置网址(否则地址栏会保留登陆信息) uint32 login_err; //登陆出错标志 uint32 login_tick; //验证密码成功时间 uint32 latest_tick; //最近访问时间 }S_IP_STATE,*PS_IP_STATE; typedef struct { uint32 current_ip; uint32 index; S_IP_STATE state[MAX_USER_NUM]; }S_LOGIN_STATE,*PS_LOGIN_STATE; extern void lan_http_start(void); extern int32 degree2fah(int32 degree); void web_task(void * pvParameters); void load_net_para(S_ETH_ADDRES *peth); void local_ip_change(void); uint32 Net_write_RF(uint8 param); void http_save_change_para(void *); void spect_data_task(void * pvParameters); void http_load_default_para(uint32 type,void *ppara); extern void http_load_sys(S_CGI_SET *ppara); extern void http_load_rf(S_CGI_RF *ppara); extern void http_load_net(S_CGI_NET *ppara); extern void http_load_mh(S_CGI_MODE *ppara); extern void http_load_latch(S_CGI_LATCH *ppara); extern void http_load_pac(S_CGI_AMP *ppara); extern void http_load_gps(S_CGI_GPS *ppara); extern void http_load_ts(TS_NET_STRUCT *ppara); extern void http_load_status(S_CGI_STATUS *ppara); extern void http_load_tuner_info(S_CGI_TUNER *ppara); extern int getNowTime(void); extern void check_fpga_gps_lock_status(void); extern void check_ts_err_status(void); extern void check_temperature_status(void); extern void check_overflow_status(void); extern void check_ts_err_log(void); #if USE_SWAP_DATA void swap_data_task(void * pvParameters); #endif #endif