mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-17 08:40:52 +00:00
incorporate i2c module, pretty prints
This commit is contained in:
parent
24bd9da6ab
commit
c113c4e9bd
4 changed files with 15 additions and 11 deletions
|
|
@ -8,7 +8,9 @@ edition = "2021"
|
||||||
[dependencies]
|
[dependencies]
|
||||||
log = "0.4.14"
|
log = "0.4.14"
|
||||||
defmt = { version = "0.3", optional = true }
|
defmt = { version = "0.3", optional = true }
|
||||||
utralib = { version = "0.1.24", default-features = false, features = ["cramium-soc"] }
|
utralib = { version = "0.1.24", default-features = false, features = [
|
||||||
|
"cramium-soc",
|
||||||
|
] }
|
||||||
|
|
||||||
[target.'cfg(target_os = "xous")'.dependencies]
|
[target.'cfg(target_os = "xous")'.dependencies]
|
||||||
xous = "0.9.61"
|
xous = "0.9.61"
|
||||||
|
|
|
||||||
5
libs/xous-bio/src/bio_tests/i2c.rs
Normal file
5
libs/xous-bio/src/bio_tests/i2c.rs
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
use crate::*;
|
||||||
|
|
||||||
|
pub fn i2c_test() {
|
||||||
|
print!("I2C tests\r");
|
||||||
|
}
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
mod debug;
|
||||||
|
pub mod i2c;
|
||||||
pub mod spi;
|
pub mod spi;
|
||||||
pub mod units;
|
pub mod units;
|
||||||
|
|
||||||
|
|
@ -88,6 +90,7 @@ pub fn report_api(d: u32) {
|
||||||
pub fn bio_tests() {
|
pub fn bio_tests() {
|
||||||
report_api(crate::get_id());
|
report_api(crate::get_id());
|
||||||
|
|
||||||
|
i2c::i2c_test();
|
||||||
units::fifo_level_tests();
|
units::fifo_level_tests();
|
||||||
spi::spi_test();
|
spi::spi_test();
|
||||||
units::hello_world();
|
units::hello_world();
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,6 @@ use utralib::generated::*;
|
||||||
#[cfg(feature = "tests")]
|
#[cfg(feature = "tests")]
|
||||||
pub mod bio_tests;
|
pub mod bio_tests;
|
||||||
|
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub enum BioError {
|
pub enum BioError {
|
||||||
/// specified state machine is not valid
|
/// specified state machine is not valid
|
||||||
|
|
@ -77,14 +76,11 @@ impl BioSharedState {
|
||||||
let imem_slice = unsafe {
|
let imem_slice = unsafe {
|
||||||
core::slice::from_raw_parts_mut(
|
core::slice::from_raw_parts_mut(
|
||||||
utralib::generated::HW_BIO_RAM_MEM as *mut u32,
|
utralib::generated::HW_BIO_RAM_MEM as *mut u32,
|
||||||
utralib::generated::HW_BIO_RAM_MEM_LEN
|
utralib::generated::HW_BIO_RAM_MEM_LEN,
|
||||||
)
|
)
|
||||||
};
|
};
|
||||||
|
|
||||||
BioSharedState {
|
BioSharedState { bio: CSR::new(utra::bio::HW_BIO_BASE as *mut u32), imem_slice }
|
||||||
bio: CSR::new(utra::bio::HW_BIO_BASE as *mut u32),
|
|
||||||
imem_slice,
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(not(feature = "baremetal"))]
|
#[cfg(not(feature = "baremetal"))]
|
||||||
|
|
@ -98,9 +94,7 @@ impl BioSharedState {
|
||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
BioSharedState {
|
BioSharedState { bio: CSR::new(csr.as_mut_ptr() as *mut u32) }
|
||||||
bio: CSR::new(csr.as_mut_ptr() as *mut u32),
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn load_code(&mut self, prog: &[u8], offset_bytes: usize) {
|
pub fn load_code(&mut self, prog: &[u8], offset_bytes: usize) {
|
||||||
|
|
@ -160,4 +154,4 @@ macro_rules! bio_code {
|
||||||
".word .",
|
".word .",
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue