2016-08-17 16:39:05 +08:00
|
|
|
#![no_std]
|
2016-09-30 02:54:08 +08:00
|
|
|
#![feature(libc)]
|
2016-08-17 16:39:05 +08:00
|
|
|
|
|
|
|
#[macro_use]
|
|
|
|
extern crate std_artiq as std;
|
2016-09-30 02:54:08 +08:00
|
|
|
extern crate libc;
|
2016-09-29 02:25:25 +08:00
|
|
|
#[macro_use]
|
|
|
|
extern crate log;
|
|
|
|
extern crate log_buffer;
|
2016-09-27 21:36:55 +08:00
|
|
|
extern crate byteorder;
|
2016-08-17 16:39:05 +08:00
|
|
|
|
2016-09-30 04:56:35 +08:00
|
|
|
use logger::BufferLogger;
|
2016-08-30 19:20:04 +08:00
|
|
|
|
2016-09-30 04:56:35 +08:00
|
|
|
mod board;
|
|
|
|
mod sched;
|
|
|
|
mod config;
|
|
|
|
mod clock;
|
|
|
|
mod rtio_crg;
|
2016-09-30 08:15:20 +08:00
|
|
|
mod mailbox;
|
2016-09-30 04:56:35 +08:00
|
|
|
|
|
|
|
mod logger;
|
2016-10-02 02:24:53 +08:00
|
|
|
mod cache;
|
2016-09-30 04:56:35 +08:00
|
|
|
|
2016-10-01 12:20:27 +08:00
|
|
|
mod kernel_proto;
|
2016-09-30 04:56:35 +08:00
|
|
|
mod session_proto;
|
2016-10-01 12:20:27 +08:00
|
|
|
|
|
|
|
mod kernel;
|
2016-09-30 04:56:35 +08:00
|
|
|
mod session;
|
2016-09-07 00:42:13 +08:00
|
|
|
|
|
|
|
extern {
|
|
|
|
fn network_init();
|
|
|
|
fn lwip_service();
|
|
|
|
}
|
|
|
|
|
2016-09-30 06:04:52 +08:00
|
|
|
include!(concat!(env!("OUT_DIR"), "/git_info.rs"));
|
|
|
|
|
2016-08-17 16:39:05 +08:00
|
|
|
#[no_mangle]
|
2016-09-07 00:42:13 +08:00
|
|
|
pub unsafe extern fn rust_main() {
|
2016-09-29 02:25:25 +08:00
|
|
|
static mut log_buffer: [u8; 4096] = [0; 4096];
|
|
|
|
BufferLogger::new(&mut log_buffer[..])
|
|
|
|
.register(move |logger| {
|
2016-09-30 06:04:52 +08:00
|
|
|
info!("booting ARTIQ runtime ({})", GIT_COMMIT);
|
|
|
|
|
2016-09-30 04:36:04 +08:00
|
|
|
clock::init();
|
|
|
|
rtio_crg::init();
|
2016-09-29 02:25:25 +08:00
|
|
|
network_init();
|
2016-09-07 00:42:13 +08:00
|
|
|
|
2016-09-30 04:56:35 +08:00
|
|
|
let mut scheduler = sched::Scheduler::new();
|
2016-10-01 12:20:27 +08:00
|
|
|
scheduler.spawn(8192, move |waiter| {
|
2016-09-29 02:25:25 +08:00
|
|
|
session::handler(waiter, logger)
|
|
|
|
});
|
2016-10-01 12:20:27 +08:00
|
|
|
|
2016-09-29 02:25:25 +08:00
|
|
|
loop {
|
|
|
|
lwip_service();
|
|
|
|
scheduler.run()
|
|
|
|
}
|
|
|
|
})
|
2016-08-17 16:39:05 +08:00
|
|
|
}
|