Subversion Repositories Kolibri OS

Rev

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

Rev 2301 Rev 2305
Line 12... Line 12...
12
;;          GNU GENERAL PUBLIC LICENSE                             ;;
12
;;          GNU GENERAL PUBLIC LICENSE                             ;;
13
;;             Version 2, June 1991                                ;;
13
;;             Version 2, June 1991                                ;;
14
;;                                                                 ;;
14
;;                                                                 ;;
15
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
15
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Line 16... Line 16...
16
 
16
 
-
 
17
$Revision: 2305 $
-
 
18
 
-
 
19
struct	ETH_header
-
 
20
 
-
 
21
	DstMAC		dp  ?  ; destination MAC-address
-
 
22
	SrcMAC		dp  ?  ; source MAC-address
Line 17... Line -...
17
$Revision: 2301 $
-
 
18
 
-
 
19
struct	ETH_FRAME
-
 
20
	.DstMAC 	dp  ?  ; destination MAC-address
-
 
21
	.SrcMAC 	dp  ?  ; source MAC-address
-
 
22
	.Type		dw  ?  ; type of the upper-layer protocol
23
	Type		dw  ?  ; type of the upper-layer protocol
Line 23... Line 24...
23
	.Data:		       ; data (46-1500 bytes for a normal packet)
24
 
Line 24... Line 25...
24
ends
25
ends
Line -... Line 26...
-
 
26
 
25
 
27
ETH_FRAME_MINIMUM	equ 60
Line 26... Line 28...
26
ETH_FRAME_MINIMUM	equ 60
28
 
27
 
29
struct	ETH_DEVICE	NET_DEVICE
Line 28... Line 30...
28
virtual at NET_DEVICE.end
30
 
29
 
31
	set_mode	dd ?
Line 30... Line -...
30
	ETH_DEVICE:
-
 
31
 
-
 
32
	.set_mode	dd ?
-
 
33
	.get_mode	dd ?
32
	get_mode	dd ?
Line 34... Line 33...
34
 
33
 
35
	.set_MAC	dd ?
34
	set_MAC 	dd ?
Line 36... Line 35...
36
	.get_MAC	dd ?
35
	get_MAC 	dd ?
Line 65... Line 64...
65
	mov	ecx, [esp+4]
64
	mov	ecx, [esp+4]
Line 66... Line 65...
66
 
65
 
67
	DEBUGF	1,"ETH_input - size: %u\n", ecx
66
	DEBUGF	1,"ETH_input - size: %u\n", ecx
68
	cmp	ecx, ETH_FRAME_MINIMUM
67
	cmp	ecx, ETH_FRAME_MINIMUM
69
	jb	.dump
68
	jb	.dump
Line 70... Line 69...
70
	sub	ecx, ETH_FRAME.Data
69
	sub	ecx, sizeof.ETH_header
71
 
70
 
Line 72... Line 71...
72
	lea	edx, [eax + ETH_FRAME.Data]
71
	lea	edx, [eax + sizeof.ETH_header]
73
	mov	ax , [eax + ETH_FRAME.Type]
72
	mov	ax , [eax + ETH_header.Type]
Line 74... Line 73...
74
 
73
 
Line 114... Line 113...
114
	cmp	ecx, [ebx + NET_DEVICE.mtu]
113
	cmp	ecx, [ebx + NET_DEVICE.mtu]
115
	ja	.exit
114
	ja	.exit
Line 116... Line 115...
116
 
115
 
117
	push	ecx			; << 1
116
	push	ecx			; << 1
118
	push	di eax edx		; << 2
117
	push	di eax edx		; << 2
Line 119... Line 118...
119
	add	ecx, ETH_FRAME.Data
118
	add	ecx, sizeof.ETH_header
Line 120... Line 119...
120
 
119
 
121
	push	ecx			; << 3
120
	push	ecx			; << 3
Line 135... Line 134...
135
	movsd
134
	movsd
136
	movsw
135
	movsw
137
	pop	ax			; >> 2
136
	pop	ax			; >> 2
138
	stosw
137
	stosw
Line 139... Line 138...
139
 
138
 
140
	lea	eax, [edi - ETH_FRAME.Data]  ; Set eax to buffer start
139
	lea	eax, [edi - sizeof.ETH_header]	; Set eax to buffer start
Line 141... Line 140...
141
	mov	edx, ecx		     ; Set edx to complete buffer size
140
	mov	edx, ecx			; Set edx to complete buffer size
Line 142... Line 141...
142
 
141
 
Line 208... Line 207...
208
	DEBUGF	2,"Device is not ethernet type\n"
207
	DEBUGF	2,"Device is not ethernet type\n"
209
	or	eax, -1
208
	or	eax, -1
210
	ret
209
	ret
Line 211... Line 210...
211
 
210
 
212
.packets_tx:
211
.packets_tx:
Line 213... Line 212...
213
	mov	eax, dword [eax + NET_DEVICE.packets_tx]
212
	mov	eax, [eax + NET_DEVICE.packets_tx]
Line 214... Line 213...
214
 
213
 
215
	ret
214
	ret
216
 
215
 
Line 217... Line 216...
217
.packets_rx:
216
.packets_rx:
218
	mov	eax, dword [eax + NET_DEVICE.packets_rx]
217
	mov	eax, [eax + NET_DEVICE.packets_rx]
219
	ret
218
	ret