CANopenNode
CO_LSS.h
Go to the documentation of this file.
1 
27 #ifndef CO_LSS_H
28 #define CO_LSS_H
29 
30 #include "301/CO_driver.h"
31 
32 /* default configuration, see CO_config.h */
33 #ifndef CO_CONFIG_LSS
34 #define CO_CONFIG_LSS (CO_CONFIG_LSS_SLAVE)
35 #endif
36 
37 #if ((CO_CONFIG_LSS) & (CO_CONFIG_LSS_SLAVE | CO_CONFIG_LSS_MASTER)) || defined CO_DOXYGEN
38 
39 #ifdef __cplusplus
40 extern "C" {
41 #endif
42 
86 typedef enum {
96  CO_LSS_CFG_STORE = 0x17U,
104 } CO_LSS_cs_t;
105 
109 typedef enum {
114 
118 typedef enum {
123 
127 typedef enum {
133 
137 typedef enum {
139  /* ... */
143 
144 #define CO_LSS_FASTSCAN_BITCHECK_VALID(bit) ((bit>=CO_LSS_FASTSCAN_BIT0 && bit<=CO_LSS_FASTSCAN_BIT31) || bit==CO_LSS_FASTSCAN_CONFIRM)
145 
149 typedef enum {
155 
156 #define CO_LSS_FASTSCAN_LSS_SUB_NEXT_VALID(index) (index>=CO_LSS_FASTSCAN_VENDOR_ID && index<=CO_LSS_FASTSCAN_SERIAL)
157 
162 typedef union {
163  uint32_t addr[4];
164  struct {
165  uint32_t vendorID;
166  uint32_t productCode;
167  uint32_t revisionNumber;
168  uint32_t serialNumber;
169  } identity;
171 
181 typedef enum {
185 
189 typedef enum {
195  /* reserved = 5 */
201 
207  1000,
208  800,
209  500,
210  250,
211  125,
212  0,
213  50,
214  20,
215  10,
216  0
217 };
218 
222 #define CO_LSS_BIT_TIMING_VALID(index) (index != 5 && (index >= CO_LSS_BIT_TIMING_1000 && index <= CO_LSS_BIT_TIMING_AUTO))
223 
227 #define CO_LSS_NODE_ID_ASSIGNMENT 0xFFU
228 
232 #define CO_LSS_NODE_ID_VALID(nid) ((nid >= 1 && nid <= 0x7F) || nid == CO_LSS_NODE_ID_ASSIGNMENT)
233 
237 #define CO_LSS_ADDRESS_EQUAL(/*CO_LSS_address_t*/ a1, /*CO_LSS_address_t*/ a2) \
238  (a1.identity.productCode == a2.identity.productCode && \
239  a1.identity.revisionNumber == a2.identity.revisionNumber && \
240  a1.identity.serialNumber == a2.identity.serialNumber && \
241  a1.identity.vendorID == a2.identity.vendorID)
242  /*@defgroup CO_LSS*/
244 
245 #ifdef __cplusplus
246 }
247 #endif /*__cplusplus*/
248 
249 #endif /* (CO_CONFIG_LSS) & (CO_CONFIG_LSS_SLAVE | CO_CONFIG_LSS_MASTER) */
250 
251 #endif /*CO_LSS_H*/
uint32_t
unsigned long int uint32_t
UNSIGNED32 in CANopen (0007h), 32-bit unsigned integer.
Definition: CO_driver.h:155
CO_driver.h
Interface between CAN hardware and CANopenNode.
CO_LSS_FASTSCAN_BIT31
@ CO_LSS_FASTSCAN_BIT31
dito
Definition: CO_LSS.h:140
CO_LSS_INQUIRE_PRODUCT
@ CO_LSS_INQUIRE_PRODUCT
Inquire identity product-code protocol.
Definition: CO_LSS.h:100
CO_LSS_CFG_BIT_TIMING
@ CO_LSS_CFG_BIT_TIMING
Configure bit timing parameter protocol.
Definition: CO_LSS.h:94
CO_LSS_cfgBitTiming_t
CO_LSS_cfgBitTiming_t
Error codes for Configure bit timing parameters protocol.
Definition: CO_LSS.h:118
CO_LSS_BIT_TIMING_800
@ CO_LSS_BIT_TIMING_800
800kbit/s
Definition: CO_LSS.h:191
uint16_t
unsigned int uint16_t
UNSIGNED16 in CANopen (0006h), 16-bit unsigned integer.
Definition: CO_driver.h:153
CO_LSS_INQUIRE_SERIAL
@ CO_LSS_INQUIRE_SERIAL
Inquire identity serial-number protocol.
Definition: CO_LSS.h:102
CO_LSS_BIT_TIMING_50
@ CO_LSS_BIT_TIMING_50
50kbit/s
Definition: CO_LSS.h:196
CO_LSS_cs_t
CO_LSS_cs_t
LSS protocol command specifiers.
Definition: CO_LSS.h:86
CO_LSS_SWITCH_STATE_SEL_PRODUCT
@ CO_LSS_SWITCH_STATE_SEL_PRODUCT
Switch state selective protocol - Product code.
Definition: CO_LSS.h:89
CO_LSS_fastscan_lss_sub_next
CO_LSS_fastscan_lss_sub_next
Fastscan LSSsub, LSSnext.
Definition: CO_LSS.h:149
CO_LSS_CFG_STORE_FAILED
@ CO_LSS_CFG_STORE_FAILED
Storage media access error.
Definition: CO_LSS.h:130
CO_LSS_CFG_BIT_TIMING_MANUFACTURER
@ CO_LSS_CFG_BIT_TIMING_MANUFACTURER
Manufacturer specific error.
Definition: CO_LSS.h:121
CO_LSS_FASTSCAN_CONFIRM
@ CO_LSS_FASTSCAN_CONFIRM
All LSS slaves waiting for scan respond and previous scan is reset.
Definition: CO_LSS.h:141
CO_LSS_SWITCH_STATE_SEL_SERIAL
@ CO_LSS_SWITCH_STATE_SEL_SERIAL
Switch state selective protocol - Serial number.
Definition: CO_LSS.h:91
CO_LSS_STATE_WAITING
@ CO_LSS_STATE_WAITING
LSS FSA waiting for requests.
Definition: CO_LSS.h:182
CO_LSS_CFG_ACTIVATE_BIT_TIMING
@ CO_LSS_CFG_ACTIVATE_BIT_TIMING
Activate bit timing parameter protocol.
Definition: CO_LSS.h:95
CO_LSS_STATE_CONFIGURATION
@ CO_LSS_STATE_CONFIGURATION
LSS FSA waiting for configuration.
Definition: CO_LSS.h:183
CO_LSS_CFG_NODE_ID
@ CO_LSS_CFG_NODE_ID
Configure node ID protocol.
Definition: CO_LSS.h:93
CO_LSS_CFG_NODE_ID_OK
@ CO_LSS_CFG_NODE_ID_OK
Protocol successfully completed.
Definition: CO_LSS.h:110
CO_LSS_CFG_STORE_OK
@ CO_LSS_CFG_STORE_OK
Protocol successfully completed.
Definition: CO_LSS.h:128
CO_LSS_SWITCH_STATE_GLOBAL
@ CO_LSS_SWITCH_STATE_GLOBAL
Switch state global protocol.
Definition: CO_LSS.h:87
CO_LSS_state_t
CO_LSS_state_t
LSS finite state automaton.
Definition: CO_LSS.h:181
CO_LSS_cfgStore_t
CO_LSS_cfgStore_t
Error codes for Store configuration protocol.
Definition: CO_LSS.h:127
CO_LSS_SWITCH_STATE_SEL_REV
@ CO_LSS_SWITCH_STATE_SEL_REV
Switch state selective protocol - Revision number.
Definition: CO_LSS.h:90
CO_LSS_FASTSCAN_BIT0
@ CO_LSS_FASTSCAN_BIT0
Least significant bit of IDnumbners bit area to be checked.
Definition: CO_LSS.h:138
CO_LSS_INQUIRE_REV
@ CO_LSS_INQUIRE_REV
Inquire identity revision-number protocol.
Definition: CO_LSS.h:101
CO_LSS_BIT_TIMING_500
@ CO_LSS_BIT_TIMING_500
500kbit/s
Definition: CO_LSS.h:192
CO_LSS_FASTSCAN_SERIAL
@ CO_LSS_FASTSCAN_SERIAL
Serial number.
Definition: CO_LSS.h:153
CO_LSS_BIT_TIMING_125
@ CO_LSS_BIT_TIMING_125
125kbit/s
Definition: CO_LSS.h:194
CO_LSS_INQUIRE_VENDOR
@ CO_LSS_INQUIRE_VENDOR
Inquire identity vendor-ID protocol.
Definition: CO_LSS.h:99
CO_LSS_bitTimingTable_t
CO_LSS_bitTimingTable_t
Definition of table_index for /CiA301/ bit timing table.
Definition: CO_LSS.h:189
CO_LSS_CFG_BIT_TIMING_OK
@ CO_LSS_CFG_BIT_TIMING_OK
Protocol successfully completed.
Definition: CO_LSS.h:119
CO_LSS_BIT_TIMING_20
@ CO_LSS_BIT_TIMING_20
20kbit/s
Definition: CO_LSS.h:197
CO_LSS_CFG_STORE_NOT_SUPPORTED
@ CO_LSS_CFG_STORE_NOT_SUPPORTED
Store configuration not supported.
Definition: CO_LSS.h:129
CO_LSS_INQUIRE_NODE_ID
@ CO_LSS_INQUIRE_NODE_ID
Inquire node-ID protocol.
Definition: CO_LSS.h:103
CO_LSS_FASTSCAN_REV
@ CO_LSS_FASTSCAN_REV
Revision number.
Definition: CO_LSS.h:152
CO_LSS_BIT_TIMING_10
@ CO_LSS_BIT_TIMING_10
10kbit/s
Definition: CO_LSS.h:198
CO_LSS_CFG_STORE_MANUFACTURER
@ CO_LSS_CFG_STORE_MANUFACTURER
Manufacturer specific error.
Definition: CO_LSS.h:131
CO_LSS_IDENT_FASTSCAN
@ CO_LSS_IDENT_FASTSCAN
LSS Fastscan protocol.
Definition: CO_LSS.h:98
CO_LSS_CFG_NODE_ID_OUT_OF_RANGE
@ CO_LSS_CFG_NODE_ID_OUT_OF_RANGE
NID out of range.
Definition: CO_LSS.h:111
CO_LSS_FASTSCAN_PRODUCT
@ CO_LSS_FASTSCAN_PRODUCT
Product code.
Definition: CO_LSS.h:151
CO_LSS_BIT_TIMING_AUTO
@ CO_LSS_BIT_TIMING_AUTO
Automatic bit rate detection.
Definition: CO_LSS.h:199
CO_LSS_BIT_TIMING_1000
@ CO_LSS_BIT_TIMING_1000
1000kbit/s
Definition: CO_LSS.h:190
CO_LSS_BIT_TIMING_250
@ CO_LSS_BIT_TIMING_250
250kbit/s
Definition: CO_LSS.h:193
CO_LSS_cfgNodeId_t
CO_LSS_cfgNodeId_t
Error codes for Configure node ID protocol.
Definition: CO_LSS.h:109
CO_LSS_CFG_BIT_TIMING_OUT_OF_RANGE
@ CO_LSS_CFG_BIT_TIMING_OUT_OF_RANGE
Bit timing / Bit rate not supported.
Definition: CO_LSS.h:120
CO_LSS_CFG_STORE
@ CO_LSS_CFG_STORE
Store configuration protocol.
Definition: CO_LSS.h:96
CO_LSS_SWITCH_STATE_SEL_VENDOR
@ CO_LSS_SWITCH_STATE_SEL_VENDOR
Switch state selective protocol - Vendor ID.
Definition: CO_LSS.h:88
CO_LSS_fastscan_bitcheck
CO_LSS_fastscan_bitcheck
Fastscan BitCheck.
Definition: CO_LSS.h:137
CO_LSS_bitTimingTableLookup
static const uint16_t CO_LSS_bitTimingTableLookup[]
Lookup table for conversion between bit timing table and numerical bit rate.
Definition: CO_LSS.h:206
CO_LSS_CFG_NODE_ID_MANUFACTURER
@ CO_LSS_CFG_NODE_ID_MANUFACTURER
Manufacturer specific error.
Definition: CO_LSS.h:112
CO_LSS_address_t
The LSS address is a 128 bit number, uniquely identifying each node.
Definition: CO_LSS.h:162
CO_LSS_SWITCH_STATE_SEL
@ CO_LSS_SWITCH_STATE_SEL
Switch state selective protocol - Slave response.
Definition: CO_LSS.h:92
CO_LSS_IDENT_SLAVE
@ CO_LSS_IDENT_SLAVE
LSS Fastscan response.
Definition: CO_LSS.h:97
CO_LSS_FASTSCAN_VENDOR_ID
@ CO_LSS_FASTSCAN_VENDOR_ID
Vendor ID.
Definition: CO_LSS.h:150