blob: d26879dd739033e48287cb6255dbd41db565578a [file] [log] [blame]
// Copyright lowRISC contributors.
// Licensed under the Apache License, Version 2.0, see LICENSE for details.
// SPDX-License-Identifier: Apache-2.0
use anyhow::Result;
use serde_annotate::Annotate;
use std::any::Any;
use std::time::Duration;
use structopt::StructOpt;
use opentitanlib::app::TransportWrapper;
use opentitanlib::app::command::CommandDispatch;
/// Boot the target device.
#[derive(Debug, StructOpt)]
pub struct BootCommand {
}
impl CommandDispatch for BootCommand {
fn run(
&self,
_context: &dyn Any,
transport: &TransportWrapper,
) -> Result<Option<Box<dyn Annotate>>> {
let reset_pin = transport.gpio_pin("RESET")?;
transport.apply_pin_strapping("RUN")?;
// Active-low RESET
reset_pin.write(true)?;
reset_pin.write(false)?;
reset_pin.write(true)?;
std::thread::sleep(Duration::from_millis(1000));
Ok(None)
}
}