head 1.4;
access;
symbols
bg2_23:1.4
bg2_22:1.4
bg2_21:1.4
bg2_20:1.4
bg2_16:1.4
bg2_15:1.4
bg2_12:1.4
bg2_07:1.4
isorc2008_submission:1.3
handbook_alpha_edition:1.3
jtres2007_submission:1.3
bg1_07:1.3
bg1_06:1.3
bg1_05:1.3
TAL_101:1.3
TAL_100:1.3
jtres_submission:1.3
wises06_submission:1.3
lctes2006_submission:1.2
rtgc_isorc2006:1.2.0.4
isorc2006:1.2.0.2
rtgc_paper:1.2;
locks; strict;
comment @# @;
1.4
date 2008.02.24.20.01.57; author martin; state Exp;
branches;
next 1.3;
commitid 5ce747c1cd324567;
1.3
date 2006.03.06.22.53.01; author martin; state Exp;
branches;
next 1.2;
commitid 9a5440cbd2b4567;
1.2
date 2005.08.27.20.01.34; author martin; state Exp;
branches;
next 1.1;
commitid 69404310c69b4567;
1.1
date 2005.08.27.17.48.06; author martin; state Exp;
branches;
next ;
commitid 3d8b4310a7534567;
desc
@@
1.4
log
@JOP goes GPL
@
text
@/*
This file is part of JOP, the Java Optimized Processor
see
Copyright (C) 2001-2008, Martin Schoeberl (martin@@jopdesign.com)
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
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 .
*/
/*
* Created on 30.05.2005
*
*/
package wishbone;
import com.jopdesign.sys.Const;
import com.jopdesign.sys.Native;
/**
* @@author admin
*
*/
public class Usb {
public static void main(String[] args) {
System.out.println("USB Test");
read();
}
public static void echo() {
int val, flags;
for(;;) {
flags = Native.rdMem(Const.IO_USB_STATUS);
if ((flags & Const.MSK_UA_RDRF)!=0) {
val = Native.rdMem(Const.IO_USB_DATA);
if ((flags & Const.MSK_UA_TDRE)!=0) {
Native.wrMem(val, Const.IO_USB_DATA);
}
}
}
}
public static void read() {
int tim = Native.rd(Const.IO_US_CNT)+1000000;
int cnt = 0;
for(;;) {
while ((Native.rdMem(Const.IO_USB_STATUS) & Const.MSK_UA_RDRF)!=0) {
Native.rdMem(Const.IO_USB_DATA);
++cnt;
}
if (tim-Native.rd(Const.IO_US_CNT) < 0) {
cnt /= 1024;
System.out.print(cnt);
System.out.print(" KB/s \r");
cnt = 0;
tim = Native.rd(Const.IO_US_CNT)+1000000;;
}
}
}
public static void write() {
int tim = Native.rd(Const.IO_US_CNT)+1000000;
int cnt = 0;
for(;;) {
while ((Native.rdMem(Const.IO_USB_STATUS) & Const.MSK_UA_TDRE)!=0) {
Native.wrMem('x', Const.IO_USB_DATA);
++cnt;
}
if (tim-Native.rd(Const.IO_US_CNT) < 0) {
cnt /= 1024;
System.out.print(cnt);
System.out.print(" KB/s \r");
cnt = 0;
tim = Native.rd(Const.IO_US_CNT)+1000000;;
}
}
}
}
@
1.3
log
@corrected syntax errors
@
text
@d2 20
@
1.2
log
@no message
@
text
@d26 1
a26 1
flags = Native.rdMem(Const.WB_USB_STATUS);
d28 1
a28 1
val = Native.rdMem(Const.WB_USB_DATA);
d30 1
a30 1
Native.wrMem(val, Const.WB_USB_DATA);
a37 1
int val, flags;
d41 2
a42 2
while ((Native.rdMem(Const.WB_USB_STATUS) & Const.MSK_UA_RDRF)!=0) {
Native.rdMem(Const.WB_USB_DATA);
a56 1
int val, flags;
d60 2
a61 2
while ((Native.rdMem(Const.WB_USB_STATUS) & Const.MSK_UA_TDRE)!=0) {
Native.wrMem('x', Const.WB_USB_DATA);
@
1.1
log
@USB interface as additional download interface for JOP
@
text
@d17 7
a23 3
System.out.println(Const.WB_USB_STATUS);
System.out.println(Const.WB_USB_DATA);
a28 1
System.out.print((char) val);
d34 23
d58 16
d75 1
@