Lely core libraries 2.3.4
|
This header file is part of the CANopen library; it contains the gateway declarations (see CiA 309-1 version 2.0). More...
Go to the source code of this file.
Data Structures | |
struct | co_gw_srv |
The common parameters of a CANopen gateway service. More... | |
struct | co_gw_req |
The common parameters of a CANopen gateway request. More... | |
struct | co_gw_req_net |
The common parameters of a CANopen gateway network-level request. More... | |
struct | co_gw_req_node |
The common parameters of a CANopen gateway node-level request. More... | |
struct | co_gw_req_sdo_up |
The parameters of a CANopen gateway 'SDO upload' request. More... | |
struct | co_gw_req_sdo_dn |
The parameters of a CANopen gateway 'SDO download' request. More... | |
struct | co_gw_req_set_sdo_timeout |
The parameters of a CANopen gateway 'Configure SDO time-out' request. More... | |
struct | co_gw_req_set_rpdo |
The parameters of a CANopen gateway 'Configure RPDO' request. More... | |
struct | co_gw_req_set_tpdo |
The parameters of a CANopen gateway 'Configure TPDO' request. More... | |
struct | co_gw_req_pdo_read |
The parameters of a CANopen gateway 'Read PDO' request. More... | |
struct | co_gw_req_pdo_write |
The parameters of a CANopen gateway 'Write PDO' request. More... | |
struct | co_gw_req_nmt_set_ng |
The parameters of a CANopen gateway 'Enable node guarding' request. More... | |
struct | co_gw_req_nmt_set_hb |
The parameters of a CANopen gateway 'Start heartbeat consumer' request. More... | |
struct | co_gw_req_init |
The parameters of a CANopen gateway 'Initialize gateway' request. More... | |
struct | co_gw_req_set_hb |
The parameters of a CANopen gateway 'Set heartbeat producer' request. More... | |
struct | co_gw_req_set_emcy |
The parameters of a CANopen gateway 'Start/Stop emergency consumer' request. More... | |
struct | co_gw_req_set_cmd_timeout |
The parameters of a CANopen gateway 'Set command time-out' request. More... | |
struct | co_gw_req_set_bootup_ind |
The parameters of a CANopen gateway 'Boot-up forwarding' request. More... | |
struct | co_gw_req_set_cmd_size |
The parameters of a CANopen gateway 'Set command size' request. More... | |
struct | co_gw_req_lss_switch |
The parameters of a CANopen gateway 'LSS switch state global' request. More... | |
struct | co_gw_req_lss_switch_sel |
The parameters of a CANopen gateway 'LSS switch state selective' request. More... | |
struct | co_gw_req_lss_set_rate |
The parameters of a CANopen gateway 'LSS configure bit-rate' request. More... | |
struct | co_gw_req_lss_switch_rate |
The parameters of a CANopen gateway 'LSS activate new bit-rate' request. More... | |
struct | co_gw_req_lss_get_lssid |
The parameters of a CANopen gateway 'Inquire LSS address' request. More... | |
struct | co_gw_req_lss_id_slave |
The parameters of a CANopen gateway 'LSS identify remote slave' request. More... | |
struct | co_gw_req__lss_scan |
The parameters of a Lely-specific gateway 'LSS Slowscan/Fastscan' request. More... | |
struct | co_gw_con |
The common parameters of a CANopen gateway confirmation. More... | |
struct | co_gw_con_sdo_up |
The parameters of a CANopen gateway 'SDO upload' confirmation. More... | |
struct | co_gw_con_pdo_read |
The parameters of a CANopen gateway 'Read PDO' confirmation. More... | |
struct | co_gw_con_get_version |
The parameters of a CANopen gateway 'Get version' confirmation. More... | |
struct | co_gw_con_lss_get_lssid |
The parameters of a CANopen gateway 'Inquire LSS address' confirmation. More... | |
struct | co_gw_con_lss_get_id |
The parameters of a CANopen gateway 'LSS inquire node-ID' confirmation. More... | |
struct | co_gw_con__lss_scan |
The parameters of a Lely-specific gateway 'LSS Slowscan/Fastscan' confirmation. More... | |
struct | co_gw_ind_rpdo |
The parameters of a CANopen gateway 'RPDO received' indication. More... | |
struct | co_gw_ind_ec |
The parameters of a CANopen gateway 'Error control event received' indication. More... | |
struct | co_gw_ind_emcy |
The parameters of a CANopen gateway 'Emergency event received' indication. More... | |
struct | co_gw_ind_sdo |
The parameters of a CANopen gateway 'CiA 301 progress indication download' indication. More... | |
struct | co_gw_ind__sync |
The parameters of a Lely-specific gateway 'Synchronization event received' indication. More... | |
struct | co_gw_ind__time |
The parameters of a Lely-specific gateway 'Time stamp event received' indication. More... | |
struct | co_gw_ind__boot |
The parameters of a Lely-specific gateway 'Boot slave process completed' indication. More... | |
Macros | |
#define | CO_GW_NUM_NET 127 |
The maximum number of networks in a CANopen gateway. | |
#define | CO_GW_PROT_HI 2 |
The high number of the version of CiA 309-1 implemented by this gateway. | |
#define | CO_GW_PROT_LO 0 |
The low number of the version of CiA 309-1 implemented by this gateway. | |
#define | CO_GW_SRV_SDO_UP 0x11 |
CANopen gateway service: SDO upload. | |
#define | CO_GW_SRV_SDO_DN 0x13 |
CANopen gateway service: SDO download. | |
#define | CO_GW_SRV_SET_SDO_TIMEOUT 0x14 |
CANopen gateway service: Configure SDO time-out. | |
#define | CO_GW_SRV_SET_RPDO 0x21 |
CANopen gateway service: Configure RPDO. | |
#define | CO_GW_SRV_SET_TPDO 0x22 |
CANopen gateway service: Configure TPDO. | |
#define | CO_GW_SRV_PDO_READ 0x23 |
CANopen gateway service: Read PDO data. | |
#define | CO_GW_SRV_PDO_WRITE 0x24 |
CANopen gateway service: Write PDO data. | |
#define | CO_GW_SRV_RPDO 0x25 |
CANopen gateway service: RPDO received. | |
#define | CO_GW_SRV_NMT_START 0x31 |
CANopen gateway service: Start node. | |
#define | CO_GW_SRV_NMT_STOP 0x32 |
CANopen gateway service: Start node. | |
#define | CO_GW_SRV_NMT_ENTER_PREOP 0x33 |
CANopen gateway service: Set node to pre-operational. | |
#define | CO_GW_SRV_NMT_RESET_NODE 0x34 |
CANopen gateway service: Reset node. | |
#define | CO_GW_SRV_NMT_RESET_COMM 0x35 |
CANopen gateway service: Reset communication. | |
#define | CO_GW_SRV_NMT_NG_ENABLE 0x36 |
CANopen gateway service: Enable node guarding. | |
#define | CO_GW_SRV_NMT_NG_DISABLE 0x37 |
CANopen gateway service: Disable node guarding. | |
#define | CO_GW_SRV_NMT_HB_ENABLE 0x38 |
CANopen gateway service: Start heartbeat consumer. | |
#define | CO_GW_SRV_NMT_HB_DISABLE 0x39 |
CANopen gateway service: Disable heartbeat consumer. | |
#define | CO_GW_SRV_EC 0x3a |
CANopen gateway service: Error control event received. | |
#define | CO_GW_SRV_EMCY 0x42 |
CANopen gateway service: Emergency event received. | |
#define | CO_GW_SRV_INIT 0x51 |
CANopen gateway service: Initialize gateway. | |
#define | CO_GW_SRV_SET_HB 0x54 |
CANopen gateway service: Set heartbeat producer. | |
#define | CO_GW_SRV_SET_ID 0x55 |
CANopen gateway service: Set node-ID. | |
#define | CO_GW_SRV_EMCY_START 0x56 |
CANopen gateway service: Start emergency consumer. | |
#define | CO_GW_SRV_EMCY_STOP 0x57 |
CANopen gateway service: Stop emergency consumer. | |
#define | CO_GW_SRV_SET_CMD_TIMEOUT 0x58 |
CANopen gateway service: Set command time-out. | |
#define | CO_GW_SRV_SET_BOOTUP_IND 0x59 |
CANopen gateway service: Boot-up forwarding. | |
#define | CO_GW_SRV_SET_NET 0x61 |
CANopen gateway service: Set default network. | |
#define | CO_GW_SRV_SET_NODE 0x62 |
CANopen gateway service: Set default node-ID. | |
#define | CO_GW_SRV_GET_VERSION 0x63 |
CANopen gateway service: Get version. | |
#define | CO_GW_SRV_SET_CMD_SIZE 0x64 |
CANopen gateway service: Set command size. | |
#define | CO_GW_SRV_LSS_SWITCH 0x81 |
CANopen gateway service: LSS switch state global. | |
#define | CO_GW_SRV_LSS_SWITCH_SEL 0x82 |
CANopen gateway service: LSS switch state selective. | |
#define | CO_GW_SRV_LSS_SET_ID 0x83 |
CANopen gateway service: LSS configure node-ID. | |
#define | CO_GW_SRV_LSS_SET_RATE 0x84 |
CANopen gateway service: LSS configure bit-rate. | |
#define | CO_GW_SRV_LSS_SWITCH_RATE 0x85 |
CANopen gateway service: LSS activate new bit-rate. | |
#define | CO_GW_SRV_LSS_STORE 0x86 |
CANopen gateway service: LSS store configuration. | |
#define | CO_GW_SRV_LSS_GET_LSSID 0x87 |
CANopen gateway service: Inquire LSS address. | |
#define | CO_GW_SRV_LSS_GET_ID 0x88 |
CANopen gateway service: LSS inquire node-ID. | |
#define | CO_GW_SRV_LSS_ID_SLAVE 0x89 |
CANopen gateway service: LSS identify remote slave. | |
#define | CO_GW_SRV_LSS_ID_NON_CFG_SLAVE 0x8a |
CANopen gateway service: LSS identify non-configured remote slaves. | |
#define | CO_GW_SRV_SDO 0x93 |
CANopen gateway service: CiA 301 progress indication download. | |
#define | CO_GW_SRV__LSS_SLOWSCAN 0x101 |
Lely-specific gateway service: LSS Slowscan. | |
#define | CO_GW_SRV__LSS_FASTSCAN 0x102 |
Lely-specific gateway service: LSS Fastscan. | |
#define | CO_GW_SRV__SYNC 0x103 |
Lely-specific gateway service: Synchronization event received. | |
#define | CO_GW_SRV__TIME 0x104 |
Lely-specific gateway service: Time stamp event received. | |
#define | CO_GW_SRV__BOOT 0x105 |
Lely-specific gateway service: Boot slave process completed. | |
#define | CO_GW_IEC_BAD_SRV 100 |
CANopen gateway internal error: Request not supported. | |
#define | CO_GW_IEC_SYNTAX 101 |
CANopen gateway internal error: Syntax error. | |
#define | CO_GW_IEC_INTERN 102 |
CANopen gateway internal error: Request not processed due to internal state. | |
#define | CO_GW_IEC_TIMEOUT 103 |
CANopen gateway internal error: Time-out. | |
#define | CO_GW_IEC_NO_DEF_NET 104 |
CANopen gateway internal error: No default net set. | |
#define | CO_GW_IEC_NO_DEF_NODE 105 |
CANopen gateway internal error: No default node set. | |
#define | CO_GW_IEC_BAD_NET 106 |
CANopen gateway internal error: Unsupported net. | |
#define | CO_GW_IEC_BAD_NODE 107 |
CANopen gateway internal error: Unsupported node. | |
#define | CO_GW_IEC_NG_OCCURRED 200 |
CANopen gateway internal error: Lost guarding message. | |
#define | CO_GW_IEC_LG_OCCURRED 201 |
CANopen gateway internal error: Lost connection. | |
#define | CO_GW_IEC_HB_RESOLVED 202 |
CANopen gateway internal error: Heartbeat started. | |
#define | CO_GW_IEC_HB_OCCURRED 203 |
CANopen gateway internal error: Heartbeat lost. | |
#define | CO_GW_IEC_ST_OCCURRED 204 |
CANopen gateway internal error: Wrong NMT state. | |
#define | CO_GW_IEC_BOOTUP 205 |
CANopen gateway internal error: Boot-up. | |
#define | CO_GW_IEC_CAN_PASSIVE 300 |
CANopen gateway internal error: Error passive. | |
#define | CO_GW_IEC_CAN_BUSOFF 301 |
CANopen gateway internal error: Bus off. | |
#define | CO_GW_IEC_CAN_OVERFLOW 303 |
CANopen gateway internal error: CAN buffer overflow. | |
#define | CO_GW_IEC_CAN_INIT 304 |
CANopen gateway internal error: CAN init. | |
#define | CO_GW_IEC_CAN_ACTIVE 305 |
CANopen gateway internal error: CAN active. | |
#define | CO_GW_IEC_PDO_INUSE 400 |
CANopen gateway internal error: PDO already used. | |
#define | CO_GW_IEC_PDO_LEN 401 |
CANopen gateway internal error: PDO length exceeded. | |
#define | CO_GW_IEC_LSS 501 |
CANopen gateway internal error: LSS error. | |
#define | CO_GW_IEC_LSS_ID 502 |
CANopen gateway internal error: LSS node-ID not supported. | |
#define | CO_GW_IEC_LSS_RATE 503 |
CANopen gateway internal error: LSS bit-rate not supported. | |
#define | CO_GW_IEC_LSS_PARAM 504 |
CANopen gateway internal error: LSS parameter storing failed. | |
#define | CO_GW_IEC_LSS_MEDIA 505 |
CANopen gateway internal error: LSS command failed because of media error. | |
#define | CO_GW_IEC_NO_MEM 600 |
CANopen gateway internal error: Running out of memory. | |
#define | CO_GW_REQ_SDO_DN_SIZE offsetof(struct co_gw_req_sdo_dn, val) |
The minimum size (in bytes) of a CANopen gateway 'SDO download' request. | |
#define | CO_GW_REQ_SET_RPDO_SIZE offsetof(struct co_gw_req_set_rpdo, map) |
The minimum size (in bytes) of a CANopen gateway 'Configure RPDO' request. | |
#define | CO_GW_REQ_SET_TPDO_SIZE offsetof(struct co_gw_req_set_tpdo, map) |
The minimum size (in bytes) of a CANopen gateway 'Configure TPDO' request. | |
#define | CO_GW_REQ_PDO_WRITE_SIZE offsetof(struct co_gw_req_pdo_write, val) |
The minimum size (in bytes) of a CANopen gateway 'Write PDO' request. | |
#define | CO_GW_CON_SDO_UP_SIZE offsetof(struct co_gw_con_sdo_up, val) |
The minimum size (in bytes) of a CANopen gateway 'SDO upload' confirmation. | |
#define | CO_GW_CON_PDO_READ_SIZE offsetof(struct co_gw_con_pdo_read, val) |
The minimum size (in bytes) of a CANopen gateway 'Read PDO' confirmation. | |
#define | CO_GW_IND_RPDO_SIZE offsetof(struct co_gw_ind_rpdo, val) |
The minimum size (in bytes) of a CANopen gateway 'RPDO received' indication. | |
Typedefs | |
typedef struct __co_gw | co_gw_t |
An opaque CANopen gateway type. | |
typedef int | co_gw_send_func_t(const struct co_gw_srv *srv, void *data) |
The type of a CANopen gateway send callback function, invoked by a gateway when an indication or confirmation needs to be sent. | |
typedef void | co_gw_rate_func_t(co_unsigned16_t net, co_unsigned16_t rate, void *data) |
The type of a CANopen gateway 'set bit timing' function, invoked when a baudrate switch is needed after an 'Initialize gateway' command is received. | |
Functions | |
const char * | co_gw_iec2str (int iec) |
Returns a string describing an internal error code. | |
co_gw_t * | co_gw_create (void) |
Creates a new CANopen gateway. | |
void | co_gw_destroy (co_gw_t *gw) |
Destroys a CANopen gateway. | |
int | co_gw_init_net (co_gw_t *gw, co_unsigned16_t id, co_nmt_t *nmt) |
Registers a CANopen network with a gateway. | |
int | co_gw_fini_net (co_gw_t *gw, co_unsigned16_t id) |
Unregisters a CANopen network with a gateway. | |
int | co_gw_recv (co_gw_t *gw, const struct co_gw_req *req) |
Receives and processes a request with a CANopen gateway. | |
void | co_gw_get_send_func (const co_gw_t *gw, co_gw_send_func_t **pfunc, void **pdata) |
Retrieves the callback function used to send indications and confirmations from a CANopen gateway. | |
void | co_gw_set_send_func (co_gw_t *gw, co_gw_send_func_t *func, void *data) |
Sets the callback function used to send indications and confirmations from a CANopen gateway. | |
void | co_gw_get_rate_func (const co_gw_t *gw, co_gw_rate_func_t **pfunc, void **pdata) |
Retrieves the callback function invoked when a baudrate switch is needed after an 'Initialize gateway' command is received. | |
void | co_gw_set_rate_func (co_gw_t *gw, co_gw_rate_func_t *func, void *data) |
Sets the callback function invoked when a baudrate switch is needed after an 'Initialize gateway' command is received. | |
This header file is part of the CANopen library; it contains the gateway declarations (see CiA 309-1 version 2.0).
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 gw.h.
typedef int co_gw_send_func_t(const struct co_gw_srv *srv, void *data) |
The type of a CANopen gateway send callback function, invoked by a gateway when an indication or confirmation needs to be sent.
srv | a pointer to the service parameters to be sent. |
data | a pointer to user-specified data. |
set_errnum()
. typedef void co_gw_rate_func_t(co_unsigned16_t net, co_unsigned16_t rate, void *data) |
The type of a CANopen gateway 'set bit timing' function, invoked when a baudrate switch is needed after an 'Initialize gateway' command is received.
net | the network-ID (in the range [1..127]). |
rate | the baudrate (in kbit/s), or 0 for automatic bit rate detection. |
data | a pointer to user-specified data. |
co_gw_t * co_gw_create | ( | void | ) |
void co_gw_destroy | ( | co_gw_t * | gw | ) |
Registers a CANopen network with a gateway.
gw | a pointer to a CANopen gateway. |
id | the network-ID (in the range [1..127]). If id is 0, the network-ID is obtained from the CANopen device of the NMT service. |
nmt | a pointer to the NMT service of the gateway node in the network. |
int co_gw_fini_net | ( | co_gw_t * | gw, |
co_unsigned16_t | id | ||
) |
Unregisters a CANopen network with a gateway.
gw | a pointer to a CANopen gateway. |
id | the network-ID (in the range [1..127]). |
Receives and processes a request with a CANopen gateway.
gw | a pointer to a CANopen gateway. |
req | a pointer to the parameters of the request. |
void co_gw_get_send_func | ( | const co_gw_t * | gw, |
co_gw_send_func_t ** | pfunc, | ||
void ** | pdata | ||
) |
Retrieves the callback function used to send indications and confirmations from a CANopen gateway.
gw | a pointer to a CANopen gateway. |
pfunc | the address at which to store a pointer to the callback function (can be NULL). |
pdata | the address at which to store a pointer to user-specified data (can be NULL). |
void co_gw_set_send_func | ( | co_gw_t * | gw, |
co_gw_send_func_t * | func, | ||
void * | data | ||
) |
Sets the callback function used to send indications and confirmations from a CANopen gateway.
gw | a pointer to a CANopen gateway. |
func | a pointer to the function to be invoked when an indication or confirmation needs to be sent. |
data | a pointer to user-specified data (can be NULL). data is passed as the last parameter to func. |
void co_gw_get_rate_func | ( | const co_gw_t * | gw, |
co_gw_rate_func_t ** | pfunc, | ||
void ** | pdata | ||
) |
Retrieves the callback function invoked when a baudrate switch is needed after an 'Initialize gateway' command is received.
gw | a pointer to a CANopen gateway. |
pfunc | the address at which to store a pointer to the callback function (can be NULL). |
pdata | the address at which to store a pointer to user-specified data (can be NULL). |
void co_gw_set_rate_func | ( | co_gw_t * | gw, |
co_gw_rate_func_t * | func, | ||
void * | data | ||
) |
Sets the callback function invoked when a baudrate switch is needed after an 'Initialize gateway' command is received.
gw | a pointer to a CANopen gateway. |
func | a pointer to the function to be invoked when an indication or confirmation needs to be sent. |
data | a pointer to user-specified data (can be NULL). data is passed as the last parameter to func. |