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/libusbJava-src/ch
- from Rev 2 to Rev 5
- ↔ Reverse comparison
Rev 2 → Rev 5
/ntb/usb/Device.java
36,7 → 36,7
|
private int dev_configuration, dev_interface, dev_altinterface; |
|
private int usbDevHandle; |
private long usbDevHandle; |
|
private boolean resetOnFirstOpen, resetDone; |
|
194,7 → 194,7
dev = initDevice(idVendor, idProduct, filename); |
|
if (dev != null) { |
int res = LibusbJava.usb_open(dev); |
long res = LibusbJava.usb_open(dev); |
if (res == 0) { |
throw new USBException("LibusbJava.usb_open: " |
+ LibusbJava.usb_strerror()); |
597,7 → 597,7
* @throws USBException |
* throws an USBException if the action fails |
*/ |
private void claim_interface(int usb_dev_handle, int configuration, |
private void claim_interface(long usb_dev_handle, int configuration, |
int interface_, int altinterface) throws USBException { |
if (LibusbJava.usb_set_configuration(usb_dev_handle, configuration) < 0) { |
usbDevHandle = 0; |
634,7 → 634,7
* @throws USBException |
* throws an USBException if the action fails |
*/ |
private void release_interface(int dev_handle, int interface_) |
private void release_interface(long dev_handle, int interface_) |
throws USBException { |
if (LibusbJava.usb_release_interface(dev_handle, interface_) < 0) { |
usbDevHandle = 0; |
/ntb/usb/Usb_Interface_Descriptor.java
51,7 → 51,7
} |
|
/** |
* Returns the value used to select the alternate setting ({@link LibusbJava#usb_set_altinterface(int, int)}).<br> |
* Returns the value used to select the alternate setting ({@link LibusbJava#usb_set_altinterface(long, int)}).<br> |
* |
* @return the alternate setting |
*/ |
/ntb/usb/Usb_Config_Descriptor.java
42,7 → 42,7
private int extralen; |
|
/** |
* Returns the value to use as an argument to select this configuration ({@link LibusbJava#usb_set_configuration(int, int)}). |
* Returns the value to use as an argument to select this configuration ({@link LibusbJava#usb_set_configuration(long, int)}). |
* |
* @return the value to use as an argument to select this configuration |
*/ |
/ntb/usb/LibusbJava.java
100,7 → 100,7
* @return a handle used in future communication with the device. 0 if an |
* error has occurred. |
*/ |
public static native int usb_open(Usb_Device dev); |
public static native long usb_open(Usb_Device dev); |
|
/** |
* <code>usb_close</code> closes a device opened with |
110,7 → 110,7
* The handle to the device. |
* @return 0 on success or < 0 on error. |
*/ |
public static native int usb_close(int dev_handle); |
public static native int usb_close(long dev_handle); |
|
/** |
* Sets the active configuration of a device |
122,7 → 122,7
* bConfigurationValue. |
* @return 0 on success or < 0 on error. |
*/ |
public static native int usb_set_configuration(int dev_handle, |
public static native int usb_set_configuration(long dev_handle, |
int configuration); |
|
/** |
135,7 → 135,7
* bAlternateSetting. |
* @return 0 on success or < 0 on error. |
*/ |
public static native int usb_set_altinterface(int dev_handle, int alternate); |
public static native int usb_set_altinterface(long dev_handle, int alternate); |
|
/** |
* Clears any halt status on an endpoint. |
146,7 → 146,7
* The value specified in the descriptor field bEndpointAddress. |
* @return 0 on success or < 0 on error. |
*/ |
public static native int usb_clear_halt(int dev_handle, int ep); |
public static native int usb_clear_halt(long dev_handle, int ep); |
|
/** |
* Resets a device by sending a RESET down the port it is connected to.<br> |
160,7 → 160,7
* The handle to the device. |
* @return 0 on success or < 0 on error. |
*/ |
public static native int usb_reset(int dev_handle); |
public static native int usb_reset(long dev_handle); |
|
/** |
* Claim an interface of a device.<br> |
176,7 → 176,7
* bInterfaceNumber. |
* @return 0 on success or < 0 on error. |
*/ |
public static native int usb_claim_interface(int dev_handle, int interface_); |
public static native int usb_claim_interface(long dev_handle, int interface_); |
|
/** |
* Releases a previously claimed interface |
188,7 → 188,7
* bInterfaceNumber. |
* @return 0 on success or < 0 on error. |
*/ |
public static native int usb_release_interface(int dev_handle, |
public static native int usb_release_interface(long dev_handle, |
int interface_); |
|
// Control Transfers |
207,7 → 207,7
* @param timeout |
* @return the number of bytes written/read or < 0 on error. |
*/ |
public static native int usb_control_msg(int dev_handle, int requesttype, |
public static native int usb_control_msg(long dev_handle, int requesttype, |
int request, int value, int index, byte[] bytes, int size, |
int timeout); |
|
221,7 → 221,7
* @param langid |
* @return the descriptor String or null |
*/ |
public static native String usb_get_string(int dev_handle, int index, |
public static native String usb_get_string(long dev_handle, int index, |
int langid); |
|
/** |
234,13 → 234,13
* @param index |
* @return the descriptor String or null |
*/ |
public static native String usb_get_string_simple(int dev_handle, int index); |
public static native String usb_get_string_simple(long dev_handle, int index); |
|
/** |
* Retrieves a descriptor from the device identified by the type and index |
* of the descriptor from the default control pipe.<br> |
* <br> |
* See {@link #usb_get_descriptor_by_endpoint(int, int, byte, byte, int)} |
* See {@link #usb_get_descriptor_by_endpoint(long, int, byte, byte, int)} |
* for a function that allows the control endpoint to be specified. |
* |
* @param dev_handle |
252,7 → 252,7
* resulting String) |
* @return the descriptor String or null |
*/ |
public static native String usb_get_descriptor(int dev_handle, byte type, |
public static native String usb_get_descriptor(long dev_handle, byte type, |
byte index, int size); |
|
/** |
269,7 → 269,7
* resulting String) |
* @return the descriptor String or null |
*/ |
public static native String usb_get_descriptor_by_endpoint(int dev_handle, |
public static native String usb_get_descriptor_by_endpoint(long dev_handle, |
int ep, byte type, byte index, int size); |
|
// Bulk Transfers |
284,7 → 284,7
* @param timeout |
* @return the number of bytes written on success or < 0 on error. |
*/ |
public static native int usb_bulk_write(int dev_handle, int ep, |
public static native int usb_bulk_write(long dev_handle, int ep, |
byte[] bytes, int size, int timeout); |
|
/** |
298,7 → 298,7
* @param timeout |
* @return the number of bytes read on success or < 0 on error. |
*/ |
public static native int usb_bulk_read(int dev_handle, int ep, |
public static native int usb_bulk_read(long dev_handle, int ep, |
byte[] bytes, int size, int timeout); |
|
// Interrupt Transfers |
313,7 → 313,7
* @param timeout |
* @return the number of bytes written on success or < 0 on error. |
*/ |
public static native int usb_interrupt_write(int dev_handle, int ep, |
public static native int usb_interrupt_write(long dev_handle, int ep, |
byte[] bytes, int size, int timeout); |
|
/** |
327,7 → 327,7
* @param timeout |
* @return the number of bytes read on success or < 0 on error. |
*/ |
public static native int usb_interrupt_read(int dev_handle, int ep, |
public static native int usb_interrupt_read(long dev_handle, int ep, |
byte[] bytes, int size, int timeout); |
|
/** |
359,10 → 359,22
private static native int usb_error_no(int value); |
|
static { |
// System.out.println("os.name: " + System.getProperty("os.name")); |
// System.out.println("os.arch: " + System.getProperty("os.arch")); |
String os = System.getProperty("os.name"); |
if (os.contains("Windows")) { |
LibLoader.load( "libusbJava" ); |
} else { |
if ( System.getProperty("os.arch").equalsIgnoreCase("amd64") ) { |
LibLoader.load( "libusbJava64" ); |
} |
else { |
LibLoader.load( "libusbJava32" ); |
} |
} |
else if ( System.getProperty("os.arch").equalsIgnoreCase("amd64") ) { |
LibLoader.load( "usbJava64" ); |
// System.err.println("loaded libusbJava64"); |
} |
else { |
try { |
LibLoader.load( "usbJavaSh" ); |
// System.err.println("loaded libusbJavaSh"); |
/ntb/usb/Usb_Descriptor.java
14,7 → 14,7
public class Usb_Descriptor { |
|
/** |
* Descriptor types ({@link #bDescriptorType}). |
* Descriptor types. |
*/ |
public static final int USB_DT_DEVICE = 0x01, USB_DT_CONFIG = 0x02, |
USB_DT_STRING = 0x03, USB_DT_INTERFACE = 0x04, |
21,13 → 21,13
USB_DT_ENDPOINT = 0x05; |
|
/** |
* Descriptor types ({@link #bDescriptorType}). |
* Descriptor types. |
*/ |
public static final int USB_DT_HID = 0x21, USB_DT_REPORT = 0x22, |
USB_DT_PHYSICAL = 0x23, USB_DT_HUB = 0x29; |
|
/** |
* Descriptor sizes per descriptor type ({@link #bLength}). |
* Descriptor sizes per descriptor type. |
*/ |
public static final int USB_DT_DEVICE_SIZE = 18, USB_DT_CONFIG_SIZE = 9, |
USB_DT_INTERFACE_SIZE = 9, USB_DT_ENDPOINT_SIZE = 7, |