probes = [
{'id': 'data', 'name': 'DATA', 'desc': 'DATA line'},
]
+ extra_probes = [
+ {'id': 'pon', 'name': 'PON', 'desc': 'TODO'},
+ ]
options = {}
annotations = [
# ANN_ASCII
raise Exception('Invalid DCF77 bit: %d' % c)
def decode(self, ss, es, data):
- for samplenum, (pon, val) in data: # FIXME
+ for samplenum, (val) in data: # TODO: Handle optional PON.
self.samplenum += 1 # FIXME. Use samplenum. Off-by-one?
self.state = WAIT_FOR_RISING_EDGE
else:
- raise Exception('Invalid state: %s' % self.state)
+ raise Exception('Invalid state: %d' % self.state)
self.oldval = val
inputs = ['i2c']
outputs = ['ddc']
probes = []
+ extra_probes = []
options = {}
annotations = [
['Byte stream', 'DDC byte stream as read from display.'],
def start(self, metadata):
self.out_ann = self.add(srd.OUTPUT_ANN, 'ddc')
+ def report(self):
+ pass
+
def decode(self, ss, es, data):
try:
cmd, data, ack_bit = data
except Exception as e:
- raise Exception('malformed I2C input: %s' % str(e)) from e
+ raise Exception('Malformed I2C input: %s' % str(e)) from e
if self.state is None:
# Wait for the DDC session to start.
# There shouldn't be anything but data reads on this
# address, so ignore everything else.
self.put(ss, es, self.out_ann, [0, ['0x%.2x' % data]])
+ else:
+ raise Exception('Invalid state: %s' % self.state)
longdesc = 'TODO.'
license = 'gplv2+'
inputs = ['i2c']
- outputs = ['i2c-axp199', 'i2c-h8563s', 'i2c-accel']
+ outputs = ['i2c-axp199', 'i2c-h8563s', 'i2c-accel'] # TODO: type vs. inst.
probes = []
+ extra_probes = []
options = {}
annotations = []
print('Error: Could not determine correct stream!') # FIXME
self.packets = []
self.stream = -1
+ else:
+ pass # Do nothing, only add the I2C packet to our cache.
{'id': 'scl', 'name': 'SCL', 'desc': 'Serial clock line'},
{'id': 'sda', 'name': 'SDA', 'desc': 'Serial data line'},
]
+ extra_probes = []
options = {
'addressing': ['Slave addressing (in bits)', 7], # 7 or 10
}
self.out_proto = self.add(srd.OUTPUT_PROTO, 'i2c')
self.out_ann = self.add(srd.OUTPUT_ANN, 'i2c')
+ def report(self):
+ pass
+
def is_start_condition(self, scl, sda):
# START condition (S): SDA = falling, SCL = high
if (self.oldsda == 1 and sda == 0) and scl == 1:
elif self.is_stop_condition(scl, sda):
self.found_stop(scl, sda)
else:
- # Shouldn't happen.
- raise Exception("unknown state %d" % self.STATE)
+ raise Exception('Invalid state %d' % self.STATE)
# Save current SDA/SCL values for the next round.
self.oldscl = scl
inputs = ['i2c']
outputs = [] # TODO: Only known at run-time.
probes = []
+ extra_probes = []
options = {}
annotations = []
self.packets = []
self.stream = -1
+ else:
+ pass # Do nothing, only add the I2C packet to our cache.
self.cmdstate = 1
else:
pass # TODO
- else:
- pass
# Handle commands.
# TODO: Use some generic way to invoke the resp. method.
license = 'gplv2+'
inputs = ['i2c']
outputs = ['nunchuck']
- probes = [] # TODO
+ probes = []
+ extra_probes = [] # TODO
options = {}
annotations = [
['TODO', 'TODO'],
inputs = ['uart']
outputs = ['pan1321']
probes = []
+ extra_probes = []
options = {}
annotations = [
['ASCII', 'TODO: description'],
[ANN_ASCII, ['Host set the Bluetooth name to ' + name]])
else:
self.put(ss, es, self.out_ann,
- [ANN_ASCII, ['Host sent unsupported command']])
+ [ANN_ASCII, ['Host sent unsupported command: %s' % s]])
self.cmd[rxtx] = ''
def handle_device_reply(self, ss, es, rxtx, s):
[ANN_ASCII, ['Device sent error code ' + error]])
else:
self.put(ss, es, self.out_ann,
- [ANN_ASCII, ['Device sent an unknown reply']])
+ [ANN_ASCII, ['Device sent an unknown reply: %s' % s]])
self.cmd[rxtx] = ''
def decode(self, ss, es, data):
elif rxtx == TX:
self.handle_host_command(ss, es, rxtx, self.cmd[rxtx])
else:
- pass # TODO: Error.
+ raise Exception('Invalid rxtx value: %d' % rxtx)
else:
pass # TODO?
else:
- # Shouldn't happen.
- raise Exception('Unknown state: %d', self.state)
+ raise Exception('Invalid state: %d' % self.state)
inputs = ['logic']
outputs = ['spi']
probes = [
- {'id': 'mosi', 'name': 'MOSI',
- 'desc': 'SPI MOSI line (Master out, slave in)'},
{'id': 'miso', 'name': 'MISO',
'desc': 'SPI MISO line (Master in, slave out)'},
+ {'id': 'mosi', 'name': 'MOSI',
+ 'desc': 'SPI MOSI line (Master out, slave in)'},
{'id': 'sck', 'name': 'CLK', 'desc': 'SPI clock line'},
{'id': 'cs', 'name': 'CS#', 'desc': 'SPI CS (chip select) line'},
]
+ extra_probes = [] # TODO
options = {
'cs_polarity': ['CS# polarity', ACTIVE_LOW],
'cpol': ['Clock polarity', CPOL_0],
return 'SPI: %d bytes received' % self.bytesreceived
def decode(self, ss, es, data):
- # HACK! At the moment the number of probes is not handled correctly.
- # E.g. if an input file (-i foo.sr) has more than two probes enabled.
- # for (samplenum, (mosi, sck, x, y, z, a)) in data:
- # for (samplenum, (cs, miso, sck, mosi, wp, hold)) in data:
- for (samplenum, (cs, miso, sck, mosi, wp, hold)) in data:
+ # TODO: Either MISO or MOSI could be optional. CS# is optional.
+ for (samplenum, (miso, mosi, sck, cs)) in data:
self.samplenum += 1 # FIXME
inputs = ['logic']
outputs = ['transitioncounts']
probes = []
+ extra_probes = []
options = {}
annotations = [
['TODO', 'TODO'],
{'id': 'rx', 'name': 'RX', 'desc': 'UART receive line'},
{'id': 'tx', 'name': 'TX', 'desc': 'UART transmit line'},
]
+ extra_probes = []
options = {
'baudrate': ['Baud rate', 115200],
'num_data_bits': ['Data bits', 8], # Valid: 5-9.
self.put(self.samplenum, self.samplenum, self.out_ann,
[ANN_ASCII, ['Stop bit', 'Stop', 'P']])
- def decode(self, ss, es, data): # TODO
+ def decode(self, ss, es, data):
+ # TODO: Either RX or TX could be omitted (optional probe).
for (samplenum, (rx, tx)) in data:
# TODO: Start counting at 0 or 1? Increase before or after?
elif self.state[rxtx] == GET_STOP_BITS:
self.get_stop_bits(rxtx, signal)
else:
- raise Exception('Invalid state: %s' % self.state[rxtx])
+ raise Exception('Invalid state: %d' % self.state[rxtx])
# Save current RX/TX values for the next round.
self.oldbit[rxtx] = signal
{'id': 'dp', 'name': 'D+', 'desc': 'USB D+ signal'},
{'id': 'dm', 'name': 'D-', 'desc': 'USB D- signal'},
]
+ extra_probes = []
options = {}
annotations = [
['TODO', 'TODO']
self.out_ann = self.add(srd.OUTPUT_ANN, 'usb')
if self.rate < 48000000:
- raise Exception('Sample rate not sufficient for USB decoding')
+ raise Exception('Sample rate (%d) not sufficient for USB '
+ 'decoding, need at least 48MHz' % self.rate)
# Initialise decoder state.
self.sym = J
self.scount = 0
self.packet = ''
- def decode(self, ss, es, data):
+ def report(self):
+ pass
- # FIXME
- # for (samplenum, (dp, dm, x, y, z, a)) in data:
+ def decode(self, ss, es, data):
for (samplenum, (dm, dp)) in data:
self.scount += 1