Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: m-labs/artiq
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 3e829d0d01ea
Choose a base ref
...
head repository: m-labs/artiq
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: bcdbd00e7b19
Choose a head ref
  • 2 commits
  • 29 files changed
  • 1 contributor

Commits on Oct 6, 2016

  1. runtime: the Rust runtime is now just the runtime.

    whitequark committed Oct 6, 2016
    Copy the full SHA
    5428a86 View commit details
  2. Copy the full SHA
    bcdbd00 View commit details
4 changes: 2 additions & 2 deletions artiq/coredevice/comm_generic.py
Original file line number Diff line number Diff line change
@@ -166,7 +166,7 @@ def _read_bytes(self):
return self._read_chunk(self._read_int32())

def _read_string(self):
return self._read_bytes()[:-1].decode("utf-8")
return self._read_bytes().decode("utf-8")

#
# Writer interface
@@ -214,7 +214,7 @@ def _write_bytes(self, value):
self._write_buffer.append(value)

def _write_string(self, value):
self._write_bytes(value.encode("utf-8") + b"\0")
self._write_bytes(value.encode("utf-8"))

#
# Exported APIs
1 change: 0 additions & 1 deletion artiq/runtime.rs/libstd_artiq/lib.rs
Original file line number Diff line number Diff line change
@@ -29,7 +29,6 @@ pub mod prelude {
}
}

pub mod time;
pub mod error;
pub mod io;

117 changes: 0 additions & 117 deletions artiq/runtime.rs/libstd_artiq/time/duration.rs

This file was deleted.

81 changes: 0 additions & 81 deletions artiq/runtime.rs/libstd_artiq/time/instant.rs

This file was deleted.

5 changes: 0 additions & 5 deletions artiq/runtime.rs/libstd_artiq/time/mod.rs

This file was deleted.

10 changes: 10 additions & 0 deletions artiq/runtime.rs/src/lib.rs
Original file line number Diff line number Diff line change
@@ -69,3 +69,13 @@ pub unsafe extern fn rust_main() {
}
})
}

#[no_mangle]
pub fn sys_now() -> u32 {
clock::get_ms() as u32
}

#[no_mangle]
pub fn sys_jiffies() -> u32 {
clock::get_ms() as u32
}
8 changes: 2 additions & 6 deletions artiq/runtime.rs/src/proto.rs
Original file line number Diff line number Diff line change
@@ -66,14 +66,10 @@ pub fn write_bytes(writer: &mut Write, value: &[u8]) -> io::Result<()> {
}

pub fn read_string(reader: &mut Read) -> io::Result<String> {
let mut bytes = try!(read_bytes(reader));
let len = bytes.len() - 1; // length without trailing \0
bytes.resize(len, 0); // FIXME: don't send \0 in the first place
let bytes = try!(read_bytes(reader));
String::from_utf8(bytes).map_err(|e| io::Error::new(io::ErrorKind::InvalidData, e))
}

pub fn write_string(writer: &mut Write, value: &str) -> io::Result<()> {
try!(write_u32(writer, (value.len() + 1) as u32));
try!(writer.write_all(value.as_bytes()));
write_u8(writer, 0)
write_bytes(writer, value.as_bytes())
}
10 changes: 5 additions & 5 deletions artiq/runtime.rs/src/sched.rs
Original file line number Diff line number Diff line change
@@ -2,16 +2,16 @@

use std::cell::RefCell;
use std::vec::Vec;
use std::time::{Instant, Duration};
use std::io::{Read, Write, Result, Error, ErrorKind};
use fringe::OwnedStack;
use fringe::generator::{Generator, Yielder, State as GeneratorState};
use lwip;
use clock;
use urc::Urc;

#[derive(Debug)]
struct WaitRequest {
timeout: Option<Instant>,
timeout: Option<u64>,
event: Option<WaitEvent>
}

@@ -106,7 +106,7 @@ impl Scheduler {

if self.threads.len() == 0 { return }

let now = Instant::now();
let now = clock::get_ms();

let start_index = self.index;
loop {
@@ -214,9 +214,9 @@ unsafe impl Send for WaitEvent {}
pub struct Waiter<'a>(&'a Yielder<WaitResult, WaitRequest, OwnedStack>);

impl<'a> Waiter<'a> {
pub fn sleep(&self, duration: Duration) -> Result<()> {
pub fn sleep(&self, duration_ms: u64) -> Result<()> {
let request = WaitRequest {
timeout: Some(Instant::now() + duration),
timeout: Some(clock::get_ms() + duration_ms),
event: None
};

4 changes: 1 addition & 3 deletions artiq/runtime/Makefile
Original file line number Diff line number Diff line change
@@ -3,9 +3,7 @@ include $(MISOC_DIRECTORY)/software/common.mak

PYTHON ?= python3.5

OBJECTS := isr.o clock.o rtiocrg.o flash_storage.o mailbox.o \
session.o log.o analyzer.o moninj.o net_server.o \
ksupport_data.o kloader.o main.o
OBJECTS := isr.o flash_storage.o ksupport_data.o main.o
OBJECTS_KSUPPORT := ksupport.o artiq_personality.o mailbox.o \
rtio.o dds.o i2c.o

Loading