mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-15 08:30:02 +00:00
refactor: utra -> utralib naming
this cleans up some namespace issues when including the utra crate which also refers to utra::generated::utra, and there are CONST at the crate-level, and also functions at the module-level which need disambiguation. By naming the crate utra-lib this saves a bit of syntatic wrangling at the top of every file.
This commit is contained in:
parent
cb6fcb60e8
commit
9a50de8b4e
16 changed files with 24 additions and 19 deletions
6
Cargo.lock
generated
6
Cargo.lock
generated
|
|
@ -213,7 +213,7 @@ version = "0.1.0"
|
|||
dependencies = [
|
||||
"embedded-graphics",
|
||||
"minifb",
|
||||
"utra",
|
||||
"utralib",
|
||||
"xous",
|
||||
]
|
||||
|
||||
|
|
@ -720,7 +720,7 @@ version = "0.1.0"
|
|||
dependencies = [
|
||||
"bitflags",
|
||||
"graphics-server",
|
||||
"utra",
|
||||
"utralib",
|
||||
"xous",
|
||||
]
|
||||
|
||||
|
|
@ -824,7 +824,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
checksum = "f7fe0bb3479651439c9112f72b6c505038574c9fbb575ed1bf3b797fa39dd564"
|
||||
|
||||
[[package]]
|
||||
name = "utra"
|
||||
name = "utralib"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"svd2utra",
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ xous = { path = "../../xous-rs" }
|
|||
embedded-graphics = "0.6"
|
||||
|
||||
[target.'cfg(not(any(windows,unix)))'.dependencies]
|
||||
utra = { path = "../../utra"}
|
||||
utralib = { path = "../../utralib"}
|
||||
|
||||
[target.'cfg(any(windows,unix))'.dependencies]
|
||||
minifb = "0.17"
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
use embedded_graphics::{drawable::Pixel, geometry::Size, pixelcolor::BinaryColor, DrawTarget};
|
||||
use xous::MemoryRange;
|
||||
use utra;
|
||||
use utralib::generated::*;
|
||||
|
||||
const FB_WIDTH_WORDS: usize = 11;
|
||||
const FB_WIDTH_PIXELS: usize = 336;
|
||||
|
|
@ -20,7 +20,7 @@ pub struct XousDisplay {
|
|||
impl XousDisplay {
|
||||
pub fn new() -> XousDisplay {
|
||||
let fb = xous::syscall::map_memory(
|
||||
xous::MemoryAddress::new(utra::HW_MEMLCD_MEM),
|
||||
xous::MemoryAddress::new(HW_MEMLCD_MEM),
|
||||
None,
|
||||
((FB_WIDTH_WORDS * FB_LINES * 4) + 4096) & !4095,
|
||||
xous::MemoryFlags::R | xous::MemoryFlags::W,
|
||||
|
|
@ -28,7 +28,7 @@ impl XousDisplay {
|
|||
.expect("couldn't map frame buffer");
|
||||
|
||||
let control = xous::syscall::map_memory(
|
||||
xous::MemoryAddress::new(utra::HW_MEMLCD_BASE),
|
||||
xous::MemoryAddress::new(HW_MEMLCD_BASE),
|
||||
None,
|
||||
4096,
|
||||
xous::MemoryFlags::R | xous::MemoryFlags::W,
|
||||
|
|
|
|||
|
|
@ -11,4 +11,4 @@ xous = { path = "../../xous-rs" }
|
|||
graphics-server = { path = "../graphics-server" }
|
||||
|
||||
[target.'cfg(not(any(windows,unix)))'.dependencies]
|
||||
utra = { path = "../../utra"}
|
||||
utralib = { path = "../../utralib"}
|
||||
|
|
|
|||
|
|
@ -16,6 +16,8 @@ mod timer;
|
|||
// }
|
||||
// }
|
||||
|
||||
extern crate utralib;
|
||||
|
||||
fn move_lfsr(mut lfsr: u32) -> u32 {
|
||||
lfsr ^= lfsr >> 7;
|
||||
lfsr ^= lfsr << 9;
|
||||
|
|
|
|||
|
|
@ -4,6 +4,8 @@ const SYSTEM_CLOCK_FREQUENCY: u32 = 100_000_000;
|
|||
#[cfg(baremetal)]
|
||||
const TIMER_BASE: usize = 0xF000_3000;
|
||||
|
||||
use utralib::generated::*;
|
||||
|
||||
#[cfg(baremetal)]
|
||||
fn timer_tick(_irq_no: usize, _arg: *mut usize) {
|
||||
println!(">>> Timer tick");
|
||||
|
|
@ -21,7 +23,7 @@ pub fn init() {
|
|||
use xous::{MemoryAddress, MemorySize};
|
||||
println!("Allocating timer...");
|
||||
xous::rsyscall(xous::SysCall::MapMemory(
|
||||
MemoryAddress::new(utra::HW_TIMER0_BASE),
|
||||
MemoryAddress::new(HW_TIMER0_BASE),
|
||||
MemoryAddress::new(TIMER_BASE),
|
||||
MemorySize::new(4096).unwrap(),
|
||||
xous::MemoryFlags::R | xous::MemoryFlags::W,
|
||||
|
|
@ -42,8 +44,8 @@ pub fn init() {
|
|||
en(true);
|
||||
|
||||
// Set EV_ENABLE
|
||||
let ptr = TIMER_BASE as *mut usize;
|
||||
unsafe { ptr.add(7).write_volatile(1) };
|
||||
let mut timer = CSR::new(TIMER_BASE as *mut u32);
|
||||
unsafe { timer.wfo(utra::timer0::EV_ENABLE_ENABLE, 0b1); }
|
||||
}
|
||||
|
||||
#[cfg(not(baremetal))]
|
||||
|
|
|
|||
4
kernel/Cargo.lock
generated
4
kernel/Cargo.lock
generated
|
|
@ -218,7 +218,7 @@ dependencies = [
|
|||
"riscv",
|
||||
"sha3",
|
||||
"stats_alloc",
|
||||
"utra",
|
||||
"utralib",
|
||||
"xous",
|
||||
]
|
||||
|
||||
|
|
@ -458,7 +458,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
checksum = "f7fe0bb3479651439c9112f72b6c505038574c9fbb575ed1bf3b797fa39dd564"
|
||||
|
||||
[[package]]
|
||||
name = "utra"
|
||||
name = "utralib"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"svd2utra",
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ stats_alloc = { version = "0.1.8", optional = true }
|
|||
sha3 = { default-features = false, version = "0.8.2" }
|
||||
|
||||
[target.'cfg(not(any(windows, unix)))'.dependencies]
|
||||
utra = { path = "../utra"}
|
||||
utralib = { path = "../utralib"}
|
||||
|
||||
[target.'cfg(target_arch = "riscv32")'.dependencies]
|
||||
riscv = "0.5.6"
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ mod syscall;
|
|||
|
||||
use services::SystemServices;
|
||||
use xous_kernel::*;
|
||||
use utralib::generated::*;
|
||||
|
||||
#[cfg(baremetal)]
|
||||
use core::panic::PanicInfo;
|
||||
|
|
@ -64,7 +65,7 @@ pub extern "C" fn init(arg_offset: *const u32, init_offset: *const u32, rpt_offs
|
|||
mem::MemoryManager::with_mut(|memory_manager| {
|
||||
memory_manager
|
||||
.map_range(
|
||||
utra::HW_UART_BASE as *mut u8,
|
||||
HW_UART_BASE as *mut u8,
|
||||
((debug::SUPERVISOR_UART.base as u32) & !4095) as *mut u8,
|
||||
4096,
|
||||
PID::new(1).unwrap(),
|
||||
|
|
|
|||
|
|
@ -588,7 +588,7 @@ fn print_peripherals<U: Write>(peripherals: &[Peripheral], out: &mut U) -> std::
|
|||
for peripheral in peripherals {
|
||||
writeln!(
|
||||
out,
|
||||
"pub const HW_{}_BASE : usize = {};",
|
||||
"pub const HW_{}_BASE : usize = 0x{:08x};",
|
||||
peripheral.name.to_uppercase(), peripheral.base
|
||||
)?;
|
||||
}
|
||||
|
|
@ -606,7 +606,7 @@ fn print_peripherals<U: Write>(peripherals: &[Peripheral], out: &mut U) -> std::
|
|||
writeln!(
|
||||
out,
|
||||
" pub const {}: crate::Register = crate::Register::new({});",
|
||||
register.name.to_uppercase(), register.offset
|
||||
register.name.to_uppercase(), register.offset / 4
|
||||
)?;
|
||||
for field in ®ister.fields {
|
||||
writeln!(
|
||||
|
|
|
|||
0
utra/.gitignore → utralib/.gitignore
vendored
0
utra/.gitignore → utralib/.gitignore
vendored
0
utra/Cargo.lock → utralib/Cargo.lock
generated
0
utra/Cargo.lock → utralib/Cargo.lock
generated
|
|
@ -1,5 +1,5 @@
|
|||
[package]
|
||||
name = "utra"
|
||||
name = "utralib"
|
||||
version = "0.1.0"
|
||||
authors = ["Sean Cross <sean@xobs.io>"]
|
||||
edition = "2018"
|
||||
|
|
@ -1,3 +1,3 @@
|
|||
#![cfg_attr(target_os = "none", no_std)]
|
||||
mod generated;
|
||||
pub mod generated;
|
||||
pub use generated::*;
|
||||
Loading…
Reference in a new issue