OpenCores
URL https://opencores.org/ocsvn/usb_fpga_1_2/usb_fpga_1_2/trunk

Subversion Repositories usb_fpga_1_2

[/] [usb_fpga_1_2/] [trunk/] [java/] [FWLoader.java] - Diff between revs 4 and 5

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 4 Rev 5
Line 33... Line 33...
    public static void main (String args[]) {
    public static void main (String args[]) {
        LibusbJava.usb_init();
        LibusbJava.usb_init();
 
 
        final String helpMsg = new String (
        final String helpMsg = new String (
                        "Global parameters:\n"+
                        "Global parameters:\n"+
                        "    -c               Scan for Cypres EZ-USB devices without ZTEX firmware\n"+
                        "    -c               Scan for Cypress EZ-USB devices without ZTEX firmware\n"+
                        "    -v <VID> <PID>   Scan for devices with ZTEX firmware and the given Vendor ID and Product ID\n"+
                        "    -v <VID> <PID>   Scan for devices with ZTEX firmware and the given Vendor ID and Product ID\n"+
                        "    -vc              Equal to -v 0x4b4 0x8613\n"+
                        "    -vc              Equal to -v 0x4b4 0x8613\n"+
                        "    -d <number>      Device Number (default: 0)\n"+
                        "    -d <number>      Device Number (default: 0)\n"+
                        "    -f               Force uploads\n"+
                        "    -f               Force uploads\n"+
                        "    -p               Print bus info\n"+
                        "    -p               Print bus info\n"+
                        "    -w               Enable certain workaraounds\n"+
                        "    -w               Enable certain workarounds\n"+
                        "    -h               This help \n\n"+
                        "    -h               This help \n\n"+
                        "Ordered parameters:\n"+
                        "Ordered parameters:\n"+
                        "    -i               Info\n"+
                        "    -i               Info\n"+
                        "    -ii              Info + capabilities\n"+
                        "    -ii              Info + capabilities\n"+
                        "    -if              Read FPGA state\n"+
                        "    -if              Read FPGA state\n"+
                        "    -ru              Reset EZ-USB Microcontroller\n"+
                        "    -ru              Reset EZ-USB Microcontroller\n"+
                        "    -uu <ihx file>   Upload EZ-USB Firmware\n"+
                        "    -uu <ihx file>   Upload EZ-USB Firmware\n"+
 
                        "    -bs 0|1|A        Bit swapping for bitstreams: 0: disable, 1: enable, A: automatic detection\n"+
                        "    -rf              Reset FPGA\n"+
                        "    -rf              Reset FPGA\n"+
                        "    -uf <bitstream>  Upload <bitstream>\n"+
                        "    -uf <bitstream>  Upload bitstream to FPGA\n"+
                        "    -re              Reset EEPROM Firmware\n"+
                        "    -re              Reset EEPROM Firmware\n"+
                        "    -ue <ihx file>   Upload Firmware to EEPROM\n"+
                        "    -ue <ihx file>   Upload Firmware to EEPROM\n"+
                        "    -rm              Reset FLASH bitstream\n"+
                        "    -rm              Reset FLASH bitstream\n"+
                        "    -um <bitstream>  Upload Firmware to FLASH");
                        "    -um <bitstream>  Upload bitstream to Flash");
 
 
 
 
// process global parameters
// process global parameters
        try {
        try {
 
 
Line 65... Line 66...
            boolean cypress = false;
            boolean cypress = false;
            int devNum = 0;
            int devNum = 0;
            boolean forceUpload = false;
            boolean forceUpload = false;
            boolean printBus = false;
            boolean printBus = false;
            boolean workarounds = false;
            boolean workarounds = false;
 
            int bs = -1;
 
 
            for (int i=0; i<args.length; i++ ) {
            for (int i=0; i<args.length; i++ ) {
                if ( args[i].equals("-c") ) {
                if ( args[i].equals("-c") ) {
                    cypress = true;
                    cypress = true;
                }
                }
Line 126... Line 128...
                        System.err.println(helpMsg);
                        System.err.println(helpMsg);
                        System.exit(0);
                        System.exit(0);
                }
                }
                else if ( args[i].equals("-i") || args[i].equals("-ii") || args[i].equals("-if") || args[i].equals("-ru") || args[i].equals("-rf") || args[i].equals("-re") || args[i].equals("-rm") ) {
                else if ( args[i].equals("-i") || args[i].equals("-ii") || args[i].equals("-if") || args[i].equals("-ru") || args[i].equals("-rf") || args[i].equals("-re") || args[i].equals("-rm") ) {
                }
                }
                else if ( args[i].equals("-uu") || args[i].equals("-uf") || args[i].equals("-ue") || args[i].equals("-um") ) {
                else if ( args[i].equals("-uu") || args[i].equals("-uf") || args[i].equals("-ue") || args[i].equals("-um") || args[i].equals("-bs") ) {
                    i+=1;
                    i+=1;
                }
                }
                else {
                else {
                    System.err.println("Error: Invalid Parameter: "+args[i]);
                    System.err.println("Error: Invalid Parameter: "+args[i]);
                    System.err.println(helpMsg);
                    System.err.println(helpMsg);
Line 177... Line 179...
                        System.err.println(helpMsg);
                        System.err.println(helpMsg);
                        System.exit(1);
                        System.exit(1);
                    }
                    }
                    System.out.println("Firmware upload time: " + ztex.uploadFirmware( args[i], forceUpload ) + " ms");
                    System.out.println("Firmware upload time: " + ztex.uploadFirmware( args[i], forceUpload ) + " ms");
                }
                }
                else if ( args[i].equals("-re") ) {
                else if ( args[i].equals("-bs") ) {
                    ztex.eepromDisable();
 
                }
 
                else if ( args[i].equals("-ue") ) {
 
                    i++;
                    i++;
                    if ( i >= args.length ) {
                    if ( (i>=args.length) || !( args[i].equals("0") || args[i].equals("1") || args[i].equalsIgnoreCase("A") ) ) {
                        System.err.println("Error: Filename expected after -ue");
                        System.err.println("Error: `0',`1' or `A' expected after -bs");
                        System.err.println(helpMsg);
                        System.err.println(helpMsg);
                        System.exit(1);
                        System.exit(1);
                    }
                    }
                    System.out.println("Firmware to EEPROM upload time: " + ztex.eepromUpload( args[i], forceUpload ) + " ms");
                    if ( args[i].equals("0") )
 
                        bs = 0;
 
                    else if ( args[i].equals("1") )
 
                        bs = 1;
 
                    else bs = -1;
                }
                }
                else if ( args[i].equals("-rf") ) {
                else if ( args[i].equals("-rf") ) {
                    ztex.resetFpga();
                    ztex.resetFpga();
                }
                }
                else if ( args[i].equals("-uf") ) {
                else if ( args[i].equals("-uf") ) {
Line 199... Line 202...
                    if ( i >= args.length ) {
                    if ( i >= args.length ) {
                        System.err.println("Error: Filename expected after -uf");
                        System.err.println("Error: Filename expected after -uf");
                        System.err.println(helpMsg);
                        System.err.println(helpMsg);
                        System.exit(1);
                        System.exit(1);
                    }
                    }
                    System.out.println("FPGA configuration time: " + ztex.configureFpga( args[i], forceUpload ) + " ms");
                    System.out.println("FPGA configuration time: " + ztex.configureFpga( args[i], forceUpload, bs ) + " ms");
 
                }
 
                else if ( args[i].equals("-re") ) {
 
                    ztex.eepromDisable();
 
                }
 
                else if ( args[i].equals("-ue") ) {
 
                    i++;
 
                    if ( i >= args.length ) {
 
                        System.err.println("Error: Filename expected after -ue");
 
                        System.err.println(helpMsg);
 
                        System.exit(1);
 
                    }
 
                    System.out.println("Firmware to EEPROM upload time: " + ztex.eepromUpload( args[i], forceUpload ) + " ms");
                }
                }
                else if ( args[i].equals("-rm") ) {
                else if ( args[i].equals("-rm") ) {
                    System.out.println("First free sector: " + ztex.flashFirstFreeSector() );
                    System.out.println("First free sector: " + ztex.flashFirstFreeSector() );
                    ztex.flashResetBitstream();
                    ztex.flashResetBitstream();
                    System.out.println("First free sector: " + ztex.flashFirstFreeSector() );
                    System.out.println("First free sector: " + ztex.flashFirstFreeSector() );
Line 214... Line 229...
                        System.err.println("Error: Filename expected after -uf");
                        System.err.println("Error: Filename expected after -uf");
                        System.err.println(helpMsg);
                        System.err.println(helpMsg);
                        System.exit(1);
                        System.exit(1);
                    }
                    }
                    System.out.println("First free sector: " + ztex.flashFirstFreeSector() );
                    System.out.println("First free sector: " + ztex.flashFirstFreeSector() );
                    System.out.println("FPGA configuration time: " + ztex.flashUploadBitstream( args[i] ) + " ms");
                    System.out.println("FPGA configuration time: " + ztex.flashUploadBitstream( args[i], bs ) + " ms");
                    System.out.println("First free sector: " + ztex.flashFirstFreeSector() );
                    System.out.println("First free sector: " + ztex.flashFirstFreeSector() );
                }
                }
            }
            }
        }
        }
        catch (Exception e) {
        catch (Exception e) {

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.