forked from KolibriOS/kolibrios
infinity.asm: add SND_GETFREESPACE call
git-svn-id: svn://kolibrios.org@572 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
f1bb02a02c
commit
6aaa312f13
@ -5,6 +5,10 @@
|
|||||||
;; ;;
|
;; ;;
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
|
|
||||||
|
AD_LOSEL equ BIT5
|
||||||
|
AD_HPSEL equ BIT10
|
||||||
|
|
||||||
align 4
|
align 4
|
||||||
proc detect_codec
|
proc detect_codec
|
||||||
locals
|
locals
|
||||||
@ -162,6 +166,14 @@ proc set_sample_rate stdcall, rate:dword
|
|||||||
ret
|
ret
|
||||||
endp
|
endp
|
||||||
|
|
||||||
|
patch_AD:
|
||||||
|
stdcall codec_read, 0x76
|
||||||
|
or ax, BIT5+BIT10
|
||||||
|
stdcall codec_write, 0x76
|
||||||
|
ret
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
align 16
|
align 16
|
||||||
ac_unknown db 'unknown manufacturer',13,10,0
|
ac_unknown db 'unknown manufacturer',13,10,0
|
||||||
ac_Realtek db 'Realtek Semiconductor',13,10,0
|
ac_Realtek db 'Realtek Semiconductor',13,10,0
|
||||||
|
@ -198,7 +198,7 @@ proc service_proc stdcall, ioctl:dword
|
|||||||
@@:
|
@@:
|
||||||
cmp eax, SND_SETFORMAT
|
cmp eax, SND_SETFORMAT
|
||||||
jne @F
|
jne @F
|
||||||
stdcall SetFormat,[ebx],[ebx+4]
|
stdcall SetFormat,edx,[ebx+4]
|
||||||
ret
|
ret
|
||||||
@@:
|
@@:
|
||||||
cmp eax, SND_GETFORMAT
|
cmp eax, SND_GETFORMAT
|
||||||
@ -213,17 +213,17 @@ proc service_proc stdcall, ioctl:dword
|
|||||||
@@:
|
@@:
|
||||||
cmp eax, SND_RESET
|
cmp eax, SND_RESET
|
||||||
jne @F
|
jne @F
|
||||||
stdcall ResetBuffer,[ebx],[ebx+4]
|
stdcall ResetBuffer,edx,[ebx+4]
|
||||||
ret
|
ret
|
||||||
@@:
|
@@:
|
||||||
cmp eax, SND_SETPOS
|
cmp eax, SND_SETPOS
|
||||||
jne @F
|
jne @F
|
||||||
stdcall SetBufferPos,[ebx],[ebx+4]
|
stdcall SetBufferPos,edx,[ebx+4]
|
||||||
ret
|
ret
|
||||||
@@:
|
@@:
|
||||||
cmp eax, SND_GETPOS
|
cmp eax, SND_GETPOS
|
||||||
jne @F
|
jne @F
|
||||||
stdcall GetBufferPos, [ebx]
|
stdcall GetBufferPos, edx
|
||||||
mov edi, [ioctl]
|
mov edi, [ioctl]
|
||||||
mov ecx, [edi+output]
|
mov ecx, [edi+output]
|
||||||
mov ecx, [ecx]
|
mov ecx, [ecx]
|
||||||
@ -233,12 +233,12 @@ proc service_proc stdcall, ioctl:dword
|
|||||||
cmp eax, SND_SETBUFF
|
cmp eax, SND_SETBUFF
|
||||||
jne @F
|
jne @F
|
||||||
mov eax, [ebx+4]
|
mov eax, [ebx+4]
|
||||||
stdcall set_buffer, [ebx],eax,[ebx+8],[ebx+12]
|
stdcall set_buffer, edx,eax,[ebx+8],[ebx+12]
|
||||||
ret
|
ret
|
||||||
@@:
|
@@:
|
||||||
cmp eax, SND_SETVOLUME
|
cmp eax, SND_SETVOLUME
|
||||||
jne @F
|
jne @F
|
||||||
stdcall SetBufferVol,[ebx],[ebx+4],[ebx+8]
|
stdcall SetBufferVol,edx,[ebx+4],[ebx+8]
|
||||||
ret
|
ret
|
||||||
@@:
|
@@:
|
||||||
cmp eax, SND_GETVOLUME
|
cmp eax, SND_GETVOLUME
|
||||||
@ -247,12 +247,12 @@ proc service_proc stdcall, ioctl:dword
|
|||||||
mov eax, [edi+output]
|
mov eax, [edi+output]
|
||||||
mov ecx, [eax]
|
mov ecx, [eax]
|
||||||
mov eax, [eax+4]
|
mov eax, [eax+4]
|
||||||
stdcall GetBufferVol,[ebx],ecx,eax
|
stdcall GetBufferVol,edx,ecx,eax
|
||||||
ret
|
ret
|
||||||
@@:
|
@@:
|
||||||
cmp eax, SND_SETPAN
|
cmp eax, SND_SETPAN
|
||||||
jne @F
|
jne @F
|
||||||
stdcall SetBufferPan,[ebx],[ebx+4]
|
stdcall SetBufferPan,edx,[ebx+4]
|
||||||
ret
|
ret
|
||||||
@@:
|
@@:
|
||||||
cmp eax, SND_GETPAN
|
cmp eax, SND_GETPAN
|
||||||
@ -268,19 +268,19 @@ proc service_proc stdcall, ioctl:dword
|
|||||||
jne @F
|
jne @F
|
||||||
|
|
||||||
mov eax, [ebx+4]
|
mov eax, [ebx+4]
|
||||||
stdcall wave_out, [ebx],eax,[ebx+8]
|
stdcall wave_out, edx,eax,[ebx+8]
|
||||||
ret
|
ret
|
||||||
@@:
|
@@:
|
||||||
cmp eax, SND_PLAY
|
cmp eax, SND_PLAY
|
||||||
jne @F
|
jne @F
|
||||||
|
|
||||||
stdcall play_buffer, [ebx],[ebx+4]
|
stdcall play_buffer, edx,[ebx+4]
|
||||||
ret
|
ret
|
||||||
@@:
|
@@:
|
||||||
cmp eax, SND_STOP
|
cmp eax, SND_STOP
|
||||||
jne @F
|
jne @F
|
||||||
|
|
||||||
stdcall stop_buffer, [ebx]
|
stdcall stop_buffer, edx
|
||||||
ret
|
ret
|
||||||
@@:
|
@@:
|
||||||
cmp eax, SND_GETBUFFSIZE
|
cmp eax, SND_GETBUFFSIZE
|
||||||
@ -291,6 +291,18 @@ proc service_proc stdcall, ioctl:dword
|
|||||||
mov [ecx], eax
|
mov [ecx], eax
|
||||||
xor eax, eax
|
xor eax, eax
|
||||||
ret
|
ret
|
||||||
|
@@:
|
||||||
|
cmp eax, SND_GETFREESPACE
|
||||||
|
jne @F
|
||||||
|
|
||||||
|
test [edx+STREAM.format], PCM_OUT
|
||||||
|
jz .fail
|
||||||
|
|
||||||
|
mov ebx, [edx+STREAM.in_free]
|
||||||
|
mov ecx, [edi+output]
|
||||||
|
mov [ecx], ebx
|
||||||
|
xor eax, eax
|
||||||
|
ret
|
||||||
@@:
|
@@:
|
||||||
.fail:
|
.fail:
|
||||||
or eax, -1
|
or eax, -1
|
||||||
|
@ -90,6 +90,7 @@ SND_GETVOLUME equ 13
|
|||||||
SND_SETPAN equ 14
|
SND_SETPAN equ 14
|
||||||
SND_GETPAN equ 15
|
SND_GETPAN equ 15
|
||||||
SND_GETBUFFSIZE equ 16
|
SND_GETBUFFSIZE equ 16
|
||||||
|
SND_GETFREESPACE equ 17
|
||||||
|
|
||||||
struc STREAM
|
struc STREAM
|
||||||
{
|
{
|
||||||
|
115
kernel/trunk/drivers/usb/urb.inc
Normal file
115
kernel/trunk/drivers/usb/urb.inc
Normal file
@ -0,0 +1,115 @@
|
|||||||
|
|
||||||
|
struc URB
|
||||||
|
{
|
||||||
|
.fd dd ?
|
||||||
|
.bk dd ?
|
||||||
|
.dev dd ? ; pointer to associated device
|
||||||
|
.pipe dd ? ; pipe information
|
||||||
|
.status dd ? ; non-ISO status
|
||||||
|
.transfer_flags dd ? ; URB_SHORT_NOT_OK | ...
|
||||||
|
.transfer_buffer dd ? ; associated data buffer
|
||||||
|
.transfer_dma dd ? ; dma addr for transfer_buffer
|
||||||
|
.transfer_buffer_length dd ? ; data buffer length
|
||||||
|
.actual_length dd ? ; actual transfer length
|
||||||
|
.setup_packet dd ? ; setup packet (control only)
|
||||||
|
.setup_dma dd ? ; dma addr for setup_packet
|
||||||
|
.start_frame dd ? ; start frame (ISO)
|
||||||
|
.number_of_packets dd ? ; number of ISO packets
|
||||||
|
.interval dd ? ; transfer interval
|
||||||
|
|
||||||
|
.error_count dd ? ; number of ISO errors
|
||||||
|
.context dd ? ; context for completion
|
||||||
|
.complete dd ? ; (in) completion routine
|
||||||
|
.iso_frame_desc:
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual at 0
|
||||||
|
URB URB
|
||||||
|
end virtual
|
||||||
|
|
||||||
|
|
||||||
|
struc REQ ;usb request
|
||||||
|
{
|
||||||
|
.request_type db ?
|
||||||
|
.request db ?
|
||||||
|
.value dw ?
|
||||||
|
.index dw ?
|
||||||
|
.length dw ?
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual at 0
|
||||||
|
REQ REQ
|
||||||
|
end virtual
|
||||||
|
|
||||||
|
align 4
|
||||||
|
proc usb_control_msg stdcall, dev:dword, pipe:dword, request:dword,\
|
||||||
|
requesttype:dword, value:dword, index:dword,\
|
||||||
|
data:dword, size:dword, timeout:dword
|
||||||
|
|
||||||
|
locals
|
||||||
|
req REQ
|
||||||
|
endl
|
||||||
|
|
||||||
|
lea eax, [req]
|
||||||
|
mov ecx, [request]
|
||||||
|
mov ebx, [requesttupe]
|
||||||
|
mov edx, [value]
|
||||||
|
mov esi, [index]
|
||||||
|
mov edi, [size]
|
||||||
|
|
||||||
|
mov [eax+REQ.request_type], bl
|
||||||
|
mov [eax+REQ.request], cl
|
||||||
|
mov [eax+REQ.value], dx
|
||||||
|
mov [eax+REQ.index], si
|
||||||
|
mov [eax+REQ.length], di
|
||||||
|
|
||||||
|
stdcall usb_internal_control_msg, [dev], [pipe],\
|
||||||
|
eax, [data], [size], [timeout]
|
||||||
|
|
||||||
|
ret
|
||||||
|
endp
|
||||||
|
|
||||||
|
|
||||||
|
; returns status (negative) or length (positive)
|
||||||
|
static int usb_internal_control_msg(struct usb_device *usb_dev,
|
||||||
|
unsigned int pipe,
|
||||||
|
struct usb_ctrlrequest *cmd,
|
||||||
|
void *data, int len, int timeout)
|
||||||
|
{
|
||||||
|
struct urb *urb;
|
||||||
|
int retv;
|
||||||
|
int length;
|
||||||
|
|
||||||
|
urb = usb_alloc_urb(0, GFP_NOIO);
|
||||||
|
if (!urb)
|
||||||
|
return -ENOMEM;
|
||||||
|
usb_fill_control_urb(urb, usb_dev, pipe, (unsigned char *)cmd, data,
|
||||||
|
len, usb_api_blocking_completion, NULL);
|
||||||
|
|
||||||
|
retv = usb_start_wait_urb(urb, timeout, &length);
|
||||||
|
if (retv < 0)
|
||||||
|
return retv;
|
||||||
|
else
|
||||||
|
return length;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void usb_fill_control_urb (struct urb *urb,
|
||||||
|
struct usb_device *dev,
|
||||||
|
unsigned int pipe,
|
||||||
|
unsigned char *setup_packet,
|
||||||
|
void *transfer_buffer,
|
||||||
|
int buffer_length,
|
||||||
|
usb_complete_t complete_fn,
|
||||||
|
void *context)
|
||||||
|
{
|
||||||
|
|
||||||
|
urb->dev = dev;
|
||||||
|
urb->pipe = pipe;
|
||||||
|
urb->setup_packet = setup_packet;
|
||||||
|
urb->transfer_buffer = transfer_buffer;
|
||||||
|
urb->transfer_buffer_length = buffer_length;
|
||||||
|
urb->complete = complete_fn;
|
||||||
|
urb->context = context;
|
||||||
|
}
|
||||||
|
|
@ -13,6 +13,7 @@ API_VERSION equ 0 ;debug
|
|||||||
|
|
||||||
include '../proc32.inc'
|
include '../proc32.inc'
|
||||||
include '../imports.inc'
|
include '../imports.inc'
|
||||||
|
include 'urb.inc'
|
||||||
|
|
||||||
struc UHCI
|
struc UHCI
|
||||||
{
|
{
|
||||||
@ -371,6 +372,42 @@ proc insert_td stdcall, td:dword, frame:dword
|
|||||||
ret
|
ret
|
||||||
endp
|
endp
|
||||||
|
|
||||||
|
|
||||||
|
align 4
|
||||||
|
proc usb_get_descriptor stdcall, dev:dword, type:dword, index:dword,\
|
||||||
|
buf:dword, size:dword
|
||||||
|
|
||||||
|
locals
|
||||||
|
count dd ?
|
||||||
|
endl
|
||||||
|
|
||||||
|
mov esi, [buf]
|
||||||
|
mov ecx, [size]
|
||||||
|
xor eax, eax
|
||||||
|
cld
|
||||||
|
rep stosb
|
||||||
|
|
||||||
|
mov [count], 3
|
||||||
|
@@:
|
||||||
|
mov eax, [type]
|
||||||
|
shl eax, 8
|
||||||
|
add eax, [index]
|
||||||
|
stdcall usb_control_msg, [dev],pipe,USB_REQ_GET_DESCRIPTOR,\
|
||||||
|
USB_DIR_IN, eax,0,[buf], [size],\
|
||||||
|
USB_CTRL_GET_TIMEOUT
|
||||||
|
test eax, eax
|
||||||
|
jz .next
|
||||||
|
cmp eax, -1
|
||||||
|
je .next
|
||||||
|
jmp. ok
|
||||||
|
.next:
|
||||||
|
dec [count]
|
||||||
|
jnz @B
|
||||||
|
mov eax, -1
|
||||||
|
.ok:
|
||||||
|
ret
|
||||||
|
endp
|
||||||
|
|
||||||
DEVICE_ID equ 0x24D2 ; pci device id
|
DEVICE_ID equ 0x24D2 ; pci device id
|
||||||
VENDOR_ID equ 0x8086 ; device vendor id
|
VENDOR_ID equ 0x8086 ; device vendor id
|
||||||
QEMU_USB equ 0x7020
|
QEMU_USB equ 0x7020
|
||||||
|
Loading…
Reference in New Issue
Block a user