Rev 1514 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1514 | Rev 1519 | ||
---|---|---|---|
Line 1... | Line 1... | ||
1 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
1 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
2 | ;; ;; |
2 | ;; ;; |
3 | ;; Copyright (C) KolibriOS team 2004-2009. All rights reserved. ;; |
3 | ;; Copyright (C) KolibriOS team 2004-2010. 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 | ;; RTL8029/ne2000 driver for KolibriOS ;; |
6 | ;; RTL8029/ne2000 driver for KolibriOS ;; |
7 | ;; ;; |
7 | ;; ;; |
- | 8 | ;; based on RTL8029.asm driver for menuetos ;; |
|
- | 9 | ;; and realtek8029.asm for SolarOS by Eugen Brasoveanu ;; |
|
- | 10 | ;; ;; |
|
8 | ;; Written by hidnplayr@kolibrios.org ;; |
11 | ;; Written by hidnplayr@kolibrios.org ;; |
9 | ;; with help from CleverMouse ;; |
12 | ;; with help from CleverMouse ;; |
10 | ;; ;; |
13 | ;; ;; |
11 | ;; GNU GENERAL PUBLIC LICENSE ;; |
14 | ;; GNU GENERAL PUBLIC LICENSE ;; |
12 | ;; Version 2, June 1991 ;; |
15 | ;; Version 2, June 1991 ;; |
13 | ;; ;; |
16 | ;; ;; |
14 | ;; current status (september 2009) - UNSTABLE ;; |
- | |
15 | ;; ;; |
- | |
16 | ;; based on RTL8029.asm driver for menuetos ;; |
- | |
17 | ;; and realtek8029.asm for SolarOS by Eugen Brasoveanu ;; |
- | |
18 | ;; ;; |
- | |
19 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
17 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
Line 20... | Line -... | ||
20 | - | ||
21 | ;$Revision: 1514 $ |
- | |
22 | 18 | ||
Line 23... | Line 19... | ||
23 | format MS COFF |
19 | format MS COFF |
- | 20 | ||
- | 21 | API_VERSION equ 0x01000100 |
|
- | 22 | DRIVER_VERSION equ 5 |
|
Line 24... | Line 23... | ||
24 | 23 | ||
25 | API_VERSION equ 0x01000100 |
24 | MAX_DEVICES equ 16 |
26 | 25 | ||
Line 27... | Line 26... | ||
27 | DEBUG equ 1 |
26 | DEBUG equ 1 |
28 | __DEBUG__ equ 1 |
27 | __DEBUG__ equ 1 |
29 | __DEBUG_LEVEL__ equ 1 |
28 | __DEBUG_LEVEL__ equ 1 |
30 | 29 | ||
Line 31... | Line -... | ||
31 | include 'proc32.inc' |
- | |
32 | include 'imports.inc' |
- | |
33 | include 'fdo.inc' |
- | |
34 | include 'netdrv.inc' |
- | |
35 | - | ||
36 | OS_BASE equ 0 |
30 | include 'proc32.inc' |
Line 37... | Line 31... | ||
37 | new_app_base equ 0x60400000 |
31 | include 'imports.inc' |
Line 38... | Line 32... | ||
38 | PROC_BASE equ OS_BASE+0x0080000 |
32 | include 'fdo.inc' |
Line 66... | Line 60... | ||
66 | 60 | ||
67 | public START |
61 | public START |
68 | public service_proc |
62 | public service_proc |
Line 69... | Line -... | ||
69 | public version |
- | |
70 | - | ||
71 | MAX_DEVICES equ 16 ; Max number of devices this driver may handle |
63 | public version |
72 | 64 | ||
73 | P0_PSTART equ 0x01 |
65 | P0_PSTART equ 0x01 |
74 | P0_PSTOP equ 0x02 |
66 | P0_PSTOP equ 0x02 |
75 | P0_BOUND equ 0x03 |
67 | P0_BOUND equ 0x03 |
Line 232... | Line 224... | ||
232 | 224 | ||
Line 233... | Line 225... | ||
233 | .pci: |
225 | .pci: |
Line 234... | Line 226... | ||
234 | 226 | ||
235 | ; check if the device is already listed |
227 | ; check if the device is already listed |
236 | 228 | ||
237 | mov esi, DEVICE_LIST |
229 | mov esi, device_list |
Line 238... | Line 230... | ||
238 | mov ecx, [DEVICES] |
230 | mov ecx, [devices] |
239 | test ecx, ecx |
231 | test ecx, ecx |
Line 267... | Line 259... | ||
267 | 259 | ||
Line 268... | Line 260... | ||
268 | jmp .hook |
260 | jmp .hook |
Line 269... | Line 261... | ||
269 | 261 | ||
270 | .isa: |
262 | .isa: |
271 | 263 | ||
272 | mov esi, DEVICE_LIST |
264 | mov esi, device_list |
273 | mov ecx, [DEVICES] |
265 | mov ecx, [devices] |
274 | test ecx, ecx |
266 | test ecx, ecx |
275 | jz .firstdevice_isa |
267 | jz .firstdevice_isa |
Line 303... | Line 295... | ||
303 | 295 | ||
304 | call probe ; this function will output in eax |
296 | call probe ; this function will output in eax |
305 | test eax, eax |
297 | test eax, eax |
Line 306... | Line 298... | ||
306 | jnz .err ; If an error occured, exit |
298 | jnz .err ; If an error occured, exit |
307 | 299 | ||
308 | mov eax, [DEVICES] |
300 | mov eax, [devices] |
Line 309... | Line 301... | ||
309 | mov [DEVICE_LIST+4*eax], ebx |
301 | mov [device_list+4*eax], ebx |
310 | inc [DEVICES] |
302 | inc [devices] |
Line 311... | Line 303... | ||
311 | 303 | ||
Line 344... | Line 336... | ||
344 | endp |
336 | endp |
Line 345... | Line 337... | ||
345 | 337 | ||
Line 346... | Line 338... | ||
346 | 338 | ||
347 | create_new_struct: |
339 | create_new_struct: |
Line 348... | Line 340... | ||
348 | 340 | ||
349 | cmp [DEVICES], MAX_DEVICES |
341 | cmp [devices], MAX_DEVICES |
350 | jge .fail |
342 | jge .fail |
Line 668... | Line 660... | ||
668 | xor eax, eax |
660 | xor eax, eax |
669 | lea edi, [device.bytes_tx] |
661 | lea edi, [device.bytes_tx] |
670 | mov ecx, 6 |
662 | mov ecx, 6 |
671 | rep stosd |
663 | rep stosd |
Line -... | Line 664... | ||
- | 664 | ||
- | 665 | ; Set the mtu, kernel will be able to send now |
|
- | 666 | mov [device.mtu], 1514 |
|
672 | 667 | ||
673 | ; Indicate that we have successfully reset the card |
668 | ; Indicate that we have successfully reset the card |
Line 674... | Line 669... | ||
674 | DEBUGF 2,"Done!\n" |
669 | DEBUGF 2,"Done!\n" |
Line 731... | Line 726... | ||
731 | 726 | ||
732 | add dword [device.bytes_tx], eax |
727 | add dword [device.bytes_tx], eax |
Line 733... | Line 728... | ||
733 | adc dword [device.bytes_tx + 4], 0 |
728 | adc dword [device.bytes_tx + 4], 0 |
- | 729 | ||
- | 730 | .finish: |
|
734 | 731 | call Kernelfree |
|
735 | .finish: |
732 | add esp, 4 |
Line 736... | Line 733... | ||
736 | xor eax, eax |
733 | xor eax, eax |
- | 734 | ret |
|
- | 735 | ||
737 | ret |
736 | .err: |
738 | 737 | call Kernelfree |
|
Line 739... | Line 738... | ||
739 | .err: |
738 | add esp, 4 |
Line 750... | Line 749... | ||
750 | int_handler: |
749 | int_handler: |
Line 751... | Line 750... | ||
751 | 750 | ||
Line 752... | Line 751... | ||
752 | DEBUGF 2,"IRQ %x ",eax:2 |
751 | DEBUGF 2,"IRQ %x ",eax:2 |
753 | 752 | ||
754 | ; find pointer of device wich made INT occur |
753 | ; find pointer of device wich made INT occur |
755 | mov esi, DEVICE_LIST |
754 | mov esi, device_list |
756 | mov ecx, [DEVICES] |
755 | mov ecx, [devices] |
Line 757... | Line 756... | ||
757 | .nextdevice: |
756 | .nextdevice: |
758 | mov ebx, [esi] |
757 | mov ebx, [esi] |
Line 1195... | Line 1194... | ||
1195 | 1194 | ||
1196 | 1195 | ||
Line 1197... | Line 1196... | ||
1197 | ;all initialized data place here |
1196 | ;all initialized data place here |
1198 | align 4 |
1197 | align 4 |
1199 | 1198 | ||
Line 1200... | Line 1199... | ||
1200 | DEVICES dd 0 |
1199 | devices dd 0 |
1201 | version dd (5 shl 16) or (API_VERSION and 0xFFFF) |
1200 | version dd (DRIVER_VERSION shl 16) or (API_VERSION and 0xFFFF) |
1202 | my_service db 'RTL8029/ne2000',0 ;max 16 chars include zero |
1201 | my_service db 'RTL8029/ne2000',0 ;max 16 chars include zero |
Line 1211... | Line 1210... | ||
1211 | 1210 | ||
Line 1212... | Line 1211... | ||
1212 | include_debug_strings |
1211 | include_debug_strings |
Line 1213... | Line 1212... | ||
1213 | 1212 |