mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-17 08:40:52 +00:00
fix xous implementation
This commit is contained in:
parent
24b6d4cb42
commit
c7f835a93f
2 changed files with 12 additions and 21 deletions
|
|
@ -525,9 +525,9 @@ fn main() {
|
||||||
}
|
}
|
||||||
HalOpcode::ConfigureBio => {
|
HalOpcode::ConfigureBio => {
|
||||||
if let Some(scalar) = msg_opt.as_mut().unwrap().body.scalar_message_mut() {
|
if let Some(scalar) = msg_opt.as_mut().unwrap().body.scalar_message_mut() {
|
||||||
let port: IoxPort = num_traits::FromPrimitive::from_usize(scalar.arg1).unwrap();
|
|
||||||
let pin = scalar.arg2 as u8;
|
|
||||||
if scalar.arg3 == 0 {
|
if scalar.arg3 == 0 {
|
||||||
|
let port: IoxPort = num_traits::FromPrimitive::from_usize(scalar.arg1).unwrap();
|
||||||
|
let pin = scalar.arg2 as u8;
|
||||||
match iox.set_bio_bit_from_port_and_pin(port, pin) {
|
match iox.set_bio_bit_from_port_and_pin(port, pin) {
|
||||||
Some(bit) => {
|
Some(bit) => {
|
||||||
scalar.arg1 = bit as usize;
|
scalar.arg1 = bit as usize;
|
||||||
|
|
|
||||||
|
|
@ -33,6 +33,7 @@ fn bio_service(clk_freq: u32) {
|
||||||
match bio_ss.init_core(config.core, &config.code, config.offset, config.config) {
|
match bio_ss.init_core(config.core, &config.code, config.offset, config.config) {
|
||||||
Ok(freq) => {
|
Ok(freq) => {
|
||||||
config.actual_freq = freq;
|
config.actual_freq = freq;
|
||||||
|
config.result = BioError::None;
|
||||||
}
|
}
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
config.result = e;
|
config.result = e;
|
||||||
|
|
@ -49,19 +50,12 @@ fn bio_service(clk_freq: u32) {
|
||||||
}
|
}
|
||||||
BioOp::GetCoreHandle => {
|
BioOp::GetCoreHandle => {
|
||||||
if let Some(scalar) = msg_opt.as_mut().unwrap().body.scalar_message_mut() {
|
if let Some(scalar) = msg_opt.as_mut().unwrap().body.scalar_message_mut() {
|
||||||
let mut free_handle: Option<usize> = None;
|
let index = scalar.arg1;
|
||||||
for (i, used) in handles_used.iter().enumerate() {
|
if !handles_used[index] {
|
||||||
if !used {
|
|
||||||
free_handle = Some(i);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if let Some(index) = free_handle {
|
|
||||||
handles_used[index] = true;
|
handles_used[index] = true;
|
||||||
scalar.arg1 = index;
|
scalar.arg1 = 1; // set valid bit
|
||||||
scalar.arg2 = 1; // set valid bit
|
|
||||||
} else {
|
} else {
|
||||||
scalar.arg2 = 0; // set invalid - no free handles available
|
scalar.arg1 = 0; // set invalid - handle already in use
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -105,14 +99,11 @@ fn bio_service(clk_freq: u32) {
|
||||||
}
|
}
|
||||||
BioOp::CoreState => {
|
BioOp::CoreState => {
|
||||||
if let Some(scalar) = msg_opt.as_mut().unwrap().body.scalar_message_mut() {
|
if let Some(scalar) = msg_opt.as_mut().unwrap().body.scalar_message_mut() {
|
||||||
bio_ss
|
let which =
|
||||||
.set_core_state([
|
[scalar.arg1.into(), scalar.arg2.into(), scalar.arg3.into(), scalar.arg4.into()];
|
||||||
scalar.arg1.into(),
|
log::debug!("setting: {:?}", which);
|
||||||
scalar.arg2.into(),
|
bio_ss.set_core_state(which).unwrap();
|
||||||
scalar.arg3.into(),
|
log::debug!("core state: {:x}", bio_ss.bio.r(utralib::utra::bio_bdma::SFR_CTRL));
|
||||||
scalar.arg4.into(),
|
|
||||||
])
|
|
||||||
.unwrap();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
BioOp::DmaWindows => {
|
BioOp::DmaWindows => {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue