26 #ifndef LELY_NO_CO_GW_TXT
119 format_printf__(2, 3);
129 co_unsigned16_t type, const
void *val);
136 co_unsigned16_t net, co_unsigned8_t node, const
char *begin,
137 const
char *end, struct
floc *at);
140 co_unsigned16_t net, co_unsigned8_t node, const
char *begin,
141 const
char *end, struct
floc *at);
144 void *data, co_unsigned16_t net, const
char *begin,
145 const
char *end, struct
floc *at);
149 co_unsigned16_t net, const
char *begin, const
char *end,
153 co_unsigned16_t net, const
char *begin, const
char *end,
157 co_unsigned16_t net, const
char *begin, const
char *end,
161 co_unsigned16_t net, const
char *begin, const
char *end,
166 co_unsigned16_t net, co_unsigned8_t node, const
char *begin,
167 const
char *end, struct
floc *at);
170 co_unsigned16_t net, co_unsigned8_t node, const
char *begin,
171 const
char *end, struct
floc *at);
175 co_unsigned16_t net, const
char *begin, const
char *end,
179 co_unsigned16_t net, const
char *begin, const
char *end,
183 co_unsigned16_t net, const
char *begin, const
char *end,
187 void *data, const
char *begin, const
char *end,
191 void *data, co_unsigned16_t net, const
char *begin,
192 const
char *end, struct
floc *at);
196 const
char *begin, const
char *end, struct
floc *at);
199 co_unsigned16_t net, const
char *begin, const
char *end,
203 const
char *begin, const
char *end, struct
floc *at);
207 co_unsigned16_t net, const
char *begin, const
char *end,
211 void *data, co_unsigned16_t net, const
char *begin,
212 const
char *end, struct
floc *at);
215 co_unsigned16_t net, const
char *begin, const
char *end,
219 co_unsigned16_t net, const
char *begin, const
char *end,
223 void *data, co_unsigned16_t net, const
char *begin,
224 const
char *end, struct
floc *at);
227 co_unsigned16_t net, const
char *begin, const
char *end,
231 co_unsigned16_t net, const
char *begin, const
char *end,
236 co_unsigned16_t net, const
char *begin, const
char *end,
240 co_unsigned16_t net, const
char *begin, const
char *end,
248 struct
floc *at, co_unsigned32_t *pseq, co_unsigned16_t *pnet,
249 co_unsigned8_t *
pnode);
253 const
char *begin, const
char *end, struct
floc *at,
int *psrv);
257 const
char *begin, const
char *end, struct
floc *at);
261 struct
floc *at, co_unsigned16_t *pidx, co_unsigned8_t *psubidx,
262 co_unsigned16_t *ptype);
266 struct
floc *at,
int ext, co_unsigned16_t *pnum,
271 struct
floc *at, co_unsigned16_t *ptype);
275 struct
floc *at, co_unsigned16_t type,
void *val);
282 struct
floc *at,
char *s,
size_t *pn);
286 struct
floc *at, co_unsigned8_t *ptrans);
297 __co_gw_txt_alloc(
void)
306 __co_gw_txt_free(
void *ptr)
345 if (!__co_gw_txt_init(gw)) {
353 __co_gw_txt_free(gw);
363 __co_gw_txt_fini(gw);
364 __co_gw_txt_free(gw);
391 if (srv->
size <
sizeof(*srv)) {
439 co_unsigned32_t seq = (uintptr_t)con->
data;
501 assert(!end || end >= begin);
512 const char *cp = begin;
524 if ((end && cp >= end) || !*cp)
527 co_unsigned32_t seq = 0;
528 co_unsigned16_t net = 0;
529 co_unsigned8_t node = 0xff;
533 void *data = (
void *)(uintptr_t)seq;
547 "node-ID specified before global command");
552 "network-ID specified before global command");
581 "node-ID specified before network-level command");
584 net = node == 0xff ? 0 : node;
595 gw, srv, data, net, node, cp, end,
floc);
599 gw, srv, data, net, node, cp, end,
floc);
603 gw, srv, data, net, cp, end,
floc);
607 gw, srv, data, net, cp, end,
floc);
611 gw, srv, data, net, cp, end,
floc);
615 gw, srv, data, net, cp, end,
floc);
619 gw, srv, data, net, cp, end,
floc);
738 if ((!end || cp < end) && *cp && !
isbreak((
unsigned char)*cp))
740 "expected line break after request");
747 while ((!end || cp + chars < end) && cp[chars] && cp[chars++] !=
'\n')
799 if (con->
iec || con->
ac)
863 const uint_least8_t *bp = con->
val;
870 char *buf = malloc(chars + 1);
910 &buf,
"[%" PRIu32
"] %u pdo %u", seq, con->
net, con->
n);
917 for (co_unsigned8_t i = 0; i < con->
n; i++) {
919 result =
asprintf(&tmp,
"%s 0x%" PRIx64, buf, con->
val[i]);
944 "[%" PRIu32
"] %" PRIu32
" %" PRIu32
" %u.%u %" PRIu32
947 (uint_least16_t)((con->
revision >> 16) & 0xffff),
948 (uint_least16_t)(con->
revision & 0xffff),
961 gw,
"[%" PRIu32
"] 0x%08" PRIx32, seq, con->
id);
981 "[%" PRIu32
"] 0x%08" PRIx32
" 0x%08" PRIx32
982 " 0x%08" PRIx32
" 0x%08" PRIx32,
998 "[%" PRIu32
"] ERROR: %08" PRIX32
" (%s)", seq,
1019 int result =
asprintf(&buf,
"%u pdo %u %u", ind->
net, ind->
num, ind->
n);
1026 for (co_unsigned8_t i = 0; i < ind->
n; i++) {
1028 result =
asprintf(&tmp,
"%s 0x%" PRIx64, buf, ind->
val[i]);
1053 gw,
"%u %u BOOT_UP", ind->
net, ind->
node);
1062 default: str =
"ERROR";
break;
1070 gw,
"%u %u %s", ind->
net, ind->
node, str);
1112 default: str =
"ERROR";
break;
1123 va_start(ap, format);
1135 int n = vsnprintf(NULL, 0, format, aq);
1140 vsprintf(buf, format, ap);
1164 char **pbegin,
char *end, co_unsigned16_t type,
const void *val)
1166 const union co_val *u = val;
1173 const char *vs = u->vs;
1176 vs +=
lex_utf8(vs, NULL, NULL, &c32);
1196 co_unsigned8_t node,
const char *begin,
const char *end,
1202 const char *cp = begin;
1205 co_unsigned16_t idx = 0;
1206 co_unsigned8_t subidx = 0;
1207 co_unsigned16_t type = 0;
1227 co_unsigned8_t
node,
const char *begin,
const char *end,
1233 const char *cp = begin;
1236 co_unsigned16_t
idx = 0;
1237 co_unsigned8_t
subidx = 0;
1238 co_unsigned16_t
type = 0;
1260 goto error_malloc_req;
1272 uint_least8_t *bp = req->
val;
1275 goto error_write_val;
1296 co_unsigned16_t net,
const char *begin,
const char *end,
1302 const char *cp = begin;
1324 co_unsigned16_t
net,
const char *begin,
const char *end,
1330 const char *cp = begin;
1333 co_unsigned16_t num = 0;
1341 +
map.n *
sizeof(*
map.map),
1347 .trans = comm.
trans,
1349 for (co_unsigned8_t i = 0; i <
map.n; i++)
1358 co_unsigned16_t
net,
const char *begin,
const char *end,
1364 const char *cp = begin;
1369 if ((chars =
lex_char(
'x', cp, end, at))) {
1375 co_unsigned16_t
num = 0;
1383 +
map.n *
sizeof(*
map.map),
1389 .trans = comm.
trans,
1391 .event = comm.
event,
1394 for (co_unsigned8_t i = 0; i <
map.n; i++)
1403 co_unsigned16_t
net,
const char *begin,
const char *end,
1409 const char *cp = begin;
1412 co_unsigned16_t
num = 0;
1420 "PDO number must be in the range [1..512]");
1436 co_unsigned16_t
net,
const char *begin,
const char *end,
1442 const char *cp = begin;
1445 co_unsigned16_t
num = 0;
1454 "PDO number must be in the range [1..512]");
1473 "number of values must be in the range [0..64]");
1477 for (co_unsigned8_t i = 0; i < req.
n; i++) {
1488 req.
size += req.
n *
sizeof(*req.
val);
1496 co_unsigned16_t
net, co_unsigned8_t node,
const char *begin,
1497 const char *end,
struct floc *at)
1502 const char *cp = begin;
1505 co_unsigned16_t gt = 0;
1513 co_unsigned8_t ltf = 0;
1514 if (!(chars =
lex_c99_u8(cp, end, at, <f))) {
1534 co_unsigned16_t
net, co_unsigned8_t
node,
const char *begin,
1535 const char *end,
struct floc *at)
1540 const char *cp = begin;
1543 co_unsigned16_t ms = 0;
1563 const char *begin,
const char *end,
struct floc *at)
1568 const char *cp = begin;
1571 co_unsigned8_t bitidx = 0;
1572 if (!(chars =
lex_c99_u8(cp, end, at, &bitidx))) {
1580 "the bit timing must be in the range [0..9]");
1596 const char *begin,
const char *end,
struct floc *at)
1601 const char *cp = begin;
1604 co_unsigned16_t ms = 0;
1623 const char *begin,
const char *end,
struct floc *at)
1628 const char *cp = begin;
1631 co_unsigned8_t node = 0;
1632 if (!(chars =
lex_c99_u8(cp, end, at, &node))) {
1640 "the node-ID must be in the range [1..%u, 255]",
1657 const char *begin,
const char *end,
struct floc *at)
1662 const char *cp = begin;
1683 co_unsigned16_t net,
const char *begin,
const char *end,
1689 const char *cp = begin;
1695 if (chars && !strncasecmp(
"Disable", cp, chars)) {
1698 }
else if (chars && !strncasecmp(
"Enable", cp, chars)) {
1703 "expected 'Disable' or 'Enable' after 'boot_up_indication'");
1719 const char *end,
struct floc *at)
1724 const char *cp = begin;
1727 co_unsigned16_t
net = 0;
1736 "the network-ID must be in the range [0, 1..%u]",
1751 co_unsigned16_t
net,
const char *begin,
const char *end,
1757 const char *cp = begin;
1760 co_unsigned8_t node = 0;
1761 if (!(chars =
lex_c99_u8(cp, end, at, &node))) {
1769 "the node-ID must be in the range [0, 1..%u]",
1786 const char *begin,
const char *end,
struct floc *at)
1791 const char *cp = begin;
1794 co_unsigned32_t n = 0;
1811 co_unsigned16_t net,
const char *begin,
const char *end,
1817 const char *cp = begin;
1820 co_unsigned8_t mode = 0;
1821 if (!(chars =
lex_c99_u8(cp, end, at, &mode)) || mode > 1) {
1839 co_unsigned16_t
net,
const char *begin,
const char *end,
1845 const char *cp = begin;
1865 co_unsigned16_t
net,
const char *begin,
const char *end,
1871 const char *cp = begin;
1874 co_unsigned8_t node = 0;
1875 if (!(chars =
lex_c99_u8(cp, end, at, &node))) {
1883 "the node-ID must be in the range [1..%u, 255]",
1900 co_unsigned16_t
net,
const char *begin,
const char *end,
1906 const char *cp = begin;
1909 co_unsigned8_t bitsel = 0;
1910 if (!(chars =
lex_c99_u8(cp, end, at, &bitsel))) {
1917 co_unsigned8_t bitidx = 0;
1918 if (!(chars =
lex_c99_u8(cp, end, at, &bitidx))) {
1937 co_unsigned16_t
net,
const char *begin,
const char *end,
1943 const char *cp = begin;
1946 co_unsigned16_t delay = 0;
1947 if (!(chars =
lex_c99_u16(cp, end, at, &delay))) {
1965 co_unsigned16_t
net,
const char *begin,
const char *end,
1971 const char *cp = begin;
1974 co_unsigned8_t cs = 0;
1975 if (!(chars =
lex_c99_u8(cp, end, at, &cs))) {
1980 if (cs < 0x5a || cs > 0x5d) {
1982 "code must be in the range [0x5A..0x5D]");
1998 co_unsigned16_t
net,
const char *begin,
const char *end,
2004 const char *cp = begin;
2026 co_unsigned16_t
net,
const char *begin,
const char *end,
2032 const char *cp = begin;
2054 co_unsigned16_t
net,
const char *begin,
const char *end,
2060 const char *cp = begin;
2143 "unable to send gateway request");
2150 co_unsigned32_t *pseq, co_unsigned16_t *pnet,
2151 co_unsigned8_t *
pnode)
2154 assert(!end || end >= begin);
2156 const char *cp = begin;
2159 if (!(chars =
lex_char(
'[', cp, end, at)))
2161 "expected '[' before sequence number");
2165 co_unsigned32_t seq = 0;
2173 if (!(chars =
lex_char(
']', cp, end, at)))
2175 "expected ']' after sequence number");
2179 co_unsigned16_t
net = 0;
2180 co_unsigned8_t node = 0xff;
2188 if ((chars =
lex_c99_u8(cp, end, at, &node))) {
2194 "the network-ID must be in the range [1..%u]",
2201 "the node-ID must be in the range [0..%u]",
2208 "the node-ID must be in the range [0..%u]",
2231 const char *begin,
const char *end,
struct floc *at,
int *psrv)
2234 assert(!end || end >= begin);
2236 const char *cp = begin;
2249 if (!strncasecmp(
"_lss_fastscan", cp, chars)) {
2252 }
else if (!strncasecmp(
"_lss_slowscan", cp, chars)) {
2255 }
else if (!strncasecmp(
"boot_up_indication", cp, chars)) {
2258 }
else if (!strncasecmp(
"disable", cp, chars)) {
2263 if (chars && !strncasecmp(
"guarding", cp, chars)) {
2266 }
else if (chars && !strncasecmp(
"heartbeat", cp, chars)) {
2271 "expected 'guarding' or 'heartbeat'");
2274 }
else if (!strncasecmp(
"enable", cp, chars)) {
2279 if (chars && !strncasecmp(
"guarding", cp, chars)) {
2282 }
else if (chars && !strncasecmp(
"heartbeat", cp, chars)) {
2287 "expected 'guarding' or 'heartbeat'");
2290 }
else if (!strncasecmp(
"info", cp, chars)) {
2295 if (chars && !strncasecmp(
"version", cp, chars)) {
2302 }
else if (!strncasecmp(
"init", cp, chars)) {
2305 }
else if (!strncasecmp(
"lss_activate_bitrate", cp, chars)) {
2308 }
else if (!strncasecmp(
"lss_conf_bitrate", cp, chars)) {
2311 }
else if (!strncasecmp(
"lss_get_node", cp, chars)) {
2314 }
else if (!strncasecmp(
"lss_identity", cp, chars)) {
2317 }
else if (!strncasecmp(
"lss_ident_nonconf", cp, chars)) {
2320 }
else if (!strncasecmp(
"lss_inquire_addr", cp, chars)) {
2323 }
else if (!strncasecmp(
"lss_set_node", cp, chars)) {
2326 }
else if (!strncasecmp(
"lss_store", cp, chars)) {
2329 }
else if (!strncasecmp(
"lss_switch_glob", cp, chars)) {
2332 }
else if (!strncasecmp(
"lss_switch_sel", cp, chars)) {
2335 }
else if (!strncasecmp(
"preop", cp, chars)
2336 || !strncasecmp(
"preoperational", cp, chars)) {
2339 }
else if (!strncasecmp(
"r", cp, chars)
2340 || !strncasecmp(
"read", cp, chars)) {
2345 if (!strncasecmp(
"p", cp, chars)
2346 || !strncasecmp(
"pdo", cp, chars)) {
2356 }
else if (!strncasecmp(
"reset", cp, chars)) {
2362 if (chars && (!strncasecmp(
"comm", cp, chars)
2363 || !strncasecmp(
"communication", cp, chars))) {
2367 }
else if (chars && !strncasecmp(
"node", cp, chars)) {
2372 "expected 'node' or 'comm[unication]'");
2375 }
else if (!strncasecmp(
"set", cp, chars)) {
2380 if (chars && !strncasecmp(
"command_size", cp, chars)) {
2383 }
else if (chars && !strncasecmp(
"command_timeout", cp, chars)) {
2386 }
else if (chars && !strncasecmp(
"heartbeat", cp, chars)) {
2389 }
else if (chars && !strncasecmp(
"id", cp, chars)) {
2392 }
else if (chars && !strncasecmp(
"network", cp, chars)) {
2395 }
else if (chars && !strncasecmp(
"node", cp, chars)) {
2398 }
else if (chars && !strncasecmp(
"rpdo", cp, chars)) {
2401 }
else if (chars && !strncasecmp(
"sdo_timeout", cp, chars)) {
2404 }
else if (chars && !strncasecmp(
"tpdo", cp, chars)) {
2407 }
else if (chars && !strncasecmp(
"tpdox", cp, chars)) {
2415 "expected 'command_size', 'command_timeout', 'heartbeat', 'id', 'network', 'node', 'rpdo', 'sdo_timeout' or 'tpdo[x]'");
2418 }
else if (!strncasecmp(
"start", cp, chars)) {
2421 }
else if (!strncasecmp(
"stop", cp, chars)) {
2424 }
else if (!strncasecmp(
"w", cp, chars)
2425 || !strncasecmp(
"write", cp, chars)) {
2430 if (!strncasecmp(
"p", cp, chars)
2431 || !strncasecmp(
"pdo", cp, chars)) {
2443 "expected '_lss_fastscan', '_lss_slowscan', 'boot_up_indication', 'disable', 'enable', 'info', 'init', 'lss_activate_bitrate', 'lss_conf_bitrate', 'lss_get_node', 'lss_identity', 'lss_ident_nonconf', 'lss_inquire_addr', 'lss_set_node', 'lss_store', 'lss_switch_glob', 'lss_switch_sel', 'preop[erational]', 'r[ead]', 'reset', 'set', 'start', 'stop', or 'w[rite]'");
2457 assert(!end || end >= begin);
2459 const char *cp = begin;
2461 if ((end && cp >= end) || !(*cp ==
'_' || isalpha((
unsigned char)*cp)))
2465 while ((!end || cp < end)
2466 && (*cp ==
'_' || isalnum((
unsigned char)*cp)))
2474 co_unsigned16_t *pidx, co_unsigned8_t *psubidx,
2475 co_unsigned16_t *ptype)
2479 const char *cp = begin;
2489 if (!(chars =
lex_c99_u8(cp, end, at, psubidx))) {
2510 const char *cp = begin;
2513 co_unsigned16_t num = 0;
2520 if (!num || num > 512) {
2522 "PDO number must be in the range [1..512]");
2540 if (ext && comm.
trans >= 0xfe) {
2549 if (ext && comm.
trans >= 0xfd) {
2556 }
else if (ext && comm.
trans <= 240) {
2574 "number of mapped values must be in the range [0..64]");
2578 for (co_unsigned8_t i = 0; i <
map.n; i++) {
2581 co_unsigned16_t idx = 0;
2582 co_unsigned8_t subidx = 0;
2591 "expected object sub-index");
2598 co_unsigned16_t type = 0;
2605 "only basic types can be mapped to PDOs");
2612 map.map[i] = ((co_unsigned32_t)(idx ? idx : type) << 16)
2613 | ((co_unsigned32_t)subidx << 8) | len;
2624 for (co_unsigned8_t i = 0; i <
map.n; i++)
2625 pmap->
map[i] =
map.map[i];
2633 co_unsigned16_t *ptype)
2637 const char *cp = begin;
2640 co_unsigned16_t type = 0;
2643 if (chars && !strncasecmp(
"b", cp, chars)) {
2645 }
else if (chars && !strncasecmp(
"d", cp, chars)) {
2647 }
else if (chars && !strncasecmp(
"i16", cp, chars)) {
2649 }
else if (chars && !strncasecmp(
"i24", cp, chars)) {
2651 }
else if (chars && !strncasecmp(
"i32", cp, chars)) {
2653 }
else if (chars && !strncasecmp(
"i40", cp, chars)) {
2655 }
else if (chars && !strncasecmp(
"i48", cp, chars)) {
2657 }
else if (chars && !strncasecmp(
"i56", cp, chars)) {
2659 }
else if (chars && !strncasecmp(
"i64", cp, chars)) {
2661 }
else if (chars && !strncasecmp(
"i8", cp, chars)) {
2663 }
else if (chars && !strncasecmp(
"os", cp, chars)) {
2665 }
else if (chars && !strncasecmp(
"r32", cp, chars)) {
2667 }
else if (chars && !strncasecmp(
"r64", cp, chars)) {
2669 }
else if (chars && !strncasecmp(
"t", cp, chars)) {
2671 }
else if (chars && !strncasecmp(
"td", cp, chars)) {
2673 }
else if (chars && !strncasecmp(
"u16", cp, chars)) {
2675 }
else if (chars && !strncasecmp(
"u24", cp, chars)) {
2677 }
else if (chars && !strncasecmp(
"u32", cp, chars)) {
2679 }
else if (chars && !strncasecmp(
"u40", cp, chars)) {
2681 }
else if (chars && !strncasecmp(
"u48", cp, chars)) {
2683 }
else if (chars && !strncasecmp(
"u56", cp, chars)) {
2685 }
else if (chars && !strncasecmp(
"u64", cp, chars)) {
2687 }
else if (chars && !strncasecmp(
"u8", cp, chars)) {
2689 }
else if (chars && !strncasecmp(
"us", cp, chars)) {
2691 }
else if (chars && !strncasecmp(
"vs", cp, chars)) {
2707 co_unsigned16_t type,
void *val)
2710 assert(!end || end >= begin);
2715 const char *cp = begin;
2718 if (!(chars =
lex_char(
'\"', cp, end, at)))
2720 "expected '\"' before string");
2728 "unable to create value of type VISIBLE_STRING");
2732 char *vs = *(
void **)val;
2738 if (!(chars =
lex_char(
'\"', cp, end, at)))
2740 "expected '\"' after string");
2748 default:
return co_val_lex(type, val, begin, end, at);
2765 const char *cp = begin;
2769 char *ends = s + (s && pn ? *pn : 0);
2771 while ((!end || cp < end) && *cp && !
isbreak((
unsigned char)*cp)) {
2774 if ((end && cp + 1 >= end) || cp[1] !=
'\"')
2778 }
else if (*cp ==
'\\') {
2798 co_unsigned8_t *ptrans)
2802 const char *cp = begin;
2811 co_unsigned8_t trans = 0;
2813 if (!strncasecmp(
"event", cp, 5)) {
2818 }
else if (!strncasecmp(
"rtr", cp, chars)) {
2821 }
else if (!strncasecmp(
"sync", cp, 4)) {
2825 if (!(chars =
lex_c99_u8(cp, end, at, &trans))) {
2832 "SYNC period must be in the range [0..240]");
2837 "expected 'event', 'rtr' or 'sync<0..240>'");
2853 const char *cp = begin;
2897 const char *cp = begin;
2916 struct co_id hi = lo;
2920 "expected lower bound for revision number");
2928 "expected upper bound for revision number");
2936 "expected lower bound for serial number");
2944 "expected upper bound for serial number");
This header file is part of the CANopen library; it contains the device description declarations.
#define CO_NUM_NODES
The maximum number of nodes in a CANopen network.
#define CO_ID_INIT
The static initializer for struct co_id.
This header file is part of the utilities library; it contains the diagnostic declarations.
size_t floc_lex(struct floc *at, const char *begin, const char *end)
Increments a file location by reading characters from a memory buffer.
void diag_if(enum diag_severity severity, int errc, const struct floc *at, const char *format,...)
Emits a diagnostic message occurring at a location in a text file.
void diag(enum diag_severity severity, int errc, const char *format,...)
Emits a diagnostic message.
@ ERRNUM_INVAL
Invalid argument.
int get_errc(void)
Returns the last (thread-specific) native error code set by a system call or library function.
void set_errc(int errc)
Sets the current (thread-specific) native error code to errc.
int errno2c(int errnum)
Transforms a standard C error number to a native error code.
void set_errnum(errnum_t errnum)
Sets the current (thread-specific) platform-independent error number to errnum.
#define CO_GW_SRV_SET_RPDO
CANopen gateway service: Configure RPDO.
#define CO_GW_SRV_SET_CMD_TIMEOUT
CANopen gateway service: Set command time-out.
#define CO_GW_SRV_NMT_STOP
CANopen gateway service: Start node.
#define CO_GW_SRV_LSS_SET_ID
CANopen gateway service: LSS configure node-ID.
#define CO_GW_SRV_LSS_SWITCH_RATE
CANopen gateway service: LSS activate new bit-rate.
#define CO_GW_SRV_NMT_ENTER_PREOP
CANopen gateway service: Set node to pre-operational.
#define CO_GW_SRV_SET_TPDO
CANopen gateway service: Configure TPDO.
#define CO_GW_SRV_LSS_GET_LSSID
CANopen gateway service: Inquire LSS address.
#define CO_GW_CON_SDO_UP_SIZE
The minimum size (in bytes) of a CANopen gateway 'SDO upload' confirmation.
#define CO_GW_SRV_LSS_SWITCH
CANopen gateway service: LSS switch state global.
#define CO_GW_REQ_SDO_DN_SIZE
The minimum size (in bytes) of a CANopen gateway 'SDO download' request.
#define CO_GW_SRV_SET_SDO_TIMEOUT
CANopen gateway service: Configure SDO time-out.
#define CO_GW_SRV_LSS_SET_RATE
CANopen gateway service: LSS configure bit-rate.
#define CO_GW_SRV_RPDO
CANopen gateway service: RPDO received.
#define CO_GW_SRV__BOOT
Lely-specific gateway service: Boot slave process completed.
#define CO_GW_SRV_SDO
CANopen gateway service: CiA 301 progress indication download.
#define CO_GW_SRV_SET_CMD_SIZE
CANopen gateway service: Set command size.
#define CO_GW_SRV_SET_BOOTUP_IND
CANopen gateway service: Boot-up forwarding.
#define CO_GW_SRV_SET_NODE
CANopen gateway service: Set default node-ID.
#define CO_GW_SRV_NMT_HB_ENABLE
CANopen gateway service: Start heartbeat consumer.
#define CO_GW_SRV_LSS_ID_NON_CFG_SLAVE
CANopen gateway service: LSS identify non-configured remote slaves.
#define CO_GW_SRV_PDO_WRITE
CANopen gateway service: Write PDO data.
#define CO_GW_SRV_NMT_RESET_COMM
CANopen gateway service: Reset communication.
#define CO_GW_SRV_SDO_UP
CANopen gateway service: SDO upload.
#define CO_GW_SRV_PDO_READ
CANopen gateway service: Read PDO data.
#define CO_GW_IND_RPDO_SIZE
The minimum size (in bytes) of a CANopen gateway 'RPDO received' indication.
#define CO_GW_SRV_SET_ID
CANopen gateway service: Set node-ID.
#define CO_GW_SRV_NMT_START
CANopen gateway service: Start node.
#define CO_GW_SRV__SYNC
Lely-specific gateway service: Synchronization event received.
#define CO_GW_SRV_EMCY
CANopen gateway service: Emergency event received.
#define CO_GW_IEC_SYNTAX
CANopen gateway internal error: Syntax error.
#define CO_GW_SRV_EC
CANopen gateway service: Error control event received.
#define CO_GW_SRV_SET_NET
CANopen gateway service: Set default network.
#define CO_GW_SRV__TIME
Lely-specific gateway service: Time stamp event received.
#define CO_GW_SRV_NMT_RESET_NODE
CANopen gateway service: Reset node.
#define CO_GW_REQ_SET_RPDO_SIZE
The minimum size (in bytes) of a CANopen gateway 'Configure RPDO' request.
#define CO_GW_IEC_BOOTUP
CANopen gateway internal error: Boot-up.
#define CO_GW_NUM_NET
The maximum number of networks in a CANopen gateway.
#define CO_GW_SRV_LSS_ID_SLAVE
CANopen gateway service: LSS identify remote slave.
#define CO_GW_SRV_LSS_STORE
CANopen gateway service: LSS store configuration.
#define CO_GW_SRV__LSS_SLOWSCAN
Lely-specific gateway service: LSS Slowscan.
#define CO_GW_SRV_LSS_GET_ID
CANopen gateway service: LSS inquire node-ID.
#define CO_GW_SRV_GET_VERSION
CANopen gateway service: Get version.
#define CO_GW_REQ_SET_TPDO_SIZE
The minimum size (in bytes) of a CANopen gateway 'Configure TPDO' request.
#define CO_GW_CON_PDO_READ_SIZE
The minimum size (in bytes) of a CANopen gateway 'Read PDO' confirmation.
#define CO_GW_REQ_PDO_WRITE_SIZE
The minimum size (in bytes) of a CANopen gateway 'Write PDO' request.
#define CO_GW_SRV__LSS_FASTSCAN
Lely-specific gateway service: LSS Fastscan.
#define CO_GW_SRV_NMT_NG_ENABLE
CANopen gateway service: Enable node guarding.
#define CO_GW_SRV_NMT_NG_DISABLE
CANopen gateway service: Disable node guarding.
#define CO_GW_IEC_INTERN
CANopen gateway internal error: Request not processed due to internal state.
#define CO_GW_SRV_NMT_HB_DISABLE
CANopen gateway service: Disable heartbeat consumer.
#define CO_GW_SRV_SET_HB
CANopen gateway service: Set heartbeat producer.
const char * co_gw_iec2str(int iec)
Returns a string describing an internal error code.
#define CO_GW_SRV_INIT
CANopen gateway service: Initialize gateway.
#define CO_GW_SRV_SDO_DN
CANopen gateway service: SDO download.
#define CO_GW_SRV_LSS_SWITCH_SEL
CANopen gateway service: LSS switch state selective.
static size_t co_gw_txt_send_set_cmd_timeout(co_gw_txt_t *gw, int srv, void *data, const char *begin, const char *end, struct floc *at)
Sends a 'Set command time-out' request after parsin gits parameters.
void co_gw_txt_set_send_func(co_gw_txt_t *gw, co_gw_txt_send_func_t *func, void *data)
Sets the callback function used to send requests from the user to a CANopen gateway.
void co_gw_txt_destroy(co_gw_txt_t *gw)
Destroys a CANopen ASCII gateway.
static size_t co_gw_txt_send_set_hb(co_gw_txt_t *gw, int srv, void *data, co_unsigned16_t net, const char *begin, const char *end, struct floc *at)
Sends a 'Set heartbeat producer' request after parsing its parameters.
static size_t co_gw_txt_send_lss_switch(co_gw_txt_t *gw, int srv, void *data, co_unsigned16_t net, const char *begin, const char *end, struct floc *at)
Sends an 'LSS switch state global' request after parsing its parameters.
static size_t co_gw_txt_lex_id_sel(const char *begin, const char *end, struct floc *at, struct co_id *plo, struct co_id *phi)
Lexes an LSS address range.
static int co_gw_txt_recv_lss_get_id(co_gw_txt_t *gw, co_unsigned32_t seq, const struct co_gw_con_lss_get_id *con)
Processes an 'LSS inquire node-ID' confirmation.
static size_t co_gw_txt_send__lss_fastscan(co_gw_txt_t *gw, int srv, void *data, co_unsigned16_t net, const char *begin, const char *end, struct floc *at)
Sends an 'LSS Fastscan' request after parsing its parameters.
static size_t co_gw_txt_send_set_bootup_ind(co_gw_txt_t *gw, int srv, void *data, co_unsigned16_t net, const char *begin, const char *end, struct floc *at)
Sends a 'Boot-up forwarding' request after parsing its parameters.
static size_t co_gw_txt_lex_sdo(const char *begin, const char *end, struct floc *at, co_unsigned16_t *pidx, co_unsigned8_t *psubidx, co_unsigned16_t *ptype)
Lexes the multiplexer and data type of an SDO upload/download request.
static size_t co_gw_txt_send_set_node(co_gw_txt_t *gw, int srv, void *data, co_unsigned16_t net, const char *begin, const char *end, struct floc *at)
Sends a 'Set default node-ID' request after parsing its parameters.
void co_gw_txt_get_recv_func(const co_gw_txt_t *gw, co_gw_txt_recv_func_t **pfunc, void **pdata)
Retrieves the callback function used to forward indications and confirmations received by a CANopen g...
static int co_gw_txt_recv_emcy(co_gw_txt_t *gw, const struct co_gw_ind_emcy *ind)
Processes an 'Emergency event received' indication.
static size_t co_gw_txt_send_sdo_dn(co_gw_txt_t *gw, int srv, void *data, co_unsigned16_t net, co_unsigned8_t node, const char *begin, const char *end, struct floc *at)
Sends an 'SDO download' request after parsing its parameters.
static size_t co_gw_txt_lex_srv(const char *begin, const char *end, struct floc *at, int *psrv)
Lexes the service number of a request.
static size_t co_gw_txt_send__lss_slowscan(co_gw_txt_t *gw, int srv, void *data, co_unsigned16_t net, const char *begin, const char *end, struct floc *at)
Sends an 'LSS Slowscan' request after parsing its parameters.
static size_t co_gw_txt_send_lss_switch_sel(co_gw_txt_t *gw, int srv, void *data, co_unsigned16_t net, const char *begin, const char *end, struct floc *at)
Sends an 'LSS switch state selective' request after parsing its parameters.
static size_t co_gw_txt_send_lss_set_id(co_gw_txt_t *gw, int srv, void *data, co_unsigned16_t net, const char *begin, const char *end, struct floc *at)
Sends an 'LSS configure node-ID' request after parsing its parameters.
static int co_gw_txt_recv_txt(co_gw_txt_t *gw, const char *txt)
Invokes the callback function to process a received indication or confirmation.
static int co_gw_txt_recv_fmt(co_gw_txt_t *gw, const char *format,...)
Formats a received indication or confirmation and invokes the callback function to process it.
static int co_gw_txt_recv_pdo_read(co_gw_txt_t *gw, co_unsigned32_t seq, const struct co_gw_con_pdo_read *con)
Processes a 'Read PDO data' confirmation.
void co_gw_txt_get_send_func(const co_gw_txt_t *gw, co_gw_txt_send_func_t **pfunc, void **pdata)
Retrieves the callback function used to send requests from the user to a CANopen gateway.
static size_t co_gw_txt_lex_type(const char *begin, const char *end, struct floc *at, co_unsigned16_t *ptype)
Lexes a data type.
static size_t co_gw_txt_send_init(co_gw_txt_t *gw, int srv, void *data, co_unsigned16_t net, const char *begin, const char *end, struct floc *at)
Sends an 'Initialize gateway' request after parsing its parameters.
static int co_gw_txt_recv_con(co_gw_txt_t *gw, co_unsigned32_t seq, const struct co_gw_con *con)
Processes a confirmation.
static int co_gw_txt_recv_sdo_up(co_gw_txt_t *gw, co_unsigned32_t seq, const struct co_gw_con_sdo_up *con)
Processes an 'SDO upload' confirmation.
size_t co_gw_txt_send(co_gw_txt_t *gw, const char *begin, const char *end, struct floc *at)
Sends a user request to a CANopen gateway.
static size_t co_gw_txt_send_lss_get_lssid(co_gw_txt_t *gw, int srv, void *data, co_unsigned16_t net, const char *begin, const char *end, struct floc *at)
Sends an 'Inquire LSS address' request after parsing its parameters.
static size_t co_gw_txt_send_sdo_up(co_gw_txt_t *gw, int srv, void *data, co_unsigned16_t net, co_unsigned8_t node, const char *begin, const char *end, struct floc *at)
Sends an 'SDO upload' request after parsing its parameters.
static size_t co_gw_txt_send_set_cmd_size(co_gw_txt_t *gw, int srv, void *data, const char *begin, const char *end, struct floc *at)
Sends a 'Set command size' request after parsing its parameters.
static size_t co_gw_txt_send_pdo_read(co_gw_txt_t *gw, int srv, void *data, co_unsigned16_t net, const char *begin, const char *end, struct floc *at)
Sends a 'Read PDO data' request after parsing its parameters.
static size_t co_gw_txt_send_lss_set_rate(co_gw_txt_t *gw, int srv, void *data, co_unsigned16_t net, const char *begin, const char *end, struct floc *at)
Sends an 'LSS configure bit-rate' request after parsing its parameters.
static int co_gw_txt_recv_sdo(co_gw_txt_t *gw, const struct co_gw_ind_sdo *ind)
Processes an 'CiA 301 progress indication download' indication.
static size_t co_gw_txt_lex_trans(const char *begin, const char *end, struct floc *at, co_unsigned8_t *ptrans)
Lexes the transmission type of a configure PDO request.
co_gw_txt_t * co_gw_txt_create(void)
Creates a new CANopen ASCII gateway.
static size_t co_gw_txt_send_set_sdo_timeout(co_gw_txt_t *gw, int srv, void *data, co_unsigned16_t net, const char *begin, const char *end, struct floc *at)
Sends a 'Configure SDO time-out' request after parsing its parameters.
static size_t co_gw_txt_send_set_id(co_gw_txt_t *gw, int srv, void *data, co_unsigned16_t net, const char *begin, const char *end, struct floc *at)
Sends a 'Set node-ID' request after parsing its parameters.
void co_gw_txt_set_recv_func(co_gw_txt_t *gw, co_gw_txt_recv_func_t *func, void *data)
Sets the callback function used to forward indications and confirmations received by a CANopen gatewa...
int co_gw_txt_recv(co_gw_txt_t *gw, const struct co_gw_srv *srv)
Receives and forwards an indication or confirmation from a CANopen gateway.
static void co_gw_txt_send_req(co_gw_txt_t *gw, const struct co_gw_req *req)
Invokes the callback function to send a request.
static size_t co_gw_txt_print_val(char **pbegin, char *end, co_unsigned16_t type, const void *val)
Prints a CANopen value.
static size_t co_gw_txt_lex_val(const char *begin, const char *end, struct floc *at, co_unsigned16_t type, void *val)
Lexes a value for an SDO download request.
static size_t co_gw_txt_lex_prefix(const char *begin, const char *end, struct floc *at, co_unsigned32_t *pseq, co_unsigned16_t *pnet, co_unsigned8_t *pnode)
Lexes the prefix (sequence number and optional network and node-ID) of a request.
static int co_gw_txt_recv__boot(co_gw_txt_t *gw, const struct co_gw_ind__boot *ind)
Processes a 'Boot slave process completed' indication.
static int co_gw_txt_recv__lss_scan(co_gw_txt_t *gw, co_unsigned32_t seq, const struct co_gw_con__lss_scan *con)
Processes an 'LSS Slowscan/Fastscan' confirmation.
int co_gw_txt_iec(co_gw_txt_t *gw)
Returns (and clears) the last internal error code.
static size_t co_gw_txt_send_lss_switch_rate(co_gw_txt_t *gw, int srv, void *data, co_unsigned16_t net, const char *begin, const char *end, struct floc *at)
Sends an 'LSS activate new bit-rate' request after parsing its parameters.
static size_t co_gw_txt_send_nmt_set_ng(co_gw_txt_t *gw, int srv, void *data, co_unsigned16_t net, co_unsigned8_t node, const char *begin, const char *end, struct floc *at)
Sends an 'Enable node guarding' request after parsing its parameters.
static size_t co_gw_txt_send_nmt_set_hb(co_gw_txt_t *gw, int srv, void *data, co_unsigned16_t net, co_unsigned8_t node, const char *begin, const char *end, struct floc *at)
Sends a 'Start heartbeat consumer' request after parsing its parameters.
static int co_gw_txt_recv_lss_get_lssid(co_gw_txt_t *gw, co_unsigned32_t seq, const struct co_gw_con_lss_get_lssid *con)
Processes an 'Inquire LSS address' confirmation.
static size_t co_gw_txt_lex_cmd(const char *begin, const char *end, struct floc *at)
Lexes a single command.
static int co_gw_txt_recv_get_version(co_gw_txt_t *gw, co_unsigned32_t seq, const struct co_gw_con_get_version *con)
Processes a 'Get version' confirmation.
size_t co_gw_txt_pending(const co_gw_txt_t *gw)
Returns the number of pending (i.e., unconfirmed) requests.
static int co_gw_txt_recv_err(co_gw_txt_t *gw, co_unsigned32_t seq, int iec, co_unsigned32_t ac)
Processes a confirmation with a non-zero internal error code or SDO abort code.
static size_t co_gw_txt_send_set_tpdo(co_gw_txt_t *gw, int srv, void *data, co_unsigned16_t net, const char *begin, const char *end, struct floc *at)
Sends a 'Configure TPDO' request after parsing its parameters.
static size_t co_gw_txt_send_lss_id_slave(co_gw_txt_t *gw, int srv, void *data, co_unsigned16_t net, const char *begin, const char *end, struct floc *at)
Sends an 'LSS identify remote slave' request after parsing its parameters.
static size_t co_gw_txt_send_set_net(co_gw_txt_t *gw, int srv, void *data, const char *begin, const char *end, struct floc *at)
Sends a 'Set default network' request after parsing its parameters.
static size_t co_gw_txt_lex_vs(const char *begin, const char *end, struct floc *at, char *s, size_t *pn)
Lexes an array of visible characters (CO_DEFTYPE_VISIBLE_STRING), excluding the delimiting quotes,...
static size_t co_gw_txt_send_pdo_write(co_gw_txt_t *gw, int srv, void *data, co_unsigned16_t net, const char *begin, const char *end, struct floc *at)
Sends a 'Write PDO data' request after parsing its parameters.
static size_t co_gw_txt_send_set_rpdo(co_gw_txt_t *gw, int srv, void *data, co_unsigned16_t net, const char *begin, const char *end, struct floc *at)
Sends a 'Configure RPDO' request after parsing its parameters.
static size_t co_gw_txt_lex_pdo(const char *begin, const char *end, struct floc *at, int ext, co_unsigned16_t *pnum, struct co_pdo_comm_par *pcomm, struct co_pdo_map_par *pmap)
Lexes the communication and mapping parameters of a configure PDO request.
static int co_gw_txt_recv_rpdo(co_gw_txt_t *gw, const struct co_gw_ind_rpdo *ind)
Processes an 'RPDO received' indication.
static size_t co_gw_txt_lex_id(const char *begin, const char *end, struct floc *at, struct co_id *pid)
Lexes an LSS address.
static int co_gw_txt_recv_ec(co_gw_txt_t *gw, const struct co_gw_ind_ec *ind)
Processes an 'Error control event received' indication.
This header file is part of the CANopen library; it contains the ASCII gateway declarations (see CiA ...
int co_gw_txt_recv_func_t(const char *txt, void *data)
The type of a CANopen ASCII gateway receive callback function, invoked when when an indication of con...
#define CO_GW_TXT_IMPL_HI
The high number of the version of CiA 309-3 implemented by this gateway.
int co_gw_txt_send_func_t(const struct co_gw_req *req, void *data)
The type of a CANopen ASCII gateway send callback function, invoked when a request has been issued by...
#define CO_GW_TXT_IMPL_LO
The low number of the version of CiA 309-3 implemented by this gateway.
This header file is part of the CANopen library; it contains the Service Data Object (SDO) declaratio...
#define CO_SDO_AC_TYPE_LEN
SDO abort code: Data type does not match, length of service parameter does not match.
const char * co_sdo_ac2str(co_unsigned32_t ac)
Returns a string describing an SDO abort code.
#define MAX(a, b)
Returns the maximum of a and b.
This header file is part of the utilities library; it contains the lexer function declarations.
size_t lex_char(int c, const char *begin, const char *end, struct floc *at)
Lexes the specified character from a memory buffer.
size_t lex_ctype(int(*ctype)(int), const char *begin, const char *end, struct floc *at)
Greedily lexes a sequence of characters of the specified class from a memory buffer.
size_t lex_utf8(const char *begin, const char *end, struct floc *at, char32_t *pc32)
Lexes a UTF-8 encoded Unicode character from a memory buffer.
size_t lex_c99_long(const char *begin, const char *end, struct floc *at, long *pl)
Lexes a C99 long from a memory buffer.
size_t lex_line_comment(const char *delim, const char *begin, const char *end, struct floc *at)
Lexes a single line-comment (excluding the line break) starting with the specified delimiter from a m...
size_t lex_c99_u8(const char *begin, const char *end, struct floc *at, uint_least8_t *pu8)
Lexes a C99 uint_least8_t from a memory buffer.
size_t lex_c99_flt(const char *begin, const char *end, struct floc *at, float *pf)
Lexes a C99 float from a memory buffer.
size_t lex_c99_esc(const char *begin, const char *end, struct floc *at, char32_t *pc32)
Lexes a C99 character escape sequence from a memory buffer if the buffer begins with '\',...
int isbreak(int c)
Returns 1 if c is a line break character, and 0 otherwise.
size_t lex_c99_u32(const char *begin, const char *end, struct floc *at, uint_least32_t *pu32)
Lexes a C99 uint_least32_t from a memory buffer.
size_t lex_c99_u64(const char *begin, const char *end, struct floc *at, uint_least64_t *pu64)
Lexes a C99 uint_least64_t from a memory buffer.
size_t lex_c99_u16(const char *begin, const char *end, struct floc *at, uint_least16_t *pu16)
Lexes a C99 uint_least16_t from a memory buffer.
size_t lex_c99_dbl(const char *begin, const char *end, struct floc *at, double *pd)
Lexes a C99 double from a memory buffer.
This header file is part of the CANopen library; it contains the network management (NMT) declaration...
#define CO_NMT_ST_PREOP
The NMT state 'pre-operational'.
#define CO_NMT_ST_START
The NMT state 'operational'.
#define CO_NMT_ST_RESET_NODE
The NMT sub-state 'reset application'.
#define CO_NMT_ST_RESET_COMM
The NMT sub-state 'reset communication'.
const char * co_nmt_es2str(char es)
Returns a pointer to a string describing an NMT boot error status.
#define CO_NMT_ST_STOP
The NMT state 'stopped'.
This header file is part of the CANopen library; it contains the Process Data Object (PDO) declaratio...
#define CO_PDO_MAP_PAR_INIT
The static initializer from struct co_pdo_map_par.
#define CO_PDO_COMM_PAR_INIT
The static initializer from struct co_pdo_comm_par.
This header file is part of the utilities library; it contains the printing function declarations.
size_t print_c99_dbl(char **pbegin, char *end, double d)
Prints a C99 double to a memory buffer.
size_t print_char(char **pbegin, char *end, int c)
Prints a single character to a memory buffer.
size_t print_c99_flt(char **pbegin, char *end, float f)
Prints a C99 float to a memory buffer.
size_t print_c99_esc(char **pbegin, char *end, char32_t c32)
Prints a UTF-8 encoded Unicode character to a memory buffer.
size_t print_utf8(char **pbegin, char *end, char32_t c32)
Prints a UTF-8 encoded Unicode character to a memory buffer.
This is the internal header file of the CANopen library.
This header file is part of the C11 and POSIX compatibility library; it includes <stdio....
int asprintf(char **strp, const char *fmt,...)
Equivalent to sprintf(), except that it allocates a string large enough to hold the output,...
int vasprintf(char **strp, const char *fmt, va_list ap)
Equivalent to vsprintf(), except that it allocates a string large enough to hold the output,...
This header file is part of the C11 and POSIX compatibility library; it includes <stdlib....
This header file is part of the C11 and POSIX compatibility library; it includes <strings....
int iec
The last internal error code.
co_gw_txt_recv_func_t * recv_func
A pointer to the callback function invoked by co_gw_txt_recv().
size_t pending
The number of pending requests.
void * send_data
A pointer to the user-specified data for send_func.
void * recv_data
A pointer to the user-specified data for recv_func.
co_gw_txt_send_func_t * send_func
A pointer to the callback function invoked by co_gw_txt_send().
The parameters of a Lely-specific gateway 'LSS Slowscan/Fastscan' confirmation.
struct co_id id
The LSS address.
The parameters of a CANopen gateway 'Get version' confirmation.
co_unsigned32_t product_code
The product code.
int srv
The service number (CO_GW_SRV_GET_VERSION).
co_unsigned8_t gw_class
The gateway class.
co_unsigned8_t prot_hi
The protocol version (high number).
co_unsigned32_t revision
The revision number.
co_unsigned8_t prot_lo
The protocol version (low number).
co_unsigned32_t vendor_id
The vendor-ID.
co_unsigned32_t serial_nr
The serial number.
The parameters of a CANopen gateway 'LSS inquire node-ID' confirmation.
co_unsigned8_t id
The node-ID.
int srv
The service number (CO_GW_SRV_LSS_GET_ID).
The parameters of a CANopen gateway 'Inquire LSS address' confirmation.
co_unsigned32_t id
The LSS number.
int srv
The service number (CO_GW_SRV_LSS_GET_LSSID).
The parameters of a CANopen gateway 'Read PDO' confirmation.
co_unsigned8_t n
Number of mapped objects in PDO.
co_unsigned16_t net
The network-ID.
int srv
The service number (CO_GW_SRV_PDO_READ).
co_unsigned64_t val[0x40]
An array of object values.
size_t size
The size of this struct (in bytes).
The parameters of a CANopen gateway 'SDO upload' confirmation.
co_unsigned32_t len
The length of the value (in bytes).
co_unsigned16_t type
The data type.
size_t size
The size of this struct (in bytes).
int srv
The service number (CO_GW_SRV_SDO_UP).
uint_least8_t val[1]
The (first byte in the) value.
The common parameters of a CANopen gateway confirmation.
void * data
A pointer to user-specified data.
int iec
The internal error code (0 on success).
int srv
The service number.
size_t size
The size of this struct (in bytes).
co_unsigned32_t ac
The SDO abort code (0 on success).
The parameters of a Lely-specific gateway 'Boot slave process completed' indication.
co_unsigned16_t net
The network-ID.
char es
The error status (in the range ['A'..'O'], or 0 on success).
co_unsigned8_t node
The node-ID.
int srv
The service number (CO_GW_SRV__BOOT).
co_unsigned8_t st
The the state of the node (including the toggle bit).
The parameters of a CANopen gateway 'Error control event received' indication.
co_unsigned8_t node
The node-ID.
int iec
The internal error code (0 on success).
int srv
The service number (CO_GW_SRV_EC).
co_unsigned16_t net
The network-ID.
co_unsigned8_t st
The state of the node, or 0 in case of a boot-up event.
The parameters of a CANopen gateway 'Emergency event received' indication.
int srv
The service number (CO_GW_SRV_EMCY).
co_unsigned16_t net
The network-ID.
co_unsigned16_t ec
The emergency error code.
co_unsigned8_t msef[5]
The manufacturer-specific error code.
co_unsigned8_t er
The error register.
co_unsigned8_t node
The node-ID.
The parameters of a CANopen gateway 'RPDO received' indication.
size_t size
The size of this struct (in bytes).
co_unsigned16_t net
The network-ID.
co_unsigned8_t n
Number of mapped objects in PDO.
co_unsigned64_t val[0x40]
An array of object values.
co_unsigned16_t num
The PDO number.
int srv
The service number (CO_GW_SRV_RPDO).
The parameters of a CANopen gateway 'CiA 301 progress indication download' indication.
co_unsigned32_t nbyte
The transferred bytes.
co_unsigned16_t net
The network-ID.
int srv
The service number (CO_GW_SRV_SDO).
co_unsigned8_t node
The node-ID.
unsigned int up
The transfer direction: download (0) or upload (1).
The parameters of a Lely-specific gateway 'LSS Slowscan/Fastscan' request.
size_t size
The size of this struct (in bytes).
struct co_id id_2
In case of an LSS Slowscan request, the upper bound of the LSS address; in case of an LSS Fastscan re...
struct co_id id_1
In case of an LSS Slowscan request, the lower bound of the LSS address; in case of an LSS Fastscan re...
void * data
A pointer to user-specified data.
int srv
The service number (CO_GW_SRV__LSS_SLOWSCAN or CO_GW_SRV__LSS_FASTSCAN).
co_unsigned16_t net
The network-ID.
The parameters of a CANopen gateway 'Initialize gateway' request.
int srv
The service number (CO_GW_SRV_INIT).
co_unsigned16_t net
The network-ID.
size_t size
The size of this struct (in bytes).
void * data
A pointer to user-specified data.
co_unsigned8_t bitidx
The bit timing index (in the range [0..9]).
The parameters of a CANopen gateway 'Inquire LSS address' request.
co_unsigned8_t cs
The command specifier (one of 0x5a, 0x5b, 0x5c or 0x5d).
int srv
The service number (CO_GW_SRV_LSS_GET_LSSID).
size_t size
The size of this struct (in bytes).
co_unsigned16_t net
The network-ID.
void * data
A pointer to user-specified data.
The parameters of a CANopen gateway 'LSS identify remote slave' request.
void * data
A pointer to user-specified data.
size_t size
The size of this struct (in bytes).
int srv
The service number (CO_GW_SRV_LSS_ID_SLAVE).
struct co_id lo
The lower bound of the LSS address.
co_unsigned16_t net
The network-ID.
struct co_id hi
The upper bound of the LSS address.
The parameters of a CANopen gateway 'LSS configure bit-rate' request.
co_unsigned8_t bitsel
The bit timing selector.
void * data
A pointer to user-specified data.
size_t size
The size of this struct (in bytes).
int srv
The service number (CO_GW_SRV_LSS_SET_RATE).
co_unsigned16_t net
The network-ID.
co_unsigned8_t bitidx
The bit timing index.
The parameters of a CANopen gateway 'LSS activate new bit-rate' request.
int srv
The service number (CO_GW_SRV_LSS_SWITCH_RATE).
co_unsigned16_t delay
The delay (in milliseconds).
void * data
A pointer to user-specified data.
size_t size
The size of this struct (in bytes).
co_unsigned16_t net
The network-ID.
The parameters of a CANopen gateway 'LSS switch state selective' request.
void * data
A pointer to user-specified data.
size_t size
The size of this struct (in bytes).
co_unsigned16_t net
The network-ID.
int srv
The service number (CO_GW_SRV_LSS_SWITCH_SEL).
The parameters of a CANopen gateway 'LSS switch state global' request.
size_t size
The size of this struct (in bytes).
int srv
The service number (CO_GW_SRV_LSS_SWITCH).
co_unsigned8_t mode
0 for waiting state, 1 for configuration state.
co_unsigned16_t net
The network-ID.
void * data
A pointer to user-specified data.
The common parameters of a CANopen gateway network-level request.
int srv
The service number.
size_t size
The size of this struct (in bytes).
co_unsigned16_t net
The network-ID.
void * data
A pointer to user-specified data.
The parameters of a CANopen gateway 'Start heartbeat consumer' request.
int srv
The service number (CO_GW_SRV_NMT_HB_ENABLE).
co_unsigned16_t net
The network-ID.
size_t size
The size of this struct (in bytes).
void * data
A pointer to user-specified data.
co_unsigned8_t node
The node-ID.
co_unsigned16_t ms
The heartbeat time (in milliseconds).
The parameters of a CANopen gateway 'Enable node guarding' request.
co_unsigned8_t node
The node-ID.
co_unsigned16_t net
The network-ID.
co_unsigned8_t ltf
The lifetime factor.
size_t size
The size of this struct (in bytes).
void * data
A pointer to user-specified data.
co_unsigned16_t gt
The guard time (in milliseconds).
int srv
The service number (CO_GW_SRV_NMT_NG_ENABLE).
The common parameters of a CANopen gateway node-level request.
void * data
A pointer to user-specified data.
co_unsigned16_t net
The network-ID.
co_unsigned8_t node
The node-ID.
size_t size
The size of this struct (in bytes).
int srv
The service number.
The parameters of a CANopen gateway 'Read PDO' request.
co_unsigned16_t num
The PDO number.
co_unsigned16_t net
The network-ID.
void * data
A pointer to user-specified data.
int srv
The service number (CO_GW_SRV_PDO_READ).
size_t size
The size of this struct (in bytes).
The parameters of a CANopen gateway 'Write PDO' request.
co_unsigned8_t n
Number of mapped objects in PDO.
void * data
A pointer to user-specified data.
co_unsigned16_t num
The PDO number.
co_unsigned16_t net
The network-ID.
size_t size
The size of this struct (in bytes).
int srv
The service number (CO_GW_SRV_PDO_WRITE).
co_unsigned64_t val[0x40]
An array of object values.
The parameters of a CANopen gateway 'SDO download' request.
co_unsigned16_t net
The network-ID.
co_unsigned16_t idx
The object index.
void * data
A pointer to user-specified data.
size_t size
The size of this struct (in bytes).
co_unsigned8_t subidx
The object sub-index.
co_unsigned8_t node
The node-ID.
uint_least8_t val[1]
The (first byte in the) value.
int srv
The service number (CO_GW_SRV_SDO_DN).
The parameters of a CANopen gateway 'SDO upload' request.
size_t size
The size of this struct (in bytes).
co_unsigned8_t node
The node-ID.
void * data
A pointer to user-specified data.
co_unsigned8_t subidx
The object sub-index.
co_unsigned16_t idx
The object index.
int srv
The service number (CO_GW_SRV_SDO_UP).
co_unsigned16_t type
The data type.
co_unsigned16_t net
The network-ID.
The parameters of a CANopen gateway 'Boot-up forwarding' request.
co_unsigned16_t net
The network-ID.
int srv
The service number (CO_GW_SRV_SET_BOOTUP_IND).
unsigned cs
A flag indicating whether "boot-up event received" commands should be forwarded (1) or not (0).
void * data
A pointer to user-specified data.
size_t size
The size of this struct (in bytes).
The parameters of a CANopen gateway 'Set command size' request.
int srv
The service number (CO_GW_SRV_SET_CMD_TIMEOUT).
co_unsigned32_t n
The command size (in bytes).
size_t size
The size of this struct (in bytes).
void * data
A pointer to user-specified data.
The parameters of a CANopen gateway 'Set command time-out' request.
int srv
The service number (CO_GW_SRV_SET_CMD_TIMEOUT).
void * data
A pointer to user-specified data.
int timeout
The command timeout (in milliseconds).
size_t size
The size of this struct (in bytes).
The parameters of a CANopen gateway 'Set heartbeat producer' request.
co_unsigned16_t ms
The heartbeat time (in milliseconds).
size_t size
The size of this struct (in bytes).
co_unsigned16_t net
The network-ID.
void * data
A pointer to user-specified data.
int srv
The service number (CO_GW_SRV_SET_HB).
The parameters of a CANopen gateway 'Configure RPDO' request.
size_t size
The size of this struct (in bytes).
int srv
The service number (CO_GW_SRV_SET_RPDO).
co_unsigned32_t cobid
The COB-ID.
co_unsigned32_t map[0x40]
An array of objects to be mapped.
co_unsigned16_t num
The PDO number.
co_unsigned16_t net
The network-ID.
void * data
A pointer to user-specified data.
The parameters of a CANopen gateway 'Configure SDO time-out' request.
int timeout
The SDO timeout (in milliseconds).
void * data
A pointer to user-specified data.
int srv
The service number (CO_GW_SRV_SET_SDO_TIMEOUT).
size_t size
The size of this struct (in bytes).
co_unsigned16_t net
The network-ID.
The parameters of a CANopen gateway 'Configure TPDO' request.
co_unsigned32_t map[0x40]
An array of objects to be mapped.
int srv
The service number (CO_GW_SRV_SET_TPDO).
void * data
A pointer to user-specified data.
co_unsigned16_t net
The network-ID.
co_unsigned32_t cobid
The COB-ID.
co_unsigned16_t num
The PDO number.
size_t size
The size of this struct (in bytes).
The common parameters of a CANopen gateway request.
The common parameters of a CANopen gateway service.
size_t size
The size of this struct (in bytes).
int srv
The service number.
co_unsigned32_t product_code
Product code.
co_unsigned32_t revision
Revision number.
co_unsigned32_t vendor_id
Vendor-ID.
co_unsigned32_t serial_nr
Serial number.
A PDO communication parameter record.
co_unsigned8_t sync
SYNC start value.
co_unsigned16_t inhibit
Inhibit time.
co_unsigned16_t event
Event timer.
co_unsigned32_t cobid
COB-ID.
co_unsigned8_t trans
Transmission type.
A PDO mapping parameter record.
co_unsigned8_t n
Number of mapped objects in PDO.
co_unsigned32_t map[0x40]
An array of objects to be mapped.
A location in a text file.
int column
The column number (starting from 1).
A node in a pairing heap.
#define CO_DEFTYPE_UNICODE_STRING
The data type (and object index) of an array of (16-bit) Unicode characters.
#define CO_DEFTYPE_UNSIGNED16
The data type (and object index) of a 16-bit unsigned integer.
#define CO_DEFTYPE_INTEGER24
The data type (and object index) of a 24-bit signed integer.
#define CO_DEFTYPE_UNSIGNED48
The data type (and object index) of a 48-bit unsigned integer.
#define CO_DEFTYPE_INTEGER48
The data type (and object index) of a 48-bit signed integer.
#define CO_DEFTYPE_VISIBLE_STRING
The data type (and object index) of an array of visible characters.
#define CO_DEFTYPE_UNSIGNED40
The data type (and object index) of a 40-bit unsigned integer.
#define CO_DEFTYPE_INTEGER56
The data type (and object index) of a 56-bit signed integer.
#define CO_DEFTYPE_UNSIGNED64
The data type (and object index) of a 64-bit unsigned integer.
#define CO_DEFTYPE_INTEGER8
The data type (and object index) of an 8-bit signed integer.
#define CO_DEFTYPE_DOMAIN
The data type (and object index) of an arbitrary large block of data.
#define CO_DEFTYPE_UNSIGNED24
The data type (and object index) of a 24-bit unsigned integer.
#define CO_DEFTYPE_UNSIGNED8
The data type (and object index) of an 8-bit unsigned integer.
#define CO_DEFTYPE_REAL64
The data type (and object index) of a 64-bit IEEE-754 floating-point number.
#define CO_DEFTYPE_BOOLEAN
The data type (and object index) of a boolean truth value.
#define CO_DEFTYPE_INTEGER40
The data type (and object index) of a 40-bit signed integer.
#define CO_DEFTYPE_TIME_OF_DAY
The data type (and object index) of a 48-bit structure representing the absolute time.
size_t co_type_sizeof(co_unsigned16_t type)
Returns the native size (in bytes) of a value of the specified data type, or 0 if it is not a static ...
#define CO_DEFTYPE_INTEGER32
The data type (and object index) of a 32-bit signed integer.
#define CO_DEFTYPE_INTEGER64
The data type (and object index) of a 64-bit signed integer.
#define CO_DEFTYPE_UNSIGNED56
The data type (and object index) of a 56-bit unsigned integer.
#define CO_DEFTYPE_UNSIGNED32
The data type (and object index) of a 32-bit unsigned integer.
#define CO_DEFTYPE_INTEGER16
The data type (and object index) of a 16-bit signed integer.
#define CO_DEFTYPE_OCTET_STRING
The data type (and object index) of an array of octets.
int co_type_is_basic(co_unsigned16_t type)
Returns 1 if the specified (static) data type is a basic type, and 0 if not.
#define CO_DEFTYPE_REAL32
The data type (and object index) of a 32-bit IEEE-754 floating-point number.
#define CO_DEFTYPE_TIME_DIFF
The data type (and object index) of a 48-bit structure representing a time difference.
A union of the CANopen static data types.
This header file is part of the CANopen library; it contains the CANopen value declarations.
size_t co_val_read(co_unsigned16_t type, void *val, const uint_least8_t *begin, const uint_least8_t *end)
Reads a value of the specified data type from a memory buffer.
int co_val_init(co_unsigned16_t type, void *val)
Initializes a value of the specified data type to zero.
size_t co_val_write(co_unsigned16_t type, const void *val, uint_least8_t *begin, uint_least8_t *end)
Writes a value of the specified data type to a memory buffer.
int co_val_init_vs_n(char **val, const char *vs, size_t n)
Initializes an array of visible characters (CO_DEFTYPE_VISIBLE_STRING).
size_t co_val_print(co_unsigned16_t type, const void *val, char **pbegin, char *end)
Prints a value of the specified data type to a memory buffer.
void co_val_fini(co_unsigned16_t type, void *val)
Finalizes a value of the specified data type.
size_t co_val_lex(co_unsigned16_t type, void *val, const char *begin, const char *end, struct floc *at)
Lexes a value of the specified data type from a memory buffer.