CANopenNode
CANopen protocol stack
Loading...
Searching...
No Matches
CO_LSS.h
Go to the documentation of this file.
1
22#ifndef CO_LSS_H
23#define CO_LSS_H
24
25#include "301/CO_driver.h"
26
27/* default configuration, see CO_config.h */
28#ifndef CO_CONFIG_LSS
29#define CO_CONFIG_LSS (CO_CONFIG_LSS_SLAVE | CO_CONFIG_GLOBAL_FLAG_CALLBACK_PRE)
30#endif
31
32#if (((CO_CONFIG_LSS) & (CO_CONFIG_LSS_SLAVE | CO_CONFIG_LSS_MASTER)) != 0) || defined CO_DOXYGEN
33
34#ifdef __cplusplus
35extern "C" {
36#endif
37
76#define CO_LSS_SWITCH_STATE_GLOBAL 0x04U
77#define CO_LSS_SWITCH_STATE_SEL_VENDOR 0x40U
78#define CO_LSS_SWITCH_STATE_SEL_PRODUCT 0x41U
79#define CO_LSS_SWITCH_STATE_SEL_REV 0x42U
80#define CO_LSS_SWITCH_STATE_SEL_SERIAL 0x43U
81#define CO_LSS_SWITCH_STATE_SEL 0x44U
82#define CO_LSS_CFG_NODE_ID 0x11U
83#define CO_LSS_CFG_BIT_TIMING 0x13U
84#define CO_LSS_CFG_ACTIVATE_BIT_TIMING 0x15U
85#define CO_LSS_CFG_STORE 0x17U
86#define CO_LSS_IDENT_SLAVE 0x4FU
87#define CO_LSS_IDENT_FASTSCAN 0x51U
88#define CO_LSS_INQUIRE_VENDOR 0x5AU
89#define CO_LSS_INQUIRE_PRODUCT 0x5BU
90#define CO_LSS_INQUIRE_REV 0x5CU
91#define CO_LSS_INQUIRE_SERIAL 0x5DU
92#define CO_LSS_INQUIRE_NODE_ID 0x5EU
100#define CO_LSS_CFG_NODE_ID_OK 0x00U
101#define CO_LSS_CFG_NODE_ID_OUT_OF_RANGE 0x01U
102#define CO_LSS_CFG_NODE_ID_MANUFACTURER 0xFFU
110#define CO_LSS_CFG_BIT_TIMING_OK 0x00U
111#define CO_LSS_CFG_BIT_TIMING_OUT_OF_RANGE 0x01U
112#define CO_LSS_CFG_BIT_TIMING_MANUFACTURER 0xFFU
120#define CO_LSS_CFG_STORE_OK 0x00U
121#define CO_LSS_CFG_STORE_NOT_SUPPORTED 0x01U
122#define CO_LSS_CFG_STORE_FAILED 0x02U
123#define CO_LSS_CFG_STORE_MANUFACTURER 0xFFU
131#define CO_LSS_FASTSCAN_BIT0 0x00U
132/* ... */
133#define CO_LSS_FASTSCAN_BIT31 0x1FU
134#define CO_LSS_FASTSCAN_CONFIRM 0x80U
141#define CO_LSS_FASTSCAN_VENDOR_ID 0x00U
142#define CO_LSS_FASTSCAN_PRODUCT 0x01U
143#define CO_LSS_FASTSCAN_REV 0x02U
144#define CO_LSS_FASTSCAN_SERIAL 0x03U
150typedef union {
151 uint32_t addr[4];
152
153 struct {
154 uint32_t vendorID;
155 uint32_t productCode;
156 uint32_t revisionNumber;
157 uint32_t serialNumber;
158 } identity;
160
171#define CO_LSS_STATE_WAITING 0x00U
172#define CO_LSS_STATE_CONFIGURATION 0x01U
180#define CO_LSS_BIT_TIMING_1000 0U
181#define CO_LSS_BIT_TIMING_800 1U
182#define CO_LSS_BIT_TIMING_500 2U
183#define CO_LSS_BIT_TIMING_250 3U
184#define CO_LSS_BIT_TIMING_125 4U
185 /* 5U - reserved */
186#define CO_LSS_BIT_TIMING_50 6U
187#define CO_LSS_BIT_TIMING_20 7U
188#define CO_LSS_BIT_TIMING_10 8U
189#define CO_LSS_BIT_TIMING_AUTO 9U
195static const uint16_t CO_LSS_bitTimingTableLookup[] = {1000, 800, 500, 250, 125, 0, 50, 20, 10, 0};
196
200#define CO_LSS_NODE_ID_ASSIGNMENT 0xFFU
201
205#define CO_LSS_NODE_ID_VALID(nid) (((nid >= 1U) && (nid <= 0x7FU)) || (nid == CO_LSS_NODE_ID_ASSIGNMENT))
206
210#define CO_LSS_ADDRESS_EQUAL(/* CO_LSS_address_t */ a1, /* CO_LSS_address_t */ a2) \
211 ((a1.identity.productCode == a2.identity.productCode) \
212 && (a1.identity.revisionNumber == a2.identity.revisionNumber) \
213 && (a1.identity.serialNumber == a2.identity.serialNumber) && (a1.identity.vendorID == a2.identity.vendorID))
214
215 /* @defgroup CO_LSS */
216
217#ifdef __cplusplus
218}
219#endif /* __cplusplus */
220
221#endif /* (CO_CONFIG_LSS) & (CO_CONFIG_LSS_SLAVE | CO_CONFIG_LSS_MASTER) */
222
223#endif /* CO_LSS_H */
Interface between CAN hardware and CANopenNode.
static const uint16_t CO_LSS_bitTimingTableLookup[]
Lookup table for conversion between bit timing table and numerical bit rate.
Definition CO_LSS.h:195
unsigned int uint16_t
UNSIGNED16 in CANopen (0006h), 16-bit unsigned integer.
Definition CO_driver.h:132
unsigned long int uint32_t
UNSIGNED32 in CANopen (0007h), 32-bit unsigned integer.
Definition CO_driver.h:133
The LSS address is a 128 bit number, uniquely identifying each node.
Definition CO_LSS.h:150