use of com.bfh.logisim.settings.VendorSoftware in project logisim-evolution by reds-heig.
the class VivadoDownload method Download.
public static boolean Download(String scriptPath, String sandboxPath, FPGAReport myReporter, boolean downloadOnly) {
GridBagConstraints gbc = new GridBagConstraints();
JFrame panel = new JFrame("Vivado Downloading");
panel.setResizable(false);
panel.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
GridBagLayout thisLayout = new GridBagLayout();
panel.setLayout(thisLayout);
// PointerInfo mouseloc = MouseInfo.getPointerInfo();
// Point mlocation = mouseloc.getLocation();
// panel.setLocation(mlocation.x, mlocation.y);
JLabel locText = new JLabel("Generating FPGA files and performing download; this may take a while");
gbc.gridx = 0;
gbc.gridy = 0;
gbc.fill = GridBagConstraints.HORIZONTAL;
panel.add(locText, gbc);
JProgressBar progres = new JProgressBar(0, 3);
progresVal = 0;
progres.setValue(progresVal);
progres.setStringPainted(true);
gbc.gridx = 0;
gbc.gridy = 1;
gbc.fill = GridBagConstraints.HORIZONTAL;
panel.add(progres, gbc);
panel.pack();
panel.setLocation(Projects.getCenteredLoc(panel.getWidth(), panel.getHeight() * 4));
panel.setVisible(true);
Rectangle labelRect = locText.getBounds();
labelRect.x = 0;
labelRect.y = 0;
locText.paintImmediately(labelRect);
VendorSoftware vivadoVendor = VendorSoftware.getSoftware(VendorSoftware.VendorVivado);
// Create Vivado project
if (!downloadOnly) {
boolean status = executeTclScript(vivadoVendor.getBinaryPath(0), scriptPath + File.separator + CREATE_PROJECT_TCL, "Create Vivado project", sandboxPath, myReporter, locText, progres);
if (!status) {
panel.dispose();
return false;
}
}
// Generate bitstream
if (!downloadOnly) {
boolean status = executeTclScript(vivadoVendor.getBinaryPath(0), scriptPath + File.separator + GENERATE_BITSTREAM_FILE, "Generate bitstream", sandboxPath, myReporter, locText, progres);
if (!status) {
panel.dispose();
return false;
}
boolean bitFileExists = new File(_bitStreamPath).exists();
if (!bitFileExists) {
myReporter.AddFatalError("Could not generate bitfile! Check Console tab for more details.");
panel.dispose();
return false;
}
}
// Download to board
// only if the bitfile exists
boolean bitFileExists = new File(_bitStreamPath).exists();
if (bitFileExists) {
Object[] options = { "Yes, download", "No, abort" };
if (JOptionPane.showOptionDialog(progres, "Verify that your board is connected and you are ready to download.", "Ready to download ?", JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE, null, options, options[0]) != JOptionPane.YES_OPTION) {
myReporter.AddWarning("Download aborted.");
panel.dispose();
return false;
}
boolean status = executeTclScript(vivadoVendor.getBinaryPath(0), scriptPath + File.separator + LOAD_BITSTEAM_FILE, "Downloading bitfile", sandboxPath, myReporter, locText, progres);
panel.dispose();
return status;
} else {
myReporter.AddFatalError("No bitfile found!");
panel.dispose();
return false;
}
}
use of com.bfh.logisim.settings.VendorSoftware in project logisim-evolution by reds-heig.
the class AlteraDownload method Download.
public static boolean Download(String scriptPath, String ProjectPath, String SandboxPath, FPGAReport MyReporter) {
VendorSoftware alteraVendor = VendorSoftware.getSoftware(VendorSoftware.VendorAltera);
boolean SofFileExists = new File(SandboxPath + ToplevelHDLGeneratorFactory.FPGAToplevelName + ".sof").exists();
GridBagConstraints gbc = new GridBagConstraints();
JFrame panel = new JFrame("Altera Downloading");
panel.setResizable(false);
panel.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
GridBagLayout thisLayout = new GridBagLayout();
panel.setLayout(thisLayout);
// PointerInfo mouseloc = MouseInfo.getPointerInfo();
// Point mlocation = mouseloc.getLocation();
// panel.setLocation(mlocation.x, mlocation.y);
JLabel LocText = new JLabel("Generating FPGA files and performing download; this may take a while");
gbc.gridx = 0;
gbc.gridy = 0;
gbc.fill = GridBagConstraints.HORIZONTAL;
panel.add(LocText, gbc);
JProgressBar progres = new JProgressBar(0, 5);
progres.setValue(1);
progres.setStringPainted(true);
gbc.gridx = 0;
gbc.gridy = 1;
gbc.fill = GridBagConstraints.HORIZONTAL;
panel.add(progres, gbc);
panel.pack();
panel.setLocation(Projects.getCenteredLoc(panel.getWidth(), panel.getHeight() * 4));
panel.setVisible(true);
Rectangle labelRect = LocText.getBounds();
labelRect.x = 0;
labelRect.y = 0;
LocText.paintImmediately(labelRect);
List<String> command = new ArrayList<String>();
if (!SofFileExists) {
try {
LocText.setText("Creating Project");
labelRect = LocText.getBounds();
labelRect.x = 0;
labelRect.y = 0;
LocText.paintImmediately(labelRect);
command.add(alteraVendor.getBinaryPath(0));
command.add("-t");
command.add(scriptPath.replace(ProjectPath, ".." + File.separator) + "AlteraDownload.tcl");
ProcessBuilder Altera1 = new ProcessBuilder(command);
Altera1.directory(new File(SandboxPath));
final Process CreateProject = Altera1.start();
InputStream is = CreateProject.getInputStream();
InputStreamReader isr = new InputStreamReader(is);
BufferedReader br = new BufferedReader(isr);
String line;
MyReporter.ClsScr();
while ((line = br.readLine()) != null) {
MyReporter.print(line);
}
CreateProject.waitFor();
if (CreateProject.exitValue() != 0) {
MyReporter.AddFatalError("Failed to Create a Quartus Project, cannot download");
panel.dispose();
return false;
}
} catch (IOException e) {
MyReporter.AddFatalError("Internal Error during Altera download");
panel.dispose();
return false;
} catch (InterruptedException e) {
MyReporter.AddFatalError("Internal Error during Altera download");
panel.dispose();
return false;
}
}
progres.setValue(2);
Rectangle ProgRect = progres.getBounds();
ProgRect.x = 0;
ProgRect.y = 0;
progres.paintImmediately(ProgRect);
command.clear();
if (!SofFileExists) {
try {
LocText.setText("Optimize Project");
labelRect = LocText.getBounds();
labelRect.x = 0;
labelRect.y = 0;
LocText.paintImmediately(labelRect);
command.add(alteraVendor.getBinaryPath(2));
command.add(ToplevelHDLGeneratorFactory.FPGAToplevelName);
command.add("--optimize=area");
ProcessBuilder Altera1 = new ProcessBuilder(command);
Altera1.directory(new File(SandboxPath));
final Process CreateProject = Altera1.start();
InputStream is = CreateProject.getInputStream();
InputStreamReader isr = new InputStreamReader(is);
BufferedReader br = new BufferedReader(isr);
String line;
MyReporter.ClsScr();
while ((line = br.readLine()) != null) {
MyReporter.print(line);
}
CreateProject.waitFor();
if (CreateProject.exitValue() != 0) {
MyReporter.AddFatalError("Failed to optimize (AREA) Project, cannot download");
panel.dispose();
return false;
}
} catch (IOException e) {
MyReporter.AddFatalError("Internal Error during Altera download");
panel.dispose();
return false;
} catch (InterruptedException e) {
MyReporter.AddFatalError("Internal Error during Altera download");
panel.dispose();
return false;
}
}
LocText.setText("Synthesizing and creating configuration file (this may take a while)");
labelRect = LocText.getBounds();
labelRect.x = 0;
labelRect.y = 0;
LocText.paintImmediately(labelRect);
progres.setValue(3);
ProgRect = progres.getBounds();
ProgRect.x = 0;
ProgRect.y = 0;
progres.paintImmediately(ProgRect);
if (!SofFileExists) {
try {
command.clear();
command.add(alteraVendor.getBinaryPath(0));
command.add("--flow");
command.add("compile");
command.add(ToplevelHDLGeneratorFactory.FPGAToplevelName);
ProcessBuilder Altera1 = new ProcessBuilder(command);
Altera1.directory(new File(SandboxPath));
final Process CreateProject = Altera1.start();
InputStream is = CreateProject.getInputStream();
InputStreamReader isr = new InputStreamReader(is);
BufferedReader br = new BufferedReader(isr);
String line;
MyReporter.ClsScr();
while ((line = br.readLine()) != null) {
MyReporter.print(line);
}
CreateProject.waitFor();
if (CreateProject.exitValue() != 0) {
MyReporter.AddFatalError("Failed to synthesize design and to create the configuration files, cannot download");
panel.dispose();
return false;
}
} catch (IOException e) {
MyReporter.AddFatalError("Internal Error during Altera download");
panel.dispose();
return false;
} catch (InterruptedException e) {
MyReporter.AddFatalError("Internal Error during Altera download");
panel.dispose();
return false;
}
}
LocText.setText("Downloading");
Object[] options = { "Yes, download", "No, abort" };
if (JOptionPane.showOptionDialog(progres, "Verify that your board is connected and you are ready to download.", "Ready to download ?", JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE, null, options, options[0]) != JOptionPane.YES_OPTION) {
MyReporter.AddWarning("Download aborted.");
panel.dispose();
return false;
}
labelRect = LocText.getBounds();
labelRect.x = 0;
labelRect.y = 0;
LocText.paintImmediately(labelRect);
progres.setValue(4);
ProgRect = progres.getBounds();
ProgRect.x = 0;
ProgRect.y = 0;
progres.paintImmediately(ProgRect);
try {
command.clear();
command.add(alteraVendor.getBinaryPath(1));
command.add("-c");
command.add("usb-blaster");
command.add("-m");
command.add("jtag");
command.add("-o");
// if there is no .sof generated, try with the .pof
if (new File(SandboxPath + ToplevelHDLGeneratorFactory.FPGAToplevelName + ".sof").exists()) {
command.add("P;" + ToplevelHDLGeneratorFactory.FPGAToplevelName + ".sof");
} else {
command.add("P;" + ToplevelHDLGeneratorFactory.FPGAToplevelName + ".pof");
}
MyReporter.AddInfo(command.toString());
ProcessBuilder Altera1 = new ProcessBuilder(command);
Altera1.directory(new File(SandboxPath));
final Process CreateProject = Altera1.start();
InputStream is = CreateProject.getInputStream();
InputStreamReader isr = new InputStreamReader(is);
BufferedReader br = new BufferedReader(isr);
String line;
MyReporter.ClsScr();
while ((line = br.readLine()) != null) {
MyReporter.print(line);
}
CreateProject.waitFor();
if (CreateProject.exitValue() != 0) {
MyReporter.AddFatalError("Failed to Download design; did you connect the board?");
panel.dispose();
return false;
}
} catch (IOException e) {
MyReporter.AddFatalError("Internal Error during Altera download");
panel.dispose();
return false;
} catch (InterruptedException e) {
MyReporter.AddFatalError("Internal Error during Altera download");
panel.dispose();
return false;
}
panel.dispose();
return true;
}
use of com.bfh.logisim.settings.VendorSoftware in project logisim-evolution by reds-heig.
the class XilinxDownload method Download.
public static boolean Download(BoardInformation BoardInfo, String scriptPath, String UcfPath, String ProjectPath, String SandboxPath, FPGAReport MyReporter) {
VendorSoftware xilinxVendor = VendorSoftware.getSoftware(VendorSoftware.VendorXilinx);
boolean IsCPLD = BoardInfo.fpga.getPart().toUpperCase().startsWith("XC2C") || BoardInfo.fpga.getPart().toUpperCase().startsWith("XA2C") || BoardInfo.fpga.getPart().toUpperCase().startsWith("XCR3") || BoardInfo.fpga.getPart().toUpperCase().startsWith("XC9500") || BoardInfo.fpga.getPart().toUpperCase().startsWith("XA9500");
String BitfileExt = (IsCPLD) ? "jed" : "bit";
boolean BitFileExists = new File(SandboxPath + ToplevelHDLGeneratorFactory.FPGAToplevelName + "." + BitfileExt).exists();
GridBagConstraints gbc = new GridBagConstraints();
JFrame panel = new JFrame("Xilinx Downloading");
panel.setResizable(false);
panel.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
GridBagLayout thisLayout = new GridBagLayout();
panel.setLayout(thisLayout);
// PointerInfo mouseloc = MouseInfo.getPointerInfo();
// Point mlocation = mouseloc.getLocation();
// panel.setLocation(mlocation.x,mlocation.y);
JLabel LocText = new JLabel("Generating FPGA files and performing download; this may take a while");
gbc.gridx = 0;
gbc.gridy = 0;
gbc.fill = GridBagConstraints.HORIZONTAL;
panel.add(LocText, gbc);
JProgressBar progres = new JProgressBar(0, xilinxVendor.getBinaries().length);
progres.setValue(0);
progres.setStringPainted(true);
gbc.gridx = 0;
gbc.gridy = 1;
gbc.fill = GridBagConstraints.HORIZONTAL;
panel.add(progres, gbc);
panel.pack();
panel.setLocation(Projects.getCenteredLoc(panel.getWidth(), panel.getHeight() * 4));
panel.setVisible(true);
Rectangle labelRect = LocText.getBounds();
labelRect.x = 0;
labelRect.y = 0;
LocText.paintImmediately(labelRect);
List<String> command = new ArrayList<String>();
if (!BitFileExists) {
try {
LocText.setText("Synthesizing Project");
labelRect = LocText.getBounds();
labelRect.x = 0;
labelRect.y = 0;
LocText.paintImmediately(labelRect);
Rectangle ProgRect = progres.getBounds();
ProgRect.x = 0;
ProgRect.y = 0;
progres.paintImmediately(ProgRect);
command.clear();
command.add(xilinxVendor.getBinaryPath(0));
command.add("-ifn");
command.add(scriptPath.replace(ProjectPath, "../") + File.separator + script_file);
command.add("-ofn");
command.add("logisim.log");
ProcessBuilder Xilinx = new ProcessBuilder(command);
Xilinx.directory(new File(SandboxPath));
final Process CreateProject = Xilinx.start();
InputStream is = CreateProject.getInputStream();
InputStreamReader isr = new InputStreamReader(is);
BufferedReader br = new BufferedReader(isr);
String line;
MyReporter.ClsScr();
while ((line = br.readLine()) != null) {
MyReporter.print(line);
}
CreateProject.waitFor();
if (CreateProject.exitValue() != 0) {
MyReporter.AddFatalError("Failed to Synthesize Xilinx project; cannot download");
panel.dispose();
return false;
}
} catch (IOException e) {
MyReporter.AddFatalError("Internal Error during Xilinx download");
panel.dispose();
return false;
} catch (InterruptedException e) {
MyReporter.AddFatalError("Internal Error during Xilinx download");
panel.dispose();
return false;
}
}
if (!BitFileExists) {
try {
LocText.setText("Adding contraints");
labelRect = LocText.getBounds();
labelRect.x = 0;
labelRect.y = 0;
LocText.paintImmediately(labelRect);
progres.setValue(1);
Rectangle ProgRect = progres.getBounds();
ProgRect.x = 0;
ProgRect.y = 0;
progres.paintImmediately(ProgRect);
command.clear();
command.add(xilinxVendor.getBinaryPath(1));
command.add("-intstyle");
command.add("ise");
command.add("-uc");
command.add(UcfPath.replace(ProjectPath, "../") + File.separator + ucf_file);
command.add("logisim.ngc");
command.add("logisim.ngd");
ProcessBuilder Xilinx = new ProcessBuilder(command);
Xilinx.directory(new File(SandboxPath));
final Process CreateProject = Xilinx.start();
InputStream is = CreateProject.getInputStream();
InputStreamReader isr = new InputStreamReader(is);
BufferedReader br = new BufferedReader(isr);
String line;
MyReporter.ClsScr();
while ((line = br.readLine()) != null) {
MyReporter.print(line);
}
CreateProject.waitFor();
if (CreateProject.exitValue() != 0) {
MyReporter.AddFatalError("Failed to add Xilinx constraints; cannot download");
panel.dispose();
return false;
}
} catch (IOException e) {
MyReporter.AddFatalError("Internal Error during Xilinx download");
panel.dispose();
return false;
} catch (InterruptedException e) {
MyReporter.AddFatalError("Internal Error during Xilinx download");
panel.dispose();
return false;
}
}
if (!BitFileExists && !IsCPLD) {
try {
LocText.setText("Mapping Design");
labelRect = LocText.getBounds();
labelRect.x = 0;
labelRect.y = 0;
LocText.paintImmediately(labelRect);
progres.setValue(2);
Rectangle ProgRect = progres.getBounds();
ProgRect.x = 0;
ProgRect.y = 0;
progres.paintImmediately(ProgRect);
command.clear();
command.add(xilinxVendor.getBinaryPath(2));
command.add("-intstyle");
command.add("ise");
command.add("-o");
command.add("logisim_map");
command.add("logisim.ngd");
ProcessBuilder Xilinx = new ProcessBuilder(command);
Xilinx.directory(new File(SandboxPath));
final Process CreateProject = Xilinx.start();
InputStream is = CreateProject.getInputStream();
InputStreamReader isr = new InputStreamReader(is);
BufferedReader br = new BufferedReader(isr);
String line;
MyReporter.ClsScr();
while ((line = br.readLine()) != null) {
MyReporter.print(line);
}
CreateProject.waitFor();
if (CreateProject.exitValue() != 0) {
MyReporter.AddFatalError("Failed to map Xilinx design; cannot download");
panel.dispose();
return false;
}
} catch (IOException e) {
MyReporter.AddFatalError("Internal Error during Xilinx download");
panel.dispose();
return false;
} catch (InterruptedException e) {
MyReporter.AddFatalError("Internal Error during Xilinx download");
panel.dispose();
return false;
}
}
if (!BitFileExists) {
try {
LocText.setText("Place and routing Design");
labelRect = LocText.getBounds();
labelRect.x = 0;
labelRect.y = 0;
LocText.paintImmediately(labelRect);
progres.setValue(3);
Rectangle ProgRect = progres.getBounds();
ProgRect.x = 0;
ProgRect.y = 0;
progres.paintImmediately(ProgRect);
command.clear();
if (!IsCPLD) {
command.add(xilinxVendor.getBinaryPath(3));
command.add("-w");
command.add("-intstyle");
command.add("ise");
command.add("-ol");
command.add("high");
command.add("logisim_map");
command.add("logisim_par");
command.add("logisim_map.pcf");
} else {
command.add(xilinxVendor.getBinaryPath(6));
command.add("-p");
command.add(BoardInfo.fpga.getPart().toUpperCase() + "-" + BoardInfo.fpga.getSpeedGrade() + "-" + BoardInfo.fpga.getPackage().toUpperCase());
command.add("-intstyle");
command.add("ise");
/* TODO: do correct termination type */
command.add("-terminate");
if (BoardInfo.fpga.getUnusedPinsBehavior() == PullBehaviors.PullUp) {
command.add("pullup");
} else if (BoardInfo.fpga.getUnusedPinsBehavior() == PullBehaviors.PullDown) {
command.add("pulldown");
} else {
command.add("float");
}
command.add("-loc");
command.add("on");
command.add("-log");
command.add("logisim_cpldfit.log");
command.add("logisim.ngd");
}
ProcessBuilder Xilinx = new ProcessBuilder(command);
Xilinx.directory(new File(SandboxPath));
final Process CreateProject = Xilinx.start();
InputStream is = CreateProject.getInputStream();
InputStreamReader isr = new InputStreamReader(is);
BufferedReader br = new BufferedReader(isr);
String line;
MyReporter.ClsScr();
while ((line = br.readLine()) != null) {
MyReporter.print(line);
}
CreateProject.waitFor();
if (CreateProject.exitValue() != 0) {
MyReporter.AddFatalError("Failed to P&R Xilinx design; cannot download");
panel.dispose();
return false;
}
} catch (IOException e) {
MyReporter.AddFatalError("Internal Error during Xilinx download");
panel.dispose();
return false;
} catch (InterruptedException e) {
MyReporter.AddFatalError("Internal Error during Xilinx download");
panel.dispose();
return false;
}
}
if (!BitFileExists) {
try {
LocText.setText("Generating Bitfile");
labelRect = LocText.getBounds();
labelRect.x = 0;
labelRect.y = 0;
LocText.paintImmediately(labelRect);
progres.setValue(4);
Rectangle ProgRect = progres.getBounds();
ProgRect.x = 0;
ProgRect.y = 0;
progres.paintImmediately(ProgRect);
command.clear();
if (!IsCPLD) {
command.add(xilinxVendor.getBinaryPath(4));
command.add("-w");
if (BoardInfo.fpga.getUnusedPinsBehavior() == PullBehaviors.PullUp) {
command.add("-g");
command.add("UnusedPin:PULLUP");
}
if (BoardInfo.fpga.getUnusedPinsBehavior() == PullBehaviors.PullDown) {
command.add("-g");
command.add("UnusedPin:PULLDOWN");
}
command.add("-g");
command.add("StartupClk:CCLK");
command.add("logisim_par");
command.add(ToplevelHDLGeneratorFactory.FPGAToplevelName + ".bit");
} else {
command.add(xilinxVendor.getBinaryPath(7));
command.add("-i");
command.add("logisim.vm6");
}
ProcessBuilder Xilinx = new ProcessBuilder(command);
Xilinx.directory(new File(SandboxPath));
final Process CreateProject = Xilinx.start();
InputStream is = CreateProject.getInputStream();
InputStreamReader isr = new InputStreamReader(is);
BufferedReader br = new BufferedReader(isr);
String line;
MyReporter.ClsScr();
while ((line = br.readLine()) != null) {
MyReporter.print(line);
}
CreateProject.waitFor();
if (CreateProject.exitValue() != 0) {
MyReporter.AddFatalError("Failed generate bitfile; cannot download");
panel.dispose();
return false;
}
} catch (IOException e) {
MyReporter.AddFatalError("Internal Error during Xilinx download");
panel.dispose();
return false;
} catch (InterruptedException e) {
MyReporter.AddFatalError("Internal Error during Xilinx download");
panel.dispose();
return false;
}
}
try {
LocText.setText("Downloading Bitfile");
labelRect = LocText.getBounds();
labelRect.x = 0;
labelRect.y = 0;
LocText.paintImmediately(labelRect);
progres.setValue(5);
Rectangle ProgRect = progres.getBounds();
ProgRect.x = 0;
ProgRect.y = 0;
progres.paintImmediately(ProgRect);
Object[] options = { "Yes, download", "No, abort" };
if (JOptionPane.showOptionDialog(progres, "Verify that your board is connected and you are ready to download.", "Ready to download ?", JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE, null, options, options[0]) != JOptionPane.YES_OPTION) {
MyReporter.AddWarning("Download aborted.");
panel.dispose();
return false;
}
/* Until here update of status window */
if (!BoardInfo.fpga.USBTMCDownloadRequired()) {
command.clear();
command.add(xilinxVendor.getBinaryPath(5));
command.add("-batch");
command.add(scriptPath.replace(ProjectPath, "../") + File.separator + download_file);
ProcessBuilder Xilinx = new ProcessBuilder(command);
Xilinx.directory(new File(SandboxPath));
final Process CreateProject = Xilinx.start();
InputStream is = CreateProject.getInputStream();
InputStreamReader isr = new InputStreamReader(is);
BufferedReader br = new BufferedReader(isr);
String line;
MyReporter.ClsScr();
while ((line = br.readLine()) != null) {
MyReporter.print(line);
}
CreateProject.waitFor();
if (CreateProject.exitValue() != 0) {
MyReporter.AddFatalError("Failed in downloading");
panel.dispose();
return false;
}
/* Until here is the standard download with programmer */
} else {
MyReporter.ClsScr();
/* Here we do the USBTMC Download */
boolean usbtmcdevice = new File("/dev/usbtmc0").exists();
if (!usbtmcdevice) {
MyReporter.AddFatalError("Could not find usbtmc device");
panel.dispose();
return false;
}
File bitfile = new File(SandboxPath + ToplevelHDLGeneratorFactory.FPGAToplevelName + "." + BitfileExt);
byte[] bitfile_buffer = new byte[BUFFER_SIZE];
int bitfile_buffer_size;
BufferedInputStream bitfile_in = new BufferedInputStream(new FileInputStream(bitfile));
File usbtmc = new File("/dev/usbtmc0");
BufferedOutputStream usbtmc_out = new BufferedOutputStream(new FileOutputStream(usbtmc));
usbtmc_out.write("FPGA ".getBytes());
bitfile_buffer_size = bitfile_in.read(bitfile_buffer, 0, BUFFER_SIZE);
while (bitfile_buffer_size > 0) {
usbtmc_out.write(bitfile_buffer, 0, bitfile_buffer_size);
bitfile_buffer_size = bitfile_in.read(bitfile_buffer, 0, BUFFER_SIZE);
}
usbtmc_out.close();
bitfile_in.close();
}
} catch (IOException e) {
MyReporter.AddFatalError("Internal Error during Xilinx download");
panel.dispose();
return false;
} catch (InterruptedException e) {
MyReporter.AddFatalError("Internal Error during Xilinx download");
panel.dispose();
return false;
}
panel.dispose();
return true;
}
Aggregations