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 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: 1514 $ |
- | |
18 | - | ||
Line 19... | Line 17... | ||
19 | ETH_QUEUE_SIZE equ 16 |
17 | $Revision: 1519 $ |
20 | 18 | ||
21 | struct ETH_FRAME |
19 | struct ETH_FRAME |
22 | .DstMAC dp ? ; destination MAC-address |
20 | .DstMAC dp ? ; destination MAC-address |
Line 26... | Line 24... | ||
26 | ends |
24 | ends |
Line 27... | Line 25... | ||
27 | 25 | ||
Line 28... | Line 26... | ||
28 | virtual at NET_DEVICE.end |
26 | virtual at NET_DEVICE.end |
29 | - | ||
30 | ETH_DEVICE: |
27 | |
31 | .unload dd ? |
- | |
32 | .reset dd ? |
- | |
33 | .transmit dd ? |
- | |
34 | .set_MAC dd ? |
28 | ETH_DEVICE: |
35 | .get_MAC dd ? |
29 | |
Line 36... | Line -... | ||
36 | .set_mode dd ? |
- | |
37 | .get_mode dd ? |
- | |
38 | 30 | .set_mode dd ? |
|
39 | .bytes_tx dq ? |
31 | .get_mode dd ? |
- | 32 | ||
40 | .bytes_rx dq ? |
33 | .set_MAC dd ? |
41 | .packets_tx dd ? |
- | |
42 | .packets_rx dd ? |
34 | .get_MAC dd ? |
Line 43... | Line 35... | ||
43 | .mode dd ? |
35 | |
Line 44... | Line 36... | ||
44 | .name dd ? |
36 | .mode dd ? |
Line 106... | Line 98... | ||
106 | je IPv4_handler |
98 | je IPv4_handler |
Line 107... | Line 99... | ||
107 | 99 | ||
108 | cmp ax, ETHER_ARP |
100 | cmp ax, ETHER_ARP |
Line -... | Line 101... | ||
- | 101 | je ARP_handler |
|
- | 102 | ||
- | 103 | ; cmp ax, ETHER_PPP_DISCOVERY |
|
109 | je ARP_handler |
104 | ; je PPPOE_discovery |
Line 110... | Line 105... | ||
110 | 105 | ||
111 | DEBUGF 2,"Unknown ethernet packet type %x\n", ax |
106 | DEBUGF 2,"Unknown ethernet packet type %x\n", ax |
112 | 107 | ||
Line 136... | Line 131... | ||
136 | align 4 |
131 | align 4 |
137 | ETH_create_packet: |
132 | ETH_create_packet: |
Line 138... | Line 133... | ||
138 | 133 | ||
Line -... | Line 134... | ||
- | 134 | DEBUGF 1,"Creating Ethernet Packet (size=%u): \n", ecx |
|
- | 135 | ||
139 | DEBUGF 1,"Creating Ethernet Packet (size=%u): \n", ecx |
136 | push esi |
- | 137 | mov esi, [NET_DRV_LIST] ;;; TODO: FIXME |
|
140 | 138 | cmp ecx, [esi + NET_DEVICE.mtu] |
|
Line 141... | Line 139... | ||
141 | cmp ecx, 1500 ;;; |
139 | pop esi |
Line 142... | Line 140... | ||
142 | jg .exit |
140 | jg .exit |
Line 169... | Line 167... | ||
169 | 167 | ||
170 | xor ebx, ebx ;;;; TODO: Fixme |
168 | xor ebx, ebx ;;;; TODO: Fixme |
Line 171... | Line 169... | ||
171 | mov ebx, [NET_DRV_LIST + ebx] |
169 | mov ebx, [NET_DRV_LIST + ebx] |
172 | 170 | ||
173 | cmp edx, 46 + ETH_FRAME.Data ; If data size is less then 46, add padding bytes |
171 | cmp edx, 46 + ETH_FRAME.Data ; If data size is less then 46, add padding bytes |
174 | jg .continue |
172 | jge .continue |
Line 175... | Line 173... | ||
175 | mov edx, 46 + ETH_FRAME.Data |
173 | mov edx, 46 + ETH_FRAME.Data |
176 | .continue: |
174 | .continue: |
Line 238... | Line 236... | ||
238 | DEBUGF 2,"Device is not ethernet type\n" |
236 | DEBUGF 2,"Device is not ethernet type\n" |
239 | or eax, -1 |
237 | or eax, -1 |
240 | ret |
238 | ret |
Line 241... | Line 239... | ||
241 | 239 | ||
242 | .packets_tx: |
240 | .packets_tx: |
Line 243... | Line 241... | ||
243 | mov eax, dword [eax + ETH_DEVICE.packets_tx] |
241 | mov eax, dword [eax + NET_DEVICE.packets_tx] |
Line 244... | Line 242... | ||
244 | 242 | ||
245 | ret |
243 | ret |
246 | 244 | ||
Line 247... | Line 245... | ||
247 | .packets_rx: |
245 | .packets_rx: |
248 | mov eax, dword [eax + ETH_DEVICE.packets_rx] |
246 | mov eax, dword [eax + NET_DEVICE.packets_rx] |
249 | ret |
247 | ret |
250 | 248 | ||
251 | .bytes_tx: |
249 | .bytes_tx: |
Line 252... | Line 250... | ||
252 | mov ebx, dword [eax + ETH_DEVICE.bytes_tx + 4] |
250 | mov ebx, dword [eax + NET_DEVICE.bytes_tx + 4] |
253 | mov eax, dword [eax + ETH_DEVICE.bytes_tx] |
251 | mov eax, dword [eax + NET_DEVICE.bytes_tx] |
254 | mov [esp+20+4], ebx ; TODO: fix this ugly code |
252 | mov [esp+20+4], ebx ; TODO: fix this ugly code |
255 | ret |
253 | ret |
256 | 254 | ||
Line 257... | Line 255... | ||
257 | .bytes_rx: |
255 | .bytes_rx: |
Line 268... | Line 266... | ||
268 | ret |
266 | ret |
Line 269... | Line 267... | ||
269 | 267 | ||
270 | .write_mac: |
268 | .write_mac: |
271 | push ecx |
269 | push ecx |
272 | push dx |
270 | push dx |
273 | mov eax, [eax + ETH_DEVICE.set_MAC] |
- | |
274 | call eax |
271 | call [eax + ETH_DEVICE.set_MAC] |
Line 275... | Line 272... | ||
275 | ret |
272 | ret |
276 | 273 | ||
277 | .in_queue: |
274 | .in_queue: |