Subversion Repositories Kolibri OS

Rev

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

Rev 4467 Rev 4470
Line 325... Line 325...
325
        cmp [state], 1
325
        cmp [state], 1
326
        jne .exit
326
        jne .exit
Line 327... Line 327...
327
 
327
 
Line 328... Line 328...
328
  .entry:
328
  .entry:
329
 
329
 
330
        DEBUGF  2,"Loading %s driver\n", my_service
330
        DEBUGF  2,"Loading driver\n"
Line 331... Line 331...
331
        stdcall RegService, my_service, service_proc
331
        stdcall RegService, my_service, service_proc
332
        ret
332
        ret
Line 348... Line 348...
348
 
348
 
349
align 4
349
align 4
Line 350... Line 350...
350
proc service_proc stdcall, ioctl:dword
350
proc service_proc stdcall, ioctl:dword
351
 
351
 
Line 352... Line 352...
352
        mov     edx, [ioctl]
352
        mov     edx, [ioctl]
Line 353... Line 353...
353
        mov     eax, [IOCTL.io_code]
353
        mov     eax, [edx + IOCTL.io_code]
354
 
354
 
Line 355... Line 355...
355
;------------------------------------------------------
355
;------------------------------------------------------
356
 
356
 
357
        cmp     eax, 0 ;SRV_GETVERSION
357
        cmp     eax, 0 ;SRV_GETVERSION
358
        jne     @F
358
        jne     @F
Line 359... Line 359...
359
 
359
 
360
        cmp     [IOCTL.out_size], 4
360
        cmp     [edx + IOCTL.out_size], 4
Line 361... Line 361...
361
        jb      .fail
361
        jb      .fail
362
        mov     eax, [IOCTL.output]
362
        mov     eax, [edx + IOCTL.output]
363
        mov     [eax], dword API_VERSION
363
        mov     [eax], dword API_VERSION
364
 
364
 
Line 365... Line 365...
365
        xor     eax, eax
365
        xor     eax, eax
366
        ret
366
        ret
Line 367... Line 367...
367
 
367
 
368
;------------------------------------------------------
368
;------------------------------------------------------
369
  @@:
369
  @@:
Line 370... Line 370...
370
        cmp     eax, 1 ;SRV_HOOK
370
        cmp     eax, 1 ;SRV_HOOK
Line 371... Line 371...
371
        jne     .fail
371
        jne     .fail
372
 
372
 
373
        cmp     [IOCTL.inp_size], 3                     ; Data input must be at least 3 bytes
373
        cmp     [edx + IOCTL.inp_size], 3               ; Data input must be at least 3 bytes
374
        jb      .fail
374
        jb      .fail
Line 375... Line 375...
375
 
375
 
376
        mov     eax, [IOCTL.input]
376
        mov     eax, [edx + IOCTL.input]
377
        cmp     byte [eax], 1                           ; 1 means device number and bus number (pci) are given
377
        cmp     byte [eax], 1                           ; 1 means device number and bus number (pci) are given
378
        jne     .fail                                   ; other types arent supported for this card yet
378
        jne     .fail                                   ; other types arent supported for this card yet
379
 
379
 
380
; check if the device is already listed
380
; check if the device is already listed
Line 411... Line 411...
411
        mov     [device.unload], unload
411
        mov     [device.unload], unload
412
        mov     [device.name], my_service
412
        mov     [device.name], my_service
Line 413... Line 413...
413
 
413
 
Line 414... Line 414...
414
; save the pci bus and device numbers
414
; save the pci bus and device numbers
415
 
415
 
416
        mov     eax, [IOCTL.input]
416
        mov     eax, [edx + IOCTL.input]
417
        movzx   ecx, byte[eax+1]
417
        movzx   ecx, byte[eax+1]
418
        mov     [device.pci_bus], ecx
418
        mov     [device.pci_bus], ecx
Line 512... Line 512...
512
;
512
;
513
;-------
513
;-------
514
align 4
514
align 4
515
probe:
515
probe:
Line 516... Line 516...
516
 
516
 
Line 517... Line 517...
517
        DEBUGF  2,"Probing mtd80x device\n"
517
        DEBUGF  2,"Probing device\n"
Line 518... Line 518...
518
 
518
 
Line 633... Line 633...
633
;
633
;
634
;-------
634
;-------
635
align 4
635
align 4
636
reset:
636
reset:
Line 637... Line 637...
637
 
637
 
Line 638... Line 638...
638
        DEBUGF  1,"Resetting mtd80x\n"
638
        DEBUGF  1,"Resetting\n"
639
 
639
 
Line 640... Line 640...
640
;--------------------------------
640
;--------------------------------
641
; insert irq handler on given irq
641
; insert irq handler on given irq
642
 
642
 
643
        movzx   eax, [device.irq_line]
643
        movzx   eax, [device.irq_line]
644
        DEBUGF  1,"Attaching int handler to irq %x\n", eax:1
644
        DEBUGF  1,"Attaching int handler to irq %x\n", eax:1
645
        stdcall AttachIntHandler, eax, int_handler, dword 0
645
        stdcall AttachIntHandler, eax, int_handler, dword 0
646
        test    eax, eax
646
        test    eax, eax
647
        jnz     @f
647
        jnz     @f
648
        DEBUGF  1,"\nCould not attach int handler!\n"
648
        DEBUGF  1,"Could not attach int handler!\n"
Line 649... Line 649...
649
;        or      eax, -1
649
;        or      eax, -1
Line 1103... Line 1103...
1103
align 4
1103
align 4
1104
int_handler:
1104
int_handler:
Line 1105... Line 1105...
1105
 
1105
 
Line 1106... Line 1106...
1106
        push    ebx esi edi
1106
        push    ebx esi edi
Line 1107... Line 1107...
1107
 
1107
 
Line 1108... Line 1108...
1108
        DEBUGF  1,"\n%s int\n", my_service
1108
        DEBUGF  1,"int\n"
1109
 
1109
 
Line 1132... Line 1132...
1132
 
1132
 
Line 1133... Line 1133...
1133
        ret                                             ; If no device was found, abort (The irq was probably for a device, not registered to this driver)
1133
        ret                                             ; If no device was found, abort (The irq was probably for a device, not registered to this driver)
Line 1134... Line 1134...
1134
 
1134
 
Line 1135... Line 1135...
1135
  .got_it:
1135
  .got_it:
1136
 
1136
 
Line 1137... Line 1137...
1137
        DEBUGF  1,"Device: %x Status: %x ", ebx, ax
1137
        DEBUGF  1,"Device: %x Status: %x\n", ebx, ax