33#ifndef PROTOCORE_DEVICENET_H
34#define PROTOCORE_DEVICENET_H
38#if PROTOCORE_ENABLE_DEVICENET
47#define DEVICENET_G1_BASE 0x000u
48#define DEVICENET_G2_BASE 0x400u
49#define DEVICENET_G3_BASE 0x600u
50#define DEVICENET_G4_BASE 0x7C0u
51#define DEVICENET_MAC_MASK 0x3Fu
54#define DEVICENET_G2_UNCONNECTED_EXPLICIT_REQ 4u
55#define DEVICENET_G2_EXPLICIT_RESPONSE 3u
56#define DEVICENET_G2_POLL_COMMAND 5u
57#define DEVICENET_G2_DUP_MAC_CHECK 7u
60#define DEVICENET_HDR_FRAG 0x80u
61#define DEVICENET_HDR_XID 0x40u
64#define DEVICENET_FRAG_FIRST 0x00u
65#define DEVICENET_FRAG_MIDDLE 0x40u
66#define DEVICENET_FRAG_LAST 0x80u
67#define DEVICENET_FRAG_ACK 0xC0u
68#define DEVICENET_FRAG_TYPE_MASK 0xC0u
69#define DEVICENET_FRAG_COUNT_MASK 0x3Fu
74 DEVICENET_GROUP_1 = 1,
75 DEVICENET_GROUP_2 = 2,
76 DEVICENET_GROUP_3 = 3,
77 DEVICENET_GROUP_4 = 4,
91 DEVICENET_FRAG_IGNORED = 0,
92 DEVICENET_FRAG_STARTED,
93 DEVICENET_FRAG_PROGRESS,
94 DEVICENET_FRAG_COMPLETE,
104 uint8_t buf[PROTOCORE_DEVICENET_MSG_MAX];
113 DeviceNetGroup group;
116} DevicenetEncodeIdArgs;
123} DevicenetDecodeIdArgs;
131} DevicenetMsgHeaderArgs;
138} DevicenetFragOctetArgs;
144 DeviceNetGroup group;
149} DevicenetBuildExplicitArgs;
155 DeviceNetGroup group;
163} DevicenetBuildFragmentArgs;
169} DevicenetFragResetArgs;
177} DevicenetFragFeedArgs;
219 DevicenetEncodeIdArgs encode_id_args;
220 DevicenetDecodeIdArgs decode_id_args;
221 DevicenetMsgHeaderArgs msg_header_args;
222 DevicenetFragOctetArgs frag_octet_args;
223 DevicenetBuildExplicitArgs build_explicit_args;
224 DevicenetBuildFragmentArgs build_fragment_args;
225 DevicenetFragResetArgs frag_reset_args;
226 DevicenetFragFeedArgs frag_feed_args;
229 DeviceNetFragResult frag;
233extern DevicenetVars DevicenetV;
238 void (*
const encode_id)(uint8_t *work);
239 void (*
const decode_id)(uint8_t *work);
240 void (*
const msg_header)(uint8_t *work);
241 void (*
const frag_octet)(uint8_t *work);
242 void (*
const build_explicit)(uint8_t *work);
243 void (*
const build_fragment)(uint8_t *work);
244 void (*
const frag_reset)(uint8_t *work);
245 void (*
const frag_feed)(uint8_t *work);
250void protocore_devicenet_encode_id(uint8_t *work);
251void protocore_devicenet_decode_id(uint8_t *work);
252void protocore_devicenet_msg_header(uint8_t *work);
253void protocore_devicenet_frag_octet(uint8_t *work);
254void protocore_devicenet_build_explicit(uint8_t *work);
255void protocore_devicenet_build_fragment(uint8_t *work);
256void protocore_devicenet_frag_reset(uint8_t *work);
257void protocore_devicenet_frag_feed(uint8_t *work);
263static const DevicenetNs Devicenet __attribute__((unused)) = {
264 .encode_id = protocore_devicenet_encode_id,
265 .decode_id = protocore_devicenet_decode_id,
266 .msg_header = protocore_devicenet_msg_header,
267 .frag_octet = protocore_devicenet_frag_octet,
268 .build_explicit = protocore_devicenet_build_explicit,
269 .build_fragment = protocore_devicenet_build_fragment,
270 .frag_reset = protocore_devicenet_frag_reset,
271 .frag_feed = protocore_devicenet_frag_feed,
PROTO_ENUM_PACKED
Application protocol spoken on a listener port or connection slot.
Shared CAN 2.0 frame type for the CAN-based industrial codecs (one source of truth).
#define PROTOCORE_BEGIN_DECLS
Give a header's declarations C linkage, so their symbol names carry no parameter types.
_Bool proto_bool
The truth value.
#define PROTOCORE_END_DECLS