URL
https://opencores.org/ocsvn/usb_fpga_1_11/usb_fpga_1_11/trunk
Subversion Repositories usb_fpga_1_11
Compare Revisions
- This comparison shows the changes necessary to convert path
/usb_fpga_1_11/trunk/examples/usb-fpga-1.2
- from Rev 4 to Rev 5
- ↔ Reverse comparison
Rev 4 → Rev 5
/nvmtest/NVMTest.java
0,0 → 1,185
/*! |
nvmtest -- ATxmega non volatile memory test |
Copyright (C) 2009-2010 ZTEX e.K. |
http://www.ztex.de |
|
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 |
published by the Free Software Foundation. |
|
This program is distributed in the hope that it will be useful, but |
WITHOUT ANY WARRANTY; without even the implied warranty of |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
General Public License for more details. |
|
You should have received a copy of the GNU General Public License |
along with this program; if not, see http://www.gnu.org/licenses/. |
!*/ |
|
import java.io.*; |
import java.util.*; |
|
import ch.ntb.usb.*; |
|
import ztex.*; |
|
// ***************************************************************************** |
// ******* ParameterException ************************************************** |
// ***************************************************************************** |
// Exception the prints a help message |
class ParameterException extends Exception { |
public final static String helpMsg = new String ( |
"Parameters:\n"+ |
" -d <number> Device Number (default: 0)\n" + |
" -f Force uploads\n" + |
" -p Print bus info\n" + |
" -w Enable certain workarounds\n"+ |
" -h This help" ); |
|
public ParameterException (String msg) { |
super( msg + "\n" + helpMsg ); |
} |
} |
|
// ***************************************************************************** |
// ******* NVMTest ************************************************************* |
// ***************************************************************************** |
class NVMTest extends Ztex1v1 { |
|
// ******* NVMTest ************************************************************* |
// constructor |
public NVMTest ( ZtexDevice1 pDev ) throws UsbException { |
super ( pDev ); |
} |
|
// ******* main **************************************************************** |
public static void main (String args[]) { |
|
int devNum = 0; |
boolean force = false; |
boolean workarounds = false; |
|
try { |
// init USB stuff |
LibusbJava.usb_init(); |
|
// scan the USB bus |
ZtexScanBus1 bus = new ZtexScanBus1( ZtexDevice1.ztexVendorId, ZtexDevice1.ztexProductId, true, false, 1); |
if ( bus.numberOfDevices() <= 0) { |
System.err.println("No devices found"); |
System.exit(0); |
} |
|
// scan the command line arguments |
for (int i=0; i<args.length; i++ ) { |
if ( args[i].equals("-d") ) { |
i++; |
try { |
if (i>=args.length) throw new Exception(); |
devNum = Integer.parseInt( args[i] ); |
} |
catch (Exception e) { |
throw new ParameterException("Device number expected after -d"); |
} |
} |
else if ( args[i].equals("-f") ) { |
force = true; |
} |
else if ( args[i].equals("-p") ) { |
bus.printBus(System.out); |
System.exit(0); |
} |
else if ( args[i].equals("-p") ) { |
bus.printBus(System.out); |
System.exit(0); |
} |
else if ( args[i].equals("-w") ) { |
workarounds = true; |
} |
else if ( args[i].equals("-h") ) { |
System.err.println(ParameterException.helpMsg); |
System.exit(0); |
} |
else throw new ParameterException("Invalid Parameter: "+args[i]); |
} |
|
|
// create the main class |
NVMTest ztex = new NVMTest ( bus.device(devNum) ); |
ztex.certainWorkarounds = workarounds; |
|
// upload the firmware if necessary |
if ( force || ! ztex.valid() || ! ztex.dev().productString().equals("nvmtest for EXP-1.10") ) { |
System.out.println("Firmware upload time: " + ztex.uploadFirmware( "nvmtest.ihx", force ) + " ms"); |
} |
|
// check for Experimental Bord 1.10 |
if ( ! ztex.xmegaEnabled() ) |
throw new Exception("Experimental Board 1.10 required"); |
|
// print out some memory information |
System.out.println("Flash size: " + ztex.xmegaFlashPages()*ztex.xmegaFlashPageSize() + " EEPROM size: " + ztex.xmegaEepromPages()*ztex.xmegaEepromPageSize() + " Error code: " + ztex.xmegaEC ); |
|
// read out device ID from production signature row |
byte buf[] = new byte[ztex.xmegaFlashPageSize()]; |
|
ztex.xmegaNvmRead ( 0x01000090, buf, 4 ); |
System.out.println( "Device ID: " + Integer.toHexString(buf[0] & 255) + " " + Integer.toHexString(buf[1] & 255) + " " + Integer.toHexString(buf[2] & 255)); |
|
// test ATxmega Flash by reading / writing random data |
// generate + write date |
Random random = new Random(); |
for (int i=0; i<ztex.xmegaFlashPageSize(); i++ ) |
buf[i] = (byte) random.nextInt(); |
ztex.xmegaFlashPageWrite ( ztex.xmegaFlashPages()*ztex.xmegaFlashPageSize()-1024, buf ); |
|
// read + verify data |
byte buf2[] = new byte[ztex.xmegaFlashPageSize()]; |
ztex.xmegaFlashRead ( ztex.xmegaFlashPages()*ztex.xmegaFlashPageSize()-1024, buf2, ztex.xmegaFlashPageSize()); |
int j = 0; |
for (int i=0; i<ztex.xmegaFlashPageSize(); i++ ) { |
if ( buf[i] != buf2[i] ) { |
if ( j<10 ) |
System.out.println("Error at " + i +": " + (buf[i] & 255) + " != " + (buf2[i] & 255)); |
j+=1; |
} |
} |
System.out.println(j + " Flash Errors"); |
|
// test ATxmega EEPROM by reading / writing random data |
// generate + write date |
random = new Random(); |
for (int i=0; i<ztex.xmegaEepromPageSize(); i++ ) |
buf[i] = (byte) random.nextInt(); |
ztex.xmegaEepromPageWrite ( ztex.xmegaEepromPages()*ztex.xmegaEepromPageSize()-64, buf ); |
|
// read + verify data |
ztex.xmegaEepromRead ( ztex.xmegaEepromPages()*ztex.xmegaEepromPageSize()-64, buf2, ztex.xmegaEepromPageSize()); |
j = 0; |
for (int i=0; i<ztex.xmegaEepromPageSize(); i++ ) { |
if ( buf[i] != buf2[i] ) { |
if ( j<10 ) |
System.out.println("Error at " + i +": " + (buf[i] & 255) + " != " + (buf2[i] & 255)); |
j+=1; |
} |
} |
System.out.println(j + " EEPROM Errors"); |
|
// test fuse by reading / writing JTAGUID |
// read old JTAGUID |
int i = ztex.xmegaFuseRead ( 0 ); |
System.out.print( "JTAGUID: 0x" + Integer.toHexString(i & 255) ); |
// write + read new JTAGUID |
ztex.xmegaFuseWrite ( 0, 0x56 ); |
System.out.print( " -> 0x" + Integer.toHexString(ztex.xmegaFuseRead ( 0 ) ) ); |
// write + read old JTAGUID |
ztex.xmegaFuseWrite ( 0, i ); |
System.out.println( " -> 0x" + Integer.toHexString(ztex.xmegaFuseRead ( 0 ) ) ); |
|
} |
catch (Exception e) { |
System.out.println("Error: "+e.getLocalizedMessage() ); |
} |
} |
|
} |
/nvmtest/nvmtest.c
0,0 → 1,37
/*! |
nvmtest -- ATxmega non volatile memory test |
Copyright (C) 2009-2010 ZTEX e.K. |
http://www.ztex.de |
|
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 |
published by the Free Software Foundation. |
|
This program is distributed in the hope that it will be useful, but |
WITHOUT ANY WARRANTY; without even the implied warranty of |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
General Public License for more details. |
|
You should have received a copy of the GNU General Public License |
along with this program; if not, see http://www.gnu.org/licenses/. |
!*/ |
|
#include[ztex-conf.h] // Loads the configuration macros, see ztex-conf.h for the available macros |
#include[ztex-utils.h] // include basic functions |
|
// select ZTEX USB-FPGA Module 1.2 with Experimental Board 1.10 as target |
IDENTITY_UFM_1_2(10.11.0.0,0); |
EXTENSION_EXP_1_10; |
|
// this product string is also used for identification by the host software |
#define[PRODUCT_STRING]["nvmtest for EXP-1.10"] |
|
// include the main part of the firmware kit, define the descriptors, ... |
#include[ztex.h] |
|
void main(void) |
{ |
// init everything |
init_USB(); |
} |
|
/nvmtest/nvmtest.sh
0,0 → 1,3
#make -C ../../ztex/java distclean all || exit |
#make distclean all || exit |
java -cp NVMTest.jar NVMTest $@ |
nvmtest/nvmtest.sh
Property changes :
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: nvmtest/Makefile
===================================================================
--- nvmtest/Makefile (nonexistent)
+++ nvmtest/Makefile (revision 5)
@@ -0,0 +1,21 @@
+#########################
+# configuration section #
+#########################
+
+ZTEXPREFIX=../../..
+
+JARTARGET=NVMTest.jar
+CLASSTARGETS=NVMTest.class
+CLASSEXTRADEPS=
+CLASSEXTRADEPS:=$(shell echo $(ZTEXPREFIX)/java/ztex/*.java)
+
+IHXTARGETS=nvmtest.ihx
+IHXEXTRADEPS=
+IHXEXTRADEPS:=$(shell echo $(ZTEXPREFIX)/include/*.h)
+EXTRAJARFILES=nvmtest.ihx
+
+################################
+# DO NOT CHANAGE THE FOLLOWING #
+################################
+
+include $(ZTEXPREFIX)/Makefile.mk
Index: nvmtest/Readme
===================================================================
--- nvmtest/Readme (nonexistent)
+++ nvmtest/Readme (revision 5)
@@ -0,0 +1,9 @@
+nvmtest
+-------
+
+This example requires the Experimental Board 1.10.
+
+It demonstrates the access to the non volatile memories (NVM) of the
+ATxmega using the JAVA API. The following NVW's are tested: Flash,
+EEPROM, Fuse and Production Signature Row.
+
Index: flashdemo/FlashDemo.java
===================================================================
--- flashdemo/FlashDemo.java (revision 4)
+++ flashdemo/FlashDemo.java (revision 5)
@@ -1,6 +1,6 @@
/*!
- flashdemo -- demo for Flash memory access from firmware and host software for ZTEX USB FPGA Module 1.2
- Copyright (C) 2009-2010 ZTEX e.K.
+ flashdemo -- demo for Flash memory access from firmware and host software for ZTEX USB-FPGA Module 1.2
+ Copyright (C) 2009-2011 ZTEX GmbH.
http://www.ztex.de
This program is free software; you can redistribute it and/or modify
/flashdemo/flashdemo.c
1,6 → 1,6
/*! |
flashdemo -- demo for Flash memory access from firmware and host software for ZTEX USB FPGA Module 1.2 |
Copyright (C) 2009-2010 ZTEX e.K. |
flashdemo -- demo for Flash memory access from firmware and host software for ZTEX USB-FPGA Module 1.2 |
Copyright (C) 2009-2011 ZTEX GmbH. |
http://www.ztex.de |
|
This program is free software; you can redistribute it and/or modify |
28,7 → 28,7
// this product string is also used for identification by the host software |
#define[PRODUCT_STRING]["Flash demo for UFM 1.2"] |
|
code char flash_string[] = "Hello World!"; |
__code char flash_string[] = "Hello World!"; |
|
// include the main part of the firmware kit, define the descriptors, ... |
#include[ztex.h] |
35,13 → 35,13
|
void main(void) |
{ |
xdata DWORD sector; |
__xdata DWORD sector; |
|
init_USB(); // init everything |
|
if ( flash_enabled ) { |
flash_read_init( 0 ); // prepare reading sector 0 |
flash_read((xdata BYTE*) §or, 4); // read the number of last sector |
flash_read((__xdata BYTE*) §or, 4); // read the number of last sector |
flash_read_finish(flash_sector_size - 4); // dummy-read the rest of the sector + finish read operation |
|
sector++; |
49,13 → 49,15
sector = 1; |
} |
|
flash_write_init( 0 ); // prepare writing sector 0 |
flash_write((xdata BYTE*) §or, 4); // write the current sector number |
flash_write_finish(flash_sector_size - 4); // dummy-write the rest of the sector + finish write operation |
flash_write_init( 0 ); // prepare writing sector 0 |
flash_write((__xdata BYTE*) §or, 4); // write the current sector number |
flash_write_finish_sector(flash_sector_size - 4); // dummy-write the rest of the sector + CRC |
flash_write_finish(); // finish write operation |
|
flash_write_init( sector ); // prepare writing sector sector |
flash_write((xdata BYTE*) flash_string, sizeof(flash_string)); // write the string |
flash_write_finish(flash_sector_size - sizeof(flash_string)); // dummy-write the rest of the sector + finish write operation |
flash_write_init( sector ); // prepare writing sector sector |
flash_write((__xdata BYTE*) flash_string, sizeof(flash_string)); // write the string |
flash_write_finish_sector(flash_sector_size - sizeof(flash_string)); // dummy-write the rest of the sector + CRC |
flash_write_finish(); // finish write operation |
} |
|
while (1) { } // twiddle thumbs |
/intraffic/InTraffic.java
1,6 → 1,6
/*! |
intraffic -- example showing how the EZ-USB FIFO interface is used on ZTEX USB FPGA Module 1.2 |
Copyright (C) 2009-2010 ZTEX e.K. |
intraffic -- example showing how the EZ-USB FIFO interface is used on ZTEX USB-FPGA Module 1.2 |
Copyright (C) 2009-2011 ZTEX GmbH. |
http://www.ztex.de |
|
This program is free software; you can redistribute it and/or modify |
/intraffic/intraffic.c
1,6 → 1,6
/*! |
intraffic -- example showing how the EZ-USB FIFO interface is used on ZTEX USB FPGA Module 1.2 |
Copyright (C) 2009-2010 ZTEX e.K. |
intraffic -- example showing how the EZ-USB FIFO interface is used on ZTEX USB-FPGA Module 1.2 |
Copyright (C) 2009-2011 ZTEX GmbH. |
http://www.ztex.de |
|
This program is free software; you can redistribute it and/or modify |
21,7 → 21,7
|
// 1024 (instead of 512) byte bulk transfers. |
// According to USB standard they are invalid but usually supported and 25% faster. |
#define[fastmode] |
//#define[fastmode] |
|
#ifdef[fastmode] |
// configure endpoint 2, in, quad buffered, 1024 bytes, interface 0 |
/intraffic/fpga/intraffic.ise
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/intraffic/fpga/intraffic.xise
80,7 → 80,7
<property xil_pn:name="Do Not Escape Signal and Instance Names in Netlist" xil_pn:value="false" xil_pn:valueState="default"/> |
<property xil_pn:name="Done (Output Events)" xil_pn:value="Default (4)" xil_pn:valueState="default"/> |
<property xil_pn:name="Drive Done Pin High" xil_pn:value="false" xil_pn:valueState="default"/> |
<property xil_pn:name="Enable BitStream Compression" xil_pn:value="false" xil_pn:valueState="default"/> |
<property xil_pn:name="Enable BitStream Compression" xil_pn:value="true" xil_pn:valueState="non-default"/> |
<property xil_pn:name="Enable Cyclic Redundancy Checking (CRC)" xil_pn:value="true" xil_pn:valueState="default"/> |
<property xil_pn:name="Enable Debugging of Serial Mode BitStream" xil_pn:value="false" xil_pn:valueState="default"/> |
<property xil_pn:name="Enable Enhanced Design Summary" xil_pn:value="true" xil_pn:valueState="default"/> |
/ucecho/UCEcho.java
1,6 → 1,6
/*! |
ucecho -- uppercase conversion example for ZTEX USB FPGA Module 1.2 |
Copyright (C) 2009-2010 ZTEX e.K. |
ucecho -- uppercase conversion example for ZTEX USB-FPGA Module 1.2 |
Copyright (C) 2009-2011 ZTEX GmbH. |
http://www.ztex.de |
|
This program is free software; you can redistribute it and/or modify |
/ucecho/ucecho.c
1,6 → 1,6
/*! |
ucecho -- uppercase conversion example for ZTEX USB FPGA Module 1.2 |
Copyright (C) 2009-2010 ZTEX e.K. |
ucecho -- uppercase conversion example for ZTEX USB-FPGA Module 1.2 |
Copyright (C) 2009-2011 ZTEX GmbH. |
http://www.ztex.de |
|
This program is free software; you can redistribute it and/or modify |
/ucecho/Readme
9,7 → 9,7
the FPGA and can be read back from Endpoint 2. |
|
This example does the same as the example in directory ../../all/ucecho |
except that the uppercase - lowercase conversion made by the FPGA. |
except that the uppercase - lowercase conversion is made by the FPGA. |
|
The driver (defined in UCEcho.java) uploads the the Firmware (ucecho.ihx) |
to the EZ-USB Microcontroller and the Bitstream (fpga/ucecho.bit) to the |
/ucecho/fpga/ucecho.ise
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/ucecho/fpga/ucecho.xise
82,7 → 82,7
<property xil_pn:name="Do Not Escape Signal and Instance Names in Netlist" xil_pn:value="false" xil_pn:valueState="default"/> |
<property xil_pn:name="Done (Output Events)" xil_pn:value="Default (4)" xil_pn:valueState="default"/> |
<property xil_pn:name="Drive Done Pin High" xil_pn:value="false" xil_pn:valueState="default"/> |
<property xil_pn:name="Enable BitStream Compression" xil_pn:value="false" xil_pn:valueState="default"/> |
<property xil_pn:name="Enable BitStream Compression" xil_pn:value="true" xil_pn:valueState="non-default"/> |
<property xil_pn:name="Enable Cyclic Redundancy Checking (CRC)" xil_pn:value="true" xil_pn:valueState="default"/> |
<property xil_pn:name="Enable Debugging of Serial Mode BitStream" xil_pn:value="false" xil_pn:valueState="default"/> |
<property xil_pn:name="Enable Enhanced Design Summary" xil_pn:value="true" xil_pn:valueState="default"/> |
/standalone/standalone.c
1,6 → 1,6
/*! |
standalone -- standalone firmware that supports FPGA configuration from FLASH and firmware loading from EEPROM for ZTEX USB FPGA Module 1.2 |
Copyright (C) 2009-2010 ZTEX e.K. |
standalone -- standalone firmware that supports FPGA configuration from Flash firmware loading from EEPROM for ZTEX USB-FPGA Module 1.2 |
Copyright (C) 2009-2011 ZTEX GmbH. |
http://www.ztex.de |
|
This program is free software; you can redistribute it and/or modify |
/lightshow/lightshow.sh
0,0 → 1,4
#make -C ../../../java distclean all || exit |
#make distclean all || exit |
#make || exit |
java -cp Lightshow.jar Lightshow $@ |
lightshow/lightshow.sh
Property changes :
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: lightshow/avr/lightshow.ihx
===================================================================
--- lightshow/avr/lightshow.ihx (nonexistent)
+++ lightshow/avr/lightshow.ihx (revision 5)
@@ -0,0 +1,45 @@
+:100000000C94FA000C941B010C941B010C941B0122
+:100010000C941B010C941B010C941B010C941B01F0
+:100020000C941B010C941B010C941B010C941B01E0
+:100030000C941B010C941B010C941B010C941B01D0
+:100040000C941B010C941B010C941B010C941B01C0
+:100050000C941B010C941B010C941B010C941B01B0
+:100060000C941B010C941B010C941B010C941B01A0
+:100070000C941B010C941B010C941B010C941B0190
+:100080000C941B010C941B010C941B010C941B0180
+:100090000C941B010C941B010C941B010C941B0170
+:1000A0000C941B010C941B010C941B010C941B0160
+:1000B0000C941B010C941B010C941B010C941B0150
+:1000C0000C941B010C941B010C941B010C941B0140
+:1000D0000C941B010C941B010C941B010C941B0130
+:1000E0000C941B010C941B010C941B010C941B0120
+:1000F0000C941B010C941B010C941B010C941B0110
+:100100000C941B010C941B010C941B010C941B01FF
+:100110000C941B010C941B010C941B010C941B01EF
+:100120000C941B010C941B010C941B010C941B01DF
+:100130000C941B010C941B010C941B010C941B01CF
+:100140000C941B010C941B010C941B010C941B01BF
+:100150000C941B010C941B010C941B010C941B01AF
+:100160000C941B010C941B010C941B010C941B019F
+:100170000C941B010C941B010C941B010C941B018F
+:100180000C941B010C941B010C941B010C941B017F
+:100190000C941B010C941B010C941B010C941B016F
+:1001A0000C941B010C941B010C941B010C941B015F
+:1001B0000C941B010C941B010C941B010C941B014F
+:1001C0000C941B010C941B010C941B010C941B013F
+:1001D0000C941B010C941B010C941B010C941B012F
+:1001E0000C941B010C941B010C941B010C941B011F
+:1001F0000C941B0111241FBECFEFDFE3DEBFCDBF88
+:1002000000E00CBF10E2A0E0B0E2E2EBF2E000E0C0
+:100210000BBF02C007900D92A030B107D9F710E2D2
+:10022000A0E0B0E201C01D92A030B107E1F70E944A
+:100230001D010C9457010C94000088ED77E084BFF9
+:10024000709350008091510087708730D9F788ED06
+:1002500071E084BF7093600084BF7093680084BFB6
+:100260007093400088ED71E084BF7093960082E047
+:10027000E0EBF0E0848380E8809360061092000752
+:100280001092E006809160068F60809360068FEF89
+:100290008093A006A0E6B6E0E0EAF6E080910807C9
+:1002A00014968C9314978091E8068483F7CFF89482
+:0202B000FFCF7E
+:00000001FF
Index: lightshow/avr/avrdude.sh
===================================================================
--- lightshow/avr/avrdude.sh (nonexistent)
+++ lightshow/avr/avrdude.sh (revision 5)
@@ -0,0 +1,2 @@
+make || exit
+avrdude -p x128a1 -c avrispmkii -P usb -e -U flash:w:test.ihx:i
lightshow/avr/avrdude.sh
Property changes :
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: lightshow/avr/lightshow.c
===================================================================
--- lightshow/avr/lightshow.c (nonexistent)
+++ lightshow/avr/lightshow.c (revision 5)
@@ -0,0 +1,76 @@
+/*!
+ lightshow -- lightshow on Experimental Board 1.10
+ Copyright (C) 2009-2010 ZTEX e.K.
+ http://www.ztex.de
+
+ 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
+ published by the Free Software Foundation.
+
+ This program is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, see http://www.gnu.org/licenses/.
+!*/
+
+#include
+
+#define F_CPU 32000000UL
+#include
+
+typedef uint8_t byte;
+
+int main(void)
+{
+ // enable 32.768 kHz, 32 MHz, 2 Mhz clocks
+ asm volatile (
+ "ldi r24,0xd8" "\n\t"
+ "ldi r23,7" "\n\t"
+ "out 0x34,r24" "\n\t"
+ "sts 0x50,r23"
+ ::: "r24", "r23"
+ );
+
+ // wait until clocks are ready
+ while ( (OSC.STATUS & 7) != 7 ) { }
+
+ // enable run time configuration of 32 MHz and 2 MHz clocks; select 32 MHz clock as system clock
+ asm volatile (
+ "ldi r24,0xd8" "\n\t"
+ "ldi r23,1" "\n\t"
+ "out 0x34,r24" "\n\t"
+ "sts 0x60,r23" "\n\t"
+ "out 0x34,r24" "\n\t"
+ "sts 0x68,r23" "\n\t"
+ "out 0x34,r24" "\n\t"
+ "sts 0x40,r23"
+ ::: "r24", "r23"
+ );
+
+ // disable JTAG at portb
+ asm volatile (
+ "ldi r24,0xd8" "\n\t"
+ "ldi r23,1" "\n\t"
+ "out 0x34,r24" "\n\t"
+ "sts 0x96,r23" "\n\t"
+ ::: "r24", "r23"
+ );
+
+ // clock output to PD7
+ PORTCFG.CLKEVOUT = 2;
+ PORTD.DIR = 128;
+
+ PORTJ.DIR = 0; // input: 4 LED's
+ PORTH.DIR = 0; // input: 8 LED's
+ PORTD.DIR |= 15; // output: 4 LED's
+ PORTF.DIR = 255; // output: 8 LED's
+
+ while (1) {
+ PORTD.OUT = PORTJ.IN;
+ PORTF.OUT = PORTH.IN;
+ }
+}
+
Index: lightshow/avr/Makefile
===================================================================
--- lightshow/avr/Makefile (nonexistent)
+++ lightshow/avr/Makefile (revision 5)
@@ -0,0 +1,16 @@
+AVRGCC=avr-gcc -std=gnu99 -save-temps -mmcu=atxmega128a1 -O2
+OBJ2HEX=avr-objcopy
+
+all: lightshow.ihx
+
+%.obj : %.c
+ $(AVRGCC) $< -o $@
+
+%.ihx : %.obj
+ $(OBJ2HEX) -R .eeprom -O ihex $< $@
+
+clean:
+ rm -f *.o *.i *.s *.obj *.old *.bak *~
+
+distclean:
+ rm -f *.ihx
Index: lightshow/Lightshow.java
===================================================================
--- lightshow/Lightshow.java (nonexistent)
+++ lightshow/Lightshow.java (revision 5)
@@ -0,0 +1,130 @@
+/*!
+ lightshow -- lightshow on ZTEX USB-FPGA Module 1.2 plus Experimental Board 1.10
+ Copyright (C) 2009-2011 ZTEX GmbH.
+ http://www.ztex.de
+
+ 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
+ published by the Free Software Foundation.
+
+ This program is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, see http://www.gnu.org/licenses/.
+!*/
+
+import java.io.*;
+import java.util.*;
+
+import ch.ntb.usb.*;
+
+import ztex.*;
+
+// *****************************************************************************
+// ******* ParameterException **************************************************
+// *****************************************************************************
+// Exception the prints a help message
+class ParameterException extends Exception {
+ public final static String helpMsg = new String (
+ "Parameters:\n"+
+ " -d Device Number (default: 0)\n" +
+ " -f Force uploads\n" +
+ " -p Print bus info\n" +
+ " -h This help" );
+
+ public ParameterException (String msg) {
+ super( msg + "\n" + helpMsg );
+ }
+}
+
+// *****************************************************************************
+// ******* Test0 ***************************************************************
+// *****************************************************************************
+class Lightshow extends Ztex1v1 {
+
+// ******* Lightshow ***********************************************************
+// constructor
+ public Lightshow ( ZtexDevice1 pDev ) throws UsbException {
+ super ( pDev );
+ }
+
+// ******* main ****************************************************************
+ public static void main (String args[]) {
+
+ int devNum = 0;
+ boolean force = false;
+ boolean workarounds = false;
+
+ try {
+// init USB stuff
+ LibusbJava.usb_init();
+
+// scan the USB bus
+ ZtexScanBus1 bus = new ZtexScanBus1( ZtexDevice1.ztexVendorId, ZtexDevice1.ztexProductId, true, false, 1);
+ if ( bus.numberOfDevices() <= 0) {
+ System.err.println("No devices found");
+ System.exit(0);
+ }
+
+// scan the command line arguments
+ for (int i=0; i=args.length) throw new Exception();
+ devNum = Integer.parseInt( args[i] );
+ }
+ catch (Exception e) {
+ throw new ParameterException("Device number expected after -d");
+ }
+ }
+ else if ( args[i].equals("-f") ) {
+ force = true;
+ }
+ else if ( args[i].equals("-p") ) {
+ bus.printBus(System.out);
+ System.exit(0);
+ }
+ else if ( args[i].equals("-p") ) {
+ bus.printBus(System.out);
+ System.exit(0);
+ }
+ else if ( args[i].equals("-h") ) {
+ System.err.println(ParameterException.helpMsg);
+ System.exit(0);
+ }
+ else throw new ParameterException("Invalid Parameter: "+args[i]);
+ }
+
+
+// create the main class
+ Lightshow ztex = new Lightshow ( bus.device(devNum) );
+
+// upload the firmware if necessary
+ if ( force || ! ztex.valid() || ! ztex.dev().productString().equals("lightshow for EXP-1.10") ) {
+ System.out.println("Firmware upload time: " + ztex.uploadFirmware( "lightshow.ihx", force ) + " ms");
+ }
+
+// check for Experimental Bord 1.10
+ if ( ! ztex.xmegaEnabled() )
+ throw new Exception("Experimental Board 1.10 required");
+
+// upload the bitstream if necessary
+ System.out.println("FPGA configuration time: " + ztex.configureFpga( "fpga/lightshow.bit" , true ) + " ms");
+
+// bitstream if necessary
+ System.out.println("AVR Firmware upload time: " + ztex.xmegaWriteFirmware( new IhxFile("avr/lightshow.ihx" ) ) + " ms");
+
+// program the ATxmega
+ System.out.println( ztex );
+
+ }
+ catch (Exception e) {
+ System.out.println("Error: "+e.getLocalizedMessage() );
+ }
+ }
+
+}
Index: lightshow/lightshow.c
===================================================================
--- lightshow/lightshow.c (nonexistent)
+++ lightshow/lightshow.c (revision 5)
@@ -0,0 +1,39 @@
+/*!
+ lightshow -- lightshow on ZTEX USB-FPGA Module 1.2 plus Experimental Board 1.10
+ Copyright (C) 2009-2011 ZTEX GmbH.
+ http://www.ztex.de
+
+ 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
+ published by the Free Software Foundation.
+
+ This program is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, see http://www.gnu.org/licenses/.
+!*/
+
+#include[ztex-conf.h] // Loads the configuration macros, see ztex-conf.h for the available macros
+#include[ztex-utils.h] // include basic functions
+
+IDENTITY_UFM_1_2(10.11.0.0,0);
+EXTENSION_EXP_1_10;
+
+// this product string is also used for identification by the host software
+#define[PRODUCT_STRING]["lightshow for EXP-1.10"]
+
+// include the main part of the firmware kit, define the descriptors, ...
+#include[ztex.h]
+
+void main(void)
+{
+// init everything
+ init_USB();
+
+ while ( 1 ) {
+ }
+}
+
Index: lightshow/fpga/lightshow.xise
===================================================================
--- lightshow/fpga/lightshow.xise (nonexistent)
+++ lightshow/fpga/lightshow.xise (revision 5)
@@ -0,0 +1,317 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Index: lightshow/fpga/lightshow.ucf
===================================================================
--- lightshow/fpga/lightshow.ucf (nonexistent)
+++ lightshow/fpga/lightshow.ucf (revision 5)
@@ -0,0 +1,16 @@
+NET "CLK" TNM_NET = "CLK";
+TIMESPEC "TS_CLK" = PERIOD "CLK" 20 ns HIGH 50 %;
+NET "CLK" LOC = "P124" | IOSTANDARD = LVCMOS33 ; # xmega clock
+
+NET "led<0>" LOC = "P86" | IOSTANDARD = LVCMOS33 | DRIVE = 12 ; # ph<0>
+NET "led<1>" LOC = "P89" | IOSTANDARD = LVCMOS33 | DRIVE = 12 ; # ph<1>
+NET "led<2>" LOC = "P92" | IOSTANDARD = LVCMOS33 | DRIVE = 12 ; # ph<2>
+NET "led<3>" LOC = "P95" | IOSTANDARD = LVCMOS33 | DRIVE = 12 ; # ph<3>
+NET "led<4>" LOC = "P97" | IOSTANDARD = LVCMOS33 | DRIVE = 12 ; # ph<4>
+NET "led<5>" LOC = "P99" | IOSTANDARD = LVCMOS33 | DRIVE = 12 ; # ph<5>
+NET "led<6>" LOC = "P102" | IOSTANDARD = LVCMOS33 | DRIVE = 12 ; # ph<6>
+NET "led<7>" LOC = "P104" | IOSTANDARD = LVCMOS33 | DRIVE = 12 ; # ph<7>
+NET "led<8>" LOC = "P113" | IOSTANDARD = LVCMOS33 | DRIVE = 12 ; # pj<0>
+NET "led<9>" LOC = "P112" | IOSTANDARD = LVCMOS33 | DRIVE = 12 ; # pj<1>
+NET "led<10>" LOC = "P118" | IOSTANDARD = LVCMOS33 | DRIVE = 12 ; # pj<2>
+NET "led<11>" LOC = "P116" | IOSTANDARD = LVCMOS33 | DRIVE = 12 ; # pj<3>
Index: lightshow/fpga/lightshow.ise
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Index: lightshow/fpga/lightshow.ise
===================================================================
--- lightshow/fpga/lightshow.ise (nonexistent)
+++ lightshow/fpga/lightshow.ise (revision 5)
lightshow/fpga/lightshow.ise
Property changes :
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Index: lightshow/fpga/lightshow.vhd
===================================================================
--- lightshow/fpga/lightshow.vhd (nonexistent)
+++ lightshow/fpga/lightshow.vhd (revision 5)
@@ -0,0 +1,84 @@
+library ieee;
+use IEEE.std_logic_1164.all;
+use IEEE.std_logic_arith.all;
+use IEEE.std_logic_unsigned.all;
+
+entity lightshow is
+ port(
+ led : out std_logic_vector(11 downto 0);
+ CLK : in std_logic -- 32 MHz
+ );
+end lightshow;
+
+--signal declaration
+architecture RTL of lightshow is
+
+type tPattern is array(11 downto 0) of integer range 0 to 15;
+
+signal pattern1 : tPattern := (0, 1, 2, 3, 4, 5, 6, 5, 4, 3, 2, 1);
+signal pattern2 : tPattern := (6, 5, 4, 3, 2, 1, 0, 1, 2, 3, 4, 5);
+signal pattern3 : tPattern := (0, 1, 4, 9, 4, 1, 0, 0, 0, 0, 0, 0);
+
+type tXlatTable1 is array(0 to 12) of integer range 0 to 1023;
+constant xt1 : tXlatTable1 := (0, 0, 1, 4, 13, 31, 64, 118, 202, 324, 493, 722, 1023);
+type tXlatTable2 is array(0 to 9) of integer range 0 to 255;
+--constant xt2 : tXlatTable2 := (0, 1, 11, 38, 90, 175, 303, 481, 718, 1023);
+constant xt2 : tXlatTable2 := (0, 0, 3, 9, 22, 44, 76, 120, 179, 255);
+
+signal cp1 : std_logic_vector(22 downto 0);
+signal cp2 : std_logic_vector(22 downto 0);
+signal cp3 : std_logic_vector(22 downto 0);
+signal d : std_logic_vector(16 downto 0);
+
+begin
+ dpCLK: process(CLK)
+ begin
+ if CLK' event and CLK = '1' then
+
+ if ( cp1 = conv_std_logic_vector(3000000,23) )
+ then
+ pattern1(10 downto 0) <= pattern1(11 downto 1);
+ pattern1(11) <= pattern1(0);
+ cp1 <= (others => '0');
+ else
+ cp1 <= cp1 + 1;
+ end if;
+
+ if ( cp2 = conv_std_logic_vector(2200000,23) )
+ then
+ pattern2(10 downto 0) <= pattern2(11 downto 1);
+ pattern2(11) <= pattern2(0);
+ cp2 <= (others => '0');
+ else
+ cp2 <= cp2 + 1;
+ end if;
+
+ if ( cp3 = conv_std_logic_vector(1500000,23) )
+ then
+ pattern3(11 downto 1) <= pattern3(10 downto 0);
+ pattern3(0) <= pattern3(11);
+ cp3 <= (others => '0');
+ else
+ cp3 <= cp3 + 1;
+ end if;
+
+ if ( d = conv_std_logic_vector(1278*64-1,17) )
+ then
+ d <= (others => '0');
+ else
+ d <= d + 1;
+ end if;
+
+ for i in 0 to 11 loop
+ if ( d(16 downto 6) < conv_std_logic_vector( xt1(pattern1(i) + pattern2(i)) + xt2(pattern3(i)) ,11) )
+ then
+ led(i) <= '1';
+ else
+ led(i) <= '0';
+ end if;
+ end loop;
+
+ end if;
+ end process dpCLK;
+
+end RTL;
Index: lightshow/fpga/clean.sh
===================================================================
--- lightshow/fpga/clean.sh (nonexistent)
+++ lightshow/fpga/clean.sh (revision 5)
@@ -0,0 +1,80 @@
+#!/bin/bash
+
+# This files / directories from this directory will not be removed
+# Filenames with spaces or other spuid characters will be ignored
+sourcefiles="*.vhd *.ucf *.sh *.ise *.bit *.bin *.xise"
+subdirs="ipcore_dir"
+
+
+# This sould not be edited.
+list_files() {
+ if [ "$2" != "" ]; then
+ echo "$1"
+ for i in $2; do
+ echo " $i"
+ done
+ fi
+}
+
+rmfiles=""
+rmdirs=""
+keepfiles=""
+keepdirs=""
+allfiles=`ls -A`
+for f in $allfiles; do
+ keep=false
+ for i in $sourcefiles; do
+ if [ "$i" == "$f" ]; then
+ keep=true
+ fi
+ done
+ for i in $subdirs; do
+ if [ "$i" == "$f" ]; then
+ keep=true
+ fi
+ done
+ if [ -d "$f" ]; then
+ if $keep; then
+ keepdirs+=" $f"
+ else
+ rmdirs+=" $f"
+ fi
+ fi
+ if [ -f "$f" ]; then
+ if $keep; then
+ keepfiles+=" $f"
+ else
+ rmfiles+=" $f"
+ fi
+ fi
+done
+
+echo
+echo "Directory $PWD:"
+list_files "This directories will NOT be removed:" "$keepdirs"
+list_files "This files will NOT be removed:" "$keepfiles"
+list_files "This directories will be removed:" "$rmdirs"
+list_files "This files will be removed:" "$rmfiles"
+
+if [ "$rmfiles" == "" -a "$rmdirs" == "" ]; then
+ c="yes"
+else
+ echo -n 'Confirm this by entering "yes": '
+ read c
+fi
+
+if [ "$c" == "yes" ]; then
+ [ "$rmfiles" != "" ] && rm $rmfiles
+ [ "$rmdirs" != "" ] && rm -r $rmdirs
+
+ for d in $subdirs; do
+ if [ -x "$d/clean.sh" ]; then
+ cd $d
+ ./clean.sh || exit 1
+ cd ..
+ fi
+ done
+
+ exit 0
+fi
+exit 1
lightshow/fpga/clean.sh
Property changes :
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: lightshow/lightshow.bat
===================================================================
--- lightshow/lightshow.bat (nonexistent)
+++ lightshow/lightshow.bat (revision 5)
@@ -0,0 +1,2 @@
+java -cp Lightshow.jar Lightshow
+pause
Index: lightshow/Makefile
===================================================================
--- lightshow/Makefile (nonexistent)
+++ lightshow/Makefile (revision 5)
@@ -0,0 +1,21 @@
+#########################
+# configuration section #
+#########################
+
+ZTEXPREFIX=../../..
+
+JARTARGET=Lightshow.jar
+CLASSTARGETS=Lightshow.class
+CLASSEXTRADEPS=
+#CLASSEXTRADEPS:=$(shell echo $(ZTEXPREFIX)/java/ztex/*.java)
+
+IHXTARGETS=lightshow.ihx
+IHXEXTRADEPS=
+#IHXEXTRADEPS:=$(shell echo $(ZTEXPREFIX)/include/*.h)
+EXTRAJARFILES=lightshow.ihx avr/lightshow.ihx fpga/lightshow.bit
+
+################################
+# DO NOT CHANAGE THE FOLLOWING #
+################################
+
+include $(ZTEXPREFIX)/Makefile.mk
Index: lightshow/Readme
===================================================================
--- lightshow/Readme (nonexistent)
+++ lightshow/Readme (revision 5)
@@ -0,0 +1,6 @@
+lightshow
+---------
+
+This example requires the Experimental Board 1.10.
+
+It implements a light show using the LED's on the board.
Index: Makefile
===================================================================
--- Makefile (revision 4)
+++ Makefile (revision 5)
@@ -1,4 +1,4 @@
-DIRS=ucecho flashdemo flashbench intraffic standalone
+DIRS=ucecho flashdemo flashbench intraffic standalone nvmtest lightshow
.PHONY: default all clean distclean
/flashbench/FlashBench.java
1,6 → 1,6
/*! |
flashbench -- Flash memory benchmark for ZTEX USB FPGA Module 1.2 |
Copyright (C) 2009-2010 ZTEX e.K. |
flashbench -- Flash memory benchmark for ZTEX USB-FPGA Module 1.2 |
Copyright (C) 2009-2011 ZTEX GmbH. |
http://www.ztex.de |
|
This program is free software; you can redistribute it and/or modify |
56,29 → 56,31
// ******* testRW ************************************************************** |
// measures read + write performance |
public double testRW ( int num ) throws UsbException, InvalidFirmwareException, CapabilityException { |
byte[] buf1 = new byte[flashSectorSize()]; |
byte[] buf2 = new byte[flashSectorSize()]; |
int secNum = 2048 / flashSectorSize(); |
byte[] buf1 = new byte[flashSectorSize() * secNum]; |
byte[] buf2 = new byte[flashSectorSize() * secNum]; |
int errors = 0; |
|
long t0 = new Date().getTime(); |
|
for ( int i=0; i<num; i++ ) { |
for ( int i=0; i<num; i+=secNum ) { |
int l = Math.min(num-i,secNum); |
int j=(int) Math.round(65535*Math.random()); |
for (int k=0; k<flashSectorSize(); k++) { |
for (int k=0; k<flashSectorSize()*l; k++) { |
buf1[k] = (byte) (j & 255); |
j+=57; |
} |
|
System.out.print("Sector " + (i+1) + "/" + num+ " " + Math.round(10000.0*(i+1)/num)/100.0 + "% \r"); |
flashWriteSector(i,buf1); |
flashReadSector(i,buf2); |
System.out.print("Sector " + (i+l) + "/" + num+ " " + Math.round(10000.0*(i+1)/num)/100.0 + "% \r"); |
flashWriteSector(i,l,buf1); |
flashReadSector(i,l,buf2); |
|
int diffs=flashSectorSize(); |
for (int k=0; k<flashSectorSize(); k++) |
int diffs=flashSectorSize()*l; |
for (int k=0; k<flashSectorSize()*l; k++) |
if ( buf1[k] == buf2[k] ) |
diffs -= 1; |
if ( diffs!=0 && errors==0) { |
System.out.print("Error occured: Sector " + i +": " + diffs + " differences: "); |
if ( diffs!=0 /*&& errors==0 */) { |
System.out.println("Error occured at sector " + i +": " + diffs + " differences"); |
} |
if ( diffs!=0 ) |
errors+=1; |
91,15 → 93,17
// ******* testW ************************************************************** |
// measures write performance |
public double testW ( int num, int seed ) throws UsbException, InvalidFirmwareException, CapabilityException { |
byte[] buf = new byte[flashSectorSize()]; |
int secNum = 2048 / flashSectorSize(); |
byte[] buf = new byte[flashSectorSize() * secNum]; |
long t0 = new Date().getTime(); |
for ( int i=0; i<num; i++ ) { |
System.out.print("Sector " + (i+1) + "/" + num+ " " + Math.round(10000.0*(i+1)/num)/100.0 + "% \r"); |
for (int k=0; k<flashSectorSize(); k++) { |
for ( int i=0; i<num; i+=secNum ) { |
int j = Math.min(num-i,secNum); |
System.out.print("Sector " + (i+j) + "/" + num+ " " + Math.round(10000.0*(i+1)/num)/100.0 + "% \r"); |
for (int k=0; k<flashSectorSize()*j; k++) { |
buf[k] = (byte) (seed & 255); |
seed+=79; |
} |
flashWriteSector(i,buf); |
flashWriteSector(i,j,buf); |
} |
return num*512.0/(new Date().getTime() - t0); |
} |
107,20 → 111,22
// ******* testR ************************************************************** |
// measures read performance |
public double testR ( int num, int seed ) throws UsbException, InvalidFirmwareException, CapabilityException { |
byte[] buf = new byte[flashSectorSize()]; |
int secNum = 2048 / flashSectorSize(); |
byte[] buf = new byte[flashSectorSize() * secNum]; |
int errors = 0; |
long t0 = new Date().getTime(); |
for ( int i=0; i<num; i++ ) { |
System.out.print("Sector " + (i+1) + "/" + num+ " " + Math.round(10000.0*(i+1)/num)/100.0 + "% \r"); |
flashReadSector(i,buf); |
int diffs = flashSectorSize(); |
for (int k=0; k<flashSectorSize(); k++) { |
for ( int i=0; i<num; i+=secNum ) { |
int j = Math.min(num-i,secNum); |
System.out.print("Sector " + (i+j) + "/" + num+ " " + Math.round(10000.0*(i+1)/num)/100.0 + "% \r"); |
flashReadSector(i,j,buf); |
int diffs = flashSectorSize()*j; |
for (int k=0; k<flashSectorSize()*j; k++) { |
if ( buf[k] == (byte) (seed & 255) ) |
diffs-=1; |
seed+=79; |
} |
if ( diffs!=0 && errors==0 ) { |
System.out.print("Error occured: Sector " + i +": " + diffs + " differences: "); |
System.out.println("Error occured at sector " + i +": " + diffs + " differences"); |
} |
if ( diffs!=0 ) |
errors+=1; |
/flashbench/flashbench.c
1,6 → 1,6
/*! |
flashbench -- Flash memory benchmark for ZTEX USB FPGA Module 1.2 |
Copyright (C) 2009-2010 ZTEX e.K. |
flashbench -- Flash memory benchmark for ZTEX USB-FPGA Module 1.2 |
Copyright (C) 2009-2011 ZTEX GmbH. |
http://www.ztex.de |
|
This program is free software; you can redistribute it and/or modify |