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
30#define LELY_CO_LSS_TIMEOUT 100
31#endif
32
34#define CO_LSS_CANID(master) (0x7e4 + !!(master))
35
36#ifdef __cplusplus
37extern "C" {
38#endif
39
51typedef void co_lss_rate_ind_t(
52 co_lss_t *lss, co_unsigned16_t rate, int delay, void *data);
53
67typedef int co_lss_store_ind_t(co_lss_t *lss, co_unsigned8_t id,
68 co_unsigned16_t rate, void *data);
69
80typedef void co_lss_cs_ind_t(co_lss_t *lss, co_unsigned8_t cs, void *data);
81
94typedef 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
109typedef void co_lss_lssid_ind_t(co_lss_t *lss, co_unsigned8_t cs,
110 co_unsigned32_t id, void *data);
111
121typedef void co_lss_nid_ind_t(co_lss_t *lss, co_unsigned8_t cs,
122 co_unsigned8_t id, void *data);
123
135typedef void co_lss_scan_ind_t(co_lss_t *lss, co_unsigned8_t cs,
136 const struct co_id *id, void *data);
137
138void *__co_lss_alloc(void);
139void __co_lss_free(void *ptr);
140struct __co_lss *__co_lss_init(struct __co_lss *lss, co_nmt_t *nmt);
141void __co_lss_fini(struct __co_lss *lss);
142
154
156void co_lss_destroy(co_lss_t *lss);
157
159co_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
187void 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
215void co_lss_set_store_ind(co_lss_t *lss, co_lss_store_ind_t *ind, void *data);
216
223int co_lss_get_timeout(const co_lss_t *lss);
224
234void co_lss_set_timeout(co_lss_t *lss, int timeout);
235
237int co_lss_is_master(const co_lss_t *lss);
238
242int co_lss_is_idle(const co_lss_t *lss);
243
248void co_lss_abort_req(co_lss_t *lss);
249
262int co_lss_switch_req(co_lss_t *lss, co_unsigned8_t mode);
263
278int co_lss_switch_sel_req(co_lss_t *lss, const struct co_id *id,
279 co_lss_cs_ind_t *ind, void *data);
280
296int co_lss_set_id_req(co_lss_t *lss, co_unsigned8_t id, co_lss_err_ind_t *ind,
297 void *data);
298
316int co_lss_set_rate_req(co_lss_t *lss, co_unsigned16_t rate,
317 co_lss_err_ind_t *ind, void *data);
318
331int co_lss_switch_rate_req(co_lss_t *lss, int delay);
332
348int 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
401int 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
435int co_lss_get_id_req(co_lss_t *lss, co_lss_nid_ind_t *ind, void *data);
436
454int 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
493int 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
516int 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_
This header file is part of the CANopen library; it contains the device description declarations.
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 'inquire identity ven...
Definition: lss.h:109
int co_lss_get_vendor_id_req(co_lss_t *lss, co_lss_lssid_ind_t *ind, void *data)
Requests the 'inquire identity vendor-ID' service.
Definition: lss.c:1017
void co_lss_destroy(co_lss_t *lss)
Destroys a CANopen LSS master/slave service.
Definition: lss.c:733
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 'store configuration' indication function, invoked when the pending node-ID...
Definition: lss.h:67
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 'configure node-ID',...
Definition: lss.h:94
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
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 'inquire node-ID' requ...
Definition: lss.h:121
int co_lss_set_id_req(co_lss_t *lss, co_unsigned8_t id, co_lss_err_ind_t *ind, void *data)
Requests the 'configure node-ID' service.
Definition: lss.c:893
void co_lss_set_timeout(co_lss_t *lss, int timeout)
Sets the timeout of an LSS master service.
Definition: lss.c:802
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 'Slowscan' or 'Fa...
Definition: lss.h:135
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 'LSS Slowscan' service.
Definition: lss.c:1194
int co_lss_switch_rate_req(co_lss_t *lss, int delay)
Requests the 'activate bit timing parameters' service.
Definition: lss.c:966
int co_lss_get_id_req(co_lss_t *lss, co_lss_nid_ind_t *ind, void *data)
Requests the 'inquire node-ID' service.
Definition: lss.c:1119
int co_lss_get_revision_req(co_lss_t *lss, co_lss_lssid_ind_t *ind, void *data)
Requests the 'inquire identity revision-number' service.
Definition: lss.c:1067
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 'store configuration' request is received.
Definition: lss.c:783
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 'switch state selective' service.
Definition: lss.c:869
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 'activate bit timing' request is received.
Definition: lss.c:751
int co_lss_switch_req(co_lss_t *lss, co_unsigned8_t mode)
Requests the 'switch state global' service.
Definition: lss.c:847
int co_lss_set_rate_req(co_lss_t *lss, co_unsigned16_t rate, co_lss_err_ind_t *ind, void *data)
Requests the 'configure bit timing parameters' service.
Definition: lss.c:925
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
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 'activate bit timing' request is received.
Definition: lss.c:762
int co_lss_get_timeout(const co_lss_t *lss)
Returns the timeout (in milliseconds) of an LSS master service.
Definition: lss.c:794
co_lss_t * co_lss_create(co_nmt_t *nmt)
Creates a new CANopen LSS master/slave service.
Definition: lss.c:706
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
int co_lss_get_product_code_req(co_lss_t *lss, co_lss_lssid_ind_t *ind, void *data)
Requests the 'inquire identity product-code' service.
Definition: lss.c:1042
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 'LSS identify remote slave' service.
Definition: lss.c:1144
int co_lss_store_req(co_lss_t *lss, co_lss_err_ind_t *ind, void *data)
Requests the 'store configuration' service.
Definition: lss.c:992
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 'switch state selectiv...
Definition: lss.h:80
void co_lss_rate_ind_t(co_lss_t *lss, co_unsigned16_t rate, int delay, void *data)
The type of a CANopen LSS 'activate bit timing' indication function, invoked when a baudrate switch i...
Definition: lss.h:51
int co_lss_id_non_cfg_slave_req(co_lss_t *lss, co_lss_cs_ind_t *ind, void *data)
Requests the 'LSS identify non-configured remote slave' service.
Definition: lss.c:1168
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 'LSS Fastscan' service.
Definition: lss.c:1228
int co_lss_get_serial_nr_req(co_lss_t *lss, co_lss_lssid_ind_t *ind, void *data)
Requests the 'inquire identity serial-number' service.
Definition: lss.c:1093
void co_lss_abort_req(co_lss_t *lss)
Aborts the current LSS master request.
Definition: lss.c:839
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 'store configuration' request is received.
Definition: lss.c:771
This header file is part of the CAN library; it contains the CAN network interface declarations.
A CANopen LSS master/slave service.
Definition: lss.c:43
co_nmt_t * nmt
A pointer to an NMT master/slave service.
Definition: lss.c:45
struct co_id mask
The mask used during the Fastscan service.
Definition: lss.c:74
struct co_id lo
The lower bound of the LSS address used during the Slowscan service.
Definition: lss.c:70
int timeout
The timeout (in milliseconds).
Definition: lss.c:60
struct co_id hi
The upper bound of the LSS address used during the Slowscan service.
Definition: lss.c:72
A CANopen NMT master/slave service.
Definition: nmt.c:104
An identity record.
Definition: dev.h:33