--t32jtag lib: --example jtag sequence: corresponds to "data.set 0x3000 0xbeef" on TeakLite 3/4 ir = {0,0,0,0x83} dr = {0,0,0,0,0,0,0xef,0xbe} t32jtag.writeIR(ir,32) t32jtag.writeDR(dr,64) ir = {0,0,0,0x82} dr = {0x00,0x0c,0x00,0x80,0x0} t32jtag.writeIR(ir,32) t32jtag.writeDR(dr,33) --example jtag sequence: reads the data at 0x3000 on TeakLite 3/4 ir = {0,0,0,0x82} dr = {0x00,0x0c,0x00,0x00,0x01} t32jtag.writeIR(ir,32) t32jtag.writeDR(dr,33) ir = {0,0,0,0x83} t32jtag.writeIR(ir,32) dr=t32jtag.readDR(64) for key,value in pairs(dr) do print(key,value) end --example for readWrite IR/DR ir = {0,0,0,0x82} dr = {0x00,0x0c,0x00,0x00,0x01} t32jtag.writeIR(ir,32) t32jtag.writeDR(dr,33) ir = {0,0,0,0x83} ir1=t32jtag.readWriteIR(ir,32) dr1=t32jtag.readWriteDR(dr,64) --for key,value in pairs(ir1) do print(key,value) end --for key,value in pairs(dr1) do print(key,value) end --example for raw shift and reset tms = {0x00,0x00,0x00,0x03,0x00} tdi = {0x00,0x30,0x00,0x01,0x00} dr=t32jtag.readWriteRaw(tms,tdi,5*8); --for key,value in pairs(dr) do print(key,value) end t32jtag.resetWithTMS() --example for getting values from the input buffer in lua --in command line mode, the input buffer is set using lua.set --in API mode, the input buffer is specified by the user test=t32io.getInputBuffer(0,1) print("get 1 byte") for k, v in pairs( test ) do print(k, string.format("%x",v)) end test=t32io.getInputBuffer(4,2) print("get 2 byte at position 4") for k, v in pairs( test ) do print(k, string.format("%x",v)) end test=t32io.getInputBuffer(0,5) print("get 5 byte") for k, v in pairs( test ) do print(k, string.format("%x",v)) end --example for setting output buffer --in command line mode, the output buffer is stored in a global buffer, which can be displayed using lua.so --in API mode, the output buffer is copied to the buffer specified by the user t32io.resetOutputBuffer() t32io.setOutputBuffer(test, 0, 1) t32io.setOutputBuffer(test, 10, 2) t32io.setOutputBuffer(test, 20, 4) t32io.setOutputBuffer(test, 1000, 1) -- poll on the BRKOUT pin (or the DBGACK pin) while (t32jtag.getPin("BRKOUT")~=1) do end -- RAW write-out to JTAG pins a= {1,0,0,0,0,1,0,1,0,1,0,1,0} b= {1,0,0,0,0,0,1,0,0,1,0,0,1} i=0 while (i<10 and t32jtag.getPin("TDO")~=1) do t32jtag.setPin("TDI", a[i], "TCK", b[i]); i=i+1; end