Subversion Repositories Kolibri OS

Rev

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

Rev 1486 Rev 1492
Line 27... Line 27...
27
include 'proc32.inc'
27
include 'proc32.inc'
28
include 'imports.inc'
28
include 'imports.inc'
29
include 'fdo.inc'
29
include 'fdo.inc'
30
include 'netdrv.inc'
30
include 'netdrv.inc'
Line 31... Line 31...
31
 
31
 
32
OS_BASE 	equ 0;
32
OS_BASE 	equ 0
33
new_app_base	equ 0x60400000
33
new_app_base	equ 0x60400000
Line 34... Line 34...
34
PROC_BASE	equ OS_BASE+0x0080000
34
PROC_BASE	equ OS_BASE+0x0080000
35
 
35
 
36
public START
36
public START
Line 37... Line -...
37
public service_proc
-
 
38
public version
-
 
39
 
-
 
40
 
-
 
41
struc ETH_DEVICE {
-
 
42
; pointers to procedures
-
 
43
      .unload		dd ?
-
 
44
      .reset		dd ?
-
 
45
      .transmit 	dd ?
-
 
46
      .set_MAC		dd ?
37
public service_proc
47
      .get_MAC		dd ?
-
 
48
      .set_mode 	dd ?
-
 
49
      .get_mode 	dd ?
-
 
50
; status & variables
-
 
51
      .bytes_tx 	dq ?
-
 
-
 
38
public version
52
      .bytes_rx 	dq ?
39
 
-
 
40
 
53
      .packets_tx	dd ?
41
virtual at ebx
54
      .packets_rx	dd ?
-
 
-
 
42
 
55
      .mode		dd ?  ; This dword contains cable status (10mbit/100mbit, full/half duplex, auto negotiation or not,..)
43
      device:
56
      .name		dd ?
44
 
57
      .mac		dp ?
45
      ETH_DEVICE
58
; device specific
46
 
59
      .rx_buffer	dd ?
47
      .rx_buffer	dd ?
Line 66... Line 54...
66
      .irq_line 	db ?
54
      .irq_line 	db ?
67
      .hw_ver_id	db ?
55
      .hw_ver_id	db ?
Line 68... Line 56...
68
 
56
 
Line 69... Line -...
69
      .size = $ - device
-
 
70
 
-
 
71
}
-
 
72
 
-
 
73
virtual at ebx
57
      .size = $ - device
Line -... Line 58...
-
 
58
 
74
  device ETH_DEVICE
59
end virtual
Line 75... Line 60...
75
end virtual
60
 
76
 
61
 
Line 332... Line 317...
332
  .firstdevice:
317
  .firstdevice:
333
	cmp	[RTL8139_DEV], MAX_RTL8139		; First check if the driver can handle one more card
318
	cmp	[RTL8139_DEV], MAX_RTL8139		; First check if the driver can handle one more card
334
	jge	.fail
319
	jge	.fail
Line 335... Line 320...
335
 
320
 
336
	push	edx
321
	push	edx
337
	stdcall KernelAlloc, dword device.size		; Allocate the buffer for eth_device structure
322
	stdcall KernelAlloc, device.size	 ; Allocate the buffer for eth_device structure
338
	pop	edx
323
	pop	edx
339
	test	eax, eax
324
	test	eax, eax
340
	jz	.fail
325
	jz	.fail
Line 356... Line 341...
356
	mov	[device.pci_bus], cl
341
	mov	[device.pci_bus], cl
357
	mov	cl , [eax+2]
342
	mov	cl , [eax+2]
358
	mov	[device.pci_dev], cl
343
	mov	[device.pci_dev], cl
Line 359... Line 344...
359
 
344
 
360
; Now, it's time to find the base io addres of the PCI device
-
 
Line 361... Line 345...
361
; TODO: implement check if bus and dev exist on this machine
345
; Now, it's time to find the base io addres of the PCI device
Line 362... Line 346...
362
 
346
 
Line 363... Line -...
363
	find_io [device.pci_bus], [device.pci_dev], [device.io_addr]
-
 
364
 
347
	find_io [device.pci_bus], [device.pci_dev], [device.io_addr]
365
; We've found the io address, find IRQ now
-
 
366
 
-
 
367
	movzx	eax, byte [device.pci_bus]
-
 
368
	movzx	ecx, byte [device.pci_dev]
-
 
Line 369... Line 348...
369
	push	ebx
348
 
370
	stdcall PciRead8, eax ,ecx ,0x3c				; 0x3c is the offset where irq can be found
349
; We've found the io address, find IRQ now