Lely core libraries  2.2.5
lss.h
Go to the documentation of this file.
1 
22 #ifndef LELY_CO_LSS_H_
23 #define LELY_CO_LSS_H_
24 
25 #include <lely/can/net.h>
26 #include <lely/co/dev.h>
27 
28 #ifndef LELY_CO_LSS_INHIBIT
29 #define LELY_CO_LSS_INHIBIT 10
31 #endif
32 
33 #ifndef LELY_CO_LSS_TIMEOUT
34 #define LELY_CO_LSS_TIMEOUT 100
36 #endif
37 
39 #define CO_LSS_CANID(master) (0x7e4 + !!(master))
40 
41 #ifdef __cplusplus
42 extern "C" {
43 #endif
44 
56 typedef void co_lss_rate_ind_t(
57  co_lss_t *lss, co_unsigned16_t rate, int delay, void *data);
58 
72 typedef int co_lss_store_ind_t(co_lss_t *lss, co_unsigned8_t id,
73  co_unsigned16_t rate, void *data);
74 
85 typedef void co_lss_cs_ind_t(co_lss_t *lss, co_unsigned8_t cs, void *data);
86 
99 typedef void co_lss_err_ind_t(co_lss_t *lss, co_unsigned8_t cs,
100  co_unsigned8_t err, co_unsigned8_t spec, void *data);
101 
114 typedef void co_lss_lssid_ind_t(co_lss_t *lss, co_unsigned8_t cs,
115  co_unsigned32_t id, void *data);
116 
126 typedef void co_lss_nid_ind_t(co_lss_t *lss, co_unsigned8_t cs,
127  co_unsigned8_t id, void *data);
128 
140 typedef void co_lss_scan_ind_t(co_lss_t *lss, co_unsigned8_t cs,
141  const struct co_id *id, void *data);
142 
143 void *__co_lss_alloc(void);
144 void __co_lss_free(void *ptr);
145 struct __co_lss *__co_lss_init(struct __co_lss *lss, co_nmt_t *nmt);
146 void __co_lss_fini(struct __co_lss *lss);
147 
159 
161 void co_lss_destroy(co_lss_t *lss);
162 
164 co_nmt_t *co_lss_get_nmt(const co_lss_t *lss);
165 
179  const co_lss_t *lss, co_lss_rate_ind_t **pind, void **pdata);
180 
192 void co_lss_set_rate_ind(co_lss_t *lss, co_lss_rate_ind_t *ind, void *data);
193 
207  const co_lss_t *lss, co_lss_store_ind_t **pind, void **pdata);
208 
220 void co_lss_set_store_ind(co_lss_t *lss, co_lss_store_ind_t *ind, void *data);
221 
228 co_unsigned16_t co_lss_get_inhibit(const co_lss_t *lss);
229 
240 void co_lss_set_inhibit(co_lss_t *lss, co_unsigned16_t inhibit);
241 
248 int co_lss_get_timeout(const co_lss_t *lss);
249 
259 void co_lss_set_timeout(co_lss_t *lss, int timeout);
260 
262 int co_lss_is_master(const co_lss_t *lss);
263 
267 int co_lss_is_idle(const co_lss_t *lss);
268 
273 void co_lss_abort_req(co_lss_t *lss);
274 
287 int co_lss_switch_req(co_lss_t *lss, co_unsigned8_t mode);
288 
303 int co_lss_switch_sel_req(co_lss_t *lss, const struct co_id *id,
304  co_lss_cs_ind_t *ind, void *data);
305 
321 int co_lss_set_id_req(co_lss_t *lss, co_unsigned8_t id, co_lss_err_ind_t *ind,
322  void *data);
323 
341 int co_lss_set_rate_req(co_lss_t *lss, co_unsigned16_t rate,
342  co_lss_err_ind_t *ind, void *data);
343 
356 int co_lss_switch_rate_req(co_lss_t *lss, int delay);
357 
373 int co_lss_store_req(co_lss_t *lss, co_lss_err_ind_t *ind, void *data);
374 
391  co_lss_t *lss, co_lss_lssid_ind_t *ind, void *data);
392 
409  co_lss_t *lss, co_lss_lssid_ind_t *ind, void *data);
410 
426 int co_lss_get_revision_req(co_lss_t *lss, co_lss_lssid_ind_t *ind, void *data);
427 
444  co_lss_t *lss, co_lss_lssid_ind_t *ind, void *data);
445 
460 int co_lss_get_id_req(co_lss_t *lss, co_lss_nid_ind_t *ind, void *data);
461 
479 int co_lss_id_slave_req(co_lss_t *lss, const struct co_id *lo,
480  const struct co_id *hi, co_lss_cs_ind_t *ind, void *data);
481 
497  co_lss_t *lss, co_lss_cs_ind_t *ind, void *data);
498 
518 int co_lss_slowscan_req(co_lss_t *lss, const struct co_id *lo,
519  const struct co_id *hi, co_lss_scan_ind_t *ind, void *data);
520 
542 int co_lss_fastscan_req(co_lss_t *lss, const struct co_id *id,
543  const struct co_id *mask, co_lss_scan_ind_t *ind, void *data);
544 
545 #ifdef __cplusplus
546 }
547 #endif
548 
549 #endif // !LELY_CO_LSS_H_
int co_lss_is_idle(const co_lss_t *lss)
Returns 1 if the specified LSS master is idle, and 0 if a request is ongoing.
Definition: lss.c:911
int co_lss_set_id_req(co_lss_t *lss, co_unsigned8_t id, co_lss_err_ind_t *ind, void *data)
Requests the &#39;configure node-ID&#39; service.
Definition: lss.c:971
int co_lss_get_revision_req(co_lss_t *lss, co_lss_lssid_ind_t *ind, void *data)
Requests the &#39;inquire identity revision-number&#39; service.
Definition: lss.c:1142
void co_lss_set_rate_ind(co_lss_t *lss, co_lss_rate_ind_t *ind, void *data)
Sets the indication function invoked when an LSS &#39;activate bit timing&#39; request is received...
Definition: lss.c:826
struct co_id hi
The upper bound of the LSS address used during the Slowscan service.
Definition: lss.c:77
A CANopen LSS master/slave service.
Definition: lss.c:44
int co_lss_set_rate_req(co_lss_t *lss, co_unsigned16_t rate, co_lss_err_ind_t *ind, void *data)
Requests the &#39;configure bit timing parameters&#39; service.
Definition: lss.c:1003
struct co_id mask
The mask used during the Fastscan service.
Definition: lss.c:79
void co_lss_rate_ind_t(co_lss_t *lss, co_unsigned16_t rate, int delay, void *data)
The type of a CANopen LSS &#39;activate bit timing&#39; indication function, invoked when a baudrate switch i...
Definition: lss.h:56
This header file is part of the CAN library; it contains the CAN network interface declarations...
void co_lss_nid_ind_t(co_lss_t *lss, co_unsigned8_t cs, co_unsigned8_t id, void *data)
The type of a CANopen LSS inquire node-ID indication function, invoked when an &#39;inquire node-ID&#39; requ...
Definition: lss.h:126
int co_lss_id_slave_req(co_lss_t *lss, const struct co_id *lo, const struct co_id *hi, co_lss_cs_ind_t *ind, void *data)
Requests the &#39;LSS identify remote slave&#39; service.
Definition: lss.c:1219
int co_lss_slowscan_req(co_lss_t *lss, const struct co_id *lo, const struct co_id *hi, co_lss_scan_ind_t *ind, void *data)
Requests the &#39;LSS Slowscan&#39; service.
Definition: lss.c:1279
int co_lss_switch_sel_req(co_lss_t *lss, const struct co_id *id, co_lss_cs_ind_t *ind, void *data)
Requests the &#39;switch state selective&#39; service.
Definition: lss.c:949
void co_lss_scan_ind_t(co_lss_t *lss, co_unsigned8_t cs, const struct co_id *id, void *data)
The type of a CANopen LSS identify remote slave indication function, invoked when a &#39;Slowscan&#39; or &#39;Fa...
Definition: lss.h:140
co_unsigned16_t inhibit
The inhibit time (in multiples of 100 microseconds).
Definition: lss.c:57
int co_lss_get_product_code_req(co_lss_t *lss, co_lss_lssid_ind_t *ind, void *data)
Requests the &#39;inquire identity product-code&#39; service.
Definition: lss.c:1117
int co_lss_switch_rate_req(co_lss_t *lss, int delay)
Requests the &#39;activate bit timing parameters&#39; service.
Definition: lss.c:1044
int co_lss_get_serial_nr_req(co_lss_t *lss, co_lss_lssid_ind_t *ind, void *data)
Requests the &#39;inquire identity serial-number&#39; service.
Definition: lss.c:1168
int co_lss_get_id_req(co_lss_t *lss, co_lss_nid_ind_t *ind, void *data)
Requests the &#39;inquire node-ID&#39; service.
Definition: lss.c:1194
int timeout
The timeout (in milliseconds).
Definition: lss.c:65
void co_lss_set_store_ind(co_lss_t *lss, co_lss_store_ind_t *ind, void *data)
Sets the indication function invoked when an LSS &#39;store configuration&#39; request is received...
Definition: lss.c:847
co_unsigned16_t co_lss_get_inhibit(const co_lss_t *lss)
Returns the inhibit time (in multiples of 100 microseconds) of an LSS master service.
Definition: lss.c:858
int co_lss_get_timeout(const co_lss_t *lss)
Returns the timeout (in milliseconds) of an LSS master service.
Definition: lss.c:874
A CANopen NMT master/slave service.
Definition: nmt.c:104
int co_lss_is_master(const co_lss_t *lss)
Returns 1 if the specified CANopen LSS service is a master, and 0 if not.
Definition: lss.c:895
int co_lss_store_ind_t(co_lss_t *lss, co_unsigned8_t id, co_unsigned16_t rate, void *data)
The type of a CANopen LSS &#39;store configuration&#39; indication function, invoked when the pending node-ID...
Definition: lss.h:72
int co_lss_store_req(co_lss_t *lss, co_lss_err_ind_t *ind, void *data)
Requests the &#39;store configuration&#39; service.
Definition: lss.c:1067
void co_lss_lssid_ind_t(co_lss_t *lss, co_unsigned8_t cs, co_unsigned32_t id, void *data)
The type of a CANopen LSS inquire identity indication function, invoked when an &#39;inquire identity ven...
Definition: lss.h:114
void co_lss_abort_req(co_lss_t *lss)
Aborts the current LSS master request.
Definition: lss.c:919
co_nmt_t * co_lss_get_nmt(const co_lss_t *lss)
Returns a pointer to the NMT service of an LSS master/slave service.
Definition: lss.c:807
void co_lss_set_timeout(co_lss_t *lss, int timeout)
Sets the timeout of an LSS master service.
Definition: lss.c:882
int co_lss_switch_req(co_lss_t *lss, co_unsigned8_t mode)
Requests the &#39;switch state global&#39; service.
Definition: lss.c:927
void co_lss_err_ind_t(co_lss_t *lss, co_unsigned8_t cs, co_unsigned8_t err, co_unsigned8_t spec, void *data)
The type of a CANopen LSS error received indication function, invoked when a &#39;configure node-ID&#39;...
Definition: lss.h:99
co_nmt_t * nmt
A pointer to an NMT master/slave service.
Definition: lss.c:46
void co_lss_get_store_ind(const co_lss_t *lss, co_lss_store_ind_t **pind, void **pdata)
Retrieves the indication function invoked when an LSS &#39;store configuration&#39; request is received...
Definition: lss.c:835
int co_lss_fastscan_req(co_lss_t *lss, const struct co_id *id, const struct co_id *mask, co_lss_scan_ind_t *ind, void *data)
Requests the &#39;LSS Fastscan&#39; service.
Definition: lss.c:1315
void co_lss_set_inhibit(co_lss_t *lss, co_unsigned16_t inhibit)
Sets the inhibit time between successive LSS messages of an LSS master service.
Definition: lss.c:866
void co_lss_destroy(co_lss_t *lss)
Destroys a CANopen LSS master/slave service.
Definition: lss.c:797
void co_lss_cs_ind_t(co_lss_t *lss, co_unsigned8_t cs, void *data)
The type of a CANopen LSS command received indication function, invoked when a &#39;switch state selectiv...
Definition: lss.h:85
This header file is part of the CANopen library; it contains the device description declarations...
int co_lss_get_vendor_id_req(co_lss_t *lss, co_lss_lssid_ind_t *ind, void *data)
Requests the &#39;inquire identity vendor-ID&#39; service.
Definition: lss.c:1092
void co_lss_get_rate_ind(const co_lss_t *lss, co_lss_rate_ind_t **pind, void **pdata)
Retrieves the indication function invoked when an LSS &#39;activate bit timing&#39; request is received...
Definition: lss.c:815
int co_lss_id_non_cfg_slave_req(co_lss_t *lss, co_lss_cs_ind_t *ind, void *data)
Requests the &#39;LSS identify non-configured remote slave&#39; service.
Definition: lss.c:1253
struct co_id lo
The lower bound of the LSS address used during the Slowscan service.
Definition: lss.c:75
An identity record.
Definition: dev.h:33
co_lss_t * co_lss_create(co_nmt_t *nmt)
Creates a new CANopen LSS master/slave service.
Definition: lss.c:770