7 def reset_device(reset
):
8 print reset
and "Put device in reset" or "Set device to run"
9 write_ram (0xe600,reset
and '\x01' or '\x00', 1)
11 def write_ram(addr
,data
,length
):
13 while(transferred
<length
):
14 this_transfer_size
=length
-transferred
>1024 and 1024 or length
-transferred
15 buf
=data
[transferred
:]
16 ret
=f
.do_usb_command( buf
,
22 print "wrote %d bytes" % ret
25 print "Error: %d" % ret
28 def reset_bix(filename
):
30 Use this function to reset your firmware. You'll need to reopen the device afterward.
33 bix
=open(filename
).read()
34 print "loading bix file of length: %d" % len(bix
)
35 write_ram( 0, bix
,len(bix
) );
37 print "Closing device after reset"