Line 1... |
Line 1... |
/*!
|
/*!
|
flashdemo -- Flash memory example
|
flashdemo -- demo for Flash memory access from firmware and host software for ZTEX USB Module 1.0
|
Copyright (C) 2008-2009 ZTEX e.K.
|
Copyright (C) 2009-2010 ZTEX e.K.
|
http://www.ztex.de
|
http://www.ztex.de
|
|
|
This program is free software; you can redistribute it and/or modify
|
This program is free software; you can redistribute it and/or modify
|
it under the terms of the GNU General Public License version 3 as
|
it under the terms of the GNU General Public License version 3 as
|
published by the Free Software Foundation.
|
published by the Free Software Foundation.
|
Line 64... |
Line 64... |
try {
|
try {
|
// init USB stuff
|
// init USB stuff
|
LibusbJava.usb_init();
|
LibusbJava.usb_init();
|
|
|
// scan the USB bus
|
// scan the USB bus
|
ZtexScanBus1 bus = new ZtexScanBus1( ZtexDevice1.cypressVendorId, ZtexDevice1.cypressProductId, true, false, 1);
|
ZtexScanBus1 bus = new ZtexScanBus1( ZtexDevice1.ztexVendorId, ZtexDevice1.ztexProductId, true, false, 1);
|
if ( bus.numberOfDevices() <= 0) {
|
if ( bus.numberOfDevices() <= 0) {
|
System.err.println("No devices found");
|
System.err.println("No devices found");
|
System.exit(0);
|
System.exit(0);
|
}
|
}
|
|
|
Line 106... |
Line 106... |
// create the main class
|
// create the main class
|
FlashDemo ztex = new FlashDemo ( bus.device(devNum) );
|
FlashDemo ztex = new FlashDemo ( bus.device(devNum) );
|
ztex.certainWorkarounds = workarounds;
|
ztex.certainWorkarounds = workarounds;
|
|
|
// upload the firmware if necessary
|
// upload the firmware if necessary
|
if ( force || ! ztex.valid() || ! ztex.dev().productString().equals("Flash demo") ) {
|
if ( force || ! ztex.valid() || ! ztex.dev().productString().equals("Flash demo for UM 1.0") ) {
|
System.out.println("Firmware upload time: " + ztex.uploadFirmware( "flashdemo.ihx", force ) + " ms");
|
System.out.println("Firmware upload time: " + ztex.uploadFirmware( "flashdemo.ihx", force ) + " ms");
|
}
|
}
|
|
|
for (int i=0; i<args.length; i++ ) {
|
for (int i=0; i<args.length; i++ ) {
|
if ( args[i].equals("-re") ) {
|
if ( args[i].equals("-re") ) {
|