Lely core libraries 2.3.4
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
30#define LELY_CO_LSS_INHIBIT 10
31#endif
32
33#ifndef LELY_CO_LSS_TIMEOUT
35#define LELY_CO_LSS_TIMEOUT 100
36#endif
37
39#define CO_LSS_CANID(master) (0x7e4 + !!(master))
40
41#ifdef __cplusplus
42extern "C" {
43#endif
44
56typedef void co_lss_rate_ind_t(
57 co_lss_t *lss, co_unsigned16_t rate, int delay, void *data);
58
72typedef int co_lss_store_ind_t(co_lss_t *lss, co_unsigned8_t id,
73 co_unsigned16_t rate, void *data);
74
85typedef void co_lss_cs_ind_t(co_lss_t *lss, co_unsigned8_t cs, void *data);
86
99typedef 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
114typedef void co_lss_lssid_ind_t(co_lss_t *lss, co_unsigned8_t cs,
115 co_unsigned32_t id, void *data);
116
126typedef void co_lss_nid_ind_t(co_lss_t *lss, co_unsigned8_t cs,
127 co_unsigned8_t id, void *data);
128
140typedef void co_lss_scan_ind_t(co_lss_t *lss, co_unsigned8_t cs,
141 const struct co_id *id, void *data);
142
143void *__co_lss_alloc(void);
144void __co_lss_free(void *ptr);
145struct __co_lss *__co_lss_init(struct __co_lss *lss, co_nmt_t *nmt);
146void __co_lss_fini(struct __co_lss *lss);
147
160
162void co_lss_destroy(co_lss_t *lss);
163
174int co_lss_start(co_lss_t *lss);
175
183void co_lss_stop(co_lss_t *lss);
184
190int co_lss_is_stopped(const co_lss_t *lss);
191
193co_nmt_t *co_lss_get_nmt(const co_lss_t *lss);
194
208 const co_lss_t *lss, co_lss_rate_ind_t **pind, void **pdata);
209
221void co_lss_set_rate_ind(co_lss_t *lss, co_lss_rate_ind_t *ind, void *data);
222
236 const co_lss_t *lss, co_lss_store_ind_t **pind, void **pdata);
237
249void co_lss_set_store_ind(co_lss_t *lss, co_lss_store_ind_t *ind, void *data);
250
257co_unsigned16_t co_lss_get_inhibit(const co_lss_t *lss);
258
269void co_lss_set_inhibit(co_lss_t *lss, co_unsigned16_t inhibit);
270
277int co_lss_get_timeout(const co_lss_t *lss);
278
288void co_lss_set_timeout(co_lss_t *lss, int timeout);
289
291int co_lss_is_master(const co_lss_t *lss);
292
296int co_lss_is_idle(const co_lss_t *lss);
297
302void co_lss_abort_req(co_lss_t *lss);
303
316int co_lss_switch_req(co_lss_t *lss, co_unsigned8_t mode);
317
332int co_lss_switch_sel_req(co_lss_t *lss, const struct co_id *id,
333 co_lss_cs_ind_t *ind, void *data);
334
350int co_lss_set_id_req(co_lss_t *lss, co_unsigned8_t id, co_lss_err_ind_t *ind,
351 void *data);
352
370int co_lss_set_rate_req(co_lss_t *lss, co_unsigned16_t rate,
371 co_lss_err_ind_t *ind, void *data);
372
385int co_lss_switch_rate_req(co_lss_t *lss, int delay);
386
402int co_lss_store_req(co_lss_t *lss, co_lss_err_ind_t *ind, void *data);
403
420 co_lss_t *lss, co_lss_lssid_ind_t *ind, void *data);
421
438 co_lss_t *lss, co_lss_lssid_ind_t *ind, void *data);
439
455int co_lss_get_revision_req(co_lss_t *lss, co_lss_lssid_ind_t *ind, void *data);
456
473 co_lss_t *lss, co_lss_lssid_ind_t *ind, void *data);
474
489int co_lss_get_id_req(co_lss_t *lss, co_lss_nid_ind_t *ind, void *data);
490
508int co_lss_id_slave_req(co_lss_t *lss, const struct co_id *lo,
509 const struct co_id *hi, co_lss_cs_ind_t *ind, void *data);
510
526 co_lss_t *lss, co_lss_cs_ind_t *ind, void *data);
527
547int co_lss_slowscan_req(co_lss_t *lss, const struct co_id *lo,
548 const struct co_id *hi, co_lss_scan_ind_t *ind, void *data);
549
571int co_lss_fastscan_req(co_lss_t *lss, const struct co_id *id,
572 const struct co_id *mask, co_lss_scan_ind_t *ind, void *data);
573
574#ifdef __cplusplus
575}
576#endif
577
578#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:114
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:1142
void co_lss_destroy(co_lss_t *lss)
Destroys a CANopen LSS master/slave service.
Definition: lss.c:810
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:72
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:99
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:945
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:126
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:1021
void co_lss_set_timeout(co_lss_t *lss, int timeout)
Sets the timeout of an LSS master service.
Definition: lss.c:932
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:908
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:140
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:1329
int co_lss_switch_rate_req(co_lss_t *lss, int delay)
Requests the 'activate bit timing parameters' service.
Definition: lss.c:1094
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:1244
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:1192
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:897
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:999
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:865
int co_lss_switch_req(co_lss_t *lss, co_unsigned8_t mode)
Requests the 'switch state global' service.
Definition: lss.c:977
void co_lss_stop(co_lss_t *lss)
Stops an LSS service.
Definition: lss.c:833
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:1053
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:961
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:876
int co_lss_get_timeout(const co_lss_t *lss)
Returns the timeout (in milliseconds) of an LSS master service.
Definition: lss.c:924
co_lss_t * co_lss_create(co_nmt_t *nmt)
Creates a new CANopen LSS master/slave service.
Definition: lss.c:783
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:857
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:1167
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:1269
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:1117
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:85
int co_lss_start(co_lss_t *lss)
Starts an LSS service.
Definition: lss.c:820
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:56
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:1303
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:1365
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:1218
void co_lss_abort_req(co_lss_t *lss)
Aborts the current LSS master request.
Definition: lss.c:969
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:885
int co_lss_is_stopped(const co_lss_t *lss)
Retuns 1 if the specified LSS service is stopped, and 0 if not.
Definition: lss.c:849
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:916
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:44
co_unsigned16_t inhibit
The inhibit time (in multiples of 100 microseconds).
Definition: lss.c:57
co_nmt_t * nmt
A pointer to an NMT master/slave service.
Definition: lss.c:46
struct co_id mask
The mask used during the Fastscan service.
Definition: lss.c:79
struct co_id lo
The lower bound of the LSS address used during the Slowscan service.
Definition: lss.c:75
int timeout
The timeout (in milliseconds).
Definition: lss.c:65
struct co_id hi
The upper bound of the LSS address used during the Slowscan service.
Definition: lss.c:77
A CANopen NMT master/slave service.
Definition: nmt.c:148
An identity record.
Definition: dev.h:33