You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

65 lines
2.0 KiB

  1. #pragma once
  2. #include <stdbool.h>
  3. #include <stdint.h>
  4. #include <stdio.h>
  5. #include <stdlib.h>
  6. #define adwin_config_protocol_size sizeof(adwin_config_protocol_t)
  7. #define active_report_data_size sizeof(active_report_data_t)
  8. #define basic_report_data_size sizeof(basic_report_data_t)
  9. #pragma pack(push, 1)
  10. typedef struct
  11. {
  12. uint32_t fixed_bit_1; /* 固定位1:F0 00 20 00 */
  13. uint32_t time_stamp_s; /* 相对时间戳,上位机通知Xsync开始工作时,从0开始,每秒+1 */
  14. uint32_t fixed_bit_2; /* 固定位2:00 00 B0 42 */
  15. uint32_t server_version; /* server版本号 */
  16. uint32_t xilinx_version; /* Xilinx Version,看需求中固定为:41 61 F7 FF */
  17. uint8_t mac_address[6]; /* MAC地址 */
  18. uint16_t fixed_bit_3; /* 固定位3:00 00 */
  19. uint16_t fixed_bit_4; /* 固定位4:00 00 */
  20. uint8_t dhcp_enable; /* DHCP enable :0-False 1- TRUE */
  21. uint8_t netmask_count; /* netmask COUNT */
  22. uint32_t gateway_ip; /* 网关 */
  23. uint64_t fixed_bit_5; /* 固定位5:00 00 00 00 00 00 00 00 */
  24. uint64_t fixed_bit_6; /* 固定位6:00 00 00 00 00 00 00 00 */
  25. } adwin_config_protocol_t;
  26. typedef struct
  27. {
  28. uint16_t index; /* */
  29. uint16_t cmd_id; /* 指令id */
  30. uint32_t time_stamp_s; /* 时间戳 */
  31. int32_t encoder_1_count; /* 编码器1计数 */
  32. int32_t encoder_2_count; /* 编码器2计数 */
  33. uint8_t device_id; /* 设备ID号 */
  34. uint8_t checksum; /* 校验和 */
  35. } active_report_data_t;
  36. typedef struct
  37. {
  38. uint16_t index; /* */
  39. uint16_t cmd_id; /* 指令id */
  40. uint16_t data; /* 数据 */
  41. uint8_t checksum; /* 校验和 */
  42. } basic_report_data_t;
  43. typedef struct
  44. {
  45. uint16_t index; /* */
  46. uint16_t cmd_id; /* 指令id */
  47. uint8_t checksum; /* 校验和 */
  48. } get_encoder_report_t;
  49. typedef struct
  50. {
  51. uint16_t index; /* */
  52. uint16_t cmd_id; /* 指令id */
  53. uint32_t encoder1; /* 编码器1的数据 */
  54. uint32_t encoder2; /* 编码器2的数据 */
  55. uint8_t checksum; /* 校验和 */
  56. } get_encoder_respont_t;
  57. #pragma pack(pop)