def open97(): usb.open() usb.send_init() # try to init TLS session from the flash tls.parseTlsFlash(read_flash(1, 0, 0x1000)) tls.open() tls.save()
from os.path import isfile from threading import Thread from struct import unpack, pack from tls97 import tls from usb97 import usb from time import ctime from sensor import write_hw_reg32, read_hw_reg32, identify_sensor from flash import erase_flash, read_flash, get_fw_info, write_flash_all from util import assert_status from blobs import calibrate_prg #usb.trace_enabled=True #tls.trace_enabled=True usb.open() tls.parseTlsFlash(read_flash(1, 0, 0x1000)) tls.open() # no idea what this is: write_hw_reg32(0x8000205c, 7) if read_hw_reg32(0x80002080) != 2: raise Exception('Unexpected register value') dev = identify_sensor() print('Sensor: %s' % dev.name) # ^ TODO -- what is the real reason to detect HW at this stage? -- likely it is required to construct calibrate_prg fwi = get_fw_info(2) if fwi == None: raise Exception('No firmware detected')
def load97(): #usb.trace_enabled = True #tls.trace_enabled = True usb.open() tls.load()