Skip to content

Commit cdffe6a

Browse files
committed
GPIO test functions moved out of main.
1 parent ad804d6 commit cdffe6a

File tree

2 files changed

+4
-26
lines changed

2 files changed

+4
-26
lines changed

src/main.rs

Lines changed: 1 addition & 23 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,7 +15,6 @@ 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;
@@ -98,26 +96,6 @@ fn test_wdt(uart: &mut UartController<'_>) {
9896
}
9997
}
10098

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

@@ -193,7 +171,7 @@ fn main() -> ! {
193171
spi::spitest::test_fmc(&mut uart_controller);
194172
spi::spitest::test_spi(&mut uart_controller);
195173

196-
test_gpio_flash_power(&mut uart_controller);
174+
gpio_test::test_gpio_flash_power(&mut uart_controller);
197175
spi::spitest::test_spi2(&mut uart_controller);
198176
}
199177
// Initialize the peripherals here if needed

src/tests/functional/gpio_test.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@ pub fn test_gpioa(uart: &mut UartController<'_>) {
5555
.unwrap();
5656
}
5757
}
58-
#[allow(dead_code)]
59-
fn test_gpio_flash_power(uart: &mut UartController<'_>) {
58+
59+
pub fn test_gpio_flash_power(uart: &mut UartController<'_>) {
6060
let mut delay = DummyDelay {};
6161
if true {
6262
/* Older demo board required this */
@@ -76,7 +76,7 @@ fn test_gpio_flash_power(uart: &mut UartController<'_>) {
7676
}
7777
}
7878
#[allow(dead_code)]
79-
fn test_gpio_bmc_reset(uart: &mut UartController<'_>) {
79+
pub fn test_gpio_bmc_reset(uart: &mut UartController<'_>) {
8080
{
8181
let peripherals = unsafe { Peripherals::steal() };
8282
let gpio = peripherals.gpio;

0 commit comments

Comments
 (0)