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: 8f6706254378
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: 641831e0e108
Choose a head ref
  • 2 commits
  • 3 files changed
  • 1 contributor

Commits on Mar 19, 2016

  1. Copy the full SHA
    d0af58d View commit details
  2. Copy the full SHA
    641831e View commit details
Showing with 13 additions and 16 deletions.
  1. +2 −3 artiq/coredevice/__init__.py
  2. +3 −2 artiq/coredevice/exceptions.py
  3. +8 −11 artiq/runtime/dds.c
5 changes: 2 additions & 3 deletions artiq/coredevice/__init__.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
from artiq.coredevice import exceptions, dds, spi
from artiq.coredevice.exceptions import (RTIOUnderflow, RTIOSequenceError,
RTIOCollision, RTIOOverflow, RTIOBusy,
DDSBatchError, CacheError)
RTIOCollision, RTIOOverflow, RTIOBusy)
from artiq.coredevice.dds import (PHASE_MODE_CONTINUOUS, PHASE_MODE_ABSOLUTE,
PHASE_MODE_TRACKING)

__all__ = []
__all__ += ["RTIOUnderflow", "RTIOSequenceError", "RTIOCollision",
"RTIOOverflow", "RTIOBusy", "DDSBatchError", "CacheError"]
"RTIOOverflow", "RTIOBusy"]
__all__ += ["PHASE_MODE_CONTINUOUS", "PHASE_MODE_ABSOLUTE",
"PHASE_MODE_TRACKING"]
5 changes: 3 additions & 2 deletions artiq/coredevice/exceptions.py
Original file line number Diff line number Diff line change
@@ -120,9 +120,10 @@ class RTIOOverflow(Exception):
"""
artiq_builtin = True

class DDSBatchError(Exception):
class DDSError(Exception):
"""Raised when attempting to start a DDS batch while already in a batch,
or when too many commands are batched.
when too many commands are batched, and when DDS channel settings are
incorrect.
"""
artiq_builtin = True

19 changes: 8 additions & 11 deletions artiq/runtime/dds.c
Original file line number Diff line number Diff line change
@@ -90,15 +90,12 @@ static void dds_set_one(long long int now, long long int ref_time,
{
unsigned int channel_enc;

if((channel < 0) || (channel >= CONFIG_DDS_CHANNELS_PER_BUS)) {
core_log("Attempted to set invalid DDS channel\n");
return;
}
if((channel < 0) || (channel >= CONFIG_DDS_CHANNELS_PER_BUS))
artiq_raise_from_c("DDSError", "Attempted to set invalid DDS channel", 0, 0, 0);
if((bus_channel < CONFIG_RTIO_FIRST_DDS_CHANNEL)
|| (bus_channel >= (CONFIG_RTIO_FIRST_DDS_CHANNEL+CONFIG_RTIO_DDS_COUNT))) {
core_log("Attempted to use invalid DDS bus\n");
return;
}
|| (bus_channel >= (CONFIG_RTIO_FIRST_DDS_CHANNEL+CONFIG_RTIO_DDS_COUNT)))
artiq_raise_from_c("DDSError", "Attempted to use invalid DDS bus", 0, 0, 0);

#ifdef CONFIG_DDS_ONEHOT_SEL
channel_enc = 1 << channel;
#else
@@ -179,7 +176,7 @@ static struct dds_set_params batch[DDS_MAX_BATCH];
void dds_batch_enter(long long int timestamp)
{
if(batch_mode)
artiq_raise_from_c("DDSBatchError", "DDS batch error", 0, 0, 0);
artiq_raise_from_c("DDSError", "DDS batch entered twice", 0, 0, 0);
batch_mode = 1;
batch_count = 0;
batch_ref_time = timestamp;
@@ -191,7 +188,7 @@ void dds_batch_exit(void)
int i;

if(!batch_mode)
artiq_raise_from_c("DDSBatchError", "DDS batch error", 0, 0, 0);
artiq_raise_from_c("DDSError", "DDS batch exited twice", 0, 0, 0);
batch_mode = 0;
/* + FUD time */
now = batch_ref_time - batch_count*(DURATION_PROGRAM + DURATION_WRITE);
@@ -209,7 +206,7 @@ void dds_set(long long int timestamp, int bus_channel, int channel,
{
if(batch_mode) {
if(batch_count >= DDS_MAX_BATCH)
artiq_raise_from_c("DDSBatchError", "DDS batch error", 0, 0, 0);
artiq_raise_from_c("DDSError", "Too many commands in DDS batch", 0, 0, 0);
/* timestamp parameter ignored (determined by batch) */
batch[batch_count].bus_channel = bus_channel;
batch[batch_count].channel = channel;