Rev 1206 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1206 | Rev 1253 | ||
---|---|---|---|
Line -... | Line 1... | ||
- | 1 | ; |
|
1 | include '../macros.inc' |
2 | ; Netcfg v1.02 |
- | 3 | ; |
|
- | 4 | ; Application to load network drivers in KolibriOS |
|
- | 5 | ; |
|
2 | MEOS_APP_START |
6 | ; By hidnplayr |
- | 7 | ; |
|
- | 8 | ||
- | 9 | use32 |
|
- | 10 | org 0x0 |
|
- | 11 | ||
- | 12 | db 'MENUET01' ; 8 byte id |
|
- | 13 | dd 0x01 ; header version |
|
- | 14 | dd START ; start of code |
|
- | 15 | dd IM_END ; size of image |
|
- | 16 | dd (I_END+0x100) ; memory for app |
|
- | 17 | dd (I_END+0x100) ; esp |
|
- | 18 | dd param, 0x0 ; I_Param , I_Icon |
|
Line 3... | Line 19... | ||
3 | 19 | ||
Line -... | Line 20... | ||
- | 20 | type_ethernet equ 1 |
|
- | 21 | ||
- | 22 | include '../macros.inc' |
|
- | 23 | include 'proc32.inc' |
|
- | 24 | include 'struct.inc' |
|
- | 25 | ||
- | 26 | START: |
|
- | 27 | ; first, check boot parameters |
|
- | 28 | ||
- | 29 | cmp byte[param], 0 |
|
- | 30 | je .noparams |
|
- | 31 | ||
- | 32 | mcall 40, 0 |
|
- | 33 | ||
- | 34 | ||
- | 35 | push exit |
|
- | 36 | cmp byte[param], 'A' ; A for All |
|
- | 37 | je Get_PCI_Info |
|
- | 38 | ||
- | 39 | cmp byte[param], 'F' ; F for First |
|
4 | type_ethernet equ 1 |
40 | je Get_PCI_Info |
- | 41 | ||
- | 42 | ret |
|
5 | 43 | ||
Line 6... | Line 44... | ||
6 | CODE |
44 | .noparams: |
7 | call draw_window |
45 | call draw_window |
8 | 46 | ||
Line 34... | Line 72... | ||
34 | button: ; button |
72 | button: ; button |
35 | mcall 17 ; get id |
73 | mcall 17 ; get id |
Line 36... | Line 74... | ||
36 | 74 | ||
37 | cmp ah, 1 ; button id = 1 ? |
75 | cmp ah, 1 ; button id = 1 ? |
38 | jne @f |
76 | jne @f |
39 | mcall -1 ; close this program |
77 | exit: mcall -1 ; close this program |
40 | @@: |
78 | @@: |
41 | cmp eax,0x0000ff00 |
79 | cmp eax,0x0000ff00 |
Line 42... | Line 80... | ||
42 | jg load_drv |
80 | jg load_drv |
Line 148... | Line 186... | ||
148 | .done: |
186 | .done: |
149 | mcall 12, 2 ; end of draw |
187 | mcall 12, 2 ; end of draw |
150 | ret |
188 | ret |
Line -... | Line 189... | ||
- | 189 | ||
- | 190 | ||
- | 191 | ||
151 | 192 | ||
152 | 193 | ||
153 | ;------------------------------------------------------------------ |
194 | ;------------------------------------------------------------------ |
154 | ;* Gets the PCI Version and Last Bus |
195 | ;* Gets the PCI Version and Last Bus |
155 | Get_PCI_Info: |
196 | Get_PCI_Info: |
Line 204... | Line 245... | ||
204 | ; inc byte [total] ; one more device found |
245 | ; inc byte [total] ; one more device found |
Line 205... | Line 246... | ||
205 | 246 | ||
206 | cmp byte [PCI_Class],2 |
247 | cmp byte [PCI_Class],2 |
Line -... | Line 248... | ||
- | 248 | jne nextDev |
|
- | 249 | ||
- | 250 | cmp byte[param], 0 |
|
207 | jne nextDev |
251 | jne load_and_start |
- | 252 | ||
208 | 253 | call Print_New_Device ; print device info to screen |
|
209 | call Print_New_Device ; print device info to screen |
254 | |
Line 210... | Line 255... | ||
210 | nextDev: |
255 | nextDev: |
211 | add byte [V_Dev], 8 ; lower 3 bits are the function number |
256 | add byte [V_Dev], 8 ; lower 3 bits are the function number |
Line 216... | Line 261... | ||
216 | mov al , byte [PCI_LastBus] ; get last bus |
261 | mov al , byte [PCI_LastBus] ; get last bus |
217 | cmp byte [V_Bus], al ; was it last bus |
262 | cmp byte [V_Bus], al ; was it last bus |
218 | jbe Start_Enum ; if not jump to keep searching |
263 | jbe Start_Enum ; if not jump to keep searching |
219 | ret |
264 | ret |
Line -... | Line 265... | ||
- | 265 | ||
- | 266 | ||
- | 267 | ||
- | 268 | load_and_start: |
|
- | 269 | ||
- | 270 | call get_drv_ptr |
|
- | 271 | cmp eax, lbl_none |
|
- | 272 | je .next |
|
- | 273 | ||
- | 274 | mov ecx, eax |
|
- | 275 | mcall 68, 16 |
|
- | 276 | test eax, eax |
|
- | 277 | jz .next |
|
- | 278 | mov [IOCTL.handle], eax |
|
- | 279 | ||
- | 280 | mov al, [V_Dev] |
|
- | 281 | mov [hardwareinfo.pci_dev], al |
|
- | 282 | mov al, [V_Bus] |
|
- | 283 | mov [hardwareinfo.pci_bus], al |
|
- | 284 | ||
- | 285 | mov [IOCTL.io_code], 1 ; SRV_HOOK |
|
- | 286 | mov [IOCTL.inp_size], 3 |
|
- | 287 | mov [IOCTL.input], hardwareinfo |
|
- | 288 | mov [IOCTL.out_size], 0 |
|
- | 289 | mov [IOCTL.output], 0 |
|
- | 290 | ||
- | 291 | mcall 68, 17, IOCTL |
|
- | 292 | ||
- | 293 | .next: |
|
- | 294 | cmp byte[param], 'A' |
|
- | 295 | je nextDev |
|
- | 296 | jmp exit |
|
- | 297 | ||
- | 298 | ||
220 | 299 | ||
221 | ;------------------------------------------------------------------ |
300 | ;------------------------------------------------------------------ |
222 | ;* Print device info to screen |
301 | ;* Print device info to screen |
Line 223... | Line 302... | ||
223 | Print_New_Device: |
302 | Print_New_Device: |
Line 378... | Line 457... | ||
378 | driverfound: |
457 | driverfound: |
379 | ret |
458 | ret |
Line 380... | Line 459... | ||
380 | 459 | ||
381 | include 'vendors.inc' |
460 | include 'vendors.inc' |
- | 461 | include 'drivers.inc' |
|
- | 462 | ||
382 | include 'drivers.inc' |
463 | |
383 | ;------------------------------------------------------------------ |
464 | ;------------------------------------------------------------------ |
- | 465 | ; DATA AREA |
|
- | 466 | ||
384 | ; DATA AREA |
467 | |
Line 385... | Line 468... | ||
385 | DATA |
468 | DATA |
386 | 469 | ||
Line 391... | Line 474... | ||
391 | dw 100 ; window y start |
474 | dw 100 ; window y start |
Line 392... | Line 475... | ||
392 | 475 | ||
Line 393... | Line 476... | ||
393 | title db 'Network Driver Control Center', 0 |
476 | title db 'Network Driver Control Center', 0 |
394 | - | ||
395 | caption db 'Vendor Device Bus Dev Rev IRQ Company Description DRIVER',0 |
477 | |
396 | ;lbl_1 db 'Hardware control',0 |
478 | caption db 'Vendor Device Bus Dev Rev IRQ Company Description DRIVER',0 |
397 | nonefound db 'No compatible devices were found!',0 |
479 | nonefound db 'No compatible devices were found!',0 |
398 | btn_start db 'Start device',0 |
480 | btn_start db 'Start device',0 |
399 | btn_reset db 'Reset device',0 |
- | |
400 | btn_stop db 'Stop device',0 |
- | |
401 | ;lbl_hdw_addr db 'hardware address:',0 |
481 | btn_reset db 'Reset device',0 |
402 | ;lbl_type db 'type:',0 |
- | |
403 | lbl_none db 'none',0 |
- | |
404 | ;lbl_unknown db 'unknown',0 |
482 | btn_stop db 'Stop device',0 |
Line 405... | Line 483... | ||
405 | ;lbl_ethernet db 'ethernet',0 |
483 | lbl_none db 'none',0 |
406 | load_error db 'Could not load driver!',0 |
484 | load_error db 'Could not load driver!',0 |
407 | 485 | ||
Line -... | Line 486... | ||
- | 486 | devicename db 'test' |
|
- | 487 | rb 64 |
|
- | 488 | db 0 |
|
- | 489 | ||
- | 490 | hardwareinfo: |
|
- | 491 | .type db 1 ; pci |
|
- | 492 | .pci_bus db ? |
|
- | 493 | .pci_dev db ? |
|
- | 494 | ||
- | 495 | ||
- | 496 | IM_END: |
|
Line 408... | Line 497... | ||
408 | devicename db 'test' |
497 | |
409 | rb 64 |
498 | ;------------------------------------------------------------------ |
410 | db 0 |
499 | ; UNINITIALIZED DATA AREA |
411 | 500 | ||
Line 419... | Line 508... | ||
419 | .out_size dd ? |
508 | .out_size dd ? |
Line 420... | Line 509... | ||
420 | 509 | ||
421 | drivernumber db ? |
510 | drivernumber db ? |
Line 422... | Line -... | ||
422 | MAC dp ? |
- | |
423 | - | ||
424 | hardwareinfo: |
- | |
425 | .type db 1 ; pci |
- | |
426 | .pci_bus db ? |
- | |
427 | .pci_dev db ? |
- | |
428 | - | ||
429 | - | ||
430 | ;------------------------------------------------------------------ |
- | |
Line 431... | Line 511... | ||
431 | ; UNINITIALIZED DATA AREA |
511 | MAC dp ? |
432 | UDATA |
512 | |
433 | 513 | ||
434 | type db ? |
514 | type db ? |
Line 448... | Line 528... | ||
448 | PCI_Interface db ? |
528 | PCI_Interface db ? |
449 | PCI_IRQ db ? |
529 | PCI_IRQ db ? |
Line 450... | Line 530... | ||
450 | 530 | ||
Line -... | Line 531... | ||
- | 531 | Proc_Info process_information |
|
- | 532 | ||
Line 451... | Line -... | ||
451 | Proc_Info process_information |
- | |
452 | 533 | param rb 1024 |
|
- | 534 | ||
453 | 535 |