mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-15 08:30:02 +00:00
fix hosted mode bugs
This commit is contained in:
parent
a8a35fa434
commit
08a86749fe
11 changed files with 56 additions and 52 deletions
|
|
@ -217,7 +217,7 @@ std::thread_local!(static SYSTEM_SERVICES: core::cell::RefCell<SystemServices> =
|
|||
}; MAX_PROCESS_COUNT],
|
||||
// Note we can't use MAX_SERVER_COUNT here because of how Rust's
|
||||
// macro tokenization works
|
||||
servers: filled_array![None; 32],
|
||||
servers: filled_array![None; 128],
|
||||
}));
|
||||
|
||||
#[cfg(baremetal)]
|
||||
|
|
|
|||
|
|
@ -1,8 +1,10 @@
|
|||
use codec::FIFO_DEPTH;
|
||||
|
||||
pub struct Codec {
|
||||
}
|
||||
|
||||
impl Codec {
|
||||
pub fn new() -> Codec {
|
||||
pub fn new(_conn: xous::CID, _xns: &xous_names::XousNames) -> Codec {
|
||||
Codec {
|
||||
}
|
||||
}
|
||||
|
|
@ -10,15 +12,33 @@ impl Codec {
|
|||
}
|
||||
pub fn resume(&self) {
|
||||
}
|
||||
pub fn init(&mut self) {
|
||||
}
|
||||
|
||||
pub fn nq_play_frame(&mut self, _frame: [u32; FIFO_DEPTH]) -> Result<(), [u32; FIFO_DEPTH]> {
|
||||
Ok(())
|
||||
}
|
||||
pub fn dq_rec_frame(&mut self) -> Option<[u32; FIFO_DEPTH]> {
|
||||
None
|
||||
}
|
||||
pub fn free_play_frames(&self) -> usize {
|
||||
0
|
||||
}
|
||||
pub fn available_rec_frames(&self) -> usize {
|
||||
0
|
||||
}
|
||||
|
||||
pub fn power(&mut self, _state: bool) {
|
||||
}
|
||||
|
||||
pub fn nq_play_frame(&mut self, _frame: [u32; FIFO_DEPTH]) -> Result<(), [u32; DEPTH]> {
|
||||
Ok(())
|
||||
pub fn is_on(&self) -> bool {
|
||||
false
|
||||
}
|
||||
pub fn dq_rec_frame(&mut self) -> Some([u32; FIFO_DEPTH]) {
|
||||
None
|
||||
pub fn is_init(&self) -> bool {
|
||||
true
|
||||
}
|
||||
pub fn is_live(&self) -> bool {
|
||||
false
|
||||
}
|
||||
|
||||
pub fn get_headset_code(&mut self) -> u8 {
|
||||
|
|
|
|||
|
|
@ -6,4 +6,4 @@ pub use crate::backend::hostaudio::*;
|
|||
#[cfg(target_os = "none")]
|
||||
mod tlv320aic3100;
|
||||
#[cfg(target_os = "none")]
|
||||
pub use crate::backend::tlv320aic3100::*;
|
||||
pub(crate) use crate::backend::tlv320aic3100::*;
|
||||
|
|
|
|||
|
|
@ -493,44 +493,3 @@ impl Codec {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
else if command.trim() == "aut" { // sample for 10 seconds and report # of samples seen -- for benchmarking sample rate
|
||||
unsafe{ self.p.POWER.power.write(|w| w.audio().bit(false).self_().bit(true).state().bits(3)); }
|
||||
delay_ms(&self.p, 50); // give it a moment to power on and initialize before blasting data in
|
||||
self.audio.reset_fifos();
|
||||
unsafe{ self.p.POWER.power.write(|w| w.audio().bit(true).self_().bit(true).state().bits(3)); }
|
||||
delay_ms(&self.p, 50); // give it a moment to power on and initialize before blasting data in
|
||||
|
||||
self.audio.audio_clocks();
|
||||
self.audio.audio_ports();
|
||||
self.audio.audio_mixer();
|
||||
|
||||
self.audio.audio_i2s_start();
|
||||
self.audio_run = true;
|
||||
|
||||
let mut samples: u32 = 0;
|
||||
let start: u32 = get_time_ms(&self.p);
|
||||
let mut toggle: bool = false;
|
||||
let mut buf_a: [u32; AUDIO_FIFODEPTH] = [0; AUDIO_FIFODEPTH];
|
||||
let mut buf_b: [u32; AUDIO_FIFODEPTH] = [0; AUDIO_FIFODEPTH];
|
||||
loop {
|
||||
if get_time_ms(&self.p) - start > 10_000 {
|
||||
break;
|
||||
}
|
||||
if self.audio.audio_loopback_poll(&mut buf_a, &mut buf_b, toggle) {
|
||||
samples = samples + 1;
|
||||
toggle = !toggle;
|
||||
}
|
||||
}
|
||||
|
||||
self.text.add_text(&mut format!("{} samples", samples));
|
||||
|
||||
self.audio.audio_i2s_stop();
|
||||
self.audio_run = false;
|
||||
|
||||
unsafe{ self.p.POWER.power.write(|w| w.audio().bit(false).self_().bit(true).state().bits(3)); }
|
||||
delay_ms(&self.p, 50); // give it a moment to power on and initialize before blasting data in
|
||||
unsafe{ self.p.POWER.power.write(|w| w.audio().bit(true).self_().bit(true).state().bits(3)); }
|
||||
*/
|
||||
|
|
@ -205,7 +205,6 @@ mod implementation {
|
|||
use log::error;
|
||||
|
||||
use heapless::Vec;
|
||||
use heapless::consts::*;
|
||||
|
||||
pub struct XousCom {
|
||||
pub workqueue: Vec<WorkRequest, 64>,
|
||||
|
|
|
|||
|
|
@ -116,6 +116,7 @@ pub fn status_thread(canvas_gid_0: usize, canvas_gid_1: usize, canvas_gid_2: usi
|
|||
|
||||
let mut rtc = rtc::Rtc::new(&xns).unwrap();
|
||||
|
||||
#[cfg(target_os = "none")]
|
||||
rtc.clear_wakeup_alarm().unwrap(); // clear any wakeup alarm state, if it was set
|
||||
|
||||
rtc.hook_rtc_callback(dt_callback).unwrap();
|
||||
|
|
|
|||
|
|
@ -275,7 +275,7 @@ impl I2cStateMachine {
|
|||
}
|
||||
|
||||
// interrupt context-friendly handler
|
||||
pub fn handler_i(&mut self) -> I2cHandlerReport {
|
||||
pub(crate) fn handler_i(&mut self) -> I2cHandlerReport {
|
||||
let mut report = I2cHandlerReport::InProgress;
|
||||
|
||||
match self.state {
|
||||
|
|
|
|||
|
|
@ -1,9 +1,23 @@
|
|||
use crate::api::*;
|
||||
|
||||
pub(crate) struct I2cStateMachine {
|
||||
}
|
||||
|
||||
impl I2cStateMachine {
|
||||
pub fn new(ticktimer: ticktimer_server::Ticktimer, i2c_base: *mut u32) -> Self {
|
||||
pub fn new(_handler_conn: xous::CID) -> Self {
|
||||
I2cStateMachine {
|
||||
}
|
||||
}
|
||||
pub fn suspend(&mut self) {}
|
||||
pub fn resume(&mut self) {}
|
||||
pub fn initiate(&mut self, _transaction: I2cTransaction) -> I2cStatus {
|
||||
I2cStatus::ResponseInProgress
|
||||
}
|
||||
pub fn report_write_done(&mut self) {
|
||||
}
|
||||
pub fn report_read_done(&mut self) {
|
||||
}
|
||||
pub fn is_busy(&self) -> bool {
|
||||
false
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
#[cfg(not(target_os = "none"))]
|
||||
mod hosted;
|
||||
#[cfg(not(target_os = "none"))]
|
||||
pub use crate::backend::hosted::*;
|
||||
pub use crate::i2c::hosted::*;
|
||||
|
||||
#[cfg(target_os = "none")]
|
||||
mod hardware;
|
||||
|
|
|
|||
|
|
@ -512,6 +512,8 @@ mod implementation {
|
|||
pub fn clear_wakeup_alarm(&mut self) { }
|
||||
pub fn rtc_alarm(&mut self, _seconds: u8) { }
|
||||
pub fn clear_rtc_alarm(&mut self) { }
|
||||
pub fn rtc_get_ack(&mut self) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ pub struct Audio {
|
|||
}
|
||||
impl Audio {
|
||||
pub fn new(xns: &xous_names::XousNames) -> Self {
|
||||
#[cfg(target_os = "none")]
|
||||
let sample = xous::syscall::map_memory(
|
||||
// 0x2634_0000 is the long sample. 0x2600_0000 is the short sample.
|
||||
Some(core::num::NonZeroUsize::new(0x2634_0000).unwrap()), // it's here, because we know it's here!
|
||||
|
|
@ -30,6 +31,14 @@ impl Audio {
|
|||
0x1c4_0000, // 0x8_0000 is length of short sample, 0x1C4_0000 is the long sample
|
||||
xous::MemoryFlags::R,
|
||||
).expect("couldn't map in the audio sample");
|
||||
#[cfg(not(target_os = "none"))] // just make a dummy mapping to keep things from crashing in hosted mode
|
||||
let sample = xous::syscall::map_memory(
|
||||
None,
|
||||
None,
|
||||
0x8_0000,
|
||||
xous::MemoryFlags::R,
|
||||
).expect("couldn't map in the audio sample");
|
||||
|
||||
let mut codec = codec::Codec::new(xns).unwrap();
|
||||
let samples: *const [u8; 16] = unsafe{sample.as_ptr().add(20)} as *const [u8; 16];
|
||||
let mut raw_header: [u8; 16] = [0; 16];
|
||||
|
|
|
|||
Loading…
Reference in a new issue