Subversion Repositories Kolibri OS

Rev

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

Rev 3619 Rev 3856
Line 23... Line 23...
23
 
23
 
Line 24... Line 24...
24
        MAX_DEVICES             = 16
24
        MAX_DEVICES             = 16
25
 
25
 
26
        DEBUG                   = 1
26
        DEBUG                   = 1
Line 27... Line 27...
27
        __DEBUG__               = 1
27
        __DEBUG__               = 1
28
        __DEBUG_LEVEL__         = 2
28
        __DEBUG_LEVEL__         = 2             ; 1 = verbose, 2 = errors only
29
 
29
 
30
include '../proc32.inc'
30
include '../proc32.inc'
Line 167... Line 167...
167
proc START stdcall, state:dword
167
proc START stdcall, state:dword
Line 168... Line 168...
168
 
168
 
169
        cmp     [state], 1
169
        cmp     [state], 1
170
        jne     .exit
170
        jne     .exit
171
  .entry:
171
  .entry:
172
        DEBUGF  2,"Registering %s driver\n", my_service
172
        DEBUGF  1, "Loading driver\n"
173
        stdcall RegService, my_service, service_proc
173
        stdcall RegService, my_service, service_proc
174
        ret
174
        ret
175
  .fail:
175
  .fail:
176
  .exit:
176
  .exit:
Line 294... Line 294...
294
        mov     cl, [eax+3]
294
        mov     cl, [eax+3]
295
        mov     [device.irq_line], cl
295
        mov     [device.irq_line], cl
Line 296... Line 296...
296
 
296
 
Line 297... Line 297...
297
  .hook:
297
  .hook:
298
 
298
 
Line 299... Line 299...
299
        DEBUGF  2,"Hooking into device, dev:%x, bus:%x, irq:%x, addr:%x\n",\
299
        DEBUGF  1, "Hooking into device, dev:%x, bus:%x, irq:%x, addr:%x\n",\
300
        [device.pci_dev]:1,[device.pci_bus]:1,[device.irq_line]:1,[device.io_addr]:4
300
        [device.pci_dev]:1,[device.pci_bus]:1,[device.irq_line]:1,[device.io_addr]:4
301
 
301
 
Line 324... Line 324...
324
        mov     eax, edi                                                ; Application wants it in eax instead
324
        mov     eax, edi                                                ; Application wants it in eax instead
325
        DEBUGF  1,"Kernel says: %u\n", eax
325
        DEBUGF  1, "Kernel says: %u\n", eax
326
        ret
326
        ret
Line 327... Line 327...
327
 
327
 
328
  .err:
328
  .err:
329
        DEBUGF  1,"Failed, removing device structure\n"
329
        DEBUGF  2, "Failed, removing device structure\n"
Line 330... Line 330...
330
        stdcall KernelFree, ebx
330
        stdcall KernelFree, ebx
Line 331... Line 331...
331
 
331
 
Line 392... Line 392...
392
 
392
 
393
probe:
393
probe:
394
        mov     [device.vendor], VENDOR_NONE
394
        mov     [device.vendor], VENDOR_NONE
Line 395... Line 395...
395
        mov     [device.bmem], 0
395
        mov     [device.bmem], 0
Line 396... Line 396...
396
 
396
 
397
        DEBUGF  2,"Trying 16-bit mode\n"
397
        DEBUGF  1, "Trying 16-bit mode\n"
398
 
398
 
399
        mov     [device.flags], FLAG_16BIT + FLAG_PIO
399
        mov     [device.flags], FLAG_16BIT + FLAG_PIO
Line 430... Line 430...
430
        mov     edi, my_service
430
        mov     edi, my_service
431
        mov     ecx, 13
431
        mov     ecx, 13
432
        repe    cmpsb
432
        repe    cmpsb
433
        je      ep_set_vendor
433
        je      ep_set_vendor
Line 434... Line 434...
434
 
434
 
435
        DEBUGF  2,"16-bit mode failed\n"
435
        DEBUGF  1, "16-bit mode failed\n"
Line 436... Line 436...
436
        DEBUGF  2,"Trying 8-bit mode\n"
436
        DEBUGF  1, "Trying 8-bit mode\n"
437
 
437
 
438
        mov     [device.flags], FLAG_PIO
438
        mov     [device.flags], FLAG_PIO
439
        mov     [device.memsize], MEM_16k
439
        mov     [device.memsize], MEM_16k
Line 489... Line 489...
489
        ret
489
        ret
Line 490... Line 490...
490
 
490
 
Line 491... Line 491...
491
 
491
 
Line 492... Line 492...
492
ep_set_vendor:
492
ep_set_vendor:
493
 
493
 
Line 494... Line 494...
494
        DEBUGF  2,"Mode ok\n"
494
        DEBUGF  1, "Mode ok\n"
Line 495... Line 495...
495
 
495
 
496
        cmp     [device.io_addr], ISA_MAX_ADDR
496
        cmp     [device.io_addr], ISA_MAX_ADDR
Line 497... Line 497...
497
        jbe     .isa
497
        jbe     .isa
498
 
498
 
Line 499... Line 499...
499
        DEBUGF  2,"Card is using PCI bus\n"
499
        DEBUGF  1, "Card is using PCI bus\n"
Line 500... Line 500...
500
 
500
 
Line 524... Line 524...
524
;;   reset: Place the chip into a virgin state
524
;;   reset: Place the chip into a virgin state
525
;;
525
;;
526
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
526
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Line 527... Line 527...
527
 
527
 
528
reset:
528
reset:
Line 529... Line 529...
529
        DEBUGF  2,"Resetting device\n"
529
        DEBUGF  1, "Resetting device\n"
530
 
530
 
531
; attach int handler
531
; attach int handler
532
        movzx   eax, [device.irq_line]
532
        movzx   eax, [device.irq_line]
-
 
533
        DEBUGF  1, "Attaching int handler to irq %x\n", eax:1
-
 
534
        stdcall AttachIntHandler, eax, int_handler, dword 0
-
 
535
        test    eax, eax
-
 
536
        jnz     @f
-
 
537
        DEBUGF  2, "Could not attach int handler!\n"
-
 
538
;        or      eax, -1
Line 533... Line 539...
533
        DEBUGF  1,"Attaching int handler to irq %x\n", eax:1
539
;        ret
534
        stdcall AttachIntHandler, eax, int_handler, dword 0
540
       @@:
535
 
541
 
536
; Stop card + DMA
542
; Stop card + DMA
Line 739... Line 745...
739
align 4
745
align 4
740
int_handler:
746
int_handler:
Line 741... Line 747...
741
 
747
 
Line 742... Line 748...
742
        push    ebx esi edi
748
        push    ebx esi edi
Line 743... Line 749...
743
 
749
 
Line 744... Line 750...
744
        DEBUGF  1,"\n%s int\n", my_service
750
        DEBUGF  1, "INT\n"
745
 
751