diff --git a/.vscode/settings.json b/.vscode/settings.json index 1a116e7..2fb436f 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -22,5 +22,6 @@ "platform/dev-imxrt/Cargo.toml", "platform/dev-npcx/Cargo.toml", "platform/dev-qemu/Cargo.toml", + "platform/winhec-demo/Cargo.toml", ] } diff --git a/platform/winhec-demo/.cargo/config.toml b/platform/winhec-demo/.cargo/config.toml new file mode 100644 index 0000000..c0d9a8b --- /dev/null +++ b/platform/winhec-demo/.cargo/config.toml @@ -0,0 +1,21 @@ +[target.thumbv8m.main-none-eabihf] +runner = 'probe-rs run --chip MIMXRT685SFVKB --preverify --verify' + +rustflags = [ + "-C", + "linker=flip-link", + "-C", + "link-arg=-Tlink.x", + "-C", + "link-arg=-Tdefmt.x", + # This is needed if your flash or ram addresses are not aligned to 0x10000 in memory.x + # See https://github.com/rust-embedded/cortex-m-quickstart/pull/95 + "-C", + "link-arg=--nmagic", +] + +[build] +target = "thumbv8m.main-none-eabihf" # Cortex-M33 + +[env] +DEFMT_LOG = "trace" diff --git a/platform/winhec-demo/Cargo.lock b/platform/winhec-demo/Cargo.lock new file mode 100644 index 0000000..33a6819 --- /dev/null +++ b/platform/winhec-demo/Cargo.lock @@ -0,0 +1,1794 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 4 + +[[package]] +name = "anyhow" +version = "1.0.102" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f202df86484c868dbad7eaa557ef785d5c66295e41b460ef922eca0723b842c" + +[[package]] +name = "aquamarine" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0f50776554130342de4836ba542aa85a4ddb361690d7e8df13774d7284c3d5c2" +dependencies = [ + "include_dir", + "itertools 0.10.5", + "proc-macro-error2", + "proc-macro2", + "quote", + "syn 2.0.117", +] + +[[package]] +name = "askama" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f75363874b771be265f4ffe307ca705ef6f3baa19011c149da8674a87f1b75c4" +dependencies = [ + "askama_derive", + "itoa", + "percent-encoding", + "serde", + "serde_json", +] + +[[package]] +name = "askama_derive" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "129397200fe83088e8a68407a8e2b1f826cf0086b21ccdb866a722c8bcd3a94f" +dependencies = [ + "askama_parser", + "memchr", + "proc-macro2", + "quote", + "rustc-hash", + "syn 2.0.117", +] + +[[package]] +name = "askama_parser" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d6ab5630b3d5eaf232620167977f95eb51f3432fc76852328774afbd242d4358" +dependencies = [ + "memchr", + "winnow", +] + +[[package]] +name = "autocfg" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8" + +[[package]] +name = "az" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be5eb007b7cacc6c660343e96f650fedf4b5a77512399eb952ca6642cf8d13f7" + +[[package]] +name = "bare-metal" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5deb64efa5bd81e31fcd1938615a6d98c82eafcbcd787162b6f63b91d6bac5b3" +dependencies = [ + "rustc_version", +] + +[[package]] +name = "battery-service" +version = "0.1.0" +source = "git+https://github.com/OpenDevicePartnership/embedded-services?branch=v0.2.0#5a0ed0d9b2ea8607c8fd45fb11b52ce4864f0808" +dependencies = [ + "battery-service-messages", + "defmt 0.3.100", + "embassy-futures", + "embassy-sync 0.7.2", + "embassy-time", + "embedded-batteries-async", + "embedded-hal 1.0.0", + "embedded-hal-async", + "embedded-services", + "heapless 0.8.0", + "mctp-rs", + "odp-service-common", + "power-policy-interface", + "zerocopy", +] + +[[package]] +name = "battery-service-messages" +version = "0.1.0" +source = "git+https://github.com/OpenDevicePartnership/embedded-services?branch=v0.2.0#5a0ed0d9b2ea8607c8fd45fb11b52ce4864f0808" +dependencies = [ + "defmt 0.3.100", + "embedded-batteries-async", + "embedded-services", + "num_enum", +] + +[[package]] +name = "bincode" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "36eaf5d7b090263e8150820482d5d93cd964a81e4019913c972f4edcc6edb740" +dependencies = [ + "unty", +] + +[[package]] +name = "bit-register" +version = "0.1.0" +source = "git+https://github.com/OpenDevicePartnership/odp-utilities#583015c08ad9855f310bdb25d5cf9abff77b5e08" +dependencies = [ + "num-traits", +] + +[[package]] +name = "bitfield" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "46afbd2983a5d5a7bd740ccb198caf5b82f45c40c09c0eed36052d91cb92e719" + +[[package]] +name = "bitfield" +version = "0.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c821a6e124197eb56d907ccc2188eab1038fb919c914f47976e64dd8dbc855d1" + +[[package]] +name = "bitfield" +version = "0.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f798d2d157e547aa99aab0967df39edd0b70307312b6f8bd2848e6abe40896e0" + +[[package]] +name = "bitfield" +version = "0.19.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "21ba6517c6b0f2bf08be60e187ab64b038438f22dd755614d8fe4d4098c46419" +dependencies = [ + "bitfield-macros", +] + +[[package]] +name = "bitfield-macros" +version = "0.19.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f48d6ace212fdf1b45fd6b566bb40808415344642b76c3224c07c8df9da81e97" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.117", +] + +[[package]] +name = "bitfield-struct" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8769c4854c5ada2852ddf6fd09d15cf43d4c2aaeccb4de6432f5402f08a6003b" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.117", +] + +[[package]] +name = "bitflags" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" + +[[package]] +name = "bitflags" +version = "2.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "843867be96c8daad0d758b57df9392b6d8d271134fce549de6ce169ff98a92af" + +[[package]] +name = "bitvec" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bc2832c24239b0141d5674bb9174f9d68a8b5b3f2753311927c172ca46f7e9c" +dependencies = [ + "funty", + "radium", + "tap", + "wyz", +] + +[[package]] +name = "bq40z50-rx" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09b6faf600295f12c3fb99b45266bc9140af5c344b08f2705bc06bfa0e8b549e" +dependencies = [ + "device-driver", + "embedded-batteries-async", + "embedded-hal 1.0.0", + "embedded-hal-async", + "smbus-pec", +] + +[[package]] +name = "bytemuck" +version = "1.25.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8efb64bd706a16a1bdde310ae86b351e4d21550d98d056f22f8a7f7a2183fec" + +[[package]] +name = "byteorder" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" + +[[package]] +name = "cfg-if" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801" + +[[package]] +name = "convert_case" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec182b0ca2f35d8fc196cf3404988fd8b8c739a4d270ff118a398feb0cbec1ca" +dependencies = [ + "unicode-segmentation", +] + +[[package]] +name = "cortex-m" +version = "0.7.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ec610d8f49840a5b376c69663b6369e71f4b34484b9b2eb29fb918d92516cb9" +dependencies = [ + "bare-metal", + "bitfield 0.13.2", + "critical-section", + "embedded-hal 0.2.7", + "volatile-register", +] + +[[package]] +name = "cortex-m-rt" +version = "0.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "801d4dec46b34c299ccf6b036717ae0fce602faa4f4fe816d9013b9a7c9f5ba6" +dependencies = [ + "cortex-m-rt-macros", +] + +[[package]] +name = "cortex-m-rt-macros" +version = "0.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e37549a379a9e0e6e576fd208ee60394ccb8be963889eebba3ffe0980364f472" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.117", +] + +[[package]] +name = "critical-section" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "790eea4361631c5e7d22598ecd5723ff611904e3344ce8720784c93e3d83d40b" + +[[package]] +name = "crunchy" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "460fbee9c2c2f33933d720630a6a0bac33ba7053db5344fac858d4b8952d77d5" + +[[package]] +name = "darling" +version = "0.20.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc7f46116c46ff9ab3eb1597a45688b6715c6e628b5c133e288e709a29bcb4ee" +dependencies = [ + "darling_core", + "darling_macro", +] + +[[package]] +name = "darling_core" +version = "0.20.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d00b9596d185e565c2207a0b01f8bd1a135483d02d9b7b0a54b11da8d53412e" +dependencies = [ + "fnv", + "ident_case", + "proc-macro2", + "quote", + "strsim", + "syn 2.0.117", +] + +[[package]] +name = "darling_macro" +version = "0.20.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc34b93ccb385b40dc71c6fceac4b2ad23662c7eeb248cf10d529b7e055b6ead" +dependencies = [ + "darling_core", + "quote", + "syn 2.0.117", +] + +[[package]] +name = "dd-manifest-tree" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5793572036e0a6638977c7370c6afc423eac848ee8495f079b8fd3964de7b9f9" +dependencies = [ + "toml", +] + +[[package]] +name = "debug-service-messages" +version = "0.1.0" +source = "git+https://github.com/OpenDevicePartnership/embedded-services?branch=v0.2.0#5a0ed0d9b2ea8607c8fd45fb11b52ce4864f0808" +dependencies = [ + "defmt 0.3.100", + "embedded-services", + "num_enum", +] + +[[package]] +name = "defmt" +version = "0.3.100" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0963443817029b2024136fc4dd07a5107eb8f977eaf18fcd1fdeb11306b64ad" +dependencies = [ + "defmt 1.0.1", +] + +[[package]] +name = "defmt" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "548d977b6da32fa1d1fda2876453da1e7df63ad0304c8b3dae4dbe7b96f39b78" +dependencies = [ + "bitflags 1.3.2", + "defmt-macros", +] + +[[package]] +name = "defmt-macros" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d4fc12a85bcf441cfe44344c4b72d58493178ce635338a3f3b78943aceb258e" +dependencies = [ + "defmt-parser", + "proc-macro-error2", + "proc-macro2", + "quote", + "syn 2.0.117", +] + +[[package]] +name = "defmt-parser" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "10d60334b3b2e7c9d91ef8150abfb6fa4c1c39ebbcf4a81c2e346aad939fee3e" +dependencies = [ + "thiserror", +] + +[[package]] +name = "defmt-rtt" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c6eca0aae8aa2cf8333200ecbd236274697bc0a394765c858b3d9372eb1abcfa" +dependencies = [ + "critical-section", + "defmt 0.3.100", +] + +[[package]] +name = "device-driver" +version = "1.0.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3aa3d97b2acf349b9d52c75470e2ccfc7224c49597ec12c2fb0e28826e910495" +dependencies = [ + "device-driver-macros", + "embedded-io 0.6.1", + "embedded-io-async 0.6.1", +] + +[[package]] +name = "device-driver-generation" +version = "1.0.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d23ac9a75e0bba43928e1a50c7b1beaaa67a98b64eaa28f353a16de1a5fd985" +dependencies = [ + "anyhow", + "askama", + "bitvec", + "convert_case", + "dd-manifest-tree", + "itertools 0.14.0", + "prettyplease", + "proc-macro2", + "quote", + "syn 2.0.117", +] + +[[package]] +name = "device-driver-macros" +version = "1.0.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dec62c8588239d60d7470326cd78ba2b264bef24f0afa20c666668487c843d03" +dependencies = [ + "device-driver-generation", + "proc-macro2", + "syn 2.0.117", +] + +[[package]] +name = "document-features" +version = "0.2.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d4b8a88685455ed29a21542a33abd9cb6510b6b129abadabdcef0f4c55bc8f61" +dependencies = [ + "litrs", +] + +[[package]] +name = "either" +version = "1.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719" + +[[package]] +name = "embassy-embedded-hal" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "554e3e840696f54b4c9afcf28a0f24da431c927f4151040020416e7393d6d0d8" +dependencies = [ + "defmt 1.0.1", + "embassy-futures", + "embassy-hal-internal 0.3.0", + "embassy-sync 0.7.2", + "embedded-hal 0.2.7", + "embedded-hal 1.0.0", + "embedded-hal-async", + "embedded-storage", + "embedded-storage-async", + "nb 1.1.0", +] + +[[package]] +name = "embassy-embedded-hal" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b0641612053b2f34fc250bb63f6630ae75de46e02ade7f457268447081d709ce" +dependencies = [ + "embassy-futures", + "embassy-hal-internal 0.4.0", + "embassy-sync 0.8.0", + "embassy-time", + "embedded-hal 0.2.7", + "embedded-hal 1.0.0", + "embedded-hal-async", + "embedded-storage", + "embedded-storage-async", + "nb 1.1.0", +] + +[[package]] +name = "embassy-executor" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06070468370195e0e86f241c8e5004356d696590a678d47d6676795b2e439c6b" +dependencies = [ + "cortex-m", + "critical-section", + "defmt 1.0.1", + "document-features", + "embassy-executor-macros", + "embassy-executor-timer-queue", +] + +[[package]] +name = "embassy-executor-macros" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dfdddc3a04226828316bf31393b6903ee162238576b1584ee2669af215d55472" +dependencies = [ + "darling", + "proc-macro2", + "quote", + "syn 2.0.117", +] + +[[package]] +name = "embassy-executor-timer-queue" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2fc328bf943af66b80b98755db9106bf7e7471b0cf47dc8559cd9a6be504cc9c" + +[[package]] +name = "embassy-futures" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc2d050bdc5c21e0862a89256ed8029ae6c290a93aecefc73084b3002cdebb01" + +[[package]] +name = "embassy-hal-internal" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95285007a91b619dc9f26ea8f55452aa6c60f7115a4edc05085cd2bd3127cd7a" +dependencies = [ + "cortex-m", + "critical-section", + "defmt 1.0.1", + "num-traits", +] + +[[package]] +name = "embassy-hal-internal" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f10ce10a4dfdf6402d8e9bd63128986b96a736b1a0a6680547ed2ac55d55dba" +dependencies = [ + "num-traits", +] + +[[package]] +name = "embassy-imxrt" +version = "0.1.0" +source = "git+https://github.com/OpenDevicePartnership/embassy-imxrt#f02744fa75e6c8711a18f00e0d8b722bdb61ce1d" +dependencies = [ + "cfg-if", + "cortex-m", + "cortex-m-rt", + "critical-section", + "defmt 1.0.1", + "document-features", + "embassy-embedded-hal 0.6.0", + "embassy-futures", + "embassy-hal-internal 0.3.0", + "embassy-sync 0.8.0", + "embassy-time", + "embassy-time-driver", + "embassy-time-queue-utils", + "embedded-hal 0.2.7", + "embedded-hal 1.0.0", + "embedded-hal-async", + "embedded-hal-nb", + "embedded-io 0.6.1", + "embedded-io-async 0.6.1", + "embedded-mcu-hal", + "embedded-storage", + "fixed", + "itertools 0.11.0", + "mimxrt600-fcb", + "mimxrt633s-pac", + "mimxrt685s-pac", + "nb 1.1.0", + "paste", + "rand_core", + "storage_bus", +] + +[[package]] +name = "embassy-sync" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73974a3edbd0bd286759b3d483540f0ebef705919a5f56f4fc7709066f71689b" +dependencies = [ + "cfg-if", + "critical-section", + "defmt 1.0.1", + "embedded-io-async 0.6.1", + "futures-core", + "futures-sink", + "heapless 0.8.0", +] + +[[package]] +name = "embassy-sync" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7bbd85cf5a5ae56bdf26f618364af642d1d0a4e245cdd75cd9aabda382f65a81" +dependencies = [ + "cfg-if", + "critical-section", + "defmt 1.0.1", + "embedded-io-async 0.7.0", + "futures-core", + "futures-sink", + "heapless 0.9.2", +] + +[[package]] +name = "embassy-time" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "592b0c143ec626e821d4d90da51a2bd91d559d6c442b7c74a47d368c9e23d97a" +dependencies = [ + "cfg-if", + "critical-section", + "defmt 1.0.1", + "document-features", + "embassy-time-driver", + "embedded-hal 0.2.7", + "embedded-hal 1.0.0", + "embedded-hal-async", + "futures-core", +] + +[[package]] +name = "embassy-time-driver" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ee71af1b3a0deaa53eaf2d39252f83504c853646e472400b763060389b9fcc9" +dependencies = [ + "document-features", +] + +[[package]] +name = "embassy-time-queue-utils" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "80e2ee86063bd028a420a5fb5898c18c87a8898026da1d4c852af2c443d0a454" +dependencies = [ + "embassy-executor-timer-queue", + "heapless 0.8.0", +] + +[[package]] +name = "embedded-batteries" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "40f975432b4e146342a1589c563cffab6b7a692024cb511bf87b6bfe78c84125" +dependencies = [ + "bitfield-struct", + "bitflags 2.11.0", + "defmt 0.3.100", + "embedded-hal 1.0.0", + "zerocopy", +] + +[[package]] +name = "embedded-batteries-async" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a3bf0e4be67770cfc31f1cea8b73baf98c0baf2c57d6bd8c3a4c315acb1d8bd4" +dependencies = [ + "bitfield-struct", + "defmt 0.3.100", + "embedded-batteries", + "embedded-hal 1.0.0", +] + +[[package]] +name = "embedded-cfu-protocol" +version = "0.2.0" +source = "git+https://github.com/OpenDevicePartnership/embedded-cfu#e0d776017cf34c902c9f2a2be0c75fe73a3a4dda" +dependencies = [ + "defmt 0.3.100", + "embedded-io-async 0.6.1", +] + +[[package]] +name = "embedded-crc-macros" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4f1c75747a43b086df1a87fb2a889590bc0725e0abf54bba6d0c4bf7bd9e762c" + +[[package]] +name = "embedded-fans" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e5007eb97aabfe3606c0b02823b3120e861c748ed3560756aa4fd231ef9ebf0" +dependencies = [ + "defmt 1.0.1", +] + +[[package]] +name = "embedded-fans-async" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bafd19dc3b6aaa5027856818e19ccbfe84ebfb094c8a0ecf84a20e75c3b8e959" +dependencies = [ + "defmt 1.0.1", + "embedded-fans", +] + +[[package]] +name = "embedded-hal" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "35949884794ad573cf46071e41c9b60efb0cb311e3ca01f7af807af1debc66ff" +dependencies = [ + "nb 0.1.3", + "void", +] + +[[package]] +name = "embedded-hal" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "361a90feb7004eca4019fb28352a9465666b24f840f5c3cddf0ff13920590b89" + +[[package]] +name = "embedded-hal-async" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c4c685bbef7fe13c3c6dd4da26841ed3980ef33e841cddfa15ce8a8fb3f1884" +dependencies = [ + "embedded-hal 1.0.0", +] + +[[package]] +name = "embedded-hal-nb" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fba4268c14288c828995299e59b12babdbe170f6c6d73731af1b4648142e8605" +dependencies = [ + "embedded-hal 1.0.0", + "nb 1.1.0", +] + +[[package]] +name = "embedded-io" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "edd0f118536f44f5ccd48bcb8b111bdc3de888b58c74639dfb034a357d0f206d" + +[[package]] +name = "embedded-io" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9eb1aa714776b75c7e67e1da744b81a129b3ff919c8712b5e1b32252c1f07cc7" + +[[package]] +name = "embedded-io-async" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ff09972d4073aa8c299395be75161d582e7629cd663171d62af73c8d50dba3f" +dependencies = [ + "embedded-io 0.6.1", +] + +[[package]] +name = "embedded-io-async" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2564b9f813c544241430e147d8bc454815ef9ac998878d30cc3055449f7fd4c0" +dependencies = [ + "embedded-io 0.7.1", +] + +[[package]] +name = "embedded-mcu-hal" +version = "0.1.0" +source = "git+https://github.com/OpenDevicePartnership/embedded-mcu#6956ebdaf9d3725959dae2c57c2ab6baefae9330" +dependencies = [ + "defmt 1.0.1", + "num_enum", +] + +[[package]] +name = "embedded-sensors-hal" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c703756bee31e7aaf55d8fb6dcf7337cfc231cfb4a3ad34b9df509846fd9001" +dependencies = [ + "defmt 1.0.1", + "paste", +] + +[[package]] +name = "embedded-sensors-hal-async" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "51c524a78b2804eca0d9ec05154e51d9af948b40cd0a6bbcc4d5832ff7e47b5b" +dependencies = [ + "defmt 1.0.1", + "embedded-sensors-hal", + "paste", +] + +[[package]] +name = "embedded-services" +version = "0.1.0" +source = "git+https://github.com/OpenDevicePartnership/embedded-services?branch=v0.2.0#5a0ed0d9b2ea8607c8fd45fb11b52ce4864f0808" +dependencies = [ + "bitfield 0.17.0", + "bitflags 2.11.0", + "bitvec", + "cfg-if", + "cortex-m", + "critical-section", + "defmt 0.3.100", + "document-features", + "embassy-futures", + "embassy-sync 0.7.2", + "embassy-time", + "embedded-cfu-protocol", + "embedded-hal-async", + "embedded-io 0.6.1", + "embedded-io-async 0.6.1", + "embedded-usb-pd", + "heapless 0.8.0", + "mctp-rs", + "num_enum", + "paste", + "portable-atomic", + "serde", + "uuid", +] + +[[package]] +name = "embedded-storage" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a21dea9854beb860f3062d10228ce9b976da520a73474aed3171ec276bc0c032" + +[[package]] +name = "embedded-storage-async" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1763775e2323b7d5f0aa6090657f5e21cfa02ede71f5dc40eead06d64dcd15cc" +dependencies = [ + "embedded-storage", +] + +[[package]] +name = "embedded-usb-pd" +version = "0.1.0" +source = "git+https://github.com/OpenDevicePartnership/embedded-usb-pd#1a8e79d3a2ac0d2837a34b045087cf0863146f7d" +dependencies = [ + "aquamarine", + "bincode", + "bitfield 0.19.4", + "defmt 0.3.100", + "embedded-hal-async", +] + +[[package]] +name = "equivalent" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" + +[[package]] +name = "espi-device" +version = "0.1.0" +source = "git+https://github.com/OpenDevicePartnership/haf-ec-service#d81a8d5a56983a4afa627bd9b4e78e5135f15e09" +dependencies = [ + "bit-register", + "bitflags 2.11.0", + "num-traits", + "num_enum", + "static_assertions", + "subenum", +] + +[[package]] +name = "fixed" +version = "1.31.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9af2cbf772fa6d1c11358f92ef554cb6b386201210bcf0e91fb7fba8a907fb40" +dependencies = [ + "az", + "bytemuck", + "half", + "typenum", +] + +[[package]] +name = "fnv" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" + +[[package]] +name = "funty" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6d5a32815ae3f33302d95fdcb2ce17862f8c65363dcfd29360480ba1001fc9c" + +[[package]] +name = "futures-core" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e3450815272ef58cec6d564423f6e755e25379b217b0bc688e295ba24df6b1d" + +[[package]] +name = "futures-sink" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c39754e157331b013978ec91992bde1ac089843443c49cbc7f46150b0fad0893" + +[[package]] +name = "half" +version = "2.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ea2d84b969582b4b1864a92dc5d27cd2b77b622a8d79306834f1be5ba20d84b" +dependencies = [ + "cfg-if", + "crunchy", + "zerocopy", +] + +[[package]] +name = "hash32" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47d60b12902ba28e2730cd37e95b8c9223af2808df9e902d4df49588d1470606" +dependencies = [ + "byteorder", +] + +[[package]] +name = "hashbrown" +version = "0.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4f467dd6dccf739c208452f8014c75c18bb8301b050ad1cfb27153803edb0f51" + +[[package]] +name = "heapless" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0bfb9eb618601c89945a70e254898da93b13be0388091d42117462b265bb3fad" +dependencies = [ + "hash32", + "stable_deref_trait", +] + +[[package]] +name = "heapless" +version = "0.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2af2455f757db2b292a9b1768c4b70186d443bcb3b316252d6b540aec1cd89ed" +dependencies = [ + "hash32", + "stable_deref_trait", +] + +[[package]] +name = "heck" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" + +[[package]] +name = "ident_case" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" + +[[package]] +name = "include_dir" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "923d117408f1e49d914f1a379a309cffe4f18c05cf4e3d12e613a15fc81bd0dd" +dependencies = [ + "include_dir_macros", +] + +[[package]] +name = "include_dir_macros" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7cab85a7ed0bd5f0e76d93846e0147172bed2e2d3f859bcc33a8d9699cad1a75" +dependencies = [ + "proc-macro2", + "quote", +] + +[[package]] +name = "indexmap" +version = "2.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d466e9454f08e4a911e14806c24e16fba1b4c121d1ea474396f396069cf949d9" +dependencies = [ + "equivalent", + "hashbrown", +] + +[[package]] +name = "itertools" +version = "0.10.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473" +dependencies = [ + "either", +] + +[[package]] +name = "itertools" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1c173a5686ce8bfa551b3563d0c2170bf24ca44da99c7ca4bfdab5418c3fe57" +dependencies = [ + "either", +] + +[[package]] +name = "itertools" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b192c782037fadd9cfa75548310488aabdbf3d2da73885b31bd0abd03351285" +dependencies = [ + "either", +] + +[[package]] +name = "itoa" +version = "1.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f42a60cbdf9a97f5d2305f08a87dc4e09308d1276d28c869c684d7777685682" + +[[package]] +name = "litrs" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "11d3d7f243d5c5a8b9bb5d6dd2b1602c0cb0b9db1621bafc7ed66e35ff9fe092" + +[[package]] +name = "manyhow" +version = "0.11.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b33efb3ca6d3b07393750d4030418d594ab1139cee518f0dc88db70fec873587" +dependencies = [ + "manyhow-macros", + "proc-macro2", + "quote", + "syn 1.0.109", + "syn 2.0.117", +] + +[[package]] +name = "manyhow-macros" +version = "0.11.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "46fce34d199b78b6e6073abf984c9cf5fd3e9330145a93ee0738a7443e371495" +dependencies = [ + "proc-macro-utils", + "proc-macro2", + "quote", +] + +[[package]] +name = "maybe-async-cfg" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8dbfaa67a76e2623580df07d6bb5e7956c0a4bae4b418314083a9c619bd66627" +dependencies = [ + "manyhow", + "proc-macro2", + "pulldown-cmark", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "mctp-rs" +version = "0.1.0" +source = "git+https://github.com/dymk/mctp-rs#3d941ba5205ca7781bf37e3dc7c5dfdc99a082d6" +dependencies = [ + "bit-register", + "defmt 0.3.100", + "embedded-batteries", + "espi-device", + "num_enum", + "smbus-pec", + "thiserror", +] + +[[package]] +name = "memchr" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8ca58f447f06ed17d5fc4043ce1b10dd205e060fb3ce5b979b8ed8e59ff3f79" + +[[package]] +name = "mimxrt600-fcb" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1ebf867c0f22d440f0ad393c28d2007af23c08953b9111379dd711083ae19a9" +dependencies = [ + "bitfield 0.15.0", +] + +[[package]] +name = "mimxrt633s-pac" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a580cd0048e0e5b1eee17208b7f95ba05ec7ca0175789333b2fa7241798d3cdc" +dependencies = [ + "cortex-m", + "cortex-m-rt", + "critical-section", + "defmt 1.0.1", + "vcell", +] + +[[package]] +name = "mimxrt685s-pac" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c8860258951178c4f91e42581ae8f33241a0e9a3e89bf2721d932ef366db51b" +dependencies = [ + "cortex-m", + "cortex-m-rt", + "critical-section", + "defmt 1.0.1", + "vcell", +] + +[[package]] +name = "nb" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "801d31da0513b6ec5214e9bf433a77966320625a37860f910be265be6e18d06f" +dependencies = [ + "nb 1.1.0", +] + +[[package]] +name = "nb" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8d5439c4ad607c3c23abf66de8c8bf57ba8adcd1f129e699851a6e43935d339d" + +[[package]] +name = "num-traits" +version = "0.2.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" +dependencies = [ + "autocfg", +] + +[[package]] +name = "num_enum" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d0bca838442ec211fa11de3a8b0e0e8f3a4522575b5c4c06ed722e005036f26" +dependencies = [ + "num_enum_derive", + "rustversion", +] + +[[package]] +name = "num_enum_derive" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "680998035259dcfcafe653688bf2aa6d3e2dc05e98be6ab46afb089dc84f1df8" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.117", +] + +[[package]] +name = "odp-service-common" +version = "0.1.0" +source = "git+https://github.com/OpenDevicePartnership/embedded-services?branch=v0.2.0#5a0ed0d9b2ea8607c8fd45fb11b52ce4864f0808" +dependencies = [ + "embedded-services", + "static_cell", +] + +[[package]] +name = "panic-probe" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fd402d00b0fb94c5aee000029204a46884b1262e0c443f166d86d2c0747e1a1a" +dependencies = [ + "cortex-m", + "defmt 1.0.1", +] + +[[package]] +name = "paste" +version = "1.0.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" + +[[package]] +name = "percent-encoding" +version = "2.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220" + +[[package]] +name = "platform-common" +version = "0.1.0" +dependencies = [ + "battery-service", + "bq40z50-rx", + "defmt 0.3.100", + "embassy-executor", + "embassy-sync 0.7.2", + "embassy-time", + "embedded-batteries-async", + "embedded-fans-async", + "embedded-hal 1.0.0", + "embedded-hal-async", + "embedded-mcu-hal", + "embedded-sensors-hal-async", + "embedded-services", + "odp-service-common", + "static_cell", + "thermal-service", + "time-alarm-service", +] + +[[package]] +name = "portable-atomic" +version = "1.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c33a9471896f1c69cecef8d20cbe2f7accd12527ce60845ff44c153bb2a21b49" + +[[package]] +name = "power-policy-interface" +version = "0.1.0" +source = "git+https://github.com/OpenDevicePartnership/embedded-services?branch=v0.2.0#5a0ed0d9b2ea8607c8fd45fb11b52ce4864f0808" +dependencies = [ + "bitfield 0.17.0", + "defmt 0.3.100", + "embassy-futures", + "embassy-sync 0.7.2", + "embedded-batteries-async", + "embedded-services", + "heapless 0.8.0", + "num_enum", +] + +[[package]] +name = "prettyplease" +version = "0.2.37" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "479ca8adacdd7ce8f1fb39ce9ecccbfe93a3f1344b3d0d97f20bc0196208f62b" +dependencies = [ + "proc-macro2", + "syn 2.0.117", +] + +[[package]] +name = "proc-macro-error-attr2" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96de42df36bb9bba5542fe9f1a054b8cc87e172759a1868aa05c1f3acc89dfc5" +dependencies = [ + "proc-macro2", + "quote", +] + +[[package]] +name = "proc-macro-error2" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "11ec05c52be0a07b08061f7dd003e7d7092e0472bc731b4af7bb1ef876109802" +dependencies = [ + "proc-macro-error-attr2", + "proc-macro2", + "quote", + "syn 2.0.117", +] + +[[package]] +name = "proc-macro-utils" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eeaf08a13de400bc215877b5bdc088f241b12eb42f0a548d3390dc1c56bb7071" +dependencies = [ + "proc-macro2", + "quote", + "smallvec", +] + +[[package]] +name = "proc-macro2" +version = "1.0.106" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8fd00f0bb2e90d81d1044c2b32617f68fcb9fa3bb7640c23e9c748e53fb30934" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "pulldown-cmark" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "679341d22c78c6c649893cbd6c3278dcbe9fc4faa62fea3a9296ae2b50c14625" +dependencies = [ + "bitflags 2.11.0", + "memchr", + "unicase", +] + +[[package]] +name = "quote" +version = "1.0.45" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41f2619966050689382d2b44f664f4bc593e129785a36d6ee376ddf37259b924" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "radium" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc33ff2d4973d518d823d61aa239014831e521c75da58e3df4840d3f47749d09" + +[[package]] +name = "rand_core" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76afc826de14238e6e8c374ddcc1fa19e374fd8dd986b0d2af0d02377261d83c" + +[[package]] +name = "rustc-hash" +version = "2.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94300abf3f1ae2e2b8ffb7b58043de3d399c73fa6f4b73826402a5c457614dbe" + +[[package]] +name = "rustc_version" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" +dependencies = [ + "semver", +] + +[[package]] +name = "rustversion" +version = "1.0.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b39cdef0fa800fc44525c84ccb54a029961a8215f9619753635a9c0d2538d46d" + +[[package]] +name = "semver" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" +dependencies = [ + "semver-parser", +] + +[[package]] +name = "semver-parser" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" + +[[package]] +name = "serde" +version = "1.0.228" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a8e94ea7f378bd32cbbd37198a4a91436180c5bb472411e48b5ec2e2124ae9e" +dependencies = [ + "serde_core", + "serde_derive", +] + +[[package]] +name = "serde_core" +version = "1.0.228" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41d385c7d4ca58e59fc732af25c3983b67ac852c1a25000afe1175de458b67ad" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.228" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.117", +] + +[[package]] +name = "serde_json" +version = "1.0.149" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "83fc039473c5595ace860d8c4fafa220ff474b3fc6bfdb4293327f1a37e94d86" +dependencies = [ + "itoa", + "memchr", + "serde", + "serde_core", + "zmij", +] + +[[package]] +name = "serde_spanned" +version = "0.6.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf41e0cfaf7226dca15e8197172c295a782857fcb97fad1808a166870dee75a3" +dependencies = [ + "serde", +] + +[[package]] +name = "smallvec" +version = "1.15.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67b1b7a3b5fe4f1376887184045fcf45c69e92af734b7aaddc05fb777b6fbd03" + +[[package]] +name = "smbus-pec" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca0763a680cd5d72b28f7bfc8a054c117d8841380a6ad4f72f05bd2a34217d3e" +dependencies = [ + "embedded-crc-macros", +] + +[[package]] +name = "stable_deref_trait" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596" + +[[package]] +name = "static_assertions" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" + +[[package]] +name = "static_cell" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0530892bb4fa575ee0da4b86f86c667132a94b74bb72160f58ee5a4afec74c23" +dependencies = [ + "portable-atomic", +] + +[[package]] +name = "storage_bus" +version = "0.1.0" +source = "git+https://github.com/OpenDevicePartnership/embedded-mcu#6956ebdaf9d3725959dae2c57c2ab6baefae9330" + +[[package]] +name = "strsim" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" + +[[package]] +name = "subenum" +version = "1.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec3d08fe7078c57309d5c3d938e50eba95ba1d33b9c3a101a8465fc6861a5416" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "syn 2.0.117", +] + +[[package]] +name = "syn" +version = "1.0.109" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "syn" +version = "2.0.117" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e665b8803e7b1d2a727f4023456bbbbe74da67099c585258af0ad9c5013b9b99" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "tap" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" + +[[package]] +name = "thermal-service" +version = "0.1.0" +source = "git+https://github.com/OpenDevicePartnership/embedded-services?branch=v0.2.0#5a0ed0d9b2ea8607c8fd45fb11b52ce4864f0808" +dependencies = [ + "defmt 0.3.100", + "embassy-futures", + "embassy-sync 0.7.2", + "embassy-time", + "embedded-fans-async", + "embedded-hal 1.0.0", + "embedded-hal-async", + "embedded-sensors-hal-async", + "embedded-services", + "heapless 0.8.0", + "mctp-rs", + "odp-service-common", + "thermal-service-messages", + "uuid", +] + +[[package]] +name = "thermal-service-messages" +version = "0.1.0" +source = "git+https://github.com/OpenDevicePartnership/embedded-services?branch=v0.2.0#5a0ed0d9b2ea8607c8fd45fb11b52ce4864f0808" +dependencies = [ + "defmt 0.3.100", + "embedded-services", + "num_enum", + "uuid", +] + +[[package]] +name = "thiserror" +version = "2.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4288b5bcbc7920c07a1149a35cf9590a2aa808e0bc1eafaade0b80947865fbc4" +dependencies = [ + "thiserror-impl", +] + +[[package]] +name = "thiserror-impl" +version = "2.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebc4ee7f67670e9b64d05fa4253e753e016c6c95ff35b89b7941d6b856dec1d5" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.117", +] + +[[package]] +name = "time-alarm-service" +version = "0.1.0" +source = "git+https://github.com/OpenDevicePartnership/embedded-services?branch=v0.2.0#5a0ed0d9b2ea8607c8fd45fb11b52ce4864f0808" +dependencies = [ + "bitfield 0.17.0", + "defmt 0.3.100", + "embassy-executor", + "embassy-futures", + "embassy-sync 0.7.2", + "embassy-time", + "embedded-mcu-hal", + "embedded-services", + "odp-service-common", + "time-alarm-service-messages", + "zerocopy", +] + +[[package]] +name = "time-alarm-service-messages" +version = "0.1.0" +source = "git+https://github.com/OpenDevicePartnership/embedded-services?branch=v0.2.0#5a0ed0d9b2ea8607c8fd45fb11b52ce4864f0808" +dependencies = [ + "bitfield 0.17.0", + "defmt 0.3.100", + "embedded-mcu-hal", + "embedded-services", + "num_enum", + "zerocopy", +] + +[[package]] +name = "tmp108" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e0d644cc97d3cee96793f454b834881f78b5d4e89c90ecf26b3690f42004d111" +dependencies = [ + "device-driver", + "embedded-hal 1.0.0", + "embedded-hal-async", + "embedded-sensors-hal-async", + "maybe-async-cfg", +] + +[[package]] +name = "toml" +version = "0.8.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc1beb996b9d83529a9e75c17a1686767d148d70663143c7854d8b4a09ced362" +dependencies = [ + "indexmap", + "serde", + "serde_spanned", + "toml_datetime", + "toml_edit", +] + +[[package]] +name = "toml_datetime" +version = "0.6.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22cddaf88f4fbc13c51aebbf5f8eceb5c7c5a9da2ac40a13519eb5b0a0e8f11c" +dependencies = [ + "serde", +] + +[[package]] +name = "toml_edit" +version = "0.22.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41fe8c660ae4257887cf66394862d21dbca4a6ddd26f04a3560410406a2f819a" +dependencies = [ + "indexmap", + "serde", + "serde_spanned", + "toml_datetime", + "toml_write", + "winnow", +] + +[[package]] +name = "toml_write" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d99f8c9a7727884afe522e9bd5edbfc91a3312b36a77b5fb8926e4c31a41801" + +[[package]] +name = "typenum" +version = "1.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "562d481066bde0658276a35467c4af00bdc6ee726305698a55b86e61d7ad82bb" + +[[package]] +name = "uart-service" +version = "0.1.0" +source = "git+https://github.com/OpenDevicePartnership/embedded-services?branch=v0.2.0#5a0ed0d9b2ea8607c8fd45fb11b52ce4864f0808" +dependencies = [ + "battery-service-messages", + "bitfield 0.17.0", + "debug-service-messages", + "defmt 0.3.100", + "embassy-futures", + "embassy-sync 0.7.2", + "embassy-time", + "embedded-io-async 0.6.1", + "embedded-services", + "mctp-rs", + "num_enum", + "thermal-service-messages", + "time-alarm-service-messages", +] + +[[package]] +name = "unicase" +version = "2.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dbc4bc3a9f746d862c45cb89d705aa10f187bb96c76001afab07a0d35ce60142" + +[[package]] +name = "unicode-ident" +version = "1.0.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6e4313cd5fcd3dad5cafa179702e2b244f760991f45397d14d4ebf38247da75" + +[[package]] +name = "unicode-segmentation" +version = "1.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9629274872b2bfaf8d66f5f15725007f635594914870f65218920345aa11aa8c" + +[[package]] +name = "unty" +version = "0.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d49784317cd0d1ee7ec5c716dd598ec5b4483ea832a2dced265471cc0f690ae" + +[[package]] +name = "uuid" +version = "1.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3cf4199d1e5d15ddd86a694e4d0dffa9c323ce759fea589f00fef9d81cc1931d" + +[[package]] +name = "vcell" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77439c1b53d2303b20d9459b1ade71a83c716e3f9c34f3228c00e6f185d6c002" + +[[package]] +name = "void" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" + +[[package]] +name = "volatile-register" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "de437e2a6208b014ab52972a27e59b33fa2920d3e00fe05026167a1c509d19cc" +dependencies = [ + "vcell", +] + +[[package]] +name = "winhec-demo" +version = "0.1.0" +dependencies = [ + "cortex-m", + "cortex-m-rt", + "defmt 0.3.100", + "defmt-rtt", + "embassy-embedded-hal 0.5.0", + "embassy-executor", + "embassy-imxrt", + "embassy-sync 0.7.2", + "embassy-time", + "embedded-fans-async", + "embedded-sensors-hal-async", + "embedded-services", + "mimxrt600-fcb", + "odp-service-common", + "panic-probe", + "platform-common", + "static_cell", + "thermal-service", + "tmp108", + "uart-service", +] + +[[package]] +name = "winnow" +version = "0.7.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df79d97927682d2fd8adb29682d1140b343be4ac0f08fd68b7765d9c059d3945" +dependencies = [ + "memchr", +] + +[[package]] +name = "wyz" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05f360fc0b24296329c78fda852a1e9ae82de9cf7b27dae4b7f62f118f77b9ed" +dependencies = [ + "tap", +] + +[[package]] +name = "zerocopy" +version = "0.8.48" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eed437bf9d6692032087e337407a86f04cd8d6a16a37199ed57949d415bd68e9" +dependencies = [ + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.8.48" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70e3cd084b1788766f53af483dd21f93881ff30d7320490ec3ef7526d203bad4" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.117", +] + +[[package]] +name = "zmij" +version = "1.0.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8848ee67ecc8aedbaf3e4122217aff892639231befc6a1b58d29fff4c2cabaa" diff --git a/platform/winhec-demo/Cargo.toml b/platform/winhec-demo/Cargo.toml new file mode 100644 index 0000000..819e0fa --- /dev/null +++ b/platform/winhec-demo/Cargo.toml @@ -0,0 +1,83 @@ +[package] +edition = "2021" +license = "MIT" +publish = false +name = "winhec-demo" +version = "0.1.0" + +[[bin]] +bench = false +name = "winhec-demo" +test = false + +[profile.release] +lto = true # better optimizations +codegen-units = 1 +debug = true +opt-level = "z" +panic = "abort" +incremental = false + +# Optimize dependencies for size but keep root crate unoptimized for better debuggability +[profile.dev.package."*"] +opt-level = "z" + +[lints.rust] +warnings = "deny" + +[lints.clippy] +correctness = "deny" +perf = "deny" +suspicious = "deny" +style = "deny" + +[dependencies] +cortex-m = { version = "0.7.7", features = [ + "inline-asm", + "critical-section-single-core", +] } +cortex-m-rt = "0.7.3" +defmt = "0.3.6" +defmt-rtt = "0.4.0" +embassy-embedded-hal = { version = "0.5.0", features = ["defmt"] } +embassy-executor = { version = "0.9.1", features = [ + "arch-cortex-m", + "executor-thread", + "executor-interrupt", + "defmt", +] } +embassy-imxrt = { git = "https://github.com/OpenDevicePartnership/embassy-imxrt", features = [ + "defmt", + "time-driver-os-timer", + "time", + "mimxrt685s", +] } +embassy-sync = { version = "0.7.2", features = ["defmt"] } +embassy-time = { version = "0.5.0", features = [ + "defmt", + "defmt-timestamp-uptime", +] } +embedded-fans-async = "0.2.0" +embedded-sensors-hal-async = "0.3.0" +embedded-services = { git = "https://github.com/OpenDevicePartnership/embedded-services", branch = "v0.2.0", features = [ + "defmt", +] } +odp-service-common = { git = "https://github.com/OpenDevicePartnership/embedded-services", branch = "v0.2.0" } +thermal-service = { git = "https://github.com/OpenDevicePartnership/embedded-services", branch = "v0.2.0", features = [ + "defmt", +] } +uart-service = { git = "https://github.com/OpenDevicePartnership/embedded-services", branch = "v0.2.0", features = [ + "defmt", +] } +tmp108 = { version = "0.4.0", features = [ + "async", + "embedded-sensors-hal-async", +] } +static_cell = "2.1.0" +platform-common = { path = "../platform-common", features = ["mock"] } + +mimxrt600-fcb = "0.2.0" +panic-probe = { version = "1.0.0", features = ["print-defmt"] } + +[package.metadata.cargo-machete] +ignored = ["cortex-m", "cortex-m-rt"] diff --git a/platform/winhec-demo/README.md b/platform/winhec-demo/README.md new file mode 100644 index 0000000..e656915 --- /dev/null +++ b/platform/winhec-demo/README.md @@ -0,0 +1,62 @@ +# winhec-demo + +This is a demo platform for WinHEC intended to run on a NXP RT685-EVK board. +It expects a TMP108 sensor breakout board and 5v 4-wire PWM fan connected to the board (see below for setup instructions). + +## Hardware +Ensure you have three components: + +### NXP RT685-EVK with Micro-B to Type-A USB Cable +![RT685-EVK](images/rt685-evk.jpg) + +### TMP108 breakout board with 4 female-to-male jumper wires +![TMP108 breakout board](images/tmp108.jpg) + +### 5v 4-wire PWM fan with 4 male-to-male jumper wires +![PWM Fan](images/fan.jpg) + +## Sensor Setup +Connect the female ends of the 4 female-to-male jumper wires to the male header pins of the TMP108 board. +From the perspective in the image below, this corresponds to the 4 left most pins (the 5th rightmost pin should be left floating). +This corresponds to GND, 3V3, SDA, SCL starting from the left. +I will reference the colors I show in the image but coloring doesn't matter as long as you remain consistent. +I am using brown for GND, violet for 3V3, blue for SDA, and yellow for SCL. +![Sensor female connection](images/sensor-female-connect.jpg) + +Now connect the male ends to the female J28 header of the RT685-EVK starting at the left most slot in the order shown below. +So based on the color coding I'm using above, the order below (from left to right) corresponds to SCL, SDA, 3V3, GND. +![Sensor male connection](images/sensor-male-connect.jpg) + +## Fan Setup +Connect 4 ends of the male-to-male jumper wires into the female fan connector. +Again coloring doesn't matter as long as you are consistent but I just match my jumper wire colors to the fan connector colors: +![Fan plug](images/fan-plug.jpg) + +Now connect the yellow wire (tachometer) and blue wire (PWM) to the female J27 header of the RT685-EVK like so (notice the gap between the wires): +![Fan GPIO](images/fan-gpio.jpg) + +Finally connect the black (GND) and red (5V) wires to the J29 female header on the RT685-EVK like so: +![Fan power](images/fan-power.jpg) + +## Power up +Connect the Micro-B end of the USB cable into the J5 (Link USB) header on the RT685-EVK: +![USB connection](images/usb.jpg) + +Double check all the connections described above, which should look like this: +![Overview](images/overview.jpg) + +If everything looks good, connect the type-A end of the USB cable into a USB port on your work machine. + +This will provide power, serial comms, and flashing capabilities. + +## Flash and test +If the board is powered up correctly (you see LEDs lit up and nothing is smoking), from the `platform/winhec-demo` folder run `cargo run --release` from a PowerShell terminal. This will build and flash the firmware. + +Confirm that the tmp108 sensor reading makes sense (e.g. we see 24 C here at room temperature), which verifies the sensor is connected correctly: + +![Running](images/running.png) + +I recommend touching the sensor to apply heat until it is above 25 C, which will cause the fan to turn on to confirm the fan is correctly connected as well. +If everything looks good, hit `Ctrl + C` to exit and detach probe-rs. +The board is now ready to be connected to a host. Please see the [QEMU SBSA](https://github.com/OpenDevicePartnership/odp-platform-qemu-sbsa/tree/winhec) repo or [RADXA Orion O6](https://github.com/OpenDevicePartnership/odp-platform-radxa-orion-o6) repo +for further instructions to connect to the board from those platforms. \ No newline at end of file diff --git a/platform/winhec-demo/build.rs b/platform/winhec-demo/build.rs new file mode 100644 index 0000000..1f5db67 --- /dev/null +++ b/platform/winhec-demo/build.rs @@ -0,0 +1,48 @@ +use std::env; +use std::fs::File; +use std::io::Write; +use std::path::PathBuf; + +fn main() { + // Put `memory.x` in our output directory and ensure it's + // on the linker search path. + let out = &PathBuf::from(env::var_os("OUT_DIR").unwrap()); + File::create(out.join("memory.x")) + .unwrap() + .write_all(include_bytes!("memory.x")) + .unwrap(); + println!("cargo:rustc-link-search={}", out.display()); + + // By default, Cargo will re-run a build script whenever + // any file in the project changes. By specifying `memory.x` + // here, we ensure the build script is only re-run when + // `memory.x` is changed. + println!("cargo:rerun-if-changed=memory.x"); + + let major = env!("CARGO_PKG_VERSION_MAJOR") + .parse::() + .expect("should have major version"); + + let minor = env!("CARGO_PKG_VERSION_MINOR") + .parse::() + .expect("should have minor version"); + + let inv_major = !major; + let inv_minor = !minor; + + // Inject crate version into the .biv section. + File::create(out.join("biv.rs")) + .unwrap() + .write_all( + format!( + r##" +#[unsafe(link_section = ".biv")] +#[used] +static BOOT_IMAGE_VERSION: u32 = 0x{:02x}{:02x}{:02x}{:02x}; +"##, + inv_major, inv_minor, major, minor, + ) + .as_bytes(), + ) + .unwrap(); +} diff --git a/platform/winhec-demo/images/fan-gpio.jpg b/platform/winhec-demo/images/fan-gpio.jpg new file mode 100644 index 0000000..65c2e84 Binary files /dev/null and b/platform/winhec-demo/images/fan-gpio.jpg differ diff --git a/platform/winhec-demo/images/fan-plug.jpg b/platform/winhec-demo/images/fan-plug.jpg new file mode 100644 index 0000000..72396a3 Binary files /dev/null and b/platform/winhec-demo/images/fan-plug.jpg differ diff --git a/platform/winhec-demo/images/fan-power.jpg b/platform/winhec-demo/images/fan-power.jpg new file mode 100644 index 0000000..17350c0 Binary files /dev/null and b/platform/winhec-demo/images/fan-power.jpg differ diff --git a/platform/winhec-demo/images/fan.jpg b/platform/winhec-demo/images/fan.jpg new file mode 100644 index 0000000..255e162 Binary files /dev/null and b/platform/winhec-demo/images/fan.jpg differ diff --git a/platform/winhec-demo/images/overview.jpg b/platform/winhec-demo/images/overview.jpg new file mode 100644 index 0000000..30e48fe Binary files /dev/null and b/platform/winhec-demo/images/overview.jpg differ diff --git a/platform/winhec-demo/images/rt685-evk.jpg b/platform/winhec-demo/images/rt685-evk.jpg new file mode 100644 index 0000000..737db16 Binary files /dev/null and b/platform/winhec-demo/images/rt685-evk.jpg differ diff --git a/platform/winhec-demo/images/running.png b/platform/winhec-demo/images/running.png new file mode 100644 index 0000000..5148875 Binary files /dev/null and b/platform/winhec-demo/images/running.png differ diff --git a/platform/winhec-demo/images/sensor-female-connect.jpg b/platform/winhec-demo/images/sensor-female-connect.jpg new file mode 100644 index 0000000..95e6672 Binary files /dev/null and b/platform/winhec-demo/images/sensor-female-connect.jpg differ diff --git a/platform/winhec-demo/images/sensor-male-connect.jpg b/platform/winhec-demo/images/sensor-male-connect.jpg new file mode 100644 index 0000000..0921846 Binary files /dev/null and b/platform/winhec-demo/images/sensor-male-connect.jpg differ diff --git a/platform/winhec-demo/images/tmp108.jpg b/platform/winhec-demo/images/tmp108.jpg new file mode 100644 index 0000000..0803b92 Binary files /dev/null and b/platform/winhec-demo/images/tmp108.jpg differ diff --git a/platform/winhec-demo/images/usb.jpg b/platform/winhec-demo/images/usb.jpg new file mode 100644 index 0000000..1d112ae Binary files /dev/null and b/platform/winhec-demo/images/usb.jpg differ diff --git a/platform/winhec-demo/memory.x b/platform/winhec-demo/memory.x new file mode 100644 index 0000000..6c84525 --- /dev/null +++ b/platform/winhec-demo/memory.x @@ -0,0 +1,34 @@ +MEMORY { + OTFAD : ORIGIN = 0x08000000, LENGTH = 256 + FCB : ORIGIN = 0x08000400, LENGTH = 512 + BIV : ORIGIN = 0x08000600, LENGTH = 4 + KEYSTORE : ORIGIN = 0x08000800, LENGTH = 2K + FLASH : ORIGIN = 0x08001000, LENGTH = 1M + RAM : ORIGIN = 0x20080000, LENGTH = 1536K +} + +SECTIONS { + .otfad : { + . = ALIGN(4); + KEEP(* (.otfad)) + . = ALIGN(4); + } > OTFAD + + .fcb : { + . = ALIGN(4); + KEEP(* (.fcb)) + . = ALIGN(4); + } > FCB + + .biv : { + . = ALIGN(4); + KEEP(* (.biv)) + . = ALIGN(4); + } > BIV + + .keystore : { + . = ALIGN(4); + KEEP(* (.keystore)) + . = ALIGN(4); + } > KEYSTORE +} diff --git a/platform/winhec-demo/src/board.rs b/platform/winhec-demo/src/board.rs new file mode 100644 index 0000000..02aefbd --- /dev/null +++ b/platform/winhec-demo/src/board.rs @@ -0,0 +1,62 @@ +use crate::fan; +use embassy_imxrt::{bind_interrupts, i2c, peripherals, uart}; +use embassy_sync::blocking_mutex::raw::ThreadModeRawMutex; +use embassy_sync::mutex::Mutex; +use platform_common::board::BoardIo; +use static_cell::StaticCell; + +bind_interrupts!(pub struct Irqs { + FLEXCOMM0 => uart::InterruptHandler; + FLEXCOMM2 => i2c::InterruptHandler; +}); + +static SENSOR_I2C_BUS: StaticCell>> = + StaticCell::new(); + +pub struct Board { + pub uart: uart::Uart<'static, uart::Async>, + pub sensor_i2c: &'static Mutex>, + pub fan_config: fan::FanConfig, +} + +impl BoardIo for Board { + type Peripherals = embassy_imxrt::Peripherals; + + fn init(p: Self::Peripherals) -> Self { + let uart = uart::Uart::new_async( + p.FLEXCOMM0, + p.PIO0_1, + p.PIO0_2, + Irqs, + p.DMA0_CH1, + p.DMA0_CH0, + Default::default(), + ) + .expect("Failed to initialize UART"); + + let sensor_i2c = SENSOR_I2C_BUS.init(Mutex::new( + i2c::master::I2cMaster::new_async( + p.FLEXCOMM2, + p.PIO0_18, + p.PIO0_17, + Irqs, + i2c::master::Config::default(), + p.DMA0_CH5, + ) + .expect("Failed to initialize sensor I2C bus"), + )); + + let fan_config = fan::FanConfig { + pwm_pin: p.PIO0_30, + pwm_match_channel: p.CTIMER4_COUNT_CHANNEL2, + pwm_period_channel: p.CTIMER4_COUNT_CHANNEL0, + tach_pin: p.PIO0_28, + }; + + Board { + uart, + sensor_i2c, + fan_config, + } + } +} diff --git a/platform/winhec-demo/src/fan/mod.rs b/platform/winhec-demo/src/fan/mod.rs new file mode 100644 index 0000000..281faae --- /dev/null +++ b/platform/winhec-demo/src/fan/mod.rs @@ -0,0 +1,82 @@ +pub(crate) mod physical_fan; +pub(crate) mod tachometer; + +use embassy_executor::Spawner; +use embassy_imxrt::gpio; +use embassy_imxrt::peripherals::{CTIMER4_COUNT_CHANNEL0, CTIMER4_COUNT_CHANNEL2, PIO0_28, PIO0_30}; +use embassy_imxrt::pwm::MicroSeconds; +use embassy_imxrt::timer::CTimerPwmPeriodChannel; +use embassy_imxrt::Peri; +use physical_fan::PhysicalFan; +use static_cell::StaticCell; +use thermal_service as ts; + +use crate::thermal::TMP108_ID; + +const SAMPLE_BUF_LEN: usize = 16; + +pub(crate) const FAN_ID: ts::fan::DeviceId = ts::fan::DeviceId(0); + +#[derive(Copy, Clone, Debug)] +pub(crate) struct FanError; + +pub(crate) struct FanConfig { + pub(crate) pwm_pin: Peri<'static, PIO0_30>, + pub(crate) pwm_match_channel: Peri<'static, CTIMER4_COUNT_CHANNEL2>, + pub(crate) pwm_period_channel: Peri<'static, CTIMER4_COUNT_CHANNEL0>, + pub(crate) tach_pin: Peri<'static, PIO0_28>, +} + +pub(crate) struct FanHandle { + pub fan: &'static ts::fan::Fan, +} + +pub(crate) async fn init(spawner: Spawner, config: FanConfig) -> Result { + tachometer::init(); + + static FAN_PWM_TIMER: StaticCell> = StaticCell::new(); + let pwm_timer = FAN_PWM_TIMER + .init(CTimerPwmPeriodChannel::new(config.pwm_period_channel, MicroSeconds(40)).map_err(|_| FanError)?); + + let driver = PhysicalFan::new( + config.pwm_pin, + pwm_timer, + config.pwm_match_channel, + tachometer::fan_tach().rpm(), + )?; + + let profile = ts::fan::Profile { + sensor_id: TMP108_ID, + auto_control: true, + on_temp: 25.0, + ramp_temp: 30.0, + max_temp: 35.0, + hysteresis: 0.0, + ..Default::default() + }; + + static FAN: StaticCell> = StaticCell::new(); + let fan = FAN.init(ts::fan::Fan::new(FAN_ID, driver, profile)); + + let tach_pin = gpio::Input::new(config.tach_pin, gpio::Pull::None, gpio::Inverter::Disabled); + spawner.must_spawn(tachometer::tachometer_task(tach_pin, tachometer::fan_tach())); + + Ok(FanHandle { fan }) +} + +pub(crate) async fn spawn_service( + spawner: Spawner, + handle: &FanHandle, + thermal_service: &'static ts::Service<'static>, +) { + type FanService = ts::fan::Service<'static, PhysicalFan, SAMPLE_BUF_LEN>; + odp_service_common::spawn_service!( + spawner, + FanService, + ts::fan::InitParams { + fan: handle.fan, + thermal_service, + } + ) + .expect("Failed to spawn fan service"); +} diff --git a/platform/winhec-demo/src/fan/physical_fan.rs b/platform/winhec-demo/src/fan/physical_fan.rs new file mode 100644 index 0000000..59d4099 --- /dev/null +++ b/platform/winhec-demo/src/fan/physical_fan.rs @@ -0,0 +1,73 @@ +use core::sync::atomic; +use embassy_imxrt::pwm::{CentiPercent, Pwm}; +use embassy_imxrt::timer::{CTimerMatchOutput, CTimerPwm, CTimerPwmPeriodChannel}; +use embassy_imxrt::Peri; +use embedded_fans_async::{Error, ErrorKind, ErrorType, Fan, RpmSense}; +use thermal_service as ts; +use ts::fan; + +pub(crate) struct PhysicalFan { + pwm: CTimerPwm<'static>, + rpm: &'static atomic::AtomicU16, +} + +impl PhysicalFan { + pub(crate) fn new( + pwm_pin: Peri<'static, impl CTimerMatchOutput>, + pwm_timer: &'static CTimerPwmPeriodChannel<'static>, + pwm_match_channel: Peri<'static, impl embassy_imxrt::timer::Instance>, + rpm: &'static atomic::AtomicU16, + ) -> Result { + let mut pwm: CTimerPwm<'static> = + CTimerPwm::new(pwm_match_channel, pwm_timer, pwm_pin).map_err(|_| super::FanError)?; + pwm.enable(()); + pwm.set_duty((), CentiPercent(0, 0)); + + Ok(Self { pwm, rpm }) + } +} + +#[derive(Clone, Copy, Debug)] +pub(crate) struct PhysicalFanError; +impl Error for PhysicalFanError { + fn kind(&self) -> ErrorKind { + ErrorKind::Other + } +} + +impl ErrorType for PhysicalFan { + type Error = PhysicalFanError; +} + +impl Fan for PhysicalFan { + fn min_rpm(&self) -> u16 { + 0 + } + + fn max_rpm(&self) -> u16 { + 6000 + } + + fn min_start_rpm(&self) -> u16 { + 3000 + } + + async fn set_speed_rpm(&mut self, rpm: u16) -> Result { + let duty = ((rpm - self.min_rpm()) as f32 / (self.max_rpm() - self.min_rpm()) as f32) * 100.0; + let duty = duty.clamp(0.0, 100.0) as u8; + self.pwm.set_duty((), CentiPercent(duty, 0)); + Ok(rpm) + } +} + +impl RpmSense for PhysicalFan { + async fn rpm(&mut self) -> Result { + Ok(self.rpm.load(atomic::Ordering::Acquire)) + } +} + +impl fan::CustomRequestHandler for PhysicalFan {} + +impl fan::RampResponseHandler for PhysicalFan {} + +impl fan::Controller for PhysicalFan {} diff --git a/platform/winhec-demo/src/fan/tachometer.rs b/platform/winhec-demo/src/fan/tachometer.rs new file mode 100644 index 0000000..97f9503 --- /dev/null +++ b/platform/winhec-demo/src/fan/tachometer.rs @@ -0,0 +1,72 @@ +use core::sync::atomic; +use embassy_imxrt::gpio; +use embassy_sync::signal::Signal; +use embassy_sync::{blocking_mutex::raw::ThreadModeRawMutex, once_lock::OnceLock}; +use embassy_time::{with_timeout, Duration}; + +static FAN_TACH: OnceLock = OnceLock::new(); + +pub(crate) struct Tachometer { + rpm: atomic::AtomicU16, + en_signal: Signal, + enabled: atomic::AtomicBool, +} + +impl Tachometer { + pub(crate) fn new() -> Self { + Self { + rpm: atomic::AtomicU16::new(0), + en_signal: Signal::new(), + enabled: atomic::AtomicBool::new(false), + } + } + + pub(crate) fn rpm(&self) -> &atomic::AtomicU16 { + &self.rpm + } + + pub(crate) fn enable(&self) { + self.enabled.store(true, atomic::Ordering::Release); + self.en_signal.signal(()); + } + + #[allow(dead_code)] + pub(crate) fn disable(&self) { + self.enabled.store(false, atomic::Ordering::Release); + } +} + +pub(crate) fn init() { + FAN_TACH.get_or_init(Tachometer::new); +} + +pub(crate) fn fan_tach() -> &'static Tachometer { + FAN_TACH + .try_get() + .expect("tachometer::init() must be called before this") +} + +#[embassy_executor::task] +pub(crate) async fn tachometer_task(mut tach_pin: gpio::Input<'static>, tachometer: &'static Tachometer) { + let window_ms = 1000; + let scale = 60_000 / window_ms as u16; + let pulses_per_rev = 2; + + loop { + if tachometer.enabled.load(atomic::Ordering::Acquire) { + let mut pulses = 0; + let _ = with_timeout(Duration::from_millis(window_ms), async { + loop { + tach_pin.wait_for_falling_edge().await.unwrap(); + pulses += 1; + } + }) + .await; + + let measured_rpm = (pulses * scale) / pulses_per_rev; + tachometer.rpm.store(measured_rpm, atomic::Ordering::Release); + } else { + tachometer.en_signal.wait().await; + } + } +} diff --git a/platform/winhec-demo/src/imxrt.rs b/platform/winhec-demo/src/imxrt.rs new file mode 100644 index 0000000..1c38a85 --- /dev/null +++ b/platform/winhec-demo/src/imxrt.rs @@ -0,0 +1,17 @@ +use mimxrt600_fcb::FlexSPIFlashConfigurationBlock; + +// auto-generated version information from Cargo.toml +include!(concat!(env!("OUT_DIR"), "/biv.rs")); + +#[unsafe(link_section = ".otfad")] +#[used] +static OTFAD: [u8; 256] = [0; 256]; + +#[rustfmt::skip] +#[unsafe(link_section = ".fcb")] +#[used] +static FCB: FlexSPIFlashConfigurationBlock = FlexSPIFlashConfigurationBlock::build(); + +#[unsafe(link_section = ".keystore")] +#[used] +static KEYSTORE: [u8; 2048] = [0; 2048]; diff --git a/platform/winhec-demo/src/main.rs b/platform/winhec-demo/src/main.rs new file mode 100644 index 0000000..b2c26bf --- /dev/null +++ b/platform/winhec-demo/src/main.rs @@ -0,0 +1,46 @@ +#![no_std] +#![no_main] + +mod board; +mod fan; +mod imxrt; +mod thermal; + +use board::Board; +use defmt::info; +use defmt_rtt as _; +use embassy_executor::Spawner; +use embassy_imxrt::uart; +use panic_probe as _; +use platform_common::board::BoardIo; +use platform_common::OdpRelayHandler; +use static_cell::StaticCell; + +#[embassy_executor::task] +async fn uart_service(uart: uart::Uart<'static, uart::Async>, relay: OdpRelayHandler<'static>) { + info!("Starting uart service"); + static UART_SERVICE: StaticCell> = StaticCell::new(); + let uart_service = uart_service::Service::new(relay).unwrap(); + let uart_service = UART_SERVICE.init(uart_service); + + let Err(e) = uart_service::task::uart_service(uart_service, uart).await; + panic!("uart-service error: {:?}", e); +} + +#[embassy_executor::main] +async fn main(spawner: Spawner) { + let p = embassy_imxrt::init(Default::default()); + let board = Board::init(p); + + embedded_services::init().await; + info!("WinHEC Demo platform starting up!"); + + let thermal = thermal::init(spawner, board.sensor_i2c, board.fan_config).await; + let battery = platform_common::mock::battery::init(spawner).await; + let tas = platform_common::mock::time_alarm::init(spawner).await; + + let relay = OdpRelayHandler::new(battery, thermal, tas); + spawner.must_spawn(uart_service(board.uart, relay)); + + spawner.must_spawn(thermal::monitor(thermal)); +} diff --git a/platform/winhec-demo/src/thermal/mod.rs b/platform/winhec-demo/src/thermal/mod.rs new file mode 100644 index 0000000..43b9d36 --- /dev/null +++ b/platform/winhec-demo/src/thermal/mod.rs @@ -0,0 +1,90 @@ +pub(crate) mod pts; + +use crate::fan; +use defmt::info; +use embassy_embedded_hal::shared_bus::asynch::i2c::I2cDevice; +use embassy_imxrt::i2c; +use embassy_sync::blocking_mutex::raw::ThreadModeRawMutex; +use embassy_sync::mutex::Mutex; +use embassy_sync::once_lock::OnceLock; +use pts::Pts; +use static_cell::StaticCell; +use thermal_service as ts; +use tmp108::Tmp108; + +const SAMPLE_BUF_LEN: usize = 16; +type Tmp108Type = Tmp108>>; +type Tmp108SensorType = ts::sensor::Sensor, SAMPLE_BUF_LEN>; + +pub(crate) const TMP108_ID: ts::sensor::DeviceId = ts::sensor::DeviceId(0); + +pub async fn init( + spawner: embassy_executor::Spawner, + sensor_i2c: &'static Mutex>, + fan_config: fan::FanConfig, +) -> &'static ts::Service<'static> { + info!("Initializing thermal service..."); + + let bus = I2cDevice::new(sensor_i2c); + let driver = Tmp108::new_with_a0_gnd(bus); + + let pts = Pts::new(driver); + static SENSOR: StaticCell = StaticCell::new(); + let sensor = SENSOR.init(ts::sensor::Sensor::new(TMP108_ID, pts, ts::sensor::Profile::default())); + let fan_handle = fan::init(spawner, fan_config).await.expect("Failed to initialize fan"); + + static SENSORS: StaticCell<[&'static ts::sensor::Device; 1]> = StaticCell::new(); + let sensors = SENSORS.init([sensor.device()]); + + static FANS: StaticCell<[&'static ts::fan::Device; 1]> = StaticCell::new(); + let fans = FANS.init([fan_handle.fan.device()]); + + static STORAGE: OnceLock> = OnceLock::new(); + let service = ts::Service::init(&STORAGE, sensors, fans).await; + + type Tmp108Service = ts::sensor::Service<'static, Pts, SAMPLE_BUF_LEN>; + odp_service_common::spawn_service!( + spawner, + Tmp108Service, + ts::sensor::InitParams { + sensor, + thermal_service: service, + } + ) + .expect("Failed to spawn TMP108 sensor service"); + + fan::spawn_service(spawner, &fan_handle, service).await; + + fan::tachometer::fan_tach().enable(); + service + .execute_fan_request(fan::FAN_ID, ts::fan::Request::EnableAutoControl) + .await + .expect("Failed to enable fan auto control"); + + info!("Thermal service initialized"); + service +} + +#[embassy_executor::task] +pub async fn monitor(thermal_service: &'static ts::Service<'static>) -> ! { + use embassy_time::Timer; + use embedded_services::error; + + loop { + match thermal_service + .execute_sensor_request(TMP108_ID, ts::sensor::Request::GetTemp) + .await + { + Ok(ts::sensor::ResponseData::Temp(temp)) => info!("TMP108 temp: {} C", temp), + _ => error!("Failed to read TMP108"), + } + match thermal_service + .execute_fan_request(fan::FAN_ID, ts::fan::Request::GetRpm) + .await + { + Ok(ts::fan::ResponseData::Rpm(rpm)) => info!("Fan RPM: {}", rpm), + _ => error!("Failed to read fan RPM"), + } + Timer::after_secs(5).await; + } +} diff --git a/platform/winhec-demo/src/thermal/pts.rs b/platform/winhec-demo/src/thermal/pts.rs new file mode 100644 index 0000000..d11e908 --- /dev/null +++ b/platform/winhec-demo/src/thermal/pts.rs @@ -0,0 +1,50 @@ +use embedded_sensors_hal_async::sensor as sensor_traits; +use embedded_sensors_hal_async::temperature::{DegreesCelsius, TemperatureSensor, TemperatureThresholdSet}; +use thermal_service::sensor; + +#[derive(Copy, Clone, Debug)] +pub(crate) struct PtsError; +impl sensor_traits::Error for PtsError { + fn kind(&self) -> sensor_traits::ErrorKind { + sensor_traits::ErrorKind::Other + } +} + +pub(crate) struct Pts { + driver: T, +} + +impl Pts { + pub(crate) fn new(driver: T) -> Self { + Self { driver } + } +} + +impl sensor_traits::ErrorType for Pts { + type Error = PtsError; +} + +impl TemperatureSensor for Pts { + async fn temperature(&mut self) -> Result { + self.driver.temperature().await.map_err(|_| PtsError) + } +} + +impl TemperatureThresholdSet for Pts { + async fn set_temperature_threshold_low(&mut self, threshold: DegreesCelsius) -> Result<(), Self::Error> { + self.driver + .set_temperature_threshold_low(threshold) + .await + .map_err(|_| PtsError) + } + + async fn set_temperature_threshold_high(&mut self, threshold: DegreesCelsius) -> Result<(), Self::Error> { + self.driver + .set_temperature_threshold_high(threshold) + .await + .map_err(|_| PtsError) + } +} + +impl sensor::CustomRequestHandler for Pts {} +impl sensor::Controller for Pts {} diff --git a/platform/winhec-demo/winhec-demo.code-workspace b/platform/winhec-demo/winhec-demo.code-workspace new file mode 100644 index 0000000..80930a6 --- /dev/null +++ b/platform/winhec-demo/winhec-demo.code-workspace @@ -0,0 +1,23 @@ +{ + "folders": [ + { + "path": "../.." + }, + { + "path": "." + } + ], + "settings": { + "rust-analyzer.checkOnSave": true, + "rust-analyzer.cargo.target": "thumbv8m.main-none-eabihf", + "rust-analyzer.linkedProjects": [ + "platform/winhec-demo/Cargo.toml" + ], + "rust-analyzer.check.workspace": false, + "terminal.integrated.cwd": ".", + // + // Variables for launch.json customization + // (grayed out in UI, but can be used in launch.json) + "platform": "winhec-demo", + }, +}