usbbus.java
来自「纯java操作系统jnode,安装简单和操作简单的个人使用的Java操作系统」· Java 代码 · 共 56 行
JAVA
56 行
/*
* $Id: USBBus.java,v 1.1 2003/11/25 11:41:20 epr Exp $
*/
package org.jnode.driver.usb;
import org.jnode.driver.Bus;
import org.jnode.driver.Device;
/**
* @author epr
*/
public class USBBus extends Bus {
/** Bitmap with in use device id's */
private final boolean devIdsInUse[];
/** The Host Controller API for this bus */
private final USBHostControllerAPI hcApi;
/**
* @param parent
*/
public USBBus(Device parent, USBHostControllerAPI hcApi) {
super(parent);
this.hcApi = hcApi;
this.devIdsInUse = new boolean[128];
}
/**
* Allocate a new device id.
*/
final synchronized int allocDeviceID() {
final int max = devIdsInUse.length;
for (int i = 1; i < max; i++) {
if (!devIdsInUse[i]) {
devIdsInUse[i] = true;
return i;
}
}
throw new IllegalArgumentException("Too many allocated USB device id's");
}
/**
* Free a given device id.
*/
final synchronized void freeDeviceID(int devId) {
devIdsInUse[devId] = false;
}
/**
* @return Returns the hcApi.
*/
public USBHostControllerAPI getHcApi() {
return this.hcApi;
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?