Subversion Repositories Kolibri OS

Rev

Rev 5127 | Rev 5363 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 5127 Rev 5182
Line 49... Line 49...
49
include '../proc32.inc'
49
include '../proc32.inc'
50
include '../struct.inc'
50
include '../struct.inc'
51
include '../macros.inc'
51
include '../macros.inc'
52
include '../fdo.inc'
52
include '../fdo.inc'
53
include '../netdrv.inc'
53
include '../netdrv.inc'
-
 
54
include '../mii.inc'
Line 54... Line 55...
54
 
55
 
55
;**************************************************************************
56
;**************************************************************************
56
; forcedeth Register Definitions
57
; forcedeth Register Definitions
Line 278... Line 279...
278
NV_MIIPHY_DELAYMAX              = 10000
279
NV_MIIPHY_DELAYMAX              = 10000
279
NV_MAC_RESET_DELAY              = 64
280
NV_MAC_RESET_DELAY              = 64
280
NV_WAKEUPPATTERNS               = 5
281
NV_WAKEUPPATTERNS               = 5
281
NV_WAKEUPMASKENTRIES            = 4
282
NV_WAKEUPMASKENTRIES            = 4
Line 282... Line -...
282
 
-
 
283
; Advertisement control register.
-
 
284
ADVERTISE_SLCT                  = 0x001f  ; Selector bits
-
 
285
ADVERTISE_CSMA                  = 0x0001  ; Only selector supported
-
 
286
ADVERTISE_10HALF                = 0x0020  ; Try for 10mbps half-duplex
-
 
287
ADVERTISE_10FULL                = 0x0040  ; Try for 10mbps full-duplex
-
 
288
ADVERTISE_100HALF               = 0x0080  ; Try for 100mbps half-duplex
-
 
289
ADVERTISE_100FULL               = 0x0100  ; Try for 100mbps full-duplex
-
 
290
ADVERTISE_100BASE4              = 0x0200  ; Try for 100mbps 4k packets
-
 
291
ADVERTISE_RESV                  = 0x1c00  ; Unused...
-
 
292
ADVERTISE_RFAULT                = 0x2000  ; Say we can detect faults
-
 
293
ADVERTISE_LPACK                 = 0x4000  ; Ack link partners response
-
 
294
ADVERTISE_NPAGE                 = 0x8000  ; Next page bit
-
 
295
 
-
 
296
ADVERTISE_FULL                  = (ADVERTISE_100FULL or ADVERTISE_10FULL or ADVERTISE_CSMA)
-
 
297
ADVERTISE_ALL                   = (ADVERTISE_10HALF or ADVERTISE_10FULL or ADVERTISE_100HALF or ADVERTISE_100FULL)
-
 
298
 
-
 
299
MII_1000BT_CR                   = 0x09
-
 
300
MII_1000BT_SR                   = 0x0a
-
 
301
ADVERTISE_1000FULL              = 0x0200
-
 
302
ADVERTISE_1000HALF              = 0x0100
-
 
303
 
-
 
304
BMCR_ANRESTART                  = 0x0200  ; Auto negotiation restart
-
 
305
BMCR_ANENABLE                   = 0x1000  ; Enable auto negotiation
-
 
306
BMCR_SPEED100                   = 0x2000  ; Select 100Mbps
-
 
307
BMCR_LOOPBACK                   = 0x4000  ; TXD loopback bits
-
 
308
BMCR_RESET                      = 0x8000  ; Reset the DP83840
-
 
309
 
-
 
310
; Basic mode status register.
-
 
311
BMSR_ERCAP                      = 0x0001  ; Ext-reg capability
-
 
312
BMSR_JCD                        = 0x0002  ; Jabber detected
-
 
313
BMSR_LSTATUS                    = 0x0004  ; Link status
-
 
314
BMSR_ANEGCAPABLE                = 0x0008  ; Able to do auto-negotiation
-
 
315
BMSR_RFAULT                     = 0x0010  ; Remote fault detected
-
 
316
BMSR_ANEGCOMPLETE               = 0x0020  ; Auto-negotiation complete
-
 
317
BMSR_RESV                       = 0x07c0  ; Unused...
-
 
318
BMSR_10HALF                     = 0x0800  ; Can do 10mbps, half-duplex
-
 
319
BMSR_10FULL                     = 0x1000  ; Can do 10mbps, full-duplex
-
 
320
BMSR_100HALF                    = 0x2000  ; Can do 100mbps, half-duplex
-
 
321
BMSR_100FULL                    = 0x4000  ; Can do 100mbps, full-duplex
-
 
322
BMSR_100BASE4                   = 0x8000  ; Can do 100mbps, 4k packets
-
 
323
 
283
 
324
struct  TxDesc
284
struct  TxDesc
325
        PacketBuffer            dd ?
285
        PacketBuffer            dd ?
326
        FlagLen                 dd ?
286
        FlagLen                 dd ?
Line 1169... Line 1129...
1169
        jmp     .next_if
1129
        jmp     .next_if
Line 1170... Line 1130...
1170
 
1130
 
1171
  .gigabit:
1131
  .gigabit:
Line 1172... Line 1132...
1172
        mov     [ebx + device.gigabit], PHY_GIGABIT
1132
        mov     [ebx + device.gigabit], PHY_GIGABIT
1173
 
1133
 
1174
        mov     eax, MII_1000BT_CR
1134
        mov     eax, MII_CTRL1000
Line 1175... Line 1135...
1175
        mov     ecx, MII_READ
1135
        mov     ecx, MII_READ
Line 1185... Line 1145...
1185
 
1145
 
Line 1186... Line 1146...
1186
        and     eax, (not ADVERTISE_1000FULL)
1146
        and     eax, (not ADVERTISE_1000FULL)
1187
 
1147
 
1188
  .next:
1148
  .next:
1189
        mov     ecx, eax
1149
        mov     ecx, eax
Line 1190... Line 1150...
1190
        mov     eax, MII_1000BT_CR
1150
        mov     eax, MII_CTRL1000
1191
        call    mii_rw
1151
        call    mii_rw
Line 1612... Line 1572...
1612
 
1572
 
1613
        cmp     [ebx + device.gigabit], PHY_GIGABIT
1573
        cmp     [ebx + device.gigabit], PHY_GIGABIT
Line 1614... Line 1574...
1614
        jne     .no_gigabit
1574
        jne     .no_gigabit
1615
 
1575
 
1616
        ;mov     edx, [ebx + device.phyaddr]
1576
        ;mov     edx, [ebx + device.phyaddr]
1617
        mov     eax, MII_1000BT_CR
1577
        mov     eax, MII_CTRL1000
1618
        mov     ecx, MII_READ
1578
        mov     ecx, MII_READ
Line 1619... Line 1579...
1619
        call    mii_rw
1579
        call    mii_rw
1620
        push    eax
1580
        push    eax
1621
 
1581
 
1622
        ;mov     edx, [ebx + device.phyaddr]
1582
        ;mov     edx, [ebx + device.phyaddr]
1623
        mov     eax, MII_1000BT_SR
1583
        mov     eax, MII_STAT1000
Line 1624... Line 1584...
1624
        mov     ecx, MII_READ
1584
        mov     ecx, MII_READ