26 #if !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)
308 __co_gw_txt_free(
void *ptr)
347 if (!__co_gw_txt_init(gw)) {
355 __co_gw_txt_free(gw);
365 __co_gw_txt_fini(gw);
366 __co_gw_txt_free(gw);
393 if (srv->
size <
sizeof(*srv)) {
441 co_unsigned32_t seq = (uintptr_t)con->
data;
503 assert(!end || end >= begin);
514 const char *cp = begin;
526 if ((end && cp >= end) || !*cp)
529 co_unsigned32_t seq = 0;
530 co_unsigned16_t net = 0;
531 co_unsigned8_t node = 0xff;
535 void *data = (
void *)(uintptr_t)seq;
549 "node-ID specified before global command");
554 "network-ID specified before global command");
583 "node-ID specified before network-level command");
586 net = node == 0xff ? 0 : node;
597 gw, srv, data, net, node, cp, end,
floc);
601 gw, srv, data, net, node, cp, end,
floc);
605 gw, srv, data, net, cp, end,
floc);
609 gw, srv, data, net, cp, end,
floc);
613 gw, srv, data, net, cp, end,
floc);
617 gw, srv, data, net, cp, end,
floc);
621 gw, srv, data, net, cp, end,
floc);
740 if ((!end || cp < end) && *cp && !
isbreak((
unsigned char)*cp))
742 "expected line break after request");
749 while ((!end || cp + chars < end) && cp[chars] && cp[chars++] !=
'\n')
801 if (con->
iec || con->
ac)
865 const uint_least8_t *bp = con->
val;
872 char *buf = malloc(chars + 1);
912 &buf,
"[%" PRIu32
"] %u pdo %u", seq, con->
net, con->
n);
919 for (co_unsigned8_t i = 0; i < con->
n; i++) {
921 result =
asprintf(&tmp,
"%s 0x%" PRIx64, buf, con->
val[i]);
946 "[%" PRIu32
"] %" PRIu32
" %" PRIu32
" %u.%u %" PRIu32
949 (uint_least16_t)((con->
revision >> 16) & 0xffff),
950 (uint_least16_t)(con->
revision & 0xffff),
963 gw,
"[%" PRIu32
"] 0x%08" PRIx32, seq, con->
id);
983 "[%" PRIu32
"] 0x%08" PRIx32
" 0x%08" PRIx32
984 " 0x%08" PRIx32
" 0x%08" PRIx32,
1000 "[%" PRIu32
"] ERROR: %08" PRIX32
" (%s)", seq,
1021 int result =
asprintf(&buf,
"%u pdo %u %u", ind->
net, ind->
num, ind->
n);
1028 for (co_unsigned8_t i = 0; i < ind->
n; i++) {
1030 result =
asprintf(&tmp,
"%s 0x%" PRIx64, buf, ind->
val[i]);
1055 gw,
"%u %u BOOT_UP", ind->
net, ind->
node);
1064 default: str =
"ERROR";
break;
1072 gw,
"%u %u %s", ind->
net, ind->
node, str);
1114 default: str =
"ERROR";
break;
1125 va_start(ap, format);
1137 int n = vsnprintf(NULL, 0, format, aq);
1142 vsprintf(buf, format, ap);
1166 char **pbegin,
char *end, co_unsigned16_t type,
const void *val)
1168 const union co_val *u = val;
1175 const char *vs = u->vs;
1178 vs +=
lex_utf8(vs, NULL, NULL, &c32);
1198 co_unsigned8_t node,
const char *begin,
const char *end,
1204 const char *cp = begin;
1207 co_unsigned16_t idx = 0;
1208 co_unsigned8_t subidx = 0;
1209 co_unsigned16_t type = 0;
1229 co_unsigned8_t
node,
const char *begin,
const char *end,
1235 const char *cp = begin;
1238 co_unsigned16_t
idx = 0;
1239 co_unsigned8_t
subidx = 0;
1240 co_unsigned16_t
type = 0;
1262 goto error_malloc_req;
1274 uint_least8_t *bp = req->
val;
1277 goto error_write_val;
1298 co_unsigned16_t net,
const char *begin,
const char *end,
1304 const char *cp = begin;
1326 co_unsigned16_t
net,
const char *begin,
const char *end,
1332 const char *cp = begin;
1335 co_unsigned16_t num = 0;
1343 +
map.n *
sizeof(*
map.map),
1349 .trans = comm.
trans,
1351 for (co_unsigned8_t i = 0; i <
map.n; i++)
1360 co_unsigned16_t
net,
const char *begin,
const char *end,
1366 const char *cp = begin;
1371 if ((chars =
lex_char(
'x', cp, end, at))) {
1377 co_unsigned16_t
num = 0;
1385 +
map.n *
sizeof(*
map.map),
1391 .trans = comm.
trans,
1393 .event = comm.
event,
1396 for (co_unsigned8_t i = 0; i <
map.n; i++)
1405 co_unsigned16_t
net,
const char *begin,
const char *end,
1411 const char *cp = begin;
1414 co_unsigned16_t
num = 0;
1422 "PDO number must be in the range [1..512]");
1438 co_unsigned16_t
net,
const char *begin,
const char *end,
1444 const char *cp = begin;
1447 co_unsigned16_t
num = 0;
1456 "PDO number must be in the range [1..512]");
1475 "number of values must be in the range [0..64]");
1479 for (co_unsigned8_t i = 0; i < req.
n; i++) {
1490 req.
size += req.
n *
sizeof(*req.
val);
1498 co_unsigned16_t
net, co_unsigned8_t node,
const char *begin,
1499 const char *end,
struct floc *at)
1504 const char *cp = begin;
1507 co_unsigned16_t gt = 0;
1515 co_unsigned8_t ltf = 0;
1516 if (!(chars =
lex_c99_u8(cp, end, at, <f))) {
1536 co_unsigned16_t
net, co_unsigned8_t
node,
const char *begin,
1537 const char *end,
struct floc *at)
1542 const char *cp = begin;
1545 co_unsigned16_t ms = 0;
1565 const char *begin,
const char *end,
struct floc *at)
1570 const char *cp = begin;
1573 co_unsigned8_t bitidx = 0;
1574 if (!(chars =
lex_c99_u8(cp, end, at, &bitidx))) {
1582 "the bit timing must be in the range [0..9]");
1598 const char *begin,
const char *end,
struct floc *at)
1603 const char *cp = begin;
1606 co_unsigned16_t ms = 0;
1625 const char *begin,
const char *end,
struct floc *at)
1630 const char *cp = begin;
1633 co_unsigned8_t node = 0;
1634 if (!(chars =
lex_c99_u8(cp, end, at, &node))) {
1642 "the node-ID must be in the range [1..%u, 255]",
1659 const char *begin,
const char *end,
struct floc *at)
1664 const char *cp = begin;
1685 co_unsigned16_t net,
const char *begin,
const char *end,
1691 const char *cp = begin;
1697 if (chars && !strncasecmp(
"Disable", cp, chars)) {
1700 }
else if (chars && !strncasecmp(
"Enable", cp, chars)) {
1705 "expected 'Disable' or 'Enable' after 'boot_up_indication'");
1721 const char *end,
struct floc *at)
1726 const char *cp = begin;
1729 co_unsigned16_t
net = 0;
1738 "the network-ID must be in the range [0, 1..%u]",
1753 co_unsigned16_t
net,
const char *begin,
const char *end,
1759 const char *cp = begin;
1762 co_unsigned8_t node = 0;
1763 if (!(chars =
lex_c99_u8(cp, end, at, &node))) {
1771 "the node-ID must be in the range [0, 1..%u]",
1788 const char *begin,
const char *end,
struct floc *at)
1793 const char *cp = begin;
1796 co_unsigned32_t n = 0;
1813 co_unsigned16_t net,
const char *begin,
const char *end,
1819 const char *cp = begin;
1822 co_unsigned8_t mode = 0;
1823 if (!(chars =
lex_c99_u8(cp, end, at, &mode)) || mode > 1) {
1841 co_unsigned16_t
net,
const char *begin,
const char *end,
1847 const char *cp = begin;
1867 co_unsigned16_t
net,
const char *begin,
const char *end,
1873 const char *cp = begin;
1876 co_unsigned8_t node = 0;
1877 if (!(chars =
lex_c99_u8(cp, end, at, &node))) {
1885 "the node-ID must be in the range [1..%u, 255]",
1902 co_unsigned16_t
net,
const char *begin,
const char *end,
1908 const char *cp = begin;
1911 co_unsigned8_t bitsel = 0;
1912 if (!(chars =
lex_c99_u8(cp, end, at, &bitsel))) {
1919 co_unsigned8_t bitidx = 0;
1920 if (!(chars =
lex_c99_u8(cp, end, at, &bitidx))) {
1939 co_unsigned16_t
net,
const char *begin,
const char *end,
1945 const char *cp = begin;
1948 co_unsigned16_t delay = 0;
1949 if (!(chars =
lex_c99_u16(cp, end, at, &delay))) {
1967 co_unsigned16_t
net,
const char *begin,
const char *end,
1973 const char *cp = begin;
1976 co_unsigned8_t cs = 0;
1977 if (!(chars =
lex_c99_u8(cp, end, at, &cs))) {
1982 if (cs < 0x5a || cs > 0x5d) {
1984 "code must be in the range [0x5A..0x5D]");
2000 co_unsigned16_t
net,
const char *begin,
const char *end,
2006 const char *cp = begin;
2028 co_unsigned16_t
net,
const char *begin,
const char *end,
2034 const char *cp = begin;
2056 co_unsigned16_t
net,
const char *begin,
const char *end,
2062 const char *cp = begin;
2145 "unable to send gateway request");
2152 co_unsigned32_t *pseq, co_unsigned16_t *pnet,
2153 co_unsigned8_t *
pnode)
2156 assert(!end || end >= begin);
2158 const char *cp = begin;
2161 if (!(chars =
lex_char(
'[', cp, end, at)))
2163 "expected '[' before sequence number");
2167 co_unsigned32_t seq = 0;
2175 if (!(chars =
lex_char(
']', cp, end, at)))
2177 "expected ']' after sequence number");
2181 co_unsigned16_t
net = 0;
2182 co_unsigned8_t node = 0xff;
2190 if ((chars =
lex_c99_u8(cp, end, at, &node))) {
2196 "the network-ID must be in the range [1..%u]",
2203 "the node-ID must be in the range [0..%u]",
2210 "the node-ID must be in the range [0..%u]",
2233 const char *begin,
const char *end,
struct floc *at,
int *psrv)
2236 assert(!end || end >= begin);
2238 const char *cp = begin;
2251 if (!strncasecmp(
"_lss_fastscan", cp, chars)) {
2254 }
else if (!strncasecmp(
"_lss_slowscan", cp, chars)) {
2257 }
else if (!strncasecmp(
"boot_up_indication", cp, chars)) {
2260 }
else if (!strncasecmp(
"disable", cp, chars)) {
2265 if (chars && !strncasecmp(
"guarding", cp, chars)) {
2268 }
else if (chars && !strncasecmp(
"heartbeat", cp, chars)) {
2273 "expected 'guarding' or 'heartbeat'");
2276 }
else if (!strncasecmp(
"enable", cp, chars)) {
2281 if (chars && !strncasecmp(
"guarding", cp, chars)) {
2284 }
else if (chars && !strncasecmp(
"heartbeat", cp, chars)) {
2289 "expected 'guarding' or 'heartbeat'");
2292 }
else if (!strncasecmp(
"info", cp, chars)) {
2297 if (chars && !strncasecmp(
"version", cp, chars)) {
2304 }
else if (!strncasecmp(
"init", cp, chars)) {
2307 }
else if (!strncasecmp(
"lss_activate_bitrate", cp, chars)) {
2310 }
else if (!strncasecmp(
"lss_conf_bitrate", cp, chars)) {
2313 }
else if (!strncasecmp(
"lss_get_node", cp, chars)) {
2316 }
else if (!strncasecmp(
"lss_identity", cp, chars)) {
2319 }
else if (!strncasecmp(
"lss_ident_nonconf", cp, chars)) {
2322 }
else if (!strncasecmp(
"lss_inquire_addr", cp, chars)) {
2325 }
else if (!strncasecmp(
"lss_set_node", cp, chars)) {
2328 }
else if (!strncasecmp(
"lss_store", cp, chars)) {
2331 }
else if (!strncasecmp(
"lss_switch_glob", cp, chars)) {
2334 }
else if (!strncasecmp(
"lss_switch_sel", cp, chars)) {
2337 }
else if (!strncasecmp(
"preop", cp, chars)
2338 || !strncasecmp(
"preoperational", cp, chars)) {
2341 }
else if (!strncasecmp(
"r", cp, chars)
2342 || !strncasecmp(
"read", cp, chars)) {
2347 if (!strncasecmp(
"p", cp, chars)
2348 || !strncasecmp(
"pdo", cp, chars)) {
2358 }
else if (!strncasecmp(
"reset", cp, chars)) {
2364 if (chars && (!strncasecmp(
"comm", cp, chars)
2365 || !strncasecmp(
"communication", cp, chars))) {
2369 }
else if (chars && !strncasecmp(
"node", cp, chars)) {
2374 "expected 'node' or 'comm[unication]'");
2377 }
else if (!strncasecmp(
"set", cp, chars)) {
2382 if (chars && !strncasecmp(
"command_size", cp, chars)) {
2386 && !strncasecmp(
"command_timeout", cp, chars)) {
2389 }
else if (chars && !strncasecmp(
"heartbeat", cp, chars)) {
2392 }
else if (chars && !strncasecmp(
"id", cp, chars)) {
2395 }
else if (chars && !strncasecmp(
"network", cp, chars)) {
2398 }
else if (chars && !strncasecmp(
"node", cp, chars)) {
2401 }
else if (chars && !strncasecmp(
"rpdo", cp, chars)) {
2404 }
else if (chars && !strncasecmp(
"sdo_timeout", cp, chars)) {
2407 }
else if (chars && !strncasecmp(
"tpdo", cp, chars)) {
2410 }
else if (chars && !strncasecmp(
"tpdox", cp, chars)) {
2418 "expected 'command_size', 'command_timeout', 'heartbeat', 'id', 'network', 'node', 'rpdo', 'sdo_timeout' or 'tpdo[x]'");
2421 }
else if (!strncasecmp(
"start", cp, chars)) {
2424 }
else if (!strncasecmp(
"stop", cp, chars)) {
2427 }
else if (!strncasecmp(
"w", cp, chars)
2428 || !strncasecmp(
"write", cp, chars)) {
2433 if (!strncasecmp(
"p", cp, chars)
2434 || !strncasecmp(
"pdo", cp, chars)) {
2446 "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]'");
2460 assert(!end || end >= begin);
2462 const char *cp = begin;
2464 if ((end && cp >= end) || !(*cp ==
'_' || isalpha((
unsigned char)*cp)))
2468 while ((!end || cp < end)
2469 && (*cp ==
'_' || isalnum((
unsigned char)*cp)))
2477 co_unsigned16_t *pidx, co_unsigned8_t *psubidx,
2478 co_unsigned16_t *ptype)
2482 const char *cp = begin;
2492 if (!(chars =
lex_c99_u8(cp, end, at, psubidx))) {
2513 const char *cp = begin;
2516 co_unsigned16_t num = 0;
2523 if (!num || num > 512) {
2525 "PDO number must be in the range [1..512]");
2543 if (ext && comm.
trans >= 0xfe) {
2552 if (ext && comm.
trans >= 0xfd) {
2559 }
else if (ext && comm.
trans <= 240) {
2577 "number of mapped values must be in the range [0..64]");
2581 for (co_unsigned8_t i = 0; i <
map.n; i++) {
2584 co_unsigned16_t idx = 0;
2585 co_unsigned8_t subidx = 0;
2594 "expected object sub-index");
2601 co_unsigned16_t type = 0;
2608 "only basic types can be mapped to PDOs");
2615 map.map[i] = ((co_unsigned32_t)(idx ? idx : type) << 16)
2616 | ((co_unsigned32_t)subidx << 8) | len;
2627 for (co_unsigned8_t i = 0; i <
map.n; i++)
2628 pmap->
map[i] =
map.map[i];
2636 co_unsigned16_t *ptype)
2640 const char *cp = begin;
2643 co_unsigned16_t type = 0;
2646 if (chars && !strncasecmp(
"b", cp, chars)) {
2648 }
else if (chars && !strncasecmp(
"d", cp, chars)) {
2650 }
else if (chars && !strncasecmp(
"i16", cp, chars)) {
2652 }
else if (chars && !strncasecmp(
"i24", cp, chars)) {
2654 }
else if (chars && !strncasecmp(
"i32", cp, chars)) {
2656 }
else if (chars && !strncasecmp(
"i40", cp, chars)) {
2658 }
else if (chars && !strncasecmp(
"i48", cp, chars)) {
2660 }
else if (chars && !strncasecmp(
"i56", cp, chars)) {
2662 }
else if (chars && !strncasecmp(
"i64", cp, chars)) {
2664 }
else if (chars && !strncasecmp(
"i8", cp, chars)) {
2666 }
else if (chars && !strncasecmp(
"os", cp, chars)) {
2668 }
else if (chars && !strncasecmp(
"r32", cp, chars)) {
2670 }
else if (chars && !strncasecmp(
"r64", cp, chars)) {
2672 }
else if (chars && !strncasecmp(
"t", cp, chars)) {
2674 }
else if (chars && !strncasecmp(
"td", cp, chars)) {
2676 }
else if (chars && !strncasecmp(
"u16", cp, chars)) {
2678 }
else if (chars && !strncasecmp(
"u24", cp, chars)) {
2680 }
else if (chars && !strncasecmp(
"u32", cp, chars)) {
2682 }
else if (chars && !strncasecmp(
"u40", cp, chars)) {
2684 }
else if (chars && !strncasecmp(
"u48", cp, chars)) {
2686 }
else if (chars && !strncasecmp(
"u56", cp, chars)) {
2688 }
else if (chars && !strncasecmp(
"u64", cp, chars)) {
2690 }
else if (chars && !strncasecmp(
"u8", cp, chars)) {
2692 }
else if (chars && !strncasecmp(
"us", cp, chars)) {
2694 }
else if (chars && !strncasecmp(
"vs", cp, chars)) {
2710 co_unsigned16_t type,
void *val)
2713 assert(!end || end >= begin);
2718 const char *cp = begin;
2721 if (!(chars =
lex_char(
'\"', cp, end, at)))
2723 "expected '\"' before string");
2731 "unable to create value of type VISIBLE_STRING");
2735 char *vs = *(
void **)val;
2741 if (!(chars =
lex_char(
'\"', cp, end, at)))
2743 "expected '\"' after string");
2751 default:
return co_val_lex(type, val, begin, end, at);
2768 const char *cp = begin;
2772 char *ends = s + (s && pn ? *pn : 0);
2774 while ((!end || cp < end) && *cp && !
isbreak((
unsigned char)*cp)) {
2777 if ((end && cp + 1 >= end) || cp[1] !=
'\"')
2781 }
else if (*cp ==
'\\') {
2801 co_unsigned8_t *ptrans)
2805 const char *cp = begin;
2814 co_unsigned8_t trans = 0;
2816 if (!strncasecmp(
"event", cp, 5)) {
2821 }
else if (!strncasecmp(
"rtr", cp, chars)) {
2824 }
else if (!strncasecmp(
"sync", cp, 4)) {
2828 if (!(chars =
lex_c99_u8(cp, end, at, &trans))) {
2835 "SYNC period must be in the range [0..240]");
2840 "expected 'event', 'rtr' or 'sync<0..240>'");
2856 const char *cp = begin;
2900 const char *cp = begin;
2919 struct co_id hi = lo;
2923 "expected lower bound for revision number");
2931 "expected upper bound for revision number");
2939 "expected lower bound for serial number");
2947 "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[CO_PDO_NUM_MAPS]
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 1 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.