Lely core libraries  1.9.2
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_TIMEOUT
29 #define LELY_CO_LSS_TIMEOUT 100
31 #endif
32 
34 #define CO_LSS_CANID(master) (0x7e4 + !!(master))
35 
36 #ifdef __cplusplus
37 extern "C" {
38 #endif
39 
51 typedef void co_lss_rate_ind_t(
52  co_lss_t *lss, co_unsigned16_t rate, int delay, void *data);
53 
67 typedef int co_lss_store_ind_t(co_lss_t *lss, co_unsigned8_t id,
68  co_unsigned16_t rate, void *data);
69 
80 typedef void co_lss_cs_ind_t(co_lss_t *lss, co_unsigned8_t cs, void *data);
81 
94 typedef void co_lss_err_ind_t(co_lss_t *lss, co_unsigned8_t cs,
95  co_unsigned8_t err, co_unsigned8_t spec, void *data);
96 
109 typedef void co_lss_lssid_ind_t(co_lss_t *lss, co_unsigned8_t cs,
110  co_unsigned32_t id, void *data);
111 
121 typedef void co_lss_nid_ind_t(co_lss_t *lss, co_unsigned8_t cs,
122  co_unsigned8_t id, void *data);
123 
135 typedef void co_lss_scan_ind_t(co_lss_t *lss, co_unsigned8_t cs,
136  const struct co_id *id, void *data);
137 
138 void *__co_lss_alloc(void);
139 void __co_lss_free(void *ptr);
140 struct __co_lss *__co_lss_init(struct __co_lss *lss, co_nmt_t *nmt);
141 void __co_lss_fini(struct __co_lss *lss);
142 
154 
156 void co_lss_destroy(co_lss_t *lss);
157 
159 co_nmt_t *co_lss_get_nmt(const co_lss_t *lss);
160 
174  const co_lss_t *lss, co_lss_rate_ind_t **pind, void **pdata);
175 
187 void co_lss_set_rate_ind(co_lss_t *lss, co_lss_rate_ind_t *ind, void *data);
188 
202  const co_lss_t *lss, co_lss_store_ind_t **pind, void **pdata);
203 
215 void co_lss_set_store_ind(co_lss_t *lss, co_lss_store_ind_t *ind, void *data);
216 
223 int co_lss_get_timeout(const co_lss_t *lss);
224 
234 void co_lss_set_timeout(co_lss_t *lss, int timeout);
235 
237 int co_lss_is_master(const co_lss_t *lss);
238 
242 int co_lss_is_idle(const co_lss_t *lss);
243 
248 void co_lss_abort_req(co_lss_t *lss);
249 
262 int co_lss_switch_req(co_lss_t *lss, co_unsigned8_t mode);
263 
278 int co_lss_switch_sel_req(co_lss_t *lss, const struct co_id *id,
279  co_lss_cs_ind_t *ind, void *data);
280 
296 int co_lss_set_id_req(co_lss_t *lss, co_unsigned8_t id, co_lss_err_ind_t *ind,
297  void *data);
298 
316 int co_lss_set_rate_req(co_lss_t *lss, co_unsigned16_t rate,
317  co_lss_err_ind_t *ind, void *data);
318 
331 int co_lss_switch_rate_req(co_lss_t *lss, int delay);
332 
348 int co_lss_store_req(co_lss_t *lss, co_lss_err_ind_t *ind, void *data);
349 
366  co_lss_t *lss, co_lss_lssid_ind_t *ind, void *data);
367 
384  co_lss_t *lss, co_lss_lssid_ind_t *ind, void *data);
385 
401 int co_lss_get_revision_req(co_lss_t *lss, co_lss_lssid_ind_t *ind, void *data);
402 
419  co_lss_t *lss, co_lss_lssid_ind_t *ind, void *data);
420 
435 int co_lss_get_id_req(co_lss_t *lss, co_lss_nid_ind_t *ind, void *data);
436 
454 int co_lss_id_slave_req(co_lss_t *lss, const struct co_id *lo,
455  const struct co_id *hi, co_lss_cs_ind_t *ind, void *data);
456 
472  co_lss_t *lss, co_lss_cs_ind_t *ind, void *data);
473 
493 int co_lss_slowscan_req(co_lss_t *lss, const struct co_id *lo,
494  const struct co_id *hi, co_lss_scan_ind_t *ind, void *data);
495 
516 int co_lss_fastscan_req(co_lss_t *lss, const struct co_id *id,
517  const struct co_id *mask, co_lss_scan_ind_t *ind, void *data);
518 
519 #ifdef __cplusplus
520 }
521 #endif
522 
523 #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:831
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:893
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:1067
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:762
struct co_id hi
The upper bound of the LSS address used during the Slowscan service.
Definition: lss.c:72
A CANopen LSS master/slave service.
Definition: lss.c:43
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:925
struct co_id mask
The mask used during the Fastscan service.
Definition: lss.c:74
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:51
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:121
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:1144
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:1194
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:869
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:135
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:1042
int co_lss_switch_rate_req(co_lss_t *lss, int delay)
Requests the &#39;activate bit timing parameters&#39; service.
Definition: lss.c:966
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:1093
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:1119
int timeout
The timeout (in milliseconds).
Definition: lss.c:60
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:783
int co_lss_get_timeout(const co_lss_t *lss)
Returns the timeout (in milliseconds) of an LSS master service.
Definition: lss.c:794
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:815
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:67
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:992
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:109
void co_lss_abort_req(co_lss_t *lss)
Aborts the current LSS master request.
Definition: lss.c:839
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:743
void co_lss_set_timeout(co_lss_t *lss, int timeout)
Sets the timeout of an LSS master service.
Definition: lss.c:802
int co_lss_switch_req(co_lss_t *lss, co_unsigned8_t mode)
Requests the &#39;switch state global&#39; service.
Definition: lss.c:847
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:94
This header file is part of the CANopen library; it contains the device description declarations...
co_nmt_t * nmt
A pointer to an NMT master/slave service.
Definition: lss.c:45
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:771
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:1228
void co_lss_destroy(co_lss_t *lss)
Destroys a CANopen LSS master/slave service.
Definition: lss.c:733
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:80
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:1017
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:751
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:1168
struct co_id lo
The lower bound of the LSS address used during the Slowscan service.
Definition: lss.c:70
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:706