Subversion Repositories Kolibri OS

Rev

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

Rev 3725 Rev 3908
Line 237... Line 237...
237
        test    ebx, ebx
237
        test    ebx, ebx
238
        jz      .freememory
238
        jz      .freememory
239
; 2. Store pointer to device data in the pipe structure.
239
; 2. Store pointer to device data in the pipe structure.
240
        mov     [ebx+usb_pipe.DeviceData], eax
240
        mov     [ebx+usb_pipe.DeviceData], eax
241
; 3. Init device data, using usb_controller.Resetting* variables.
241
; 3. Init device data, using usb_controller.Resetting* variables.
-
 
242
        mov     [eax+usb_device_data.TTHub], edi
-
 
243
        mov     [eax+usb_device_data.TTPort], 0
-
 
244
        mov     [eax+usb_device_data.NumInterfaces], edi
-
 
245
        mov     [eax+usb_device_data.DeviceDescrSize], 0
-
 
246
        mov     dl, [esi+usb_controller.ResettingSpeed]
-
 
247
        mov     [eax+usb_device_data.Speed], dl
242
        mov     [eax+usb_device_data.NumPipes], 1
248
        mov     [eax+usb_device_data.NumPipes], 1
-
 
249
        push    ebx
-
 
250
        cmp     dl, USB_SPEED_HS
-
 
251
        jz      .nott
-
 
252
        mov     ebx, [esi+usb_controller.ResettingHub]
-
 
253
        test    ebx, ebx
-
 
254
        jz      .nott
-
 
255
        mov     cl, [esi+usb_controller.ResettingPort]
-
 
256
        mov     edx, [ebx+usb_hub.ConfigPipe]
-
 
257
        mov     edx, [edx+usb_pipe.DeviceData]
-
 
258
        cmp     [edx+usb_device_data.TTHub], 0
-
 
259
        jz      @f
-
 
260
        mov     cl, [edx+usb_device_data.TTPort]
-
 
261
        mov     ebx, [edx+usb_device_data.TTHub]
-
 
262
        jmp     .has_tt
-
 
263
@@:
-
 
264
        cmp     [edx+usb_device_data.Speed], USB_SPEED_HS
-
 
265
        jnz     .nott
-
 
266
.has_tt:
-
 
267
        mov     [eax+usb_device_data.TTHub], ebx
-
 
268
        mov     [eax+usb_device_data.TTPort], cl
-
 
269
.nott:
-
 
270
        pop     ebx
243
        mov     [eax+usb_device_data.ConfigDataSize], edi
271
        mov     [eax+usb_device_data.ConfigDataSize], edi
244
        mov     [eax+usb_device_data.Interfaces], edi
272
        mov     [eax+usb_device_data.Interfaces], edi
245
        movzx   ecx, [esi+usb_controller.ResettingPort]
273
        movzx   ecx, [esi+usb_controller.ResettingPort]
246
; Note: the following write zeroes
-
 
247
; usb_device_data.DeviceDescrSize, usb_device_data.NumInterfaces,
-
 
248
; usb_device_data.Speed.
-
 
249
        mov     dword [eax+usb_device_data.Port], ecx
-
 
250
        mov     dl, [esi+usb_controller.ResettingSpeed]
-
 
251
        mov     [eax+usb_device_data.Speed], dl
274
        mov     [eax+usb_device_data.Port], cl
252
        mov     edx, [esi+usb_controller.ResettingHub]
275
        mov     edx, [esi+usb_controller.ResettingHub]
253
        mov     [eax+usb_device_data.Hub], edx
276
        mov     [eax+usb_device_data.Hub], edx
254
; 4. Store pointer to the config pipe in the hub data.
277
; 4. Store pointer to the config pipe in the hub data.
255
; Config pipe serves as device identifier.
278
; Config pipe serves as device identifier.
256
; Root hubs use the array inside usb_controller structure,
279
; Root hubs use the array inside usb_controller structure,
Line 468... Line 491...
468
        push    esi edi
491
        push    esi edi
469
        mov     esi, [ebx+usb_pipe.DeviceData]
492
        mov     esi, [ebx+usb_pipe.DeviceData]
470
        mov     [ebx+usb_pipe.DeviceData], eax
493
        mov     [ebx+usb_pipe.DeviceData], eax
471
        mov     edi, eax
494
        mov     edi, eax
472
        mov     eax, esi
495
        mov     eax, esi
473
repeat sizeof.usb_device_data / 4
496
        mov     ecx, sizeof.usb_device_data / 4
474
        movsd
497
        rep movsd
475
end repeat
-
 
476
        pop     edi esi
498
        pop     edi esi
477
        call    usb_reinit_pipe_list
499
        call    usb_reinit_pipe_list
478
; 1d. Free the old memory.
500
; 1d. Free the old memory.
479
; Note that free destroys ebx.
501
; Note that free destroys ebx.
480
        push    ebx
502
        push    ebx
Line 734... Line 756...
734
.invalid:
756
.invalid:
735
        dbgstr 'error: invalid configuration descriptor'
757
        dbgstr 'error: invalid configuration descriptor'
736
        jmp     .nothing
758
        jmp     .nothing
737
@@:
759
@@:
738
; 3. Store the number of interfaces in device data structure.
760
; 3. Store the number of interfaces in device data structure.
739
        mov     [ebx+usb_device_data.NumInterfaces], dl
761
        mov     [ebx+usb_device_data.NumInterfaces], edx
740
; 4. If there is only one interface (which happens quite often),
762
; 4. If there is only one interface (which happens quite often),
741
; the memory allocated in usb_know_length_callback is sufficient.
763
; the memory allocated in usb_know_length_callback is sufficient.
742
; Otherwise (which also happens quite often), reallocate device data.
764
; Otherwise (which also happens quite often), reallocate device data.
743
; 4a. Check whether there is only one interface. If so, skip this step.
765
; 4a. Check whether there is only one interface. If so, skip this step.
744
        cmp     edx, 1
766
        cmp     edx, 1
Line 773... Line 795...
773
.has_memory:
795
.has_memory:
774
; 5. Initialize interfaces table: zero all contents.
796
; 5. Initialize interfaces table: zero all contents.
775
        mov     edi, [ebx+usb_device_data.Interfaces]
797
        mov     edi, [ebx+usb_device_data.Interfaces]
776
        add     edi, ebx
798
        add     edi, ebx
777
        mov     [InterfacesData], edi
799
        mov     [InterfacesData], edi
778
        movzx   ecx, [ebx+usb_device_data.NumInterfaces]
800
        mov     ecx, [ebx+usb_device_data.NumInterfaces]
779
if sizeof.usb_interface_data <> 8
801
if sizeof.usb_interface_data <> 8
780
You have changed sizeof.usb_interface_data? Modify this place too.
802
You have changed sizeof.usb_interface_data? Modify this place too.
781
end if
803
end if
782
        add     ecx, ecx
804
        add     ecx, ecx
783
        xor     eax, eax
805
        xor     eax, eax
Line 835... Line 857...
835
                [eax+usb_interface_descr.bInterfaceProtocol]:2
857
                [eax+usb_interface_descr.bInterfaceProtocol]:2
836
        jmp     .next_descriptor
858
        jmp     .next_descriptor
837
@@:
859
@@:
838
; 7f. Check that the new interface does not overflow allocated table.
860
; 7f. Check that the new interface does not overflow allocated table.
839
        mov     edx, [NumInterfaces]
861
        mov     edx, [NumInterfaces]
840
        inc     dl
862
        inc     edx
841
        jz      .invalid
-
 
842
        cmp     dl, [ebx+usb_device_data.NumInterfaces]
863
        cmp     edx, [ebx+usb_device_data.NumInterfaces]
843
        ja      .invalid
864
        ja      .invalid
844
; 7g. We have found a new interface. Advance bookkeeping vars.
865
; 7g. We have found a new interface. Advance bookkeeping vars.
845
        mov     [NumInterfaces], edx
866
        mov     [NumInterfaces], edx
846
        add     [InterfacesData], sizeof.usb_interface_data
867
        add     [InterfacesData], sizeof.usb_interface_data
847
; 7h. Save length left and pointer to the current interface descriptor.
868
; 7h. Save length left and pointer to the current interface descriptor.