Subversion Repositories Kolibri OS

Rev

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 15... Line 15...
15
;;          GNU GENERAL PUBLIC LICENSE                             ;;
15
;;          GNU GENERAL PUBLIC LICENSE                             ;;
16
;;             Version 2, June 1991                                ;;
16
;;             Version 2, June 1991                                ;;
17
;;                                                                 ;;
17
;;                                                                 ;;
18
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
18
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Line 19... Line 19...
19
 
19
 
Line 20... Line 20...
20
$Revision: 1514 $
20
$Revision: 1519 $
21
 
21
 
Line 22... Line 22...
22
__DEBUG_LEVEL_OLD__  equ __DEBUG_LEVEL__
22
__DEBUG_LEVEL_OLD__  equ __DEBUG_LEVEL__
Line 35... Line 35...
35
MAX_EPHEMERAL_PORT equ 61000
35
MAX_EPHEMERAL_PORT equ 61000
Line 36... Line 36...
36
 
36
 
37
; Ethernet protocol numbers
37
; Ethernet protocol numbers
38
ETHER_ARP	equ 0x0608
38
ETHER_ARP		equ 0x0608
-
 
39
ETHER_IPv4		equ 0x0008		; Reversed from 0800 for intel
-
 
40
ETHER_PPP_DISCOVERY	equ 0x6388
Line 39... Line 41...
39
ETHER_IPv4	equ 0x0008		; Reversed from 0800 for intel
41
ETHER_PPP_SESSION	equ 0x6488
40
 
42
 
41
;Protocol family
43
;Protocol family
42
AF_UNSPEC	equ 0
44
AF_UNSPEC	equ 0
Line 74... Line 76...
74
 
76
 
Line 75... Line 77...
75
 
77
 
-
 
78
virtual at 0
-
 
79
 
-
 
80
	NET_DEVICE:
-
 
81
 
-
 
82
	.type		dd ?	; Type field
-
 
83
	.mtu		dd ?	; Maximal Transmission Unit
76
virtual at 0
84
	.name		dd ?	; Ptr to 0 terminated string
-
 
85
 
-
 
86
	.unload 	dd ?	; Ptrs to driver functions
-
 
87
	.reset		dd ?	;
-
 
88
	.transmit	dd ?	;
-
 
89
 
-
 
90
	.bytes_tx	dq ?	; Statistics, updated by the driver
-
 
91
	.bytes_rx	dq ?	;
77
 
92
	.packets_tx	dd ?	;
Line 78... Line 93...
78
	NET_DEVICE:
93
	.packets_rx	dd ?	;
Line 191... Line 206...
191
	mov	eax, [timer_ticks]
206
	mov	eax, [timer_ticks]
192
	cmp	eax, [net_10ms]
207
	cmp	eax, [net_10ms]
193
	je	.exit
208
	je	.exit
194
	mov	[net_10ms], eax
209
	mov	[net_10ms], eax
Line 195... Line -...
195
 
-
 
196
   if ETH_QUEUE
-
 
197
	call	ETH_handler
-
 
198
	call	ETH_send_queued
-
 
199
   end if
-
 
200
	call	TCP_10ms
-
 
201
 
-
 
202
	inc	[net_tmr_count]
-
 
203
	cmp	[net_tmr_count], 50
-
 
204
	je	.500ms
210
 
205
	cmp	[net_tmr_count], 100
211
	test	[net_10ms], 0x0f	; 160ms
Line 206... Line -...
206
	jne	.exit
-
 
207
 
-
 
208
	call	ARP_decrease_entry_ttls
212
	jnz	.exit
Line 209... Line 213...
209
	call	IPv4_decrease_fragment_ttls
213
 
-
 
214
;        call    TCP_timer_160ms
Line 210... Line 215...
210
	call	TCP_timer_1000ms
215
 
211
 
216
	test	[net_10ms], 0x3f	; 640ms
-
 
217
	jnz	.exit
Line 212... Line 218...
212
	mov	[net_tmr_count], 0
218
 
213
 
219
;        call    TCP_timer_640ms
Line 378... Line 384...
378
	shr	edi, 2
384
	shr	edi, 2
Line 379... Line 385...
379
 
385
 
380
	pop	ecx
386
	pop	ecx
Line 381... Line -...
381
	ret
-
 
382
 
-
 
383
 
-
 
384
 
-
 
385
 
-
 
386
;--------------------------
-
 
387
;
-
 
388
; NET_send
-
 
389
;
-
 
390
; IN:   ebx = ptr to device struct
-
 
391
;      [esp] = data ptr
-
 
392
;    [esp + 4] = data size
-
 
393
;
-
 
394
; OUT: /
-
 
395
;
-
 
396
;--------------------------
-
 
397
align 4
-
 
398
NET_send:
-
 
399
 
-
 
400
	call	[ebx + ETH_DEVICE.transmit] ;;;;
-
 
401
 
-
 
402
;;; TODO:check if packet was sent ok
-
 
403
 
-
 
404
	call	kernel_free
-
 
405
	add	esp, 4
-
 
406
	ret
-
 
407
 
-
 
408
 
-
 
409
 
387
	ret
410
 
388
 
411
;-----------------------------------------------------------------
389
;-----------------------------------------------------------------
412
;
390
;
413
; checksum_1
391
; checksum_1
Line 561... Line 539...
561
  @@:
539
  @@:
562
	dec	bl			; 1 = Get device name
540
	dec	bl			; 1 = Get device name
563
	jnz	@f
541
	jnz	@f
Line 564... Line 542...
564
 
542
 
565
	mov	esi, [esi + NET_DRV_LIST]
543
	mov	esi, [esi + NET_DRV_LIST]
566
	mov	esi, [esi + ETH_DEVICE.name]
544
	mov	esi, [esi + NET_DEVICE.name]
Line 567... Line 545...
567
	mov	edi, ecx
545
	mov	edi, ecx
568
 
546
 
Line 576... Line 554...
576
 
554
 
577
	dec	bl			; 2 = Reset the device
555
	dec	bl			; 2 = Reset the device
Line 578... Line 556...
578
	jnz	@f
556
	jnz	@f
579
 
557
 
580
	mov	esi, [esi + NET_DRV_LIST]
558
	mov	esi, [esi + NET_DRV_LIST]
Line 581... Line 559...
581
	call	[esi + ETH_DEVICE.reset]
559
	call	[esi + NET_DEVICE.reset]
Line 582... Line 560...
582
	jmp	.return
560
	jmp	.return
583
 
561
 
Line 584... Line 562...
584
  @@:
562
  @@:
585
 
563
 
586
	dec	bl			; 3 = Stop driver for this device
564
	dec	bl			; 3 = Stop driver for this device
Line 587... Line 565...
587
	jnz	@f
565
	jnz	@f
588
 
566
 
589
	mov	esi, [esi + NET_DRV_LIST]
567
	mov	esi, [esi + NET_DRV_LIST]
Line 643... Line 621...
643
	je	TCP_API
621
	je	TCP_API
Line 644... Line 622...
644
 
622
 
645
	cmp	ax , ETHER_ARP
623
	cmp	ax , ETHER_ARP
Line 646... Line 624...
646
	je	ARP_API
624
	je	ARP_API
647
 
625
 
Line 648... Line 626...
648
	cmp	ax , 1337
626
	cmp	ax , 1337  ;;;;;
Line 649... Line 627...
649
	je	ETH_API
627
	je	ETH_API