Subversion Repositories Kolibri OS

Rev

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

Rev 4418 Rev 4547
Line 62... Line 62...
62
; 1. Lower 7 bits (bits 0-6) are FunctionAddress. This is the USB address of
62
; 1. Lower 7 bits (bits 0-6) are FunctionAddress. This is the USB address of
63
;    the function containing the endpoint that this ED controls.
63
;    the function containing the endpoint that this ED controls.
64
; 2. Next 4 bits (bits 7-10) are EndpointNumber. This is the USB address of
64
; 2. Next 4 bits (bits 7-10) are EndpointNumber. This is the USB address of
65
;    the endpoint within the function.
65
;    the endpoint within the function.
66
; 3. Next 2 bits (bits 11-12) are Direction. This 2-bit field indicates the
66
; 3. Next 2 bits (bits 11-12) are Direction. This 2-bit field indicates the
67
;    direction of data flow: 1 = IN, 2 = OUT. If neither IN nor OUT is
67
;    direction of data flow: 1 = OUT, 2 = IN. If neither IN nor OUT is
68
;    specified, then the direction is determined from the PID field of the TD.
68
;    specified, then the direction is determined from the PID field of the TD.
69
;    For CONTROL endpoints, the transfer direction is different
69
;    For CONTROL endpoints, the transfer direction is different
70
;    for different transfers, so the value of this field is 0
70
;    for different transfers, so the value of this field is 0
71
;    (3 would have the same effect) and the actual direction
71
;    (3 would have the same effect) and the actual direction
72
;    of one transfer is encoded in the Transfer Descriptor.
72
;    of one transfer is encoded in the Transfer Descriptor.
Line 320... Line 320...
320
        dd      ohci_alloc_gtd
320
        dd      ohci_alloc_gtd
321
        dd      ohci_free_gtd
321
        dd      ohci_free_gtd
322
        dd      ohci_alloc_transfer
322
        dd      ohci_alloc_transfer
323
        dd      ohci_insert_transfer
323
        dd      ohci_insert_transfer
324
        dd      ohci_new_device
324
        dd      ohci_new_device
-
 
325
        dd      ohci_disable_pipe
-
 
326
        dd      ohci_enable_pipe
325
ohci_name db    'OHCI',0
327
ohci_name db    'OHCI',0
326
endg
328
endg
Line 327... Line 329...
327
 
329
 
328
; =============================================================================
330
; =============================================================================
Line 1012... Line 1014...
1012
        jz      .return0
1014
        jz      .return0
1013
; 3c. Insert endpoint at edi to the head of list in edx.
1015
; 3c. Insert endpoint at edi to the head of list in edx.
1014
; Inserting to tail would work as well,
1016
; Inserting to tail would work as well,
1015
; but let's be consistent with other controllers.
1017
; but let's be consistent with other controllers.
1016
.insert:
1018
.insert:
-
 
1019
        mov     [edi+usb_pipe.BaseList], edx
1017
        mov     ecx, [edx+usb_pipe.NextVirt]
1020
        mov     ecx, [edx+usb_pipe.NextVirt]
1018
        mov     [edi+usb_pipe.NextVirt], ecx
1021
        mov     [edi+usb_pipe.NextVirt], ecx
1019
        mov     [edi+usb_pipe.PrevVirt], edx
1022
        mov     [edi+usb_pipe.PrevVirt], edx
1020
        mov     [ecx+usb_pipe.PrevVirt], edi
1023
        mov     [ecx+usb_pipe.PrevVirt], edi
1021
        mov     [edx+usb_pipe.NextVirt], edi
1024
        mov     [edx+usb_pipe.NextVirt], edi
Line 1612... Line 1615...
1612
        cmp     [ebx+usb_pipe.Type], INTERRUPT_PIPE
1615
        cmp     [ebx+usb_pipe.Type], INTERRUPT_PIPE
1613
        jnz     @f
1616
        jnz     @f
1614
        mov     eax, [ebx+ohci_pipe.Flags-sizeof.ohci_pipe]
1617
        mov     eax, [ebx+ohci_pipe.Flags-sizeof.ohci_pipe]
1615
        bt      eax, 13
1618
        bt      eax, 13
1616
        setc    cl
1619
        setc    cl
1617
        bt      eax, 11
1620
        bt      eax, 12
1618
        setc    ch
1621
        setc    ch
1619
        shr     eax, 16
1622
        shr     eax, 16
1620
        stdcall usb1_interrupt_list_unlink, eax, ecx
1623
        stdcall usb1_interrupt_list_unlink, eax, ecx
1621
@@:
1624
@@:
-
 
1625
        ret
-
 
1626
endp
-
 
1627
 
-
 
1628
; This procedure temporarily removes the given pipe from hardware queue,
-
 
1629
; keeping it in software lists.
-
 
1630
; esi -> usb_controller, ebx -> usb_pipe
-
 
1631
proc ohci_disable_pipe
1622
        mov     edx, [ebx+usb_pipe.NextVirt]
1632
        mov     eax, [ebx+ohci_pipe.NextED-sizeof.ohci_pipe]
1623
        mov     eax, [ebx+usb_pipe.PrevVirt]
1633
        mov     edx, [ebx+usb_pipe.PrevVirt]
-
 
1634
        mov     [edx+ohci_pipe.NextED-sizeof.ohci_pipe], eax
-
 
1635
        ret
-
 
1636
endp
-
 
1637
 
-
 
1638
; This procedure reinserts the given pipe from hardware queue
-
 
1639
; after ehci_disable_pipe, with clearing transfer queue.
-
 
1640
; esi -> usb_controller, ebx -> usb_pipe
-
 
1641
; edx -> current descriptor, eax -> new last descriptor
-
 
1642
proc ohci_enable_pipe
-
 
1643
        sub     eax, sizeof.ohci_gtd
-
 
1644
        invoke  GetPhysAddr
-
 
1645
        mov     edx, [ebx+ohci_pipe.HeadP-sizeof.ohci_pipe]
-
 
1646
        and     edx, 2
-
 
1647
        or      eax, edx
1624
        mov     [edx+usb_pipe.PrevVirt], eax
1648
        mov     [ebx+ohci_pipe.HeadP-sizeof.ohci_pipe], eax
-
 
1649
        lea     eax, [ebx-sizeof.ohci_pipe]
-
 
1650
        invoke  GetPhysAddr
1625
        mov     [eax+usb_pipe.NextVirt], edx
1651
        mov     edx, [ebx+usb_pipe.PrevVirt]
1626
        mov     edx, [ebx+ohci_pipe.NextED-sizeof.ohci_pipe]
1652
        mov     ecx, [edx+ohci_pipe.NextED-sizeof.ohci_pipe]
-
 
1653
        mov     [ebx+ohci_pipe.NextED-sizeof.ohci_pipe], ecx
1627
        mov     [eax+ohci_pipe.NextED-sizeof.ohci_pipe], edx
1654
        mov     [edx+ohci_pipe.NextED-sizeof.ohci_pipe], eax
1628
        ret
1655
        ret
1629
endp
1656
endp
Line 1630... Line 1657...
1630
 
1657
 
1631
; Allocates one endpoint structure for OHCI.
1658
; Allocates one endpoint structure for OHCI.