Subversion Repositories Kolibri OS

Rev

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

Rev 4547 Rev 5246
Line 851... Line 851...
851
        jmp     .accloop
851
        jmp     .accloop
852
.accdone:
852
.accdone:
853
; debugging output, not needed for work
853
; debugging output, not needed for work
854
;       test    eax, 1F0000h
854
;       test    eax, 1F0000h
855
;       jz      @f
855
;       jz      @f
856
;       DEBUGF 1,'K : ohci irq [%d] status of port %d is %x\n',[timer_ticks],ecx,eax
856
;       DEBUGF 1,'K : ohci %x status of port %d is %x\n',esi,ecx,eax
857
;@@:
857
;@@:
858
; 11c. Ignore any events until all ports are powered up.
858
; 11c. Ignore any events until all ports are powered up.
859
; They will be processed by ohci_init.
859
; They will be processed by ohci_init.
860
        cmp     [esi+ohci_controller.PoweredUp-sizeof.ohci_controller], 0
860
        cmp     [esi+ohci_controller.PoweredUp-sizeof.ohci_controller], 0
861
        jz      .nextport
861
        jz      .nextport
Line 1321... Line 1321...
1321
proc ohci_process_deferred
1321
proc ohci_process_deferred
1322
        push    ebx edi         ; save used registers to be stdcall
1322
        push    ebx edi         ; save used registers to be stdcall
1323
; 1. Initialize the return value.
1323
; 1. Initialize the return value.
1324
        push    -1
1324
        push    -1
1325
; 2. Process disconnect events.
1325
; 2. Process disconnect events.
-
 
1326
; Capture NewConnected mask in the state before disconnect processing;
-
 
1327
; IRQ handler could asynchronously signal disconnect+connect event,
-
 
1328
; connect events should be handled after disconnect events.
-
 
1329
        push    [esi+usb_controller.NewConnected]
1326
        invoke  usbhc_api.usb_disconnect_stage2
1330
        invoke  usbhc_api.usb_disconnect_stage2
1327
; 3. Check for connected devices.
1331
; 3. Check for connected devices.
1328
; If there is a connected device which was connected less than
1332
; If there is a connected device which was connected less than
1329
; USB_CONNECT_DELAY ticks ago, plan to wake up when the delay will be over.
1333
; USB_CONNECT_DELAY ticks ago, plan to wake up when the delay will be over.
1330
; Otherwise, call ohci_new_port.
1334
; Otherwise, call ohci_new_port.
1331
        mov     edi, [esi+ohci_controller.MMIOBase-sizeof.ohci_controller]
1335
        mov     edi, [esi+ohci_controller.MMIOBase-sizeof.ohci_controller]
1332
        xor     ecx, ecx
1336
        xor     ecx, ecx
1333
        cmp     [esi+usb_controller.NewConnected], ecx
1337
        cmp     [esp], ecx
1334
        jz      .skip_newconnected
1338
        jz      .skip_newconnected
1335
.portloop:
1339
.portloop:
1336
        bt      [esi+usb_controller.NewConnected], ecx
1340
        bt      [esp], ecx
1337
        jnc     .noconnect
1341
        jnc     .noconnect
1338
; If this port is shared with the EHCI companion and we see the connect event,
1342
; If this port is shared with the EHCI companion and we see the connect event,
1339
; then the device is USB1 dropped by EHCI,
1343
; then the device is USB1 dropped by EHCI,
1340
; so EHCI has already waited for debounce delay, we can proceed immediately.
1344
; so EHCI has already waited for debounce delay, we can proceed immediately.
1341
        cmp     [esi+ohci_controller.EhciCompanion-sizeof.ohci_controller], 0
1345
        cmp     [esi+ohci_controller.EhciCompanion-sizeof.ohci_controller], 0
Line 1346... Line 1350...
1346
        invoke  GetTimerTicks
1350
        invoke  GetTimerTicks
1347
        sub     eax, [esi+usb_controller.ConnectedTime+ecx*4]
1351
        sub     eax, [esi+usb_controller.ConnectedTime+ecx*4]
1348
        sub     eax, USB_CONNECT_DELAY
1352
        sub     eax, USB_CONNECT_DELAY
1349
        jge     .connected
1353
        jge     .connected
1350
        neg     eax
1354
        neg     eax
1351
        cmp     [esp], eax
1355
        cmp     [esp+4], eax
1352
        jb      .nextport
1356
        jb      .nextport
1353
        mov     [esp], eax
1357
        mov     [esp+4], eax
1354
        jmp     .nextport
1358
        jmp     .nextport
1355
.connected:
1359
.connected:
1356
        lock btr [esi+usb_controller.NewConnected], ecx
1360
        lock btr [esi+usb_controller.NewConnected], ecx
1357
        jnc     .nextport
1361
        jnc     .nextport
1358
        call    ohci_new_port
1362
        call    ohci_new_port
Line 1360... Line 1364...
1360
.nextport:
1364
.nextport:
1361
        inc     ecx
1365
        inc     ecx
1362
        cmp     ecx, [esi+usb_controller.NumPorts]
1366
        cmp     ecx, [esi+usb_controller.NumPorts]
1363
        jb      .portloop
1367
        jb      .portloop
1364
.skip_newconnected:
1368
.skip_newconnected:
-
 
1369
        pop     eax
1365
; 4. Check for end of reset signalling. If so, call ohci_port_after_reset.
1370
; 4. Check for end of reset signalling. If so, call ohci_port_after_reset.
1366
        cmp     [esi+usb_controller.ResettingStatus], 2
1371
        cmp     [esi+usb_controller.ResettingStatus], 2
1367
        jnz     .no_reset_recovery
1372
        jnz     .no_reset_recovery
1368
        invoke  GetTimerTicks
1373
        invoke  GetTimerTicks
1369
        sub     eax, [esi+usb_controller.ResetTime]
1374
        sub     eax, [esi+usb_controller.ResetTime]