Interpret CTRL/ADDR/DATA command entry.
(self, ctrl, addr, data)
| 242 | self.state = 'CMD' if is_start else 'DATA' |
| 243 | |
| 244 | def command_check(self, ctrl, addr, data): |
| 245 | '''Interpret CTRL/ADDR/DATA command entry.''' |
| 246 | |
| 247 | # See the Siemens Datasheet section 2.3 Commands. The abbreviated |
| 248 | # text variants are my guesses, terse for readability at coarser |
| 249 | # zoom levels. |
| 250 | codes_table = { |
| 251 | 0x30: { |
| 252 | 'fmt': [ |
| 253 | 'read main memory, addr {addr:02x}', |
| 254 | 'RD-M @{addr:02x}', |
| 255 | ], |
| 256 | 'len': lambda ctrl, addr, data: self.max_addr - addr, |
| 257 | }, |
| 258 | 0x31: { |
| 259 | 'fmt': [ |
| 260 | 'read security memory', |
| 261 | 'RD-S', |
| 262 | ], |
| 263 | 'len': 4, |
| 264 | }, |
| 265 | 0x33: { |
| 266 | 'fmt': [ |
| 267 | 'compare verification data, addr {addr:02x}, data {data:02x}', |
| 268 | 'CMP-V @{addr:02x} ={data:02x}', |
| 269 | ], |
| 270 | 'proc': True, |
| 271 | }, |
| 272 | 0x34: { |
| 273 | 'fmt': [ |
| 274 | 'read protection memory, addr {addr:02x}', |
| 275 | 'RD-P @{addr:02x}', |
| 276 | ], |
| 277 | 'len': 4, |
| 278 | }, |
| 279 | 0x38: { |
| 280 | 'fmt': [ |
| 281 | 'update main memory, addr {addr:02x}, data {data:02x}', |
| 282 | 'WR-M @{addr:02x} ={data:02x}', |
| 283 | ], |
| 284 | 'proc': True, |
| 285 | }, |
| 286 | 0x39: { |
| 287 | 'fmt': [ |
| 288 | 'update security memory, addr {addr:02x}, data {data:02x}', |
| 289 | 'WR-S @{addr:02x} ={data:02x}', |
| 290 | ], |
| 291 | 'proc': True, |
| 292 | }, |
| 293 | 0x3c: { |
| 294 | 'fmt': [ |
| 295 | 'write protection memory, addr {addr:02x}, data {data:02x}', |
| 296 | 'WR-P @{addr:02x} ={data:02x}', |
| 297 | ], |
| 298 | 'proc': True, |
| 299 | }, |
| 300 | } |
| 301 | code = codes_table.get(ctrl, {}) |
no test coverage detected