Lely core libraries  2.2.5
sync.h
Go to the documentation of this file.
1 
22 #ifndef LELY_CO_SYNC_H_
23 #define LELY_CO_SYNC_H_
24 
25 #include <lely/can/net.h>
26 #include <lely/co/type.h>
27 
29 #define CO_SYNC_COBID_PRODUCER UINT32_C(0x40000000)
30 
35 #define CO_SYNC_COBID_FRAME UINT32_C(0x20000000)
36 
37 #ifdef __cplusplus
38 extern "C" {
39 #endif
40 
49 typedef void co_sync_ind_t(co_sync_t *sync, co_unsigned8_t cnt, void *data);
50 
60 typedef void co_sync_err_t(co_sync_t *sync, co_unsigned16_t eec,
61  co_unsigned8_t er, void *data);
62 
63 void *__co_sync_alloc(void);
64 void __co_sync_free(void *ptr);
65 struct __co_sync *__co_sync_init(
66  struct __co_sync *sync, can_net_t *net, co_dev_t *dev);
67 void __co_sync_fini(struct __co_sync *sync);
68 
81 
83 void co_sync_destroy(co_sync_t *sync);
84 
86 can_net_t *co_sync_get_net(const co_sync_t *sync);
87 
89 co_dev_t *co_sync_get_dev(const co_sync_t *sync);
90 
103 void co_sync_get_ind(const co_sync_t *sync, co_sync_ind_t **pind, void **pdata);
104 
116 void co_sync_set_ind(co_sync_t *sync, co_sync_ind_t *ind, void *data);
117 
129 void co_sync_get_err(const co_sync_t *sync, co_sync_err_t **perr, void **pdata);
130 
141 void co_sync_set_err(co_sync_t *sync, co_sync_err_t *err, void *data);
142 
143 #ifdef __cplusplus
144 }
145 #endif
146 
147 #endif // !LELY_CO_SYNC_H_
co_sync_set_err
void co_sync_set_err(co_sync_t *sync, co_sync_err_t *err, void *data)
Sets the error handling function of a SYNC consumer service.
Definition: sync.c:314
co_sync_ind_t
void co_sync_ind_t(co_sync_t *sync, co_unsigned8_t cnt, void *data)
The type of a CANopen SYNC indication function, invoked after a SYNC message is received or transmitt...
Definition: sync.h:49
co_sync_get_err
void co_sync_get_err(const co_sync_t *sync, co_sync_err_t **perr, void **pdata)
Retrieves the error handling function of a SYNC consumer service.
Definition: sync.c:303
type.h
co_sync_create
co_sync_t * co_sync_create(can_net_t *net, co_dev_t *dev)
Creates a new CANopen SYNC producer/consumer service.
Definition: sync.c:230
co_sync_get_ind
void co_sync_get_ind(const co_sync_t *sync, co_sync_ind_t **pind, void **pdata)
Retrieves the indication function invoked after a CANopen SYNC message is received or transmitted.
Definition: sync.c:283
co_sync_err_t
void co_sync_err_t(co_sync_t *sync, co_unsigned16_t eec, co_unsigned8_t er, void *data)
The type of a CANopen SYNC error handling function, invoked when the SYNC data length does not match.
Definition: sync.h:60
__co_sync::ind
co_sync_ind_t * ind
A pointer to the indication function.
Definition: sync.c:58
co_sync_get_dev
co_dev_t * co_sync_get_dev(const co_sync_t *sync)
Returns a pointer to the CANopen device of a SYNC producer/consumer service.
Definition: sync.c:275
co_sync_get_net
can_net_t * co_sync_get_net(const co_sync_t *sync)
Returns a pointer to the CAN network of a SYNC producer/consumer service.
Definition: sync.c:267
__co_sync::err
co_sync_err_t * err
A pointer to the error handling function.
Definition: sync.c:62
__co_dev
A CANopen device.
Definition: dev.c:41
__co_sync::net
can_net_t * net
A pointer to a CAN network interface.
Definition: sync.c:42
co_sync_destroy
void co_sync_destroy(co_sync_t *sync)
Destroys a CANopen SYNC producer/consumer service.
Definition: sync.c:257
__co_sync::dev
co_dev_t * dev
A pointer to a CANopen device.
Definition: sync.c:44
net.h
__co_sync
A CANopen SYNC producer/consumer service.
Definition: sync.c:40
__can_net
A CAN network interface.
Definition: net.c:37
co_sync_set_ind
void co_sync_set_ind(co_sync_t *sync, co_sync_ind_t *ind, void *data)
Sets the indication function invoked after a CANopen SYNC message is received or transmitted.
Definition: sync.c:294