Skip to content

Commit 92a5c48

Browse files
committed
Add first draft ethernet support
1 parent bfa17fd commit 92a5c48

File tree

5 files changed

+1740
-0
lines changed

5 files changed

+1740
-0
lines changed

tm4c129x-hal/Cargo.toml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,15 @@ repository = "https://github.com/thejpster/tm4c-hal/tm4c129x-hal"
1515
edition = "2018"
1616

1717
[dependencies]
18+
bare-metal = "*"
1819
cortex-m = "0.5"
1920
nb = "0.1"
2021
tm4c129x = "0.7"
2122

23+
[dependencies.byteorder]
24+
version = "1"
25+
default-features = false
26+
2227
[dependencies.cast]
2328
version = "0.2"
2429
default-features = false
@@ -27,6 +32,17 @@ default-features = false
2732
version = "0.2"
2833
features = ["unproven"]
2934

35+
[dependencies.smoltcp]
36+
git = "https://github.com/m-labs/smoltcp"
37+
default_features = false
38+
features = [
39+
"proto-ipv4",
40+
"proto-ipv6",
41+
"socket-raw",
42+
"socket-udp",
43+
"socket-tcp",
44+
]
45+
3046
[dependencies.void]
3147
version = "1.0"
3248
default-features = false
@@ -35,5 +51,9 @@ default-features = false
3551
# path = "../tm4c-hal"
3652
version = "0.2.2"
3753

54+
[dependencies.vcell]
55+
version = "*"
56+
features = ["const-fn"]
57+
3858
[features]
3959
rt = ["tm4c129x/rt"]

tm4c129x-hal/src/edes.rs

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
pub const DES0_TX_CTRL_OWN: u32 = 2147483648;
2+
pub const DES0_TX_CTRL_INTERRUPT: u32 = 1073741824;
3+
pub const DES0_TX_CTRL_LAST_SEG: u32 = 536870912;
4+
pub const DES0_TX_CTRL_FIRST_SEG: u32 = 268435456;
5+
pub const DES0_TX_CTRL_DISABLE_CRC: u32 = 134217728;
6+
pub const DES0_TX_CTRL_DISABLE_PADDING: u32 = 67108864;
7+
pub const DES0_TX_CTRL_ENABLE_TS: u32 = 33554432;
8+
pub const DES0_TX_CTRL_REPLACE_CRC: u32 = 16777216;
9+
pub const DES0_TX_CTRL_CHKSUM_M: u32 = 12582912;
10+
pub const DES0_TX_CTRL_NO_CHKSUM: u32 = 0;
11+
pub const DES0_TX_CTRL_IP_HDR_CHKSUM: u32 = 4194304;
12+
pub const DES0_TX_CTRL_IP_HDR_PAY_CHKSUM: u32 = 8388608;
13+
pub const DES0_TX_CTRL_IP_ALL_CKHSUMS: u32 = 12582912;
14+
pub const DES0_TX_CTRL_END_OF_RING: u32 = 2097152;
15+
pub const DES0_TX_CTRL_CHAINED: u32 = 1048576;
16+
pub const DES0_TX_CTRL_VLAN_M: u32 = 786432;
17+
pub const DES0_TX_CTRL_VLAN_NONE: u32 = 0;
18+
pub const DES0_TX_CTRL_VLAN_REMOVE: u32 = 262144;
19+
pub const DES0_TX_CTRL_VLAN_INSERT: u32 = 524288;
20+
pub const DES0_TX_CTRL_VLAN_REPLACE: u32 = 786432;
21+
pub const DES0_TX_STAT_TS_CAPTURED: u32 = 131072;
22+
pub const DES0_TX_STAT_IPH_ERR: u32 = 65536;
23+
pub const DES0_TX_STAT_ERR: u32 = 32768;
24+
pub const DES0_TX_STAT_JABBER_TO: u32 = 16384;
25+
pub const DES0_TX_STAT_FLUSHED: u32 = 8192;
26+
pub const DES0_TX_STAT_PAYLOAD_ERR: u32 = 4096;
27+
pub const DES0_TX_STAT_CARRIER_LOST: u32 = 2048;
28+
pub const DES0_TX_STAT_NO_CARRIER: u32 = 1024;
29+
pub const DES0_TX_STAT_TX_L_COLLISION: u32 = 512;
30+
pub const DES0_TX_STAT_E_COLLISION: u32 = 256;
31+
pub const DES0_TX_STAT_VLAN_FRAME: u32 = 128;
32+
pub const DES0_TX_STAT_COL_COUNT_M: u32 = 120;
33+
pub const DES0_TX_STAT_COL_COUNT_S: u32 = 3;
34+
pub const DES0_TX_STAT_E_DEFERRAL: u32 = 4;
35+
pub const DES0_TX_STAT_UNDERFLOW: u32 = 2;
36+
pub const DES0_TX_STAT_DEFERRED: u32 = 1;
37+
pub const DES1_TX_CTRL_SADDR_MAC1: u32 = 2147483648;
38+
pub const DES1_TX_CTRL_SADDR_M: u32 = 1610612736;
39+
pub const DES1_TX_CTRL_SADDR_NONE: u32 = 0;
40+
pub const DES1_TX_CTRL_SADDR_INSERT: u32 = 536870912;
41+
pub const DES1_TX_CTRL_SADDR_REPLACE: u32 = 1073741824;
42+
pub const DES1_TX_CTRL_BUFF2_SIZE_M: u32 = 536805376;
43+
pub const DES1_TX_CTRL_BUFF1_SIZE_M: u32 = 8191;
44+
pub const DES1_TX_CTRL_BUFF2_SIZE_S: u32 = 16;
45+
pub const DES1_TX_CTRL_BUFF1_SIZE_S: u32 = 0;
46+
pub const DES0_RX_CTRL_OWN: u32 = 2147483648;
47+
pub const DES0_RX_STAT_DEST_ADDR_FAIL: u32 = 1073741824;
48+
pub const DES0_RX_STAT_FRAME_LENGTH_M: u32 = 1073676288;
49+
pub const DES0_RX_STAT_FRAME_LENGTH_S: u32 = 16;
50+
pub const DES0_RX_STAT_ERR: u32 = 32768;
51+
pub const DES0_RX_STAT_DESCRIPTOR_ERR: u32 = 16384;
52+
pub const DES0_RX_STAT_SRC_ADDR_FAIL: u32 = 8192;
53+
pub const DES0_RX_STAT_LENGTH_ERR: u32 = 4096;
54+
pub const DES0_RX_STAT_OVERFLOW: u32 = 2048;
55+
pub const DES0_RX_STAT_VLAN_TAG: u32 = 1024;
56+
pub const DES0_RX_STAT_FIRST_DESC: u32 = 512;
57+
pub const DES0_RX_STAT_LAST_DESC: u32 = 256;
58+
pub const DES0_RX_STAT_TS_AVAILABLE: u32 = 128;
59+
pub const DES0_RX_STAT_RX_L_COLLISION: u32 = 64;
60+
pub const DES0_RX_STAT_FRAME_TYPE: u32 = 32;
61+
pub const DES0_RX_STAT_WDOG_TIMEOUT: u32 = 16;
62+
pub const DES0_RX_STAT_RX_ERR: u32 = 8;
63+
pub const DES0_RX_STAT_DRIBBLE_ERR: u32 = 4;
64+
pub const DES0_RX_STAT_CRC_ERR: u32 = 2;
65+
pub const DES0_RX_STAT_MAC_ADDR: u32 = 1;
66+
pub const DES0_RX_STAT_EXT_AVAILABLE: u32 = 1;
67+
pub const DES1_RX_CTRL_DISABLE_INT: u32 = 2147483648;
68+
pub const DES1_RX_CTRL_BUFF2_SIZE_M: u32 = 536805376;
69+
pub const DES1_RX_CTRL_BUFF2_SIZE_S: u32 = 16;
70+
pub const DES1_RX_CTRL_END_OF_RING: u32 = 32768;
71+
pub const DES1_RX_CTRL_CHAINED: u32 = 16384;
72+
pub const DES1_RX_CTRL_BUFF1_SIZE_M: u32 = 8191;
73+
pub const DES1_RX_CTRL_BUFF1_SIZE_S: u32 = 0;
74+
pub const DES4_RX_STAT_TS_DROPPED: u32 = 16384;
75+
pub const DES4_RX_STAT_PTP_VERSION2: u32 = 8192;
76+
pub const DES4_RX_STAT_PTP_TYPE_ETH: u32 = 4096;
77+
pub const DES4_RX_STAT_PTP_TYPE_UDP: u32 = 0;
78+
pub const DES4_RX_STAT_PTP_MT_M: u32 = 3840;
79+
pub const DES4_RX_STAT_PTP_MT_NONE: u32 = 0;
80+
pub const DES4_RX_STAT_PTP_MT_SYNC: u32 = 256;
81+
pub const DES4_RX_STAT_PTP_MT_FOLLOW_UP: u32 = 512;
82+
pub const DES4_RX_STAT_PTP_MT_DELAY_REQ: u32 = 768;
83+
pub const DES4_RX_STAT_PTP_MT_DELAY_RESP: u32 = 1024;
84+
pub const DES4_RX_STAT_PTP_MT_PDELAY_REQ: u32 = 1280;
85+
pub const DES4_RX_STAT_PTP_MT_PDELAY_RESP: u32 = 1536;
86+
pub const DES4_RX_STAT_PTP_MT_PDELAY_RFU: u32 = 1792;
87+
pub const DES4_RX_STAT_PTP_MT_ANNOUNCE: u32 = 2048;
88+
pub const DES4_RX_STAT_PTP_MT_SIGNALLING: u32 = 2560;
89+
pub const DES4_RX_STAT_PTP_MT_RESERVED: u32 = 3840;
90+
pub const DES4_RX_STAT_IPV6: u32 = 128;
91+
pub const DES4_RX_STAT_IPV4: u32 = 64;
92+
pub const DES4_RX_STAT_IP_CHK_BYPASSED: u32 = 32;
93+
pub const DES4_RX_STAT_IP_PAYLOAD_ERR: u32 = 16;
94+
pub const DES4_RX_STAT_IP_HEADER_ERR: u32 = 8;
95+
pub const DES4_RX_STAT_PAYLOAD_M: u32 = 7;
96+
pub const DES4_RX_STAT_PAYLOAD_UNKNOWN: u32 = 0;
97+
pub const DES4_RX_STAT_PAYLOAD_UDP: u32 = 1;
98+
pub const DES4_RX_STAT_PAYLOAD_TCP: u32 = 2;
99+
pub const DES4_RX_STAT_PAYLOAD_ICMP: u32 = 3;

0 commit comments

Comments
 (0)