Subversion Repositories Kolibri OS

Rev

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

Rev 4467 Rev 4470
Line 553... Line 553...
553
        cmp [state], 1
553
        cmp [state], 1
554
        jne .exit
554
        jne .exit
Line 555... Line 555...
555
 
555
 
Line 556... Line 556...
556
  .entry:
556
  .entry:
557
 
557
 
558
        DEBUGF  2,"Loading %s driver\n", my_service
558
        DEBUGF  2,"Loading driver\n"
Line 559... Line 559...
559
        stdcall RegService, my_service, service_proc
559
        stdcall RegService, my_service, service_proc
560
        ret
560
        ret
Line 576... Line 576...
576
 
576
 
577
align 4
577
align 4
Line 578... Line 578...
578
proc service_proc stdcall, ioctl:dword
578
proc service_proc stdcall, ioctl:dword
579
 
579
 
Line 580... Line 580...
580
        mov     edx, [ioctl]
580
        mov     edx, [ioctl]
Line 581... Line 581...
581
        mov     eax, [IOCTL.io_code]
581
        mov     eax, [edx + IOCTL.io_code]
582
 
582
 
Line 583... Line 583...
583
;------------------------------------------------------
583
;------------------------------------------------------
584
 
584
 
585
        cmp     eax, 0 ;SRV_GETVERSION
585
        cmp     eax, 0 ;SRV_GETVERSION
586
        jne     @F
586
        jne     @F
Line 587... Line 587...
587
 
587
 
588
        cmp     [IOCTL.out_size], 4
588
        cmp     [edx + IOCTL.out_size], 4
Line 589... Line 589...
589
        jb      .fail
589
        jb      .fail
590
        mov     eax, [IOCTL.output]
590
        mov     eax, [edx + IOCTL.output]
591
        mov     [eax], dword API_VERSION
591
        mov     [eax], dword API_VERSION
592
 
592
 
Line 593... Line 593...
593
        xor     eax, eax
593
        xor     eax, eax
594
        ret
594
        ret
Line 595... Line 595...
595
 
595
 
596
;------------------------------------------------------
596
;------------------------------------------------------
597
  @@:
597
  @@:
Line 598... Line 598...
598
        cmp     eax, 1 ;SRV_HOOK
598
        cmp     eax, 1 ;SRV_HOOK
Line 599... Line 599...
599
        jne     .fail
599
        jne     .fail
600
 
600
 
601
        cmp     [IOCTL.inp_size], 3                     ; Data input must be at least 3 bytes
601
        cmp     [edx + IOCTL.inp_size], 3               ; Data input must be at least 3 bytes
602
        jb      .fail
602
        jb      .fail
Line 603... Line 603...
603
 
603
 
604
        mov     eax, [IOCTL.input]
604
        mov     eax, [edx + IOCTL.input]
605
        cmp     byte [eax], 1                           ; 1 means device number and bus number (pci) are given
605
        cmp     byte [eax], 1                           ; 1 means device number and bus number (pci) are given
606
        jne     .fail                                   ; other types arent supported for this card yet
606
        jne     .fail                                   ; other types arent supported for this card yet
607
 
607
 
608
; check if the device is already listed
608
; check if the device is already listed
Line 639... Line 639...
639
        mov     [device.unload], unload
639
        mov     [device.unload], unload
640
        mov     [device.name], my_service
640
        mov     [device.name], my_service
Line 641... Line 641...
641
 
641
 
Line 642... Line 642...
642
; save the pci bus and device numbers
642
; save the pci bus and device numbers
643
 
643
 
644
        mov     eax, [IOCTL.input]
644
        mov     eax, [edx + IOCTL.input]
645
        movzx   ecx, byte[eax+1]
645
        movzx   ecx, byte[eax+1]
646
        mov     [device.pci_bus], ecx
646
        mov     [device.pci_bus], ecx
Line 1379... Line 1379...
1379
 
1379
 
1380
 
1380
 
Line 1381... Line -...
1381
align 4
-
 
1382
read_mac:
-
 
1383
 
1381
align 4
1384
        DEBUGF  1, "Ethernet Address: "
1382
read_mac:
1385
 
1383
 
1386
        lea     edi, [device.mac]
1384
        lea     edi, [device.mac]
1387
        set_io  0
1385
        set_io  0
1388
        set_io  byPAR0
1386
        set_io  byPAR0
1389
        mov     ecx, 6
1387
        mov     ecx, 6
1390
  .next:
-
 
1391
        in      al, dx
1388
  .next:
1392
        stosb
1389
        in      al, dx
1393
        DEBUGF  1, "-%x", al
1390
        stosb
-
 
1391
        inc     edx
1394
        inc     edx
1392
        dec     ecx
-
 
1393
        jnz     .next
-
 
1394
 
Line 1395... Line 1395...
1395
        dec     ecx
1395
        DEBUGF  1,"MAC = %x-%x-%x-%x-%x-%x\n", \
Line 1396... Line 1396...
1396
        jnz     .next
1396
        [device.mac+0]:2,[device.mac+1]:2,[device.mac+2]:2,[device.mac+3]:2,[device.mac+4]:2,[device.mac+5]:2
Line 1408... Line 1408...
1408
;;     pointer to device structure in ebx  ;;
1408
;;     pointer to device structure in ebx  ;;
1409
;;                                         ;;
1409
;;                                         ;;
1410
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1410
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1411
align 4
1411
align 4
1412
transmit:
1412
transmit:
1413
        DEBUGF  1,"\nTransmitting packet, buffer:%x, size:%u\n", [esp+4], [esp+8]
1413
        DEBUGF  1,"Transmitting packet, buffer:%x, size:%u\n", [esp+4], [esp+8]
1414
        mov     eax, [esp+4]
1414
        mov     eax, [esp+4]
1415
        DEBUGF  1,"To: %x-%x-%x-%x-%x-%x From: %x-%x-%x-%x-%x-%x Type:%x%x\n",\
1415
        DEBUGF  1,"To: %x-%x-%x-%x-%x-%x From: %x-%x-%x-%x-%x-%x Type:%x%x\n",\
1416
        [eax+00]:2,[eax+01]:2,[eax+02]:2,[eax+03]:2,[eax+04]:2,[eax+05]:2,\
1416
        [eax+00]:2,[eax+01]:2,[eax+02]:2,[eax+03]:2,[eax+04]:2,[eax+05]:2,\
1417
        [eax+06]:2,[eax+07]:2,[eax+08]:2,[eax+09]:2,[eax+10]:2,[eax+11]:2,\
1417
        [eax+06]:2,[eax+07]:2,[eax+08]:2,[eax+09]:2,[eax+10]:2,[eax+11]:2,\
1418
        [eax+13]:2,[eax+12]:2
1418
        [eax+13]:2,[eax+12]:2
Line 1483... Line 1483...
1483
align 4
1483
align 4
1484
int_handler:
1484
int_handler:
Line 1485... Line 1485...
1485
 
1485
 
Line 1486... Line 1486...
1486
        push    ebx esi edi
1486
        push    ebx esi edi
Line 1487... Line 1487...
1487
 
1487
 
Line 1488... Line 1488...
1488
        DEBUGF  1,"\n%s int ", my_service
1488
        DEBUGF  1,"INT\n"
1489
 
1489