Skip to content
Snippets Groups Projects
Commit ade54448 authored by Patrick Robbe's avatar Patrick Robbe
Browse files

Handle 48 links in pll_status

parent d2d1fa1e
No related branches found
No related tags found
1 merge request!56links
......@@ -588,34 +588,47 @@ class Arria10(object):
return ( val & 0x1 ) >> 0
def rxReadyIndividual(self, i):
status, val = mem.read( self.dev , 0x00050160 )
return ( val & ( 0x1 << i ) ) >> i
add = 0x00050160
if ( i > 23 ): add = 0x00050180
status, val = mem.read( self.dev , add )
return ( val & ( 0x1 << (i%24) ) ) >> (i%24)
def validChannel(self,i):
status, val = mem.read( self.dev , 0x00050520 )
return ( val & ( 0x1 << i ) ) >> i
add = 0x00050520
if ( i > 23 ): add = 0x00050540
status, val = mem.read( self.dev , add )
return ( val & ( 0x1 << (i%24) ) ) >> (i%24)
def txReady(self):
status, val = mem.read( self.dev , 0x00050000 )
return ( val & 0x2 ) >> 1
def txReadyIndividual(self, i):
status, val = mem.read( self.dev , 0x000501A0 )
return ( val & ( 0x1 << i ) ) >> ( i )
add = 0x000501a0
if ( i > 23 ) : add = 0x000501C0
status, val = mem.read( self.dev , add )
return ( val & ( 0x1 << (i%24) ) ) >> ( i%24 )
def b2linkReady(self):
status, val = mem.read( self.dev , 0x00050000 )
return ( val & 0x4 ) >> 2
def b2linkReadyIndividual(self, i):
status, val1 = mem.read( self.dev , 0x000500E0 )
status, val2 = mem.read( self.dev , 0x00050120 )
return ( ( ( val1 & ( 0x1 << i ) ) >> i ) & ( ( val2 & ( 0x1 << i ) ) >> i ) )
add1 = 0x000500E0
add2 = 0x00050120
if ( i > 23 ):
add1 = 0x00050100
add2 = 0x00050140
status, val1 = mem.read( self.dev , add1 )
status, val2 = mem.read( self.dev , add2 )
return ( ( ( val1 & ( 0x1 << (i%24) ) ) >> (i%24) ) & ( ( val2 & ( 0x1 << (i%24) ) ) >> (i%24) ) )
def resynchronizeLink(self, i ):
mem.write( self.dev , 0x00050240 , 0x0 )
mem.write( self.dev , 0x00050240 , 0x1 << i )
mem.write( self.dev , 0x00050240 , 0x0 )
add = 0x00050440
if ( i > 23 ) : add = 0x00050460
mem.write( self.dev , add , 0x0 )
mem.write( self.dev , add , 0x1 << (i%24) )
mem.write( self.dev , add , 0x0 )
def resetTriggerCounter(self):
mem.write( self.dev , 0x00050100 , 0x0 )
......
......@@ -127,33 +127,39 @@ def fanout_window(fpga, win):
win.addstr(4,1,'Trigger counter : ' , curses.A_BOLD)
win.addstr(4,19,'{0:5d}'.format(fpga.triggerCounter()),GREEN)
win.addstr(5,1,'RX ready : ' , curses.A_BOLD)
for link in range( 6 ):
win.refresh()
def link_window(fpga, win):
#win.addstr(5,1,'RX ready : ' , curses.A_BOLD)
for link in range( 48 ):
if fpga.validChannel( link ) == 0:
win.addstr(5,12+3*link, 'XX' , CYAN )
win.addstr(5+link%24+int(link%24/6), 6 + 22 * int( link / 24 ) , 'XX' , CYAN )
elif fpga.rxReadyIndividual(link) == 1:
win.addstr(5,12+3*link, 'OK' , GREEN )
win.addstr(5+link%24+int(link%24/6), 6 + 22 * int( link / 24 ) , 'OK' , GREEN )
else:
win.addstr(5,12+3*link,'NO',RED)
win.addstr(5,31,'TX ready : ' , curses.A_BOLD)
for link in range( 6 ):
win.addstr(5+link%24+int(link%24/6), 6 + 22 * int( link / 24 ) , 'NO' , RED)
#win.addstr(5,31,'TX ready : ' , curses.A_BOLD)
for link in range( 48 ):
if fpga.validChannel( link ) == 0:
win.addstr(5,42+3*link, 'XX' , CYAN )
win.addstr(5+link%24+int(link%24/6), 10 + 22 * int( link / 24 ), 'XX' , CYAN )
elif fpga.txReadyIndividual(link) == 1:
win.addstr(5,42+3*link, 'OK' , GREEN )
win.addstr(5+link%24+int(link%24/6), 10 + 22 * int( link / 24 ), 'OK' , GREEN )
else:
win.addstr(5,42+3*link,'NO',RED)
win.addstr(5,62,'b2link ready : ' , curses.A_BOLD)
for link in range( 6 ):
win.addstr(5+link%24+int(link%24/6), 10 + 22 * int( link / 24 ), 'NO' , RED)
#win.addstr(5,62,'b2link ready : ' , curses.A_BOLD)
for link in range( 48 ):
if fpga.validChannel( link ) == 0:
win.addstr(5,77+3*link, 'XX' , CYAN )
win.addstr(5+link%24+int(link%24/6), 14 + 22 * int( link / 24 ), 'XX' , CYAN )
elif fpga.b2linkReadyIndividual( link ) == 1:
win.addstr(5,77+3*link, 'OK' , GREEN )
win.addstr(5+link%24+int(link%24/6), 14 + 22 * int( link / 24 ), 'OK' , GREEN )
else:
win.addstr(5,77+3*link,'NO',RED)
win.addstr(5+link%24+int(link%24/6), 14 + 22 * int( link / 24 ), 'NO' , RED)
win.refresh()
def program_plls(plls, devices, files, win):
#win.move(2,1)
......@@ -297,7 +303,7 @@ def draw_menu(stdscr, dev):
y_max, x_max = stdscr.getmaxyx()
win1 = stdscr.subwin(y_max/6, x_max-2, 0, 0)
win1 = stdscr.subwin(y_max/6, int(0.7*(x_max))-2, 0, 0)
win1.box()
win1.addstr(1, 1, "Command window", CYAN | curses.A_BOLD)
board = EepromAT24C(dev, const.EEPROM_FPGA_BUS, const.EEPROM_U64_ADD)
......@@ -320,7 +326,7 @@ def draw_menu(stdscr, dev):
win1.refresh()
win2 = stdscr.subwin(y_max/6,
x_max - 2,
int(0.7*x_max - 2),
y_max/6,
0)
win2.box()
......@@ -328,36 +334,49 @@ def draw_menu(stdscr, dev):
win2.refresh()
win3 = stdscr.subwin(y_max/6,
x_max - 2,
int(0.7*x_max - 2),
2*y_max/6,
0)
win3.box()
win3.addstr(1, 1, "PLL SI54345_2", CYAN | curses.A_BOLD)
win3.refresh()
win4 = stdscr.subwin( y_max/6 , x_max-2 , 3*y_max/6, 0 )
win4 = stdscr.subwin( y_max/6 , int(0.7*x_max-2) , 3*y_max/6, 0 )
win4.box()
win4.addstr(1, 1, "PLL SI54344", CYAN | curses.A_BOLD)
win4.refresh()
win5 = stdscr.subwin(y_max/6,
x_max -2,
int(0.7*x_max -2),
4*y_max/6,
0)
win5.box()
win5.addstr(1, 1, "Clock FTSW", CYAN | curses.A_BOLD)
win5.refresh()
win7 = stdscr.subwin( y_max - 1 , int( 0.3*x_max ) , 0 , int(0.7*x_max) )
win7.box()
win7.addstr( 4 , 6 , "RX" , curses.A_BOLD )
win7.addstr( 4 , 10 , "TX" , curses.A_BOLD )
win7.addstr( 4 , 14 , "B2L" , curses.A_BOLD )
win7.addstr( 4 , 6+22 , "RX" , curses.A_BOLD )
win7.addstr( 4 , 10+22 , "TX" , curses.A_BOLD )
win7.addstr( 4 , 14+22 , "B2L" , curses.A_BOLD )
for i in range( 24 ) :
win7.addstr( 5 + i + int( i / 6 ) , 2 , str(i) )
win7.addstr( 5 + i + int( i / 6 ) , 22 , str(i + 24 ) )
win7.refresh()
win6 = stdscr.subwin(y_max/6,
x_max -2,
int(0.7*x_max -2),
5*y_max/6,
0)
win6.box()
win6.addstr(1, 1, "F2: Program PLLs (source = FTSW), F3: Program PLLs (source = Osci.)", CYAN | curses.A_BOLD)
win6.addstr(2, 1, "F4: Clear LOS/OOF/LOL Flag, F5 : Hard reset, F6: Soft reset", CYAN | curses.A_BOLD)
win6.addstr(3, 1, "F7: Reset trigger counter, 0/1/2/3/4/5: Resynchronize b2link 0/1/2/3/4/5", CYAN | curses.A_BOLD)
win6.addstr(3, 1, "F7: Reset trigger counter, r: Resynchronize one b2link", CYAN | curses.A_BOLD)
win6.addstr(4, 1, "a: Activate all channels, d: Deactivate all channels", CYAN | curses.A_BOLD)
win6.addstr(5, 1, "z/x/c/v/b/n: (Des)activate channels 0/1/2/3/4/5", CYAN | curses.A_BOLD)
win6.addstr(5, 1, "m: (Des)activate one channel", CYAN | curses.A_BOLD)
win6.refresh()
......@@ -444,36 +463,30 @@ def draw_menu(stdscr, dev):
win1.addstr(line, 1, "..... Done")
line = line + 1
win1.refresh()
elif k== ord('0'):
fpga.resynchronizeLink(0)
elif k== ord('1'):
fpga.resynchronizeLink(1)
elif k== ord('2'):
fpga.resynchronizeLink(2)
elif k== ord('3'):
fpga.resynchronizeLink(3)
elif k== ord('4'):
fpga.resynchronizeLink(4)
elif k== ord('5'):
fpga.resynchronizeLink(5)
elif k== ord('r'):
win7.addstr(37 , 2 , "Enter channel number to reset + ENTER" , curses.A_BOLD )
win7.refresh()
curses.echo()
stdscr.nodelay (False)
the_s = stdscr.getstr( 37 , 149 )
win7.addstr(37 , 2 , " " , curses.A_BOLD )
curses.noecho()
fpga.resynchronizeLink( int(the_s) )
elif k== curses.KEY_F7:
fpga.resetTriggerCounter()
elif k==ord('a'):
fpga.activateAllChannels()
elif k==ord('d'):
fpga.deactivateAllChannels()
elif k==ord('z'):
fpga.toggleActivateChannel( 0 )
elif k==ord('x'):
fpga.toggleActivateChannel( 1 )
elif k==ord('c'):
fpga.toggleActivateChannel( 2 )
elif k==ord('v'):
fpga.toggleActivateChannel( 3 )
elif k==ord('b'):
fpga.toggleActivateChannel( 4 )
elif k==ord('n'):
fpga.toggleActivateChannel( 5 )
elif k==ord('m'):
win7.addstr(38 , 2 , "Enter channel to (un)mask + ENTER" , curses.A_BOLD )
win7.refresh()
curses.echo()
stdscr.nodelay (False)
the_s = stdscr.getstr( 38 , 145 )
win7.addstr(38 , 2 , " " , curses.A_BOLD )
curses.noecho()
fpga.toggleActivateChannel( int(the_s) )
# cursor_x = max (0, cursor_x)
# cursor_x = min (width - 1, cursor_x)
......@@ -486,7 +499,7 @@ def draw_menu(stdscr, dev):
pll_window(pll_si5345_2, devices[2], fpga, freq[2], conf[2], win3)
pll_window(pll_si5344 , devices[3], fpga, freq[3], conf[3], win4)
fanout_window(fpga, win5)
link_window( fpga , win7 )
# Refresh the screen
#stdscr.refresh ()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment