Skip to content

Commit b40d289

Browse files
committed
[opentitantool] Add set-pll command
This commit adds the `set-pll` command for configuring the output frequency of the PLL on CW310 to 100 MHz. Signed-off-by: Alphan Ulusoy <[email protected]>
1 parent 9153679 commit b40d289

File tree

4 files changed

+30
-0
lines changed

4 files changed

+30
-0
lines changed

sw/host/opentitantool/BUILD

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ rust_binary(
1818
"src/command/image.rs",
1919
"src/command/load_bitstream.rs",
2020
"src/command/mod.rs",
21+
"src/command/set_pll.rs",
2122
"src/command/spi.rs",
2223
"src/main.rs",
2324
],

sw/host/opentitantool/src/command/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ pub mod hello;
1010
pub mod i2c;
1111
pub mod image;
1212
pub mod load_bitstream;
13+
pub mod set_pll;
1314
pub mod spi;
1415

1516
use anyhow::Result;
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
// Copyright lowRISC contributors.
2+
// Licensed under the Apache License, Version 2.0, see LICENSE for details.
3+
// SPDX-License-Identifier: Apache-2.0
4+
5+
use anyhow::Result;
6+
use erased_serde::Serialize;
7+
use std::any::Any;
8+
use structopt::StructOpt;
9+
10+
use opentitanlib::app::command::CommandDispatch;
11+
use opentitanlib::app::TransportWrapper;
12+
use opentitanlib::transport::cw310;
13+
14+
/// Program the CDCE906 PLL chip with defaults.
15+
#[derive(Debug, StructOpt)]
16+
pub struct SetPll {}
17+
18+
impl CommandDispatch for SetPll {
19+
fn run(
20+
&self,
21+
_context: &dyn Any,
22+
transport: &TransportWrapper,
23+
) -> Result<Option<Box<dyn Serialize>>> {
24+
log::info!("Programming the CDCE906 PLL chip with defaults");
25+
Ok(transport.dispatch(&cw310::SetPll {})?)
26+
}
27+
}

sw/host/opentitantool/src/main.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ enum RootCommandHierarchy {
3030

3131
I2c(command::i2c::I2cCommand),
3232
Image(command::image::Image),
33+
SetPll(command::set_pll::SetPll),
3334
LoadBitstream(command::load_bitstream::LoadBitstream),
3435
NoOp(command::NoOp),
3536
Spi(command::spi::SpiCommand),

0 commit comments

Comments
 (0)