Lely core libraries  2.3.4
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 
82 
84 void co_sync_destroy(co_sync_t *sync);
85 
96 int co_sync_start(co_sync_t *sync);
97 
105 void co_sync_stop(co_sync_t *sync);
106 
112 int co_sync_is_stopped(const co_sync_t *sync);
113 
115 can_net_t *co_sync_get_net(const co_sync_t *sync);
116 
118 co_dev_t *co_sync_get_dev(const co_sync_t *sync);
119 
132 void co_sync_get_ind(const co_sync_t *sync, co_sync_ind_t **pind, void **pdata);
133 
145 void co_sync_set_ind(co_sync_t *sync, co_sync_ind_t *ind, void *data);
146 
158 void co_sync_get_err(const co_sync_t *sync, co_sync_err_t **perr, void **pdata);
159 
170 void co_sync_set_err(co_sync_t *sync, co_sync_err_t *err, void *data);
171 
172 #ifdef __cplusplus
173 }
174 #endif
175 
176 #endif // !LELY_CO_SYNC_H_
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 device.
Definition: dev.h:30
A CANopen SYNC producer/consumer service.
Definition: sync.c:40
can_net_t * net
A pointer to a CAN network interface.
Definition: sync.c:42
co_sync_err_t * err
A pointer to the error handling function.
Definition: sync.c:64
co_sync_ind_t * ind
A pointer to the indication function.
Definition: sync.c:60
co_dev_t * dev
A pointer to a CANopen device.
Definition: sync.c:44
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:360
void co_sync_destroy(co_sync_t *sync)
Destroys a CANopen SYNC producer/consumer service.
Definition: sync.c:238
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
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:371
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:351
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:332
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:211
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
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:324
int co_sync_start(co_sync_t *sync)
Starts a SYNC service.
Definition: sync.c:248
void co_sync_stop(co_sync_t *sync)
Stops a SYNC service.
Definition: sync.c:285
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:340
int co_sync_is_stopped(const co_sync_t *sync)
Retuns 1 if the specified SYNC service is stopped, and 0 if not.
Definition: sync.c:316
This header file is part of the CANopen library; it contains the CANopen type definitions.