Subversion Repositories Kolibri OS

Rev

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

Rev 3589 Rev 3626
Line 313... Line 313...
313
        add     eax, uhci_controller.IntEDs
313
        add     eax, uhci_controller.IntEDs
314
        call    get_phys_addr
314
        call    get_phys_addr
315
; 2b. Fill first 32 entries.
315
; 2b. Fill first 32 entries.
316
        inc     eax
316
        inc     eax
317
        inc     eax     ; set QH bit for uhci_pipe.NextQH
317
        inc     eax     ; set QH bit for uhci_pipe.NextQH
318
        push    32
-
 
319
        pop     ecx
318
        movi    ecx, 32
320
        mov     edx, ecx
319
        mov     edx, ecx
321
@@:
320
@@:
322
        stosd
321
        stosd
323
        add     eax, sizeof.uhci_static_ep
322
        add     eax, sizeof.uhci_static_ep
324
        loop    @b
323
        loop    @b
Line 414... Line 413...
414
; 5e. Host reset.
413
; 5e. Host reset.
415
        mov     edx, edi
414
        mov     edx, edi
416
        mov     ax, 2
415
        mov     ax, 2
417
        out     dx, ax
416
        out     dx, ax
418
; 5f. Wait up to 10ms.
417
; 5f. Wait up to 10ms.
419
        push    10
-
 
420
        pop     ecx
418
        movi    ecx, 10
421
@@:
419
@@:
422
        push    esi
420
        push    esi
423
        push    1
-
 
424
        pop     esi
421
        movi    esi, 1
425
        call    delay_ms
422
        call    delay_ms
426
        pop     esi
423
        pop     esi
427
        in      ax, dx
424
        in      ax, dx
428
        test    al, 2
425
        test    al, 2
429
        loopnz  @b
426
        loopnz  @b
Line 433... Line 430...
433
@@:
430
@@:
434
if 0
431
if 0
435
; emergency variant for tests - always wait 10 ms
432
; emergency variant for tests - always wait 10 ms
436
; wait 10 ms
433
; wait 10 ms
437
        push    esi
434
        push    esi
438
        push    10
-
 
439
        pop     esi
435
        movi    esi, 10
440
        call    delay_ms
436
        call    delay_ms
441
        pop     esi
437
        pop     esi
442
; clear reset signal
438
; clear reset signal
443
        xor     eax, eax
439
        xor     eax, eax
444
        out     dx, ax
440
        out     dx, ax
Line 996... Line 992...
996
;   other errors just lead to retrying the transaction;
992
;   other errors just lead to retrying the transaction;
997
;   if babble is detected, return the corresponding error;
993
;   if babble is detected, return the corresponding error;
998
; * if several non-fatal errors have occured during transaction retries,
994
; * if several non-fatal errors have occured during transaction retries,
999
;   all corresponding bits are set. In this case, return some error code,
995
;   all corresponding bits are set. In this case, return some error code,
1000
;   the order is quite arbitrary.
996
;   the order is quite arbitrary.
1001
        push    USB_STATUS_UNDERRUN
997
        movi    ecx, USB_STATUS_UNDERRUN
1002
        pop     ecx
-
 
1003
        test    al, 1 shl (22-16)       ; not Stalled?
998
        test    al, 1 shl (22-16)       ; not Stalled?
1004
        jz      .know_error
999
        jz      .know_error
1005
        mov     cl, USB_STATUS_OVERRUN
1000
        mov     cl, USB_STATUS_OVERRUN
1006
        test    al, 1 shl (20-16)       ; Babble detected?
1001
        test    al, 1 shl (20-16)       ; Babble detected?
1007
        jnz     .know_error
1002
        jnz     .know_error
Line 1258... Line 1253...
1258
        and     ah, not 2
1253
        and     ah, not 2
1259
        out     dx, ax
1254
        out     dx, ax
1260
; 2. Status bits in UHCI are invalid during reset signalling.
1255
; 2. Status bits in UHCI are invalid during reset signalling.
1261
; Wait a millisecond while status bits become valid again.
1256
; Wait a millisecond while status bits become valid again.
1262
        push    esi
1257
        push    esi
1263
        push    1
-
 
1264
        pop     esi
1258
        movi    esi, 1
1265
        call    delay_ms
1259
        call    delay_ms
1266
        pop     esi
1260
        pop     esi
1267
; 3. ConnectStatus bit is zero during reset and becomes 1 during step 2;
1261
; 3. ConnectStatus bit is zero during reset and becomes 1 during step 2;
1268
; some controllers interpret this as a (fake) connect event.
1262
; some controllers interpret this as a (fake) connect event.
1269
; Enable port and clear status change notification.
1263
; Enable port and clear status change notification.
Line 1456... Line 1450...
1456
; based on the current bandwidth distribution and the requested bandwidth.
1450
; based on the current bandwidth distribution and the requested bandwidth.
1457
; This could fail if the requested bandwidth is not available;
1451
; This could fail if the requested bandwidth is not available;
1458
; if so, return an error.
1452
; if so, return an error.
1459
        lea     edx, [esi + uhci_controller.IntEDs - sizeof.uhci_controller]
1453
        lea     edx, [esi + uhci_controller.IntEDs - sizeof.uhci_controller]
1460
        lea     eax, [esi + uhci_controller.IntEDs + 32*sizeof.uhci_static_ep - sizeof.uhci_controller]
1454
        lea     eax, [esi + uhci_controller.IntEDs + 32*sizeof.uhci_static_ep - sizeof.uhci_controller]
1461
        push    64
-
 
1462
        pop     ecx
1455
        movi    ecx, 64
1463
        call    usb1_select_interrupt_list
1456
        call    usb1_select_interrupt_list
1464
        test    edx, edx
1457
        test    edx, edx
1465
        jz      .return0
1458
        jz      .return0
1466
.insert:
1459
.insert:
1467
; Insert to the head of the corresponding list.
1460
; Insert to the head of the corresponding list.