Flush previously accumulated operations details.
(self)
| 173 | return ss, es, data, text |
| 174 | |
| 175 | def flush_queued(self): |
| 176 | '''Flush previously accumulated operations details.''' |
| 177 | |
| 178 | # Can be called when either the completion of an operation got |
| 179 | # detected (reliably), or when some kind of reset condition was |
| 180 | # met while a potential previously observed operation has not |
| 181 | # been postprocessed yet (best effort). Should not harm when the |
| 182 | # routine gets invoked while no data was collected yet, or was |
| 183 | # flushed already. |
| 184 | # BEWARE! Will void internal state. Should really only get called |
| 185 | # "between operations", NOT between fields of an operation. |
| 186 | |
| 187 | if self.atr_bytes: |
| 188 | key = 'ATR_DATA' |
| 189 | ss, es, _, text = self.text_for_accu_bytes(self.atr_bytes) |
| 190 | cls, texts = self.lookup_proto_ann_txt(key, {'data': text}) |
| 191 | self.putx(ss, es, cls, texts) |
| 192 | |
| 193 | if self.cmd_bytes: |
| 194 | key = 'CMD_DATA' |
| 195 | ss, es, _, text = self.text_for_accu_bytes(self.cmd_bytes) |
| 196 | cls, texts = self.lookup_proto_ann_txt(key, {'data': text}) |
| 197 | self.putx(ss, es, cls, texts) |
| 198 | |
| 199 | if self.out_bytes: |
| 200 | key = 'OUT_DATA' |
| 201 | ss, es, _, text = self.text_for_accu_bytes(self.out_bytes) |
| 202 | cls, texts = self.lookup_proto_ann_txt(key, {'data': text}) |
| 203 | self.putx(ss, es, cls, texts) |
| 204 | |
| 205 | if self.proc_state: |
| 206 | key = 'PROC_DATA' |
| 207 | ss = self.proc_state['ss'] |
| 208 | es = self.proc_state['es'] |
| 209 | clk = self.proc_state['clk'] |
| 210 | high = self.proc_state['io1'] |
| 211 | text = '{clk} clocks, I/O {high}'.format(clk = clk, high = int(high)) |
| 212 | usecs = self.snums_to_usecs(es - ss) |
| 213 | if usecs: |
| 214 | msecs = usecs / 1000 |
| 215 | text = '{msecs:.2f} ms, {text}'.format(msecs = msecs, text = text) |
| 216 | cls, texts = self.lookup_proto_ann_txt(key, {'data': text}) |
| 217 | self.putx(ss, es, cls, texts) |
| 218 | |
| 219 | self.atr_bytes = None |
| 220 | self.cmd_bytes = None |
| 221 | self.cmd_proc = None |
| 222 | self.out_len = None |
| 223 | self.out_bytes = None |
| 224 | self.proc_state = None |
| 225 | self.state = None |
| 226 | |
| 227 | def handle_reset(self, ss, es, has_clk): |
| 228 | self.flush_queued() |
no test coverage detected