Annotation entries also consist of a tuple, not a list.
return SRD_OK;
py_probelist = PyObject_GetAttrString(d->py_dec, attr);
- if (!PyList_Check(py_probelist)) {
- srd_err("Protocol decoder %s %s attribute is not a list.",
+ if (!PyTuple_Check(py_probelist)) {
+ srd_err("Protocol decoder %s %s attribute is not a tuple.",
d->name, attr);
return SRD_ERR_PYTHON;
}
- if ((num_probes = PyList_Size(py_probelist)) == 0)
+ if ((num_probes = PyTuple_Size(py_probelist)) == 0)
/* Empty probelist. */
return SRD_OK;
ret = SRD_OK;
for (i = 0; i < num_probes; i++) {
- py_entry = PyList_GetItem(py_probelist, i);
+ py_entry = PyTuple_GetItem(py_probelist, i);
if (!PyDict_Check(py_entry)) {
srd_err("Protocol decoder %s %s attribute is not "
"a list with dict elements.", d->name, attr);
d->annotations = NULL;
if (PyObject_HasAttrString(d->py_dec, "annotations")) {
py_annlist = PyObject_GetAttrString(d->py_dec, "annotations");
- if (!PyList_Check(py_annlist)) {
+ if (!PyTuple_Check(py_annlist)) {
srd_err("Protocol decoder %s annotations should "
- "be a list.", module_name);
+ "be a tuple.", module_name);
goto err_out;
}
- for (i = 0; i < PyList_Size(py_annlist); i++) {
- py_ann = PyList_GetItem(py_annlist, i);
- if (!PyList_Check(py_ann) || PyList_Size(py_ann) != 2) {
+ for (i = 0; i < PyTuple_Size(py_annlist); i++) {
+ py_ann = PyTuple_GetItem(py_annlist, i);
+ if (!PyTuple_Check(py_ann) || PyTuple_Size(py_ann) != 2) {
srd_err("Protocol decoder %s annotation %d should "
- "be a list with two elements.", module_name, i + 1);
+ "be a tuple with two elements.", module_name, i + 1);
goto err_out;
}
license = 'gplv2+'
inputs = ['spi', 'logic']
outputs = ['avr_isp']
- optional_probes = [
+ optional_probes = (
{'id': 'reset', 'name': 'RESET#', 'desc': 'Target AVR MCU reset'},
- ]
- annotations = [
- ['pe', 'Programming enable'],
- ['rsb0', 'Read signature byte 0'],
- ['rsb1', 'Read signature byte 1'],
- ['rsb2', 'Read signature byte 2'],
- ['ce', 'Chip erase'],
- ['rfb', 'Read fuse bits'],
- ['rhfb', 'Read high fuse bits'],
- ['refb', 'Read extended fuse bits'],
- ['warnings', 'Warnings'],
- ['dev', 'Device'],
- ]
+ )
+ annotations = (
+ ('pe', 'Programming enable'),
+ ('rsb0', 'Read signature byte 0'),
+ ('rsb1', 'Read signature byte 1'),
+ ('rsb2', 'Read signature byte 2'),
+ ('ce', 'Chip erase'),
+ ('rfb', 'Read fuse bits'),
+ ('rhfb', 'Read high fuse bits'),
+ ('refb', 'Read extended fuse bits'),
+ ('warnings', 'Warnings'),
+ ('dev', 'Device'),
+ )
annotation_rows = (
('bits', 'Bits', ()),
('commands', 'Commands', tuple(range(7 + 1))),
license = 'gplv2+'
inputs = ['logic']
outputs = ['can']
- probes = [
+ probes = (
{'id': 'can_rx', 'name': 'CAN RX', 'desc': 'CAN bus line'},
- ]
+ )
options = (
{'id': 'bitrate', 'desc': 'Bitrate', 'default': 1000000}, # 1Mbit/s
{'id': 'sample_point', 'desc': 'Sample point', 'default': 70}, # 70%
)
- annotations = [
- ['data', 'CAN payload data'],
- ['sof', 'Start of frame'],
- ['eof', 'End of frame'],
- ['id', 'Identifier'],
- ['ext-id', 'Extended identifier'],
- ['full-id', 'Full identifier'],
- ['ide', 'Identifier extension bit'],
- ['reserved-bit', 'Reserved bit 0 and 1'],
- ['rtr', 'Remote transmission request'],
- ['srr', 'Substitute remote request'],
- ['dlc', 'Data length count'],
- ['crc-sequence', 'CRC sequence'],
- ['crc-delimiter', 'CRC delimiter'],
- ['ack-slot', 'ACK slot'],
- ['ack-delimiter', 'ACK delimiter'],
- ['stuff-bit', 'Stuff bit'],
- ['warnings', 'Human-readable warnings'],
- ]
+ annotations = (
+ ('data', 'CAN payload data'),
+ ('sof', 'Start of frame'),
+ ('eof', 'End of frame'),
+ ('id', 'Identifier'),
+ ('ext-id', 'Extended identifier'),
+ ('full-id', 'Full identifier'),
+ ('ide', 'Identifier extension bit'),
+ ('reserved-bit', 'Reserved bit 0 and 1'),
+ ('rtr', 'Remote transmission request'),
+ ('srr', 'Substitute remote request'),
+ ('dlc', 'Data length count'),
+ ('crc-sequence', 'CRC sequence'),
+ ('crc-delimiter', 'CRC delimiter'),
+ ('ack-slot', 'ACK slot'),
+ ('ack-delimiter', 'ACK delimiter'),
+ ('stuff-bit', 'Stuff bit'),
+ ('warnings', 'Human-readable warnings'),
+ )
def __init__(self, **kwargs):
self.samplerate = None
license = 'gplv2+'
inputs = ['logic']
outputs = ['dcf77']
- probes = [
+ probes = (
{'id': 'data', 'name': 'DATA', 'desc': 'DATA line'},
- ]
- annotations = [
- ['start-of-minute', 'Start of minute'],
- ['special-bits', 'Special bits (civil warnings, weather forecast)'],
- ['call-bit', 'Call bit'],
- ['summer-time', 'Summer time announcement'],
- ['cest', 'CEST bit'],
- ['cet', 'CET bit'],
- ['leap-second', 'Leap second bit'],
- ['start-of-time', 'Start of encoded time'],
- ['minute', 'Minute'],
- ['minute-parity', 'Minute parity bit'],
- ['hour', 'Hour'],
- ['hour-parity', 'Hour parity bit'],
- ['day', 'Day of month'],
- ['day-of-week', 'Day of week'],
- ['month', 'Month'],
- ['year', 'Year'],
- ['date-parity', 'Date parity bit'],
- ['raw-bits', 'Raw bits'],
- ['unknown-bits', 'Unknown bits'],
- ['warnings', 'Human-readable warnings'],
- ]
+ )
+ annotations = (
+ ('start-of-minute', 'Start of minute'),
+ ('special-bits', 'Special bits (civil warnings, weather forecast)'),
+ ('call-bit', 'Call bit'),
+ ('summer-time', 'Summer time announcement'),
+ ('cest', 'CEST bit'),
+ ('cet', 'CET bit'),
+ ('leap-second', 'Leap second bit'),
+ ('start-of-time', 'Start of encoded time'),
+ ('minute', 'Minute'),
+ ('minute-parity', 'Minute parity bit'),
+ ('hour', 'Hour'),
+ ('hour-parity', 'Hour parity bit'),
+ ('day', 'Day of month'),
+ ('day-of-week', 'Day of week'),
+ ('month', 'Month'),
+ ('year', 'Year'),
+ ('date-parity', 'Date parity bit'),
+ ('raw-bits', 'Raw bits'),
+ ('unknown-bits', 'Unknown bits'),
+ ('warnings', 'Human-readable warnings'),
+ )
annotation_rows = (
('bits', 'Bits', (17, 18)),
('fields', 'Fields', tuple(range(0, 16 + 1))),
license = 'gplv2+'
inputs = ['i2c']
outputs = ['ds1307']
- annotations = [
- ['text', 'Human-readable text'],
- ]
+ annotations = (
+ ('text', 'Human-readable text'),
+ )
def __init__(self, **kwargs):
self.state = 'IDLE'
license = 'gplv3+'
inputs = ['i2c']
outputs = ['edid']
- annotations = [
- ['fields', 'EDID structure fields'],
- ['sections', 'EDID structure sections'],
- ]
+ annotations = (
+ ('fields', 'EDID structure fields'),
+ ('sections', 'EDID structure sections'),
+ )
def __init__(self, **kwargs):
self.state = None
license = 'gplv2+'
inputs = ['logic']
outputs = ['guess_bitrate']
- probes = [
+ probes = (
{'id': 'data', 'name': 'Data', 'desc': 'Data line'},
- ]
- annotations = [
- ['bitrate', 'Bitrate / baudrate'],
- ]
+ )
+ annotations = (
+ ('bitrate', 'Bitrate / baudrate'),
+ )
def putx(self, data):
self.put(self.ss_edge, self.samplenum, self.out_ann, data)
license = 'gplv2+'
inputs = ['logic']
outputs = ['i2c']
- probes = [
+ probes = (
{'id': 'scl', 'name': 'SCL', 'desc': 'Serial clock line'},
{'id': 'sda', 'name': 'SDA', 'desc': 'Serial data line'},
- ]
+ )
options = (
{'id': 'address_format', 'desc': 'Displayed slave address format',
'default': 'shifted', 'values': ('shifted', 'unshifted')},
)
- annotations = [
- ['start', 'Start condition'],
- ['repeat-start', 'Repeat start condition'],
- ['stop', 'Stop condition'],
- ['ack', 'ACK'],
- ['nack', 'NACK'],
- ['bit', 'Data/address bit'],
- ['address-read', 'Address read'],
- ['address-write', 'Address write'],
- ['data-read', 'Data read'],
- ['data-write', 'Data write'],
- ['warnings', 'Human-readable warnings'],
- ]
+ annotations = (
+ ('start', 'Start condition'),
+ ('repeat-start', 'Repeat start condition'),
+ ('stop', 'Stop condition'),
+ ('ack', 'ACK'),
+ ('nack', 'NACK'),
+ ('bit', 'Data/address bit'),
+ ('address-read', 'Address read'),
+ ('address-write', 'Address write'),
+ ('data-read', 'Data read'),
+ ('data-write', 'Data write'),
+ ('warnings', 'Human-readable warnings'),
+ )
annotation_rows = (
('bits', 'Bits', (5,)),
('addr-data', 'Address/Data', (0, 1, 2, 3, 4, 6, 7, 8, 9)),
license = 'gplv2+'
inputs = ['i2c']
outputs = [] # TODO: Only known at run-time.
- annotations = []
def __init__(self, **kwargs):
self.packets = [] # Local cache of I²C packets
{'id': 'direction', 'desc': 'Direction to filter', 'default': 'both',
'values': ('read', 'write', 'both')}
)
- annotations = []
def __init__(self, **kwargs):
self.state = None
license = 'gplv2+'
inputs = ['logic']
outputs = ['i2s']
- probes = [
+ probes = (
{'id': 'sck', 'name': 'SCK', 'desc': 'Bit clock line'},
{'id': 'ws', 'name': 'WS', 'desc': 'Word select line'},
{'id': 'sd', 'name': 'SD', 'desc': 'Serial data line'},
- ]
- annotations = [
- ['left', 'Left channel'],
- ['right', 'Right channel'],
- ['warnings', 'Warnings'],
- ]
+ )
+ annotations = (
+ ('left', 'Left channel'),
+ ('right', 'Right channel'),
+ ('warnings', 'Warnings'),
+ )
binary = (
('wav', 'WAV file'),
)
license = 'gplv2+'
inputs = ['logic']
outputs = ['ir_rc5']
- probes = [
+ probes = (
{'id': 'ir', 'name': 'IR', 'desc': 'IR data line'},
- ]
- optional_probes = []
+ )
options = (
{'id': 'polarity', 'desc': 'Polarity', 'default': 'active-low',
'values': ('active-low', 'active-high')},
{'id': 'protocol', 'desc': 'Protocol type', 'default': 'standard',
'values': ('standard', 'extended')},
)
- annotations = [
- ['bit', 'Bit'],
- ['startbit1', 'Startbit 1'],
- ['startbit2', 'Startbit 2'],
- ['togglebit-0', 'Toggle bit 0'],
- ['togglebit-1', 'Toggle bit 1'],
- ['address', 'Address'],
- ['command', 'Command'],
- ]
+ annotations = (
+ ('bit', 'Bit'),
+ ('startbit1', 'Startbit 1'),
+ ('startbit2', 'Startbit 2'),
+ ('togglebit-0', 'Toggle bit 0'),
+ ('togglebit-1', 'Toggle bit 1'),
+ ('address', 'Address'),
+ ('command', 'Command'),
+ )
annotation_rows = (
('bits', 'Bits', (0,)),
('fields', 'Fields', (1, 2, 3, 4, 5, 6)),
license = 'gplv2+'
inputs = ['logic']
outputs = ['jtag']
- probes = [
+ probes = (
{'id': 'tdi', 'name': 'TDI', 'desc': 'Test data input'},
{'id': 'tdo', 'name': 'TDO', 'desc': 'Test data output'},
{'id': 'tck', 'name': 'TCK', 'desc': 'Test clock'},
{'id': 'tms', 'name': 'TMS', 'desc': 'Test mode select'},
- ]
- optional_probes = [
+ )
+ optional_probes = (
{'id': 'trst', 'name': 'TRST#', 'desc': 'Test reset'},
{'id': 'srst', 'name': 'SRST#', 'desc': 'System reset'},
{'id': 'rtck', 'name': 'RTCK', 'desc': 'Return clock signal'},
- ]
- annotations = [[s.lower(), s] for s in jtag_states]
+ )
+ annotations = tuple([tuple([s.lower(), s]) for s in jtag_states])
def __init__(self, **kwargs):
# self.state = 'TEST-LOGIC-RESET'
license = 'gplv2+'
inputs = ['jtag']
outputs = ['jtag_stm32']
- annotations = [
- ['text', 'Human-readable text'],
- ]
+ annotations = (
+ ('text', 'Human-readable text'),
+ )
def __init__(self, **kwargs):
self.state = 'IDLE'
license = 'gplv2+'
inputs = ['i2c']
outputs = ['lm75']
- optional_probes = [
+ optional_probes = (
{'id': 'os', 'name': 'OS', 'desc': 'Overtemperature shutdown'},
{'id': 'a0', 'name': 'A0', 'desc': 'I²C slave address input 0'},
{'id': 'a1', 'name': 'A1', 'desc': 'I²C slave address input 1'},
{'id': 'a2', 'name': 'A2', 'desc': 'I²C slave address input 2'},
- ]
+ )
options = (
{'id': 'sensor', 'desc': 'Sensor type', 'default': 'lm75'},
{'id': 'resolution', 'desc': 'Resolution', 'default': 9,
'values': (9, 10, 11, 12)},
)
- annotations = [
- ['celsius', 'Temperature in degrees Celsius'],
- ['kelvin', 'Temperature in Kelvin'],
- ['text-verbose', 'Human-readable text (verbose)'],
- ['text', 'Human-readable text'],
- ['warnings', 'Human-readable warnings'],
- ]
+ annotations = (
+ ('celsius', 'Temperature in degrees Celsius'),
+ ('kelvin', 'Temperature in Kelvin'),
+ ('text-verbose', 'Human-readable text (verbose)'),
+ ('text', 'Human-readable text'),
+ ('warnings', 'Human-readable warnings'),
+ )
def __init__(self, **kwargs):
self.state = 'IDLE'
license = 'gplv2+'
inputs = ['logic']
outputs = ['lpc']
- probes = [
+ probes = (
{'id': 'lframe', 'name': 'LFRAME#', 'desc': 'Frame'},
{'id': 'lclk', 'name': 'LCLK', 'desc': 'Clock'},
{'id': 'lad0', 'name': 'LAD[0]', 'desc': 'Addr/control/data 0'},
{'id': 'lad1', 'name': 'LAD[1]', 'desc': 'Addr/control/data 1'},
{'id': 'lad2', 'name': 'LAD[2]', 'desc': 'Addr/control/data 2'},
{'id': 'lad3', 'name': 'LAD[3]', 'desc': 'Addr/control/data 3'},
- ]
- optional_probes = [
+ )
+ optional_probes = (
{'id': 'lreset', 'name': 'LRESET#', 'desc': 'Reset'},
{'id': 'ldrq', 'name': 'LDRQ#', 'desc': 'Encoded DMA / bus master request'},
{'id': 'serirq', 'name': 'SERIRQ', 'desc': 'Serialized IRQ'},
{'id': 'lpme', 'name': 'LPME#', 'desc': 'LPC power management event'},
{'id': 'lpcpd', 'name': 'LPCPD#', 'desc': 'Power down'},
{'id': 'lsmi', 'name': 'LSMI#', 'desc': 'System Management Interrupt'},
- ]
- annotations = [
- ['warnings', 'Warnings'],
- ['start', 'Start'],
- ['cycle-type', 'Cycle-type/direction'],
- ['addr', 'Address'],
- ['tar1', 'Turn-around cycle 1'],
- ['sync', 'Sync'],
- ['data', 'Data'],
- ['tar2', 'Turn-around cycle 2'],
- ]
+ )
+ annotations = (
+ ('warnings', 'Warnings'),
+ ('start', 'Start'),
+ ('cycle-type', 'Cycle-type/direction'),
+ ('addr', 'Address'),
+ ('tar1', 'Turn-around cycle 1'),
+ ('sync', 'Sync'),
+ ('data', 'Data'),
+ ('tar2', 'Turn-around cycle 2'),
+ )
annotation_rows = (
('data', 'Data', (1, 2, 3, 4, 5, 6, 7)),
('warnings', 'Warnings', (0,)),
license = 'gplv2+'
inputs = ['onewire_network']
outputs = ['maxim_ds28ea00']
- optional_probes = [
+ optional_probes = (
{'id': 'pioa', 'name': 'PIOA/DONE#',
'desc': 'PIOA channel and chain output'},
{'id': 'piob', 'name': 'PIOB/EN#',
'desc': 'PIOB channel and chain output'},
- ]
- annotations = [
- ['text', 'Human-readable text'],
- ]
+ )
+ annotations = (
+ ('text', 'Human-readable text'),
+ )
def __init__(self, **kwargs):
self.trn_beg = 0
license = 'gplv2+'
inputs = ['uart']
outputs = ['midi']
- annotations = [
- ['text-verbose', 'Human-readable text (verbose)'],
- ]
+ annotations = (
+ ('text-verbose', 'Human-readable text (verbose)'),
+ )
def __init__(self, **kwargs):
self.cmd = []
license = 'gplv2+'
inputs = ['i2c']
outputs = ['mlx90614']
- annotations = [
- ['celsius', 'Temperature in degrees Celsius'],
- ['kelvin', 'Temperature in Kelvin'],
- ]
+ annotations = (
+ ('celsius', 'Temperature in degrees Celsius'),
+ ('kelvin', 'Temperature in Kelvin'),
+ )
def __init__(self, **kwargs):
self.state = 'IGNORE START REPEAT'
}
def cmd_annotation_classes():
- return [[cmd[0].lower(), cmd[1]] for cmd in cmds.values()]
+ return tuple([tuple([cmd[0].lower(), cmd[1]]) for cmd in cmds.values()])
def decode_status_reg(data):
# TODO: Additional per-bit(s) self.put() calls with correct start/end.
license = 'gplv2+'
inputs = ['spi', 'logic']
outputs = ['mx25lxx05d']
- optional_probes = [
+ optional_probes = (
{'id': 'hold', 'name': 'HOLD#', 'desc': 'Pause device w/o deselecting it'},
{'id': 'wp_acc', 'name': 'WP#/ACC', 'desc': 'Write protect'},
- ]
- annotations = cmd_annotation_classes() + [
- ['bits', 'Bits'],
- ['bits2', 'Bits2'],
- ['warnings', 'Warnings'],
- ]
+ )
+ annotations = cmd_annotation_classes() + (
+ ('bits', 'Bits'),
+ ('bits2', 'Bits2'),
+ ('warnings', 'Warnings'),
+ )
annotation_rows = (
('bits', 'Bits', (24, 25)),
('commands', 'Commands', tuple(range(23 + 1))),
license = 'gplv2+'
inputs = ['i2c']
outputs = ['mxc6225xu']
- optional_probes = [
+ optional_probes = (
{'id': 'int', 'name': 'INT', 'desc': 'DTOS interrupt output pin'},
- ]
- annotations = [
- ['text', 'Human-readable text'],
- ]
+ )
+ annotations = (
+ ('text', 'Human-readable text'),
+ )
def __init__(self, **kwargs):
self.state = 'IDLE'
license = 'gplv2+'
inputs = ['i2c']
outputs = ['nunchuck']
- annotations = [
- ['text-verbose', 'Human-readable text (verbose)'],
- ['text', 'Human-readable text'],
- ['warnings', 'Human-readable warnings'],
- ]
+ annotations = (
+ ('text-verbose', 'Human-readable text (verbose)'),
+ ('text', 'Human-readable text'),
+ ('warnings', 'Human-readable warnings'),
+ )
def __init__(self, **kwargs):
self.state = 'IDLE'
license = 'gplv2+'
inputs = ['logic']
outputs = ['onewire_link']
- probes = [
+ probes = (
{'id': 'owr', 'name': 'OWR', 'desc': '1-Wire signal line'},
- ]
- optional_probes = [
+ )
+ optional_probes = (
{'id': 'pwr', 'name': 'PWR', 'desc': '1-Wire power supply pin'},
- ]
+ )
options = (
{'id': 'overdrive',
'desc': 'Overdrive mode',
'desc': 'Overdrive mode reset time (μs)',
'default': 48},
)
- annotations = [
- ['bit', 'Bit'],
- ['warnings', 'Warnings'],
- ['reset', 'Reset'],
- ['presence', 'Presence'],
- ['overdrive', 'Overdrive mode notifications'],
- ]
+ annotations = (
+ ('bit', 'Bit'),
+ ('warnings', 'Warnings'),
+ ('reset', 'Reset'),
+ ('presence', 'Presence'),
+ ('overdrive', 'Overdrive mode notifications'),
+ )
annotation_rows = (
('bits', 'Bits', (0, 2, 3)),
('info', 'Info', (4,)),
license = 'gplv2+'
inputs = ['onewire_link']
outputs = ['onewire_network']
- annotations = [
- ['text', 'Human-readable text'],
- ]
+ annotations = (
+ ('text', 'Human-readable text'),
+ )
def __init__(self, **kwargs):
self.beg = 0
license = 'gplv2+'
inputs = ['uart']
outputs = ['pan1321']
- annotations = [
- ['text-verbose', 'Human-readable text (verbose)'],
- ['text', 'Human-readable text'],
- ['warnings', 'Human-readable warnings'],
- ]
+ annotations = (
+ ('text-verbose', 'Human-readable text (verbose)'),
+ ('text', 'Human-readable text'),
+ ('warnings', 'Human-readable warnings'),
+ )
def __init__(self, **kwargs):
self.cmd = ['', '']
for i in range(num_probes):
d = {'id': 'd%d' % i, 'name': 'D%d' % i, 'desc': 'Data line %d' % i}
l.append(d)
- return l
+ return tuple(l)
class Decoder(srd.Decoder):
api_version = 1
{'id': 'endianness', 'desc': 'Endianness of the data',
'default': 'little', 'values': ('little', 'big')},
)
- annotations = [
- ['items', 'Items'],
- ['words', 'Words'],
- ]
+ annotations = (
+ ('items', 'Items'),
+ ('words', 'Words'),
+ )
def __init__(self):
self.oldclk = None
license = 'gplv2'
inputs = ['spi']
outputs = ['rgb_led_spi']
- annotations = [
- ['rgb', 'RGB values'],
- ]
+ annotations = (
+ ('rgb', 'RGB values'),
+ )
def __init__(self, **kwargs):
self.cmd_ss, self.cmd_es = 0, 0
def bcd2int(b):
return (b & 0x0f) + ((b >> 4) * 10)
+def reg_list():
+ l = []
+ for i in range(8 + 1):
+ l.append(('reg-0x%02x' % i, 'Register 0x%02x' % i))
+
+ return tuple(l)
+
class Decoder(srd.Decoder):
api_version = 1
id = 'rtc8564'
license = 'gplv2+'
inputs = ['i2c']
outputs = ['rtc8564']
- optional_probes = [
+ optional_probes = (
{'id': 'clkout', 'name': 'CLKOUT', 'desc': 'Clock output'},
{'id': 'clkoe', 'name': 'CLKOE', 'desc': 'Clock output enable'},
{'id': 'int', 'name': 'INT#', 'desc': 'Interrupt'},
- ]
- annotations = \
- [['reg-0x%02x' % i, 'Register 0x%02x' % i] for i in range(8 + 1)] + [
- ['read', 'Read date/time'],
- ['write', 'Write date/time'],
- ['bit-reserved', 'Reserved bit'],
- ['bit-vl', 'VL bit'],
- ['bit-century', 'Century bit'],
- ['reg-read', 'Register read'],
- ['reg-write', 'Register write'],
- ]
+ )
+ annotations = reg_list() + (
+ ('read', 'Read date/time'),
+ ('write', 'Write date/time'),
+ ('bit-reserved', 'Reserved bit'),
+ ('bit-vl', 'VL bit'),
+ ('bit-century', 'Century bit'),
+ ('reg-read', 'Register read'),
+ ('reg-write', 'Register write'),
+ )
annotation_rows = (
('bits', 'Bits', tuple(range(0, 8 + 1)) + (11, 12, 13)),
('regs', 'Register access', (14, 15)),
51: 'SEND_SCR',
}
+def cmd_list():
+ l = []
+ for i in range(63 + 1):
+ l.append(('cmd%d' % i, 'CMD%d' % i))
+
+ return tuple(l)
+
class Decoder(srd.Decoder):
api_version = 1
id = 'sdcard_spi'
license = 'gplv2+'
inputs = ['spi']
outputs = ['sdcard_spi']
- annotations = \
- [['cmd%d' % i, 'CMD%d' % i] for i in range(63 + 1)] + [
- ['cmd-desc', 'Command description'],
- ['r1', 'R1 reply'],
- ['r1b', 'R1B reply'],
- ['r2', 'R2 reply'],
- ['r3', 'R3 reply'],
- ['r7', 'R7 reply'],
- ['bits', 'Bits'],
- ['bit-warnings', 'Bit warnings'],
- ]
+ annotations = cmd_list() + (
+ ('cmd-desc', 'Command description'),
+ ('r1', 'R1 reply'),
+ ('r1b', 'R1B reply'),
+ ('r2', 'R2 reply'),
+ ('r3', 'R3 reply'),
+ ('r7', 'R7 reply'),
+ ('bits', 'Bits'),
+ ('bit-warnings', 'Bit warnings'),
+ )
annotation_rows = (
('bits', 'Bits', (70, 71)),
('cmd-reply', 'Commands/replies',
license = 'gplv2+'
inputs = ['logic']
outputs = ['spi']
- probes = [
+ probes = (
{'id': 'clk', 'name': 'CLK', 'desc': 'Clock'},
- ]
- optional_probes = [
+ )
+ optional_probes = (
{'id': 'miso', 'name': 'MISO', 'desc': 'Master in, slave out'},
{'id': 'mosi', 'name': 'MOSI', 'desc': 'Master out, slave in'},
{'id': 'cs', 'name': 'CS#', 'desc': 'Chip-select'},
- ]
+ )
options = (
{'id': 'cs_polarity', 'desc': 'CS# polarity', 'default': 'active-low',
'values': ('active-low', 'active-high')},
'default': 'msb-first', 'values': ('msb-first', 'lsb-first')},
{'id': 'wordsize', 'desc': 'Word size of SPI data', 'default': 8},
)
- annotations = [
- ['miso-data', 'MISO data'],
- ['mosi-data', 'MOSI data'],
- ['miso-bits', 'MISO bits'],
- ['mosi-bits', 'MOSI bits'],
- ['warnings', 'Human-readable warnings'],
- ]
+ annotations = (
+ ('miso-data', 'MISO data'),
+ ('mosi-data', 'MOSI data'),
+ ('miso-bits', 'MISO bits'),
+ ('mosi-bits', 'MOSI bits'),
+ ('warnings', 'Human-readable warnings'),
+ )
annotation_rows = (
('miso-data', 'MISO data', (0,)),
('miso-bits', 'MISO bits', (2,)),
license = 'gplv2+'
inputs = ['logic']
outputs = ['tlc5620']
- probes = [
+ probes = (
{'id': 'clk', 'name': 'CLK', 'desc': 'Serial interface clock'},
{'id': 'data', 'name': 'DATA', 'desc': 'Serial interface data'},
- ]
- optional_probes = [
+ )
+ optional_probes = (
{'id': 'load', 'name': 'LOAD', 'desc': 'Serial interface load control'},
{'id': 'ldac', 'name': 'LDAC', 'desc': 'Load DAC'},
- ]
- annotations = [
- ['dac-select', 'DAC select'],
- ['gain', 'Gain'],
- ['value', 'DAC value'],
- ['data-latch', 'Data latch point'],
- ['ldac-fall', 'LDAC falling edge'],
- ]
+ )
+ annotations = (
+ ('dac-select', 'DAC select'),
+ ('gain', 'Gain'),
+ ('value', 'DAC value'),
+ ('data-latch', 'Data latch point'),
+ ('ldac-fall', 'LDAC falling edge'),
+ )
def __init__(self, **kwargs):
self.oldpins = self.oldclk = self.oldload = self.oldldac = None
license = 'gplv2+'
inputs = ['logic']
outputs = ['uart']
- optional_probes = [
+ optional_probes = (
# Allow specifying only one of the signals, e.g. if only one data
# direction exists (or is relevant).
{'id': 'rx', 'name': 'RX', 'desc': 'UART receive line'},
{'id': 'tx', 'name': 'TX', 'desc': 'UART transmit line'},
- ]
+ )
options = (
{'id': 'baudrate', 'desc': 'Baud rate', 'default': 115200},
{'id': 'num_data_bits', 'desc': 'Data bits', 'default': 8,
'values': ('ascii', 'dec', 'hex', 'oct', 'bin')},
# TODO: Options to invert the signal(s).
)
- annotations = [
- ['rx-data', 'RX data'],
- ['tx-data', 'TX data'],
- ['rx-start', 'RX start bits'],
- ['tx-start', 'TX start bits'],
- ['rx-parity-ok', 'RX parity OK bits'],
- ['tx-parity-ok', 'TX parity OK bits'],
- ['rx-parity-err', 'RX parity error bits'],
- ['tx-parity-err', 'TX parity error bits'],
- ['rx-stop', 'RX stop bits'],
- ['tx-stop', 'TX stop bits'],
- ['rx-warnings', 'RX warnings'],
- ['tx-warnings', 'TX warnings'],
- ['rx-data-bits', 'RX data bits'],
- ['tx-data-bits', 'TX data bits'],
- ]
+ annotations = (
+ ('rx-data', 'RX data'),
+ ('tx-data', 'TX data'),
+ ('rx-start', 'RX start bits'),
+ ('tx-start', 'TX start bits'),
+ ('rx-parity-ok', 'RX parity OK bits'),
+ ('tx-parity-ok', 'TX parity OK bits'),
+ ('rx-parity-err', 'RX parity error bits'),
+ ('tx-parity-err', 'TX parity error bits'),
+ ('rx-stop', 'RX stop bits'),
+ ('tx-stop', 'TX stop bits'),
+ ('rx-warnings', 'RX warnings'),
+ ('tx-warnings', 'TX warnings'),
+ ('rx-data-bits', 'RX data bits'),
+ ('tx-data-bits', 'TX data bits'),
+ )
annotation_rows = (
('rx-data', 'RX', (0, 2, 4, 6, 8)),
('rx-data-bits', 'RX bits', (12,)),
options = (
{'id': 'signalling', 'desc': 'Signalling', 'default': 'full-speed'},
)
- annotations = [
- ['sync-ok', 'SYNC'],
- ['sync-err', 'SYNC (error)'],
- ['pid', 'PID'],
- ['framenum', 'FRAMENUM'],
- ['addr', 'ADDR'],
- ['ep', 'EP'],
- ['crc5-ok', 'CRC5'],
- ['crc5-err', 'CRC5 (error)'],
- ['data', 'DATA'],
- ['crc16-ok', 'CRC16'],
- ['crc16-err', 'CRC16 (error)'],
- ['packet-out', 'Packet: OUT'],
- ['packet-in', 'Packet: IN'],
- ['packet-sof', 'Packet: SOF'],
- ['packet-setup', 'Packet: SETUP'],
- ['packet-data0', 'Packet: DATA0'],
- ['packet-data1', 'Packet: DATA1'],
- ['packet-data2', 'Packet: DATA2'],
- ['packet-mdata', 'Packet: MDATA'],
- ['packet-ack', 'Packet: ACK'],
- ['packet-nak', 'Packet: NAK'],
- ['packet-stall', 'Packet: STALL'],
- ['packet-nyet', 'Packet: NYET'],
- ['packet-pre', 'Packet: PRE'],
- ['packet-err', 'Packet: ERR'],
- ['packet-split', 'Packet: SPLIT'],
- ['packet-ping', 'Packet: PING'],
- ['packet-reserved', 'Packet: Reserved'],
- ['packet-invalid', 'Packet: Invalid'],
- ]
+ annotations = (
+ ('sync-ok', 'SYNC'),
+ ('sync-err', 'SYNC (error)'),
+ ('pid', 'PID'),
+ ('framenum', 'FRAMENUM'),
+ ('addr', 'ADDR'),
+ ('ep', 'EP'),
+ ('crc5-ok', 'CRC5'),
+ ('crc5-err', 'CRC5 (error)'),
+ ('data', 'DATA'),
+ ('crc16-ok', 'CRC16'),
+ ('crc16-err', 'CRC16 (error)'),
+ ('packet-out', 'Packet: OUT'),
+ ('packet-in', 'Packet: IN'),
+ ('packet-sof', 'Packet: SOF'),
+ ('packet-setup', 'Packet: SETUP'),
+ ('packet-data0', 'Packet: DATA0'),
+ ('packet-data1', 'Packet: DATA1'),
+ ('packet-data2', 'Packet: DATA2'),
+ ('packet-mdata', 'Packet: MDATA'),
+ ('packet-ack', 'Packet: ACK'),
+ ('packet-nak', 'Packet: NAK'),
+ ('packet-stall', 'Packet: STALL'),
+ ('packet-nyet', 'Packet: NYET'),
+ ('packet-pre', 'Packet: PRE'),
+ ('packet-err', 'Packet: ERR'),
+ ('packet-split', 'Packet: SPLIT'),
+ ('packet-ping', 'Packet: PING'),
+ ('packet-reserved', 'Packet: Reserved'),
+ ('packet-invalid', 'Packet: Invalid'),
+ )
annotation_rows = (
('fields', 'Packet fields', tuple(range(11 + 1))),
('packet', 'Packets', tuple(range(12, 28 + 1))),
license = 'gplv2+'
inputs = ['logic']
outputs = ['usb_signalling']
- probes = [
+ probes = (
{'id': 'dp', 'name': 'D+', 'desc': 'USB D+ signal'},
{'id': 'dm', 'name': 'D-', 'desc': 'USB D- signal'},
- ]
+ )
options = (
{'id': 'signalling', 'desc': 'Signalling',
'default': 'full-speed', 'values': ('full-speed', 'low-speed')},
)
- annotations = [
- ['sym', 'Symbol'],
- ['sop', 'Start of packet (SOP)'],
- ['eop', 'End of packet (EOP)'],
- ['bit', 'Bit'],
- ['stuffbit', 'Stuff bit'],
- ]
+ annotations = (
+ ('sym', 'Symbol'),
+ ('sop', 'Start of packet (SOP)'),
+ ('eop', 'End of packet (EOP)'),
+ ('bit', 'Bit'),
+ ('stuffbit', 'Stuff bit'),
+ )
annotation_rows = (
('bits', 'Bits', (1, 2, 3, 4)),
('symbols', 'Symbols', (0,)),
license = 'gplv3+'
inputs = ['i2c']
outputs = ['xfp']
- annotations = [
- ['fieldnames-and-values', 'XFP structure field names and values'],
- ['fields', 'XFP structure fields'],
- ]
+ annotations = (
+ ('fieldnames-and-values', 'XFP structure field names and values'),
+ ('fields', 'XFP structure fields'),
+ )
def __init__(self, **kwargs):
# Received data items, used as an index into samplenum/data
license = 'gplv2+'
inputs = ['logic']
outputs = ['z80']
- probes = [
- {'id': 'd%d' % i, 'name': 'D%d' % i, 'desc': 'Data bus line %d' % i}
- for i in range(8)
- ] + [
+ probes = tuple({
+ 'id': 'd%d' % i,
+ 'name': 'D%d' % i,
+ 'desc': 'Data bus line %d' % i
+ } for i in range(8)
+ ) + (
{'id': 'm1', 'name': '/M1', 'desc': 'Machine cycle 1'},
{'id': 'rd', 'name': '/RD', 'desc': 'Memory or I/O read'},
{'id': 'wr', 'name': '/WR', 'desc': 'Memory or I/O write'},
- ]
- optional_probes = [
+ )
+ optional_probes = (
{'id': 'mreq', 'name': '/MREQ', 'desc': 'Memory request'},
{'id': 'iorq', 'name': '/IORQ', 'desc': 'I/O request'},
- ] + [
- {'id': 'a%d' % i, 'name': 'A%d' % i, 'desc': 'Address bus line %d' % i}
- for i in range(16)
- ]
- annotations = [
- ['addr', 'Memory or I/O address'],
- ['memrd', 'Byte read from memory'],
- ['memwr', 'Byte written to memory'],
- ['iord', 'Byte read from I/O port'],
- ['iowr', 'Byte written to I/O port'],
- ['instr', 'Z80 CPU instruction'],
- ['rop', 'Value of input operand'],
- ['wop', 'Value of output operand'],
- ['warn', 'Warning message'],
- ]
+ ) + tuple({
+ 'id': 'a%d' % i,
+ 'name': 'A%d' % i,
+ 'desc': 'Address bus line %d' % i
+ } for i in range(16)
+ )
+ annotations = (
+ ('addr', 'Memory or I/O address'),
+ ('memrd', 'Byte read from memory'),
+ ('memwr', 'Byte written to memory'),
+ ('iord', 'Byte read from I/O port'),
+ ('iowr', 'Byte written to I/O port'),
+ ('instr', 'Z80 CPU instruction'),
+ ('rop', 'Value of input operand'),
+ ('wop', 'Value of output operand'),
+ ('warn', 'Warning message'),
+ )
annotation_rows = (
('addrbus', 'Address bus', (Ann.ADDR,)),
('databus', 'Data bus', (Ann.MEMRD, Ann.MEMWR, Ann.IORD, Ann.IOWR)),