def reset(self):
self.state = LinFsm.State.WaitForBreak
+ self.uart_idle_count = 0
def __init__(self):
a = dict()
self.allowed_state = a
self.state = None
+ self.uart_idle_count = 0
self.reset()
class Decoder(srd.Decoder):
annotations = (
('data', 'LIN data'),
('control', 'Protocol info'),
- ('error', 'Error descriptions'),
- ('inline_error', 'Protocol violations and errors'),
+ ('error', 'Error description'),
+ ('inline_error', 'Protocol violation or error'),
)
annotation_rows = (
- ('data', 'Data', (0, 1, 3)),
- ('error', 'Error', (2,)),
+ ('data_vals', 'Data', (0, 1, 3)),
+ ('errors', 'Errors', (2,)),
)
def __init__(self):
self.lin_header = []
self.lin_rsp = []
self.lin_version = None
- self.out_ann = None
self.ss_block = None
self.es_block = None
return True
+ def handle_uart_idle(self):
+ if self.fsm.state not in (LinFsm.State.WaitForBreak, LinFsm.State.Error):
+ self.fsm.uart_idle_count += 1
+
+ if self.fsm.uart_idle_count == 2:
+ self.fsm.transit(LinFsm.State.Checksum)
+ self.handle_checksum()
+ self.fsm.reset()
+
def handle_wait_for_break(self, value):
self.wipe_break_null_byte(value)
self.ss_block, self.es_block = ss, es
# Ignore all UART packets except the actual data packets or BREAK.
+ if ptype == 'IDLE':
+ self.handle_uart_idle()
if ptype == 'BREAK':
self.handle_break(pdata)
if ptype != 'DATA':