Skip to content

Commit b7b2d97

Browse files
authored
Merge pull request #9 from lxuxx/develop
Add gpio and its test.
2 parents c0a4b53 + 58377a1 commit b7b2d97

File tree

6 files changed

+861
-232
lines changed

6 files changed

+861
-232
lines changed

Cargo.lock

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ embedded-io = "0.6.1"
3333
fugit = "0.3.7"
3434
proposed-traits = { git = "https://github.com/rusty1968/proposed_traits.git", package = "proposed-traits", rev = "85641310df5a5276c67f81621b104322cff0286c" }
3535
hex-literal = "0.4"
36+
paste = "1.0"
3637

3738
cortex-m = { version = "0.7.5" }
3839
cortex-m-rt = { version = "0.6.5", features = ["device"] }

src/main.rs

Lines changed: 3 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
#![no_std]
44
#![no_main]
55

6-
use aspeed_ddk::gpio::{gpiol, GpioExt};
76
use core::sync::atomic::AtomicBool;
87
// use core::arch::asm;
98
use aspeed_ddk::uart::{Config, UartController};
@@ -16,10 +15,10 @@ use aspeed_ddk::hace_controller::HaceController;
1615
use aspeed_ddk::rsa::AspeedRsa;
1716
use aspeed_ddk::spi;
1817
use aspeed_ddk::syscon::{ClockId, ResetId, SysCon};
19-
use embedded_hal::digital::OutputPin;
2018
use fugit::MillisDurationU32 as MilliSeconds;
2119

2220
use aspeed_ddk::tests::functional::ecdsa_test::run_ecdsa_tests;
21+
use aspeed_ddk::tests::functional::gpio_test;
2322
use aspeed_ddk::tests::functional::hash_test::run_hash_tests;
2423
use aspeed_ddk::tests::functional::hmac_test::run_hmac_tests;
2524
use aspeed_ddk::tests::functional::rsa_test::run_rsa_tests;
@@ -97,26 +96,6 @@ fn test_wdt(uart: &mut UartController<'_>) {
9796
}
9897
}
9998

100-
fn test_gpio_flash_power(uart: &mut UartController<'_>) {
101-
let mut delay = DummyDelay {};
102-
if true {
103-
/* Older demo board required this */
104-
let peripherals = unsafe { Peripherals::steal() };
105-
let gpio = peripherals.gpio;
106-
let gpiol = gpiol::GPIOL::new(gpio).split();
107-
uart.write_all(b"\r\n####### GPIO test #######\r\n")
108-
.unwrap();
109-
110-
let mut pl2 = gpiol.pl2.into_push_pull_output();
111-
pl2.set_high().unwrap();
112-
uart.write_all(b"\r\nGPIOL2 set high\r\n").unwrap();
113-
let mut pl3 = gpiol.pl3.into_push_pull_output();
114-
pl3.set_high().unwrap();
115-
uart.write_all(b"\r\nGPIOL3 set high\r\n").unwrap();
116-
delay.delay_ns(1_000_000);
117-
}
118-
}
119-
12099
#[no_mangle]
121100
pub static HALT: AtomicBool = AtomicBool::new(true);
122101

@@ -184,15 +163,15 @@ fn main() -> ! {
184163

185164
let mut rsa = AspeedRsa::new(&secure, delay);
186165
run_rsa_tests(&mut uart_controller, &mut rsa);
187-
166+
gpio_test::test_gpioa(&mut uart_controller);
188167
test_wdt(&mut uart_controller);
189168

190169
let test_spicontroller = false;
191170
if test_spicontroller {
192171
spi::spitest::test_fmc(&mut uart_controller);
193172
spi::spitest::test_spi(&mut uart_controller);
194173

195-
test_gpio_flash_power(&mut uart_controller);
174+
gpio_test::test_gpio_flash_power(&mut uart_controller);
196175
spi::spitest::test_spi2(&mut uart_controller);
197176
}
198177
// Initialize the peripherals here if needed

0 commit comments

Comments
 (0)