40 lines
1.5 KiB
C
40 lines
1.5 KiB
C
#ifndef __HART_MASTER_RSP_H__
|
||
#define __HART_MASTER_RSP_H__
|
||
|
||
#include "./hart_master_frame.h"
|
||
|
||
#pragma pack(1)
|
||
typedef struct
|
||
{
|
||
uint8_t card_index;
|
||
uint8_t channel_index;
|
||
io_system_device_t *device;
|
||
} io_system_device_info_t;
|
||
typedef union
|
||
{
|
||
hart_command_75_t command_75; // 轮询子设备
|
||
hart_command_84_t command_84; // 读取子设备标识摘要
|
||
hart_command_85_t command_85; // 读取I/O通道统计信息
|
||
hart_command_86_t command_86; // 读取子设备统计信息
|
||
hart_command_87_t command_87; // 写入I/O系统主模式
|
||
hart_command_88_t command_88; // 写入重试计数
|
||
} hart_command_rsp_data_u; // HART请求指令数据域
|
||
typedef struct
|
||
{
|
||
uint8_t address[HART_LONG_ADDRESS_LEN]; // 短帧地址1个字节,长帧地址5个字节,上位机发送时从低位到高位填充,例如短地址:0x01,长地址:0x00 0x00 0x00 0x00 0x01
|
||
uint8_t address_length; // 地址长度
|
||
uint32_t command; // HART命令码
|
||
hart_command_rsp_data_u data; // 数据域
|
||
|
||
// 以下解析数据后填充
|
||
hart_delimiter_u delimiter;
|
||
uint8_t data_length; // 数据域长度
|
||
} hart_command_rsp_t; // 主机请求指令接口参数定义:hart_master_command_req
|
||
|
||
#pragma pack()
|
||
|
||
extern BOOL (*hart_command_rsp_ptr_arr[HART_COMMAND_MAX])(const hart_command_rsp_t *const data, hart_response_t *resp);
|
||
|
||
extern BOOL hart_master_rsp_init(const hart_master_init_t *const init);
|
||
#endif // __HART_MASTER_RSP_H__
|