Subversion Repositories Kolibri OS

Rev

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

Rev 3520 Rev 3653
Line 24... Line 24...
24
usb_gtd_first_page      dd      ?
24
usb_gtd_first_page      dd      ?
25
usb_gtd_mutex           MUTEX
25
usb_gtd_mutex           MUTEX
26
endg
26
endg
Line 27... Line 27...
27
 
27
 
28
; sanity check: structures in UHCI and OHCI should be the same for allocation
28
; sanity check: structures in UHCI and OHCI should be the same for allocation
Line 29... Line 29...
29
if (sizeof.ohci_pipe=sizeof.uhci_pipe)&(ohci_pipe.SoftwarePart=uhci_pipe.SoftwarePart)
29
if (sizeof.ohci_pipe = sizeof.uhci_pipe)
30
 
30
 
31
; Allocates one endpoint structure for UHCI/OHCI.
31
; Allocates one endpoint structure for UHCI/OHCI.
32
; Returns pointer to software part (usb_pipe) in eax.
32
; Returns pointer to software part (usb_pipe) in eax.
33
proc usb1_allocate_endpoint
33
proc usb1_allocate_endpoint
34
        push    ebx
34
        push    ebx
35
        mov     ebx, usb1_ep_mutex
35
        mov     ebx, usb1_ep_mutex
36
        stdcall usb_allocate_common, sizeof.ohci_pipe
36
        stdcall usb_allocate_common, (sizeof.ohci_pipe + sizeof.usb_pipe + 0Fh) and not 0Fh
37
        test    eax, eax
37
        test    eax, eax
38
        jz      @f
38
        jz      @f
39
        add     eax, ohci_pipe.SoftwarePart
39
        add     eax, sizeof.ohci_pipe
40
@@:
40
@@:
41
        pop     ebx
41
        pop     ebx
Line 42... Line 42...
42
        ret
42
        ret
43
endp
43
endp
44
 
44
 
45
; Free one endpoint structure for UHCI/OHCI.
45
; Free one endpoint structure for UHCI/OHCI.
46
; Stdcall with one argument, pointer to software part (usb_pipe).
46
; Stdcall with one argument, pointer to software part (usb_pipe).
47
proc usb1_free_endpoint
47
proc usb1_free_endpoint
Line 48... Line 48...
48
        sub     dword [esp+4], ohci_pipe.SoftwarePart
48
        sub     dword [esp+4], sizeof.ohci_pipe
49
        jmp     usb_free_common
49
        jmp     usb_free_common
50
endp
50
endp
51
 
51
 
Line 52... Line 52...
52
else
52
else
53
; sanity check continued
53
; sanity check continued
Line 54... Line 54...
54
.err allocate_endpoint/free_endpoint must be different for OHCI and UHCI
54
.err allocate_endpoint/free_endpoint must be different for OHCI and UHCI
55
end if
55
end if
56
 
56
 
57
; sanity check: structures in UHCI and OHCI should be the same for allocation
57
; sanity check: structures in UHCI and OHCI should be the same for allocation
58
if (sizeof.ohci_gtd=sizeof.uhci_gtd)&(ohci_gtd.SoftwarePart=uhci_gtd.SoftwarePart)
58
if (sizeof.ohci_gtd = sizeof.uhci_gtd)
59
 
59
 
60
; Allocates one general transfer descriptor structure for UHCI/OHCI.
60
; Allocates one general transfer descriptor structure for UHCI/OHCI.
61
; Returns pointer to software part (usb_gtd) in eax.
61
; Returns pointer to software part (usb_gtd) in eax.
62
proc usb1_allocate_general_td
62
proc usb1_allocate_general_td
63
        push    ebx
63
        push    ebx
64
        mov     ebx, usb_gtd_mutex
64
        mov     ebx, usb_gtd_mutex
65
        stdcall usb_allocate_common, sizeof.ohci_gtd
65
        stdcall usb_allocate_common, (sizeof.ohci_gtd + sizeof.usb_gtd + 0Fh) and not 0Fh
66
        test    eax, eax
66
        test    eax, eax
Line 67... Line 67...
67
        jz      @f
67
        jz      @f
68
        add     eax, ohci_gtd.SoftwarePart
68
        add     eax, sizeof.ohci_gtd
69
@@:
69
@@:
70
        pop     ebx
70
        pop     ebx
71
        ret
71
        ret
72
endp
72
endp
Line 73... Line 73...
73
 
73
 
74
; Free one general transfer descriptor structure for UHCI/OHCI.
74
; Free one general transfer descriptor structure for UHCI/OHCI.