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: 0bf3b7a32beb
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: d73006652b5d
Choose a head ref
  • 4 commits
  • 12 files changed
  • 1 contributor

Commits on Jun 3, 2015

  1. Copy the full SHA
    a2ae5e4 View commit details

Commits on Jun 4, 2015

  1. Copy the full SHA
    448ba04 View commit details
  2. style fixes

    sbourdeauducq committed Jun 4, 2015
    Copy the full SHA
    82a2bea View commit details
  3. Copy the full SHA
    d730066 View commit details
2 changes: 1 addition & 1 deletion artiq/gateware/rtio/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
from artiq.gateware.rtio.core import Channel, RTIO
from artiq.gateware.rtio.monitor import Monitor
from artiq.gateware.rtio.moninj import Monitor
Original file line number Diff line number Diff line change
@@ -2,6 +2,7 @@
from migen.bank.description import *
from migen.genlib.cdc import BusSynchronizer


class Monitor(Module, AutoCSR):
def __init__(self, channels):
chan_probes = [c.probes for c in channels]
6 changes: 3 additions & 3 deletions artiq/test/sync_struct.py
Original file line number Diff line number Diff line change
@@ -18,7 +18,7 @@ def write_test_data(test_dict):
for key, value in enumerate(test_values):
test_dict[key] = value
test_dict[1.5] = 1.5
test_dict["Finished"] = True
test_dict["finished"] = True


@asyncio.coroutine
@@ -37,8 +37,8 @@ def init_test_dict(self, init):
return init

def notify(self, mod):
if (mod["action"] == "init" and "Finished" in mod["struct"])\
or (mod["action"] == "setitem" and mod["key"] == "Finished"):
if (mod["action"] == "init" and "finished" in mod["struct"])\
or (mod["action"] == "setitem" and mod["key"] == "finished"):
self.receiving_done.set()

def setUp(self):
4 changes: 2 additions & 2 deletions artiq/test/worker.py
Original file line number Diff line number Diff line change
@@ -31,8 +31,8 @@ def run(self):

@asyncio.coroutine
def _call_worker(worker, expid):
yield from worker.prepare(0, "main", expid, 0)
try:
yield from worker.prepare(0, "main", expid, 0)
yield from worker.run()
yield from worker.analyze()
finally:
@@ -58,7 +58,7 @@ def _run_experiment(experiment):

class WatchdogCase(unittest.TestCase):
def test_watchdog_no_timeout(self):
_run_experiment("WatchdogNoTimeout")
_run_experiment("WatchdogNoTimeout")

def test_watchdog_timeout(self):
with self.assertRaises(WorkerWatchdogTimeout):
2 changes: 1 addition & 1 deletion doc/manual/installing.rst
Original file line number Diff line number Diff line change
@@ -177,7 +177,7 @@ To flash the ``idle`` kernel:
* Compile the ``idle`` experiment:
The ``idle`` experiment's ``run()`` method must be a kernel: it must be decorated with the ``@kernel`` decorator (see :ref:`next topic <connecting-to-the-core-device>` for more information about kernels).

Moreover, since the core device is not connected to the PC: RPC are forbidden in this ``idle`` experiment.
Since the core device is not connected to the PC, RPCs (calling Python code running on the PC from the kernel) are forbidden in the ``idle`` experiment.
::

$ artiq_compile idle.py
2 changes: 1 addition & 1 deletion soc/runtime/Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
include $(MSCDIR)/software/common.mak

OBJECTS := isr.o flash_storage.o clock.o elf_loader.o services.o session.o log.o test_mode.o kloader.o bridge_ctl.o mailbox.o ksupport_data.o kserver.o main.o
OBJECTS := isr.o flash_storage.o clock.o elf_loader.o services.o session.o log.o test_mode.o kloader.o bridge_ctl.o mailbox.o ksupport_data.o kserver.o moninj.o main.o
OBJECTS_KSUPPORT := ksupport.o exception_jmp.o exceptions.o mailbox.o bridge.o rtio.o ttl.o dds.o

CFLAGS += -Ilwip/src/include -Iliblwip
4 changes: 2 additions & 2 deletions soc/runtime/liblwip/lwipopts.h
Original file line number Diff line number Diff line change
@@ -66,7 +66,7 @@ a lot of data that needs to be copied, this should be set high. */
#define MEMP_NUM_PBUF 64
/* MEMP_NUM_UDP_PCB: the number of UDP protocol control blocks. One
per active UDP "connection". */
#define MEMP_NUM_UDP_PCB 1
#define MEMP_NUM_UDP_PCB 2
/* MEMP_NUM_TCP_PCB: the number of simulatenously active TCP
connections. */
#define MEMP_NUM_TCP_PCB 8
@@ -159,7 +159,7 @@ a lot of data that needs to be copied, this should be set high. */
#define DHCP_DOES_ARP_CHECK 0

/* ---------- UDP options ---------- */
#define LWIP_UDP 0
#define LWIP_UDP 1
#define UDP_TTL 255


2 changes: 2 additions & 0 deletions soc/runtime/main.c
Original file line number Diff line number Diff line change
@@ -28,6 +28,7 @@
#include "test_mode.h"
#include "kserver.h"
#include "session.h"
#include "moninj.h"

static void common_init(void)
{
@@ -139,6 +140,7 @@ static void regular_main(void)
puts("Accepting sessions on Ethernet.");
network_init();
kserver_init();
moninj_init();

session_end();
while(1) {
83 changes: 83 additions & 0 deletions soc/runtime/moninj.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
#include <generated/csr.h>

#ifdef CSR_ETHMAC_BASE

#include <netif/etharp.h>
#include <lwip/init.h>
#include <lwip/memp.h>
#include <lwip/ip4_addr.h>
#include <lwip/ip4.h>
#include <lwip/netif.h>
#include <lwip/sys.h>
#include <lwip/udp.h>
#include <lwip/timers.h>

#include "log.h"
#include "moninj.h"

enum {
MONINJ_REQ_MONITOR = 1
};

static struct udp_pcb *listen_pcb;

struct monitor_reply {
long long int ttl_levels;
long long int ttl_oes;
};

static void moninj_monitor(const ip_addr_t *addr, u16_t port)
{
struct monitor_reply reply;
int i;
struct pbuf *reply_p;

reply.ttl_levels = 0;
reply.ttl_oes = 0;
for(i=0;i<RTIO_TTL_COUNT;i++) {
rtio_mon_chan_sel_write(i);
rtio_mon_probe_sel_write(0);
if(rtio_mon_probe_value_read())
reply.ttl_levels |= 1LL << i;
rtio_mon_probe_sel_write(1);
if(rtio_mon_probe_value_read())
reply.ttl_oes |= 1LL << i;
}

reply_p = pbuf_alloc(PBUF_TRANSPORT, sizeof(struct monitor_reply), PBUF_RAM);
if(!reply_p) {
log("Failed to allocate pbuf for monitor reply");
return;
}
memcpy(reply_p->payload, &reply, sizeof(struct monitor_reply));
udp_sendto(listen_pcb, reply_p, addr, port);
pbuf_free(reply_p);
}

static void moninj_recv(void *arg, struct udp_pcb *upcb, struct pbuf *req,
const ip_addr_t *addr, u16_t port)
{
if(req->len >= 1) {
switch(*(char *)req->payload) {
case MONINJ_REQ_MONITOR:
moninj_monitor(addr, port);
break;
default:
break;
}
}
pbuf_free(req); /* beware: addr may point into the req pbuf */
}

void moninj_init(void)
{
listen_pcb = udp_new();
if(!listen_pcb) {
log("Failed to create UDP listening PCB");
return;
}
udp_bind(listen_pcb, IP_ADDR_ANY, 3250);
udp_recv(listen_pcb, moninj_recv, NULL);
}

#endif /* CSR_ETHMAC_BASE */
6 changes: 6 additions & 0 deletions soc/runtime/moninj.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#ifndef __MONINJ_H
#define __MONINJ_H

void moninj_init(void);

#endif /* __MONINJ_H */
1 change: 1 addition & 0 deletions soc/targets/artiq_kc705.py
Original file line number Diff line number Diff line change
@@ -76,6 +76,7 @@ def __init__(self, platform, cpu_type="or1k", **kwargs):
phy = ttl_simple.Output(platform.request("user_led", 2))
self.submodules += phy
rtio_channels.append(rtio.Channel(phy.rtlink, phy.probes))
self.add_constant("RTIO_TTL_COUNT", len(rtio_channels))

self.add_constant("RTIO_DDS_CHANNEL", len(rtio_channels))
self.submodules.dds = RenameClockDomains(
1 change: 1 addition & 0 deletions soc/targets/artiq_pipistrello.py
Original file line number Diff line number Diff line change
@@ -111,6 +111,7 @@ def __init__(self, platform, cpu_type="or1k", **kwargs):
phy = ttl_simple.Output(platform.request("user_led", i))
self.submodules += phy
rtio_channels.append(rtio.Channel(phy.rtlink, phy.probes))
self.add_constant("RTIO_TTL_COUNT", len(rtio_channels))

self.add_constant("RTIO_DDS_CHANNEL", len(rtio_channels))
self.submodules.dds = RenameClockDomains(