Rev 1206 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1206 | Rev 1254 | ||
---|---|---|---|
Line 5... | Line 5... | ||
5 | ;; ;; |
5 | ;; ;; |
6 | ;; Realtek 8139 driver for KolibriOS ;; |
6 | ;; Realtek 8139 driver for KolibriOS ;; |
7 | ;; ;; |
7 | ;; ;; |
8 | ;; Written by hidnplayr@kolibrios.org ;; |
8 | ;; Written by hidnplayr@kolibrios.org ;; |
9 | ;; ;; |
9 | ;; ;; |
10 | ;; v0.1 - march 2009 ;; |
10 | ;; 0.1 - x march 2009 ;; |
- | 11 | ;; 0.2 - 8 november 2009 ;; |
|
11 | ;; ;; |
12 | ;; ;; |
12 | ;; GNU GENERAL PUBLIC LICENSE ;; |
13 | ;; GNU GENERAL PUBLIC LICENSE ;; |
13 | ;; Version 2, June 1991 ;; |
14 | ;; Version 2, June 1991 ;; |
14 | ;; ;; |
15 | ;; ;; |
15 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
16 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
Line 16... | Line -... | ||
16 | - | ||
17 | $Revision: 1206 $ |
- | |
18 | 17 | ||
Line 19... | Line 18... | ||
19 | format MS COFF |
18 | format MS COFF |
Line 20... | Line 19... | ||
20 | 19 | ||
Line 764... | Line 763... | ||
764 | 763 | ||
765 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
764 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
766 | ;; ;; |
765 | ;; ;; |
767 | ;; Transmit ;; |
766 | ;; Transmit ;; |
768 | ;; ;; |
767 | ;; ;; |
769 | ;; In: buffer pointer in [esp] ;; |
768 | ;; In: buffer pointer in [esp+4] ;; |
770 | ;; size of buffer in [esp+4] ;; |
769 | ;; size of buffer in [esp+8] ;; |
771 | ;; pointer to device structure in ebx ;; |
770 | ;; pointer to device structure in ebx ;; |
772 | ;; ;; |
771 | ;; ;; |
Line 773... | Line 772... | ||
773 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
772 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
774 | 773 | ||
775 | align 4 |
774 | align 4 |
776 | transmit: |
775 | transmit: |
777 | DEBUGF 1,"Transmitting packet, buffer:%x, size:%u\n",[esp],[esp+4] |
776 | DEBUGF 1,"Transmitting packet, buffer:%x, size:%u\n",[esp+4],[esp+8] |
778 | mov eax, [esp] |
777 | mov eax, [esp+4] |
779 | DEBUGF 1,"To: %x-%x-%x-%x-%x-%x From: %x-%x-%x-%x-%x-%x Type:%x%x\n",\ |
778 | DEBUGF 1,"To: %x-%x-%x-%x-%x-%x From: %x-%x-%x-%x-%x-%x Type:%x%x\n",\ |
780 | [eax+00]:2,[eax+01]:2,[eax+02]:2,[eax+03]:2,[eax+04]:2,[eax+05]:2,\ |
779 | [eax+00]:2,[eax+01]:2,[eax+02]:2,[eax+03]:2,[eax+04]:2,[eax+05]:2,\ |
Line 781... | Line 780... | ||
781 | [eax+06]:2,[eax+07]:2,[eax+08]:2,[eax+09]:2,[eax+10]:2,[eax+11]:2,\ |
780 | [eax+06]:2,[eax+07]:2,[eax+08]:2,[eax+09]:2,[eax+10]:2,[eax+11]:2,\ |
782 | [eax+13]:2,[eax+12]:2 |
781 | [eax+13]:2,[eax+12]:2 |
783 | 782 | ||
784 | cmp dword [esp+4], MAX_ETH_FRAME_SIZE |
783 | cmp dword [esp+8], MAX_ETH_FRAME_SIZE |
Line 785... | Line 784... | ||
785 | jg .finish ; packet is too long |
784 | jg .finish ; packet is too long |
786 | cmp dword [esp+4], 60 |
785 | cmp dword [esp+8], 60 |
787 | jl .finish ; packet is too short |
786 | jl .finish ; packet is too short |
Line 820... | Line 819... | ||
820 | mul edx ; |
819 | mul edx ; |
821 | mov edi, [ebx+device.tx_buffer] ; |
820 | mov edi, [ebx+device.tx_buffer] ; |
822 | add edi, eax ; Store it in edi |
821 | add edi, eax ; Store it in edi |
823 | pop edx |
822 | pop edx |
Line 824... | Line 823... | ||
824 | 823 | ||
825 | mov esi, [esp] ; Copy data to that address |
824 | mov esi, [esp+4] ; Copy data to that address |
826 | mov ecx, [esp+4] ; |
825 | mov ecx, [esp+8] ; |
827 | shr ecx, 2 ; |
826 | shr ecx, 2 ; |
828 | rep movsd ; |
827 | rep movsd ; |
829 | mov ecx, [esp+4] ; |
828 | mov ecx, [esp+8] ; |
830 | and ecx, 3 ; |
829 | and ecx, 3 ; |
Line 831... | Line 830... | ||
831 | rep movsb ; |
830 | rep movsb ; |
832 | 831 | ||
Line 833... | Line 832... | ||
833 | inc [ebx+device.packets_tx] ; |
832 | inc [ebx+device.packets_tx] ; |
834 | mov eax, [esp+4] ; Get packet size in eax |
833 | mov eax, [esp+8] ; Get packet size in eax |
Line 835... | Line 834... | ||
835 | 834 | ||
Line 844... | Line 843... | ||
844 | and [ebx+device.curr_tx_desc], 3 |
843 | and [ebx+device.curr_tx_desc], 3 |
Line 845... | Line 844... | ||
845 | 844 | ||
846 | DEBUGF 2," - Packet Sent! " |
845 | DEBUGF 2," - Packet Sent! " |
847 | .finish: |
846 | .finish: |
848 | DEBUGF 2," - Done!\n" |
- | |
849 | call KernelFree |
- | |
850 | add esp, 4 ; pop (balance stack) |
- | |
851 | 847 | DEBUGF 2," - Done!\n" |