Subversion Repositories Kolibri OS

Rev

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

Rev 4265 Rev 4423
Line 456... Line 456...
456
        mov     ecx, command_block_wrapper.sizeof
456
        mov     ecx, command_block_wrapper.sizeof
457
        call    debug_dump
457
        call    debug_dump
458
        DEBUGF 1,'\n'
458
        DEBUGF 1,'\n'
459
end if
459
end if
460
        stdcall USBNormalTransferAsync, [esi+usb_device_data.OutPipe], edx, command_block_wrapper.sizeof, request_callback1, esi, 0
460
        stdcall USBNormalTransferAsync, [esi+usb_device_data.OutPipe], edx, command_block_wrapper.sizeof, request_callback1, esi, 0
-
 
461
        test    eax, eax
-
 
462
        jz      .nothing
-
 
463
; 5. If the next stage is data stage in the same direction, enqueue it here.
-
 
464
        cmp     [esi+usb_device_data.Command.Flags], 0
-
 
465
        js      .nothing
-
 
466
        cmp     [esi+usb_device_data.Command.Length], 0
-
 
467
        jz      .nothing
-
 
468
        mov     edx, [esi+usb_device_data.RequestsQueue+request_queue_item.Next]
-
 
469
if DUMP_PACKETS
-
 
470
        DEBUGF 1,'K : USBSTOR out:'
-
 
471
        mov     eax, [edx+request_queue_item.Buffer]
-
 
472
        mov     ecx, [esi+usb_device_data.Command.Length]
-
 
473
        call    debug_dump
-
 
474
        DEBUGF 1,'\n'
-
 
475
end if
-
 
476
        stdcall USBNormalTransferAsync, [esi+usb_device_data.OutPipe], [edx+request_queue_item.Buffer], [esi+usb_device_data.Command.Length], request_callback2, esi, 0
-
 
477
.nothing:
461
        ret
478
        ret
462
endp
479
endp
Line 463... Line 480...
463
 
480
 
464
if DUMP_PACKETS
481
if DUMP_PACKETS
Line 524... Line 541...
524
        jnz     .error
541
        jnz     .error
525
; No error.
542
; No error.
526
; 3. Increment the stage.
543
; 3. Increment the stage.
527
        mov     edx, [ecx+usb_device_data.RequestsQueue+request_queue_item.Next]
544
        mov     edx, [ecx+usb_device_data.RequestsQueue+request_queue_item.Next]
528
        inc     [edx+request_queue_item.Stage]
545
        inc     [edx+request_queue_item.Stage]
-
 
546
; 4. Check whether we need to send the data.
529
; 4. If there is no data, skip this stage.
547
; 4a. If there is no data, skip this stage.
530
        cmp     [ecx+usb_device_data.Command.Length], 0
548
        cmp     [ecx+usb_device_data.Command.Length], 0
531
        jz      ..request_get_status
549
        jz      ..request_get_status
532
; 5. Initiate USB transfer. If this fails, go to the error handler.
550
; 4b. If data were enqueued in the first stage, do nothing, wait for request_callback2.
533
        mov     eax, [ecx+usb_device_data.InPipe]
-
 
534
        cmp     [ecx+usb_device_data.Command.Flags], 0
551
        cmp     [ecx+usb_device_data.Command.Flags], 0
535
        js      @f
552
        jns     .nothing
536
        mov     eax, [ecx+usb_device_data.OutPipe]
-
 
537
if DUMP_PACKETS
-
 
538
        DEBUGF 1,'K : USBSTOR out:'
-
 
539
        push    eax ecx
-
 
540
        mov     eax, [edx+request_queue_item.Buffer]
553
; 5. Initiate USB transfer. If this fails, go to the error handler.
541
        mov     ecx, [ecx+usb_device_data.Command.Length]
-
 
542
        call    debug_dump
-
 
543
        pop     ecx eax
-
 
544
        DEBUGF 1,'\n'
-
 
545
end if
-
 
546
@@:
-
 
547
        stdcall USBNormalTransferAsync, eax, [edx+request_queue_item.Buffer], [ecx+usb_device_data.Command.Length], request_callback2, ecx, 0
554
        stdcall USBNormalTransferAsync, [ecx+usb_device_data.InPipe], [edx+request_queue_item.Buffer], [ecx+usb_device_data.Command.Length], request_callback2, ecx, 0
548
        test    eax, eax
555
        test    eax, eax
549
        jz      .error
556
        jz      .error
-
 
557
; 6. The status stage goes to the same direction, enqueue it now.
-
 
558
        mov     ecx, [.calldata]
-
 
559
        jmp     ..enqueue_status
550
; 6. Return.
560
.nothing:
551
        ret     20
561
        ret     20
552
.error:
562
.error:
553
; Error.
563
; Error.
554
; 7. Print debug message and complete the request as failed.
564
; 7. Print debug message and complete the request as failed.
555
        DEBUGF 1,'K : error %d after %d bytes in request stage\n',eax,[.length]
565
        DEBUGF 1,'K : error %d after %d bytes in request stage\n',eax,[.length]
Line 594... Line 604...
594
        mov     eax, [.status]
604
        mov     eax, [.status]
595
; 2. Test for error.
605
; 2. Test for error.
596
        test    eax, eax
606
        test    eax, eax
597
        jnz     .error
607
        jnz     .error
598
; No error.
608
; No error.
-
 
609
; If the previous stage was in same direction, do nothing; status request is already enqueued.
-
 
610
        cmp     [ecx+usb_device_data.Command.Flags], 0
-
 
611
        js      .nothing
599
..request_get_status:
612
..request_get_status:
600
; 3. Increment the stage.
613
; 3. Increment the stage.
601
        mov     edx, [ecx+usb_device_data.RequestsQueue+request_queue_item.Next]
614
        mov     edx, [ecx+usb_device_data.RequestsQueue+request_queue_item.Next]
602
        inc     [edx+request_queue_item.Stage]
615
        inc     [edx+request_queue_item.Stage]
603
; 4. Initiate USB transfer. If this fails, go to the error handler.
616
; 4. Initiate USB transfer. If this fails, go to the error handler.
-
 
617
..enqueue_status:
604
        lea     edx, [ecx+usb_device_data.Status]
618
        lea     edx, [ecx+usb_device_data.Status]
605
        stdcall USBNormalTransferAsync, [ecx+usb_device_data.InPipe], edx, command_status_wrapper.sizeof, request_callback3, ecx, 0
619
        stdcall USBNormalTransferAsync, [ecx+usb_device_data.InPipe], edx, command_status_wrapper.sizeof, request_callback3, ecx, 0
606
        test    eax, eax
620
        test    eax, eax
607
        jz      .error
621
        jz      .error
-
 
622
.nothing:
608
        ret     20
623
        ret     20
609
.error:
624
.error:
610
; Error.
625
; Error.
611
; 7. Print debug message and complete the request as failed.
626
; 7. Print debug message and complete the request as failed.
612
        DEBUGF 1,'K : error %d after %d bytes in data stage\n',eax,[.length]
627
        DEBUGF 1,'K : error %d after %d bytes in data stage\n',eax,[.length]