diff --git a/Cargo.toml b/Cargo.toml index 541d1a6..0781e70 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,39 +1,7 @@ -[package] -name = "allwinner-hal" -version = "0.0.0" -edition = "2021" -description = "Allwinner SoC driver support" -authors = [ - "Luo Jia ", - "Gao Chengbo ", -] -repository = "https://github.com/rustsbi/allwinner-hal" -documentation = "https://docs.rs/allwinner-hal" -license = "MulanPSL-2.0 OR MIT" -readme = "README.md" -keywords = ["hal", "allwinner"] -categories = ["os", "embedded", "hardware-support", "no-std"] - -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html - -[dependencies] -volatile-register = "0.2.1" -embedded-hal = "1.0.0" -embedded-io = "0.6.1" -embedded-time = "0.12.1" -uart16550 = "0.0.1" -plic = "0.0.2" - -[dev-dependencies] -memoffset = "0.8" - -[features] -default = ["d1"] -# D1-like chips: D1-H, D1s, F133. -d1 = [] - [workspace] +resolver = "2" members = [ + "allwinner-hal", "allwinner-rt", "allwinner-rt/macros", "examples/nezha-d1", diff --git a/README.md b/README.md index 1735d96..c6d4824 100644 --- a/README.md +++ b/README.md @@ -1,37 +1,15 @@ # allwinner-hal -[![crates.io](https://img.shields.io/crates/v/allwinner-hal.svg)](https://crates.io/crates/allwinner-hal) -[![Documentation](https://docs.rs/allwinner-hal/badge.svg)](https://docs.rs/allwinner-hal) -![License](https://img.shields.io/crates/l/allwinner-hal.svg) +Allwinner-HAL仓库包含以下的项目. -全志芯片组件化外设驱动;外设包括DDR控制器。 - -## 支持列表 - -组件化外设驱动可根据外设基地址提供驱动支持,这要求外设的设计(寄存器定义和功能等)相同; -大多数情况下,外设IP核相同就能满足以上条件。 - -按此要求,虽然全志系列芯片大部分外设IP核都是共享的,但本项目只测试了一部分芯片的兼容性。 -经过测试能够运行本项目的芯片如下。 - -| 系列* | CCU | GPIO | SPI | UART | -|:-----|:----|:----|:----|:----| -| D1系列 | ○ | ○ | ○ | ○ | - -✓:可运行,功能完整 -○:可运行,详细功能仍需完善 -×:暂未支持 - -*全志芯片中有一部分型号的外设基地址布局相同,即使其中的处理器核可能不相同。 -本项目称这些芯片为一个系列,并以系列中首个发布的芯片型号命名。 - -理论上兼容,但尚未经过测试的芯片型号如下: - -- D1系列:D1s, F133, V853, R128 +| 项目 | crates.io | 文档 | 许可协议 | +|:----|:-----------|:------|:--------| +| [`allwinner-hal`](./allwinner-hal/) | [![crates.io](https://img.shields.io/crates/v/allwinner-hal.svg)](https://crates.io/crates/allwinner-hal) | [![Documentation](https://docs.rs/allwinner-hal/badge.svg)](https://docs.rs/allwinner-hal) | ![License](https://img.shields.io/crates/l/allwinner-hal.svg) | +| [`allwinner-rt`](./allwinner-rt/) | [![crates.io](https://img.shields.io/crates/v/allwinner-rt.svg)](https://crates.io/crates/allwinner-rt) | [![Documentation](https://docs.rs/allwinner-rt/badge.svg)](https://docs.rs/allwinner-rt) | ![License](https://img.shields.io/crates/l/allwinner-rt.svg) | ## 许可协议 -本项目使用MIT和Mulan-PSL v2.0双许可协议。 +本仓库的所有项目使用MIT和Mulan-PSL v2.0双许可协议。 ## 参考资料 diff --git a/CHANGELOG.md b/allwinner-hal/CHANGELOG.md similarity index 100% rename from CHANGELOG.md rename to allwinner-hal/CHANGELOG.md diff --git a/allwinner-hal/Cargo.toml b/allwinner-hal/Cargo.toml new file mode 100644 index 0000000..dc44e8a --- /dev/null +++ b/allwinner-hal/Cargo.toml @@ -0,0 +1,33 @@ +[package] +name = "allwinner-hal" +version = "0.0.0" +edition = "2021" +description = "Allwinner SoC driver support" +authors = [ + "Luo Jia ", + "Gao Chengbo ", +] +repository = "https://github.com/rustsbi/allwinner-hal" +documentation = "https://docs.rs/allwinner-hal" +license = "MulanPSL-2.0 OR MIT" +readme = "README.md" +keywords = ["hal", "allwinner"] +categories = ["os", "embedded", "hardware-support", "no-std"] + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] +volatile-register = "0.2.1" +embedded-hal = "1.0.0" +embedded-io = "0.6.1" +embedded-time = "0.12.1" +uart16550 = "0.0.1" +plic = "0.0.2" + +[dev-dependencies] +memoffset = "0.8" + +[features] +default = ["d1"] +# D1-like chips: D1-H, D1s, F133. +d1 = [] diff --git a/allwinner-hal/README.md b/allwinner-hal/README.md new file mode 100644 index 0000000..1735d96 --- /dev/null +++ b/allwinner-hal/README.md @@ -0,0 +1,41 @@ +# allwinner-hal + +[![crates.io](https://img.shields.io/crates/v/allwinner-hal.svg)](https://crates.io/crates/allwinner-hal) +[![Documentation](https://docs.rs/allwinner-hal/badge.svg)](https://docs.rs/allwinner-hal) +![License](https://img.shields.io/crates/l/allwinner-hal.svg) + +全志芯片组件化外设驱动;外设包括DDR控制器。 + +## 支持列表 + +组件化外设驱动可根据外设基地址提供驱动支持,这要求外设的设计(寄存器定义和功能等)相同; +大多数情况下,外设IP核相同就能满足以上条件。 + +按此要求,虽然全志系列芯片大部分外设IP核都是共享的,但本项目只测试了一部分芯片的兼容性。 +经过测试能够运行本项目的芯片如下。 + +| 系列* | CCU | GPIO | SPI | UART | +|:-----|:----|:----|:----|:----| +| D1系列 | ○ | ○ | ○ | ○ | + +✓:可运行,功能完整 +○:可运行,详细功能仍需完善 +×:暂未支持 + +*全志芯片中有一部分型号的外设基地址布局相同,即使其中的处理器核可能不相同。 +本项目称这些芯片为一个系列,并以系列中首个发布的芯片型号命名。 + +理论上兼容,但尚未经过测试的芯片型号如下: + +- D1系列:D1s, F133, V853, R128 + +## 许可协议 + +本项目使用MIT和Mulan-PSL v2.0双许可协议。 + +## 参考资料 + +以下资料提供了全志芯片驱动的参考设计或社区设计,供贡献者参考。 + +- RT-Thread驱动:https://gitee.com/rtthread/rt-thread/tree/master/bsp/allwinner/libraries/sunxi-hal/hal/source +- TinyKasKit项目:https://github.com/YuzukiHD/TinyKasKit diff --git a/src/ccu.rs b/allwinner-hal/src/ccu.rs similarity index 100% rename from src/ccu.rs rename to allwinner-hal/src/ccu.rs diff --git a/src/com.rs b/allwinner-hal/src/com.rs similarity index 100% rename from src/com.rs rename to allwinner-hal/src/com.rs diff --git a/src/gpio.rs b/allwinner-hal/src/gpio.rs similarity index 100% rename from src/gpio.rs rename to allwinner-hal/src/gpio.rs diff --git a/src/lib.rs b/allwinner-hal/src/lib.rs similarity index 100% rename from src/lib.rs rename to allwinner-hal/src/lib.rs diff --git a/src/phy.rs b/allwinner-hal/src/phy.rs similarity index 100% rename from src/phy.rs rename to allwinner-hal/src/phy.rs diff --git a/src/smhc.rs b/allwinner-hal/src/smhc.rs similarity index 100% rename from src/smhc.rs rename to allwinner-hal/src/smhc.rs diff --git a/src/spi.rs b/allwinner-hal/src/spi.rs similarity index 100% rename from src/spi.rs rename to allwinner-hal/src/spi.rs diff --git a/src/sysctl.rs b/allwinner-hal/src/sysctl.rs similarity index 100% rename from src/sysctl.rs rename to allwinner-hal/src/sysctl.rs diff --git a/src/uart.rs b/allwinner-hal/src/uart.rs similarity index 100% rename from src/uart.rs rename to allwinner-hal/src/uart.rs diff --git a/src/wafer/d1.rs b/allwinner-hal/src/wafer/d1.rs similarity index 100% rename from src/wafer/d1.rs rename to allwinner-hal/src/wafer/d1.rs diff --git a/allwinner-rt/.gitignore b/allwinner-rt/.gitignore deleted file mode 100644 index 4fffb2f..0000000 --- a/allwinner-rt/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -/target -/Cargo.lock diff --git a/allwinner-rt/Cargo.toml b/allwinner-rt/Cargo.toml index 6d82b4e..b54221d 100644 --- a/allwinner-rt/Cargo.toml +++ b/allwinner-rt/Cargo.toml @@ -18,7 +18,7 @@ categories = ["embedded", "hardware-support", "no-std"] [dependencies] allwinner-rt-macros = { version = "0.0.0", path = "macros" } -allwinner-hal = { version = "0.0.0", features = ["d1"], path = ".." } +allwinner-hal = { version = "0.0.0", features = ["d1"], path = "../allwinner-hal" } embedded-hal = "1.0.0" embedded-time = "0.12.1" nb = "1.1.0" diff --git a/examples/nezha-d1/Cargo.toml b/examples/nezha-d1/Cargo.toml index c4581a5..fa9bd9f 100644 --- a/examples/nezha-d1/Cargo.toml +++ b/examples/nezha-d1/Cargo.toml @@ -5,7 +5,7 @@ edition = "2021" publish = false [dependencies] -allwinner-hal = { path = "../.." } +allwinner-hal = { path = "../../allwinner-hal" } allwinner-rt = { path = "../../allwinner-rt" } panic-halt = "0.2.0" embedded-io = "0.6.1" diff --git a/examples/sdmmc/Cargo.toml b/examples/sdmmc/Cargo.toml index 749852a..defb957 100644 --- a/examples/sdmmc/Cargo.toml +++ b/examples/sdmmc/Cargo.toml @@ -5,7 +5,7 @@ edition = "2021" publish = false [dependencies] -allwinner-hal = { path = "../.." } +allwinner-hal = { path = "../../allwinner-hal" } allwinner-rt = { path = "../../allwinner-rt" } panic-halt = "0.2.0" embedded-io = "0.6.1"