Port fpgalink_programmer to use newer fl library.
* See change in 2074e51a33
This commit is contained in:
parent
df2306ab88
commit
9c902bcd86
|
@ -1,11 +1,14 @@
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
|
||||||
from mibuild.generic_programmer import GenericProgrammer
|
from mibuild.generic_programmer import GenericProgrammer
|
||||||
from mibuild.xilinx.programmer import _create_xsvf
|
from mibuild.xilinx.programmer import _create_xsvf
|
||||||
|
|
||||||
import fpgalink3
|
try:
|
||||||
fpgalink3.flInitialise(0)
|
import fl
|
||||||
|
except ImportError:
|
||||||
|
import fpgalink3 as fl
|
||||||
|
|
||||||
|
fl.flInitialise(0)
|
||||||
|
|
||||||
|
|
||||||
class FPGALink(GenericProgrammer):
|
class FPGALink(GenericProgrammer):
|
||||||
|
@ -50,28 +53,29 @@ class FPGALink(GenericProgrammer):
|
||||||
|
|
||||||
print("Attempting to open connection to FPGALink device", vp, "...")
|
print("Attempting to open connection to FPGALink device", vp, "...")
|
||||||
try:
|
try:
|
||||||
handle = fpgalink3.flOpen(self.fpgalink_vidpid)
|
handle = fl.flOpen(self.fpgalink_vidpid)
|
||||||
except fpgalink3.FLException as ex:
|
except fl.FLException as ex:
|
||||||
if not ivp:
|
if not ivp:
|
||||||
raise FLException(
|
raise FLException(
|
||||||
"Could not open FPGALink device at {0} and"
|
"Could not open FPGALink device at {0} and"
|
||||||
" no initial VID:PID was supplied".format(vp))
|
" no initial VID:PID was supplied".format(vp))
|
||||||
|
|
||||||
print("Loading firmware into %s..." % ivp)
|
print("Loading firmware into %s..." % ivp)
|
||||||
fpgalink3.flLoadStandardFirmware(ivp, vp)
|
fl.flLoadStandardFirmware(ivp, vp)
|
||||||
|
|
||||||
print("Awaiting renumeration...")
|
print("Awaiting renumeration...")
|
||||||
if not fpgalink3.flAwaitDevice(vp, 600):
|
if not fl.flAwaitDevice(vp, 600):
|
||||||
raise fpgalink3.FLException(
|
raise fl.FLException(
|
||||||
"FPGALink device did not renumerate properly"
|
"FPGALink device did not renumerate properly"
|
||||||
" as {0}".format(vp))
|
" as {0}".format(vp))
|
||||||
|
|
||||||
print("Attempting to open connection to FPGALink device", vp,
|
print("Attempting to open connection to FPGALink device", vp,
|
||||||
"again...")
|
"again...")
|
||||||
handle = fpgalink3.flOpen(vp)
|
handle = fl.flOpen(vp)
|
||||||
|
|
||||||
# Only Nero capable hardware support doing programming.
|
# Only Nero capable hardware support doing programming.
|
||||||
assert fpgalink3.flIsNeroCapable(handle)
|
assert fl.flIsNeroCapable(handle)
|
||||||
|
print("Cable connection opened.")
|
||||||
return handle
|
return handle
|
||||||
|
|
||||||
def load_bitstream(self, bitstream_file):
|
def load_bitstream(self, bitstream_file):
|
||||||
|
@ -88,10 +92,11 @@ class FPGALink(GenericProgrammer):
|
||||||
print("Programming %s to device." % xsvf_file)
|
print("Programming %s to device." % xsvf_file)
|
||||||
print("="*n)
|
print("="*n)
|
||||||
handle = self.open_device()
|
handle = self.open_device()
|
||||||
fpgalink3.flProgram(handle, 'J:'+self.pin_cfg, progFile=xsvf_file)
|
print("Programming device...")
|
||||||
|
fl.flProgram(handle, "J:"+self.pin_cfg, progFile=xsvf_file)
|
||||||
print("Programming successful!")
|
print("Programming successful!")
|
||||||
print("="*n+"\n")
|
print("="*n+"\n")
|
||||||
fpgalink3.flClose(handle)
|
fl.flClose(handle)
|
||||||
|
|
||||||
def flash(self, address, data_file):
|
def flash(self, address, data_file):
|
||||||
raise NotImplementedError("Not supported yet.")
|
raise NotImplementedError("Not supported yet.")
|
||||||
|
|
Loading…
Reference in New Issue