|
From: <ls...@us...> - 2007-05-02 20:43:28
|
Revision: 3177
http://jnode.svn.sourceforge.net/jnode/?rev=3177&view=rev
Author: lsantha
Date: 2007-05-02 13:43:25 -0700 (Wed, 02 May 2007)
Log Message:
-----------
via-rhine nic driver, initial commit.
Added Paths:
-----------
trunk/net/src/driver/org/jnode/driver/net/via_rhine/
trunk/net/src/driver/org/jnode/driver/net/via_rhine/ViaRhineConstants.java
Added: trunk/net/src/driver/org/jnode/driver/net/via_rhine/ViaRhineConstants.java
===================================================================
--- trunk/net/src/driver/org/jnode/driver/net/via_rhine/ViaRhineConstants.java (rev 0)
+++ trunk/net/src/driver/org/jnode/driver/net/via_rhine/ViaRhineConstants.java 2007-05-02 20:43:25 UTC (rev 3177)
@@ -0,0 +1,474 @@
+/*
+ * $Id$
+ */
+package org.jnode.driver.net.via_rhine;
+
+/**
+ * @author Levente S\xE1ntha
+ */
+public interface ViaRhineConstants {
+ byte ioaddr = 0;
+ byte byPAR0 = ioaddr;
+ byte byRCR = ioaddr + 6;
+ byte byTCR = ioaddr + 7;
+ byte byCR0 = ioaddr + 8;
+ byte byCR1 = ioaddr + 9;
+ byte byISR0 = ioaddr + 0x0c;
+ byte byISR1 = ioaddr + 0x0d;
+ byte byIMR0 = ioaddr + 0x0e;
+ byte byIMR1 = ioaddr + 0x0f;
+ byte byMAR0 = ioaddr + 0x10;
+ byte byMAR1 = ioaddr + 0x11;
+ byte byMAR2 = ioaddr + 0x12;
+ byte byMAR3 = ioaddr + 0x13;
+ byte byMAR4 = ioaddr + 0x14;
+ byte byMAR5 = ioaddr + 0x15;
+ byte byMAR6 = ioaddr + 0x16;
+ byte byMAR7 = ioaddr + 0x17;
+ int dwCurrentRxDescAddr = ioaddr + 0x18;
+ int dwCurrentTxDescAddr = ioaddr + 0x1c;
+ int dwCurrentRDSE0 = ioaddr + 0x20;
+ int dwCurrentRDSE1 = ioaddr + 0x24;
+ int dwCurrentRDSE2 = ioaddr + 0x28;
+ int dwCurrentRDSE3 = ioaddr + 0x2c;
+ int dwNextRDSE0 = ioaddr + 0x30;
+ int dwNextRDSE1 = ioaddr + 0x34;
+ int dwNextRDSE2 = ioaddr + 0x38;
+ int dwNextRDSE3 = ioaddr + 0x3c;
+ int dwCurrentTDSE0 = ioaddr + 0x40;
+ int dwCurrentTDSE1 = ioaddr + 0x44;
+ int dwCurrentTDSE2 = ioaddr + 0x48;
+ int dwCurrentTDSE3 = ioaddr + 0x4c;
+ int dwNextTDSE0 = ioaddr + 0x50;
+ int dwNextTDSE1 = ioaddr + 0x54;
+ int dwNextTDSE2 = ioaddr + 0x58;
+ int dwNextTDSE3 = ioaddr + 0x5c;
+ int dwCurrRxDMAPtr = ioaddr + 0x60;
+ int dwCurrTxDMAPtr = ioaddr + 0x64;
+ int byMPHY = ioaddr + 0x6c;
+ int byMIISR = ioaddr + 0x6d;
+ int byBCR0 = ioaddr + 0x6e;
+ int byBCR1 = ioaddr + 0x6f;
+ int byMIICR = ioaddr + 0x70;
+ int byMIIAD = ioaddr + 0x71;
+ int wMIIDATA = ioaddr + 0x72;
+ int byEECSR = ioaddr + 0x74;
+ int byTEST = ioaddr + 0x75;
+ int byGPIO = ioaddr + 0x76;
+ int byCFGA = ioaddr + 0x78;
+ int byCFGB = ioaddr + 0x79;
+ int byCFGC = ioaddr + 0x7a;
+ int byCFGD = ioaddr + 0x7b;
+ int wTallyCntMPA = ioaddr + 0x7c;
+ int wTallyCntCRC = ioaddr + 0x7d;
+ int bySTICKHW = ioaddr + 0x83;
+ int byWOLcrClr = ioaddr + 0xA4;
+ int byWOLcgClr = ioaddr + 0xA7;
+ int byPwrcsrClr = ioaddr + 0xAC;
+
+/*--------------------- Exioaddr Definitions -------------------------*/
+
+/*
+ * Bits in the RCR register
+ */
+
+ int RCR_RRFT2 = 0x80;
+ int RCR_RRFT1 = 0x40;
+ int RCR_RRFT0 = 0x20;
+ int RCR_PROM = 0x10;
+ int RCR_AB = 0x08;
+ int RCR_AM = 0x04;
+ int RCR_AR = 0x02;
+ int RCR_SEP = 0x01;
+
+/*
+ * Bits in the TCR register
+ */
+
+ int TCR_RTSF = 0x80;
+ int TCR_RTFT1 = 0x40;
+ int TCR_RTFT0 = 0x20;
+ int TCR_OFSET = 0x08;
+ int TCR_LB1 = 0x04; /* loopback[1] */
+ int TCR_LB0 = 0x02; /* loopback[0] */
+
+/*
+ * Bits in the CR0 register
+ */
+
+ int CR0_RDMD = 0x40; /* rx descriptor polling demand */
+ int CR0_TDMD = 0x20; /* tx descriptor polling demand */
+ int CR0_TXON = 0x10;
+ int CR0_RXON = 0x08;
+ int CR0_STOP = 0x04; /* stop NIC, default = 1 */
+ int CR0_STRT = 0x02; /* start NIC */
+ int CR0_INIT = 0x01; /* start init process */
+
+/*
+* Bits in the CR1 register
+*/
+
+ int CR1_SFRST = 0x80 /* software reset */;
+ int CR1_RDMD1 = 0x40 /* RDMD1 */;
+ int CR1_TDMD1 = 0x20 /* TDMD1 */;
+ int CR1_KEYPAG = 0x10 /* turn on par/key */;
+ int CR1_DPOLL = 0x08 /* disable rx/tx auto polling */;
+ int CR1_FDX = 0x04 /* full duplex mode */;
+ int CR1_ETEN = 0x02 /* early tx mode */;
+ int CR1_EREN = 0x01 /* early rx mode */;
+
+/*
+ * Bits in the CR register
+ */
+
+ int CR_RDMD = 0x0040 /* rx descriptor polling demand */;
+ int CR_TDMD = 0x0020 /* tx descriptor polling demand */;
+ int CR_TXON = 0x0010;
+ int CR_RXON = 0x0008;
+ int CR_STOP = 0x0004 /* stop NIC, default = 1 */;
+ int CR_STRT = 0x0002 /* start NIC */;
+ int CR_INIT = 0x0001 /* start init process */;
+ int CR_SFRST = 0x8000 /* software reset */;
+ int CR_RDMD1 = 0x4000 /* RDMD1 */;
+ int CR_TDMD1 = 0x2000 /* TDMD1 */;
+ int CR_KEYPAG = 0x1000 /* turn on par/key */;
+ int CR_DPOLL = 0x0800 /* disable rx/tx auto polling */;
+ int CR_FDX = 0x0400 /* full duplex mode */;
+ int CR_ETEN = 0x0200 /* early tx mode */;
+ int CR_EREN = 0x0100 /* early rx mode */;
+
+/*
+ * Bits in the IMR0 register
+ */
+
+ int IMR0_CNTM = 0x80;
+ int IMR0_BEM = 0x40;
+ int IMR0_RUM = 0x20;
+ int IMR0_TUM = 0x10;
+ int IMR0_TXEM = 0x08;
+ int IMR0_RXEM = 0x04;
+ int IMR0_PTXM = 0x02;
+ int IMR0_PRXM = 0x01;
+
+/* define imrshadow */
+
+ int IMRShadow = 0x5AFF;
+
+/*
+ * Bits in the IMR1 register
+ */
+
+ int IMR1_INITM = 0x80;
+ int IMR1_SRCM = 0x40;
+ int IMR1_NBFM = 0x10;
+ int IMR1_PRAIM = 0x08;
+ int IMR1_RES0M = 0x04;
+ int IMR1_ETM = 0x02;
+ int IMR1_ERM = 0x01;
+
+/*
+ * Bits in the ISR register
+ */
+
+ int ISR_INITI = 0x8000;
+ int ISR_SRCI = 0x4000;
+ int ISR_ABTI = 0x2000;
+ int ISR_NORBF = 0x1000;
+ int ISR_PKTRA = 0x0800;
+ int ISR_RES0 = 0x0400;
+ int ISR_ETI = 0x0200;
+ int ISR_ERI = 0x0100;
+ int ISR_CNT = 0x0080;
+ int ISR_BE = 0x0040;
+ int ISR_RU = 0x0020;
+ int ISR_TU = 0x0010;
+ int ISR_TXE = 0x0008;
+ int ISR_RXE = 0x0004;
+ int ISR_PTX = 0x0002;
+ int ISR_PRX = 0x0001;
+
+/*
+ * Bits in the ISR0 register;
+ */
+
+ int ISR0_CNT = 0x80;
+ int ISR0_BE = 0x40;
+ int ISR0_RU = 0x20;
+ int ISR0_TU = 0x10;
+ int ISR0_TXE = 0x08;
+ int ISR0_RXE = 0x04;
+ int ISR0_PTX = 0x02;
+ int ISR0_PRX = 0x01;
+
+/*
+ * Bits in the ISR1 register
+ */
+
+ int ISR1_INITI = 0x80;
+ int ISR1_SRCI = 0x40;
+ int ISR1_NORBF = 0x10;
+ int ISR1_PKTRA = 0x08;
+ int ISR1_ETI = 0x02;
+ int ISR1_ERI = 0x01;
+
+/* ISR ABNORMAL CONDITION */
+
+ int ISR_ABNORMAL = ISR_BE + ISR_RU + ISR_TU + ISR_CNT + ISR_NORBF + ISR_PKTRA;
+
+/*
+ * Bits in the MIISR register;
+ */
+
+ int MIISR_MIIERR = 0x08;
+ int MIISR_MRERR = 0x04;
+ int MIISR_LNKFL = 0x02;
+ int MIISR_SPEED = 0x01;
+
+/*
+ * Bits in the MIICR register;
+ */
+
+ int MIICR_MAUTO = 0x80;
+ int MIICR_RCMD = 0x40;
+ int MIICR_WCMD = 0x20;
+ int MIICR_MDPM = 0x10;
+ int MIICR_MOUT = 0x08;
+ int MIICR_MDO = 0x04;
+ int MIICR_MDI = 0x02;
+ int MIICR_MDC = 0x01;
+
+/*
+ * Bits in the EECSR register;
+ */
+
+ int EECSR_EEPR = 0x80 /* eeprom programed status, 73h means programed */;
+ int EECSR_EMBP = 0x40 /* eeprom embeded programming */;
+ int EECSR_AUTOLD = 0x20 /* eeprom content reload */;
+ int EECSR_DPM = 0x10 /* eeprom direct programming */;
+ int EECSR_CS = 0x08 /* eeprom CS pin */;
+ int EECSR_SK = 0x04 /* eeprom SK pin */;
+ int EECSR_DI = 0x02 /* eeprom DI pin */;
+ int EECSR_DO = 0x01 /* eeprom DO pin */;
+
+/*
+ * Bits in the BCR0 register;
+ */
+
+ int BCR0_CRFT2 = 0x20;
+ int BCR0_CRFT1 = 0x10;
+ int BCR0_CRFT0 = 0x08;
+ int BCR0_DMAL2 = 0x04;
+ int BCR0_DMAL1 = 0x02;
+ int BCR0_DMAL0 = 0x01;
+
+ /*
+ * Bits in the BCR1 register;
+ */
+ int BCR1_CTSF = 0x20;
+ int BCR1_CTFT1 = 0x10;
+ int BCR1_CTFT0 = 0x08;
+ int BCR1_POT2 = 0x04;
+ int BCR1_POT1 = 0x02;
+ int BCR1_POT0 = 0x01;
+
+ /*
+ * Bits in the CFGA register;
+ */
+ int CFGA_EELOAD = 0x80 /* enable eeprom embeded and direct programming */;
+ int CFGA_JUMPER = 0x40;
+ int CFGA_MTGPIO = 0x08;
+ int CFGA_T10EN = 0x02;
+ int CFGA_AUTO = 0x01;
+
+ /*
+ * Bits in the CFGB register;
+ */
+ int CFGB_PD = 0x80;
+ int CFGB_POLEN = 0x02;
+ int CFGB_LNKEN = 0x01;
+
+ /*
+ * Bits in the CFGC register;
+ */
+ int CFGC_M10TIO = 0x80;
+ int CFGC_M10POL = 0x40;
+ int CFGC_PHY1 = 0x20;
+ int CFGC_PHY0 = 0x10;
+ int CFGC_BTSEL = 0x08;
+ int CFGC_BPS2 = 0x04 /* bootrom select[2] */;
+ int CFGC_BPS1 = 0x02 /* bootrom select[1] */;
+ int CFGC_BPS0 = 0x01 /* bootrom select[0] */;
+
+ /*
+ * Bits in the CFGD register;
+ */
+ int CFGD_GPIOEN = 0x80;
+ int CFGD_DIAG = 0x40;
+ int CFGD_MAGIC = 0x10;
+ int CFGD_RANDOM = 0x08;
+ int CFGD_CFDX = 0x04;
+ int CFGD_CEREN = 0x02;
+ int CFGD_CETEN = 0x01;
+
+ /* Bits in RSR */
+ int RSR_RERR = 0x00000001;
+ int RSR_CRC = 0x00000002;
+ int RSR_FAE = 0x00000004;
+ int RSR_FOV = 0x00000008;
+ int RSR_LONG = 0x00000010;
+ int RSR_RUNT = 0x00000020;
+ int RSR_SERR = 0x00000040;
+ int RSR_BUFF = 0x00000080;
+ int RSR_EDP = 0x00000100;
+ int RSR_STP = 0x00000200;
+ int RSR_CHN = 0x00000400;
+ int RSR_PHY = 0x00000800;
+ int RSR_BAR = 0x00001000;
+ int RSR_MAR = 0x00002000;
+ int RSR_RXOK = 0x00008000;
+ int RSR_ABNORMAL = RSR_RERR + RSR_LONG + RSR_RUNT;
+
+ /* Bits in TSR */
+ int TSR_NCR0 = 0x00000001;
+ int TSR_NCR1 = 0x00000002;
+ int TSR_NCR2 = 0x00000004;
+ int TSR_NCR3 = 0x00000008;
+ int TSR_COLS = 0x00000010;
+ int TSR_CDH = 0x00000080;
+ int TSR_ABT = 0x00000100;
+ int TSR_OWC = 0x00000200;
+ int TSR_CRS = 0x00000400;
+ int TSR_UDF = 0x00000800;
+ int TSR_TBUFF = 0x00001000;
+ int TSR_SERR = 0x00002000;
+ int TSR_JAB = 0x00004000;
+ int TSR_TERR = 0x00008000;
+ int TSR_ABNORMAL = TSR_TERR + TSR_OWC + TSR_ABT + TSR_JAB + TSR_CRS;
+ int TSR_OWN_BIT = 0x80000000;
+
+ int CB_DELAY_LOOP_WAIT = 10; /* 10ms */
+
+ /* enabled mask value of irq */
+ int W_IMR_MASK_VALUE = 0x1BFF; /* initial value of IMR */
+
+ /* Ethernet address filter type */
+ int PKT_TYPE_DIRECTED = 0x0001; /* obsolete, directed address is always accepted */
+ int PKT_TYPE_MULTICAST = 0x0002;
+ int PKT_TYPE_ALL_MULTICAST = 0x0004;
+ int PKT_TYPE_BROADCAST = 0x0008;
+ int PKT_TYPE_PROMISCUOUS = 0x0020;
+ int PKT_TYPE_LONG = 0x2000;
+ int PKT_TYPE_RUNT = 0x4000;
+ int PKT_TYPE_ERROR = 0x8000; /* accept error packets, e.g. CRC error */
+
+ /* Loopback mode */
+ int NIC_LB_NONE = 0x00;
+ int NIC_LB_INTERNAL = 0x01;
+ int NIC_LB_PHY = 0x02; /* MII or Internal-10BaseT loopback */
+
+ int TX_RING_SIZE = 2;
+ int RX_RING_SIZE = 2;
+ int PKT_BUF_SZ = 1536; /* Size of each temporary Rx buffer. */
+
+ int PCI_REG_MODE3 = 0x53;
+ int MODE3_MIION = 0x04; /* in PCI_REG_MOD3 OF PCI space */
+
+/* Offsets to the device registers. */
+ /*
+enum register_offsets {
+ StationAddr=0x00, RxConfig=0x06, TxConfig=0x07, ChipCmd=0x08,
+ IntrStatus=0x0C, IntrEnable=0x0E,
+ MulticastFilter0=0x10, MulticastFilter1=0x14,
+ RxRingPtr=0x18, TxRingPtr=0x1C, GFIFOTest=0x54,
+ MIIPhyAddr=0x6C, MIIStatus=0x6D, PCIBusConfig=0x6E,
+ MIICmd=0x70, MIIRegAddr=0x71, MIIData=0x72, MACRegEEcsr=0x74,
+ ConfigA=0x78, ConfigB=0x79, ConfigC=0x7A, ConfigD=0x7B,
+ RxMissed=0x7C, RxCRCErrs=0x7E, MiscCmd=0x81,
+ StickyHW=0x83, IntrStatus2=0x84, WOLcrClr=0xA4, WOLcgClr=0xA7,
+ PwrcsrClr=0xAC,
+};
+*/
+
+/* Offsets to the device registers. */
+ int StationAddr=0x00, RxConfig=0x06, TxConfig=0x07, ChipCmd=0x08,
+ IntrStatus=0x0C, IntrEnable=0x0E,
+ MulticastFilter0=0x10, MulticastFilter1=0x14,
+ RxRingPtr=0x18, TxRingPtr=0x1C, GFIFOTest=0x54,
+ MIIPhyAddr=0x6C, MIIStatus=0x6D, PCIBusConfig=0x6E,
+ MIICmd=0x70, MIIRegAddr=0x71, MIIData=0x72, MACRegEEcsr=0x74,
+ ConfigA=0x78, ConfigB=0x79, ConfigC=0x7A, ConfigD=0x7B,
+ RxMissed=0x7C, RxCRCErrs=0x7E, MiscCmd=0x81,
+ StickyHW=0x83, IntrStatus2=0x84, WOLcrClr=0xA4, WOLcgClr=0xA7,
+ PwrcsrClr=0xAC;
+
+
+/* Bits in the interrupt status/mask registers. */
+ /*
+enum intr_status_bits {
+ IntrRxDone=0x0001, IntrRxErr=0x0004, IntrRxEmpty=0x0020,
+ IntrTxDone=0x0002, IntrTxError=0x0008, IntrTxUnderrun=0x0210,
+ IntrPCIErr=0x0040,
+ IntrStatsMax=0x0080, IntrRxEarly=0x0100,
+ IntrRxOverflow=0x0400, IntrRxDropped=0x0800, IntrRxNoBuf=0x1000,
+ IntrTxAborted=0x2000, IntrLinkChange=0x4000,
+ IntrRxWakeUp=0x8000,
+ IntrNormalSummary=0x0003, IntrAbnormalSummary=0xC260,
+ IntrTxDescRace=0x080000, // mapped from IntrStatus2
+ IntrTxErrSummary=0x082218,
+};
+/* Bits in the interrupt status/mask registers. */
+
+ int IntrRxDone=0x0001, IntrRxErr=0x0004, IntrRxEmpty=0x0020,
+ IntrTxDone=0x0002, IntrTxError=0x0008, IntrTxUnderrun=0x0210,
+ IntrPCIErr=0x0040,
+ IntrStatsMax=0x0080, IntrRxEarly=0x0100,
+ IntrRxOverflow=0x0400, IntrRxDropped=0x0800, IntrRxNoBuf=0x1000,
+ IntrTxAborted=0x2000, IntrLinkChange=0x4000,
+ IntrRxWakeUp=0x8000,
+ IntrNormalSummary=0x0003, IntrAbnormalSummary=0xC260,
+ IntrTxDescRace=0x080000, // mapped from IntrStatus2
+ IntrTxErrSummary=0x082218;
+
+
+
+//#define DEFAULT_INTR (IntrRxDone | IntrRxErr | IntrRxEmpty| IntrRxOverflow | \
+// IntrRxDropped | IntrRxNoBuf)
+
+ int DEFAULT_INTR = IntrRxDone | IntrRxErr | IntrRxEmpty|
+ IntrRxOverflow | IntrRxDropped | IntrRxNoBuf;
+
+//enum rhine_revs {
+// int VT86C100A = 0x00;
+// int VTunknown0 = 0x20;
+// int VT6102 = 0x40;
+// int VT8231 = 0x50; /* Integrated MAC */
+// int VT8233 = 0x60; /* Integrated MAC */
+// int VT8235 = 0x74; /* Integrated MAC */
+// int VT8237 = 0x78; /* Integrated MAC */
+// int VTunknown1 = 0x7C;
+// int VT6105 = 0x80;
+// int VT6105_B0 = 0x83;
+// int VT6105L = 0x8A;
+// int VT6107 = 0x8C;
+// int VTunknown2 = 0x8E;
+// int VT6105M = 0x90;
+//};
+
+//enum rhine_revs {
+ int VT86C100A = 0x00;
+ int VTunknown0 = 0x20;
+ int VT6102 = 0x40;
+ int VT8231 = 0x50; /* Integrated MAC */
+ int VT8233 = 0x60; /* Integrated MAC */
+ int VT8235 = 0x74; /* Integrated MAC */
+ int VT8237 = 0x78; /* Integrated MAC */
+ int VTunknown1 = 0x7C;
+ int VT6105 = 0x80;
+ int VT6105_B0 = 0x83;
+ int VT6105L = 0x8A;
+ int VT6107 = 0x8C;
+ int VTunknown2 = 0x8E;
+ int VT6105M = 0x90;
+//};
+
+}
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <hag...@us...> - 2008-05-30 12:27:55
|
Revision: 4155
http://jnode.svn.sourceforge.net/jnode/?rev=4155&view=rev
Author: hagar-wize
Date: 2008-05-30 05:27:50 -0700 (Fri, 30 May 2008)
Log Message:
-----------
reformat code
Modified Paths:
--------------
trunk/net/src/driver/org/jnode/driver/net/lance/BufferManager.java
trunk/net/src/driver/org/jnode/driver/net/lance/DWordIOAccess.java
trunk/net/src/driver/org/jnode/driver/net/lance/Descriptor.java
trunk/net/src/driver/org/jnode/driver/net/lance/DescriptorRing.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/LanceConstants.java
trunk/net/src/driver/org/jnode/driver/net/lance/LanceCore.java
trunk/net/src/driver/org/jnode/driver/net/lance/LanceDriver.java
trunk/net/src/driver/org/jnode/driver/net/lance/LanceFlags.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/lance/TxDescriptor.java
trunk/net/src/driver/org/jnode/driver/net/lance/TxDescriptorRing.java
trunk/net/src/driver/org/jnode/driver/net/lance/WordIOAccess.java
trunk/net/src/driver/org/jnode/driver/net/loopback/LoopbackDevice.java
trunk/net/src/driver/org/jnode/driver/net/loopback/LoopbackDriver.java
trunk/net/src/driver/org/jnode/driver/net/loopback/LoopbackFinder.java
trunk/net/src/driver/org/jnode/driver/net/rtl8139/RTL8139Constants.java
Modified: trunk/net/src/driver/org/jnode/driver/net/lance/BufferManager.java
===================================================================
--- trunk/net/src/driver/org/jnode/driver/net/lance/BufferManager.java 2008-05-30 12:21:53 UTC (rev 4154)
+++ trunk/net/src/driver/org/jnode/driver/net/lance/BufferManager.java 2008-05-30 12:27:50 UTC (rev 4155)
@@ -18,7 +18,7 @@
* along with this library; If not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-
+
package org.jnode.driver.net.lance;
import org.apache.log4j.Logger;
@@ -30,115 +30,113 @@
import org.jnode.system.ResourceOwner;
/**
- *
* @author Chris Cole
- *
*/
public class BufferManager {
- static final public int DATA_BUFFER_SIZE = 1544;
+ static final public int DATA_BUFFER_SIZE = 1544;
- /** MemoryResource to hold initialization block, descriptor rings, and data buffers */
- private MemoryResource mem;
+ /**
+ * MemoryResource to hold initialization block, descriptor rings, and data buffers
+ */
+ private MemoryResource mem;
- private final InitializationBlock32Bit initBlock;
- private final RxDescriptorRing rxRing;
- private final TxDescriptorRing txRing;
-
- private final int size;
+ private final InitializationBlock32Bit initBlock;
+ private final RxDescriptorRing rxRing;
+ private final TxDescriptorRing txRing;
- public BufferManager(
- int rxRingLength,
- int txRingLength,
- int mode,
- EthernetAddress physicalAddr,
- long logicalAddr,
- ResourceManager rm,
- ResourceOwner owner) {
+ private final int size;
- // Compute the required size for the memory resource
- size =
- InitializationBlock32Bit.INIT_BLOCK_SIZE
- + ((rxRingLength + txRingLength)
- * (Descriptor.MESSAGE_DESCRIPTOR_SIZE
- + DATA_BUFFER_SIZE));
-
-
+ public BufferManager(
+ int rxRingLength,
+ int txRingLength,
+ int mode,
+ EthernetAddress physicalAddr,
+ long logicalAddr,
+ ResourceManager rm,
+ ResourceOwner owner) {
- // Get the memory
- try {
- mem =
- rm.claimMemoryResource(
- owner,
- null,
- size,
- ResourceManager.MEMMODE_NORMAL);
- } catch (ResourceNotFreeException e) {
- System.out.println("buffer memory resouce not free exception");
- }
+ // Compute the required size for the memory resource
+ size =
+ InitializationBlock32Bit.INIT_BLOCK_SIZE
+ + ((rxRingLength + txRingLength)
+ * (Descriptor.MESSAGE_DESCRIPTOR_SIZE
+ + DATA_BUFFER_SIZE));
- // define the offsets into the memory resource for the entities
- final int rxRingOffset = InitializationBlock32Bit.INIT_BLOCK_SIZE;
+ // Get the memory
+ try {
+ mem =
+ rm.claimMemoryResource(
+ owner,
+ null,
+ size,
+ ResourceManager.MEMMODE_NORMAL);
+ } catch (ResourceNotFreeException e) {
+ System.out.println("buffer memory resouce not free exception");
+ }
- final int txRingOffset =
- rxRingOffset + (rxRingLength * Descriptor.MESSAGE_DESCRIPTOR_SIZE);
+ // define the offsets into the memory resource for the entities
+ final int rxRingOffset = InitializationBlock32Bit.INIT_BLOCK_SIZE;
- final int rxDataBufferOffset =
- txRingOffset + (txRingLength * Descriptor.MESSAGE_DESCRIPTOR_SIZE);
+ final int txRingOffset =
+ rxRingOffset + (rxRingLength * Descriptor.MESSAGE_DESCRIPTOR_SIZE);
- final int txDataBufferOffset =
- rxDataBufferOffset + (rxRingLength * DATA_BUFFER_SIZE);
+ final int rxDataBufferOffset =
+ txRingOffset + (txRingLength * Descriptor.MESSAGE_DESCRIPTOR_SIZE);
- // Create and initialize the receive ring
- rxRing =
- new RxDescriptorRing(
- mem,
- rxRingOffset,
- rxRingLength,
- rxDataBufferOffset);
+ final int txDataBufferOffset =
+ rxDataBufferOffset + (rxRingLength * DATA_BUFFER_SIZE);
- // Create and initialize the transmit ring
- txRing =
- new TxDescriptorRing(
- mem,
- txRingOffset,
- txRingLength,
- txDataBufferOffset);
+ // Create and initialize the receive ring
+ rxRing =
+ new RxDescriptorRing(
+ mem,
+ rxRingOffset,
+ rxRingLength,
+ rxDataBufferOffset);
- // Create and initialize the initializtion block
- initBlock =
- new InitializationBlock32Bit(
- mem,
- 0,
- (short) mode,
- physicalAddr,
- logicalAddr,
- rxRing,
- txRing);
- }
+ // Create and initialize the transmit ring
+ txRing =
+ new TxDescriptorRing(
+ mem,
+ txRingOffset,
+ txRingLength,
+ txDataBufferOffset);
- /**
- * Gets the address of the initdata structure as a 32-bit int
- */
- public final int getInitDataAddressAs32Bit() {
- return mem.getAddress().toInt();
- }
+ // Create and initialize the initializtion block
+ initBlock =
+ new InitializationBlock32Bit(
+ mem,
+ 0,
+ (short) mode,
+ physicalAddr,
+ logicalAddr,
+ rxRing,
+ txRing);
+ }
- public void transmit(SocketBuffer buf) {
- final int len = buf.getSize();
- if (len > DATA_BUFFER_SIZE) {
- System.out.println("Length must be <= " + DATA_BUFFER_SIZE);
- }
+ /**
+ * Gets the address of the initdata structure as a 32-bit int
+ */
+ public final int getInitDataAddressAs32Bit() {
+ return mem.getAddress().toInt();
+ }
- txRing.transmit(buf);
- }
+ public void transmit(SocketBuffer buf) {
+ final int len = buf.getSize();
+ if (len > DATA_BUFFER_SIZE) {
+ System.out.println("Length must be <= " + DATA_BUFFER_SIZE);
+ }
- public SocketBuffer getPacket() {
- return rxRing.getPacket();
- }
+ txRing.transmit(buf);
+ }
- public void dumpData(Logger out) {
- initBlock.dumpData(out);
- rxRing.dumpData(out);
- txRing.dumpData(out);
+ public SocketBuffer getPacket() {
+ return rxRing.getPacket();
+ }
+
+ public void dumpData(Logger out) {
+ initBlock.dumpData(out);
+ rxRing.dumpData(out);
+ txRing.dumpData(out);
}
}
Modified: trunk/net/src/driver/org/jnode/driver/net/lance/DWordIOAccess.java
===================================================================
--- trunk/net/src/driver/org/jnode/driver/net/lance/DWordIOAccess.java 2008-05-30 12:21:53 UTC (rev 4154)
+++ trunk/net/src/driver/org/jnode/driver/net/lance/DWordIOAccess.java 2008-05-30 12:27:50 UTC (rev 4155)
@@ -18,47 +18,46 @@
* along with this library; If not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-
+
package org.jnode.driver.net.lance;
import org.jnode.system.IOResource;
/**
* @author Chris Cole
- *
*/
public class DWordIOAccess extends IOAccess implements LanceConstants {
- public DWordIOAccess(IOResource io, int iobase) {
- super(io, iobase);
- }
-
- public String getType() {
- return "DWord";
- }
-
- public void reset() {
- // Read triggers a reset
- io.inPortDword(iobase + DWIO_RESET);
- }
+ public DWordIOAccess(IOResource io, int iobase) {
+ super(io, iobase);
+ }
- public int getCSR(int csrnr) {
- io.outPortDword(iobase + DWIO_RAP, csrnr);
- return io.inPortDword(iobase + DWIO_RDP);
- }
+ public String getType() {
+ return "DWord";
+ }
- public void setCSR(int csrnr, int value) {
- io.outPortDword(iobase + DWIO_RAP, csrnr);
- io.outPortDword(iobase + DWIO_RDP, value);
- }
+ public void reset() {
+ // Read triggers a reset
+ io.inPortDword(iobase + DWIO_RESET);
+ }
- public int getBCR(int bcrnr) {
- io.outPortDword(iobase + DWIO_RAP, bcrnr);
- return io.inPortDword(iobase + DWIO_BDP);
- }
+ public int getCSR(int csrnr) {
+ io.outPortDword(iobase + DWIO_RAP, csrnr);
+ return io.inPortDword(iobase + DWIO_RDP);
+ }
- public void setBCR(int bcrnr, int value) {
- io.outPortDword(iobase + DWIO_RAP, bcrnr);
- io.outPortDword(iobase + DWIO_BDP, value);
- }
+ public void setCSR(int csrnr, int value) {
+ io.outPortDword(iobase + DWIO_RAP, csrnr);
+ io.outPortDword(iobase + DWIO_RDP, value);
+ }
+
+ public int getBCR(int bcrnr) {
+ io.outPortDword(iobase + DWIO_RAP, bcrnr);
+ return io.inPortDword(iobase + DWIO_BDP);
+ }
+
+ public void setBCR(int bcrnr, int value) {
+ io.outPortDword(iobase + DWIO_RAP, bcrnr);
+ io.outPortDword(iobase + DWIO_BDP, value);
+ }
}
Modified: trunk/net/src/driver/org/jnode/driver/net/lance/Descriptor.java
===================================================================
--- trunk/net/src/driver/org/jnode/driver/net/lance/Descriptor.java 2008-05-30 12:21:53 UTC (rev 4154)
+++ trunk/net/src/driver/org/jnode/driver/net/lance/Descriptor.java 2008-05-30 12:27:50 UTC (rev 4155)
@@ -18,7 +18,7 @@
* along with this library; If not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-
+
package org.jnode.driver.net.lance;
import org.apache.log4j.Logger;
@@ -27,80 +27,72 @@
/**
* @author Chris Cole
- *
*/
public class Descriptor {
- static final public int MESSAGE_DESCRIPTOR_SIZE = 0x10;
+ static final public int MESSAGE_DESCRIPTOR_SIZE = 0x10;
+ static final public int STATUS = 0x06;
+ static final public int STATUS_OWN = 0x8000;
+ static final public int STATUS_ERR = 0x4000;
+ static final public int STATUS_STP = 0x0200;
+ static final public int STATUS_ENP = 0x0100;
+ static final public int STATUS_BPE = 0x0080;
+ static final public int BCNT = 0x08;
- static final public int STATUS = 0x06;
+ protected final MemoryResource mem;
- static final public int STATUS_OWN = 0x8000;
+ protected final int offset;
- static final public int STATUS_ERR = 0x4000;
+ protected final int dataBufferOffset;
- static final public int STATUS_STP = 0x0200;
+ protected byte[] data;
- static final public int STATUS_ENP = 0x0100;
+ public Descriptor(MemoryResource mem, int offset, int dataBufferOffset) {
- static final public int STATUS_BPE = 0x0080;
+ this.mem = mem;
+ this.offset = offset;
+ this.dataBufferOffset = dataBufferOffset;
- static final public int BCNT = 0x08;
+ data = new byte[BufferManager.DATA_BUFFER_SIZE];
- protected final MemoryResource mem;
+ // final int buffAddress =
+ // Address.as32bit(Address.addressOfArrayData(data));
+ // Set the address
+ final int buffAddress = mem.getAddress().add(dataBufferOffset).toInt();
+ mem.setInt(offset + 0x00, buffAddress);
+ mem.setShort(offset + 0x04, (short) (-BufferManager.DATA_BUFFER_SIZE));
+ mem.setShort(offset + STATUS, (short) 0);
+ mem.setInt(offset + 0x08, 0);
+ mem.setInt(offset + 0x0C, 0);
+ }
- protected final int offset;
+ public boolean isOwnerSelf() {
+ return ((STATUS_OWN & mem.getShort(offset + STATUS)) == 0);
+ }
- protected final int dataBufferOffset;
+ public void setOwnerSelf(boolean self) {
+ if (self) {
+ mem.setShort(offset + STATUS, (short) (0x7FFF & mem.getShort(offset
+ + STATUS)));
+ } else {
+ mem.setShort(offset + STATUS, (short) (STATUS_OWN | mem
+ .getShort(offset + STATUS)));
+ }
+ }
- protected byte[] data;
+ public short getStatus() {
+ return mem.getShort(offset + STATUS);
+ }
- public Descriptor(MemoryResource mem, int offset, int dataBufferOffset) {
+ public void setStatus(short status) {
+ mem.setShort(offset + STATUS, status);
+ }
- this.mem = mem;
- this.offset = offset;
- this.dataBufferOffset = dataBufferOffset;
-
- data = new byte[BufferManager.DATA_BUFFER_SIZE];
-
- // final int buffAddress =
- // Address.as32bit(Address.addressOfArrayData(data));
- // Set the address
- final int buffAddress = mem.getAddress().add(dataBufferOffset).toInt();
- mem.setInt(offset + 0x00, buffAddress);
- mem.setShort(offset + 0x04, (short) (-BufferManager.DATA_BUFFER_SIZE));
- mem.setShort(offset + STATUS, (short) 0);
- mem.setInt(offset + 0x08, 0);
- mem.setInt(offset + 0x0C, 0);
- }
-
- public boolean isOwnerSelf() {
- return ((STATUS_OWN & mem.getShort(offset + STATUS)) == 0);
- }
-
- public void setOwnerSelf(boolean self) {
- if (self) {
- mem.setShort(offset + STATUS, (short) (0x7FFF & mem.getShort(offset
- + STATUS)));
- } else {
- mem.setShort(offset + STATUS, (short) (STATUS_OWN | mem
- .getShort(offset + STATUS)));
- }
- }
-
- public short getStatus() {
- return mem.getShort(offset + STATUS);
- }
-
- public void setStatus(short status) {
- mem.setShort(offset + STATUS, status);
- }
-
- public void dumpData(Logger out) {
- for (int i = 0; i <= MESSAGE_DESCRIPTOR_SIZE - 1; i += 4) {
- out.debug("0x"
- + NumberUtils.hex(mem.getAddress().toInt()
- + offset + i) + " : 0x" + NumberUtils.hex((byte) i)
- + " : 0x" + NumberUtils.hex(mem.getInt(offset + i)));
- }
- }
+ public void dumpData(Logger out) {
+ for (int i = 0; i <= MESSAGE_DESCRIPTOR_SIZE - 1; i += 4) {
+ out.debug("0x"
+ + NumberUtils.hex(mem.getAddress().toInt()
+ + offset + i) + " : 0x" + NumberUtils.hex((byte) i)
+ + " : 0x" + NumberUtils.hex(mem.getInt(offset + i)));
+ }
+ }
}
Modified: trunk/net/src/driver/org/jnode/driver/net/lance/DescriptorRing.java
===================================================================
--- trunk/net/src/driver/org/jnode/driver/net/lance/DescriptorRing.java 2008-05-30 12:21:53 UTC (rev 4154)
+++ trunk/net/src/driver/org/jnode/driver/net/lance/DescriptorRing.java 2008-05-30 12:27:50 UTC (rev 4155)
@@ -18,37 +18,36 @@
* along with this library; If not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-
+
package org.jnode.driver.net.lance;
import org.jnode.system.MemoryResource;
/**
* @author Chris Cole
- *
*/
public class DescriptorRing {
- protected final MemoryResource mem;
- protected final int offset;
- protected final int length;
- protected int currentDescriptor;
-
- public DescriptorRing(MemoryResource mem, int offset, int length) {
- this.mem = mem;
- this.offset = offset;
- this.length = length;
- }
-
- public int getSize() {
- return length * Descriptor.MESSAGE_DESCRIPTOR_SIZE;
- }
-
- public int getLength() {
- return length;
- }
-
- public int getAddressAs32() {
- return mem.getAddress().add(offset).toInt();
- }
+ protected final MemoryResource mem;
+ protected final int offset;
+ protected final int length;
+ protected int currentDescriptor;
+ public DescriptorRing(MemoryResource mem, int offset, int length) {
+ this.mem = mem;
+ this.offset = offset;
+ this.length = length;
+ }
+
+ public int getSize() {
+ return length * Descriptor.MESSAGE_DESCRIPTOR_SIZE;
+ }
+
+ public int getLength() {
+ return length;
+ }
+
+ public int getAddressAs32() {
+ return mem.getAddress().add(offset).toInt();
+ }
+
}
Modified: trunk/net/src/driver/org/jnode/driver/net/lance/IOAccess.java
===================================================================
--- trunk/net/src/driver/org/jnode/driver/net/lance/IOAccess.java 2008-05-30 12:21:53 UTC (rev 4154)
+++ trunk/net/src/driver/org/jnode/driver/net/lance/IOAccess.java 2008-05-30 12:27:50 UTC (rev 4155)
@@ -18,59 +18,57 @@
* along with this library; If not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-
+
package org.jnode.driver.net.lance;
import org.jnode.system.IOResource;
/**
* @author Chris Cole
- *
*/
public abstract class IOAccess {
- protected IOResource io;
- protected int iobase;
-
- public IOAccess(IOResource io, int iobase) {
- this.io = io;
- this.iobase = iobase;
- }
-
- public abstract String getType();
+ protected IOResource io;
+ protected int iobase;
- /**
- * Reset the device.
- *
- */
- public abstract void reset();
+ public IOAccess(IOResource io, int iobase) {
+ this.io = io;
+ this.iobase = iobase;
+ }
- /**
- * Gets the contents of a Control and Status Register.
- *
- * @param csrnr
- */
- public abstract int getCSR(int csrnr);
+ public abstract String getType();
- /**
- * Sets the contents of a Control and Status Register.
- *
- * @param csrnr
- */
- public abstract void setCSR(int csrnr, int value);
+ /**
+ * Reset the device.
+ */
+ public abstract void reset();
- /**
- * Gets the contents of a Bus Configuration Register.
- *
- * @param bcrnr
- */
- public abstract int getBCR(int bcrnr);
+ /**
+ * Gets the contents of a Control and Status Register.
+ *
+ * @param csrnr
+ */
+ public abstract int getCSR(int csrnr);
- /**
- * Sets the contents of a Bus Configuration Register.
- *
- * @param bcrnr
- * @param value
- */
+ /**
+ * Sets the contents of a Control and Status Register.
+ *
+ * @param csrnr
+ */
+ public abstract void setCSR(int csrnr, int value);
+
+ /**
+ * Gets the contents of a Bus Configuration Register.
+ *
+ * @param bcrnr
+ */
+ public abstract int getBCR(int bcrnr);
+
+ /**
+ * Sets the contents of a Bus Configuration Register.
+ *
+ * @param bcrnr
+ * @param value
+ */
public abstract void setBCR(int bcrnr, int value);
}
Modified: trunk/net/src/driver/org/jnode/driver/net/lance/InitializationBlock32Bit.java
===================================================================
--- trunk/net/src/driver/org/jnode/driver/net/lance/InitializationBlock32Bit.java 2008-05-30 12:21:53 UTC (rev 4154)
+++ trunk/net/src/driver/org/jnode/driver/net/lance/InitializationBlock32Bit.java 2008-05-30 12:27:50 UTC (rev 4155)
@@ -18,7 +18,7 @@
* along with this library; If not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-
+
package org.jnode.driver.net.lance;
import org.apache.log4j.Logger;
@@ -28,62 +28,61 @@
/**
* @author Chris Cole
- *
*/
public class InitializationBlock32Bit {
- static public final int INIT_BLOCK_SIZE = 0x1C;
+ static public final int INIT_BLOCK_SIZE = 0x1C;
- private MemoryResource mem;
- private int offset;
+ private MemoryResource mem;
+ private int offset;
- public InitializationBlock32Bit(
- MemoryResource mem,
- int offset,
- short mode,
- EthernetAddress physicalAddr,
- long logicalAddr,
- RxDescriptorRing rxRing,
- TxDescriptorRing txRing) {
+ public InitializationBlock32Bit(
+ MemoryResource mem,
+ int offset,
+ short mode,
+ EthernetAddress physicalAddr,
+ long logicalAddr,
+ RxDescriptorRing rxRing,
+ TxDescriptorRing txRing) {
- this.mem = mem;
- this.offset = offset;
+ this.mem = mem;
+ this.offset = offset;
- // Populate the initial data structure
- mem.setShort(offset + 0x00, mode);
- mem.setByte(offset + 0x02, getEncodedRingLength(rxRing.getLength()));
- mem.setByte(offset + 0x03, getEncodedRingLength(txRing.getLength()));
- mem.setByte(offset + 0x04, physicalAddr.get(0));
- mem.setByte(offset + 0x05, physicalAddr.get(1));
- mem.setByte(offset + 0x06, physicalAddr.get(2));
- mem.setByte(offset + 0x07, physicalAddr.get(3));
- mem.setByte(offset + 0x08, physicalAddr.get(4));
- mem.setByte(offset + 0x09, physicalAddr.get(5));
- mem.setInt(offset + 0x0C, (int) (logicalAddr & 0xFFFFFFFF));
- mem.setInt(offset + 0x10, (int) ((logicalAddr >> 32) & 0xFFFFFFFF));
- mem.setInt(offset + 0x14, rxRing.getAddressAs32());
- mem.setInt(offset + 0x18, txRing.getAddressAs32());
- }
+ // Populate the initial data structure
+ mem.setShort(offset + 0x00, mode);
+ mem.setByte(offset + 0x02, getEncodedRingLength(rxRing.getLength()));
+ mem.setByte(offset + 0x03, getEncodedRingLength(txRing.getLength()));
+ mem.setByte(offset + 0x04, physicalAddr.get(0));
+ mem.setByte(offset + 0x05, physicalAddr.get(1));
+ mem.setByte(offset + 0x06, physicalAddr.get(2));
+ mem.setByte(offset + 0x07, physicalAddr.get(3));
+ mem.setByte(offset + 0x08, physicalAddr.get(4));
+ mem.setByte(offset + 0x09, physicalAddr.get(5));
+ mem.setInt(offset + 0x0C, (int) (logicalAddr & 0xFFFFFFFF));
+ mem.setInt(offset + 0x10, (int) ((logicalAddr >> 32) & 0xFFFFFFFF));
+ mem.setInt(offset + 0x14, rxRing.getAddressAs32());
+ mem.setInt(offset + 0x18, txRing.getAddressAs32());
+ }
- private byte getEncodedRingLength(int ringLength) {
- byte encoded = 0;
- while (ringLength != 1) {
- ringLength = ringLength >> 1;
- encoded += 1;
- }
- return (byte) (encoded << 4);
- }
+ private byte getEncodedRingLength(int ringLength) {
+ byte encoded = 0;
+ while (ringLength != 1) {
+ ringLength = ringLength >> 1;
+ encoded += 1;
+ }
+ return (byte) (encoded << 4);
+ }
- public void dumpData(Logger out) {
- out.debug("Intialization Block - 32 bit mode");
- for (int i = 0; i <= INIT_BLOCK_SIZE - 1; i += 4) {
- out.debug(
- "0x"
- + NumberUtils.hex(
- mem.getAddress().toInt() + offset + i)
- + " : 0x"
- + NumberUtils.hex((byte) i)
- + " : 0x"
- + NumberUtils.hex(mem.getInt(offset + i)));
- }
- }
+ public void dumpData(Logger out) {
+ out.debug("Intialization Block - 32 bit mode");
+ for (int i = 0; i <= INIT_BLOCK_SIZE - 1; i += 4) {
+ out.debug(
+ "0x"
+ + NumberUtils.hex(
+ mem.getAddress().toInt() + offset + i)
+ + " : 0x"
+ + NumberUtils.hex((byte) i)
+ + " : 0x"
+ + NumberUtils.hex(mem.getInt(offset + i)));
+ }
+ }
}
Modified: trunk/net/src/driver/org/jnode/driver/net/lance/LanceConstants.java
===================================================================
--- trunk/net/src/driver/org/jnode/driver/net/lance/LanceConstants.java 2008-05-30 12:21:53 UTC (rev 4154)
+++ trunk/net/src/driver/org/jnode/driver/net/lance/LanceConstants.java 2008-05-30 12:27:50 UTC (rev 4155)
@@ -18,7 +18,7 @@
* along with this library; If not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-
+
package org.jnode.driver.net.lance;
/**
@@ -26,107 +26,107 @@
*/
public interface LanceConstants {
- // Word I/O port offsets from iobase.
- public static final int R_ETH_ADDR_OFFSET = 0x00;
- public static final int WIO_RDP = 0x10; // Register data (RDP)
- public static final int WIO_RAP = 0x12; // RAP
- public static final int WIO_RESET = 0x14; // RESET
- public static final int WIO_BDP = 0x16; // Bus data (BDP)
+ // Word I/O port offsets from iobase.
+ public static final int R_ETH_ADDR_OFFSET = 0x00;
+ public static final int WIO_RDP = 0x10; // Register data (RDP)
+ public static final int WIO_RAP = 0x12; // RAP
+ public static final int WIO_RESET = 0x14; // RESET
+ public static final int WIO_BDP = 0x16; // Bus data (BDP)
- // Double Word I/O port offsets from iobase.
- public static final int DWIO_RDP = 0x10; // Register data (RDP)
- public static final int DWIO_RAP = 0x14; // RAP
- public static final int DWIO_RESET = 0x18; // RESET
- public static final int DWIO_BDP = 0x1c; // Bus data (BDP)
+ // Double Word I/O port offsets from iobase.
+ public static final int DWIO_RDP = 0x10; // Register data (RDP)
+ public static final int DWIO_RAP = 0x14; // RAP
+ public static final int DWIO_RESET = 0x18; // RESET
+ public static final int DWIO_BDP = 0x1c; // Bus data (BDP)
- // CSR0 bits
- public static final int CSR0_INIT = 0x0001;
- public static final int CSR0_STRT = 0x0002;
- public static final int CSR0_STOP = 0x0004;
- public static final int CSR0_TDMD = 0x0008;
- public static final int CSR0_TXON = 0x0010;
- public static final int CSR0_RXON = 0x0020;
- public static final int CSR0_IENA = 0x0040;
- public static final int CSR0_INTR = 0x0080;
- public static final int CSR0_IDON = 0x0100;
- public static final int CSR0_TINT = 0x0200;
- public static final int CSR0_RINT = 0x0400;
- public static final int CSR0_MERR = 0x0800;
- public static final int CSR0_MISS = 0x1000;
- public static final int CSR0_CERR = 0x2000;
- public static final int CSR0_BABL = 0x4000;
- public static final int CSR0_ERR = 0x8000;
+ // CSR0 bits
+ public static final int CSR0_INIT = 0x0001;
+ public static final int CSR0_STRT = 0x0002;
+ public static final int CSR0_STOP = 0x0004;
+ public static final int CSR0_TDMD = 0x0008;
+ public static final int CSR0_TXON = 0x0010;
+ public static final int CSR0_RXON = 0x0020;
+ public static final int CSR0_IENA = 0x0040;
+ public static final int CSR0_INTR = 0x0080;
+ public static final int CSR0_IDON = 0x0100;
+ public static final int CSR0_TINT = 0x0200;
+ public static final int CSR0_RINT = 0x0400;
+ public static final int CSR0_MERR = 0x0800;
+ public static final int CSR0_MISS = 0x1000;
+ public static final int CSR0_CERR = 0x2000;
+ public static final int CSR0_BABL = 0x4000;
+ public static final int CSR0_ERR = 0x8000;
- // CSR3 bits
- public static final int CSR3_BSWP = 0x0004;
- public static final int CSR3_EMBA = 0x0008;
- public static final int CSR3_DXMT2PD = 0x0010;
- public static final int CSR3_LAPPEN = 0x0020;
- public static final int CSR3_DXSUFLO = 0x0040;
- public static final int CSR3_IDONM = 0x0100;
- public static final int CSR3_TINTM = 0x0200;
- public static final int CSR3_RINTM = 0x0400;
- public static final int CSR3_MERRM = 0x0800;
- public static final int CSR3_MISSM = 0x1000;
- public static final int CSR3_BABLM = 0x4000;
+ // CSR3 bits
+ public static final int CSR3_BSWP = 0x0004;
+ public static final int CSR3_EMBA = 0x0008;
+ public static final int CSR3_DXMT2PD = 0x0010;
+ public static final int CSR3_LAPPEN = 0x0020;
+ public static final int CSR3_DXSUFLO = 0x0040;
+ public static final int CSR3_IDONM = 0x0100;
+ public static final int CSR3_TINTM = 0x0200;
+ public static final int CSR3_RINTM = 0x0400;
+ public static final int CSR3_MERRM = 0x0800;
+ public static final int CSR3_MISSM = 0x1000;
+ public static final int CSR3_BABLM = 0x4000;
- // CSR4 bits
- public static final int CSR4_JABM = 0x0001;
- public static final int CSR4_JAB = 0x0002;
- public static final int CSR4_TXSTRTM = 0x0004;
- public static final int CSR4_TXSTRT = 0x0008;
- public static final int CSR4_RCVCCOM = 0x0010;
- public static final int CSR4_RCVCCO = 0x0020;
- public static final int CSR4_UINT = 0x0040;
- public static final int CSR4_UINTCMD = 0x0080;
- public static final int CSR4_MFCOM = 0x0100;
- public static final int CSR4_MFCO = 0x0200;
- public static final int CSR4_ASTRP_RCV = 0x0400;
- public static final int CSR4_APAD_XMT = 0x0800;
- public static final int CSR4_DPOLL = 0x1000;
- public static final int CSR4_TIMER = 0x2000;
- public static final int CSR4_DMAPLUS = 0x4000;
- public static final int CSR4_EN124 = 0x8000;
+ // CSR4 bits
+ public static final int CSR4_JABM = 0x0001;
+ public static final int CSR4_JAB = 0x0002;
+ public static final int CSR4_TXSTRTM = 0x0004;
+ public static final int CSR4_TXSTRT = 0x0008;
+ public static final int CSR4_RCVCCOM = 0x0010;
+ public static final int CSR4_RCVCCO = 0x0020;
+ public static final int CSR4_UINT = 0x0040;
+ public static final int CSR4_UINTCMD = 0x0080;
+ public static final int CSR4_MFCOM = 0x0100;
+ public static final int CSR4_MFCO = 0x0200;
+ public static final int CSR4_ASTRP_RCV = 0x0400;
+ public static final int CSR4_APAD_XMT = 0x0800;
+ public static final int CSR4_DPOLL = 0x1000;
+ public static final int CSR4_TIMER = 0x2000;
+ public static final int CSR4_DMAPLUS = 0x4000;
+ public static final int CSR4_EN124 = 0x8000;
- // CSR5 bits
- public static final int CSR5_SPND = 0x0001;
- public static final int CSR5_MPMODE = 0x0002;
- public static final int CSR5_MPEN = 0x0004;
- public static final int CSR5...
[truncated message content] |
|
From: <hag...@us...> - 2008-05-30 12:54:03
|
Revision: 4156
http://jnode.svn.sourceforge.net/jnode/?rev=4156&view=rev
Author: hagar-wize
Date: 2008-05-30 05:54:00 -0700 (Fri, 30 May 2008)
Log Message:
-----------
reformat code
Modified Paths:
--------------
trunk/net/src/driver/org/jnode/driver/net/NetDeviceAPI.java
trunk/net/src/driver/org/jnode/driver/net/NetDeviceEvent.java
trunk/net/src/driver/org/jnode/driver/net/NetDeviceListener.java
trunk/net/src/driver/org/jnode/driver/net/NetworkException.java
trunk/net/src/driver/org/jnode/driver/net/WirelessNetDeviceAPI.java
trunk/net/src/driver/org/jnode/driver/net/ethernet/spi/AbstractEthernetDriver.java
trunk/net/src/driver/org/jnode/driver/net/ethernet/spi/BasicEthernetDriver.java
trunk/net/src/driver/org/jnode/driver/net/ethernet/spi/Flags.java
Modified: trunk/net/src/driver/org/jnode/driver/net/NetDeviceAPI.java
===================================================================
--- trunk/net/src/driver/org/jnode/driver/net/NetDeviceAPI.java 2008-05-30 12:27:50 UTC (rev 4155)
+++ trunk/net/src/driver/org/jnode/driver/net/NetDeviceAPI.java 2008-05-30 12:54:00 UTC (rev 4156)
@@ -18,7 +18,7 @@
* along with this library; If not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-
+
package org.jnode.driver.net;
import org.jnode.driver.DeviceAPI;
@@ -28,71 +28,74 @@
/**
* Generic API for network devices.
- *
+ * <p/>
* <h3>Transmission</h3>
- * To transmit data, each network device should has a queue of Frame's.
+ * To transmit data, each network device should has a queue of Frame's.
* The transmit method is called to add a frame to this queue. The device
* should start a worker thread to process this queue.
* Once a frame has been transmitted, the notifyTransmission method of that
* frame must be called.
- *
+ * <p/>
* <h3>Reception</h3>
* On reception of a frame, a network device must call the receive
* method of the NetworkLayerManager.
- *
+ *
+ * @author epr
* @see org.jnode.net.NetworkLayerManager
- *
- * @author epr
*/
public interface NetDeviceAPI extends DeviceAPI {
- /**
- * Gets the hardware address of this device
- */
- public HardwareAddress getAddress();
+ /**
+ * Gets the hardware address of this device
+ */
+ public HardwareAddress getAddress();
- /**
- * Gets the maximum transfer unit, the number of bytes this device can
- * transmit at a time.
- */
- public int getMTU();
+ /**
+ * Gets the maximum transfer unit, the number of bytes this device can
+ * transmit at a time.
+ */
+ public int getMTU();
- /**
- * Add the given frame to the transmit queue of this device.
- * A client to this interface should use methods in Frame to checks for
- * errors and wait for the actual transmission.
- * After the frame has actually been transmitted by the device, the
- * Frame.notifyTransmission method must be called.
- *
- * @param packet The network packet to transmit. No linklayer header has
- * been added yet.
- * @param destination The destination address, or null for a broadcast.
- * @throws NetworkException
- */
- public void transmit(SocketBuffer packet, HardwareAddress destination)
- throws NetworkException;
+ /**
+ * Add the given frame to the transmit queue of this device.
+ * A client to this interface should use methods in Frame to checks for
+ * errors and wait for the actual transmission.
+ * After the frame has actually been transmitted by the device, the
+ * Frame.notifyTransmission method must be called.
+ *
+ * @param packet The network packet to transmit. No linklayer header has
+ * been added yet.
+ * @param destination The destination address, or null for a broadcast.
+ * @throws NetworkException
+ */
+ public void transmit(SocketBuffer packet, HardwareAddress destination)
+ throws NetworkException;
- /**
- * Gets the protocol address information for a given protocol.
- * @param protocolID
- * @return The protocol address information, or null if not found.
- */
- public ProtocolAddressInfo getProtocolAddressInfo(int protocolID);
+ /**
+ * Gets the protocol address information for a given protocol.
+ *
+ * @param protocolID
+ * @return The protocol address information, or null if not found.
+ */
+ public ProtocolAddressInfo getProtocolAddressInfo(int protocolID);
- /**
- * Sets the protocol address information for a given protocol.
- * @param protocolID
- */
- public void setProtocolAddressInfo(int protocolID, ProtocolAddressInfo addressInfo);
-
/**
- * Add a net device listener to this device.
+ * Sets the protocol address information for a given protocol.
+ *
+ * @param protocolID
+ */
+ public void setProtocolAddressInfo(int protocolID, ProtocolAddressInfo addressInfo);
+
+ /**
+ * Add a net device listener to this device.
+ *
* @param listener
*/
public void addEventListener(NetDeviceListener listener);
-
+
/**
- * Add a net device listener to this device.
+ * Add a net device listener to this device.
+ *
* @param listener
*/
public void removeEventListener(NetDeviceListener listener);
Modified: trunk/net/src/driver/org/jnode/driver/net/NetDeviceEvent.java
===================================================================
--- trunk/net/src/driver/org/jnode/driver/net/NetDeviceEvent.java 2008-05-30 12:27:50 UTC (rev 4155)
+++ trunk/net/src/driver/org/jnode/driver/net/NetDeviceEvent.java 2008-05-30 12:54:00 UTC (rev 4156)
@@ -18,7 +18,7 @@
* along with this library; If not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-
+
package org.jnode.driver.net;
import java.util.EventObject;
@@ -27,14 +27,16 @@
/**
* Base class for all net device events.
- *
+ *
* @author Ewout Prangsma (ep...@us...)
*/
public abstract class NetDeviceEvent extends EventObject {
- /** Identification of the event */
+ /**
+ * Identification of the event
+ */
private final int id;
-
+
/**
* @param source
*/
@@ -45,14 +47,16 @@
/**
* Gets the device that it the source of this event.
+ *
* @return
*/
public final Device getDevice() {
- return (Device)getSource();
+ return (Device) getSource();
}
-
+
/**
* Gets the event ID.
+ *
* @return Returns the id.
*/
public final int getId() {
Modified: trunk/net/src/driver/org/jnode/driver/net/NetDeviceListener.java
===================================================================
--- trunk/net/src/driver/org/jnode/driver/net/NetDeviceListener.java 2008-05-30 12:27:50 UTC (rev 4155)
+++ trunk/net/src/driver/org/jnode/driver/net/NetDeviceListener.java 2008-05-30 12:54:00 UTC (rev 4156)
@@ -18,7 +18,7 @@
* along with this library; If not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-
+
package org.jnode.driver.net;
import java.util.EventListener;
@@ -30,6 +30,7 @@
/**
* A net device has fired the given event.
+ *
* @param event
*/
public void processEvent(NetDeviceEvent event);
Modified: trunk/net/src/driver/org/jnode/driver/net/NetworkException.java
===================================================================
--- trunk/net/src/driver/org/jnode/driver/net/NetworkException.java 2008-05-30 12:27:50 UTC (rev 4155)
+++ trunk/net/src/driver/org/jnode/driver/net/NetworkException.java 2008-05-30 12:54:00 UTC (rev 4156)
@@ -18,7 +18,7 @@
* along with this library; If not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-
+
package org.jnode.driver.net;
import java.net.SocketException;
@@ -28,34 +28,34 @@
*/
public class NetworkException extends SocketException {
- /**
- *
- */
- public NetworkException() {
- super();
- }
+ /**
+ *
+ */
+ public NetworkException() {
+ super();
+ }
- /**
- * @param message
- * @param cause
- */
- public NetworkException(String message, Throwable cause) {
- super(message);
- initCause(cause);
- }
+ /**
+ * @param message
+ * @param cause
+ */
+ public NetworkException(String message, Throwable cause) {
+ super(message);
+ initCause(cause);
+ }
- /**
- * @param cause
- */
- public NetworkException(Throwable cause) {
- super();
- initCause(cause);
- }
+ /**
+ * @param cause
+ */
+ public NetworkException(Throwable cause) {
+ super();
+ initCause(cause);
+ }
- /**
- * @param s
- */
- public NetworkException(String s) {
- super(s);
- }
+ /**
+ * @param s
+ */
+ public NetworkException(String s) {
+ super(s);
+ }
}
Modified: trunk/net/src/driver/org/jnode/driver/net/WirelessNetDeviceAPI.java
===================================================================
--- trunk/net/src/driver/org/jnode/driver/net/WirelessNetDeviceAPI.java 2008-05-30 12:27:50 UTC (rev 4155)
+++ trunk/net/src/driver/org/jnode/driver/net/WirelessNetDeviceAPI.java 2008-05-30 12:54:00 UTC (rev 4156)
@@ -18,42 +18,46 @@
* along with this library; If not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-
+
package org.jnode.driver.net;
import org.jnode.net.wireless.AuthenticationMode;
/**
* Device API for wireless network devices.
- *
+ *
* @author Ewout Prangsma (ep...@us...)
*/
public interface WirelessNetDeviceAPI extends NetDeviceAPI {
/**
* Gets the current authentication mode.
+ *
* @return
*/
public AuthenticationMode getAuthenticationMode();
-
+
/**
* Sets the current authentication mode.
+ *
* @param mode
*/
public void setAuthenticationMode(AuthenticationMode mode)
- throws NetworkException;
-
+ throws NetworkException;
+
/**
* Gets the current ESS ID.
+ *
* @return A valid ESSID, or null if not ESSID is present.
*/
public String getESSID();
/**
* Sets the current ESS ID.
+ *
* @param essid A valid ESSID, or null for any ESS.
*/
public void setESSID(String essid)
- throws NetworkException;
-
+ throws NetworkException;
+
}
Modified: trunk/net/src/driver/org/jnode/driver/net/ethernet/spi/AbstractEthernetDriver.java
===================================================================
--- trunk/net/src/driver/org/jnode/driver/net/ethernet/spi/AbstractEthernetDriver.java 2008-05-30 12:27:50 UTC (rev 4155)
+++ trunk/net/src/driver/org/jnode/driver/net/ethernet/spi/AbstractEthernetDriver.java 2008-05-30 12:54:00 UTC (rev 4156)
@@ -18,7 +18,7 @@
* along with this library; If not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-
+
package org.jnode.driver.net.ethernet.spi;
import org.jnode.driver.net.NetworkException;
@@ -34,7 +34,7 @@
* @author epr
*/
public abstract class AbstractEthernetDriver extends AbstractNetDriver
- implements EthernetConstants {
+ implements EthernetConstants {
/**
* Gets the maximum transfer unit, the number of bytes this device can
@@ -69,7 +69,7 @@
* org.jnode.net.HardwareAddress)
*/
protected final void doTransmit(SocketBuffer skbuf,
- HardwareAddress destination) throws NetworkException {
+ HardwareAddress destination) throws NetworkException {
skbuf.insert(ETH_HLEN);
if (destination == null) {
destination = EthernetAddress.BROADCAST;
@@ -91,5 +91,5 @@
* org.jnode.net.HardwareAddress)
*/
protected abstract void doTransmitEthernet(SocketBuffer skbuf, HardwareAddress destination)
- throws NetworkException;
+ throws NetworkException;
}
Modified: trunk/net/src/driver/org/jnode/driver/net/ethernet/spi/BasicEthernetDriver.java
===================================================================
--- trunk/net/src/driver/org/jnode/driver/net/ethernet/spi/BasicEthernetDriver.java 2008-05-30 12:27:50 UTC (rev 4155)
+++ trunk/net/src/driver/org/jnode/driver/net/ethernet/spi/BasicEthernetDriver.java 2008-05-30 12:54:00 UTC (rev 4156)
@@ -18,7 +18,7 @@
* along with this library; If not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-
+
package org.jnode.driver.net.ethernet.spi;
import org.apache.log4j.Logger;
@@ -112,7 +112,8 @@
/**
* Create a new RTL8139Core instance
*/
- protected abstract AbstractDeviceCore newCore(Device device, Flags flags) throws DriverException, ResourceNotFreeException;
+ protected abstract AbstractDeviceCore newCore(Device device, Flags flags)
+ throws DriverException, ResourceNotFreeException;
/**
* Get the flags for this device
Modified: trunk/net/src/driver/org/jnode/driver/net/ethernet/spi/Flags.java
===================================================================
--- trunk/net/src/driver/org/jnode/driver/net/ethernet/spi/Flags.java 2008-05-30 12:27:50 UTC (rev 4155)
+++ trunk/net/src/driver/org/jnode/driver/net/ethernet/spi/Flags.java 2008-05-30 12:54:00 UTC (rev 4156)
@@ -18,7 +18,7 @@
* along with this library; If not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-
+
package org.jnode.driver.net.ethernet.spi;
/**
@@ -27,8 +27,7 @@
* @author Martin Husted Hartvig
*/
-public interface Flags
-{
- public String getName();
+public interface Flags {
+ public String getName();
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <hag...@us...> - 2008-05-30 14:55:42
|
Revision: 4157
http://jnode.svn.sourceforge.net/jnode/?rev=4157&view=rev
Author: hagar-wize
Date: 2008-05-30 07:55:37 -0700 (Fri, 30 May 2008)
Log Message:
-----------
reformat code
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/EEPRO100Driver.java
trunk/net/src/driver/org/jnode/driver/net/eepro100/EEPRO100Flags.java
trunk/net/src/driver/org/jnode/driver/net/eepro100/EEPRO100Registers.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/event/LinkStatusEvent.java
trunk/net/src/driver/org/jnode/driver/net/ne2000/Ne2000Constants.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/Prism2Driver.java
trunk/net/src/driver/org/jnode/driver/net/prism2/Prism2Flags.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
trunk/net/src/driver/org/jnode/driver/net/spi/AbstractDeviceCore.java
trunk/net/src/driver/org/jnode/driver/net/spi/AbstractNetDriver.java
trunk/net/src/driver/org/jnode/driver/net/spi/NetDeviceEventProcessor.java
trunk/net/src/driver/org/jnode/driver/net/usb/UsbNetConstant.java
trunk/net/src/driver/org/jnode/driver/net/usb/UsbNetDeviceToDriverMapper.java
trunk/net/src/driver/org/jnode/driver/net/usb/bluetooth/UsbBluetoothDevice.java
trunk/net/src/driver/org/jnode/driver/net/usb/bluetooth/UsbBluetoothDriver.java
trunk/net/src/driver/org/jnode/driver/net/wireless/spi/WirelessDeviceCore.java
trunk/net/src/driver/org/jnode/driver/net/wireless/spi/WirelessEthernetDriver.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-05-30 12:54:00 UTC (rev 4156)
+++ trunk/net/src/driver/org/jnode/driver/net/_3c90x/_3c90xConstants.java 2008-05-30 14:55:37 UTC (rev 4157)
@@ -18,7 +18,7 @@
* along with this library; If not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-
+
package org.jnode.driver.net._3c90x;
/**
@@ -26,95 +26,287 @@
*/
public interface _3c90xConstants {
- /* Register definitions for the 3c905 ***/
- public static final int regPowerMgmtCtrl_w = 0x7c; /** 905B Revision Only **/
- public static final int regUpMaxBurst_w = 0x7a; /** 905B Revision Only **/
- public static final int regDnMaxBurst_w = 0x78; /** 905B Revision Only **/
- public static final int regDebugControl_w = 0x74; /** 905B Revision Only **/
- public static final int regDebugData_l = 0x70; /** 905B Revision Only **/
- public static final int regRealTimeCnt_l = 0x40; /** Universal **/
- public static final int regUpBurstThresh_b = 0x3e; /** 905B Revision Only **/
- public static final int regUpPoll_b = 0x3d; /** 905B Revision Only **/
- public static final int regUpPriorityThresh_b = 0x3c; /** 905B Revision Only **/
- public static final int regUpListPtr_l = 0x38; /** Universal **/
- public static final int regCountdown_w = 0x36; /** Universal **/
- public static final int regFreeTimer_w = 0x34; /** Universal **/
- public static final int regUpPktStatus_l = 0x30; /** Universal with Exception; pg 130 **/
- public static final int regTxFreeThresh_b = 0x2f; /** 90X Revision Only **/
- public static final int regDnPoll_b = 0x2d; /** 905B Revision Only **/
- public static final int regDnPriorityThresh_b = 0x2c; /** 905B Revision Only **/
- public static final int regDnBurstThresh_b = 0x2a; /** 905B Revision Only **/
- public static final int regDnListPtr_l = 0x24; /** Universal with Exception; pg 107 **/
+ /* Register definitions for the 3c905 ***/
+ public static final int regPowerMgmtCtrl_w = 0x7c;
+ /**
+ * 905B Revision Only *
+ */
+ public static final int regUpMaxBurst_w = 0x7a;
+ /**
+ * 905B Revision Only *
+ */
+ public static final int regDnMaxBurst_w = 0x78;
+ /**
+ * 905B Revision Only *
+ */
+ public static final int regDebugControl_w = 0x74;
+ /**
+ * 905B Revision Only *
+ */
+ public static final int regDebugData_l = 0x70;
+ /**
+ * 905B Revision Only *
+ */
+ public static final int regRealTimeCnt_l = 0x40;
+ /**
+ * Universal *
+ */
+ public static final int regUpBurstThresh_b = 0x3e;
+ /**
+ * 905B Revision Only *
+ */
+ public static final int regUpPoll_b = 0x3d;
+ /**
+ * 905B Revision Only *
+ */
+ public static final int regUpPriorityThresh_b = 0x3c;
+ /**
+ * 905B Revision Only *
+ */
+ public static final int regUpListPtr_l = 0x38;
+ /**
+ * Universal *
+ */
+ public static final int regCountdown_w = 0x36;
+ /**
+ * Universal *
+ */
+ public static final int regFreeTimer_w = 0x34;
+ /**
+ * Universal *
+ */
+ public static final int regUpPktStatus_l = 0x30;
+ /**
+ * Universal with Exception; pg 130 *
+ */
+ public static final int regTxFreeThresh_b = 0x2f;
+ /**
+ * 90X Revision Only *
+ */
+ public static final int regDnPoll_b = 0x2d;
+ /**
+ * 905B Revision Only *
+ */
+ public static final int regDnPriorityThresh_b = 0x2c;
+ /**
+ * 905B Revision Only *
+ */
+ public static final int regDnBurstThresh_b = 0x2a;
+ /**
+ * 905B Revision Only *
+ */
+ public static final int regDnListPtr_l = 0x24;
+ /**
+ * Universal with Exception; pg 107 *
+ */
public static final int regDmaCtrl_l = 0x20; /** Universal with Exception; pg 106 **/
- /** **/
- public static final int regIntStatusAuto_w = 0x1e; /** 905B Revision Only **/
- public static final int regTxStatus_b = 0x1b; /** Universal with Exception; pg 113 **/
- public static final int regTimer_b = 0x1a; /** Universal **/
- public static final int regTxPktId_b = 0x18; /** 905B Revision Only **/
+ /** **/
+ public static final int regIntStatusAuto_w = 0x1e;
+ /**
+ * 905B Revision Only *
+ */
+ public static final int regTxStatus_b = 0x1b;
+ /**
+ * Universal with Exception; pg 113 *
+ */
+ public static final int regTimer_b = 0x1a;
+ /**
+ * Universal *
+ */
+ public static final int regTxPktId_b = 0x18;
+ /**
+ * 905B Revision Only *
+ */
public static final int regCommandIntStatus_w = 0x0e; /** Universal (Command Variations) **/
- /** following are windowed registers **/
- // Registers7
- public static final int regPowerMgmtEvent_7_w = 0x0c; /** 905B Revision Only **/
- public static final int regVlanEtherType_7_w = 0x04; /** 905B Revision Only **/
- public static final int regVlanMask_7_w = 0x00; /** 905B Revision Only **/
+ /**
+ * following are windowed registers *
+ */
+ // Registers7
+ public static final int regPowerMgmtEvent_7_w = 0x0c;
+ /**
+ * 905B Revision Only *
+ */
+ public static final int regVlanEtherType_7_w = 0x04;
+ /**
+ * 905B Revision Only *
+ */
+ public static final int regVlanMask_7_w = 0x00;
+ /**
+ * 905B Revision Only *
+ */
- // Registers6
- public static final int regBytesXmittedOk_6_w = 0x0c; /** Universal **/
- public static final int regBytesRcvdOk_6_w = 0x0a; /** Universal **/
- public static final int regUpperFramesOk_6_b = 0x09; /** Universal **/
- public static final int regFramesDeferred_6_b = 0x08; /** Universal **/
- public static final int regFramesRecdOk_6_b = 0x07; /** Universal with Exceptions; pg 142 **/
- public static final int regFramesXmittedOk_6_b = 0x06; /** Universal **/
- public static final int regRxOverruns_6_b = 0x05; /** Universal **/
- public static final int regLateCollisions_6_b = 0x04; /** Universal **/
- public static final int regSingleCollisions_6_b = 0x03; /** Universal **/
- public static final int regMultipleCollisions_6_b = 0x02; /** Universal **/
- public static final int regSqeErrors_6_b = 0x01; /** Universal **/
- public static final int regCarrierLost_6_b = 0x00; /** Universal **/
+ // Registers6
+ public static final int regBytesXmittedOk_6_w = 0x0c;
+ /**
+ * Universal *
+ */
+ public static final int regBytesRcvdOk_6_w = 0x0a;
+ /**
+ * Universal *
+ */
+ public static final int regUpperFramesOk_6_b = 0x09;
+ /**
+ * Universal *
+ */
+ public static final int regFramesDeferred_6_b = 0x08;
+ /**
+ * Universal *
+ */
+ public static final int regFramesRecdOk_6_b = 0x07;
+ /**
+ * Universal with Exceptions; pg 142 *
+ */
+ public static final int regFramesXmittedOk_6_b = 0x06;
+ /**
+ * Universal *
+ */
+ public static final int regRxOverruns_6_b = 0x05;
+ /**
+ * Universal *
+ */
+ public static final int regLateCollisions_6_b = 0x04;
+ /**
+ * Universal *
+ */
+ public static final int regSingleCollisions_6_b = 0x03;
+ /**
+ * Universal *
+ */
+ public static final int regMultipleCollisions_6_b = 0x02;
+ /**
+ * Universal *
+ */
+ public static final int regSqeErrors_6_b = 0x01;
+ /**
+ * Universal *
+ */
+ public static final int regCarrierLost_6_b = 0x00;
+ /**
+ * Universal *
+ */
- // Registers5
- public static final int regIndicationEnable_5_w = 0x0c; /** Universal **/
- public static final int regInterruptEnable_5_w = 0x0a; /** Universal **/
- public static final int regTxReclaimThresh_5_b = 0x09; /** 905B Revision Only **/
- public static final int regRxFilter_5_b = 0x08; /** Universal **/
- public static final int regRxEarlyThresh_5_w = 0x06; /** Universal **/
- public static final int regTxStartThresh_5_w = 0x00; /** Universal **/
-
- // Registers4
- public static final int regUpperBytesOk_4_b = 0x0d; /** Universal **/
- public static final int regBadSSD_4_b = 0x0c; /** Universal **/
- public static final int regMediaStatus_4_w = 0x0a; /** Universal with Exceptions; pg 201 **/
- public static final int regPhysicalMgmt_4_w = 0x08; /** Universal **/
- public static final int regNetworkDiagnostic_4_w = 0x06; /** Universal with Exceptions; pg 203 **/
- public static final int regFifoDiagnostic_4_w = 0x04; /** Universal with Exceptions; pg 196 **/
- public static final int regVcoDiagnostic_4_w = 0x02; /** Undocumented? **/
+ // Registers5
+ public static final int regIndicationEnable_5_w = 0x0c;
+ /**
+ * Universal *
+ */
+ public static final int regInterruptEnable_5_w = 0x0a;
+ /**
+ * Universal *
+ */
+ public static final int regTxReclaimThresh_5_b = 0x09;
+ /**
+ * 905B Revision Only *
+ */
+ public static final int regRxFilter_5_b = 0x08;
+ /**
+ * Universal *
+ */
+ public static final int regRxEarlyThresh_5_w = 0x06;
+ /**
+ * Universal *
+ */
+ public static final int regTxStartThresh_5_w = 0x00;
+ /**
+ * Universal *
+ */
- // Registers3
- public static final int regTxFree_3_w = 0x0c; /** Universal **/
- public static final int regRxFree_3_w = 0x0a; /** Universal with Exceptions; pg 125 **/
+ // Registers4
+ public static final int regUpperBytesOk_4_b = 0x0d;
+ /**
+ * Universal *
+ */
+ public static final int regBadSSD_4_b = 0x0c;
+ /**
+ * Universal *
+ */
+ public static final int regMediaStatus_4_w = 0x0a;
+ /**
+ * Universal with Exceptions; pg 201 *
+ */
+ public static final int regPhysicalMgmt_4_w = 0x08;
+ /**
+ * Universal *
+ */
+ public static final int regNetworkDiagnostic_4_w = 0x06;
+ /**
+ * Universal with Exceptions; pg 203 *
+ */
+ public static final int regFifoDiagnostic_4_w = 0x04;
+ /**
+ * Universal with Exceptions; pg 196 *
+ */
+ public static final int regVcoDiagnostic_4_w = 0x02;
+ /**
+ * Undocumented? *
+ */
+
+ // Registers3
+ public static final int regTxFree_3_w = 0x0c;
+ /**
+ * Universal *
+ */
+ public static final int regRxFree_3_w = 0x0a;
+ /**
+ * Universal with Exceptions; pg 125 *
+ */
public static final int regResetMediaOptions_3_w = 0x08; /** Media Options on B Revision; **/
- /** Reset Options on Non-B Revision **/
- public static final int regMacControl_3_w = 0x06; /** Universal with Exceptions; pg 199 **/
- public static final int regMaxPktSize_3_w = 0x04; /** 905B Revision Only **/
+ /**
+ * Reset Options on Non-B Revision *
+ */
+ public static final int regMacControl_3_w = 0x06;
+ /**
+ * Universal with Exceptions; pg 199 *
+ */
+ public static final int regMaxPktSize_3_w = 0x04;
+ /**
+ * 905B Revision Only *
+ */
public static final int regInternalConfig_3_l = 0x00; /** Universal; different bit **/
- /** definitions; pg 59 **/
+ /**
+ * definitions; pg 59 *
+ */
- // Registers2
- public static final int regResetOptions_2_w = 0x0c; /** 905B Revision Only **/
- public static final int regStationMask_2_3w = 0x06; /** Universal with Exceptions; pg 127 **/
- public static final int regStationAddress_2_3w = 0x00; /** Universal with Exceptions; pg 127 **/
+ // Registers2
+ public static final int regResetOptions_2_w = 0x0c;
+ /**
+ * 905B Revision Only *
+ */
+ public static final int regStationMask_2_3w = 0x06;
+ /**
+ * Universal with Exceptions; pg 127 *
+ */
+ public static final int regStationAddress_2_3w = 0x00;
+ /**
+ * Universal with Exceptions; pg 127 *
+ */
- // Registers1
- public static final int regRxStatus_1_w = 0x0a; /** 90X Revision Only; Pg 126 **/
+ // Registers1
+ public static final int regRxStatus_1_w = 0x0a;
+ /**
+ * 90X Revision Only; Pg 126 *
+ */
- // Registers0
- public static final int regEepromData_0_w = 0x0c; /** Universal **/
- public static final int regEepromCommand_0_w = 0x0a; /** Universal **/
- public static final int regBiosRomData_0_b = 0x08; /** 905B Revision Only **/
- public static final int regBiosRomAddr_0_l = 0x04; /** 905B Revision Only **/
+ // Registers0
+ public static final int regEepromData_0_w = 0x0c;
+ /**
+ * Universal *
+ */
+ public static final int regEepromCommand_0_w = 0x0a;
+ /**
+ * Universal *
+ */
+ public static final int regBiosRomData_0_b = 0x08;
+ /**
+ * 905B Revision Only *
+ */
+ public static final int regBiosRomAddr_0_l = 0x04;
+ /**
+ * 905B Revision Only *
+ */
- /* The names for the eight register windows ***/
+ /* The names for the eight register windows ***/
public static final int winPowerVlan7 = 0x07;
public static final int winStatistics6 = 0x06;
public static final int winTxRxControl5 = 0x05;
@@ -124,64 +316,108 @@
public static final int winUnused1 = 0x01;
public static final int winEepromBios0 = 0x00;
- /* Command definitions for the 3c90X ***/
- public static final int cmdGlobalReset = 0x00; /** Universal with Exceptions; pg 151 **/
- public static final int cmdSelectRegisterWindow = 0x01; /** Universal **/
- public static final int cmdEnableDcConverter = 0x02; /** **/
- public static final int cmdRxDisable = 0x03; /** **/
- public static final int cmdRxEnable = 0x04; /** Universal **/
- public static final int cmdRxReset = 0x05; /** Universal **/
- public static final int cmdStallCtl = 0x06; /** Universal **/
- public static final int cmdTxEnable = 0x09; /** Universal **/
- public static final int cmdTxDisable = 0x0A; /** **/
- public static final int cmdTxReset = 0x0B; /** Universal **/
- public static final int cmdRequestInterrupt = 0x0C; /** **/
- public static final int cmdAcknowledgeInterrupt = 0x0D; /** Universal **/
- public static final int cmdSetInterruptEnable = 0x0E; /** Universal **/
- public static final int cmdSetIndicationEnable = 0x0F; /** Universal **/
- public static final int cmdSetRxFilter = 0x10; /** Universal **/
- public static final int cmdSetRxEarlyThresh = 0x11; /** **/
- public static final int cmdSetTxStartThresh = 0x13; /** **/
- public static final int cmdStatisticsEnable = 0x15; /** **/
- public static final int cmdStatisticsDisable = 0x16; /** **/
- public static final int cmdDisableDcConverter = 0x17; /** **/
- public static final int cmdSetTxReclaimThresh = 0x18; /** **/
- public static final int cmdSetHashFilterBit = 0x19; /** **/
+ /* Command definitions for the 3c90X ***/
+ public static final int cmdGlobalReset = 0x00;
+ /**
+ * Universal with Exceptions; pg 151 *
+ */
+ public static final int cmdSelectRegisterWindow = 0x01;
+ /**
+ * Universal *
+ */
+ public static final int cmdEnableDcConverter = 0x02;
+ /** **/
+ public static final int cmdRxDisable = 0x03;
+ /** **/
+ public static final int cmdRxEnable = 0x04;
+ /**
+ * Universal *
+ */
+ public static final int cmdRxReset = 0x05;
+ /**
+ * Universal *
+ */
+ public static final int cmdStallCtl = 0x06;
+ /**
+ * Universal *
+ */
+ public static final int cmdTxEnable = 0x09;
+ /**
+ * Universal *
+ */
+ public static final int cmdTxDisable = 0x0A;
+ /** **/
+ public static final int cmdTxReset = 0x0B;
+ /**
+ * Universal *
+ */
+ public static final int cmdRequestInterrupt = 0x0C;
+ /** **/
+ public static final int cmdAcknowledgeInterrupt = 0x0D;
+ /**
+ * Universal *
+ */
+ public static final int cmdSetInterruptEnable = 0x0E;
+ /**
+ * Universal *
+ */
+ public static final int cmdSetIndicationEnable = 0x0F;
+ /**
+ * Universal *
+ */
+ public static final int cmdSetRxFilter = 0x10;
+ /**
+ * Universal *
+ */
+ public static final int cmdSetRxEarlyThresh = 0x11;
+ /** **/
+ public static final int cmdSetTxStartThresh = 0x13;
+ /** **/
+ public static final int cmdStatisticsEnable = 0x15;
+ /** **/
+ public static final int cmdStatisticsDisable = 0x16;
+ /** **/
+ public static final int cmdDisableDcConverter = 0x17;
+ /** **/
+ public static final int cmdSetTxReclaimThresh = 0x18;
+ /** **/
+ public static final int cmdSetHashFilterBit = 0x19;
+ /** **/
- /* Values for int status register bitmask **/
- public static final int INT_INTERRUPTLATCH = (1<<0);
- public static final int INT_HOSTERROR = (1<<1);
- public static final int INT_TXCOMPLETE = (1<<2);
- public static final int INT_RXCOMPLETE = (1<<4);
- public static final int INT_RXEARLY = (1<<5);
- public static final int INT_INTREQUESTED = (1<<6);
- public static final int INT_UPDATESTATS = (1<<7);
- public static final int INT_LINKEVENT = (1<<8);
- public static final int INT_DNCOMPLETE = (1<<9);
- public static final int INT_UPCOMPLETE = (1<<10);
- public static final int INT_CMDINPROGRESS = (1<<12);
- public static final int INT_WINDOWNUMBER = (7<<13);
-
+ /* Values for int status register bitmask **/
+ public static final int INT_INTERRUPTLATCH = (1 << 0);
+ public static final int INT_HOSTERROR = (1 << 1);
+ public static final int INT_TXCOMPLETE = (1 << 2);
+ public static final int INT_RXCOMPLETE = (1 << 4);
+ public static final int INT_RXEARLY = (1 << 5);
+ public static final int INT_INTREQUESTED = (1 << 6);
+ public static final int INT_UPDATESTATS = (1 << 7);
+ public static final int INT_LINKEVENT = (1 << 8);
+ public static final int INT_DNCOMPLETE = (1 << 9);
+ public static final int INT_UPCOMPLETE = (1 << 10);
+ public static final int INT_CMDINPROGRESS = (1 << 12);
+ public static final int INT_WINDOWNUMBER = (7 << 13);
+
/* UpPktStatus bits */
- public static final int upPktLenMask = 0x1FFF;
- public static final int upError = (1<<14);
- public static final int upComplete = (1<<15);
- public static final int upOverrun = (1<<16);
- public static final int runtFrame = (1<<17);
- public static final int alignmentError = (1<<18);
- public static final int crcError = (1<<19);
- public static final int oversizedFrame = (1<<20);
- public static final int dribbleBits = (1<<23);
- public static final int upOverflow = (1<<24);
- public static final int ipChecksumError = (1<<25);
- public static final int tcpChecksumError = (1<<26);
- public static final int udpChecksumError = (1<<27);
- public static final int impliedBufferEnable = (1<<28);
- public static final int ipChecksumChecked = (1<<29);
- public static final int tcpChecksumChecked = (1<<30);
- public static final int udpChecksumChecked = (1<<31);
-
- /* Driver specific values */
- public static final int RX_FRAMES = 32;
- public static final int MAX_SERVICE = 32;
+ public static final int upPktLenMask = 0x1FFF;
+ public static final int upError = (1 << 14);
+ public static final int upComplete = (1 << 15);
+ public static final int upOverrun = (1 << 16);
+ public static final int runtFrame = (1 << 17);
+ public static final int alignmentError = (1 << 18);
+ public static final int crcError = (1 << 19);
+ public static final int oversizedFrame = (1 << 20);
+ public static final int dribbleBits = (1 << 23);
+ public static final int upOverflow = (1 << 24);
+ public static final int ipChecksumError = (1 << 25);
+ public static final int tcpChecksumError = (1 << 26);
+ public static final int udpChecksumError = (1 << 27);
+ public static final int impliedBufferEnable = (1 << 28);
+ public static final int ipChecksumChecked = (1 << 29);
+ public static final int tcpChecksumChecked = (1 << 30);
+ public static final int udpChecksumChecked = (1 << 31);
+
+ /* Driver specific values */
+ public static final int RX_FRAMES = 32;
+ public static final int MAX_SERVICE = 32;
}
Modified: trunk/net/src/driver/org/jnode/driver/net/_3c90x/_3c90xCore.java
===================================================================
--- trunk/net/src/driver/org/jnode/driver/net/_3c90x/_3c90xCore.java 2008-05-30 12:54:00 UTC (rev 4156)
+++ trunk/net/src/driver/org/jnode/driver/net/_3c90x/_3c90xCore.java 2008-05-30 14:55:37 UTC (rev 4157)
@@ -18,7 +18,7 @@
* along with this library; If not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-
+
package org.jnode.driver.net._3c90x;
import java.util.ArrayList;
@@ -52,604 +52,643 @@
*/
public class _3c90xCore extends AbstractDeviceCore implements _3c90xConstants, IRQHandler, EthernetConstants {
- /** Start of IO address space */
- private final int iobase;
- /** IO address space */
- private final IOResource io;
- /** IRQ */
- private final IRQResource irq;
- /** My ethernet address */
- private EthernetAddress hwAddress;
- /** The driver i'm a part of */
- private final _3c90xDriver driver;
- /** My flags */
- private final _3c90xFlags flags;
- /** Is a transmission active? */
- private boolean tx_active;
- /** Active register window */
- private int reg_window = 0xff;
- /** The receive buffer ring */
- private final _3c90xRxRing rxRing;
- /** The transmit buffer */
- private final _3c90xTxBuffer txBuffer;
- /** Is the device a B revision */
- private final boolean Brev;
-
- /**
- * Create a new instance
- * @param flags
- */
- public _3c90xCore(
- _3c90xDriver driver,
- ResourceOwner owner,
- PCIDevice device,
- _3c90xFlags flags)
- throws DriverException, ResourceNotFreeException {
- final int irq = getIRQ(device, flags);
- this.driver = driver;
- this.flags = flags;
- this.tx_active = false;
+ /**
+ * Start of IO address space
+ */
+ private final int iobase;
+ /**
+ * IO address space
+ */
+ private final IOResource io;
+ /**
+ * IRQ
+ */
+ private final IRQResource irq;
+ /**
+ * My ethernet address
+ */
+ private Ethe...
[truncated message content] |
|
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());
- *
- ...
[truncated message content] |