HH
VS1005 VSOS A
UDIO
S
UBSYSTEM
VS1005g
11
VSOS Audio ioctl() Controls
VSOS Audio Drivers can be controlled from C language using ioctl() controls declared
in <aucommon.h>.
There are many more definitions in the #include file <aucommon.h>. Refer to the doc-
umentation of the specific drivers you use for exact details on what of these functions
they support and how to get access to a file pointer for that driver.
The ioctl() function prototype is
s_int16 ioctl(void *p, register int request, register char *arg);
where
p
is the file or device pointer (e.g.
stdaudioin
or
stdaudioout
),
request
is the
type of the request, and
arg
is the optional argument.
ioctl() returns
S_ERROR
(-1) for an error (there was an error in the parameters, or the
ioctl() for the
request
doesn’t exist in this driver), any other value for success.
Generally, for functions that set a value, if
arg
is a pointer or a 16-bit calue, it is casted to
c
char *
and passed to the function (e.g. IOCTL_AUDIO_SET_BITS in Chapter 11.2.5).
If
arg
is a larger entity (e.g. 32-bit number), a pointer to the value is passed instead (e.g.
IOCTL_AUDIO_SET_ORATE in Chapter 11.2.3).
Again, generally, for functions that return a 16-bit value where
S_ERROR
(-1) isn’t included
in the valid value range, the value is returned directly (e.g. IOCTL_AUDIO_GET_BITS
in Chapter 11.2.4). Otherwise, the user needs to transmit a pointer to the return value in
arg
(e.g. IOCTL_AUDIO_GET_ORATE in Chapter 11.2.2). Not that in both cases ioctl()
returns
S_ERROR
(-1) if there was an error in the call.
11.1
Resetting a Driver
11.1.1
IOCTL_RESTART
Restart driver. Normally this needs never be done.
Example:
ioctl(fp, IOCTL_RESTART, NULL);
Rev. 3.57
2019-04-10
Page