framelist.java
来自「纯java操作系统jnode,安装简单和操作简单的个人使用的Java操作系统」· Java 代码 · 共 86 行
JAVA
86 行
/*
* $Id: FrameList.java,v 1.1 2003/11/25 11:42:17 epr Exp $
*/
package org.jnode.driver.usb.uhci;
import org.jnode.system.ResourceManager;
/**
* @author Ewout Prangsma (epr@users.sourceforge.net)
*/
public class FrameList extends AbstractStructure {
/** Shadow list */
private final AbstractStructure[] list = new AbstractStructure[1024];
/**
* Create a new instance
*
* @param rm
*/
public FrameList(ResourceManager rm) {
super(rm, 4096, 4096);
for (int i = 0; i < 1024; i++) {
setListPointerInvalid(i);
}
}
/**
* Set the list pointer to the given transfer descriptor.
*
* @param frame
* The framenumber 0..1023
* @param td
*/
public final void setListPointer(int frame, TransferDescriptor td) {
final int ptr = td.getDescriptorAddress() & 0xFFFFFFF0;
this.list[frame] = td;
setInt(frame << 2, ptr);
}
/**
* Set the list pointer to the given queue head.
*
* @param frame
* The framenumber 0..1023
* @param qh
* @param depthFirst
* If true, the next queue is processed depth first, otherwise the next queue is
* processed breadth first
*/
public final void setListPointer(int frame, QueueHead qh, boolean depthFirst) {
final int ptr = (qh.getDescriptorAddress() & 0xFFFFFFF0) | 0x2 | (depthFirst ? 0x4 : 0x0);
this.list[frame] = qh;
setInt(frame << 2, ptr);
}
/**
* Set the list pointer as invalid
*
* @param frame
* The framenumber 0..1023
*/
public final void setListPointerInvalid(int frame) {
setInt(frame << 2, 0);
this.list[frame] = null;
}
/**
* Get the list pointer at a given frame
*
* @param frame
* The framenumber 0..1023
* @return A TransferDescriptor, a QueueHead or null.
*/
public final AbstractStructure getListPointer(int frame) {
return this.list[frame];
}
/**
* Gets the number of elements in this list.
*/
public final int getSize() {
return 1024;
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?