return file_contents.split('\n')[0:-1] def disable_controller(): onoff = nova.Enable(dev_addr=SMB_Add) onoff.off() #main program print(f"silicon fw rev = {nova.Command('fw_revision',SMB_Add).formatted()}") proceed = input("Enter 'y' to proceed ") if proceed == "y" or proceed == "yes": disable_controller() print("halting fw") nova.Command('halt_FW', SMB_Add).write_reg() print("loading fw patch") nova.load_fw_commands(commands(patchfilename), SMB_Add) #nova.Command('commit_patch_data',SMB_Add).write_reg() if (int(nova.Command('patch_status', SMB_Add).formatted()[0], 16) >> 4 & 1): input( 'fw patch successful! Cycle Vcc then press enter to display fw revision' ) print( f"fw revision = {nova.Command('fw_revision',SMB_Add).formatted()}") else: print( f"fw patch failed! fw revision = {nova.Command('fw_revision',SMB_Add).formatted()}" ) print('exiting program. end of line')
def print_new_nvm_and_crc_info(): slots = nova.Command('avail_NVM_slots', SMB_Add).formatted() print(f"Available NVM slots: {slots}") crc = nova.Command('crc', SMB_Add).formatted() print(f"new CRC: {crc}")
def verify_device_and_file_versions(): allgood = (nova.check_REV(header=header, dev_addr=SMB_Add) and nova.Command('avail_NVM_slots', SMB_Add).formatted() and nova.check_ID(header=header, dev_addr=SMB_Add)) return allgood
def reload_and_restart_fw(): nova.Command('load_FW', SMB_Add).write_reg() nova.Command('recomp_OTP_bounds', SMB_Add).write_reg() nova.Command('wake_FW', SMB_Add).write_reg() nova.Command('restcfg', SMB_Add).write_reg()
def reload_and_restart_fw(): nova.Command('load_FW', SMB_Add).write_reg() nova.Command('recomp_OTP_bounds', SMB_Add).write_reg() nova.Command('wake_FW', SMB_Add).write_reg() nova.Command('restcfg', SMB_Add).write_reg() def print_new_nvm_and_crc_info(): slots = nova.Command('avail_NVM_slots', SMB_Add).formatted() print(f"Available NVM slots: {slots}") crc = nova.Command('crc', SMB_Add).formatted() print(f"new CRC: {crc}") #main program disable_controller() if verify_device_and_file_versions(): write_hexfile_to_device() if nova.Command('prog_status', SMB_Add).formatted() & 1: print("OTP programming successful! Restarting FW") reload_and - restart_fw() print_new_nvm_and_crc_info() print("End of Line") else: errorcode = bin( int(nova.Command('bank_status', SMB_Add).formatted()[0], 16)) print(f"OTP programming failed. Bank Status: {errorcode}") else: print("Check REV, available NVM slots, and ID")