Rev 1377 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1377 | Rev 1514 | ||
---|---|---|---|
Line 21... | Line 21... | ||
21 | ;; Updates: ;; |
21 | ;; Updates: ;; |
22 | ;; Revision Look up table and SIS635 Mac Address by Jarek Pelczar ;; |
22 | ;; Revision Look up table and SIS635 Mac Address by Jarek Pelczar ;; |
23 | ;; ;; |
23 | ;; ;; |
24 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
24 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
Line 25... | Line 25... | ||
25 | 25 | ||
Line 26... | Line 26... | ||
26 | ; $Revision: 1377 $ |
26 | ; $Revision: 1514 $ |
Line 27... | Line 27... | ||
27 | 27 | ||
Line 34... | Line 34... | ||
34 | __DEBUG_LEVEL__ equ 1 |
34 | __DEBUG_LEVEL__ equ 1 |
Line 35... | Line 35... | ||
35 | 35 | ||
36 | include 'proc32.inc' |
36 | include 'proc32.inc' |
37 | include 'imports.inc' |
37 | include 'imports.inc' |
- | 38 | include 'fdo.inc' |
|
Line 38... | Line 39... | ||
38 | include 'fdo.inc' |
39 | include 'netdrv.inc' |
39 | 40 | ||
Line 40... | Line -... | ||
40 | public START |
- | |
41 | public version |
- | |
42 | - | ||
43 | struc IOCTL { |
- | |
44 | .handle dd ? |
- | |
45 | .io_code dd ? |
- | |
46 | .input dd ? |
- | |
47 | .inp_size dd ? |
- | |
48 | .output dd ? |
- | |
49 | .out_size dd ? |
- | |
50 | } |
- | |
51 | - | ||
52 | virtual at 0 |
- | |
53 | IOCTL IOCTL |
41 | public START |
54 | end virtual |
42 | public version |
55 | 43 | ||
56 | NUM_RX_DESC equ 4 ;* Number of RX descriptors * |
44 | NUM_RX_DESC equ 4 ;* Number of RX descriptors * |
57 | NUM_TX_DESC equ 1 ;* Number of TX descriptors * |
45 | NUM_TX_DESC equ 1 ;* Number of TX descriptors * |
Line 58... | Line 46... | ||
58 | RX_BUFF_SZ equ 1520 ;* Buffer size for each Rx buffer * |
46 | RX_BUFF_SZ equ 1520 ;* Buffer size for each Rx buffer * |
Line 59... | Line -... | ||
59 | TX_BUFF_SZ equ 1516 ;* Buffer size for each Tx buffer * |
- | |
60 | MAX_ETH_FRAME_SIZE equ 1516 |
- | |
61 | 47 | TX_BUFF_SZ equ 1516 ;* Buffer size for each Tx buffer * |
|
62 | TOTAL_BUFFERS_SIZE equ NUM_RX_DESC*RX_BUFF_SZ + NUM_TX_DESC*TX_BUFF_SZ |
- | |
63 | - | ||
64 | struc ETH_DEVICE { |
- | |
65 | ; pointers to procedures |
- | |
66 | .unload dd ? |
- | |
67 | .reset dd ? |
- | |
68 | .transmit dd ? |
48 | MAX_ETH_FRAME_SIZE equ 1516 |
69 | .set_MAC dd ? |
- | |
70 | .get_MAC dd ? |
- | |
71 | .set_mode dd ? |
- | |
72 | .get_mode dd ? |
- | |
73 | ; status & variables |
- | |
74 | .bytes_tx dq ? |
- | |
- | 49 | ||
75 | .bytes_rx dq ? |
50 | TOTAL_BUFFERS_SIZE equ NUM_RX_DESC*RX_BUFF_SZ + NUM_TX_DESC*TX_BUFF_SZ |
- | 51 | ||
76 | .packets_tx dd ? |
52 | virtual at 0 |
77 | .packets_rx dd ? |
53 | device: |
78 | .mode dd ? ; This dword contains cable status (10mbit/100mbit, full/half duplex, auto negotiation or not,..) |
54 | |
79 | .name dd ? |
55 | ETH_DEVICE |
80 | .mac dp ? |
56 | |
Line 89... | Line 65... | ||
89 | align 4 |
65 | align 4 |
90 | .special_func: dd 0 |
66 | .special_func: dd 0 |
91 | .txd: times (3 * NUM_TX_DESC) dd 0 |
67 | .txd: times (3 * NUM_TX_DESC) dd 0 |
92 | .rxd: times (3 * NUM_RX_DESC) dd 0 |
68 | .rxd: times (3 * NUM_RX_DESC) dd 0 |
93 | .size: |
69 | .size: |
94 | } |
70 | end virtual |
Line 95... | Line 71... | ||
95 | 71 | ||
96 | ; First page is designated to ETH_DEVICE, buffers start from second |
72 | ; First page is designated to ETH_DEVICE, buffers start from second |
97 | ALLOCATION_SIZE = ((device.size+0FFFh) and not 0FFFh) + TOTAL_BUFFERS_SIZE |
73 | ALLOCATION_SIZE = ((device.size+0FFFh) and not 0FFFh) + TOTAL_BUFFERS_SIZE |
98 | ; Note that buffers must be contiguous in the physical memory; |
74 | ; Note that buffers must be contiguous in the physical memory; |
99 | ; because KernelAlloc allocates contiguous physical pages only in 8-pages blocks, |
75 | ; because KernelAlloc allocates contiguous physical pages only in 8-pages blocks, |
100 | ; align ALLOCATION_SIZE up to 8*(page size) = 8000h |
76 | ; align ALLOCATION_SIZE up to 8*(page size) = 8000h |
Line 101... | Line 77... | ||
101 | ALLOCATION_SIZE = (ALLOCATION_SIZE + 7FFFh) and not 7FFFh |
77 | ALLOCATION_SIZE = (ALLOCATION_SIZE + 7FFFh) and not 7FFFh |
Line 102... | Line -... | ||
102 | - | ||
103 | MAX_DEVICES = 16 ; maximum number of devices which this driver can handle |
- | |
104 | - | ||
Line 105... | Line 78... | ||
105 | virtual at 0 |
78 | |
106 | device ETH_DEVICE |
79 | MAX_DEVICES = 16 ; maximum number of devices which this driver can handle |
107 | end virtual |
80 | |
108 | 81 | ||
Line 236... | Line 209... | ||
236 | call SIS900_probe |
209 | call SIS900_probe |
237 | test eax, eax |
210 | test eax, eax |
238 | jnz .destroy |
211 | jnz .destroy |
239 | ; 4n. If device was successfully initialized, register it for the kernel. |
212 | ; 4n. If device was successfully initialized, register it for the kernel. |
Line -... | Line 213... | ||
- | 213 | ||
240 | 214 | mov [device.type], NET_TYPE_ETH |
|
- | 215 | call NetRegDev |
|
241 | call EthRegDev |
216 | |
242 | cmp eax, -1 |
217 | cmp eax, -1 |
Line 243... | Line 218... | ||
243 | je .destroy |
218 | je .destroy |
Line 244... | Line 219... | ||
244 | 219 | ||
Line 245... | Line 220... | ||
245 | ret 4 |
220 | ret 4 |
246 | 221 | ||
247 | ; 5. If the device was already loaded, find the device number and return it in eax |
222 | ; 5. If the device was already loaded, find the device number and return it in eax |
248 | 223 | ||
249 | .find_devicenum: |
224 | .find_devicenum: |
250 | mov ebx, eax |
225 | mov ebx, eax |
Line 251... | Line 226... | ||
251 | call EthStruc2Dev ; This kernel procedure converts a pointer to device struct in ebx |
226 | call NetPtrToNum ; This kernel procedure converts a pointer to device struct in ebx |