MCPcopy Create free account
hub / github.com/DreamSourceLab/DSView / handle_data_bit

Method handle_data_bit

libsigrokdecode4DSL/decoders/sle44xx/pd.py:369–444  ·  view source on GitHub ↗

Gather 8 bits of data (or track processing progress).

(self, ss, es, bit)

Source from the content-addressed store, hash-verified

367 return
368
369 def handle_data_bit(self, ss, es, bit):
370 '''Gather 8 bits of data (or track processing progress).'''
371
372 # Switch late from DATA to either OUT or PROC. We can tell the
373 # type and potentially fixed length at the end of CMD already,
374 # but a START/STOP condition may void this information. So we
375 # do the switch at the first data bit after CMD.
376 # In the OUT case data bytes get accumulated, until either the
377 # expected byte count is reached, or another CMD starts. In the
378 # PROC case a high I/O level terminates execution.
379 if self.state == 'DATA':
380 if self.out_len:
381 self.state = 'OUT'
382 elif self.cmd_proc:
383 self.state = 'PROC'
384 self.processing_start(ss or es, es or ss, bit == 1)
385 else:
386 # Implementor's note: Handle unknown situations like
387 # outgoing data bytes, for the user's convenience. This
388 # will show OUT bytes even if it's just processing CLK
389 # cycles with constant or irrelevant I/O bit patterns.
390 self.state = 'OUT'
391 if self.state == 'PROC':
392 high = bit == 1
393 if ss is not None:
394 self.processing_update(ss, 0, high)
395 if es is not None:
396 self.processing_update(es, 1, high)
397 if high:
398 self.flush_queued()
399 return
400
401 # This routine gets called two times per bit value. Track the
402 # bit's value and ss timestamp when the bit period starts. And
403 # update the es timestamp at the end of the bit's validity.
404 if ss is not None:
405 self.bits.append([bit, ss, es or ss])
406 return
407 if es is None:
408 # Unexpected invocation. Could be a glitch or invalid input
409 # data, or an interaction with RESET/START/STOP conditions.
410 self.bits = []
411 return
412 if not self.bits:
413 return
414 if bit is not None:
415 self.bits[-1][0] = bit
416 # TODO Check for consistent bit level at ss and es when
417 # the information was available? Is bit data sampled at
418 # different clock edges depending whether data is sent
419 # or received?
420 self.bits[-1][2] = es
421 # Emit the bit's annotation. See if a byte was received.
422 bit, ss, es = self.bits[-1]
423 cls, texts = self.lookup_proto_ann_txt('BIT_SYM', {'bit': bit})
424 self.putx(ss, es, cls, texts)
425 if len(self.bits) < 8:
426 return

Callers 1

decodeMethod · 0.95

Calls 9

processing_startMethod · 0.95
processing_updateMethod · 0.95
flush_queuedMethod · 0.95
lookup_proto_ann_txtMethod · 0.95
putxMethod · 0.95
putbMethod · 0.95
handle_data_byteMethod · 0.95
bitpack_lsbFunction · 0.90
formatMethod · 0.45

Tested by

no test coverage detected