-
Notifications
You must be signed in to change notification settings - Fork 17
/
jsd_sdo_pub.h
144 lines (128 loc) · 5.76 KB
/
jsd_sdo_pub.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
#ifndef JSD_SDO_PUB_H
#define JSD_SDO_PUB_H
#include "jsd/jsd_types.h"
#ifdef __cplusplus
extern "C" {
#endif
/** @brief A request to set a COE parameter after intialization using the
* background SDO thread
*
* The async SDO responses are no longer checked by JSD as of v1.9.0. The
* application must monitor the jsd response queue to ensure the SDO set
* operation resulted in a success or failure.
*
* @param self pointer to jsd context
* @param slave_id The id of the slave
* @param index the COE parameter index value
* @param subindex the COE parameter subindex value
* @param data_type the type of the COE parameter e.g. U16
* @param param_in raw pointer to a value of data_type type
* @param app_id application-provided id for response tracking, not touched by JSD
* @return true if request passes prechecks, otherwise false
*/
bool jsd_sdo_set_param_async(jsd_t* self, uint16_t slave_id, uint16_t index,
uint8_t subindex, jsd_sdo_data_type_t data_type,
void* param_in, uint16_t app_id);
/** A request to retrieve a COE parameter after initialization using
* the background SDO thread
*
* The async SDO responses are no longer checked by JSD as of v1.9.0. The
* application must monitor the jsd response queue to retrieve the returned
* value and success or failure of the request.
*
* @param self pointer to jsd context
* @param slave_id The id of the slave
* @param index the COE parameter index value
* @param subindex the COE parameter subindex value
* @param data_type the type of the COE parameter e.g. U16
* @param app_id application-provided id for response tracking, not touched by JSD
* @return true if request passes prechecks, otherwise false
*/
bool jsd_sdo_get_param_async(jsd_t* self, uint16_t slave_id, uint16_t index,
uint8_t subindex, jsd_sdo_data_type_t data_type,
uint16_t app_id);
/** @brief A blocking request to set a COE parameter
*
* Only to be used during PO2SO callbacks or before transitioning to OPERATIONAL
*
* @param ecx_context Pointer to SOEM Ethercat bus context
* @param slave_id The id of the slave
* @param index the COE parameter index value
* @param subindex the COE parameter subindex value
* @param data_type the type of the COE parameter e.g. U16
* @param param_in raw pointer to a value of data_type
* @return bool true if parameter was updated, false if parameter could not be set
*/
bool jsd_sdo_set_param_blocking(ecx_contextt* ecx_context, uint16_t slave_id,
uint16_t index, uint8_t subindex,
jsd_sdo_data_type_t data_type, void* param_in);
/** A blocking request to get a COE parameter
*
* Only to be used during PO2SO callbacks or before transitioning to OPERATIONAL
*
* @param ecx_context Pointer to SOEM Ethercat bus context
* @param slave_id The id of the slave
* @param index the COE parameter index value
* @param subindex the COE parameter subindex value
* @param data_type the type of the COE parameter e.g. U16
* @param param_out raw pointer to the retrieved parameter value
* @return bool true if parameter was retrieved, false if parameter could not be retrieved
*/
bool jsd_sdo_get_param_blocking(ecx_contextt* ecx_context, uint16_t slave_id,
uint16_t index, uint8_t subindex,
jsd_sdo_data_type_t data_type, void* param_out);
/** @brief A blocking request to set a COE parameter through Complete Access (CA)
*
* Only to be used during PO2SO callbacks or before transitioning to OPERATIONAL
*
* @param ecx_context Pointer to SOEM Ethercat bus context
* @param slave_id The id of the slave
* @param index the COE parameter index value
* @param subindex the COE parameter subindex value
* @param param_size size of CA data to be written
* @param param_in CA data to be written
* @return bool true if parameter was updated, false if parameter could not be set
*/
bool jsd_sdo_set_ca_param_blocking(ecx_contextt* ecx_context, uint16_t slave_id,
uint16_t index, uint8_t subindex,
int param_size, void* param_in);
/** A blocking request to get a COE parameter through Complete Access (CA)
*
* Only to be used during PO2SO callbacks or before transitioning to OPERATIONAL
*
* @param ecx_context Pointer to SOEM Ethercat bus context
* @param slave_id The id of the slave
* @param index the COE parameter index value
* @param subindex the COE parameter subindex value
* @param param_size_in_out input as the size of the param_out buffer, returns the number
* bytes written to param_out upon success
* @param param_out raw pointer to the retrieved parameter value
* @return bool true if parameter was retrieved, false if parameter could not be retrieved
*/
bool jsd_sdo_get_ca_param_blocking(ecx_contextt* ecx_context, uint16_t slave_id,
uint16_t index, uint8_t subindex,
int* param_size_in_out, void* param_out);
/** Signal the SDO process to wakeup and check for EMCY codes
*
* Trigger to wakeup the background SDO thread to check EMCY codes.
* If this trigger is never called, the background SDO thread
* will wake up automatically at a 1hz loop rate. This function
* promotes responsiveness of the EMCY code retrieval.
*
* @param self the JSD context
* @return void
*
*/
void jsd_sdo_signal_emcy_check(jsd_t* self);
/** Pop the Async SDO response queue
*
* @param self the JSD context
* @param response the SDO result of last read/write operation
*
* return true if response is populated with a valid result.
*/
bool jsd_sdo_pop_response_queue(jsd_t* self, jsd_sdo_req_t* response);
#ifdef __cplusplus
}
#endif
#endif