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: 6a81b16230ef
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: f0ac0b78c131
Choose a head ref
  • 4 commits
  • 4 files changed
  • 1 contributor

Commits on Jun 20, 2016

  1. Copy the full SHA
    e069ce9 View commit details
  2. Copy the full SHA
    5f8b02a View commit details
  3. Copy the full SHA
    5baba5f View commit details
  4. runtime: minor cleanup

    sbourdeauducq committed Jun 20, 2016
    Copy the full SHA
    f0ac0b7 View commit details
Showing with 75 additions and 50 deletions.
  1. +44 −41 artiq/runtime/ksupport.c
  2. +0 −2 artiq/runtime/ksupport.h
  3. +0 −7 artiq/runtime/messages.h
  4. +31 −0 artiq/test/coredevice/test_rtio.py
85 changes: 44 additions & 41 deletions artiq/runtime/ksupport.c
Original file line number Diff line number Diff line change
@@ -335,6 +335,38 @@ void exception_handler(unsigned long vect, unsigned long *regs,
vect, pc, ea);
}

static void now_init(void)
{
struct msg_base request;
struct msg_now_init_reply *reply;

request.type = MESSAGE_TYPE_NOW_INIT_REQUEST;
mailbox_send_and_wait(&request);

reply = mailbox_wait_and_receive();
if(reply->type != MESSAGE_TYPE_NOW_INIT_REPLY) {
core_log("Malformed MESSAGE_TYPE_NOW_INIT_REQUEST reply type %d\n",
reply->type);
while(1);
}
now = reply->now;
mailbox_acknowledge();

if(now < 0) {
rtio_init();
now = rtio_get_counter() + (272000 << CONFIG_RTIO_FINE_TS_WIDTH);
}
}

static void now_save(void)
{
struct msg_now_save request;

request.type = MESSAGE_TYPE_NOW_SAVE;
request.now = now;
mailbox_send_and_wait(&request);
}

int main(void);
int main(void)
{
@@ -368,9 +400,9 @@ int main(void)

mailbox_send_and_wait(&load_reply);

now = now_init();
now_init();
kernel_run();
now_save(now);
now_save();

attribute_writeback(typeinfo);

@@ -387,9 +419,12 @@ int main(void)
/* called from __artiq_personality */
void __artiq_terminate(struct artiq_exception *artiq_exn,
struct artiq_backtrace_item *backtrace,
size_t backtrace_size) {
size_t backtrace_size)
{
struct msg_exception msg;

now_save();

msg.type = MESSAGE_TYPE_EXCEPTION;
msg.exception = artiq_exn;
msg.backtrace = backtrace;
@@ -399,46 +434,12 @@ void __artiq_terminate(struct artiq_exception *artiq_exn,
while(1);
}

void ksupport_abort() {
void ksupport_abort()
{
artiq_raise_from_c("InternalError", "abort() called; check device log for details",
0, 0, 0);
}

long long int now_init(void)
{
struct msg_base request;
struct msg_now_init_reply *reply;
long long int now;

request.type = MESSAGE_TYPE_NOW_INIT_REQUEST;
mailbox_send_and_wait(&request);

reply = mailbox_wait_and_receive();
if(reply->type != MESSAGE_TYPE_NOW_INIT_REPLY) {
core_log("Malformed MESSAGE_TYPE_NOW_INIT_REQUEST reply type %d\n",
reply->type);
while(1);
}
now = reply->now;
mailbox_acknowledge();

if(now < 0) {
rtio_init();
now = rtio_get_counter() + (272000 << CONFIG_RTIO_FINE_TS_WIDTH);
}

return now;
}

void now_save(long long int now)
{
struct msg_now_save request;

request.type = MESSAGE_TYPE_NOW_SAVE;
request.now = now;
mailbox_send_and_wait(&request);
}

int watchdog_set(int ms)
{
struct msg_watchdog_set_request request;
@@ -485,7 +486,8 @@ void send_rpc(int service, const char *tag, ...)
va_end(request.args);
}

int recv_rpc(void *slot) {
int recv_rpc(void *slot)
{
struct msg_rpc_recv_request request;
struct msg_rpc_recv_reply *reply;

@@ -524,7 +526,8 @@ struct type_desc {
void **objects;
};

void attribute_writeback(void *utypes) {
void attribute_writeback(void *utypes)
{
struct type_desc **types = (struct type_desc **)utypes;
while(*types) {
struct type_desc *type = *types++;
2 changes: 0 additions & 2 deletions artiq/runtime/ksupport.h
Original file line number Diff line number Diff line change
@@ -6,8 +6,6 @@ struct artiq_list {
int32_t *elements;
};

long long int now_init(void);
void now_save(long long int now);
int watchdog_set(int ms);
void watchdog_clear(int id);
void send_rpc(int service, const char *tag, ...);
7 changes: 0 additions & 7 deletions artiq/runtime/messages.h
Original file line number Diff line number Diff line change
@@ -103,13 +103,6 @@ struct msg_rpc_recv_reply {
struct artiq_exception *exception;
};

struct msg_rpc_batch {
int type;
int service;
const char *tag;
void *ptr;
};

struct msg_cache_get_request {
int type;
const char *key;
31 changes: 31 additions & 0 deletions artiq/test/coredevice/test_rtio.py
Original file line number Diff line number Diff line change
@@ -238,6 +238,31 @@ def run(self):
self.k("t2")


class DummyException(Exception):
pass


class HandoverException(EnvExperiment):
def build(self):
self.setattr_device("core")

@kernel
def k(self, var):
self.set_dataset(var, now_mu())
delay_mu(1234)
raise DummyException()

def run(self):
try:
self.k("t1")
except DummyException:
pass
try:
self.k("t2")
except DummyException:
pass


class CoredeviceTest(ExperimentCase):
def test_loopback(self):
self.execute(Loopback)
@@ -314,6 +339,12 @@ def test_handover(self):
self.assertEqual(self.dataset_mgr.get("t1") + 1234,
self.dataset_mgr.get("t2"))

def test_handover_exception(self):
self.execute(HandoverException)
self.assertEqual(self.dataset_mgr.get("t1") + 1234,
self.dataset_mgr.get("t2"))



class RPCTiming(EnvExperiment):
def build(self):