You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
135 lines
6.4 KiB
C
135 lines
6.4 KiB
C
/*****************************************************************************
|
|
* file include/pd_dbg.h
|
|
* author YuLiang
|
|
* version 1.0.0
|
|
* date 01-June-2023
|
|
* brief This file provides all the headers of the debug server functions.
|
|
******************************************************************************
|
|
* Attention
|
|
*
|
|
* <h2><center>© COPYRIGHT(c) 2021 LandPower</center></h2>
|
|
*
|
|
* Redistribution and use in source and binary forms, with or without modification,
|
|
* are permitted provided that the following conditions are met:
|
|
* 1. Redistributions of source code must retain the above copyright notice,
|
|
* this list of conditions and the following disclaimer.
|
|
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
* this list of conditions and the following disclaimer in the documentation
|
|
* and/or other materials provided with the distribution.
|
|
* 3. Neither the name of LandPower nor the names of its contributors may be used to
|
|
* endorse or promote products derived from this software without specific
|
|
* prior written permission.
|
|
*
|
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
*
|
|
******************************************************************************/
|
|
|
|
#ifndef __PD_DBG_H__
|
|
#define __PD_DBG_H__
|
|
|
|
#ifdef CFG_DEV_TYPE_LAND_PD
|
|
/* Includes ------------------------------------------------------------------*/
|
|
#include "pd_main.h"
|
|
|
|
/* Define --------------------------------------------------------------------*/
|
|
#define DEBUG_BUG_SIZE 1512
|
|
#define DEBUG_CJSON_BUG_SIZE 1512
|
|
|
|
#define DEBUG_CONFIG_GET (0x0001) // 获取配置.
|
|
#define DEBUG_CONFIG_SET (0x0002) // 设置配置.
|
|
#define DEBUG_ALARM_CONFIG_GET (0x0003) // 获取事件告警二进制文件配置.
|
|
#define DEBUG_ALARM_CONFIG_SET (0x0004) // 设置事件告警二进制文件配置.
|
|
#define DEBUG_REBOOT (0x0005) // 重启.
|
|
#define DEBUG_TIME_SET (0x0006) // 对时.
|
|
#define DEBUG_NOISE_CAREFOR (0x0007) // 关注对应通道的底噪原始值, 校准底噪值.
|
|
#define DEBUG_NOISE_POST (0x0008) // 获取底噪原始值, 校准底噪值 服务端主动提交每秒刷新一次.
|
|
#define DEBUG_ADJSUT_COEFFICIENT_GET (0x0009) // 获取校准系数.
|
|
#define DEBUG_ADJSUT_COEFFICIENT_SET (0x000a) // 设置校准系数.
|
|
#define DEBUG_RUN_STATUS_GET (0x000b) // 获取运行状态数据.
|
|
#define DEBUG_ARM_UPGRADE (0x0050) // ARM 升级.
|
|
#define DEBUG_FPGA1_UPGRADE (0x0051) // FPGA 板卡升级.
|
|
#define DEBUG_FPGA2_UPGRADE (0x0052) // FPGA 板卡升级.
|
|
#define DEBUG_FPGA3_UPGRADE (0x0053) // FPGA 板卡升级.
|
|
#define DEBUG_FPGA4_UPGRADE (0x0054) // FPGA 板卡升级.
|
|
#define DEBUG_FPGA_UPGRADE (0x0055) // FPGA 板卡升级.
|
|
#define DEBUG_UPGRADE_ALL (0x0056) // ARM和FPGA板卡升级
|
|
|
|
#define BITMAP_SAVE_FILE (1 << 0)
|
|
#define BITMAP_IP_CHANGE (1 << 1)
|
|
|
|
#define DEBUG_MANAGE_TOOL_PORT (10050)
|
|
/* Exported types ------------------------------------------------------------*/
|
|
/* 端口校准系数. */
|
|
typedef struct {
|
|
uint16_t point[4]; // 通道分段点.
|
|
uint16_t param_a[5]; // 通道线性度校准系数 a.
|
|
uint16_t param_b[5]; // 通道线性度校准系数 b.
|
|
uint16_t alarm_ref; // 断线告警比较值.
|
|
uint16_t reserve;
|
|
} debug_pkt_adj_vport_t;
|
|
|
|
typedef struct {
|
|
debug_pkt_adj_vport_t vport[PD_PORT_SUM];
|
|
} debug_pkt_adj_t;
|
|
|
|
/* 端口状态, 主要是 ADC 原始值和校准后的值.*/
|
|
typedef struct {
|
|
uint16_t value_adc;
|
|
int16_t value_adj;
|
|
} debug_pkt_port_state_t;
|
|
|
|
typedef struct {
|
|
debug_pkt_port_state_t vport[PD_PORT_SUM];
|
|
} debug_pkt_port_t;
|
|
|
|
/* 设备状态. */
|
|
typedef struct {
|
|
uint32_t idx; // 编号.
|
|
uint32_t UTC_TimeScale; // UTC 时标
|
|
float F50Hz_Frequency; // 同步 50Hz 频率.
|
|
uint8_t F50Hz_SynStatus; // 同步状态.
|
|
uint8_t dau_status; // 插件状态.
|
|
uint16_t sensor_status; // 传感器断线状态.
|
|
uint16_t is_server_link; // 是否连接上后台.
|
|
uint16_t version; // 软件版本
|
|
uint32_t communication_time; // 上一次通讯的时间
|
|
uint32_t run_time; // 设备运行时间
|
|
} debug_pkt_status_t;
|
|
|
|
/* 报文头. */
|
|
typedef struct{
|
|
uint16_t head; // 0x55aa.
|
|
uint16_t cmd; // 命令.
|
|
uint32_t len; // 包长.
|
|
} debug_pkt_head_t;
|
|
|
|
/* 调试工具全局结构 */
|
|
typedef struct{
|
|
int fd; // TCP server 监听使用的 socket.
|
|
int fd_client; // TCP client 通讯使用的 socket.
|
|
char buf[DEBUG_BUG_SIZE]; // 通讯使用收法包 buffer.
|
|
char buf_post[DEBUG_BUG_SIZE]; // 主动上传通讯使用收法包 buffer.
|
|
int is_manual_col; // 是否手动采集.
|
|
} debug_ctrl_t;
|
|
|
|
/* Exported macro ------------------------------------------------------------*/
|
|
|
|
/* Extern global variables ---------------------------------------------------*/
|
|
extern debug_ctrl_t debug_ctrl;
|
|
|
|
/* Extern functions ----------------------------------------------------------*/
|
|
extern int32_t debug_handle_init(void);
|
|
extern int32_t debug_pkt_port_state_post(void);
|
|
#endif
|
|
#endif
|
|
/************************ (C) COPYRIGHT LandPower ***** END OF FILE ****/
|