Lely core libraries  2.3.4
csdo.h
Go to the documentation of this file.
1 
22 #ifndef LELY_CO_CSDO_H_
23 #define LELY_CO_CSDO_H_
24 
25 #include <lely/can/net.h>
26 #include <lely/co/sdo.h>
27 
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31 
43 typedef void co_csdo_dn_con_t(co_csdo_t *sdo, co_unsigned16_t idx,
44  co_unsigned8_t subidx, co_unsigned32_t ac, void *data);
45 
59 typedef void co_csdo_up_con_t(co_csdo_t *sdo, co_unsigned16_t idx,
60  co_unsigned8_t subidx, co_unsigned32_t ac, const void *ptr,
61  size_t n, void *data);
62 
79 typedef void co_csdo_ind_t(const co_csdo_t *sdo, co_unsigned16_t idx,
80  co_unsigned8_t subidx, size_t size, size_t nbyte, void *data);
81 
98 int co_dev_dn_req(co_dev_t *dev, co_unsigned16_t idx, co_unsigned8_t subidx,
99  const void *ptr, size_t n, co_csdo_dn_con_t *con, void *data);
100 
119 int co_dev_dn_val_req(co_dev_t *dev, co_unsigned16_t idx, co_unsigned8_t subidx,
120  co_unsigned16_t type, const void *val, co_csdo_dn_con_t *con,
121  void *data);
122 
139 int co_dev_dn_dcf_req(co_dev_t *dev, const uint_least8_t *begin,
140  const uint_least8_t *end, co_csdo_dn_con_t *con, void *data);
141 
156 int co_dev_up_req(const co_dev_t *dev, co_unsigned16_t idx,
157  co_unsigned8_t subidx, co_csdo_up_con_t *con, void *data);
158 
159 void *__co_csdo_alloc(void);
160 void __co_csdo_free(void *ptr);
161 struct __co_csdo *__co_csdo_init(struct __co_csdo *sdo, can_net_t *net,
162  co_dev_t *dev, co_unsigned8_t num);
163 void __co_csdo_fini(struct __co_csdo *sdo);
164 
181 co_csdo_t *co_csdo_create(can_net_t *net, co_dev_t *dev, co_unsigned8_t num);
182 
184 void co_csdo_destroy(co_csdo_t *sdo);
185 
196 int co_csdo_start(co_csdo_t *sdo);
197 
205 void co_csdo_stop(co_csdo_t *sdo);
206 
212 int co_csdo_is_stopped(const co_csdo_t *sdo);
213 
215 can_net_t *co_csdo_get_net(const co_csdo_t *sdo);
216 
218 co_dev_t *co_csdo_get_dev(const co_csdo_t *sdo);
219 
221 co_unsigned8_t co_csdo_get_num(const co_csdo_t *sdo);
222 
224 const struct co_sdo_par *co_csdo_get_par(const co_csdo_t *sdo);
225 
232 int co_csdo_get_timeout(const co_csdo_t *sdo);
233 
244 void co_csdo_set_timeout(co_csdo_t *sdo, int timeout);
245 
258 void co_csdo_get_dn_ind(
259  const co_csdo_t *sdo, co_csdo_ind_t **pind, void **pdata);
260 
272 void co_csdo_set_dn_ind(co_csdo_t *sdo, co_csdo_ind_t *ind, void *data);
273 
286 void co_csdo_get_up_ind(
287  const co_csdo_t *sdo, co_csdo_ind_t **pind, void **pdata);
288 
300 void co_csdo_set_up_ind(co_csdo_t *sdo, co_csdo_ind_t *ind, void *data);
301 
306 int co_csdo_is_valid(const co_csdo_t *sdo);
307 
312 int co_csdo_is_idle(const co_csdo_t *sdo);
313 
321 void co_csdo_abort_req(co_csdo_t *sdo, co_unsigned32_t ac);
322 
343 int co_csdo_dn_req(co_csdo_t *sdo, co_unsigned16_t idx, co_unsigned8_t subidx,
344  const void *ptr, size_t n, co_csdo_dn_con_t *con, void *data);
345 
366 int co_csdo_dn_val_req(co_csdo_t *sdo, co_unsigned16_t idx,
367  co_unsigned8_t subidx, co_unsigned16_t type, const void *val,
368  co_csdo_dn_con_t *con, void *data);
369 
386 int co_csdo_dn_dcf_req(co_csdo_t *sdo, const uint_least8_t *begin,
387  const uint_least8_t *end, co_csdo_dn_con_t *con, void *data);
388 
405 int co_csdo_up_req(co_csdo_t *sdo, co_unsigned16_t idx, co_unsigned8_t subidx,
406  co_csdo_up_con_t *con, void *data);
407 
426 int co_csdo_blk_dn_req(co_csdo_t *sdo, co_unsigned16_t idx,
427  co_unsigned8_t subidx, const void *ptr, size_t n,
428  co_csdo_dn_con_t *con, void *data);
429 
450 int co_csdo_blk_dn_val_req(co_csdo_t *sdo, co_unsigned16_t idx,
451  co_unsigned8_t subidx, co_unsigned16_t type, const void *val,
452  co_csdo_dn_con_t *con, void *data);
453 
473 int co_csdo_blk_up_req(co_csdo_t *sdo, co_unsigned16_t idx,
474  co_unsigned8_t subidx, co_unsigned8_t pst,
475  co_csdo_up_con_t *con, void *data);
476 
477 #ifdef __cplusplus
478 }
479 #endif
480 
481 #endif // !LELY_CO_CSDO_H_
co_csdo_t * co_csdo_create(can_net_t *net, co_dev_t *dev, co_unsigned8_t num)
Creates a new CANopen Client-SDO service.
Definition: csdo.c:997
int co_csdo_up_req(co_csdo_t *sdo, co_unsigned16_t idx, co_unsigned8_t subidx, co_csdo_up_con_t *con, void *data)
Submits an upload request to a remote Server-SDO.
Definition: csdo.c:1294
void co_csdo_up_con_t(co_csdo_t *sdo, co_unsigned16_t idx, co_unsigned8_t subidx, co_unsigned32_t ac, const void *ptr, size_t n, void *data)
The type of a CANopen Client-SDO upload confirmation callback function, invoked when an upload reques...
Definition: csdo.h:59
int co_dev_up_req(const co_dev_t *dev, co_unsigned16_t idx, co_unsigned8_t subidx, co_csdo_up_con_t *con, void *data)
Submits an upload request to a local device.
Definition: csdo.c:812
void co_csdo_stop(co_csdo_t *sdo)
Stops a Client-SDO service.
Definition: csdo.c:1069
int co_csdo_is_idle(const co_csdo_t *sdo)
Returns 1 if the specified Client-SDO service is idle, and 0 if a transfer is ongoing.
Definition: csdo.c:1203
int co_csdo_is_stopped(const co_csdo_t *sdo)
Retuns 1 if the specified Client-SDO service is stopped, and 0 if not.
Definition: csdo.c:1094
int co_csdo_dn_req(co_csdo_t *sdo, co_unsigned16_t idx, co_unsigned8_t subidx, const void *ptr, size_t n, co_csdo_dn_con_t *con, void *data)
Submits a download request to a remote Server-SDO.
Definition: csdo.c:1219
int co_dev_dn_val_req(co_dev_t *dev, co_unsigned16_t idx, co_unsigned8_t subidx, co_unsigned16_t type, const void *val, co_csdo_dn_con_t *con, void *data)
Submits a download request to a local device.
Definition: csdo.c:701
void co_csdo_dn_con_t(co_csdo_t *sdo, co_unsigned16_t idx, co_unsigned8_t subidx, co_unsigned32_t ac, void *data)
The type of a CANopen Client-SDO download confirmation callback function, invoked when a download req...
Definition: csdo.h:43
int co_dev_dn_req(co_dev_t *dev, co_unsigned16_t idx, co_unsigned8_t subidx, const void *ptr, size_t n, co_csdo_dn_con_t *con, void *data)
Submits a download request to a local device.
Definition: csdo.c:664
int co_dev_dn_dcf_req(co_dev_t *dev, const uint_least8_t *begin, const uint_least8_t *end, co_csdo_dn_con_t *con, void *data)
Submits a series of download requests to a local device.
Definition: csdo.c:739
void co_csdo_set_timeout(co_csdo_t *sdo, int timeout)
Sets the timeout of a Client-SDO.
Definition: csdo.c:1142
can_net_t * co_csdo_get_net(const co_csdo_t *sdo)
Returns a pointer to the CAN network of a Client-SDO.
Definition: csdo.c:1102
int co_csdo_get_timeout(const co_csdo_t *sdo)
Returns the timeout (in milliseconds) of a Client-SDO.
Definition: csdo.c:1134
int co_csdo_start(co_csdo_t *sdo)
Starts a Client-SDO service.
Definition: csdo.c:1034
int co_csdo_blk_up_req(co_csdo_t *sdo, co_unsigned16_t idx, co_unsigned8_t subidx, co_unsigned8_t pst, co_csdo_up_con_t *con, void *data)
Submits a block upload request to a remote Server-SDO.
Definition: csdo.c:1356
int co_csdo_blk_dn_req(co_csdo_t *sdo, co_unsigned16_t idx, co_unsigned8_t subidx, const void *ptr, size_t n, co_csdo_dn_con_t *con, void *data)
Submits a block download request to a remote Server-SDO.
Definition: csdo.c:1313
int co_csdo_blk_dn_val_req(co_csdo_t *sdo, co_unsigned16_t idx, co_unsigned8_t subidx, co_unsigned16_t type, const void *val, co_csdo_dn_con_t *con, void *data)
Submits a block download request to a remote Server-SDO.
Definition: csdo.c:1332
void co_csdo_set_up_ind(co_csdo_t *sdo, co_csdo_ind_t *ind, void *data)
Sets the indication function used to notify the user of the progress of the current SDO upload reques...
Definition: csdo.c:1184
void co_csdo_abort_req(co_csdo_t *sdo, co_unsigned32_t ac)
Submits an abort transfer request to a remote Server-SDO.
Definition: csdo.c:1211
int co_csdo_dn_dcf_req(co_csdo_t *sdo, const uint_least8_t *begin, const uint_least8_t *end, co_csdo_dn_con_t *con, void *data)
Submits a series of download requests to a remote Server-SDO.
Definition: csdo.c:1265
void co_csdo_ind_t(const co_csdo_t *sdo, co_unsigned16_t idx, co_unsigned8_t subidx, size_t size, size_t nbyte, void *data)
The type of a CANopen Client-SDO request progress indication function, used to notify the user of the...
Definition: csdo.h:79
void co_csdo_get_up_ind(const co_csdo_t *sdo, co_csdo_ind_t **pind, void **pdata)
Retrieves the indication function used to notify the user of the progress of the current SDO upload r...
Definition: csdo.c:1173
void co_csdo_set_dn_ind(co_csdo_t *sdo, co_csdo_ind_t *ind, void *data)
Sets the indication function used to notify the user of the progress of the current SDO download requ...
Definition: csdo.c:1164
const struct co_sdo_par * co_csdo_get_par(const co_csdo_t *sdo)
Returns a pointer to the SDO parameter record of a Client-SDO.
Definition: csdo.c:1126
co_unsigned8_t co_csdo_get_num(const co_csdo_t *sdo)
Returns the SDO number of a Client-SDO.
Definition: csdo.c:1118
co_dev_t * co_csdo_get_dev(const co_csdo_t *sdo)
Returns a pointer to the CANopen device of a Client-SDO.
Definition: csdo.c:1110
int co_csdo_is_valid(const co_csdo_t *sdo)
Returns 1 of the COB-IDs of the specified Client-SDO service are valid, and 0 if not.
Definition: csdo.c:1193
void co_csdo_get_dn_ind(const co_csdo_t *sdo, co_csdo_ind_t **pind, void **pdata)
Retrieves the indication function used to notify the user of the progress of the current SDO download...
Definition: csdo.c:1153
int co_csdo_dn_val_req(co_csdo_t *sdo, co_unsigned16_t idx, co_unsigned8_t subidx, co_unsigned16_t type, const void *val, co_csdo_dn_con_t *con, void *data)
Submits a download request to a remote Server-SDO.
Definition: csdo.c:1241
void co_csdo_destroy(co_csdo_t *sdo)
Destroys a CANopen Client-SDO service.
Definition: csdo.c:1024
This header file is part of the CANopen library; it contains the Service Data Object (SDO) declaratio...
This header file is part of the CAN library; it contains the CAN network interface declarations.
A CAN network interface.
Definition: net.c:37
A CANopen Client-SDO.
Definition: csdo.c:71
co_unsigned8_t num
The SDO number.
Definition: csdo.c:77
can_net_t * net
A pointer to a CAN network interface.
Definition: csdo.c:73
co_dev_t * dev
A pointer to a CANopen device.
Definition: csdo.c:75
A CANopen device.
Definition: dev.h:30
An SDO parameter record.
Definition: sdo.h:45
co_unsigned8_t n
Highest sub-index supported.
Definition: sdo.h:47