/** Sets certain bits of the command register on/off */ protected final void setCommandBits(int mask, boolean on) { int cmd = io.inPortWord(base + USBCMD); if (on) { cmd |= mask; } else { cmd &= ~mask; } io.outPortWord(base + USBCMD, cmd); }
/** Sets certain bits of the port1 status and control register on/off */ protected final void setPortSCBits(int port, int mask, boolean on) { int sc = io.inPortWord(base + USBPORTSC1 + (port << 1)); sc &= 0xFFF5; if (on) { sc |= mask; } else { sc &= ~mask; } io.outPortWord(base + USBPORTSC1 + (port << 1), sc); }
/** * Gets a word from the data register * * @return a word from the data register */ public final int getDataReg() { return cmdBlock.inPortWord(cmdBlockStart + RW16_DATA_OFFSET); }
/** Gets the frame number register */ protected final int getFrameNumber() { return io.inPortWord(base + USBFRNUM); }
/** Gets the interrupt enable register */ protected final int getInterruptEnable() { return io.inPortWord(base + USBINTR); }
/** Are the given bits in the status register set? */ protected final boolean getStatusBits(int mask) { return ((io.inPortWord(base + USBSTS) & mask) == mask); }
/** Gets the status register */ protected final int getStatus() { return io.inPortWord(base + USBSTS); }
/** Are the given bits in the command register set? */ protected final boolean getCommandBits(int mask) { return ((io.inPortWord(base + USBCMD) & mask) == mask); }
/** Gets the command register */ protected final int getCommand() { return io.inPortWord(base + USBCMD); }
/** Are the given bits in the port status and control register set? */ protected final boolean getPortSCBits(int port, int mask) { return ((io.inPortWord(base + USBPORTSC1 + (port << 1)) & mask) == mask); }
/** Gets the port status and control register */ protected final int getPortSC(int port) { return io.inPortWord(base + USBPORTSC1 + (port << 1)); }