Пример #1
0
 /** @see org.jnode.driver.video.vgahw.VgaIO#getDACData() */
 public int getDACData() {
   ports.inPortByte(HDR_HIDDEN_DAC_REGISTER);
   ports.inPortByte(HDR_HIDDEN_DAC_REGISTER);
   ports.inPortByte(HDR_HIDDEN_DAC_REGISTER);
   ports.inPortByte(HDR_HIDDEN_DAC_REGISTER);
   return ports.inPortByte(HDR_HIDDEN_DAC_REGISTER);
 }
Пример #2
0
 /** @see org.jnode.driver.video.vgahw.VgaIO#setDACData(int) */
 public void setDACData(int data) {
   ports.inPortByte(HDR_HIDDEN_DAC_REGISTER);
   ports.inPortByte(HDR_HIDDEN_DAC_REGISTER);
   ports.inPortByte(HDR_HIDDEN_DAC_REGISTER);
   ports.inPortByte(HDR_HIDDEN_DAC_REGISTER);
   ports.outPortByte(HDR_HIDDEN_DAC_REGISTER, data);
 }
Пример #3
0
 /** 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);
 }
Пример #4
0
 /** 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);
 }
Пример #5
0
  /** Not implemented by kvm's cirrus emulation! */
  public boolean getDDC1Bit() {

    ports.outPortByte(SRX_SEQUENCER_INDEX, SR8_DDC2B);
    int data = ports.inPortByte(SRX_SEQUENCER_DATA) & 0xFF;

    if ((data & 0x40) == 0) {
      log.error("DDC2B/I2C configured in EEPROM mode!");
      return false;
    }

    // Anything else to check?

    return (data & (1 << 7)) != 0;
  }
Пример #6
0
 /**
  * Sets the control register.
  *
  * @param control The new value for the control register
  */
 public final void setControlReg(int control) {
   ctrlBlock.outPortByte(ctrlBlockStart + W8_CONTROL_OFFSET, control);
 }
Пример #7
0
 /**
  * Gets the alternative status of the IDE controller. Any pending IRQ is NOT reset.
  *
  * @return the alternative status of the IDE controller
  */
 public final int getAltStatusReg() {
   return ctrlBlock.inPortByte(altStatusPort);
 }
Пример #8
0
 /**
  * Sets the select register
  *
  * @param select
  */
 public final void setSelectReg(int select) {
   cmdBlock.outPortByte(cmdBlockStart + RW8_SELECT_OFFSET, select);
 }
Пример #9
0
 /** Sets the cylinder registers value (both LSB and MSB) */
 protected final void setCylinderRegs(int cylinder) {
   final int lsb = cylinder & 0xFF;
   final int msb = (cylinder >> 8) & 0xFF;
   cmdBlock.outPortByte(cmdBlockStart + RW8_CYLINDER_LSB_OFFSET, lsb);
   cmdBlock.outPortByte(cmdBlockStart + RW8_CYLINDER_MSB_OFFSET, msb);
 }
Пример #10
0
 /**
  * Sets the sector register
  *
  * @param sector
  */
 protected final void setSectorReg(int sector) {
   cmdBlock.outPortByte(cmdBlockStart + RW8_SECTOR_OFFSET, sector);
 }
Пример #11
0
 /**
  * Sets the contents of the LBA mid register
  *
  * @param value
  */
 public final void setLbaMidReg(int value) {
   cmdBlock.outPortByte(cmdBlockStart + RW8_LBA_MID_OFFSET, value);
 }
Пример #12
0
 /**
  * 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);
 }
Пример #13
0
 /** Stop this processor. */
 public void release() {
   cmdBlock.release();
   ctrlBlock.release();
 }
Пример #14
0
 /** Gets the frame number register */
 protected final int getFrameNumber() {
   return io.inPortWord(base + USBFRNUM);
 }
Пример #15
0
 /** Sets the interrupt enable register */
 protected final void setInterruptEnable(int mask) {
   io.outPortWord(base + USBINTR, mask);
 }
Пример #16
0
 /**
  * Gets the contents of the LBA high register
  *
  * @return the contents of the LBA high register
  */
 public final int getLbaHighReg() {
   return cmdBlock.inPortByte(cmdBlockStart + RW8_LBA_HIGH_OFFSET);
 }
Пример #17
0
 /**
  * Sets the contents of the LBA low register
  *
  * @param value
  */
 public final void setLbaLowReg(int value) {
   cmdBlock.outPortByte(cmdBlockStart + RW8_LBA_LOW_OFFSET, value);
 }
Пример #18
0
 /**
  * Writes a word to the data register
  *
  * @param dataWord
  */
 public final void setDataReg(int dataWord) {
   cmdBlock.outPortWord(cmdBlockStart + RW16_DATA_OFFSET, dataWord);
 }
Пример #19
0
 /**
  * Sets the contents of the LBA high register
  *
  * @param value
  */
 public final void setLbaHighReg(int value) {
   cmdBlock.outPortByte(cmdBlockStart + RW8_LBA_HIGH_OFFSET, value);
 }
Пример #20
0
 /**
  * Gets the contents of the error register
  *
  * @return the contents of the error register
  */
 public final int getErrorReg() {
   return cmdBlock.inPortByte(cmdBlockStart + R8_ERROR_OFFSET);
 }
Пример #21
0
 /** Gets the combined cylinder value out the the cylinder LSB and MSB registers. */
 protected final int getCylinderRegs() {
   final int lsb = cmdBlock.inPortByte(cmdBlockStart + RW8_CYLINDER_LSB_OFFSET);
   final int msb = cmdBlock.inPortByte(cmdBlockStart + RW8_CYLINDER_MSB_OFFSET);
   return ((msb & 0xFF) << 8) | (lsb & 0xFF);
 }
Пример #22
0
 /**
  * Sets the contents of the featureregister
  *
  * @param features
  */
 public final void setFeatureReg(int features) {
   cmdBlock.outPortByte(cmdBlockStart + W8_FEATURE_OFFSET, features);
 }
Пример #23
0
 /**
  * Gets the contents of the select register
  *
  * @return the contents of the select register
  */
 public final int getSelectReg() {
   return cmdBlock.inPortByte(cmdBlockStart + RW8_SELECT_OFFSET);
 }
Пример #24
0
 /**
  * Sets the sector count register
  *
  * @param sectorCount
  */
 public final void setSectorCountReg(int sectorCount) {
   cmdBlock.outPortByte(cmdBlockStart + RW8_SECTOR_COUNT_OFFSET, sectorCount);
 }
Пример #25
0
 /**
  * Gets the status of the IDE controller. Any pending IRQ is reset.
  *
  * @return the status of the IDE controller. Any pending IRQ is reset.
  */
 public final int getStatusReg() {
   return cmdBlock.inPortByte(cmdBlockStart + R8_STATUS_OFFSET);
 }
Пример #26
0
 /**
  * Gets the contents of the sector register
  *
  * @return the contents of the sector register
  */
 public final int getSectorReg() {
   return cmdBlock.inPortByte(cmdBlockStart + RW8_SECTOR_OFFSET);
 }
Пример #27
0
 /**
  * Sets the command register. This also activates the IDE controller so always set other registers
  * first.
  *
  * @param command
  */
 public final void setCommandReg(int command) {
   cmdBlock.outPortByte(cmdBlockStart + W8_COMMAND_OFFSET, command);
 }
Пример #28
0
 /**
  * Gets the contents of the LBA low register
  *
  * @return the contents of the LBA low register
  */
 public final int getLbaLowReg() {
   return cmdBlock.inPortByte(cmdBlockStart + RW8_LBA_LOW_OFFSET);
 }
Пример #29
0
  /** Create a new instance */
  protected DefaultIDEIO(Device device, boolean primary)
      throws IllegalArgumentException, DriverException, ResourceNotFreeException {

    int cmdBlockStart = (primary ? IDE0_START_PORT : IDE1_START_PORT);
    int ctrlBlockStart = cmdBlockStart + HIGH_OFFSET;
    int cmdBlockSize = IDE_NR_PORTS;
    int ctrlBlockSize = IDE_NR_HIGH_PORTS;
    int altStatusPort = ctrlBlockStart + R8_ALTSTATUS_OFFSET;
    int irq = (primary ? IDE0_IRQ : IDE1_IRQ);
    boolean nativeMode = false;

    // Detect PCI IDE Controller, look for enhanced mode
    if (device instanceof PCIDevice) {
      final PCIDevice pciDev = (PCIDevice) device;
      final PCIDeviceConfig pciCfg = pciDev.getConfig();
      final int pIntf = pciCfg.getMinorClass();
      final int progMask = 0x02 | 0x08;
      final int enhModeMask = 0x01 | 0x04;
      if ((pIntf & progMask) == progMask) {
        // Mode is programmable, set enhanced mode
        // pciCfg.setMinorClass(pIntf | enhModeMask);
      }
      if ((pciCfg.getMinorClass() & enhModeMask) == enhModeMask) {
        // Use enhanced mode
        final PCIBaseAddress[] baseAddrs = pciCfg.asHeaderType0().getBaseAddresses();
        final int idx = (primary ? 0 : 2);
        cmdBlockStart = baseAddrs[idx].getIOBase();
        cmdBlockSize = 8;
        ctrlBlockStart = baseAddrs[idx + 1].getIOBase();
        ctrlBlockSize = 4;
        altStatusPort = ctrlBlockStart + 0x02;
        irq = pciCfg.asHeaderType0().getInterruptLine();
        nativeMode = true;
      }
    }

    log.info(
        "Using PCI IDE " + (nativeMode ? "Native" : "Compatibility") + " mode [irq=" + irq + "]");

    // Now claim the resources
    IOResource cmdBlock = null;
    IOResource ctrlBlock = null;
    final ResourceManager rm;
    try {
      rm = InitialNaming.lookup(ResourceManager.NAME);
      cmdBlock = claimPorts(rm, device, cmdBlockStart, cmdBlockSize);
      ctrlBlock = claimPorts(rm, device, ctrlBlockStart, ctrlBlockSize);
    } catch (NameNotFoundException ex) {
      throw new ResourceNotFreeException("Cannot find ResourceManager", ex);
    } catch (ResourceNotFreeException ex) {
      if (cmdBlock != null) {
        cmdBlock.release();
      }
      if (ctrlBlock != null) {
        ctrlBlock.release();
      }
      throw ex;
    }
    this.irq = irq;
    this.cmdBlockStart = cmdBlockStart;
    this.ctrlBlockStart = ctrlBlockStart;
    this.cmdBlock = cmdBlock;
    this.ctrlBlock = ctrlBlock;
    this.altStatusPort = altStatusPort;
  }
Пример #30
0
 /**
  * Gets the contents of the LBA mid register
  *
  * @return the contents of the LBA mid register
  */
 public final int getLbaMidReg() {
   return cmdBlock.inPortByte(cmdBlockStart + RW8_LBA_MID_OFFSET);
 }