Lely core libraries  2.3.4
tpdo.h
Go to the documentation of this file.
1 
22 #ifndef LELY_CO_TPDO_H_
23 #define LELY_CO_TPDO_H_
24 
25 #include <lely/can/net.h>
26 #include <lely/co/pdo.h>
27 
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31 
46 typedef void co_tpdo_ind_t(co_tpdo_t *pdo, co_unsigned32_t ac, const void *ptr,
47  size_t n, void *data);
48 
60 typedef int co_tpdo_sample_ind_t(co_tpdo_t *pdo, void *data);
61 
62 void *__co_tpdo_alloc(void);
63 void __co_tpdo_free(void *ptr);
64 struct __co_tpdo *__co_tpdo_init(struct __co_tpdo *pdo, can_net_t *net,
65  co_dev_t *dev, co_unsigned16_t num);
66 void __co_tpdo_fini(struct __co_tpdo *pdo);
67 
83 co_tpdo_t *co_tpdo_create(can_net_t *net, co_dev_t *dev, co_unsigned16_t num);
84 
86 void co_tpdo_destroy(co_tpdo_t *pdo);
87 
98 int co_tpdo_start(co_tpdo_t *pdo);
99 
107 void co_tpdo_stop(co_tpdo_t *pdo);
108 
114 int co_tpdo_is_stopped(const co_tpdo_t *pdo);
115 
117 can_net_t *co_tpdo_get_net(const co_tpdo_t *pdo);
118 
120 co_dev_t *co_tpdo_get_dev(const co_tpdo_t *pdo);
121 
123 co_unsigned16_t co_tpdo_get_num(const co_tpdo_t *pdo);
124 
129 const struct co_pdo_comm_par *co_tpdo_get_comm_par(const co_tpdo_t *pdo);
130 
132 const struct co_pdo_map_par *co_tpdo_get_map_par(const co_tpdo_t *pdo);
133 
146 void co_tpdo_get_ind(const co_tpdo_t *pdo, co_tpdo_ind_t **pind, void **pdata);
147 
159 void co_tpdo_set_ind(co_tpdo_t *pdo, co_tpdo_ind_t *ind, void *data);
160 
174  void **pdata);
175 
188  co_tpdo_t *pdo, co_tpdo_sample_ind_t *ind, void *data);
189 
200 int co_tpdo_event(co_tpdo_t *pdo);
201 
214 int co_tpdo_sync(co_tpdo_t *pdo, co_unsigned8_t cnt);
215 
229 int co_tpdo_sample_res(co_tpdo_t *pdo, co_unsigned32_t ac);
230 
232 void co_tpdo_get_next(const co_tpdo_t *pdo, struct timespec *tp);
233 
249 int co_dam_mpdo_event(co_tpdo_t *pdo, co_unsigned8_t id, co_unsigned16_t idx,
250  co_unsigned8_t subidx, const co_unsigned8_t data[4]);
251 
265  co_tpdo_t *pdo, co_unsigned16_t idx, co_unsigned8_t subidx);
266 
267 #ifdef __cplusplus
268 }
269 #endif
270 
271 #endif // !LELY_CO_TPDO_H_
This header file is part of the CAN library; it contains the CAN network interface declarations.
This header file is part of the CANopen library; it contains the Process Data Object (PDO) declaratio...
A CAN network interface.
Definition: net.c:37
A CANopen device.
Definition: dev.h:30
A CANopen Transmit-PDO.
Definition: tpdo.c:53
co_unsigned16_t num
The PDO number.
Definition: tpdo.c:59
co_dev_t * dev
A pointer to a CANopen device.
Definition: tpdo.c:57
can_net_t * net
A pointer to a CAN network interface.
Definition: tpdo.c:55
A PDO communication parameter record.
Definition: pdo.h:64
A PDO mapping parameter record.
Definition: pdo.h:90
int co_tpdo_sample_ind_t(co_tpdo_t *pdo, void *data)
The type of a CANopen Transmit-PDO sampling indication function, invoked when the device starts sampl...
Definition: tpdo.h:60
int co_tpdo_is_stopped(const co_tpdo_t *pdo)
Retuns 1 if the specified Transmit-PDO service is stopped, and 0 if not.
Definition: tpdo.c:420
const struct co_pdo_map_par * co_tpdo_get_map_par(const co_tpdo_t *pdo)
Returns a pointer to the PDO mapping parameter record of a Transmit-PDO.
Definition: tpdo.c:460
void co_tpdo_set_sample_ind(co_tpdo_t *pdo, co_tpdo_sample_ind_t *ind, void *data)
Sets the indication function invoked when a Transmit-PDO starts sampling after the reception of a SYN...
Definition: tpdo.c:500
int co_tpdo_event(co_tpdo_t *pdo)
Triggers the transmission of an acyclic or event-driven PDO.
Definition: tpdo.c:509
void co_tpdo_get_sample_ind(const co_tpdo_t *pdo, co_tpdo_sample_ind_t **pind, void **pdata)
Retrieves the indication function invoked when a Transmit-PDO starts sampling after the reception of ...
Definition: tpdo.c:488
int co_sam_mpdo_event(co_tpdo_t *pdo, co_unsigned16_t idx, co_unsigned8_t subidx)
Triggers the transmission of a DAM-MPDO.
Definition: tpdo.c:730
void co_tpdo_destroy(co_tpdo_t *pdo)
Destroys a CANopen Transmit-PDO service.
Definition: tpdo.c:330
int co_tpdo_sample_res(co_tpdo_t *pdo, co_unsigned32_t ac)
Indicates the result of the sampling step after the reception of a SYNC event.
Definition: tpdo.c:614
can_net_t * co_tpdo_get_net(const co_tpdo_t *pdo)
Returns a pointer to the CAN network of a Transmit-PDO.
Definition: tpdo.c:428
void co_tpdo_get_next(const co_tpdo_t *pdo, struct timespec *tp)
Retrieves the time at which the next event-driven TPDO may be sent.
Definition: tpdo.c:655
void co_tpdo_get_ind(const co_tpdo_t *pdo, co_tpdo_ind_t **pind, void **pdata)
Retrieves the indication function invoked when a Transmit-PDO is sent or an error occurs.
Definition: tpdo.c:468
void co_tpdo_ind_t(co_tpdo_t *pdo, co_unsigned32_t ac, const void *ptr, size_t n, void *data)
The type of a CANopen Transmit-PDO indication function, invoked when a PDO is sent or an error occurs...
Definition: tpdo.h:46
co_tpdo_t * co_tpdo_create(can_net_t *net, co_dev_t *dev, co_unsigned16_t num)
Creates a new CANopen Transmit-PDO service.
Definition: tpdo.c:303
int co_dam_mpdo_event(co_tpdo_t *pdo, co_unsigned8_t id, co_unsigned16_t idx, co_unsigned8_t subidx, const co_unsigned8_t data[4])
Triggers the transmission of a DAM-MPDO.
Definition: tpdo.c:666
void co_tpdo_set_ind(co_tpdo_t *pdo, co_tpdo_ind_t *ind, void *data)
Sets the indication function invoked when a Transmit-PDO is sent or an error occurs.
Definition: tpdo.c:479
int co_tpdo_start(co_tpdo_t *pdo)
Starts a Transmit-PDO service.
Definition: tpdo.c:340
int co_tpdo_sync(co_tpdo_t *pdo, co_unsigned8_t cnt)
Triggers the transmission of a synchronous PDO.
Definition: tpdo.c:565
co_dev_t * co_tpdo_get_dev(const co_tpdo_t *pdo)
Returns a pointer to the CANopen device of a Transmit-PDO.
Definition: tpdo.c:436
void co_tpdo_stop(co_tpdo_t *pdo)
Stops a Transmit-PDO service.
Definition: tpdo.c:392
co_unsigned16_t co_tpdo_get_num(const co_tpdo_t *pdo)
Returns the PDO number of a Transmit-PDO.
Definition: tpdo.c:444
const struct co_pdo_comm_par * co_tpdo_get_comm_par(const co_tpdo_t *pdo)
Returns a pointer to the PDO communication parameter record of a Transmit-PDO.
Definition: tpdo.c:452