def main(argv): if len(argv) != 2: print """\ usage: %s <argfoop> where <argfoop> is a valid foop.""" % (prog_name) sys.exit(1) else: print 'argv 1 is ' + argv[1] if probe(dev0): print 'Device not Found'. dev0 sys.exit(1) patWrkNum = 5 # pattern gen smaWrkNum = 6 # SMA gbeWrkNum = 9 # GBE dp0WrkNum = 13 # dgdp dp0 #wreset(dev0, iqWrkNum) #wunreset(dev0, iqWrkNum) #wwctl(dev0, iqWrkNum, 0x8000000F) #wreset(dev0, capWrkNum) #wunreset(dev0, capWrkNum) #wwctl(dev0, capWrkNum, 0x8000000F) for addr in range(0, 0x30, 4): rval = wread(dev0, patWrkNum, addr) print 'pat addr:', hex(addr), ' data:', hex(rval) for addr in range(0, 0x4C, 4): rval = wread(dev0, smaWrkNum, addr) print 'sma addr:', hex(addr), ' data:', hex(rval) for addr in range(0, 0x18, 4): rval = wread(dev0, gbeWrkNum, addr) print 'gbe addr:', hex(addr), ' data:', hex(rval) for addr in range(0, 0xBC, 4): rval = wread(dev0, dp0WrkNum, addr) print 'dp0 addr:', hex(addr), ' data:', hex(rval) sys.exit(0)
def main(argv): if len(argv) != 2: print """\ usage: %s <argfoop> where <argfoop> is a valid foop.""" % (prog_name) sys.exit(1) else: print 'argv 1 is ' + argv[1] if probe(dev0): print 'Device not Found'. dev0 sys.exit(1) pat0WrkNum = 2 # Pattern biasWrkNum = 3 # Bias cap0WrkNum = 4 # Capture workerList = [2,3,4] print 'Reset cycling each worker...' for w in workerList: print 'Worker: ' + str(w) print 'reset' wreset(dev0, w) print 'unreset' wunreset(dev0, w) # Modification for extended timeout... #print 'f-value timeout' #wwctl(dev0, w, 0x8000000F) #print 'Testing admin scratch regsiters...' #testAdminReg(dev0, 0x20) #testAdminReg(dev0, 0x24) wadmin(dev0, 0x20, 0xFEEDC0DE) wadmin(dev0, 0x24, 0xBABECAFE) print 'Probing Worker Control Status ahead of init...' for w in workerList: rwsr(dev0, w) print 'Initializing each worker...' for w in workerList: wop(dev0, w, 'initialize') wwrite(dev0, pat0WrkNum, 0x04, 0x00000001); print 'Reading Config Prop status regs...' wread(dev0, pat0WrkNum, 0x1C); wread(dev0, cap0WrkNum, 0x0C); print 'Starting each worker...' for w in workerList: wop(dev0, w, 'start') print 'Write capture enable bit...' wwrite(dev0, cap0WrkNum, 0x00, 0x00000001); print 'Set Page Register to Metadata on Pattern Generator...' wwpage(dev0, pat0WrkNum, 0x400); print 'Write Metadata...' wwrite(dev0, pat0WrkNum, 0x0000, 0x00000080); # 32*4=128 wwrite(dev0, pat0WrkNum, 0x0004, 0x00000002); # opcode 2 wwrite(dev0, pat0WrkNum, 0x0008, 0x00000042); wwrite(dev0, pat0WrkNum, 0x000C, 0x00000043); print 'Set Page Register to Data Region on Pattern Generator...' wwpage(dev0, pat0WrkNum, 0x800); print 'Write Data Region...' #wwrite(dev0, pat0WrkNum, 0x0000, 0x03020100); #wwrite(dev0, pat0WrkNum, 0x0004, 0x07060504); #wwrite(dev0, pat0WrkNum, 0x0008, 0x0B0A0908); #wwrite(dev0, pat0WrkNum, 0x000C, 0x0F0E0D0C); #wwrite(dev0, pat0WrkNum, 0x0010, 0x13121110); startWord = 0x03020100; for i in range(32): wwrite(dev0, pat0WrkNum, i*4, i); print 'ReturnPage Register to 0 on Pattern Generator...' wwpage(dev0, pat0WrkNum, 0x0); # Page 0 print 'Write Data Region...' wwrite(dev0, pat0WrkNum, 0x0010, 0x00000003); # send 3 messages wwrite(dev0, pat0WrkNum, 0x0000, 0x00000001); # Fire! print 'Command Sequence complete and fired!' #print 'Probing Worker Control Status after init...' #for w in workerList: # rwsr(dev0, w) #print 'Testing scratch registers...' #print 'sma0' #testScratchReg(dev0, pat0WrkNum, 0) #print 'bias' #testScratchReg(dev0, biasWrkNum, 0x4) #print 'sma1' #testScratchReg(dev0, cap0WrkNum, 0) print 'Done.' sys.exit(0)
def main(argv): if len(argv) != 2: print """\ usage: %s <argfoop> where <argfoop> is a valid foop.""" % (prog_name) sys.exit(1) else: print 'argv 1 is ' + argv[1] if probe(dev0): print 'Device not Found'. dev0 sys.exit(1) iqWrkNum = 10 # the IQADCWorker capWrkNum = 11 # the WSI Capture Worker wreset(dev0, iqWrkNum) wunreset(dev0, iqWrkNum) wwctl(dev0, iqWrkNum, 0x8000000F) wreset(dev0, capWrkNum) wunreset(dev0, capWrkNum) wwctl(dev0, capWrkNum, 0x8000000F) for addr in range(0, 0x64, 4): rval = wread(dev0, iqWrkNum, addr) print 'IQADC CFG addr:', hex(addr), ' data:', hex(rval) #wwrite(dev0, iqWrkNum, 0x400, 0x2) # soft reset ADC device #while (wread(dev0, iqWrkNum, 0x400) & 0x2): # test if bit 1 is set - goes to zero when reset finishes # print 'waiting for reset bit to self clear' print 'Enabling ADC Ramp Output...' wwrite(dev0, iqWrkNum, 0x28, 0x00000002) # soft reset ADC (0x00) <= 0x02 wwrite(dev0, iqWrkNum, 0x28, 0x00001480) # (0x14) <= 0x80 override bit d7 wwrite(dev0, iqWrkNum, 0x28, 0x00001604) # ramp pattern (0x16) <= 0x4 #wwrite(dev0, iqWrkNum, 0x28, 0x00001B80) # Offset Correction wwrite(dev0, iqWrkNum, 0x28, 0x000018AA) wwrite(dev0, iqWrkNum, 0x28, 0x000019AA) for addr in range(0, 0x64, 4): rval = wread(dev0, iqWrkNum, addr) print 'IQADC CFG addr:', hex(addr), ' data:', hex(rval) for i in range(0, 10): addr = 0x1C # sample spy rval = wread(dev0, iqWrkNum, addr) print 'CFG addr:', hex(addr), ' data:', hex(rval) for addr in range(0, 0x20, 4): rval = wread(dev0, capWrkNum, addr) print 'WSICAP CFG addr:', hex(addr), ' data:', hex(rval) print 'start capture' wop(dev0, capWrkNum, 'initialize') wop(dev0, capWrkNum, 'start') wwrite(dev0, capWrkNum, 0x00, 0x00000003) # b1=wrapInhibit b0=captureEnabled print 'start iqadc' wop(dev0, iqWrkNum, 'initialize') wop(dev0, iqWrkNum, 'start') wwrite(dev0, capWrkNum, 0x00, 0x00000000) # b1=wrapInhibit b0=captureEnabled for addr in range(0, 0x64, 4): rval = wread(dev0, iqWrkNum, addr) print 'IQADC CFG addr:', hex(addr), ' data:', hex(rval) for addr in range(0, 0x20, 4): rval = wread(dev0, capWrkNum, addr) print 'WSICAP CFG addr:', hex(addr), ' data:', hex(rval) for addr in range(0, 0x1000, 4): rval = wread(dev0, capWrkNum, 0x80000000 + addr) print 'WSICAP DATA_REGION addr:', hex(addr), ' data:', hex(rval) for addr in range(0, 0x32, 4): rval = wread(dev0, capWrkNum, 0x40000000 + addr) print 'WSICAP META_REGION addr:', hex(addr), ' data:', hex(rval) #wwrite(dev0, iqWrkNum, 0x28, 0x00001000) # (0x10) <= 0x00 #wwrite(dev0, iqWrkNum, 0x28, 0x00001100) # (0x11) <= 0x00 ####wwrite(dev0, iqWrkNum, 0x28, 0x00001480) # (0x14) <= 0x80 override bit d7 #wwrite(dev0, iqWrkNum, 0x28, 0x00001600) # (0x16) <= 0x00 #wwrite(dev0, iqWrkNum, 0x28, 0x00001700) # (0x17) <= 0x00 #wwrite(dev0, iqWrkNum, 0x28, 0x00001800) # (0x18) <= 0x00 #wwrite(dev0, iqWrkNum, 0x28, 0x00001900) # (0x19) <= 0x00 #wwrite(dev0, iqWrkNum, 0x28, 0x00001A00) # (0x1A) <= 0x00 #wwrite(dev0, iqWrkNum, 0x28, 0x00001A00) # (0x1B) <= 0x00 #wwrite(dev0, iqWrkNum, 0x28, 0x00001D00) # (0x1D) <= 0x00 #wwrite(dev0, iqWrkNum, 0x28, 0x00000001) # ramp pattern (0x16) <= 0x4 #wwrite(dev0, iqWrkNum, 0x28, 0x80001400) # #for addr in [0x400, 0x458]: # rval = spi_read(dev0, iqWrkNum, addr) # print 'SPI addr:', hex(addr), ' data:', hex(rval) #for addr in range(0x478, 0x4AC, 4): # rval = spi_read(dev0, iqWrkNum, addr) # print 'COEF addr:', hex(addr), ' data:', hex(rval) sys.exit(0)
def spi_read(device, iqWrkNum, addr): wwrite(device, iqWrkNum, 0x400, 0x1) # enable serial readout rval = wread(device, iqWrkNum, addr) wwrite(device, iqWrkNum, 0x400, 0x0) # disable serial readout return(rval)