|
From: <cr...@us...> - 2008-06-08 07:26:21
|
Revision: 4216
http://jnode.svn.sourceforge.net/jnode/?rev=4216&view=rev
Author: crawley
Date: 2008-06-08 00:26:19 -0700 (Sun, 08 Jun 2008)
Log Message:
-----------
style fixes
Modified Paths:
--------------
trunk/net/src/driver/org/jnode/driver/net/_3c90x/_3c90xConstants.java
trunk/net/src/driver/org/jnode/driver/net/_3c90x/_3c90xCore.java
trunk/net/src/driver/org/jnode/driver/net/_3c90x/_3c90xDriver.java
trunk/net/src/driver/org/jnode/driver/net/_3c90x/_3c90xFlags.java
trunk/net/src/driver/org/jnode/driver/net/_3c90x/_3c90xRxRing.java
trunk/net/src/driver/org/jnode/driver/net/_3c90x/_3c90xTxBuffer.java
trunk/net/src/driver/org/jnode/driver/net/bcm570x/BCM570xConstants.java
trunk/net/src/driver/org/jnode/driver/net/bcm570x/BCM570xCore.java
trunk/net/src/driver/org/jnode/driver/net/bcm570x/BCM570xDriver.java
trunk/net/src/driver/org/jnode/driver/net/bcm570x/BCM570xFlags.java
trunk/net/src/driver/org/jnode/driver/net/eepro100/EEPRO100Buffer.java
trunk/net/src/driver/org/jnode/driver/net/eepro100/EEPRO100Constants.java
trunk/net/src/driver/org/jnode/driver/net/eepro100/EEPRO100Core.java
trunk/net/src/driver/org/jnode/driver/net/eepro100/EEPRO100RxFD.java
trunk/net/src/driver/org/jnode/driver/net/eepro100/EEPRO100Stats.java
trunk/net/src/driver/org/jnode/driver/net/eepro100/EEPRO100TxFD.java
trunk/net/src/driver/org/jnode/driver/net/eepro100/EEPRO100Utils.java
trunk/net/src/driver/org/jnode/driver/net/lance/BufferManager.java
trunk/net/src/driver/org/jnode/driver/net/lance/Descriptor.java
trunk/net/src/driver/org/jnode/driver/net/lance/IOAccess.java
trunk/net/src/driver/org/jnode/driver/net/lance/InitializationBlock32Bit.java
trunk/net/src/driver/org/jnode/driver/net/lance/LanceCore.java
trunk/net/src/driver/org/jnode/driver/net/lance/RxDescriptor.java
trunk/net/src/driver/org/jnode/driver/net/lance/RxDescriptorRing.java
trunk/net/src/driver/org/jnode/driver/net/ne2000/Ne2000Core.java
trunk/net/src/driver/org/jnode/driver/net/ne2000/Ne2000Driver.java
trunk/net/src/driver/org/jnode/driver/net/ne2000/Ne2000Flags.java
trunk/net/src/driver/org/jnode/driver/net/ne2000/Ne2000PacketHeader.java
trunk/net/src/driver/org/jnode/driver/net/ne2000/pci/Ne2000PCI.java
trunk/net/src/driver/org/jnode/driver/net/ne2000/pci/Ne2000PCIDriver.java
trunk/net/src/driver/org/jnode/driver/net/prism2/Prism2CommFrame.java
trunk/net/src/driver/org/jnode/driver/net/prism2/Prism2CommandResponse.java
trunk/net/src/driver/org/jnode/driver/net/prism2/Prism2Constants.java
trunk/net/src/driver/org/jnode/driver/net/prism2/Prism2Core.java
trunk/net/src/driver/org/jnode/driver/net/prism2/Prism2IO.java
trunk/net/src/driver/org/jnode/driver/net/prism2/Prism2InfoFrame.java
trunk/net/src/driver/org/jnode/driver/net/prism2/Prism2Record.java
Modified: trunk/net/src/driver/org/jnode/driver/net/_3c90x/_3c90xConstants.java
===================================================================
--- trunk/net/src/driver/org/jnode/driver/net/_3c90x/_3c90xConstants.java 2008-06-08 05:47:07 UTC (rev 4215)
+++ trunk/net/src/driver/org/jnode/driver/net/_3c90x/_3c90xConstants.java 2008-06-08 07:26:19 UTC (rev 4216)
@@ -99,7 +99,8 @@
/**
* Universal with Exception; pg 107 *
*/
- public static final int regDmaCtrl_l = 0x20; /** Universal with Exception; pg 106 **/
+ public static final int regDmaCtrl_l = 0x20;
+ /** Universal with Exception; pg 106 **/
/** **/
public static final int regIntStatusAuto_w = 0x1e;
/**
@@ -117,7 +118,8 @@
/**
* 905B Revision Only *
*/
- public static final int regCommandIntStatus_w = 0x0e; /** Universal (Command Variations) **/
+ public static final int regCommandIntStatus_w = 0x0e;
+ /** Universal (Command Variations) **/
/**
* following are windowed registers *
@@ -251,7 +253,8 @@
/**
* Universal with Exceptions; pg 125 *
*/
- public static final int regResetMediaOptions_3_w = 0x08; /** Media Options on B Revision; **/
+ public static final int regResetMediaOptions_3_w = 0x08;
+ /** Media Options on B Revision; **/
/**
* Reset Options on Non-B Revision *
*/
@@ -263,7 +266,8 @@
/**
* 905B Revision Only *
*/
- public static final int regInternalConfig_3_l = 0x00; /** Universal; different bit **/
+ public static final int regInternalConfig_3_l = 0x00;
+ /** Universal; different bit **/
/**
* definitions; pg 59 *
*/
Modified: trunk/net/src/driver/org/jnode/driver/net/_3c90x/_3c90xCore.java
===================================================================
--- trunk/net/src/driver/org/jnode/driver/net/_3c90x/_3c90xCore.java 2008-06-08 05:47:07 UTC (rev 4215)
+++ trunk/net/src/driver/org/jnode/driver/net/_3c90x/_3c90xCore.java 2008-06-08 07:26:19 UTC (rev 4216)
@@ -102,11 +102,7 @@
*
* @param flags
*/
- public _3c90xCore(
- _3c90xDriver driver,
- ResourceOwner owner,
- PCIDevice device,
- _3c90xFlags flags)
+ public _3c90xCore(_3c90xDriver driver, ResourceOwner owner, PCIDevice device, _3c90xFlags flags)
throws DriverException, ResourceNotFreeException {
final int irq = getIRQ(device, flags);
this.driver = driver;
@@ -137,21 +133,21 @@
// Determine Brev flag
switch (readEEProm(0x03)) {
- case 0x9000: /** 10 Base TPO **/
- case 0x9001: /** 10/100 T4 **/
- case 0x9050: /** 10/100 TPO **/
- case 0x9051: /** 10 Base Combo **/
+ case 0x9000:/** 10 Base TPO **/
+ case 0x9001:/** 10/100 T4 **/
+ case 0x9050:/** 10/100 TPO **/
+ case 0x9051:/** 10 Base Combo **/
//case 0x9200: /** 3Com905C-TXM **/
Brev = false;
break;
- case 0x9004: /** 10 Base TPO **/
- case 0x9005: /** 10 Base Combo **/
- case 0x9006: /** 10 Base TPO and Base2 **/
- case 0x900A: /** 10 Base FL **/
- case 0x9055: /** 10/100 TPO **/
- case 0x9056: /** 10/100 T4 **/
- case 0x905A: /** 10 Base FX **/
+ case 0x9004:/** 10 Base TPO **/
+ case 0x9005:/** 10 Base Combo **/
+ case 0x9006:/** 10 Base TPO and Base2 **/
+ case 0x900A:/** 10 Base FL **/
+ case 0x9055:/** 10/100 TPO **/
+ case 0x9056:/** 10/100 T4 **/
+ case 0x905A:/** 10 Base FX **/
default:
Brev = true;
break;
@@ -172,15 +168,8 @@
hwAddrArr[5] = (byte) (eeprom[0x0c] & 0xFF);
this.hwAddress = new EthernetAddress(hwAddrArr, 0);
- log.debug(
- "Found "
- + flags.getName()
- + " IRQ="
- + irq
- + ", IOBase=0x"
- + NumberUtils.hex(iobase)
- + ", MAC Address="
- + hwAddress);
+ log.debug("Found " + flags.getName() + " IRQ=" + irq + ", IOBase=0x" +
+ NumberUtils.hex(iobase) + ", MAC Address=" + hwAddress);
}
/**
@@ -264,8 +253,9 @@
/**
** set Indication and Interrupt flags , acknowledge any IRQ's
**/
- final int intMask = INT_HOSTERROR | INT_TXCOMPLETE | INT_RXCOMPLETE | INT_UPDATESTATS | INT_LINKEVENT |
- INT_UPCOMPLETE | INT_INTREQUESTED;
+ final int intMask =
+ INT_HOSTERROR | INT_TXCOMPLETE | INT_RXCOMPLETE | INT_UPDATESTATS | INT_LINKEVENT |
+ INT_UPCOMPLETE | INT_INTREQUESTED;
issueCommand(cmdSetInterruptEnable, /*0x7FF*/intMask, 0);
issueCommand(cmdSetIndicationEnable, 0x7FF, 0);
issueCommand(cmdAcknowledgeInterrupt, 0x661, 0);
@@ -362,7 +352,7 @@
issueCommand(cmdAcknowledgeInterrupt, INT_INTERRUPTLATCH, 0);
} else {
log.debug("Unknown IntStatus flags set on " + flags.getName() + ": IntStatus=0x" +
- NumberUtils.hex(intStatus, 4));
+ NumberUtils.hex(intStatus, 4));
issueCommand(cmdAcknowledgeInterrupt, intStatus & ~INT_WINDOWNUMBER, 0);
}
intStatus = getReg16(regCommandIntStatus_w);
@@ -464,8 +454,7 @@
* @param device
* @param flags
*/
- protected int getIOBase(Device device, _3c90xFlags flags)
- throws DriverException {
+ protected int getIOBase(Device device, _3c90xFlags flags) throws DriverException {
final PCIHeaderType0 config = ((PCIDevice) device).getConfig().asHeaderType0();
final PCIBaseAddress[] addrs = config.getBaseAddresses();
if (addrs.length < 1) {
@@ -483,8 +472,7 @@
* @param device
* @param flags
*/
- protected int getIOLength(Device device, _3c90xFlags flags)
- throws DriverException {
+ protected int getIOLength(Device device, _3c90xFlags flags) throws DriverException {
final PCIHeaderType0 config = ((PCIDevice) device).getConfig().asHeaderType0();
final PCIBaseAddress[] addrs = config.getBaseAddresses();
if (addrs.length < 1) {
@@ -502,8 +490,7 @@
* @param device
* @param flags
*/
- protected int getIRQ(Device device, _3c90xFlags flags)
- throws DriverException {
+ protected int getIRQ(Device device, _3c90xFlags flags) throws DriverException {
final PCIHeaderType0 config = ((PCIDevice) device).getConfig().asHeaderType0();
return config.getInterruptLine();
}
@@ -680,16 +667,16 @@
* @param value
*/
private final void setReg16(int reg, int value) {
- io.outPortWord(iobase + reg, value);
- }
+ io.outPortWord(iobase + reg, value);
+ }
- /**
+ /**
* Writes a 32-bit NIC register
*
* @param reg
* @param value
*/
- private final void setReg32(int reg, int value) {
- io.outPortDword(iobase + reg, value);
- }
+ private final void setReg32(int reg, int value) {
+ io.outPortDword(iobase + reg, value);
+ }
}
Modified: trunk/net/src/driver/org/jnode/driver/net/_3c90x/_3c90xDriver.java
===================================================================
--- trunk/net/src/driver/org/jnode/driver/net/_3c90x/_3c90xDriver.java 2008-06-08 05:47:07 UTC (rev 4215)
+++ trunk/net/src/driver/org/jnode/driver/net/_3c90x/_3c90xDriver.java 2008-06-08 07:26:19 UTC (rev 4216)
@@ -110,8 +110,7 @@
dd.initialize();
super.startDevice();
} catch (ResourceNotFreeException ex) {
- throw new DriverException("Cannot claim " + flags.getName()
- + " resources", ex);
+ throw new DriverException("Cannot claim " + flags.getName() + " resources", ex);
}
}
@@ -121,13 +120,11 @@
protected _3c90xCore newCore(final Device device, final _3c90xFlags flags)
throws DriverException, ResourceNotFreeException {
try {
- return (_3c90xCore) AccessControllerUtils
- .doPrivileged(new PrivilegedExceptionAction() {
- public Object run() throws DriverException, ResourceNotFreeException {
- return new _3c90xCore(_3c90xDriver.this, device, (PCIDevice) device,
- flags);
- }
- });
+ return AccessControllerUtils.doPrivileged(new PrivilegedExceptionAction<_3c90xCore>() {
+ public _3c90xCore run() throws DriverException, ResourceNotFreeException {
+ return new _3c90xCore(_3c90xDriver.this, device, (PCIDevice) device, flags);
+ }
+ });
} catch (DriverException ex) {
throw ex;
} catch (ResourceNotFreeException ex) {
Modified: trunk/net/src/driver/org/jnode/driver/net/_3c90x/_3c90xFlags.java
===================================================================
--- trunk/net/src/driver/org/jnode/driver/net/_3c90x/_3c90xFlags.java 2008-06-08 05:47:07 UTC (rev 4215)
+++ trunk/net/src/driver/org/jnode/driver/net/_3c90x/_3c90xFlags.java 2008-06-08 07:26:19 UTC (rev 4216)
@@ -39,7 +39,7 @@
/**
* Create a new instance
- *
+ *
* @param name
*/
public _3c90xFlags(String name) {
@@ -51,6 +51,5 @@
*/
public String getName() {
return name;
- }
-
+ }
}
Modified: trunk/net/src/driver/org/jnode/driver/net/_3c90x/_3c90xRxRing.java
===================================================================
--- trunk/net/src/driver/org/jnode/driver/net/_3c90x/_3c90xRxRing.java 2008-06-08 05:47:07 UTC (rev 4215)
+++ trunk/net/src/driver/org/jnode/driver/net/_3c90x/_3c90xRxRing.java 2008-06-08 07:26:19 UTC (rev 4216)
@@ -66,14 +66,14 @@
/**
* Create a new instance
- *
+ *
* @param nrFrames The number of complete ethernet frames in this ring.
* @param rm
*/
public _3c90xRxRing(int nrFrames, ResourceManager rm) {
// Create a large enough buffer
- final int size = (nrFrames * (UPD_SIZE + FRAME_SIZE)) + 16/*alignment*/;
+ final int size = (nrFrames * (UPD_SIZE + FRAME_SIZE)) + 16/* alignment */;
this.data = new byte[size];
this.nrFrames = nrFrames;
this.mem = rm.asMemoryResource(data);
@@ -117,7 +117,7 @@
/**
* Gets the packet status of the UPD at the given index
- *
+ *
* @param index
*/
public int getPktStatus(int index) {
@@ -127,7 +127,7 @@
/**
* Sets the packet status of the UPD at the given index
- *
+ *
* @param index
* @param value The new pkt status value
*/
@@ -138,7 +138,7 @@
/**
* Gets the packet data of UPD with the given index into a SocketBuffer
- *
+ *
* @param index
*/
public SocketBuffer getPacket(int index) {
@@ -160,8 +160,8 @@
/**
* Gets the number of frames of this ring
- */
- public int getNrFrames() {
- return nrFrames;
- }
+ */
+ public int getNrFrames() {
+ return nrFrames;
+ }
}
Modified: trunk/net/src/driver/org/jnode/driver/net/_3c90x/_3c90xTxBuffer.java
===================================================================
--- trunk/net/src/driver/org/jnode/driver/net/_3c90x/_3c90xTxBuffer.java 2008-06-08 05:47:07 UTC (rev 4215)
+++ trunk/net/src/driver/org/jnode/driver/net/_3c90x/_3c90xTxBuffer.java 2008-06-08 07:26:19 UTC (rev 4216)
@@ -62,13 +62,13 @@
/**
* Create a new instance
- *
+ *
* @param rm
*/
public _3c90xTxBuffer(ResourceManager rm) {
// Create a large enough buffer
- final int size = (DPD_SIZE + FRAME_SIZE) + 16 /*alignment*/;
+ final int size = (DPD_SIZE + FRAME_SIZE) + 16 /* alignment */;
this.data = new byte[size];
this.mem = rm.asMemoryResource(data);
@@ -90,8 +90,7 @@
/**
* Initialize this ring to its default (empty) state
*/
- public void initialize(SocketBuffer src)
- throws IllegalArgumentException {
+ public void initialize(SocketBuffer src) throws IllegalArgumentException {
// Setup the DPD
final int dpdOffset = firstDPDOffset;
@@ -115,6 +114,6 @@
* Gets the address of the first DPD in this buffer.
*/
public Address getFirstDPDAddress() {
- return firstDPDAddress;
- }
+ return firstDPDAddress;
+ }
}
Modified: trunk/net/src/driver/org/jnode/driver/net/bcm570x/BCM570xConstants.java
===================================================================
--- trunk/net/src/driver/org/jnode/driver/net/bcm570x/BCM570xConstants.java 2008-06-08 05:47:07 UTC (rev 4215)
+++ trunk/net/src/driver/org/jnode/driver/net/bcm570x/BCM570xConstants.java 2008-06-08 07:26:19 UTC (rev 4216)
@@ -22,13 +22,11 @@
package org.jnode.driver.net.bcm570x;
/**
- * Driver constants to the RTL8139 ethernet card.
- * <p/>
- * Build with help of the donation from WebSprocket LLC
- *
+ * Driver constants to the RTL8139 ethernet card. <p/> Build with help of the
+ * donation from WebSprocket LLC
+ *
* @author Martin Husted Hartvig
*/
-
public interface BCM570xConstants {
public static final int MAX_MULTICAST_ADDR = 64;
@@ -45,8 +43,8 @@
public static final int REG_TX_ADDR0 = 0x20;
public static final int REG_RX_BUF = 0x30;
public static final int REG_RX_EARLY_CNT = 0x34; // 16-bit reg
- public static final int REG_RX_EARLY_STA = 0x36; // 8-bit reg
- public static final int REG_CHIPCMD = 0x37; // 8-bit reg
+ public static final int REG_RX_EARLY_STA = 0x36; // 8-bit reg
+ public static final int REG_CHIPCMD = 0x37; // 8-bit reg
public static final int REG_RX_BUF_PTR = 0x38; // 16-bit reg
public static final int REG_RX_BUF_CNT = 0x3A; // 16-bit reg
public static final int CAPR = 0x38; // 16-bit reg
@@ -58,15 +56,15 @@
public static final int REG_RX_CONFIG = 0x44;
public static final int REG_TIMER = 0x48;
public static final int REG_RX_MISSED = 0x4C;
- public static final int REG_CFG9346 = 0x50; // 8-bit reg
- public static final int REG_CONFIG0 = 0x51; // 8-bit reg
- public static final int REG_CONFIG1 = 0x52; // 8-bit reg
+ public static final int REG_CFG9346 = 0x50; // 8-bit reg
+ public static final int REG_CONFIG0 = 0x51; // 8-bit reg
+ public static final int REG_CONFIG1 = 0x52; // 8-bit reg
public static final int REG_FLASH = 0x54;
- public static final int MSR = 0x58; // 8-bit reg
- public static final int REG_CONFIG3 = 0x59; // 8-bit reg
- public static final int REG_MII_SMI = 0x5A; // 8-bit reg
+ public static final int MSR = 0x58; // 8-bit reg
+ public static final int REG_CONFIG3 = 0x59; // 8-bit reg
+ public static final int REG_MII_SMI = 0x5A; // 8-bit reg
public static final int REG_CONFIG4 = 0x5a;
- public static final int REG_HLT_CLK = 0x5B; // 8-bit reg
+ public static final int REG_HLT_CLK = 0x5B; // 8-bit reg
public static final int REG_MULTI_INTR = 0x5C;
public static final int REG_TX_SUMMARY = 0x60; // 16-bit reg
public static final int BMCR = 0x62; // 16-bit reg
@@ -104,8 +102,9 @@
public int txFlag = TX_FIFO_THRESHOLD << 16;
// accept broadcasts and runt packets, wrap around the buffer
- public int rxConfig = (RX_DMA_BURST << 8) | (RX_FIFO_THRESHOLD << 13)
- | (RX_RBLEN << 11) | RX_AR | RX_BCAST | RX_MYPHYS;
+ public int rxConfig =
+ (RX_DMA_BURST << 8) | (RX_FIFO_THRESHOLD << 13) | (RX_RBLEN << 11) | RX_AR | RX_BCAST |
+ RX_MYPHYS;
public static final int INTR_RX_OK = 0x0001;
public static final int INTR_RX_ERR = 0x0002;
public static final int INTR_TX_OK = 0x0004;
@@ -117,9 +116,9 @@
public static final int INTR_LEN_CHG = 0x2000;
public static final int INTR_TIMEOUT = 0x4000;
public static final int INTR_SYS_ERR = 0x8000;
- public static final int INTR_MASK = (INTR_SYS_ERR | INTR_TIMEOUT
- | INTR_LEN_CHG | INTR_RX_UNDERRUN | INTR_RX_BUF_OVRFLO
- | INTR_RX_FIFO_OVRFLO | INTR_RX_ERR | INTR_RX_OK | INTR_TX_ERR | INTR_TX_OK);
+ public static final int INTR_MASK =
+ (INTR_SYS_ERR | INTR_TIMEOUT | INTR_LEN_CHG | INTR_RX_UNDERRUN | INTR_RX_BUF_OVRFLO |
+ INTR_RX_FIFO_OVRFLO | INTR_RX_ERR | INTR_RX_OK | INTR_TX_ERR | INTR_TX_OK);
public static final int CFG1_MMIO = 0x08;
public static final int CFG1_PIO = 0x04;
public static final int CSCR_LINKCHANGE = 0x800;
@@ -139,8 +138,7 @@
public static final int RX_BUF_SIZE = 8192 << RX_BUF_IDX;
public static final int RX_BUF_WRAP_PAD = 2048;
public static final int RX_BUF_EXTRA = 16; // extra room
- public static final int TOTAL_RX_BUF_SIZE = RX_BUF_SIZE + RX_BUF_EXTRA
- + RX_BUF_WRAP_PAD;
+ public static final int TOTAL_RX_BUF_SIZE = RX_BUF_SIZE + RX_BUF_EXTRA + RX_BUF_WRAP_PAD;
public static final int RX_FRAMES = 32;
public static final int MAX_ETH_FRAME_LEN = 1536;
@@ -148,7 +146,8 @@
public static final int RX_MAR = 0x8000; // Multicast address received
public static final int RX_PAM = 0x4000; // Physical address matched
public static final int RX_BAR = 0x2000; // Broadcast address received
- public static final int RX_ISE = 0x0020; // Invalid symbol error (100B-TX)
+ public static final int RX_ISE = 0x0020; // Invalid symbol error
+ // (100B-TX)
public static final int RX_RUNT = 0x0010; // runt packet
public static final int RX_LONG = 0x0008; // long packet (>4k bytes)
public static final int RX_CRC = 0x0004; // CRC error
@@ -185,7 +184,7 @@
public static final int udpChecksumChecked = (1 << 31);
/**
- * Timeout for autonegotiate in seconds
+ * Timeout for auto-negotiate in seconds
*/
public static final int AUTO_NEGOTIATE_TIMEOUT = 15;
}
Modified: trunk/net/src/driver/org/jnode/driver/net/bcm570x/BCM570xCore.java
===================================================================
--- trunk/net/src/driver/org/jnode/driver/net/bcm570x/BCM570xCore.java 2008-06-08 05:47:07 UTC (rev 4215)
+++ trunk/net/src/driver/org/jnode/driver/net/bcm570x/BCM570xCore.java 2008-06-08 07:26:19 UTC (rev 4216)
@@ -50,8 +50,8 @@
/**
* @author Martin Husted Hartvig (ha...@jn...)
*/
-
-public class BCM570xCore extends AbstractDeviceCore implements BCM570xConstants, IRQHandler, EthernetConstants {
+public class BCM570xCore extends AbstractDeviceCore implements BCM570xConstants, IRQHandler,
+ EthernetConstants {
/**
* Start of IO address space
*/
@@ -77,13 +77,13 @@
*/
private final BCM570xDriver driver;
/** The receive buffer ring */
-// private final RTL8139RxRing rxRing = null;
+ // private final RTL8139RxRing rxRing = null;
/** The transmit buffer */
// private final RTL8139TxBuffer[] txBuffers = new RTL8139TxBuffer[4];
/**
* Is a transmission active?
*/
- //private boolean tx_active;
+ // private boolean tx_active;
private int txIndex;
private int txAborted;
private int txNumberOfPackets;
@@ -91,7 +91,7 @@
/**
* Create a new instance
- *
+ *
* @param flags
*/
public BCM570xCore(BCM570xDriver driver, ResourceOwner owner, PCIDevice device, Flags flags)
@@ -130,62 +130,55 @@
throw ex;
}
-/*
- this.rxRing = new RTL8139RxRing(RX_FRAMES, rm);
-
- for (int i = 0; i < txBuffers.length; i++) {
- txBuffers[i] = new RTL8139TxBuffer(rm);
- setReg32(REG_TX_ADDR0 + (4 * i), txBuffers[i].getFirstDPDAddress().toInt());
- }
-
- powerUpDevice();
- reset();
-
- byte[] adr1 = i2bsLoHi(getReg32(REG_MAC0));
- byte[] adr2 = i2bsLoHi(getReg32(REG_MAC0 + 4));
-
- final byte[] hwAddrArr = new byte[ETH_ALEN];
-
- hwAddrArr[0] = adr1[0];
- hwAddrArr[1] = adr1[1];
- hwAddrArr[2] = adr1[2];
- hwAddrArr[3] = adr1[3];
- hwAddrArr[4] = adr2[0];
- hwAddrArr[5] = adr2[1];
-
- this.hwAddress = new EthernetAddress(hwAddrArr, 0);
-
- // disable multicast
- setReg32(REG_MAR0, 0);
- setReg32(REG_MAR0 + 4, 0);
-
- log.debug("Found " + flags.getName() + " IRQ=" + irq + ", IOBase=0x" + NumberUtils.hex(iobase) + ", MAC Address=" + hwAddress);
-*/
+ /*
+ * this.rxRing = new RTL8139RxRing(RX_FRAMES, rm);
+ *
+ * for (int i = 0; i < txBuffers.length; i++) { txBuffers[i] = new
+ * RTL8139TxBuffer(rm); setReg32(REG_TX_ADDR0 + (4 * i),
+ * txBuffers[i].getFirstDPDAddress().toInt()); }
+ *
+ * powerUpDevice(); reset();
+ *
+ * byte[] adr1 = i2bsLoHi(getReg32(REG_MAC0)); byte[] adr2 =
+ * i2bsLoHi(getReg32(REG_MAC0 + 4));
+ *
+ * final byte[] hwAddrArr = new byte[ETH_ALEN];
+ *
+ * hwAddrArr[0] = adr1[0]; hwAddrArr[1] = adr1[1]; hwAddrArr[2] =
+ * adr1[2]; hwAddrArr[3] = adr1[3]; hwAddrArr[4] = adr2[0]; hwAddrArr[5] =
+ * adr2[1];
+ *
+ * this.hwAddress = new EthernetAddress(hwAddrArr, 0);
+ * // disable multicast setReg32(REG_MAR0, 0); setReg32(REG_MAR0 + 4,
+ * 0);
+ *
+ * log.debug("Found " + flags.getName() + " IRQ=" + irq + ", IOBase=0x" +
+ * NumberUtils.hex(iobase) + ", MAC Address=" + hwAddress);
+ */
}
private void powerUpDevice() {
setReg8(REG_CFG9346, CFG9346_WE);
-
setReg8(REG_CONFIG1, 0);
setReg8(REG_CFG9346, 0);
}
private void reset() {
+ // FIXME ... what is with all the fixed delays???
txIndex = 0;
-
int i;
-
setReg8(REG_CHIPCMD, CMD_RESET);
-
try {
Thread.sleep(200);
} catch (InterruptedException ex) {
+ // ignore
}
for (i = 0; i < REPEAT_TIMEOUT_COUNT; i++) {
try {
Thread.sleep(GENERIC_WAIT_TIME);
} catch (InterruptedException ex) {
+ // ignore
}
if ((getReg8(REG_CHIPCMD) & CMD_RESET) == 0)
@@ -200,12 +193,14 @@
try {
Thread.sleep(200);
} catch (InterruptedException ex) {
+ // ignore
}
for (i = 0; i < REPEAT_TIMEOUT_COUNT; i++) {
try {
Thread.sleep(GENERIC_WAIT_TIME);
} catch (InterruptedException ex) {
+ // ignore
}
if ((getReg16(BMCR) & BMCR_RESET) == 0)
@@ -221,12 +216,14 @@
try {
Thread.sleep(200);
} catch (InterruptedException ex) {
+ // ignore
}
for (i = 0; i < REPEAT_TIMEOUT_COUNT; i++) {
try {
Thread.sleep(GENERIC_WAIT_TIME);
} catch (InterruptedException ex) {
+ // ignore
}
if ((getReg8(REG_CFG9346) & 0xc0) == 0)
@@ -250,7 +247,7 @@
private void autoNegotiate() {
- //boolean fullDuplex = false;
+ // boolean fullDuplex = false;
// start auto negotiating
setReg16(REG_INTR_MASK, INTR_MASK);
@@ -274,11 +271,13 @@
try {
Thread.sleep(1000);
} catch (InterruptedException ex) {
+ // ignore
}
bogusCount++;
if (bogusCount >= AUTO_NEGOTIATE_TIMEOUT) {
- log.debug("Bogus count: autonegotiating taking too long: " + Integer.toHexString(status));
+ log.debug("Bogus count: autonegotiating taking too long: " +
+ Integer.toHexString(status));
break;
}
status = getReg16(BMSR);
@@ -296,24 +295,26 @@
/* int lpar = */
getReg16(NWAY_LPAR);
- log.debug("MSR: " + Integer.toHexString(getReg8(MSR)) + " BMCR: " + Integer.toHexString(getReg16(BMCR)) +
- " LPAR: " + Integer.toHexString(getReg16(NWAY_LPAR)));
+ log.debug("MSR: " + Integer.toHexString(getReg8(MSR)) + " BMCR: " +
+ Integer.toHexString(getReg16(BMCR)) + " LPAR: " +
+ Integer.toHexString(getReg16(NWAY_LPAR)));
- // if (lpar == 0xffff) {
- // } else if (((lpar & 0x0100) == 0x0100) || ((lpar & 0x00C0) == 0x0040)) {
- // fullDuplex = true;
- // }
+ // if (lpar == 0xffff) {
+ // } else if (((lpar & 0x0100) == 0x0100) || ((lpar & 0x00C0) ==
+ // 0x0040)) {
+ // fullDuplex = true;
+ // }
- // if (fullDuplex) rtl8139.write8(REG_CONFIG1, 0x60); // check
- // else rtl8139.write8(REG_CONFIG1, 0x20);
+ // if (fullDuplex) rtl8139.write8(REG_CONFIG1, 0x60); // check
+ // else rtl8139.write8(REG_CONFIG1, 0x20);
setReg8(REG_CFG9346, 0x00);
- // if (fullDuplex) System.out.print("AutoNegotiation: Full Duplex ");
- // else System.out.print("AutoNegotiation: Half Duplex ");
+ // if (fullDuplex) System.out.print("AutoNegotiation: Full Duplex ");
+ // else System.out.print("AutoNegotiation: Half Duplex ");
- // if ((lpar & 0x0180) != 0) System.out.println("100 Mbps Mode");
- // else System.out.println("10 Mbps Mode");
+ // if ((lpar & 0x0180) != 0) System.out.println("100 Mbps Mode");
+ // else System.out.println("10 Mbps Mode");
return;
}
@@ -333,9 +334,9 @@
reset();
// initialize our buffer
-// rxRing.initialize();
+ // rxRing.initialize();
-// setReg32(REG_RX_BUF, rxRing.getFirstUPDAddress().toInt());
+ // setReg32(REG_RX_BUF, rxRing.getFirstUPDAddress().toInt());
autoNegotiate();
@@ -394,50 +395,51 @@
/**
* Transmit the given buffer
- *
+ *
* @param buf
* @param timeout
* @throws InterruptedException
* @throws org.jnode.util.TimeoutException
- *
+ *
*/
public void transmit(SocketBuffer buf, HardwareAddress destination, long timeout)
throws InterruptedException, TimeoutException {
// Set the source address
hwAddress.writeTo(buf, 6);
- //tx_active = true;
+ // tx_active = true;
txNumberOfPackets++;
// Set the address of the txBuffer
setReg32(REG_CFG9346, CFG9346_WE);
- // this should be a bug fix, but looking (in Ethereal) at the packes send
+ // this should be a bug fix, but looking (in Ethereal) at the packes
+ // send
// indicate on my card that this is not true
// Martin
/*
- * if (txIndex == 0) { txBuffers[0].initialize(buf); setReg32(REG_TX_STATUS0, txFlag |
- * buf.getSize());
- *
- * txBuffers[1].initialize(buf); setReg32(REG_TX_STATUS0 + 4, txFlag | buf.getSize());
- *
- * txIndex = 2; } else {
- */
-// txBuffers[txIndex].initialize(buf);
-
+ * if (txIndex == 0) { txBuffers[0].initialize(buf);
+ * setReg32(REG_TX_STATUS0, txFlag | buf.getSize());
+ *
+ * txBuffers[1].initialize(buf); setReg32(REG_TX_STATUS0 + 4, txFlag |
+ * buf.getSize());
+ *
+ * txIndex = 2; } else {
+ */
+ // txBuffers[txIndex].initialize(buf);
setReg32(REG_TX_STATUS0 + 4 * txIndex, txFlag | buf.getSize());
// Point to the next empty descriptor
txIndex++;
txIndex &= 3;
- // }
+ // }
setReg32(REG_CFG9346, CFG9346_NORMAL);
}
/**
- * Handle a given hardware interrupt. This method is called from the kernel with interrupts
- * disabled. So keep and handling here as short as possible!
+ * Handle a given hardware interrupt. This method is called from the kernel
+ * with interrupts disabled. So keep and handling here as short as possible!
*/
public void handleInterrupt(int irq) {
int bogusCount = 20;
@@ -452,10 +454,9 @@
}
// See if anything needs servicing
- if ((status
- & (INTR_RX_OK | INTR_RX_ERR | INTR_TX_OK | INTR_TX_ERR | INTR_RX_BUF_OVRFLO | INTR_RX_FIFO_OVRFLO |
- INTR_TIMEOUT | INTR_SYS_ERR | INTR_RX_UNDERRUN | INTR_LEN_CHG))
- == 0) {
+ if ((status & (INTR_RX_OK | INTR_RX_ERR | INTR_TX_OK | INTR_TX_ERR |
+ INTR_RX_BUF_OVRFLO | INTR_RX_FIFO_OVRFLO | INTR_TIMEOUT | INTR_SYS_ERR |
+ INTR_RX_UNDERRUN | INTR_LEN_CHG)) == 0) {
break;
}
@@ -483,11 +484,11 @@
}
// Process the other errors
- if ((status & (INTR_RX_ERR | INTR_TX_ERR | INTR_RX_BUF_OVRFLO | INTR_RX_FIFO_OVRFLO | INTR_TIMEOUT |
- INTR_SYS_ERR | INTR_RX_UNDERRUN)) != 0) {
+ if ((status & (INTR_RX_ERR | INTR_TX_ERR | INTR_RX_BUF_OVRFLO | INTR_RX_FIFO_OVRFLO |
+ INTR_TIMEOUT | INTR_SYS_ERR | INTR_RX_UNDERRUN)) != 0) {
errorInterrupt(status);
- // log.debug(" error Interupt "+status);
+ // log.debug(" error Interupt "+status);
}
if (--bogusCount < 0) {
setReg16(REG_INTR_STATUS, 0xffff);
@@ -502,43 +503,40 @@
setReg32(REG_RX_MISSED, 0);
if ((status & (INTR_RX_UNDERRUN | INTR_RX_BUF_OVRFLO | INTR_RX_FIFO_OVRFLO | INTR_RX_ERR)) != 0) {
- // rxErrors++;
+ // rxErrors++;
}
if ((status & INTR_RX_FIFO_OVRFLO) != 0) {
- // rxFifoOverflow++;
+ // rxFifoOverflow++;
}
if ((status & INTR_RX_UNDERRUN) != 0) {
- // rxUnderRun++;
+ // rxUnderRun++;
}
if ((status & INTR_RX_BUF_OVRFLO) != 0) {
- // rxBufferOverflow++;
- // rxBufferOverflow++;
+ // rxBufferOverflow++;
+ // rxBufferOverflow++;
// following is needed to clear this interrupt
- // rxIndex = getReg16(REG_RX_BUF_CNT) % RX_BUF_SIZE;
+ // rxIndex = getReg16(REG_RX_BUF_CNT) % RX_BUF_SIZE;
-/*
- rxRing.setIndex(getReg16(REG_RX_BUF_CNT) % RX_BUF_SIZE);
- setReg16(REG_RX_BUF_PTR, rxRing.getIndex() - 16);
-*/
+ /*
+ * rxRing.setIndex(getReg16(REG_RX_BUF_CNT) % RX_BUF_SIZE);
+ * setReg16(REG_RX_BUF_PTR, rxRing.getIndex() - 16);
+ */
}
if ((status & INTR_SYS_ERR) != 0) {
+ // ???
}
if ((status & INTR_TIMEOUT) != 0) {
- // timeoutError++;
+ // timeoutError++;
}
}
- /*
- * private void rxError(int status) {
- */
-
private void rxProcess(int status) {
// Read all packets
setReg32(REG_CFG9346, CFG9346_WE);
while ((getReg8(REG_CHIPCMD) & CMD_BUFFER_EMPTY) == 0) {
- final int pktStatus = 0;//rxRing.getPktStatus();
+ final int pktStatus = 0; // rxRing.getPktStatus();
final int pktLen = (pktStatus >> 16);
if (pktLen == 0xfff0) {
@@ -550,34 +548,30 @@
// set up rx mode/configuration
setReg32(REG_RX_CONFIG, rxConfig);
-
-// rxRing.setIndex(getReg16(CBR));
-
+ // rxRing.setIndex(getReg16(CBR));
setReg16(CAPR, CBR);
-
enableTxRx();
-
setReg32(REG_RX_CONFIG, rxConfig);
// Enable interrupts
setReg16(REG_INTR_MASK, INTR_MASK);
return;
} else {
- final SocketBuffer skbuf = null; //rxRing.getPacket(pktLen);
+ final SocketBuffer skbuf = null; // rxRing.getPacket(pktLen);
try {
if (skbuf.getSize() > 0)
driver.onReceive(skbuf);
} catch (NetworkException e) {
- e.printStackTrace(); //To change body of catch statement use Options | File
+ e.printStackTrace(); // To change body of catch statement
+ // use Options | File
// Templates.
} finally {
+ // FIXME
}
}
-
-// setReg16(CAPR, rxRing.getIndex() - 16);
+ // setReg16(CAPR, rxRing.getIndex() - 16);
}
-
setReg32(REG_CFG9346, CFG9346_NORMAL);
}
@@ -589,7 +583,7 @@
return;
}
if ((txStatus & (TX_OWC | TX_TABT)) != 0) {
- // txErrors++;
+ // txErrors++;
if ((txStatus & TX_TABT) != 0) {
txAborted++;
// Setting clear abort bit will make the 8139
@@ -598,35 +592,33 @@
return;
}
if ((txStatus & TX_CRS) != 0) {
- // txCarrierErrors++;
+ // txCarrierErrors++;
}
if ((txStatus & TX_OWC) != 0) {
- // System.out.println("TX window error");
- // txWindowErrors++;
+ // System.out.println("TX window error");
+ // txWindowErrors++;
}
} else {
if ((txStatus & TX_TUN) != 0) {
- // txFifoErrors++;
+ // txFifoErrors++;
}
- // txCollisions += ((txStatus & TX_NCC) >> 24);
- // txBytes += txStatus & 0x7ff;
- // txPackets++;
+ // txCollisions += ((txStatus & TX_NCC) >> 24);
+ // txBytes += txStatus & 0x7ff;
+ // txPackets++;
}
// txPendingQueue[txPending].free();
txNumberOfPackets--;
txPending++;
txPending &= 3;
}
-
}
/**
* Gets the first IO-Address used by the given device
- *
+ *
* @param device
* @param flags
*/
-
protected int getIOBase(Device device, Flags flags) throws DriverException {
final PCIHeaderType0 config = ((PCIDevice) device).getConfig().asHeaderType0();
final PCIBaseAddress[] addrs = config.getBaseAddresses();
@@ -642,7 +634,7 @@
/**
* Gets the number of IO-Addresses used by the given device
- *
+ *
* @param device
* @param flags
*/
@@ -663,11 +655,10 @@
/**
* Gets the IRQ used by the given device
- *
+ *
* @param device
* @param flags
*/
-
protected int getIRQ(Device device, Flags flags) throws DriverException {
final PCIHeaderType0 config = ((PCIDevice) device).getConfig().asHeaderType0();
return config.getInterruptLine();
@@ -675,7 +666,7 @@
/**
* Reads a 8-bit NIC register
- *
+ *
* @param reg
*/
protected final int getReg8(int reg) {
@@ -684,7 +675,7 @@
/**
* Reads a 16-bit NIC register
- *
+ *
* @param reg
*/
protected final int getReg16(int reg) {
@@ -693,59 +684,55 @@
/**
* Reads a 32-bit NIC register
- *
+ *
* @param reg
*/
-
protected final int getReg32(int reg) {
return io.inPortDword(iobase + reg);
}
/**
* Writes a 8-bit NIC register
- *
+ *
* @param reg
* @param value
*/
-
protected final void setReg8(int reg, int value) {
io.outPortByte(iobase + reg, value);
}
/**
* Writes a 16-bit NIC register
- *
+ *
* @param reg
* @param value
*/
-
protected final void setReg16(int reg, int value) {
io.outPortWord(iobase + reg, value);
}
/**
* Writes a 32-bit NIC register
- *
+ *
* @param reg
* @param value
*/
-
public final void setReg32(int reg, int value) {
io.outPortDword(iobase + reg, value);
}
- private IOResource claimPorts(final ResourceManager rm, final ResourceOwner owner, final int low, final int length)
- throws ResourceNotFreeException, DriverException {
+ private IOResource claimPorts(final ResourceManager rm, final ResourceOwner owner,
+ final int low, final int length) throws ResourceNotFreeException, DriverException {
try {
- return (IOResource) AccessControllerUtils.doPrivileged(new PrivilegedExceptionAction() {
- public Object run() throws ResourceNotFreeException {
+ return AccessControllerUtils.doPrivileged(new PrivilegedExceptionAction<IOResource>() {
+ public IOResource run() throws ResourceNotFreeException {
return rm.claimIOResource(owner, low, length);
- }});
- } catch (ResourceNotFreeException ex) {
- throw ex;
+ }
+ });
+ } catch (ResourceNotFreeException ex) {
+ throw ex;
} catch (Exception ex) {
throw new DriverException("Unknown exception", ex);
}
-
- }
+ }
}
Modified: trunk/net/src/driver/org/jnode/driver/net/bcm570x/BCM570xDriver.java
===================================================================
--- trunk/net/src/driver/org/jnode/driver/net/bcm570x/BCM570xDriver.java 2008-06-08 05:47:07 UTC (rev 4215)
+++ trunk/net/src/driver/org/jnode/driver/net/bcm570x/BCM570xDriver.java 2008-06-08 07:26:19 UTC (rev 4216)
@@ -33,7 +33,6 @@
/**
* @author Martin Husted Hartvig
*/
-
public class BCM570xDriver extends BasicEthernetDriver {
/**
@@ -45,7 +44,7 @@
/**
* Create new driver instance for this device
- *
+ *
* @param flags
*/
public BCM570xDriver(BCM570xFlags flags) {
Modified: trunk/net/src/driver/org/jnode/driver/net/bcm570x/BCM570xFlags.java
===================================================================
--- trunk/net/src/driver/org/jnode/driver/net/bcm570x/BCM570xFlags.java 2008-06-08 05:47:07 UTC (rev 4215)
+++ trunk/net/src/driver/org/jnode/driver/net/bcm570x/BCM570xFlags.java 2008-06-08 07:26:19 UTC (rev 4216)
@@ -27,7 +27,6 @@
/**
* @author Martin Husted Hartvig
*/
-
public class BCM570xFlags implements Flags {
private final String name;
@@ -46,10 +45,9 @@
/**
* Create a new instance of the flags
- *
+ *
* @param name
*/
-
public BCM570xFlags(String name) {
this.name = name;
}
@@ -57,7 +55,6 @@
/**
* Gets the name of the device
*/
-
public String getName() {
return name;
}
Modified: trunk/net/src/driver/org/jnode/driver/net/eepro100/EEPRO100Buffer.java
===================================================================
--- trunk/net/src/driver/org/jnode/driver/net/eepro100/EEPRO100Buffer.java 2008-06-08 05:47:07 UTC (rev 4215)
+++ trunk/net/src/driver/org/jnode/driver/net/eepro100/EEPRO100Buffer.java 2008-06-08 07:26:19 UTC (rev 4216)
@@ -135,7 +135,7 @@
regs.setReg16(SCBStatus, status & IntrAllNormal);
log.debug("transmitting status = " + NumberUtils.hex(status) + ", cmd=" +
- NumberUtils.hex(regs.getReg16(SCBStatus)) + "\n");
+ NumberUtils.hex(regs.getReg16(SCBStatus)) + "\n");
txFD.setStatus(0);
txFD.setCommand(CmdSuspend | CmdTx | CmdTxFlex);
@@ -153,6 +153,7 @@
// TODO wait 10 ms for transmiting;
long start = System.currentTimeMillis();
while ((System.currentTimeMillis() <= start + 10) && (txFD.getStatus() != 0)) {
+ // FIXME ... busy wait!!!!
}
s2 = regs.getReg16(SCBStatus);
log.debug("Tx FD :");
@@ -175,8 +176,7 @@
regs.setReg16(SCBCmd, SCBMaskAll | RxStart);
EEPRO100Utils.waitForCmdDone(regs);
- log.debug("Got a packet: Len="
- + NumberUtils.hex(rxPacket.getCount()));
+ log.debug("Got a packet: Len=" + NumberUtils.hex(rxPacket.getCount()));
final SocketBuffer skbuf = rxPacket.getPacket();
driver.onReceive(skbuf);
@@ -188,7 +188,6 @@
*
*/
public void txProcess() {
-
// Caution: the write order is important here, set the base address with
// the "ownership" bits last.
@@ -200,8 +199,7 @@
txRing[txEntry].setCommand(CmdSuspend | CmdTx | CmdTxFlex);
getNextTx();
- txRing[txEntry].setLink(txRing[getCurTx() & TX_RING_SIZE - 1]
- .getBufferAddress());
+ txRing[txEntry].setLink(txRing[getCurTx() & TX_RING_SIZE - 1].getBufferAddress());
// We may nominally release the lock here.
txRing[txEntry].setDescriptorAddress(txRing[txEntry].getBufferAddress() + 16);
// The data region is always in one buffer descriptor.
@@ -302,6 +300,6 @@
* @param rxMode The rxMode to set.
*/
public void setRxMode(int rxMode) {
- this.rxMode = rxMode;
- }
+ this.rxMode = rxMode;
+ }
}
Modified: trunk/net/src/driver/org/jnode/driver/net/eepro100/EEPRO100Constants.java
===================================================================
--- trunk/net/src/driver/org/jnode/driver/net/eepro100/EEPRO100Constants.java 2008-06-08 05:47:07 UTC (rev 4215)
+++ trunk/net/src/driver/org/jnode/driver/net/eepro100/EEPRO100Constants.java 2008-06-08 07:26:19 UTC (rev 4216)
@@ -23,147 +23,131 @@
/**
* @author flesire
- * <p/>
- * TODO To change the template for this generated type comment go to Window -
- * Preferences - Java - Code Generation - Code and Comments
*/
public interface EEPRO100Constants {
- final static int MAX_ETH_FRAME_LEN = 1536;
+ static final int MAX_ETH_FRAME_LEN = 1536;
/* The ring sizes should be a power of two for efficiency. */
- final static int TX_RING_SIZE = 32; /* Effectively 2 entries fewer. */
- final static int RX_RING_SIZE = 32;
+ static final int TX_RING_SIZE = 32; /* Effectively 2 entries fewer. */
+ static final int RX_RING_SIZE = 32;
/* Actual number of TX packets queued, must be <= TX_RING_SIZE-2. */
- final static int TX_QUEUE_LIMIT = 12;
- final static int TX_QUEUE_UNFULL = 8;
+ static final int TX_QUEUE_LIMIT = 12;
+ static final int TX_QUEUE_UNFULL = 8;
/* Time in jiffies before concluding the transmitter is hung. */
- final static int HZ = 1000;
- final static int TX_TIMEOUT = (2 * HZ);
+ static final int HZ = 1000;
+ static final int TX_TIMEOUT = (2 * HZ);
/* PHY media interface chips. */
- final static String phys[] = {"None", "i82553-A/B", "i82553-C", "i82503", "DP83840", "80c240", "80c24", "i82555",
- "Microlinear", "Level One", "DP83840A", "ICS 1890", "unknown-12", "unknown-13", "unknown-14", "unknown-15",};
- final static int NonSuchPhy = 0;
- final static int I82553AB = 1;
- final static int I82553C = 2;
- final static int I82503 = 3;
- final static int DP83840 = 4;
- final static int S80C240 = 5;
- final static int S80C24 = 6;
- final static int I82555 = 7;
- final static int DP83840A = 10;
+ static final String phys[] = {
+ "None", "i82553-A/B", "i82553-C", "i82503", "DP83840", "80c240", "80c24", "i82555",
+ "Microlinear", "Level One", "DP83840A", "ICS 1890", "unknown-12", "unknown-13",
+ "unknown-14", "unknown-15"
+ };
+ static final int NonSuchPhy = 0;
+ static final int I82553AB = 1;
+ static final int I82553C = 2;
+ static final int I82503 = 3;
+ static final int DP83840 = 4;
+ static final int S80C240 = 5;
+ static final int S80C24 = 6;
+ static final int I82555 = 7;
+ static final int DP83840A = 10;
/*
* The parameters for a CmdConfigure operation. There are so many options
* that it would be difficult to document each bit. We mostly use the
* default or recommended settings.
*/
- final static byte i82557ConfigCmd[] = {22, 0x08, 0, 0, 0, 0, 0x32, 0x03, 1, /*
- * 1=Use MII
- * 0=Use AUI
- */
- 0, 0x2E, 0, 0x60, 0, (byte) 0xf2, 0x48, 0, 0x40, (byte) 0xf2, (byte) 0x80, /*
- * 0x40=Force
- * full-duplex
- */
+ static final byte i82557ConfigCmd[] = {
+ 22, 0x08, 0, 0, 0, 0, 0x32, 0x03, 1, /* 1=Use MII 0=Use AUI */
+ 0, 0x2E, 0, 0x60, 0, (byte) 0xf2, 0x48, 0, 0x40, (byte) 0xf2,
+ (byte) 0x80, /* 0x40=Force full-duplex */
0x3f, 0x05};
- final static byte i82558ConfigCmd[] = {22, 0x08, 0, 1, 0, 0, (byte) 0x22, 0x03, 1, /*
- * 1=Use
- * MII
- * 0=Use
- * AUI
- */
- 0, 0x2E, 0, 0x60, 0x8, (byte) 0x88, 0x68, 0, 0x40, (byte) 0xf2, (byte) 0x84, /*
- * 0xBD->0xFD=Force
- * full-duplex
- */
+ static final byte i82558ConfigCmd[] = {
+ 22, 0x08, 0, 1, 0, 0, (byte) 0x22, 0x03, 1, /* 1=Use MII 0=Use AUI */
+ 0, 0x2E, 0, 0x60, 0x8, (byte) 0x88, 0x68, 0, 0x40, (byte) 0xf2,
+ (byte) 0x84, /* 0xBD->0xFD=Force full-duplex */
0x31, 0x05};
/* EEPROM_Ctrl bits. */
- final static int EE_SHIFT_CLK = 0x01; /* EEPROM shift clock. */
- final static int EE_CS = 0x02; /* EEPROM chip select. */
- final static int EE_DATA_WRITE = 0x04; /* EEPROM chip data in. */
- final static int EE_DATA_READ = 0x08; /* EEPROM chip data out. */
- final static int EE_WRITE_0 = 0x4802;
- final static int EE_WRITE_1 = 0x4806;
- final static int EE_ENB = (0x4800 | EE_CS);
- final static int EE_READ_CMD = 6;
+ static final int EE_SHIFT_CLK = 0x01; /* EEPROM shift clock. */
+ static final int EE_CS = 0x02; /* EEPROM chip select. */
+ static final int EE_DATA_WRITE = 0x04; /* EEPROM chip data in. */
+ static final int EE_DATA_READ = 0x08; /* EEPROM chip data out. */
+ static final int EE_WRITE_0 = 0x4802;
+ static final int EE_WRITE_1 = 0x4806;
+ static final int EE_ENB = (0x4800 | EE_CS);
+ static final int EE_READ_CMD = 6;
- final static int SCBStatus = 0;
- final static int SCBCmd = 2; /* Rx/Command Unit command and status. */
- final static int SCBPointer = 4; /* General purpose pointer. */
- final static int SCBPort = 8; /* Misc. commands and operands. */
- final static int SCBflash = 12;
- final static int SCBeeprom = 14; /* EEPROM and flash memory control. */
- final static int SCBCtrlMDI = 16; /* MDI interface control. */
- final static int SCBEarlyRx = 20; /* Early receive byte count. */
+ static final int SCBStatus = 0;
+ static final int SCBCmd = 2; /* Rx/Command Unit command and status. */
+ static final int SCBPointer = 4; /* General purpose pointer. */
+ static final int SCBPort = 8; /* Misc. commands and operands. */
+ static final int SCBflash = 12;
+ static final int SCBeeprom = 14; /* EEPROM and flash memory control. */
+ static final int SCBCtrlMDI = 16; /* MDI interface control. */
+ static final int SCBEarlyRx = 20; /* Early receive byte count. */
/* Commands that can be put in a command list entry. */
- final static int CmdNOp = 0;
- final static int CmdIASetup = 0x10000;
- final static int CmdConfigure = 0x20000;
- final static int CmdMulticastList = 0x30000;
- final static int CmdTx = 0x40000;
- final static int CmdTDR = 0x50000;
- final static int CmdDump = 0x60000;
- final static int CmdDiagnose = 0x70000;
- final static int CmdSuspend = 0x40000000; /* Suspend after completion. */
- final static int CmdIntr = 0x20000000; /* Interrupt after completion. */
- final static int CmdTxFlex = 0x00080000; /*
- * Use "Flexible mode" for CmdTx
- * command.
- */
+ static final int CmdNOp = 0;
+ static final int CmdIASetup = 0x10000;
+ static final int CmdConfigure = 0x20000;
+ static final int CmdMulticastList = 0x30000;
+ static final int CmdTx = 0x40000;
+ static final int CmdTDR = 0x50000;
+ static final int CmdDump = 0x60000;
+ static final int CmdDiagnose = 0x70000;
+ static final int CmdSuspend = 0x40000000; /* Suspend after completion. */
+ static final int CmdIntr = 0x20000000; /* Interrupt after completion. */
+ static final int CmdTxFlex = 0x00080000; /* Use "Flexible mode" for CmdTx command. */
/* Do atomically if possible. */
- final static int SCBMaskCmdDone = 0x8000;
- final static int SCBMaskRxDone = 0x4000;
- final static int SCBMaskCmdIdle = 0x2000;
- final static int SCBMaskRxSuspend = 0x1000;
- final static int SCBMaskEarlyRx = 0x0800;
- final static int SCBMaskFlowCtl = 0x0400;
- final static int SCBTriggerIntr = 0x0200;
- final static int SCBMaskAll = 0x0100;
+ static final int SCBMaskCmdDone = 0x8000;
+ static final int SCBMaskRxDone = 0x4000;
+ static final int SCBMaskCmdIdle = 0x2000;
+ static final int SCBMaskRxSuspend = 0x1000;
+ static final int SCBMaskEarlyRx = 0x0800;
+ static final int SCBMaskFlowCtl = 0x0400;
+ static final int SCBTriggerIntr = 0x0200;
+ static final int SCBMaskAll = 0x0100;
/* The rest are Rx and Tx commands. */
- final static int CUStart = 0x0010;
- final static int CUResume = 0x0020;
- final static int CUHiPriStart = 0x0030;
- final static int CUStatsAddr = 0x0040;
- final static int CUShowStats = 0x0050;
- final static int CUCmdBase = 0x0060; /* CU Base address (set to zero) . */
- final static int CUDumpStats = 0x0070; /* Dump then reset stats counters. */
- final static int CUHiPriResume = 0x00b0; /*
- * Resume for the high priority Tx
- * queue.
- */
+ static final int CUStart = 0x0010;
+ static final int CUResume = 0x0020;
+ static final int CUHiPriStart = 0x0030;
+ static final int CUStatsAddr = 0x0040;
+ static final int CUShowStats = 0x0050;
+ static final int CUCmdBase = 0x0060; /* CU Base address (set to zero) . */
+ static final int CUDumpStats = 0x0070; /* Dump then reset stats counters. */
+ static final int CUHiPriResume = 0x00b0; /* Resume for the high priority Tx queue.,*/
- final static int RxStart = 0x0001;
- final static int RxResume = 0x0002;
- final static int RxAbort = 0x0004;
- final static int RxAddrLoad = 0x0006;
- final static int RxResumeNoResources = 0x0007;
- final static int IntrCmdDone = 0x8000;
- final static int IntrRxDone = 0x4000;
- final static int IntrCmdIdle = 0x2000;
- final static int IntrRxSuspend = 0x1000;
- final static int IntrMIIDone = 0x0800;
- final static int IntrDrvrIntr = 0x0400;
- final static int IntrAllNormal = 0xfc00;
- final static int PortReset = 0;
- final static int PortSelfTest = 1;
- final static int PortPartialReset = 2;
- final static int PortDump = 3;
+ static final int RxStart = 0x0001;
+ static final int RxResume = 0x0002;
+ static final int RxAbort = 0x0004;
+ static final int RxAddrLoad = 0x0006;
+ static final int RxResumeNoResources = 0x0007;
+ static final int IntrCmdDone = 0x8000;
+ static final int IntrRxDone = 0x4000;
+ static final int IntrCmdIdle = 0x2000;
+ static final int IntrRxSuspend = 0x1000;
+ static final int IntrMIIDone = 0x0800;
+ static final int IntrDrvrIntr = 0x0400;
+ static final int IntrAllNormal = 0xfc00;
+ static final int PortReset = 0;
+ static final int PortSelfTest = 1;
+ static final int PortPartialReset = 2;
+ static final int PortDump = 3;
- final static int RxComplete = 0x8000;
- final static int RxOK = 0x2000;
- final static int RxErrCRC = 0x0800;
- final static int RxErrAlign = 0x0400;
- final static int RxErrTooBig = 0x0200;
- final static int RxErrSymbol = 0x0010;
- final static int RxEth2Type = 0x0020;
- final static int RxNoMatch = 0x0004;
- final static int RxNoIAMatch = 0x0002;
- final static int TxUnderrun = 0x1000;
- final static int StatusComplete = 0x8000;
+ static final int RxComplete = 0x8000;
+ static final int RxOK = 0x2000;
+ static final int RxErrCRC = 0x0800;
+ static final int RxErrAlign = 0x0400;
+ static final int RxErrTooBig = 0x0200;
+ static final int RxErrSymbol = 0x0010;
+ static final int RxEth2Type = 0x0020;
+ static final int RxNoMatch = 0x0004;
+ static final int RxNoIAMatch = 0x0002;
+ static final int TxUnderrun = 0x1000;
+ static final int StatusComplete = 0x8000;
}
Modified: trunk/net/src/driver/org/jnode/driver/net/eepro100/EEPRO100Core.java
===================================================================
--- trunk/net/src/driver/org/jnode/driver/net/eepro100/EEPRO100Core.java 2008-06-08 05:47:07 UTC (rev 4215)
+++ trunk/net/src/driver/org/jnode/driver/net/eepro100/EEPRO100Core.java 2008-06-08 07:26:19 UTC (rev 4216)
@@ -51,8 +51,8 @@
/**
* @author Fabien Lesire (galatnm at gmail dot com)
*/
-public class EEPRO100Core extends AbstractDeviceCore implements IRQHandler,
- EEPRO100Constants, EthernetConstants {
+public class EEPRO100Core extends AbstractDeviceCore implements IRQHandler, EEPRO100Constants,
+ EthernetConstants {
/**
* Device Driver
*/
@@ -72,16 +72,14 @@
* IRQ
*/
private final IRQResource irq;
-
- /** */
+
private ResourceManager rm;
/**
* My ethernet address
*/
private EthernetAddress hwAddress;
-
- /** */
+
private int[] eeprom;
/**
@@ -103,25 +101,17 @@
* RX/TX
*/
private EEPRO100Buffer buffers;
-
- /** */
- private int phy[];
-
- /** */
- private int eeReadCmd;
-
- /** */
- private int eeSize;
-
- /** */
+
+ private int phy[];
+ private int eeReadCmd;
+ private int eeSize;
private int eeAddress;
/**
* Enable congestion control in the DP83840.
*/
- final static boolean congenb = false;
+ static final boolean congenb = false;
- /** */
boolean txFull;
/**
@@ -129,9 +119,8 @@
*
* @throws ResourceNotFreeException
*/
- public EEPRO100Core(EEPRO100Driver driver, ResourceOwner owner,
- PCIDevice device, EEPRO100Flags flags)
- throws ResourceNotFreeException, DriverException {
+ public EEPRO100Core(EEPRO100Driver driver, ResourceOwner owner, PCIDevice device,
+ EEPRO100Flags flags) throws ResourceNotFreeException, DriverException {
phy = new int[2];
@@ -142,8 +131,7 @@
this.iobase = getIOBase(device, flags);
final int iolength = getIOLength(device, flags);
- log.debug("Found EEPRO100 IOBase: 0x" + NumberUtils.hex(iobase)
- + ", length: " + iolength);
+ log.debug("Found EEPRO100 IOBase: 0x" + NumberUtils.hex(iobase) + ", length: " + iolength);
try {
rm = (ResourceManager) InitialNaming.lookup(ResourceManager.NAME);
@@ -178,8 +166,7 @@
eeReadCmd = EE_READ_CMD << 22;
}
- log.debug("EEProm size: " + NumberUtils.hex(eeSize) + " read command: "
- + eeReadCmd);
+ log.debug("EEProm size: " + NumberUtils.hex(eeSize) + " read command: " + eeReadCmd);
int x, y, sum;
final byte[] hwAddrArr = new byte[ETH_ALEN];
@@ -197,40 +184,29 @@
this.hwAddress = new EthernetAddress(hwAddrArr, 0);
if (sum != 0xBABA) {
- log.debug(this.flags.getName() + ": Invalid EEPROM checksum "
- + NumberUtils.hex(sum)
- + ", check settings before activating this device!");
+ log.debug(this.flags.getName() + ": Invalid EEPROM checksum " + NumberUtils.hex(sum) +
+ ", check settings before activating this device!");
}
regs.setReg32(SCBPort, PortReset);
sys...
[truncated message content] |