Skip to content
Permalink
Browse files

inlined module tree for boards/arty-e21/

  • Loading branch information
pnkfelix committed Nov 15, 2019
1 parent 6875531 commit 600c31d2643ac0c44e03f345b390eed2a0210e2d
Showing with 71 additions and 69 deletions.
  1. +0 −40 tock/boards/arty-e21/src/io.rs
  2. +71 −2 tock/boards/arty-e21/src/main.rs
  3. +0 −27 tock/boards/arty-e21/src/timer_test.rs

This file was deleted.

@@ -13,9 +13,78 @@ use kernel::hil;
use kernel::Platform;
use kernel::{create_capability, debug, static_init};

mod timer_test;
mod timer_test {
#![allow(dead_code)]

pub mod io;
use kernel::debug;
use kernel::hil::time::{self, Alarm};

pub struct TimerTest<'a, A: Alarm<'a>> {
alarm: &'a A,
}

impl<A: Alarm<'a>> TimerTest<'a, A> {
pub const fn new(alarm: &'a A) -> TimerTest<'a, A> {
TimerTest { alarm: alarm }
}

pub fn start(&self) {
debug!("starting");
let start = self.alarm.now();
let exp = start + 99999;
self.alarm.set_alarm(exp);
}
}

impl<A: Alarm<'a>> time::AlarmClient for TimerTest<'a, A> {
fn fired(&self) {
debug!("timer!!");
}
}
}

pub mod io {
use arty_e21;
use core::fmt::Write;
use core::panic::PanicInfo;
use core::str;
use kernel::debug;
use kernel::hil::gpio;
use kernel::hil::led;
use rv32i;

use crate::PROCESSES;

struct Writer;

static mut WRITER: Writer = Writer {};

impl Write for Writer {
fn write_str(&mut self, s: &str) -> ::core::fmt::Result {
debug!("{}", s);
Ok(())
}
}

/// Panic handler.
#[cfg(not(test))]
#[no_mangle]
#[panic_handler]
pub unsafe extern "C" fn panic_fmt(pi: &PanicInfo) -> ! {
// turn off the non panic leds, just in case
let led_green = &arty_e21::gpio::PORT[19];
gpio::Pin::make_output(led_green);
gpio::Pin::set(led_green);

let led_blue = &arty_e21::gpio::PORT[21];
gpio::Pin::make_output(led_blue);
gpio::Pin::set(led_blue);

let led_red = &mut led::LedLow::new(&mut arty_e21::gpio::PORT[22]);
let writer = &mut WRITER;
debug::panic(&mut [led_red], writer, pi, &rv32i::support::nop, &PROCESSES)
}
}

// State for loading and holding applications.

This file was deleted.

0 comments on commit 600c31d

Please sign in to comment.
You can’t perform that action at this time.