Lely core libraries 2.3.4
|
This header file is part of the CANopen library; it contains the Layer Setting Services (LSS) and protocols declarations. More...
Go to the source code of this file.
Typedefs | |
typedef 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 is requested. | |
typedef 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 and baudrate should be copied to the persistent node-ID and baudrate. | |
typedef 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 selective','LSS identify remote slave' or 'LSS identify non-configured remote slave' request completes. | |
typedef 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', 'configure bit timing parameters' or 'store configuration' request completes. | |
typedef 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 vendor-ID', 'inquire identity product-code', 'inquire identity revision-number' or 'inquire identity serial-number' request completes. | |
typedef 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' request completes. | |
typedef 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 'Fastscan' request completes. | |
Functions | |
co_lss_t * | co_lss_create (co_nmt_t *nmt) |
Creates a new CANopen LSS master/slave service. | |
void | co_lss_destroy (co_lss_t *lss) |
Destroys a CANopen LSS master/slave service. | |
int | co_lss_start (co_lss_t *lss) |
Starts an LSS service. | |
void | co_lss_stop (co_lss_t *lss) |
Stops an LSS service. | |
int | co_lss_is_stopped (const co_lss_t *lss) |
Retuns 1 if the specified LSS service is stopped, and 0 if not. | |
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. | |
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. | |
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. | |
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. | |
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. | |
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. | |
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. | |
int | co_lss_get_timeout (const co_lss_t *lss) |
Returns the timeout (in milliseconds) of an LSS master service. | |
void | co_lss_set_timeout (co_lss_t *lss, int timeout) |
Sets the timeout of an LSS master service. | |
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. | |
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. | |
void | co_lss_abort_req (co_lss_t *lss) |
Aborts the current LSS master request. | |
int | co_lss_switch_req (co_lss_t *lss, co_unsigned8_t mode) |
Requests the 'switch state global' service. | |
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. | |
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. | |
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. | |
int | co_lss_switch_rate_req (co_lss_t *lss, int delay) |
Requests the 'activate bit timing parameters' service. | |
int | co_lss_store_req (co_lss_t *lss, co_lss_err_ind_t *ind, void *data) |
Requests the 'store configuration' service. | |
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. | |
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. | |
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. | |
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. | |
int | co_lss_get_id_req (co_lss_t *lss, co_lss_nid_ind_t *ind, void *data) |
Requests the 'inquire node-ID' service. | |
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. | |
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. | |
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. | |
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. | |
This header file is part of the CANopen library; it contains the Layer Setting Services (LSS) and protocols declarations.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Definition in file lss.h.
typedef 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 is requested.
lss | a pointer to an LSS slave service. |
rate | the new baudrate (in kbit/s), or 0 for automatic bit rate detection. |
delay | the delay (in milliseconds) before the switch and the delay after the switch during which CAN frames MUST NOT be sent. |
data | a pointer to user-specified data. |
typedef 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 and baudrate should be copied to the persistent node-ID and baudrate.
lss | a pointer to an LSS slave service. |
id | the node-ID. |
rate | the new baudrate (in kbit/s), or 0 for automatic bit rate detection. |
data | a pointer to user-specified data. |
typedef 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 selective','LSS identify remote slave' or 'LSS identify non-configured remote slave' request completes.
lss | a pointer to an LSS master service. |
cs | the received command specifier (one of 0x44, 0x4f or 0x50), or 0 on timeout. |
data | a pointer to user-specified data. |
typedef 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', 'configure bit timing parameters' or 'store configuration' request completes.
lss | a pointer to an LSS master service. |
cs | the received command specifier (one of 0x11, 0x13 or 0x17), or 0 on timeout. |
err | the error code (0 on success). |
spec | the implementation-specific error code (if err is 0xff). |
data | a pointer to user-specified data. |
typedef 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 vendor-ID', 'inquire identity product-code', 'inquire identity revision-number' or 'inquire identity serial-number' request completes.
lss | a pointer to an LSS master service. |
cs | the received command specifier (one of 0x5a, 0x5b, 0x5c or 0x5d), or 0 on timeout. |
id | the received LSS number. |
data | a pointer to user-specified data. |
typedef 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' request completes.
lss | a pointer to an LSS master service. |
cs | the received command specifier (0x5e), or 0 on timeout. |
id | the received node-ID. |
data | a pointer to user-specified data. |
typedef 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 'Fastscan' request completes.
lss | a pointer to an LSS master service. |
cs | the received command specifier (0x44 or 0x4f), or 0 if no slave was found. |
id | a pointer to the received LSS address, or NULL if no slave was found. |
data | a pointer to user-specified data. |
Creates a new CANopen LSS master/slave service.
The service is started as if by co_lss_start().
nmt | a pointer to an NMT master/slave service. |
void co_lss_destroy | ( | co_lss_t * | lss | ) |
Destroys a CANopen LSS master/slave service.
int co_lss_start | ( | co_lss_t * | lss | ) |
Starts an LSS service.
void co_lss_stop | ( | co_lss_t * | lss | ) |
int co_lss_is_stopped | ( | const co_lss_t * | lss | ) |
Retuns 1 if the specified LSS service is stopped, and 0 if not.
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.
lss | a pointer to an LSS slave service. |
pind | the address at which to store a pointer to the indication function (can be NULL). |
pdata | the address at which to store a pointer to user-specified data (can be NULL). |
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.
lss | a pointer to an LSS slave service. |
ind | a pointer to the function to be invoked. |
data | a pointer to user-specified data (can be NULL). data is passed as the last parameter to ind. |
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.
lss | a pointer to an LSS slave service. |
pind | the address at which to store a pointer to the indication function (can be NULL). |
pdata | the address at which to store a pointer to user-specified data (can be NULL). |
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.
lss | a pointer to an LSS slave service. |
ind | a pointer to the function to be invoked. |
data | a pointer to user-specified data (can be NULL). data is passed as the last parameter to ind. |
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.
A return value of 0 means the inhibit time is disabled.
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.
lss | a pointer to an LSS master service. |
inhibit | the inhibit time (in multiples of 100 microseconds. A value of 0 disables the inhibit time. |
int co_lss_get_timeout | ( | const co_lss_t * | lss | ) |
Returns the timeout (in milliseconds) of an LSS master service.
A return value of 0 means no timeout is being used.
void co_lss_set_timeout | ( | co_lss_t * | lss, |
int | timeout | ||
) |
Sets the timeout of an LSS master service.
lss | a pointer to an LSS master service. |
timeout | the timeout (in milliseconds). A value of 0 disables the timeout. |
void co_lss_abort_req | ( | co_lss_t * | lss | ) |
Aborts the current LSS master request.
This function has no effect if the LSS service is idle (see co_lss_is_idle()).
int co_lss_switch_req | ( | co_lss_t * | lss, |
co_unsigned8_t | mode | ||
) |
Requests the 'switch state global' service.
See section 6.3.2 in CiA 305 version 3.0.0.
lss | a pointer to an LSS master service. |
mode | 0 to switch to all slaves the LSS waiting state, 1 to switch all slaves to the LSS configuration state. |
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.
See section 6.3.3 in CiA 305 version 3.0.0.
lss | a pointer to an LSS master service. |
id | a pointer to the LSS address of the slave to be configured. |
ind | a pointer to the indication function (can be NULL). |
data | a pointer to user-specified data (can be NULL). data is passed as the last parameter to ind. |
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.
It is the responsibility of the LSS master to ensure that a single LSS slave is in the LSS configuration state.
See section 6.4.2 in CiA 305 version 3.0.0.
lss | a pointer to an LSS master service. |
id | the pending node-ID to be configured. |
ind | a pointer to the indication function (can be NULL). |
data | a pointer to user-specified data (can be NULL). data is passed as the last parameter to ind. |
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.
It is the responsibility of the LSS master to ensure that a single LSS slave is in the LSS configuration state.
See section 6.4.3 in CiA 305 version 3.0.0.
lss | a pointer to an LSS master service. |
rate | the pending baudrate (in kbit/s), or 0 for automatic bit rate detection. |
ind | a pointer to the indication function (can be NULL). |
data | a pointer to user-specified data (can be NULL). data is passed as the last parameter to ind. |
int co_lss_switch_rate_req | ( | co_lss_t * | lss, |
int | delay | ||
) |
Requests the 'activate bit timing parameters' service.
See section 6.4.4 in CiA 305 version 3.0.0.
lss | a pointer to an LSS master service. |
delay | the delay (in milliseconds) before the switch and the delay after the switch during which CAN frames MUST NOT be sent. |
int co_lss_store_req | ( | co_lss_t * | lss, |
co_lss_err_ind_t * | ind, | ||
void * | data | ||
) |
Requests the 'store configuration' service.
It is the responsibility of the LSS master to ensure that a single LSS slave is in the LSS configuration state.
See section 6.4.5 in CiA 305 version 3.0.0.
lss | a pointer to an LSS master service. |
ind | a pointer to the indication function (can be NULL). |
data | a pointer to user-specified data (can be NULL). data is passed as the last parameter to ind. |
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.
It is the responsibility of the LSS master to ensure that a single LSS slave is in the LSS configuration state.
See section 6.5.2 in CiA 305 version 3.0.0.
lss | a pointer to an LSS master service. |
ind | a pointer to the indication function (can be NULL). |
data | a pointer to user-specified data (can be NULL). data is passed as the last parameter to ind. |
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.
It is the responsibility of the LSS master to ensure that a single LSS slave is in the LSS configuration state.
See section 6.5.2 in CiA 305 version 3.0.0.
lss | a pointer to an LSS master service. |
ind | a pointer to the indication function (can be NULL). |
data | a pointer to user-specified data (can be NULL). data is passed as the last parameter to ind. |
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.
It is the responsibility of the LSS master to ensure that a single LSS slave is in the LSS configuration state.
See section 6.5.2 in CiA 305 version 3.0.0.
lss | a pointer to an LSS master service. |
ind | a pointer to the indication function (can be NULL). |
data | a pointer to user-specified data (can be NULL). data is passed as the last parameter to ind. |
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.
It is the responsibility of the LSS master to ensure that a single LSS slave is in the LSS configuration state.
See section 6.5.2 in CiA 305 version 3.0.0.
lss | a pointer to an LSS master service. |
ind | a pointer to the indication function (can be NULL). |
data | a pointer to user-specified data (can be NULL). data is passed as the last parameter to ind. |
int co_lss_get_id_req | ( | co_lss_t * | lss, |
co_lss_nid_ind_t * | ind, | ||
void * | data | ||
) |
Requests the 'inquire node-ID' service.
It is the responsibility of the LSS master to ensure that a single LSS slave is in the LSS configuration state.
See section 6.5.3 in CiA 305 version 3.0.0.
lss | a pointer to an LSS master service. |
ind | a pointer to the indication function (can be NULL). |
data | a pointer to user-specified data (can be NULL). data is passed as the last parameter to ind. |
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.
The specified indication function is invoked as soon as the first slave responds.
See section 6.6.2 in CiA 305 version 3.0.0.
lss | a pointer to an LSS master service. |
lo | a pointer to the lower bound of the LSS address. |
hi | a pointer to the upper bound of the LSS address. The vendor-ID and product-code MUST be the same as in *lo. |
ind | a pointer to the indication function (can be NULL). |
data | a pointer to user-specified data (can be NULL). data is passed as the last parameter to ind. |
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.
The specified indication function is invoked as soon as the first slave responds.
See section 6.6.4 in CiA 305 version 3.0.0.
lss | a pointer to an LSS master service. |
ind | a pointer to the indication function (can be NULL). |
data | a pointer to user-specified data (can be NULL). data is passed as the last parameter to ind. |
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.
This service performs a binary search using the 'LSS identify remote slave' service to obtain a single LSS address, followed by the 'switch state selective' service. If the request completes with success, the identified slave is in the LSS configuration state.
See section 8.4.2 in CiA 305 version 3.0.0.
lss | a pointer to an LSS master service. |
lo | a pointer to the lower bound of the LSS address. |
hi | a pointer to the upper bound of the LSS address. The vendor-ID and product-code MUST be the same as in *lo. |
ind | a pointer to the indication function (can be NULL). |
data | a pointer to user-specified data (can be NULL). data is passed as the last parameter to ind. |
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.
If the request completes with success, the identified slave is in the LSS configuration state.
See section 6.7 in CiA 305 version 3.0.0.
lss | a pointer to an LSS master service. |
id | a pointer a struct containing the bits of the LSS address that are already known and can be skipped during scanning (can be NULL). |
mask | a pointer to a struct containing the mask specifying which bits in *id are already known (can be NULL). If a bit in *mask is 1, the corresponding bit in *id is not checked. |
ind | a pointer to the indication function (can be NULL). |
data | a pointer to user-specified data (can be NULL). data is passed as the last parameter to ind. |