ethernet: tweak
This commit is contained in:
parent
0fafd7aa42
commit
0efd14aec8
|
@ -93,7 +93,7 @@ dependencies = [
|
||||||
"proc-macro2 0.4.28 (registry+https://github.com/rust-lang/crates.io-index)",
|
"proc-macro2 0.4.28 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)",
|
"quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"rand 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
"rand 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"syn 0.15.32 (registry+https://github.com/rust-lang/crates.io-index)",
|
"syn 0.15.33 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -118,7 +118,7 @@ version = "0.7.5"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
"bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)",
|
"libc 0.2.53 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"libgit2-sys 0.7.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
"libgit2-sys 0.7.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"url 1.7.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"url 1.7.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
@ -136,7 +136,7 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "libc"
|
name = "libc"
|
||||||
version = "0.2.51"
|
version = "0.2.53"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -145,7 +145,7 @@ version = "0.7.11"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cc 1.0.35 (registry+https://github.com/rust-lang/crates.io-index)",
|
"cc 1.0.35 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)",
|
"libc 0.2.53 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"libz-sys 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)",
|
"libz-sys 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)",
|
"pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
@ -156,7 +156,7 @@ version = "1.0.25"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cc 1.0.35 (registry+https://github.com/rust-lang/crates.io-index)",
|
"cc 1.0.35 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)",
|
"libc 0.2.53 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)",
|
"pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"vcpkg 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
"vcpkg 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
@ -186,8 +186,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "panic-semihosting"
|
name = "panic-semihosting"
|
||||||
version = "0.5.1"
|
version = "0.5.2"
|
||||||
source = "git+https://github.com/rust-embedded/panic-semihosting?rev=aef8231a521aa4197cdb5c3b0bc2b435ed663e2b#aef8231a521aa4197cdb5c3b0bc2b435ed663e2b"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cortex-m 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"cortex-m 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"cortex-m-semihosting 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
"cortex-m-semihosting 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
@ -295,14 +295,13 @@ dependencies = [
|
||||||
name = "stabilizer"
|
name = "stabilizer"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"aligned 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"built 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"built 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"cortex-m 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"cortex-m 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"cortex-m-log 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"cortex-m-log 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"cortex-m-rt 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
"cortex-m-rt 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"panic-abort 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"panic-abort 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"panic-semihosting 0.5.1 (git+https://github.com/rust-embedded/panic-semihosting?rev=aef8231a521aa4197cdb5c3b0bc2b435ed663e2b)",
|
"panic-semihosting 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"smoltcp 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"smoltcp 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"stm32h7 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"stm32h7 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
@ -325,7 +324,7 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "syn"
|
name = "syn"
|
||||||
version = "0.15.32"
|
version = "0.15.33"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2 0.4.28 (registry+https://github.com/rust-lang/crates.io-index)",
|
"proc-macro2 0.4.28 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
@ -338,7 +337,7 @@ name = "time"
|
||||||
version = "0.1.42"
|
version = "0.1.42"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)",
|
"libc 0.2.53 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"redox_syscall 0.1.54 (registry+https://github.com/rust-lang/crates.io-index)",
|
"redox_syscall 0.1.54 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
"winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
@ -441,14 +440,14 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
"checksum generic-array 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3c0f28c2f5bfb5960175af447a2da7c18900693738343dc896ffbcabd9839592"
|
"checksum generic-array 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3c0f28c2f5bfb5960175af447a2da7c18900693738343dc896ffbcabd9839592"
|
||||||
"checksum git2 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)" = "591f8be1674b421644b6c030969520bc3fa12114d2eb467471982ed3e9584e71"
|
"checksum git2 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)" = "591f8be1674b421644b6c030969520bc3fa12114d2eb467471982ed3e9584e71"
|
||||||
"checksum idna 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "38f09e0f0b1fb55fdee1f17470ad800da77af5186a1a76c026b679358b7e844e"
|
"checksum idna 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "38f09e0f0b1fb55fdee1f17470ad800da77af5186a1a76c026b679358b7e844e"
|
||||||
"checksum libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)" = "bedcc7a809076656486ffe045abeeac163da1b558e963a31e29fbfbeba916917"
|
"checksum libc 0.2.53 (registry+https://github.com/rust-lang/crates.io-index)" = "ec350a9417dfd244dc9a6c4a71e13895a4db6b92f0b106f07ebbc3f3bc580cee"
|
||||||
"checksum libgit2-sys 0.7.11 (registry+https://github.com/rust-lang/crates.io-index)" = "48441cb35dc255da8ae72825689a95368bf510659ae1ad55dc4aa88cb1789bf1"
|
"checksum libgit2-sys 0.7.11 (registry+https://github.com/rust-lang/crates.io-index)" = "48441cb35dc255da8ae72825689a95368bf510659ae1ad55dc4aa88cb1789bf1"
|
||||||
"checksum libz-sys 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)" = "2eb5e43362e38e2bca2fd5f5134c4d4564a23a5c28e9b95411652021a8675ebe"
|
"checksum libz-sys 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)" = "2eb5e43362e38e2bca2fd5f5134c4d4564a23a5c28e9b95411652021a8675ebe"
|
||||||
"checksum log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c84ec4b527950aa83a329754b01dbe3f58361d1c5efacd1f6d68c494d08a17c6"
|
"checksum log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c84ec4b527950aa83a329754b01dbe3f58361d1c5efacd1f6d68c494d08a17c6"
|
||||||
"checksum managed 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "fdcec5e97041c7f0f1c5b7d93f12e57293c831c646f4cc7a5db59460c7ea8de6"
|
"checksum managed 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "fdcec5e97041c7f0f1c5b7d93f12e57293c831c646f4cc7a5db59460c7ea8de6"
|
||||||
"checksum matches 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "7ffc5c5338469d4d3ea17d269fa8ea3512ad247247c30bd2df69e68309ed0a08"
|
"checksum matches 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "7ffc5c5338469d4d3ea17d269fa8ea3512ad247247c30bd2df69e68309ed0a08"
|
||||||
"checksum panic-abort 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2c14a66511ed17b6a8b4256b868d7fd207836d891db15eea5195dbcaf87e630f"
|
"checksum panic-abort 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2c14a66511ed17b6a8b4256b868d7fd207836d891db15eea5195dbcaf87e630f"
|
||||||
"checksum panic-semihosting 0.5.1 (git+https://github.com/rust-embedded/panic-semihosting?rev=aef8231a521aa4197cdb5c3b0bc2b435ed663e2b)" = "<none>"
|
"checksum panic-semihosting 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "97cfb37c1d3b5f0cc18bf14485018cccd13bdd24f7b5bfd456c1d8760afef824"
|
||||||
"checksum percent-encoding 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "31010dd2e1ac33d5b46a5b413495239882813e0369f8ed8a5e266f173602f831"
|
"checksum percent-encoding 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "31010dd2e1ac33d5b46a5b413495239882813e0369f8ed8a5e266f173602f831"
|
||||||
"checksum pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)" = "676e8eb2b1b4c9043511a9b7bea0915320d7e502b0a079fb03f9635a5252b18c"
|
"checksum pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)" = "676e8eb2b1b4c9043511a9b7bea0915320d7e502b0a079fb03f9635a5252b18c"
|
||||||
"checksum proc-macro2 0.4.28 (registry+https://github.com/rust-lang/crates.io-index)" = "ba92c84f814b3f9a44c5cfca7d2ad77fa10710867d2bbb1b3d175ab5f47daa12"
|
"checksum proc-macro2 0.4.28 (registry+https://github.com/rust-lang/crates.io-index)" = "ba92c84f814b3f9a44c5cfca7d2ad77fa10710867d2bbb1b3d175ab5f47daa12"
|
||||||
|
@ -466,7 +465,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
"checksum smoltcp 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fef582369edb298c6c41319a544ca9c4e83622f226055ccfcb35974fbb55ed34"
|
"checksum smoltcp 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fef582369edb298c6c41319a544ca9c4e83622f226055ccfcb35974fbb55ed34"
|
||||||
"checksum stable_deref_trait 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "dba1a27d3efae4351c8051072d619e3ade2820635c3958d826bfea39d59b54c8"
|
"checksum stable_deref_trait 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "dba1a27d3efae4351c8051072d619e3ade2820635c3958d826bfea39d59b54c8"
|
||||||
"checksum stm32h7 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "64173a3f8edb1bf9e17b14861695da2a7e6ca98afc99e0f249b62e4962cc478d"
|
"checksum stm32h7 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "64173a3f8edb1bf9e17b14861695da2a7e6ca98afc99e0f249b62e4962cc478d"
|
||||||
"checksum syn 0.15.32 (registry+https://github.com/rust-lang/crates.io-index)" = "846620ec526c1599c070eff393bfeeeb88a93afa2513fc3b49f1fea84cf7b0ed"
|
"checksum syn 0.15.33 (registry+https://github.com/rust-lang/crates.io-index)" = "ec52cd796e5f01d0067225a5392e70084acc4c0013fa71d55166d38a8b307836"
|
||||||
"checksum time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)" = "db8dcfca086c1143c9270ac42a2bbd8a7ee477b78ac8e45b19abfb0cbede4b6f"
|
"checksum time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)" = "db8dcfca086c1143c9270ac42a2bbd8a7ee477b78ac8e45b19abfb0cbede4b6f"
|
||||||
"checksum toml 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)" = "758664fc71a3a69038656bee8b6be6477d2a6c315a6b81f7081f591bffa4111f"
|
"checksum toml 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)" = "758664fc71a3a69038656bee8b6be6477d2a6c315a6b81f7081f591bffa4111f"
|
||||||
"checksum typenum 1.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "612d636f949607bdf9b123b4a6f6d966dedf3ff669f7f045890d3a4a73948169"
|
"checksum typenum 1.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "612d636f949607bdf9b123b4a6f6d966dedf3ff669f7f045890d3a4a73948169"
|
||||||
|
|
|
@ -33,10 +33,7 @@ cortex-m-log = { version = "0.5", features = ["log-integration"] }
|
||||||
stm32h7 = { version = "0.7", features = ["stm32h7x3", "rt"] }
|
stm32h7 = { version = "0.7", features = ["stm32h7x3", "rt"] }
|
||||||
log = "0.4"
|
log = "0.4"
|
||||||
panic-abort = "0.3"
|
panic-abort = "0.3"
|
||||||
# https://github.com/rust-embedded/panic-semihosting/issues/16
|
panic-semihosting = { version = "0.5.2", optional = true }
|
||||||
# panic-semihosting = { version = "0.6", optional = true }
|
|
||||||
panic-semihosting = { git = "https://github.com/rust-embedded/panic-semihosting", rev = "aef8231a521aa4197cdb5c3b0bc2b435ed663e2b", optional = true }
|
|
||||||
aligned = "0.3"
|
|
||||||
|
|
||||||
[dependencies.smoltcp]
|
[dependencies.smoltcp]
|
||||||
#git = "https://github.com/m-labs/smoltcp"
|
#git = "https://github.com/m-labs/smoltcp"
|
||||||
|
|
18
memory.x
18
memory.x
|
@ -13,20 +13,24 @@ MEMORY
|
||||||
}
|
}
|
||||||
|
|
||||||
SECTIONS {
|
SECTIONS {
|
||||||
|
.itcm : ALIGN(8) {
|
||||||
|
*(.itcm .itcm.*);
|
||||||
|
. = ALIGN(8);
|
||||||
|
} > ITCM
|
||||||
|
.axisram : ALIGN(8) {
|
||||||
|
*(.axisram .axisram.*);
|
||||||
|
. = ALIGN(8);
|
||||||
|
} > AXISRAM
|
||||||
.sram1 (NOLOAD) : ALIGN(4) {
|
.sram1 (NOLOAD) : ALIGN(4) {
|
||||||
*(.sram1);
|
*(.sram1 .sram1.*);
|
||||||
. = ALIGN(4);
|
. = ALIGN(4);
|
||||||
} > SRAM1
|
} > SRAM1
|
||||||
.sram2 (NOLOAD) : ALIGN(4) {
|
.sram2 (NOLOAD) : ALIGN(4) {
|
||||||
*(.sram2);
|
*(.sram2 .sram2.*);
|
||||||
. = ALIGN(4);
|
. = ALIGN(4);
|
||||||
} > SRAM2
|
} > SRAM2
|
||||||
.sram3 (NOLOAD) : ALIGN(4) {
|
.sram3 (NOLOAD) : ALIGN(4) {
|
||||||
*(.sram3);
|
*(.sram3 .sram3.*);
|
||||||
. = ALIGN(4);
|
. = ALIGN(4);
|
||||||
} > SRAM3
|
} > SRAM3
|
||||||
.axisram (NOLOAD) : ALIGN(8) {
|
|
||||||
*(.axisram);
|
|
||||||
. = ALIGN(8);
|
|
||||||
} > AXISRAM
|
|
||||||
} INSERT AFTER .bss;
|
} INSERT AFTER .bss;
|
||||||
|
|
|
@ -223,7 +223,7 @@ impl RxRing {
|
||||||
});
|
});
|
||||||
|
|
||||||
dma.dmacrx_rlr.write(|w| {
|
dma.dmacrx_rlr.write(|w| {
|
||||||
w.rdrl().bits(self.desc_buf.len() as u16 - 1) // FIXME: unclear
|
w.rdrl().bits(self.desc_buf.len() as u16 - 1)
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -310,7 +310,7 @@ impl TxRing {
|
||||||
});
|
});
|
||||||
|
|
||||||
dma.dmactx_rlr.write(|w| {
|
dma.dmactx_rlr.write(|w| {
|
||||||
w.tdrl().bits(self.desc_buf.len() as u16 - 1) // FIXME: unclear
|
w.tdrl().bits(self.desc_buf.len() as u16 - 1)
|
||||||
});
|
});
|
||||||
|
|
||||||
dma.dmactx_dtpr.write(|w| {
|
dma.dmactx_dtpr.write(|w| {
|
||||||
|
@ -411,7 +411,7 @@ impl Device {
|
||||||
eth_mac.maca0hr.write(|w|
|
eth_mac.maca0hr.write(|w|
|
||||||
w.addrhi().bits( mac.0[4] as u16 |
|
w.addrhi().bits( mac.0[4] as u16 |
|
||||||
((mac.0[5] as u16) << 8))
|
((mac.0[5] as u16) << 8))
|
||||||
//.ae().set_bit()
|
.ae().set_bit()
|
||||||
//.sa().clear_bit()
|
//.sa().clear_bit()
|
||||||
//.mbc().bits(0b000000)
|
//.mbc().bits(0b000000)
|
||||||
);
|
);
|
||||||
|
|
36
src/main.rs
36
src/main.rs
|
@ -510,12 +510,12 @@ static SPIP: Mutex<RefCell<Option<(
|
||||||
stm32::SPI1, stm32::SPI2, stm32::SPI4, stm32::SPI5)>>> =
|
stm32::SPI1, stm32::SPI2, stm32::SPI4, stm32::SPI5)>>> =
|
||||||
Mutex::new(RefCell::new(None));
|
Mutex::new(RefCell::new(None));
|
||||||
|
|
||||||
#[link_section = ".sram1"]
|
#[link_section = ".sram1.datspi"]
|
||||||
static mut DAT: u32 = (1 << 9) | (1 << 0);
|
static mut DAT: u32 = (1 << 9) | (1 << 0);
|
||||||
|
|
||||||
static TIME: Mutex<RefCell<i64>> = Mutex::new(RefCell::new(0));
|
static TIME: Mutex<RefCell<i64>> = Mutex::new(RefCell::new(0));
|
||||||
|
|
||||||
#[link_section = ".sram3"]
|
#[link_section = ".sram3.eth"]
|
||||||
static mut ETH: eth::Device = eth::Device::new();
|
static mut ETH: eth::Device = eth::Device::new();
|
||||||
|
|
||||||
const TCP_RX_BUFFER_SIZE: usize = 4096;
|
const TCP_RX_BUFFER_SIZE: usize = 4096;
|
||||||
|
@ -615,8 +615,6 @@ fn main() -> ! {
|
||||||
//dbgmcu.apb1lfz1.modify(|_, w| w.stop_tim2().set_bit()); // stop tim2 in debug
|
//dbgmcu.apb1lfz1.modify(|_, w| w.stop_tim2().set_bit()); // stop tim2 in debug
|
||||||
unsafe { ptr::write_volatile(0x5c00_103c as *mut usize, 0x0000_0001) };
|
unsafe { ptr::write_volatile(0x5c00_103c as *mut usize, 0x0000_0001) };
|
||||||
|
|
||||||
tim2_setup(&dp.TIM2);
|
|
||||||
|
|
||||||
unsafe {
|
unsafe {
|
||||||
let t = 2e-6*2.;
|
let t = 2e-6*2.;
|
||||||
IIR_CH[0].set_pi(1., 0., 0.).unwrap();
|
IIR_CH[0].set_pi(1., 0., 0.).unwrap();
|
||||||
|
@ -627,12 +625,6 @@ fn main() -> ! {
|
||||||
IIR_CH[1].get_x_offset().unwrap();
|
IIR_CH[1].get_x_offset().unwrap();
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe { cp.NVIC.set_priority(stm32::Interrupt::SPI1, 0); } // highest prio
|
|
||||||
cortex_m::interrupt::free(|cs| {
|
|
||||||
cp.NVIC.enable(stm32::Interrupt::SPI1);
|
|
||||||
SPIP.borrow(cs).replace(Some((spi1, spi2, spi4, spi5)));
|
|
||||||
});
|
|
||||||
|
|
||||||
eth::setup(&rcc, &dp.SYSCFG);
|
eth::setup(&rcc, &dp.SYSCFG);
|
||||||
eth::setup_pins(&dp.GPIOA, &dp.GPIOB, &dp.GPIOC, &dp.GPIOG);
|
eth::setup_pins(&dp.GPIOA, &dp.GPIOB, &dp.GPIOC, &dp.GPIOG);
|
||||||
|
|
||||||
|
@ -656,6 +648,15 @@ fn main() -> ! {
|
||||||
unsafe { cp.NVIC.set_priority(stm32::Interrupt::ETH, 196); } // mid prio
|
unsafe { cp.NVIC.set_priority(stm32::Interrupt::ETH, 196); } // mid prio
|
||||||
cp.NVIC.enable(stm32::Interrupt::ETH);
|
cp.NVIC.enable(stm32::Interrupt::ETH);
|
||||||
|
|
||||||
|
tim2_setup(&dp.TIM2);
|
||||||
|
|
||||||
|
unsafe { cp.NVIC.set_priority(stm32::Interrupt::SPI1, 0); } // highest prio
|
||||||
|
cortex_m::interrupt::free(|cs| {
|
||||||
|
cp.NVIC.enable(stm32::Interrupt::SPI1);
|
||||||
|
SPIP.borrow(cs).replace(Some((spi1, spi2, spi4, spi5)));
|
||||||
|
});
|
||||||
|
|
||||||
|
let mut last = 0;
|
||||||
loop {
|
loop {
|
||||||
let time = cortex_m::interrupt::free(|cs| *TIME.borrow(cs).borrow());
|
let time = cortex_m::interrupt::free(|cs| *TIME.borrow(cs).borrow());
|
||||||
|
|
||||||
|
@ -664,9 +665,11 @@ fn main() -> ! {
|
||||||
if !socket.is_open() {
|
if !socket.is_open() {
|
||||||
socket.listen(80).unwrap_or_else(|e| warn!("TCP listen error: {:?}", e));
|
socket.listen(80).unwrap_or_else(|e| warn!("TCP listen error: {:?}", e));
|
||||||
}
|
}
|
||||||
if socket.can_send() {
|
if socket.can_send() && last != time {
|
||||||
write!(socket, "hello\n")
|
last = time;
|
||||||
.map(|_| socket.close())
|
let (x0, y0, x1, y1) = unsafe {
|
||||||
|
(IIR_STATE[0][0], IIR_STATE[0][2], IIR_STATE[1][0], IIR_STATE[1][2]) };
|
||||||
|
write!(socket, "t={} x0={:.1} y0={:.1} x1={:.1} y1={:.1}\n", time, x0, y0, x1, y1)
|
||||||
.unwrap_or_else(|e| warn!("TCP send error: {:?}", e));
|
.unwrap_or_else(|e| warn!("TCP send error: {:?}", e));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -676,12 +679,6 @@ fn main() -> ! {
|
||||||
Err(e) => info!("iface poll error: {:?}", e)
|
Err(e) => info!("iface poll error: {:?}", e)
|
||||||
}
|
}
|
||||||
|
|
||||||
if time % 1000 == 0 {
|
|
||||||
let (x0, y0, x1, y1) = unsafe {
|
|
||||||
(IIR_STATE[0][0], IIR_STATE[0][2], IIR_STATE[1][0], IIR_STATE[1][2]) };
|
|
||||||
info!("x0={:.1} y0={:.1} x1={:.1} y1={:.1}", x0, y0, x1, y1);
|
|
||||||
}
|
|
||||||
|
|
||||||
cortex_m::asm::wfi();
|
cortex_m::asm::wfi();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -692,6 +689,7 @@ static mut IIR_CH: [IIR; 2] = [
|
||||||
IIR{ ba: [0., 0., 0., 0., 0.], y_offset: 0.,
|
IIR{ ba: [0., 0., 0., 0., 0.], y_offset: 0.,
|
||||||
y_min: -SCALE, y_max: SCALE }; 2];
|
y_min: -SCALE, y_max: SCALE }; 2];
|
||||||
|
|
||||||
|
#[link_section = ".data.spi1"]
|
||||||
#[interrupt]
|
#[interrupt]
|
||||||
fn SPI1() {
|
fn SPI1() {
|
||||||
#[cfg(feature = "bkpt")]
|
#[cfg(feature = "bkpt")]
|
||||||
|
|
Loading…
Reference in New Issue