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
72EMBED_ENUM_BYTE(DeviceNetGroup, DEVICENET_GROUP_1 = 1, DEVICENET_GROUP_2 = 2, DEVICENET_GROUP_3 = 3,
73 DEVICENET_GROUP_4 = 4, );
84EMBED_ENUM_BYTE(DeviceNetFragResult, DEVICENET_FRAG_IGNORED = 0, DEVICENET_FRAG_STARTED, DEVICENET_FRAG_PROGRESS,
85 DEVICENET_FRAG_COMPLETE, DEVICENET_FRAG_ERR, );
93 uint8_t buf[PROTOCORE_DEVICENET_MSG_MAX];
102 DeviceNetGroup group;
105} DevicenetEncodeIdArgs;
112} DevicenetDecodeIdArgs;
120} DevicenetMsgHeaderArgs;
127} DevicenetFragOctetArgs;
133 DeviceNetGroup group;
138} DevicenetBuildExplicitArgs;
144 DeviceNetGroup group;
152} DevicenetBuildFragmentArgs;
158} DevicenetFragResetArgs;
166} DevicenetFragFeedArgs;
208 DevicenetEncodeIdArgs encode_id_args;
209 DevicenetDecodeIdArgs decode_id_args;
210 DevicenetMsgHeaderArgs msg_header_args;
211 DevicenetFragOctetArgs frag_octet_args;
212 DevicenetBuildExplicitArgs build_explicit_args;
213 DevicenetBuildFragmentArgs build_fragment_args;
214 DevicenetFragResetArgs frag_reset_args;
215 DevicenetFragFeedArgs frag_feed_args;
218 DeviceNetFragResult frag;
222extern DevicenetVars DevicenetV;
227 void (*
const encode_id)(
const uint8_t *work);
228 void (*
const decode_id)(
const uint8_t *work);
229 void (*
const msg_header)(
const uint8_t *work);
230 void (*
const frag_octet)(
const uint8_t *work);
231 void (*
const build_explicit)(
const uint8_t *work);
232 void (*
const build_fragment)(
const uint8_t *work);
233 void (*
const frag_reset)(
const uint8_t *work);
234 void (*
const frag_feed)(
const uint8_t *work);
239void protocore_devicenet_encode_id(
const uint8_t *work);
240void protocore_devicenet_decode_id(
const uint8_t *work);
241void protocore_devicenet_msg_header(
const uint8_t *work);
242void protocore_devicenet_frag_octet(
const uint8_t *work);
243void protocore_devicenet_build_explicit(
const uint8_t *work);
244void protocore_devicenet_build_fragment(
const uint8_t *work);
245void protocore_devicenet_frag_reset(
const uint8_t *work);
246void protocore_devicenet_frag_feed(
const uint8_t *work);
252static const DevicenetNs Devicenet __attribute__((unused)) = {
253 .encode_id = protocore_devicenet_encode_id,
254 .decode_id = protocore_devicenet_decode_id,
255 .msg_header = protocore_devicenet_msg_header,
256 .frag_octet = protocore_devicenet_frag_octet,
257 .build_explicit = protocore_devicenet_build_explicit,
258 .build_fragment = protocore_devicenet_build_fragment,
259 .frag_reset = protocore_devicenet_frag_reset,
260 .frag_feed = protocore_devicenet_frag_feed,
EMBED_ENUM_BYTE(ProtoConn, PROTO_NONE=0, PROTO_HTTP=1, PROTO_TELNET=2, PROTO_SSH=3, PROTO_MODBUS=4, PROTO_OPCUA=5, PROTO_SSH_RFWD=6, PROTO_RELAY=7, PROTO_BRIDGE=8, PROTO_NTRIP_CASTER=9, PROTO_MESH=10, PROTO_UDP=11,)
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).