Subversion Repositories Kolibri OS

Rev

Rev 4418 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 4418 Rev 4547
Line 272... Line 272...
272
        dd      uhci_alloc_td
272
        dd      uhci_alloc_td
273
        dd      uhci_free_td
273
        dd      uhci_free_td
274
        dd      uhci_alloc_transfer
274
        dd      uhci_alloc_transfer
275
        dd      uhci_insert_transfer
275
        dd      uhci_insert_transfer
276
        dd      uhci_new_device
276
        dd      uhci_new_device
-
 
277
        dd      uhci_disable_pipe
-
 
278
        dd      uhci_enable_pipe
277
uhci_name db    'UHCI',0
279
uhci_name db    'UHCI',0
278
endg
280
endg
Line 279... Line 281...
279
 
281
 
280
; =============================================================================
282
; =============================================================================
Line 1131... Line 1133...
1131
        cmp     eax, [ecx+usb_pipe.LastTD-usb_pipe.Lock]
1133
        cmp     eax, [ecx+usb_pipe.LastTD-usb_pipe.Lock]
1132
        mov     eax, [eax+usb_gtd.NextVirt]
1134
        mov     eax, [eax+usb_gtd.NextVirt]
1133
        jnz     .loop
1135
        jnz     .loop
1134
; 5. Flip the toggle bit in uhci_pipe structure.
1136
; 5. Flip the toggle bit in uhci_pipe structure.
1135
        xor     byte [ecx+uhci_pipe.Token-sizeof.uhci_pipe-usb_pipe.Lock+2], 1 shl (19-16)
1137
        xor     byte [ecx+uhci_pipe.Token-sizeof.uhci_pipe-usb_pipe.Lock+2], 1 shl (19-16)
1136
        or      dword [ecx+uhci_pipe.Token-sizeof.uhci_pipe-usb_pipe.Lock], eax
-
 
1137
; 6. Unlock the transfer queue.
1138
; 6. Unlock the transfer queue.
1138
        invoke  MutexUnlock
1139
        invoke  MutexUnlock
1139
.nothing:
1140
.nothing:
1140
        ret
1141
        ret
1141
endp
1142
endp
Line 1459... Line 1460...
1459
        movi    ecx, 64
1460
        movi    ecx, 64
1460
        call    usb1_select_interrupt_list
1461
        call    usb1_select_interrupt_list
1461
        test    edx, edx
1462
        test    edx, edx
1462
        jz      .return0
1463
        jz      .return0
1463
.insert:
1464
.insert:
-
 
1465
        mov     [edi+usb_pipe.BaseList], edx
1464
; Insert to the head of the corresponding list.
1466
; Insert to the head of the corresponding list.
1465
; Note: inserting to the head guarantees that the list traverse in
1467
; Note: inserting to the head guarantees that the list traverse in
1466
; uhci_process_updated_schedule, once started, will not interact with new pipes.
1468
; uhci_process_updated_schedule, once started, will not interact with new pipes.
1467
; However, we still need to ensure that links in the new pipe (edi.NextVirt)
1469
; However, we still need to ensure that links in the new pipe (edi.NextVirt)
1468
; are initialized before links to the new pipe (edx.NextVirt).
1470
; are initialized before links to the new pipe (edx.NextVirt).
Line 1503... Line 1505...
1503
        setc    cl
1505
        setc    cl
1504
        add     eax, 1 shl 21
1506
        add     eax, 1 shl 21
1505
        shr     eax, 21
1507
        shr     eax, 21
1506
        stdcall usb1_interrupt_list_unlink, eax, ecx
1508
        stdcall usb1_interrupt_list_unlink, eax, ecx
1507
@@:
1509
@@:
1508
; Note: we need to ensure that NextVirt field of the pipe is not modified;
1510
        ret
-
 
1511
endp
-
 
1512
 
1509
; this procedure can be called while uhci_process_updated_schedule processes
1513
; This procedure temporarily removes the given pipe from hardware queue,
1510
; the same pipe, and it needs a correct NextVirt field to continue.
1514
; keeping it in software lists.
1511
        mov     edx, [ebx+usb_pipe.NextVirt]
1515
; esi -> usb_controller, ebx -> usb_pipe
1512
        mov     eax, [ebx+usb_pipe.PrevVirt]
1516
proc uhci_disable_pipe
1513
        mov     [edx+usb_pipe.PrevVirt], eax
1517
        mov     eax, [ebx+uhci_pipe.NextQH-sizeof.uhci_pipe]
1514
        mov     [eax+usb_pipe.NextVirt], edx
1518
        mov     edx, [ebx+usb_pipe.PrevVirt]
1515
; Note: eax could be either usb_pipe or usb_static_ep;
1519
; Note: edx could be either usb_pipe or usb_static_ep;
1516
; fortunately, NextQH and SoftwarePart have same offsets in both.
1520
; fortunately, NextQH and SoftwarePart have same offsets in both.
-
 
1521
        mov     [edx+uhci_pipe.NextQH-sizeof.uhci_pipe], eax
-
 
1522
        ret
-
 
1523
endp
-
 
1524
 
-
 
1525
; This procedure reinserts the given pipe from hardware queue
-
 
1526
; after ehci_disable_pipe, with clearing transfer queue.
-
 
1527
; esi -> usb_controller, ebx -> usb_pipe
-
 
1528
; edx -> current descriptor, eax -> new last descriptor
-
 
1529
proc uhci_enable_pipe
-
 
1530
; 1. Copy DataToggle bit from edx to pipe.
-
 
1531
        mov     ecx, [edx+uhci_gtd.Token-sizeof.uhci_gtd]
-
 
1532
        xor     ecx, [ebx+uhci_pipe.Token-sizeof.uhci_pipe]
-
 
1533
        and     ecx, 1 shl 19
-
 
1534
        xor     [ebx+uhci_pipe.Token-sizeof.uhci_pipe], ecx
-
 
1535
; 2. Store new last descriptor as the current HeadTD.
-
 
1536
        sub     eax, sizeof.uhci_gtd
-
 
1537
        invoke  GetPhysAddr
-
 
1538
        mov     [ebx+uhci_pipe.HeadTD-sizeof.uhci_pipe], eax
-
 
1539
; 3. Reinsert the pipe to hardware queue.
-
 
1540
        lea     eax, [ebx-sizeof.uhci_pipe]
-
 
1541
        invoke  GetPhysAddr
-
 
1542
        inc     eax
-
 
1543
        inc     eax
-
 
1544
        mov     edx, [ebx+usb_pipe.PrevVirt]
1517
        mov     edx, [ebx+uhci_pipe.NextQH-sizeof.uhci_pipe]
1545
        mov     ecx, [edx+uhci_pipe.NextQH-sizeof.uhci_pipe]
-
 
1546
        mov     [ebx+uhci_pipe.NextQH-sizeof.uhci_pipe], ecx
1518
        mov     [eax+uhci_pipe.NextQH-sizeof.uhci_pipe], edx
1547
        mov     [edx+uhci_pipe.NextQH-sizeof.uhci_pipe], eax
1519
        ret
1548
        ret
1520
endp
1549
endp
Line 1521... Line 1550...
1521
 
1550
 
1522
; This procedure is called from the several places in main USB code
1551
; This procedure is called from the several places in main USB code