mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-15 08:30:02 +00:00
intermediate checkin
This commit is contained in:
parent
9716eba039
commit
95d4f03591
5 changed files with 25 additions and 23 deletions
|
|
@ -237,16 +237,11 @@ fn xmain() -> ! {
|
|||
|
||||
log_server::init_wait().unwrap();
|
||||
|
||||
xous_names::register_name("COM manager to EC");
|
||||
let com_sid = xous_names::register_name(xous::names::SERVER_NAME_COM).expect("COM: can't register server");
|
||||
|
||||
let com_server =
|
||||
xous::create_server_with_address(b"com ").expect("Couldn't create COM server");
|
||||
|
||||
let shell_id = xous::SID::from_bytes(b"shell ").unwrap();
|
||||
let shell_conn = xous::connect(shell_id).unwrap();
|
||||
|
||||
let testconn = xous_names::request_connection("COM manager to EC");
|
||||
info!("testconn result: {:?}", testconn);
|
||||
// let shell_id = xous::SID::from_bytes(b"shell ").unwrap();
|
||||
// let shell_conn = xous::connect(shell_id).unwrap();
|
||||
let shell_conn = xous_names::request_connection(xous::names::SERVER_NAME_SHELL).expect("COM: couldn't establish shell connection");
|
||||
|
||||
let agent_conn: usize;
|
||||
if cfg!(feature = "fccagent") {
|
||||
|
|
@ -261,7 +256,7 @@ fn xmain() -> ! {
|
|||
|
||||
info!("COM: starting main loop");
|
||||
loop {
|
||||
let envelope = xous::receive_message(com_server).unwrap();
|
||||
let envelope = xous::receive_message(com_sid).unwrap();
|
||||
// info!("COM: Message: {:?}", envelope);
|
||||
if let Ok(opcode) = Opcode::try_from(&envelope.body) {
|
||||
// info!("COM: Opcode: {:?}", opcode);
|
||||
|
|
|
|||
|
|
@ -5,11 +5,9 @@ use blitstr::{Cursor, GlyphStyle};
|
|||
use com::*;
|
||||
use core::fmt::Write;
|
||||
use graphics_server::{Circle, DrawStyle, Line, PixelColor, Point, Rectangle};
|
||||
use xous_names::api::{Registration, Lookup};
|
||||
|
||||
use log::{error, info};
|
||||
use xous::String;
|
||||
use xous::ipc::*;
|
||||
|
||||
use core::convert::TryFrom;
|
||||
|
||||
|
|
@ -107,9 +105,7 @@ static BATT_STATS_CURRENT: AtomicI16 = AtomicI16::new(-150);
|
|||
static BATT_STATS_SOC: AtomicU8 = AtomicU8::new(50);
|
||||
static BATT_STATS_REMAINING: AtomicU16 = AtomicU16::new(750);
|
||||
|
||||
fn com_thread(_arg: Option<u32>) {
|
||||
let shell_server = xous::create_server_with_address(b"shell ")
|
||||
.expect("Couldn't create Shell server");
|
||||
fn com_thread(shell_server: xous::SID) {
|
||||
info!("SHELL|com_thread: starting COM response handler thread");
|
||||
loop {
|
||||
let envelope = xous::syscall::receive_message(shell_server).expect("couldn't get address");
|
||||
|
|
@ -134,18 +130,18 @@ fn com_thread(_arg: Option<u32>) {
|
|||
fn shell_main() -> ! {
|
||||
log_server::init_wait().unwrap();
|
||||
|
||||
let shell_sid = xous_names::register_name(xous::names::SERVER_NAME_SHELL).expect("SHELL: can't register server");
|
||||
|
||||
// let log_server_id = xous::SID::from_bytes(b"xous-logs-output").unwrap();
|
||||
let graphics_server_id = xous::SID::from_bytes(b"graphics-server ").unwrap();
|
||||
let ticktimer_server_id = xous::SID::from_bytes(b"ticktimer-server").unwrap();
|
||||
let log_server_id = xous::SID::from_bytes(b"xous-log-server ").unwrap();
|
||||
let com_id = xous::SID::from_bytes(b"com ").unwrap();
|
||||
let ns_id = xous::SID::from_bytes(b"xous-name-server").unwrap();
|
||||
|
||||
let log_conn = xous::connect(log_server_id).unwrap();
|
||||
let graphics_conn = xous::connect(graphics_server_id).unwrap();
|
||||
let ticktimer_conn = xous::connect(ticktimer_server_id).unwrap();
|
||||
let com_conn = xous::connect(com_id).unwrap();
|
||||
let ns_conn = xous::connect(ns_id).unwrap();
|
||||
|
||||
info!(
|
||||
"SHELL: Connected to Log server: {} Graphics server: {} Ticktimer server: {} Com: {}",
|
||||
|
|
@ -163,7 +159,7 @@ fn shell_main() -> ! {
|
|||
);
|
||||
|
||||
// make a thread to catch responses from the COM
|
||||
xous::create_thread_simple(com_thread, None).unwrap();
|
||||
xous::create_thread_simple(com_thread, shell_sid).unwrap();
|
||||
info!("SHELL: COM responder thread started");
|
||||
|
||||
let screensize = graphics_server::screen_size(graphics_conn).expect("Couldn't get screen size");
|
||||
|
|
@ -345,7 +341,7 @@ fn shell_main() -> ! {
|
|||
)
|
||||
.expect("unable to draw to screen");
|
||||
|
||||
/* test code to exhaust memory allocation */
|
||||
/* test code to exhaust memory allocation
|
||||
let mut iter = 0;
|
||||
info!("Test memory allocation");
|
||||
loop {
|
||||
|
|
@ -357,7 +353,7 @@ fn shell_main() -> ! {
|
|||
info!("memtest: iter {}", iter);
|
||||
iter += 1;
|
||||
}
|
||||
|
||||
*/
|
||||
// Periodic tasks
|
||||
if let Ok(elapsed_time) = ticktimer_server::elapsed_ms(ticktimer_conn) {
|
||||
if elapsed_time - last_time > 500 {
|
||||
|
|
|
|||
|
|
@ -107,7 +107,7 @@ impl AsRef<str> for XousServerName {
|
|||
#[repr(C)]
|
||||
pub struct Registration {
|
||||
mid: usize,
|
||||
pub sid: SID, // query: do we even want to return this to the registering process??
|
||||
pub sid: SID,
|
||||
|
||||
// we use fixed-length, u8-only records to pass server names. This is different from
|
||||
// your typical Rust String object; but, a key restriction on IPC calls is that the size
|
||||
|
|
|
|||
|
|
@ -6,7 +6,10 @@ use xous::ipc::*;
|
|||
use api::{Registration, Lookup};
|
||||
use core::fmt::Write;
|
||||
|
||||
pub fn register_name(name: &str) -> Result<bool, xous::Error> {
|
||||
pub fn register_name(name: &str) -> Result<xous::SID, xous::Error> {
|
||||
let ticktimer_server_id = xous::SID::from_bytes(b"ticktimer-server").unwrap();
|
||||
let ticktimer_conn = xous::connect(ticktimer_server_id).unwrap();
|
||||
|
||||
let ns_id = xous::SID::from_bytes(b"xous-name-server").unwrap();
|
||||
let ns_conn = xous::connect(ns_id).unwrap();
|
||||
|
||||
|
|
@ -16,7 +19,13 @@ pub fn register_name(name: &str) -> Result<bool, xous::Error> {
|
|||
write!(sendable_registration.name, "{}", name).unwrap();
|
||||
sendable_registration.lend_mut(ns_conn, sendable_registration.mid()).expect("nameserver registration failure!");
|
||||
|
||||
Ok(sendable_registration.success)
|
||||
ticktimer_server::sleep_ms(ticktimer_conn, 100).expect("Failed to wait for server boot");
|
||||
|
||||
if sendable_registration.success {
|
||||
Ok(sendable_registration.sid)
|
||||
} else {
|
||||
Err(xous::Error::InternalError)
|
||||
}
|
||||
}
|
||||
|
||||
/// note: if this throws an AccessDenied error, you can retry with a request_authenticat_connection() call (to be written)
|
||||
|
|
|
|||
|
|
@ -16,6 +16,8 @@ mod messages;
|
|||
pub mod string;
|
||||
pub mod syscall;
|
||||
|
||||
pub mod names;
|
||||
|
||||
pub use arch::{ProcessArgs, ProcessInit, ProcessKey, ThreadInit};
|
||||
pub use definitions::*;
|
||||
pub use messages::*;
|
||||
|
|
|
|||
Loading…
Reference in a new issue