ecat_service.h 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. /**
  2. * RT-Thread RuiChing
  3. *
  4. * COPYRIGHT (C) 2024-2025 Shanghai Real-Thread Electronic Technology Co., Ltd.
  5. * All rights reserved.
  6. *
  7. * The license and distribution terms for this file may be
  8. * found in the file LICENSE in this distribution.
  9. */
  10. #include <rtthread.h>
  11. #ifndef __ECAT_SERVICE_H__
  12. #define __ECAT_SERVICE_H__
  13. #define ECAT_SERVICE_MASTER_INIT (0x01)
  14. #define ECAT_SERVICE_MASTER_DEINIT (0x02)
  15. #define ECAT_SERVICE_MASTER_START (0x03)
  16. #define ECAT_SERVICE_MASTER_STOP (0x04)
  17. #define ECAT_SERVICE_MASTER_STATE (0x05)
  18. #define ECAT_SERVICE_SLAVE_STATE (0x06)
  19. #define ECAT_SERVICE_SLAVE_INFO (0x07)
  20. #define ECAT_SERVICE_SDO_WRITE (0x08)
  21. #define ECAT_SERVICE_SDO_READ (0x09)
  22. #define ECAT_SERVICE_DC_CONFIG (0x0A)
  23. #define ECAT_SERVICE_DC_CONFIG_EX (0x0B)
  24. #define ECAT_SERVICE_SLAVE_COUNT (0x10)
  25. #define ECAT_SERVICE_SET_STATE (0x11)
  26. #define ECAT_SERVICE_CHECT_STATE (0x12)
  27. #define ECAT_SERVICE_INIT_CONFIG (0x13)
  28. #define ECAT_SERVICE_CONFIG_DC (0x14)
  29. #define ECAT_SERVICE_CONFIG_MAP_GROUP (0x15)
  30. #define ECAT_SERVICE_SEND_PROCESS_DATA_GROUP (0x16)
  31. #define ECAT_SERVICE_RECV_PROCESS_DATA_GROUP (0x17)
  32. #define ECAT_SERVICE_TIMERSTART (0x18)
  33. #define ECAT_SERVICE_TIMER_ISEXPIRED (0x19)
  34. #define ECAT_SERVICE_HWTIMER_START (0x20)
  35. #define ECAT_SERVICE_SYNC_DC (0x0)
  36. #define ECAT_SERVICE_SLAVE_CONFIG (0x21)
  37. struct ecat_master_state_arg
  38. {
  39. ec_master_t *master;
  40. ec_master_state_t *state;
  41. };
  42. struct ecat_slave_state_arg
  43. {
  44. ec_master_t *master;
  45. ec_slave_state_t *state;
  46. uint16_t slave;
  47. };
  48. struct ecat_state_arg
  49. {
  50. ec_master_t *master;
  51. uint16_t *state;
  52. uint16_t slave;
  53. int timeout;
  54. };
  55. struct ecat_slave_info_arg
  56. {
  57. ec_master_t *master;
  58. ec_slave_info_t *info;
  59. uint16_t slave;
  60. };
  61. struct ecat_slave_config_arg
  62. {
  63. ec_master_t *master;
  64. ec_slave_config_t *config;
  65. uint16_t slave;
  66. };
  67. struct ecat_pdo_arg
  68. {
  69. ec_master_t *master;
  70. void *data;
  71. int size;
  72. int timeout;
  73. uint16_t slave;
  74. uint16_t index;
  75. uint8_t subindex;
  76. uint8_t complete_access;
  77. };
  78. struct ecat_dc_config_arg
  79. {
  80. ec_master_t *master;
  81. uint32_t cycle_time;
  82. int32_t cycle_shift;
  83. uint16_t slave;
  84. uint8_t act;
  85. };
  86. struct ecat_dc_config_ex_arg
  87. {
  88. ec_master_t *master;
  89. uint32_t cycle_time0;
  90. uint32_t cycle_time1;
  91. int32_t cycle_shift;
  92. uint16_t slave;
  93. uint8_t act;
  94. };
  95. struct ecat_config_handler_arg
  96. {
  97. ec_master_t *master;
  98. void (*handler)(struct ec_master *master);
  99. };
  100. struct ecat_pdo_handler_arg
  101. {
  102. ec_master_t *master;
  103. void (*handler)(struct ec_master *master,
  104. uint16_t slave,
  105. uint8_t *input,
  106. uint8_t *output);
  107. };
  108. struct ecat_error_handler_arg
  109. {
  110. ec_master_t *master;
  111. void (*handler)(struct ec_master *master,
  112. uint32_t error_code,
  113. const unsigned char *error_str);
  114. };
  115. struct ecat_slavecount_arg
  116. {
  117. ec_master_t *master;
  118. int count;
  119. };
  120. #endif /* __ECAT_SERVICE_H__ */