Lely core libraries  2.2.5
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 
137 int co_dev_up_req(const co_dev_t *dev, co_unsigned16_t idx,
138  co_unsigned8_t subidx, co_csdo_up_con_t *con, void *data);
139 
140 void *__co_csdo_alloc(void);
141 void __co_csdo_free(void *ptr);
142 struct __co_csdo *__co_csdo_init(struct __co_csdo *sdo, can_net_t *net,
143  co_dev_t *dev, co_unsigned8_t num);
144 void __co_csdo_fini(struct __co_csdo *sdo);
145 
161 co_csdo_t *co_csdo_create(can_net_t *net, co_dev_t *dev, co_unsigned8_t num);
162 
164 void co_csdo_destroy(co_csdo_t *sdo);
165 
167 can_net_t *co_csdo_get_net(const co_csdo_t *sdo);
168 
170 co_dev_t *co_csdo_get_dev(const co_csdo_t *sdo);
171 
173 co_unsigned8_t co_csdo_get_num(const co_csdo_t *sdo);
174 
176 const struct co_sdo_par *co_csdo_get_par(const co_csdo_t *sdo);
177 
184 int co_csdo_get_timeout(const co_csdo_t *sdo);
185 
196 void co_csdo_set_timeout(co_csdo_t *sdo, int timeout);
197 
210 void co_csdo_get_dn_ind(
211  const co_csdo_t *sdo, co_csdo_ind_t **pind, void **pdata);
212 
224 void co_csdo_set_dn_ind(co_csdo_t *sdo, co_csdo_ind_t *ind, void *data);
225 
238 void co_csdo_get_up_ind(
239  const co_csdo_t *sdo, co_csdo_ind_t **pind, void **pdata);
240 
252 void co_csdo_set_up_ind(co_csdo_t *sdo, co_csdo_ind_t *ind, void *data);
253 
258 int co_csdo_is_idle(const co_csdo_t *sdo);
259 
267 void co_csdo_abort_req(co_csdo_t *sdo, co_unsigned32_t ac);
268 
287 int co_csdo_dn_req(co_csdo_t *sdo, co_unsigned16_t idx, co_unsigned8_t subidx,
288  const void *ptr, size_t n, co_csdo_dn_con_t *con, void *data);
289 
310 int co_csdo_dn_val_req(co_csdo_t *sdo, co_unsigned16_t idx,
311  co_unsigned8_t subidx, co_unsigned16_t type, const void *val,
312  co_csdo_dn_con_t *con, void *data);
313 
330 int co_csdo_up_req(co_csdo_t *sdo, co_unsigned16_t idx, co_unsigned8_t subidx,
331  co_csdo_up_con_t *con, void *data);
332 
351 int co_csdo_blk_dn_req(co_csdo_t *sdo, co_unsigned16_t idx,
352  co_unsigned8_t subidx, const void *ptr, size_t n,
353  co_csdo_dn_con_t *con, void *data);
354 
374 int co_csdo_blk_up_req(co_csdo_t *sdo, co_unsigned16_t idx,
375  co_unsigned8_t subidx, co_unsigned8_t pst, co_csdo_up_con_t *con,
376  void *data);
377 
378 #ifdef __cplusplus
379 }
380 #endif
381 
382 #endif // !LELY_CO_CSDO_H_
void co_csdo_set_timeout(co_csdo_t *sdo, int timeout)
Sets the timeout of a Client-SDO.
Definition: csdo.c:945
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:601
can_net_t * net
A pointer to a CAN network interface.
Definition: csdo.c:47
co_unsigned8_t n
Highest sub-index supported.
Definition: sdo.h:47
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:913
co_unsigned8_t num
The SDO number.
Definition: csdo.c:51
A CAN network interface.
Definition: net.c:37
This header file is part of the CAN library; it contains the CAN network interface declarations...
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:976
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:676
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:1117
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:996
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:1034
This header file is part of the CANopen library; it contains the Service Data Object (SDO) declaratio...
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
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:929
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
co_unsigned8_t co_csdo_get_num(const co_csdo_t *sdo)
Returns the SDO number of a Client-SDO.
Definition: csdo.c:921
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:1004
A CANopen Client-SDO.
Definition: csdo.c:45
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:638
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:967
An SDO parameter record.
Definition: sdo.h:45
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_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:956
A CANopen device.
Definition: dev.c:41
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:1079
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:868
co_dev_t * dev
A pointer to a CANopen device.
Definition: csdo.c:49
co_dev_t * dev
A pointer to a CANopen device.
Definition: lss.c:50
void co_csdo_destroy(co_csdo_t *sdo)
Destroys a CANopen Client-SDO service.
Definition: csdo.c:895
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:1012
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:905
int co_csdo_get_timeout(const co_csdo_t *sdo)
Returns the timeout (in milliseconds) of a Client-SDO.
Definition: csdo.c:937
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:987
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:1098