Rev 2999 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 2999 | Rev 3155 | ||
---|---|---|---|
Line 1... | Line 1... | ||
1 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
1 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
2 | ;; ;; |
2 | ;; ;; |
3 | ;; Copyright (C) KolibriOS team 2004-2012. All rights reserved. ;; |
3 | ;; Copyright (C) KolibriOS team 2004-2013. All rights reserved. ;; |
4 | ;; Distributed under terms of the GNU General Public License ;; |
4 | ;; Distributed under terms of the GNU General Public License ;; |
5 | ;; ;; |
5 | ;; ;; |
6 | ;; i8254x driver for KolibriOS ;; |
6 | ;; i8254x driver for KolibriOS ;; |
7 | ;; ;; |
7 | ;; ;; |
8 | ;; based on i8254x.asm from baremetal os ;; |
8 | ;; based on i8254x.asm from baremetal os ;; |
Line 164... | Line 164... | ||
164 | 164 | ||
165 | ; ICR - Interrupt Cause Read (0x00c0) |
165 | ; ICR - Interrupt Cause Read (0x00c0) |
166 | ICR_TXDW = 0x00000001 ; TX Desc Written back |
166 | ICR_TXDW = 0x00000001 ; TX Desc Written back |
167 | ICR_TXQE = 0x00000002 ; TX Queue Empty |
167 | ICR_TXQE = 0x00000002 ; TX Queue Empty |
168 | ICR_LSC = 0x00000004 ; Link Status Change |
168 | ICR_LSC = 0x00000004 ; Link Status Change |
169 | ICR_RXSEQ = 0x00000008 ; RX S= ence Error |
169 | ICR_RXSEQ = 0x00000008 ; RX Sence Error |
170 | ICR_RXDMT0 = 0x00000010 ; RX Desc min threshold reached |
170 | ICR_RXDMT0 = 0x00000010 ; RX Desc min threshold reached |
171 | ICR_RXO = 0x00000040 ; RX Overrun |
171 | ICR_RXO = 0x00000040 ; RX Overrun |
172 | ICR_RXT0 = 0x00000080 ; RX Timer Interrupt |
172 | ICR_RXT0 = 0x00000080 ; RX Timer Interrupt |
173 | ICR_MDAC = 0x00000200 ; MDIO Access Complete |
173 | ICR_MDAC = 0x00000200 ; MDIO Access Complete |
Line 322... | Line 322... | ||
322 | 322 | ||
323 | cmp eax, 0 ;SRV_GETVERSION |
323 | cmp eax, 0 ;SRV_GETVERSION |
Line 324... | Line 324... | ||
324 | jne @F |
324 | jne @F |
325 | 325 | ||
326 | cmp [IOCTL.out_size], 4 |
326 | cmp [IOCTL.out_size], 4 |
327 | jl .fail |
327 | jb .fail |
Line 328... | Line 328... | ||
328 | mov eax, [IOCTL.output] |
328 | mov eax, [IOCTL.output] |
329 | mov [eax], dword API_VERSION |
329 | mov [eax], dword API_VERSION |
Line 335... | Line 335... | ||
335 | @@: |
335 | @@: |
336 | cmp eax, 1 ;SRV_HOOK |
336 | cmp eax, 1 ;SRV_HOOK |
337 | jne .fail |
337 | jne .fail |
Line 338... | Line 338... | ||
338 | 338 | ||
339 | cmp [IOCTL.inp_size], 3 ; Data input must be at least 3 bytes |
339 | cmp [IOCTL.inp_size], 3 ; Data input must be at least 3 bytes |
Line 340... | Line 340... | ||
340 | jl .fail |
340 | jb .fail |
341 | 341 | ||
342 | mov eax, [IOCTL.input] |
342 | mov eax, [IOCTL.input] |
Line 364... | Line 364... | ||
364 | 364 | ||
365 | 365 | ||
366 | ; This device doesnt have its own eth_device structure yet, lets create one |
366 | ; This device doesnt have its own eth_device structure yet, lets create one |
367 | .firstdevice: |
367 | .firstdevice: |
Line 368... | Line 368... | ||
368 | cmp [devices], MAX_DEVICES ; First check if the driver can handle one more card |
368 | cmp [devices], MAX_DEVICES ; First check if the driver can handle one more card |
Line 369... | Line 369... | ||
369 | jge .fail |
369 | jae .fail |
Line 567... | Line 567... | ||
567 | mov dword [esi + REG_TIPG], 0x0060200A ; IPGT 10, IPGR1 8, IPGR2 6 |
567 | mov dword [esi + REG_TIPG], 0x0060200A ; IPGT 10, IPGR1 8, IPGR2 6 |
Line 568... | Line 568... | ||
568 | 568 | ||
569 | xor eax, eax |
569 | xor eax, eax |
Line -... | Line 570... | ||
- | 570 | ret |
|
- | 571 | ||
- | 572 | align 4 |
|
- | 573 | reset: |
|
570 | ret |
574 | call reset_dontstart |
Line 571... | Line 575... | ||
571 | 575 | ||
572 | start_i8254x: |
576 | start_i8254x: |
573 | 577 | ||
Line 582... | Line 586... | ||
582 | mov [device.mtu], 1514 |
586 | mov [device.mtu], 1514 |
Line 583... | Line 587... | ||
583 | 587 | ||
584 | xor eax, eax |
588 | xor eax, eax |
Line 585... | Line -... | ||
585 | ret |
- | |
586 | - | ||
587 | align 4 |
- | |
588 | reset: |
- | |
589 | call reset_dontstart |
- | |
590 | call start_i8254x |
- | |
Line 591... | Line 589... | ||
591 | 589 | ret |
|
592 | ret |
590 | |
Line 650... | Line 648... | ||
650 | [eax+00]:2,[eax+01]:2,[eax+02]:2,[eax+03]:2,[eax+04]:2,[eax+05]:2,\ |
648 | [eax+00]:2,[eax+01]:2,[eax+02]:2,[eax+03]:2,[eax+04]:2,[eax+05]:2,\ |
651 | [eax+06]:2,[eax+07]:2,[eax+08]:2,[eax+09]:2,[eax+10]:2,[eax+11]:2,\ |
649 | [eax+06]:2,[eax+07]:2,[eax+08]:2,[eax+09]:2,[eax+10]:2,[eax+11]:2,\ |
652 | [eax+13]:2,[eax+12]:2 |
650 | [eax+13]:2,[eax+12]:2 |
Line 653... | Line 651... | ||
653 | 651 | ||
654 | cmp dword [esp + 8], 1514 |
652 | cmp dword [esp + 8], 1514 |
655 | jg .fail |
653 | ja .fail |
656 | cmp dword [esp + 8], 60 |
654 | cmp dword [esp + 8], 60 |
Line 657... | Line 655... | ||
657 | jl .fail |
655 | jb .fail |
658 | 656 | ||
659 | 657 |