|
Packit Service |
db8eaa |
/**
|
|
Packit Service |
db8eaa |
* \file hwdep/hwdep.c
|
|
Packit Service |
db8eaa |
* \brief HwDep Interface (hardware dependent)
|
|
Packit Service |
db8eaa |
* \author Jaroslav Kysela <perex@perex.cz>
|
|
Packit Service |
db8eaa |
* \date 2000-2001
|
|
Packit Service |
db8eaa |
*
|
|
Packit Service |
db8eaa |
* HwDep (hardware dependent) Interface is designed for individual hardware
|
|
Packit Service |
db8eaa |
* access. This interface does not cover any API specification.
|
|
Packit Service |
db8eaa |
*/
|
|
Packit Service |
db8eaa |
/*
|
|
Packit Service |
db8eaa |
* Hardware dependent Interface - main file
|
|
Packit Service |
db8eaa |
* Copyright (c) 2000 by Jaroslav Kysela <perex@perex.cz>
|
|
Packit Service |
db8eaa |
*
|
|
Packit Service |
db8eaa |
*
|
|
Packit Service |
db8eaa |
* This library is free software; you can redistribute it and/or modify
|
|
Packit Service |
db8eaa |
* it under the terms of the GNU Lesser General Public License as
|
|
Packit Service |
db8eaa |
* published by the Free Software Foundation; either version 2.1 of
|
|
Packit Service |
db8eaa |
* the License, or (at your option) any later version.
|
|
Packit Service |
db8eaa |
*
|
|
Packit Service |
db8eaa |
* This program is distributed in the hope that it will be useful,
|
|
Packit Service |
db8eaa |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Packit Service |
db8eaa |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
Packit Service |
db8eaa |
* GNU Lesser General Public License for more details.
|
|
Packit Service |
db8eaa |
*
|
|
Packit Service |
db8eaa |
* You should have received a copy of the GNU Lesser General Public
|
|
Packit Service |
db8eaa |
* License along with this library; if not, write to the Free Software
|
|
Packit Service |
db8eaa |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
Packit Service |
db8eaa |
*
|
|
Packit Service |
db8eaa |
*/
|
|
Packit Service |
db8eaa |
|
|
Packit Service |
db8eaa |
#include <stdio.h>
|
|
Packit Service |
db8eaa |
#include <stdlib.h>
|
|
Packit Service |
db8eaa |
#include <unistd.h>
|
|
Packit Service |
db8eaa |
#include <string.h>
|
|
Packit Service |
db8eaa |
#include <fcntl.h>
|
|
Packit Service |
db8eaa |
#include <sys/ioctl.h>
|
|
Packit Service |
db8eaa |
#include "hwdep_local.h"
|
|
Packit Service |
db8eaa |
|
|
Packit Service |
db8eaa |
static int snd_hwdep_open_conf(snd_hwdep_t **hwdep,
|
|
Packit Service |
db8eaa |
const char *name, snd_config_t *hwdep_root,
|
|
Packit Service |
db8eaa |
snd_config_t *hwdep_conf, int mode)
|
|
Packit Service |
db8eaa |
{
|
|
Packit Service |
db8eaa |
const char *str;
|
|
Packit Service |
db8eaa |
char buf[256], errbuf[256];
|
|
Packit Service |
db8eaa |
int err;
|
|
Packit Service |
db8eaa |
snd_config_t *conf, *type_conf = NULL;
|
|
Packit Service |
db8eaa |
snd_config_iterator_t i, next;
|
|
Packit Service |
db8eaa |
const char *id;
|
|
Packit Service |
db8eaa |
const char *lib = NULL, *open_name = NULL;
|
|
Packit Service |
db8eaa |
int (*open_func)(snd_hwdep_t **, const char *, snd_config_t *, snd_config_t *, int) = NULL;
|
|
Packit Service |
db8eaa |
#ifndef PIC
|
|
Packit Service |
db8eaa |
extern void *snd_hwdep_open_symbols(void);
|
|
Packit Service |
db8eaa |
#endif
|
|
Packit Service |
db8eaa |
void *h = NULL;
|
|
Packit Service |
db8eaa |
if (snd_config_get_type(hwdep_conf) != SND_CONFIG_TYPE_COMPOUND) {
|
|
Packit Service |
db8eaa |
if (name)
|
|
Packit Service |
db8eaa |
SNDERR("Invalid type for HWDEP %s definition", name);
|
|
Packit Service |
db8eaa |
else
|
|
Packit Service |
db8eaa |
SNDERR("Invalid type for HWDEP definition");
|
|
Packit Service |
db8eaa |
return -EINVAL;
|
|
Packit Service |
db8eaa |
}
|
|
Packit Service |
db8eaa |
err = snd_config_search(hwdep_conf, "type", &conf;;
|
|
Packit Service |
db8eaa |
if (err < 0) {
|
|
Packit Service |
db8eaa |
SNDERR("type is not defined");
|
|
Packit Service |
db8eaa |
return err;
|
|
Packit Service |
db8eaa |
}
|
|
Packit Service |
db8eaa |
err = snd_config_get_id(conf, &id;;
|
|
Packit Service |
db8eaa |
if (err < 0) {
|
|
Packit Service |
db8eaa |
SNDERR("unable to get id");
|
|
Packit Service |
db8eaa |
return err;
|
|
Packit Service |
db8eaa |
}
|
|
Packit Service |
db8eaa |
err = snd_config_get_string(conf, &str);
|
|
Packit Service |
db8eaa |
if (err < 0) {
|
|
Packit Service |
db8eaa |
SNDERR("Invalid type for %s", id);
|
|
Packit Service |
db8eaa |
return err;
|
|
Packit Service |
db8eaa |
}
|
|
Packit Service |
db8eaa |
err = snd_config_search_definition(hwdep_root, "hwdep_type", str, &type_conf);
|
|
Packit Service |
db8eaa |
if (err >= 0) {
|
|
Packit Service |
db8eaa |
if (snd_config_get_type(type_conf) != SND_CONFIG_TYPE_COMPOUND) {
|
|
Packit Service |
db8eaa |
SNDERR("Invalid type for HWDEP type %s definition", str);
|
|
Packit Service |
db8eaa |
err = -EINVAL;
|
|
Packit Service |
db8eaa |
goto _err;
|
|
Packit Service |
db8eaa |
}
|
|
Packit Service |
db8eaa |
snd_config_for_each(i, next, type_conf) {
|
|
Packit Service |
db8eaa |
snd_config_t *n = snd_config_iterator_entry(i);
|
|
Packit Service |
db8eaa |
const char *id;
|
|
Packit Service |
db8eaa |
if (snd_config_get_id(n, &id) < 0)
|
|
Packit Service |
db8eaa |
continue;
|
|
Packit Service |
db8eaa |
if (strcmp(id, "comment") == 0)
|
|
Packit Service |
db8eaa |
continue;
|
|
Packit Service |
db8eaa |
if (strcmp(id, "lib") == 0) {
|
|
Packit Service |
db8eaa |
err = snd_config_get_string(n, &lib);
|
|
Packit Service |
db8eaa |
if (err < 0) {
|
|
Packit Service |
db8eaa |
SNDERR("Invalid type for %s", id);
|
|
Packit Service |
db8eaa |
goto _err;
|
|
Packit Service |
db8eaa |
}
|
|
Packit Service |
db8eaa |
continue;
|
|
Packit Service |
db8eaa |
}
|
|
Packit Service |
db8eaa |
if (strcmp(id, "open") == 0) {
|
|
Packit Service |
db8eaa |
err = snd_config_get_string(n, &open_name);
|
|
Packit Service |
db8eaa |
if (err < 0) {
|
|
Packit Service |
db8eaa |
SNDERR("Invalid type for %s", id);
|
|
Packit Service |
db8eaa |
goto _err;
|
|
Packit Service |
db8eaa |
}
|
|
Packit Service |
db8eaa |
continue;
|
|
Packit Service |
db8eaa |
}
|
|
Packit Service |
db8eaa |
SNDERR("Unknown field %s", id);
|
|
Packit Service |
db8eaa |
err = -EINVAL;
|
|
Packit Service |
db8eaa |
goto _err;
|
|
Packit Service |
db8eaa |
}
|
|
Packit Service |
db8eaa |
}
|
|
Packit Service |
db8eaa |
if (!open_name) {
|
|
Packit Service |
db8eaa |
open_name = buf;
|
|
Packit Service |
db8eaa |
snprintf(buf, sizeof(buf), "_snd_hwdep_%s_open", str);
|
|
Packit Service |
db8eaa |
}
|
|
Packit Service |
db8eaa |
#ifndef PIC
|
|
Packit Service |
db8eaa |
snd_hwdep_open_symbols();
|
|
Packit Service |
db8eaa |
#endif
|
|
Packit Service |
db8eaa |
h = INTERNAL(snd_dlopen)(lib, RTLD_NOW, errbuf, sizeof(errbuf));
|
|
Packit Service |
db8eaa |
if (h)
|
|
Packit Service |
db8eaa |
open_func = snd_dlsym(h, open_name, SND_DLSYM_VERSION(SND_HWDEP_DLSYM_VERSION));
|
|
Packit Service |
db8eaa |
err = 0;
|
|
Packit Service |
db8eaa |
if (!h) {
|
|
Packit Service |
db8eaa |
SNDERR("Cannot open shared library %s (%s)", lib, errbuf);
|
|
Packit Service |
db8eaa |
err = -ENOENT;
|
|
Packit Service |
db8eaa |
} else if (!open_func) {
|
|
Packit Service |
db8eaa |
SNDERR("symbol %s is not defined inside %s", open_name, lib);
|
|
Packit Service |
db8eaa |
snd_dlclose(h);
|
|
Packit Service |
db8eaa |
err = -ENXIO;
|
|
Packit Service |
db8eaa |
}
|
|
Packit Service |
db8eaa |
_err:
|
|
Packit Service |
db8eaa |
if (type_conf)
|
|
Packit Service |
db8eaa |
snd_config_delete(type_conf);
|
|
Packit Service |
db8eaa |
if (err >= 0) {
|
|
Packit Service |
db8eaa |
err = open_func(hwdep, name, hwdep_root, hwdep_conf, mode);
|
|
Packit Service |
db8eaa |
if (err >= 0) {
|
|
Packit Service |
db8eaa |
(*hwdep)->dl_handle = h;
|
|
Packit Service |
db8eaa |
} else {
|
|
Packit Service |
db8eaa |
snd_dlclose(h);
|
|
Packit Service |
db8eaa |
}
|
|
Packit Service |
db8eaa |
}
|
|
Packit Service |
db8eaa |
return err;
|
|
Packit Service |
db8eaa |
}
|
|
Packit Service |
db8eaa |
|
|
Packit Service |
db8eaa |
static int snd_hwdep_open_noupdate(snd_hwdep_t **hwdep, snd_config_t *root, const char *name, int mode)
|
|
Packit Service |
db8eaa |
{
|
|
Packit Service |
db8eaa |
int err;
|
|
Packit Service |
db8eaa |
snd_config_t *hwdep_conf;
|
|
Packit Service |
db8eaa |
err = snd_config_search_definition(root, "hwdep", name, &hwdep_conf);
|
|
Packit Service |
db8eaa |
if (err < 0) {
|
|
Packit Service |
db8eaa |
SNDERR("Unknown HwDep %s", name);
|
|
Packit Service |
db8eaa |
return err;
|
|
Packit Service |
db8eaa |
}
|
|
Packit Service |
db8eaa |
err = snd_hwdep_open_conf(hwdep, name, root, hwdep_conf, mode);
|
|
Packit Service |
db8eaa |
snd_config_delete(hwdep_conf);
|
|
Packit Service |
db8eaa |
return err;
|
|
Packit Service |
db8eaa |
}
|
|
Packit Service |
db8eaa |
|
|
Packit Service |
db8eaa |
/**
|
|
Packit Service |
db8eaa |
* \brief Opens a new connection to the HwDep interface.
|
|
Packit Service |
db8eaa |
* \param hwdep Returned handle (NULL if not wanted)
|
|
Packit Service |
db8eaa |
* \param name ASCII identifier of the HwDep handle
|
|
Packit Service |
db8eaa |
* \param mode Open mode
|
|
Packit Service |
db8eaa |
* \return 0 on success otherwise a negative error code
|
|
Packit Service |
db8eaa |
*
|
|
Packit Service |
db8eaa |
* Opens a new connection to the HwDep interface specified with
|
|
Packit Service |
db8eaa |
* an ASCII identifier and mode.
|
|
Packit Service |
db8eaa |
*/
|
|
Packit Service |
db8eaa |
int snd_hwdep_open(snd_hwdep_t **hwdep, const char *name, int mode)
|
|
Packit Service |
db8eaa |
{
|
|
Packit Service |
db8eaa |
snd_config_t *top;
|
|
Packit Service |
db8eaa |
int err;
|
|
Packit Service |
db8eaa |
|
|
Packit Service |
db8eaa |
assert(hwdep && name);
|
|
Packit Service |
db8eaa |
err = snd_config_update_ref(&top);
|
|
Packit Service |
db8eaa |
if (err < 0)
|
|
Packit Service |
db8eaa |
return err;
|
|
Packit Service |
db8eaa |
err = snd_hwdep_open_noupdate(hwdep, top, name, mode);
|
|
Packit Service |
db8eaa |
snd_config_unref(top);
|
|
Packit Service |
db8eaa |
return err;
|
|
Packit Service |
db8eaa |
}
|
|
Packit Service |
db8eaa |
|
|
Packit Service |
db8eaa |
/**
|
|
Packit Service |
db8eaa |
* \brief Opens a new connection to the HwDep interface using local configuration
|
|
Packit Service |
db8eaa |
* \param hwdep Returned handle (NULL if not wanted)
|
|
Packit Service |
db8eaa |
* \param name ASCII identifier of the HwDep handle
|
|
Packit Service |
db8eaa |
* \param mode Open mode
|
|
Packit Service |
db8eaa |
* \param lconf The local configuration tree
|
|
Packit Service |
db8eaa |
* \return 0 on success otherwise a negative error code
|
|
Packit Service |
db8eaa |
*
|
|
Packit Service |
db8eaa |
* Opens a new connection to the HwDep interface specified with
|
|
Packit Service |
db8eaa |
* an ASCII identifier and mode.
|
|
Packit Service |
db8eaa |
*/
|
|
Packit Service |
db8eaa |
int snd_hwdep_open_lconf(snd_hwdep_t **hwdep, const char *name,
|
|
Packit Service |
db8eaa |
int mode, snd_config_t *lconf)
|
|
Packit Service |
db8eaa |
{
|
|
Packit Service |
db8eaa |
assert(hwdep && name && lconf);
|
|
Packit Service |
db8eaa |
return snd_hwdep_open_noupdate(hwdep, lconf, name, mode);
|
|
Packit Service |
db8eaa |
}
|
|
Packit Service |
db8eaa |
|
|
Packit Service |
db8eaa |
/**
|
|
Packit Service |
db8eaa |
* \brief close HwDep handle
|
|
Packit Service |
db8eaa |
* \param hwdep HwDep handle
|
|
Packit Service |
db8eaa |
* \return 0 on success otherwise a negative error code
|
|
Packit Service |
db8eaa |
*
|
|
Packit Service |
db8eaa |
* Closes the specified HwDep handle and frees all associated
|
|
Packit Service |
db8eaa |
* resources.
|
|
Packit Service |
db8eaa |
*/
|
|
Packit Service |
db8eaa |
int snd_hwdep_close(snd_hwdep_t *hwdep)
|
|
Packit Service |
db8eaa |
{
|
|
Packit Service |
db8eaa |
int err;
|
|
Packit Service |
db8eaa |
assert(hwdep);
|
|
Packit Service |
db8eaa |
err = hwdep->ops->close(hwdep);
|
|
Packit Service |
db8eaa |
if (hwdep->dl_handle)
|
|
Packit Service |
db8eaa |
snd_dlclose(hwdep->dl_handle);
|
|
Packit Service |
db8eaa |
free(hwdep->name);
|
|
Packit Service |
db8eaa |
free(hwdep);
|
|
Packit Service |
db8eaa |
return err;
|
|
Packit Service |
db8eaa |
}
|
|
Packit Service |
db8eaa |
|
|
Packit Service |
db8eaa |
/**
|
|
Packit Service |
db8eaa |
* \brief get identifier of HwDep handle
|
|
Packit Service |
db8eaa |
* \param hwdep a Hwdep handle
|
|
Packit Service |
db8eaa |
* \return ascii identifier of HwDep handle
|
|
Packit Service |
db8eaa |
*
|
|
Packit Service |
db8eaa |
* Returns the ASCII identifier of given HwDep handle. It's the same
|
|
Packit Service |
db8eaa |
* identifier specified in snd_hwdep_open().
|
|
Packit Service |
db8eaa |
*/
|
|
Packit Service |
db8eaa |
const char *snd_hwdep_name(snd_hwdep_t *hwdep)
|
|
Packit Service |
db8eaa |
{
|
|
Packit Service |
db8eaa |
assert(hwdep);
|
|
Packit Service |
db8eaa |
return hwdep->name;
|
|
Packit Service |
db8eaa |
}
|
|
Packit Service |
db8eaa |
|
|
Packit Service |
db8eaa |
/**
|
|
Packit Service |
db8eaa |
* \brief get type of HwDep handle
|
|
Packit Service |
db8eaa |
* \param hwdep a HwDep handle
|
|
Packit Service |
db8eaa |
* \return type of HwDep handle
|
|
Packit Service |
db8eaa |
*
|
|
Packit Service |
db8eaa |
* Returns the type #snd_hwdep_type_t of given HwDep handle.
|
|
Packit Service |
db8eaa |
*/
|
|
Packit Service |
db8eaa |
snd_hwdep_type_t snd_hwdep_type(snd_hwdep_t *hwdep)
|
|
Packit Service |
db8eaa |
{
|
|
Packit Service |
db8eaa |
assert(hwdep);
|
|
Packit Service |
db8eaa |
return hwdep->type;
|
|
Packit Service |
db8eaa |
}
|
|
Packit Service |
db8eaa |
|
|
Packit Service |
db8eaa |
/**
|
|
Packit Service |
db8eaa |
* \brief get count of poll descriptors for HwDep handle
|
|
Packit Service |
db8eaa |
* \param hwdep HwDep handle
|
|
Packit Service |
db8eaa |
* \return count of poll descriptors
|
|
Packit Service |
db8eaa |
*/
|
|
Packit Service |
db8eaa |
int snd_hwdep_poll_descriptors_count(snd_hwdep_t *hwdep)
|
|
Packit Service |
db8eaa |
{
|
|
Packit Service |
db8eaa |
assert(hwdep);
|
|
Packit Service |
db8eaa |
return 1;
|
|
Packit Service |
db8eaa |
}
|
|
Packit Service |
db8eaa |
|
|
Packit Service |
db8eaa |
/**
|
|
Packit Service |
db8eaa |
* \brief get poll descriptors
|
|
Packit Service |
db8eaa |
* \param hwdep HwDep handle
|
|
Packit Service |
db8eaa |
* \param pfds array of poll descriptors
|
|
Packit Service |
db8eaa |
* \param space space in the poll descriptor array
|
|
Packit Service |
db8eaa |
* \return count of filled descriptors
|
|
Packit Service |
db8eaa |
*/
|
|
Packit Service |
db8eaa |
int snd_hwdep_poll_descriptors(snd_hwdep_t *hwdep, struct pollfd *pfds, unsigned int space)
|
|
Packit Service |
db8eaa |
{
|
|
Packit Service |
db8eaa |
assert(hwdep);
|
|
Packit Service |
db8eaa |
if (space >= 1) {
|
|
Packit Service |
db8eaa |
pfds->fd = hwdep->poll_fd;
|
|
Packit Service |
db8eaa |
switch (hwdep->mode & O_ACCMODE) {
|
|
Packit Service |
db8eaa |
case O_WRONLY:
|
|
Packit Service |
db8eaa |
pfds->events = POLLOUT|POLLERR|POLLNVAL;
|
|
Packit Service |
db8eaa |
break;
|
|
Packit Service |
db8eaa |
case O_RDONLY:
|
|
Packit Service |
db8eaa |
pfds->events = POLLIN|POLLERR|POLLNVAL;
|
|
Packit Service |
db8eaa |
break;
|
|
Packit Service |
db8eaa |
case O_RDWR:
|
|
Packit Service |
db8eaa |
pfds->events = POLLOUT|POLLIN|POLLERR|POLLNVAL;
|
|
Packit Service |
db8eaa |
break;
|
|
Packit Service |
db8eaa |
default:
|
|
Packit Service |
db8eaa |
return -EIO;
|
|
Packit Service |
db8eaa |
}
|
|
Packit Service |
db8eaa |
return 1;
|
|
Packit Service |
db8eaa |
}
|
|
Packit Service |
db8eaa |
return 0;
|
|
Packit Service |
db8eaa |
}
|
|
Packit Service |
db8eaa |
|
|
Packit Service |
db8eaa |
/**
|
|
Packit Service |
db8eaa |
* \brief get returned events from poll descriptors
|
|
Packit Service |
db8eaa |
* \param hwdep HwDep handle
|
|
Packit Service |
db8eaa |
* \param pfds array of poll descriptors
|
|
Packit Service |
db8eaa |
* \param nfds count of poll descriptors
|
|
Packit Service |
db8eaa |
* \param revents returned events
|
|
Packit Service |
db8eaa |
* \return zero if success, otherwise a negative error code
|
|
Packit Service |
db8eaa |
*/
|
|
Packit Service |
db8eaa |
int snd_hwdep_poll_descriptors_revents(snd_hwdep_t *hwdep, struct pollfd *pfds, unsigned int nfds, unsigned short *revents)
|
|
Packit Service |
db8eaa |
{
|
|
Packit Service |
db8eaa |
assert(hwdep && pfds && revents);
|
|
Packit Service |
db8eaa |
if (nfds == 1) {
|
|
Packit Service |
db8eaa |
*revents = pfds->revents;
|
|
Packit Service |
db8eaa |
return 0;
|
|
Packit Service |
db8eaa |
}
|
|
Packit Service |
db8eaa |
return -EINVAL;
|
|
Packit Service |
db8eaa |
}
|
|
Packit Service |
db8eaa |
|
|
Packit Service |
db8eaa |
/**
|
|
Packit Service |
db8eaa |
* \brief set nonblock mode
|
|
Packit Service |
db8eaa |
* \param hwdep HwDep handle
|
|
Packit Service |
db8eaa |
* \param nonblock 0 = block, 1 = nonblock mode
|
|
Packit Service |
db8eaa |
* \return 0 on success otherwise a negative error code
|
|
Packit Service |
db8eaa |
*/
|
|
Packit Service |
db8eaa |
int snd_hwdep_nonblock(snd_hwdep_t *hwdep, int nonblock)
|
|
Packit Service |
db8eaa |
{
|
|
Packit Service |
db8eaa |
int err;
|
|
Packit Service |
db8eaa |
assert(hwdep);
|
|
Packit Service |
db8eaa |
if ((err = hwdep->ops->nonblock(hwdep, nonblock)) < 0)
|
|
Packit Service |
db8eaa |
return err;
|
|
Packit Service |
db8eaa |
if (nonblock)
|
|
Packit Service |
db8eaa |
hwdep->mode |= SND_HWDEP_OPEN_NONBLOCK;
|
|
Packit Service |
db8eaa |
else
|
|
Packit Service |
db8eaa |
hwdep->mode &= ~SND_HWDEP_OPEN_NONBLOCK;
|
|
Packit Service |
db8eaa |
return 0;
|
|
Packit Service |
db8eaa |
}
|
|
Packit Service |
db8eaa |
|
|
Packit Service |
db8eaa |
/**
|
|
Packit Service |
db8eaa |
* \brief get size of the snd_hwdep_info_t structure in bytes
|
|
Packit Service |
db8eaa |
* \return size of the snd_hwdep_info_t structure in bytes
|
|
Packit Service |
db8eaa |
*/
|
|
Packit Service |
db8eaa |
size_t snd_hwdep_info_sizeof()
|
|
Packit Service |
db8eaa |
{
|
|
Packit Service |
db8eaa |
return sizeof(snd_hwdep_info_t);
|
|
Packit Service |
db8eaa |
}
|
|
Packit Service |
db8eaa |
|
|
Packit Service |
db8eaa |
/**
|
|
Packit Service |
db8eaa |
* \brief allocate a new snd_hwdep_info_t structure
|
|
Packit Service |
db8eaa |
* \param info returned pointer
|
|
Packit Service |
db8eaa |
* \return 0 on success otherwise a negative error code if fails
|
|
Packit Service |
db8eaa |
*
|
|
Packit Service |
db8eaa |
* Allocates a new snd_hwdep_info_t structure using the standard
|
|
Packit Service |
db8eaa |
* malloc C library function.
|
|
Packit Service |
db8eaa |
*/
|
|
Packit Service |
db8eaa |
int snd_hwdep_info_malloc(snd_hwdep_info_t **info)
|
|
Packit Service |
db8eaa |
{
|
|
Packit Service |
db8eaa |
assert(info);
|
|
Packit Service |
db8eaa |
*info = calloc(1, sizeof(snd_hwdep_info_t));
|
|
Packit Service |
db8eaa |
if (!*info)
|
|
Packit Service |
db8eaa |
return -ENOMEM;
|
|
Packit Service |
db8eaa |
return 0;
|
|
Packit Service |
db8eaa |
}
|
|
Packit Service |
db8eaa |
|
|
Packit Service |
db8eaa |
/**
|
|
Packit Service |
db8eaa |
* \brief frees the snd_hwdep_info_t structure
|
|
Packit Service |
db8eaa |
* \param info pointer to the snd_hwdep_info_t structure to free
|
|
Packit Service |
db8eaa |
*
|
|
Packit Service |
db8eaa |
* Frees the given snd_hwdep_info_t structure using the standard
|
|
Packit Service |
db8eaa |
* free C library function.
|
|
Packit Service |
db8eaa |
*/
|
|
Packit Service |
db8eaa |
void snd_hwdep_info_free(snd_hwdep_info_t *info)
|
|
Packit Service |
db8eaa |
{
|
|
Packit Service |
db8eaa |
assert(info);
|
|
Packit Service |
db8eaa |
free(info);
|
|
Packit Service |
db8eaa |
}
|
|
Packit Service |
db8eaa |
|
|
Packit Service |
db8eaa |
/**
|
|
Packit Service |
db8eaa |
* \brief copy one snd_hwdep_info_t structure to another
|
|
Packit Service |
db8eaa |
* \param dst destination snd_hwdep_info_t structure
|
|
Packit Service |
db8eaa |
* \param src source snd_hwdep_info_t structure
|
|
Packit Service |
db8eaa |
*/
|
|
Packit Service |
db8eaa |
void snd_hwdep_info_copy(snd_hwdep_info_t *dst, const snd_hwdep_info_t *src)
|
|
Packit Service |
db8eaa |
{
|
|
Packit Service |
db8eaa |
assert(dst && src);
|
|
Packit Service |
db8eaa |
*dst = *src;
|
|
Packit Service |
db8eaa |
}
|
|
Packit Service |
db8eaa |
|
|
Packit Service |
db8eaa |
/**
|
|
Packit Service |
db8eaa |
* \brief get hwdep card number
|
|
Packit Service |
db8eaa |
* \param obj pointer to a snd_hwdep_info_t structure
|
|
Packit Service |
db8eaa |
* \return hwdep card number
|
|
Packit Service |
db8eaa |
*/
|
|
Packit Service |
db8eaa |
int snd_hwdep_info_get_card(const snd_hwdep_info_t *obj)
|
|
Packit Service |
db8eaa |
{
|
|
Packit Service |
db8eaa |
assert(obj);
|
|
Packit Service |
db8eaa |
return obj->card;
|
|
Packit Service |
db8eaa |
}
|
|
Packit Service |
db8eaa |
|
|
Packit Service |
db8eaa |
/**
|
|
Packit Service |
db8eaa |
* \brief get hwdep device number
|
|
Packit Service |
db8eaa |
* \param info pointer to a snd_hwdep_info_t structure
|
|
Packit Service |
db8eaa |
* \return hwdep device number
|
|
Packit Service |
db8eaa |
*/
|
|
Packit Service |
db8eaa |
unsigned int snd_hwdep_info_get_device(const snd_hwdep_info_t *info)
|
|
Packit Service |
db8eaa |
{
|
|
Packit Service |
db8eaa |
assert(info);
|
|
Packit Service |
db8eaa |
return info->device;
|
|
Packit Service |
db8eaa |
}
|
|
Packit Service |
db8eaa |
|
|
Packit Service |
db8eaa |
/**
|
|
Packit Service |
db8eaa |
* \brief get hwdep driver identifier
|
|
Packit Service |
db8eaa |
* \param obj pointer to a snd_hwdep_info_t structure
|
|
Packit Service |
db8eaa |
* \return hwdep driver identifier
|
|
Packit Service |
db8eaa |
*/
|
|
Packit Service |
db8eaa |
const char *snd_hwdep_info_get_id(const snd_hwdep_info_t *obj)
|
|
Packit Service |
db8eaa |
{
|
|
Packit Service |
db8eaa |
assert(obj);
|
|
Packit Service |
db8eaa |
return (const char *)obj->id;
|
|
Packit Service |
db8eaa |
}
|
|
Packit Service |
db8eaa |
|
|
Packit Service |
db8eaa |
/**
|
|
Packit Service |
db8eaa |
* \brief get hwdep driver name
|
|
Packit Service |
db8eaa |
* \param obj pointer to a snd_hwdep_info_t structure
|
|
Packit Service |
db8eaa |
* \return hwdep driver name
|
|
Packit Service |
db8eaa |
*/
|
|
Packit Service |
db8eaa |
const char *snd_hwdep_info_get_name(const snd_hwdep_info_t *obj)
|
|
Packit Service |
db8eaa |
{
|
|
Packit Service |
db8eaa |
assert(obj);
|
|
Packit Service |
db8eaa |
return (const char *)obj->name;
|
|
Packit Service |
db8eaa |
}
|
|
Packit Service |
db8eaa |
|
|
Packit Service |
db8eaa |
/**
|
|
Packit Service |
db8eaa |
* \brief get hwdep protocol interface
|
|
Packit Service |
db8eaa |
* \param obj pointer to a snd_hwdep_info_t structure
|
|
Packit Service |
db8eaa |
* \return hwdep protocol interface
|
|
Packit Service |
db8eaa |
*/
|
|
Packit Service |
db8eaa |
snd_hwdep_iface_t snd_hwdep_info_get_iface(const snd_hwdep_info_t *obj)
|
|
Packit Service |
db8eaa |
{
|
|
Packit Service |
db8eaa |
assert(obj);
|
|
Packit Service |
db8eaa |
return obj->iface;
|
|
Packit Service |
db8eaa |
}
|
|
Packit Service |
db8eaa |
|
|
Packit Service |
db8eaa |
/**
|
|
Packit Service |
db8eaa |
* \brief set hwdep device number
|
|
Packit Service |
db8eaa |
* \param obj pointer to a snd_hwdep_info_t structure
|
|
Packit Service |
db8eaa |
* \param val hwdep device
|
|
Packit Service |
db8eaa |
*/
|
|
Packit Service |
db8eaa |
void snd_hwdep_info_set_device(snd_hwdep_info_t *obj, unsigned int val)
|
|
Packit Service |
db8eaa |
{
|
|
Packit Service |
db8eaa |
assert(obj);
|
|
Packit Service |
db8eaa |
obj->device = val;
|
|
Packit Service |
db8eaa |
}
|
|
Packit Service |
db8eaa |
|
|
Packit Service |
db8eaa |
/**
|
|
Packit Service |
db8eaa |
* \brief get information about HwDep handle
|
|
Packit Service |
db8eaa |
* \param hwdep HwDep handle
|
|
Packit Service |
db8eaa |
* \param info pointer to a snd_hwdep_info_t structure to be filled
|
|
Packit Service |
db8eaa |
* \return 0 on success otherwise a negative error code
|
|
Packit Service |
db8eaa |
*/
|
|
Packit Service |
db8eaa |
int snd_hwdep_info(snd_hwdep_t *hwdep, snd_hwdep_info_t * info)
|
|
Packit Service |
db8eaa |
{
|
|
Packit Service |
db8eaa |
assert(hwdep);
|
|
Packit Service |
db8eaa |
assert(info);
|
|
Packit Service |
db8eaa |
return hwdep->ops->info(hwdep, info);
|
|
Packit Service |
db8eaa |
}
|
|
Packit Service |
db8eaa |
|
|
Packit Service |
db8eaa |
/**
|
|
Packit Service |
db8eaa |
* \brief do hardware dependent ioctl
|
|
Packit Service |
db8eaa |
* \param hwdep HwDep handle
|
|
Packit Service |
db8eaa |
* \param request ioctl command
|
|
Packit Service |
db8eaa |
* \param arg ioctl argument
|
|
Packit Service |
db8eaa |
* \return 0 on success otherwise a negative error code
|
|
Packit Service |
db8eaa |
*/
|
|
Packit Service |
db8eaa |
int snd_hwdep_ioctl(snd_hwdep_t *hwdep, unsigned int request, void * arg)
|
|
Packit Service |
db8eaa |
{
|
|
Packit Service |
db8eaa |
assert(hwdep);
|
|
Packit Service |
db8eaa |
return hwdep->ops->ioctl(hwdep, request, arg);
|
|
Packit Service |
db8eaa |
}
|
|
Packit Service |
db8eaa |
|
|
Packit Service |
db8eaa |
/**
|
|
Packit Service |
db8eaa |
* \brief write bytes using HwDep handle
|
|
Packit Service |
db8eaa |
* \param hwdep HwDep handle
|
|
Packit Service |
db8eaa |
* \param buffer buffer containing bytes to write
|
|
Packit Service |
db8eaa |
* \param size output buffer size in bytes
|
|
Packit Service |
db8eaa |
*/
|
|
Packit Service |
db8eaa |
ssize_t snd_hwdep_write(snd_hwdep_t *hwdep, const void *buffer, size_t size)
|
|
Packit Service |
db8eaa |
{
|
|
Packit Service |
db8eaa |
assert(hwdep);
|
|
Packit Service |
db8eaa |
assert(((hwdep->mode & O_ACCMODE) == O_WRONLY) || ((hwdep->mode & O_ACCMODE) == O_RDWR));
|
|
Packit Service |
db8eaa |
assert(buffer || size == 0);
|
|
Packit Service |
db8eaa |
return hwdep->ops->write(hwdep, buffer, size);
|
|
Packit Service |
db8eaa |
}
|
|
Packit Service |
db8eaa |
|
|
Packit Service |
db8eaa |
/**
|
|
Packit Service |
db8eaa |
* \brief read bytes using HwDep handle
|
|
Packit Service |
db8eaa |
* \param hwdep HwDep handle
|
|
Packit Service |
db8eaa |
* \param buffer buffer to store the input bytes
|
|
Packit Service |
db8eaa |
* \param size input buffer size in bytes
|
|
Packit Service |
db8eaa |
*/
|
|
Packit Service |
db8eaa |
ssize_t snd_hwdep_read(snd_hwdep_t *hwdep, void *buffer, size_t size)
|
|
Packit Service |
db8eaa |
{
|
|
Packit Service |
db8eaa |
assert(hwdep);
|
|
Packit Service |
db8eaa |
assert(((hwdep->mode & O_ACCMODE) == O_RDONLY) || ((hwdep->mode & O_ACCMODE) == O_RDWR));
|
|
Packit Service |
db8eaa |
assert(buffer || size == 0);
|
|
Packit Service |
db8eaa |
return (hwdep->ops->read)(hwdep, buffer, size);
|
|
Packit Service |
db8eaa |
}
|
|
Packit Service |
db8eaa |
|
|
Packit Service |
db8eaa |
/**
|
|
Packit Service |
db8eaa |
* \brief get the DSP status information
|
|
Packit Service |
db8eaa |
* \param hwdep HwDep handle
|
|
Packit Service |
db8eaa |
* \param info pointer to a snd_hwdep_dsp_status_t structure to be filled
|
|
Packit Service |
db8eaa |
* \return 0 on success otherwise a negative error code
|
|
Packit Service |
db8eaa |
*/
|
|
Packit Service |
db8eaa |
int snd_hwdep_dsp_status(snd_hwdep_t *hwdep, snd_hwdep_dsp_status_t *info)
|
|
Packit Service |
db8eaa |
{
|
|
Packit Service |
db8eaa |
assert(hwdep);
|
|
Packit Service |
db8eaa |
assert(info);
|
|
Packit Service |
db8eaa |
return hwdep->ops->ioctl(hwdep, SNDRV_HWDEP_IOCTL_DSP_STATUS, (void*)info);
|
|
Packit Service |
db8eaa |
}
|
|
Packit Service |
db8eaa |
|
|
Packit Service |
db8eaa |
/**
|
|
Packit Service |
db8eaa |
* \brief load the DSP block
|
|
Packit Service |
db8eaa |
* \param hwdep HwDep handle
|
|
Packit Service |
db8eaa |
* \param block pointer to a snd_hwdep_dsp_image_t structure to transfer
|
|
Packit Service |
db8eaa |
* \return 0 on success otherwise a negative error code
|
|
Packit Service |
db8eaa |
*/
|
|
Packit Service |
db8eaa |
int snd_hwdep_dsp_load(snd_hwdep_t *hwdep, snd_hwdep_dsp_image_t *block)
|
|
Packit Service |
db8eaa |
{
|
|
Packit Service |
db8eaa |
assert(hwdep);
|
|
Packit Service |
db8eaa |
assert(block);
|
|
Packit Service |
db8eaa |
return hwdep->ops->ioctl(hwdep, SNDRV_HWDEP_IOCTL_DSP_LOAD, (void*)block);
|
|
Packit Service |
db8eaa |
}
|
|
Packit Service |
db8eaa |
|
|
Packit Service |
db8eaa |
/**
|
|
Packit Service |
db8eaa |
* \brief get size of the snd_hwdep_dsp_status_t structure in bytes
|
|
Packit Service |
db8eaa |
* \return size of the snd_hwdep_dsp_status_t structure in bytes
|
|
Packit Service |
db8eaa |
*/
|
|
Packit Service |
db8eaa |
size_t snd_hwdep_dsp_status_sizeof()
|
|
Packit Service |
db8eaa |
{
|
|
Packit Service |
db8eaa |
return sizeof(snd_hwdep_dsp_status_t);
|
|
Packit Service |
db8eaa |
}
|
|
Packit Service |
db8eaa |
|
|
Packit Service |
db8eaa |
/**
|
|
Packit Service |
db8eaa |
* \brief allocate a new snd_hwdep_dsp_status_t structure
|
|
Packit Service |
db8eaa |
* \param info returned pointer
|
|
Packit Service |
db8eaa |
* \return 0 on success otherwise a negative error code if fails
|
|
Packit Service |
db8eaa |
*
|
|
Packit Service |
db8eaa |
* Allocates a new snd_hwdep_dsp_status_t structure using the standard
|
|
Packit Service |
db8eaa |
* malloc C library function.
|
|
Packit Service |
db8eaa |
*/
|
|
Packit Service |
db8eaa |
int snd_hwdep_dsp_status_malloc(snd_hwdep_dsp_status_t **info)
|
|
Packit Service |
db8eaa |
{
|
|
Packit Service |
db8eaa |
assert(info);
|
|
Packit Service |
db8eaa |
*info = calloc(1, sizeof(snd_hwdep_dsp_status_t));
|
|
Packit Service |
db8eaa |
if (!*info)
|
|
Packit Service |
db8eaa |
return -ENOMEM;
|
|
Packit Service |
db8eaa |
return 0;
|
|
Packit Service |
db8eaa |
}
|
|
Packit Service |
db8eaa |
|
|
Packit Service |
db8eaa |
/**
|
|
Packit Service |
db8eaa |
* \brief frees the snd_hwdep_dsp_status_t structure
|
|
Packit Service |
db8eaa |
* \param info pointer to the snd_hwdep_dsp_status_t structure to free
|
|
Packit Service |
db8eaa |
*
|
|
Packit Service |
db8eaa |
* Frees the given snd_hwdep_dsp_status_t structure using the standard
|
|
Packit Service |
db8eaa |
* free C library function.
|
|
Packit Service |
db8eaa |
*/
|
|
Packit Service |
db8eaa |
void snd_hwdep_dsp_status_free(snd_hwdep_dsp_status_t *info)
|
|
Packit Service |
db8eaa |
{
|
|
Packit Service |
db8eaa |
assert(info);
|
|
Packit Service |
db8eaa |
free(info);
|
|
Packit Service |
db8eaa |
}
|
|
Packit Service |
db8eaa |
|
|
Packit Service |
db8eaa |
/**
|
|
Packit Service |
db8eaa |
* \brief copy one snd_hwdep_dsp_status_t structure to another
|
|
Packit Service |
db8eaa |
* \param dst destination snd_hwdep_dsp_status_t structure
|
|
Packit Service |
db8eaa |
* \param src source snd_hwdep_dsp_status_t structure
|
|
Packit Service |
db8eaa |
*/
|
|
Packit Service |
db8eaa |
void snd_hwdep_dsp_status_copy(snd_hwdep_dsp_status_t *dst, const snd_hwdep_dsp_status_t *src)
|
|
Packit Service |
db8eaa |
{
|
|
Packit Service |
db8eaa |
assert(dst && src);
|
|
Packit Service |
db8eaa |
*dst = *src;
|
|
Packit Service |
db8eaa |
}
|
|
Packit Service |
db8eaa |
|
|
Packit Service |
db8eaa |
/**
|
|
Packit Service |
db8eaa |
* \brief get the driver version of dsp loader
|
|
Packit Service |
db8eaa |
* \param obj pointer to a snd_hwdep_dsp_status_t structure
|
|
Packit Service |
db8eaa |
* \return the driver version
|
|
Packit Service |
db8eaa |
*/
|
|
Packit Service |
db8eaa |
unsigned int snd_hwdep_dsp_status_get_version(const snd_hwdep_dsp_status_t *obj)
|
|
Packit Service |
db8eaa |
{
|
|
Packit Service |
db8eaa |
assert(obj);
|
|
Packit Service |
db8eaa |
return obj->version;
|
|
Packit Service |
db8eaa |
}
|
|
Packit Service |
db8eaa |
|
|
Packit Service |
db8eaa |
/**
|
|
Packit Service |
db8eaa |
* \brief get the driver id of dsp loader
|
|
Packit Service |
db8eaa |
* \param obj pointer to a snd_hwdep_dsp_status_t structure
|
|
Packit Service |
db8eaa |
* \return the driver id string
|
|
Packit Service |
db8eaa |
*/
|
|
Packit Service |
db8eaa |
const char *snd_hwdep_dsp_status_get_id(const snd_hwdep_dsp_status_t *obj)
|
|
Packit Service |
db8eaa |
{
|
|
Packit Service |
db8eaa |
assert(obj);
|
|
Packit Service |
db8eaa |
return (const char *)obj->id;
|
|
Packit Service |
db8eaa |
}
|
|
Packit Service |
db8eaa |
|
|
Packit Service |
db8eaa |
/**
|
|
Packit Service |
db8eaa |
* \brief get number of dsp blocks
|
|
Packit Service |
db8eaa |
* \param obj pointer to a snd_hwdep_dsp_status_t structure
|
|
Packit Service |
db8eaa |
* \return number of dsp blocks
|
|
Packit Service |
db8eaa |
*/
|
|
Packit Service |
db8eaa |
unsigned int snd_hwdep_dsp_status_get_num_dsps(const snd_hwdep_dsp_status_t *obj)
|
|
Packit Service |
db8eaa |
{
|
|
Packit Service |
db8eaa |
assert(obj);
|
|
Packit Service |
db8eaa |
return obj->num_dsps;
|
|
Packit Service |
db8eaa |
}
|
|
Packit Service |
db8eaa |
|
|
Packit Service |
db8eaa |
/**
|
|
Packit Service |
db8eaa |
* \brief get the bit flags of the loaded dsp blocks
|
|
Packit Service |
db8eaa |
* \param info pointer to a snd_hwdep_dsp_status_t structure
|
|
Packit Service |
db8eaa |
* \return the big flags of the loaded dsp blocks
|
|
Packit Service |
db8eaa |
*/
|
|
Packit Service |
db8eaa |
unsigned int snd_hwdep_dsp_status_get_dsp_loaded(const snd_hwdep_dsp_status_t *info)
|
|
Packit Service |
db8eaa |
{
|
|
Packit Service |
db8eaa |
assert(info);
|
|
Packit Service |
db8eaa |
return info->dsp_loaded;
|
|
Packit Service |
db8eaa |
}
|
|
Packit Service |
db8eaa |
|
|
Packit Service |
db8eaa |
/**
|
|
Packit Service |
db8eaa |
* \brief get the chip status of dsp loader
|
|
Packit Service |
db8eaa |
* \param obj pointer to a snd_hwdep_dsp_status_t structure
|
|
Packit Service |
db8eaa |
* \return non-zero if all DSP blocks are loaded and the chip is ready
|
|
Packit Service |
db8eaa |
*/
|
|
Packit Service |
db8eaa |
unsigned int snd_hwdep_dsp_status_get_chip_ready(const snd_hwdep_dsp_status_t *obj)
|
|
Packit Service |
db8eaa |
{
|
|
Packit Service |
db8eaa |
assert(obj);
|
|
Packit Service |
db8eaa |
return obj->chip_ready;
|
|
Packit Service |
db8eaa |
}
|
|
Packit Service |
db8eaa |
|
|
Packit Service |
db8eaa |
/**
|
|
Packit Service |
db8eaa |
* \brief get size of the snd_hwdep_dsp_image_t structure in bytes
|
|
Packit Service |
db8eaa |
* \return size of the snd_hwdep_dsp_image_t structure in bytes
|
|
Packit Service |
db8eaa |
*/
|
|
Packit Service |
db8eaa |
size_t snd_hwdep_dsp_image_sizeof()
|
|
Packit Service |
db8eaa |
{
|
|
Packit Service |
db8eaa |
return sizeof(snd_hwdep_dsp_image_t);
|
|
Packit Service |
db8eaa |
}
|
|
Packit Service |
db8eaa |
|
|
Packit Service |
db8eaa |
/**
|
|
Packit Service |
db8eaa |
* \brief allocate a new snd_hwdep_dsp_image_t structure
|
|
Packit Service |
db8eaa |
* \param info returned pointer
|
|
Packit Service |
db8eaa |
* \return 0 on success otherwise a negative error code if fails
|
|
Packit Service |
db8eaa |
*
|
|
Packit Service |
db8eaa |
* Allocates a new snd_hwdep_dsp_image_t structure using the standard
|
|
Packit Service |
db8eaa |
* malloc C library function.
|
|
Packit Service |
db8eaa |
*/
|
|
Packit Service |
db8eaa |
int snd_hwdep_dsp_image_malloc(snd_hwdep_dsp_image_t **info)
|
|
Packit Service |
db8eaa |
{
|
|
Packit Service |
db8eaa |
assert(info);
|
|
Packit Service |
db8eaa |
*info = calloc(1, sizeof(snd_hwdep_dsp_image_t));
|
|
Packit Service |
db8eaa |
if (!*info)
|
|
Packit Service |
db8eaa |
return -ENOMEM;
|
|
Packit Service |
db8eaa |
return 0;
|
|
Packit Service |
db8eaa |
}
|
|
Packit Service |
db8eaa |
|
|
Packit Service |
db8eaa |
/**
|
|
Packit Service |
db8eaa |
* \brief frees the snd_hwdep_dsp_image_t structure
|
|
Packit Service |
db8eaa |
* \param info pointer to the snd_hwdep_dsp_image_t structure to free
|
|
Packit Service |
db8eaa |
*
|
|
Packit Service |
db8eaa |
* Frees the given snd_hwdep_dsp_image_t structure using the standard
|
|
Packit Service |
db8eaa |
* free C library function.
|
|
Packit Service |
db8eaa |
*/
|
|
Packit Service |
db8eaa |
void snd_hwdep_dsp_image_free(snd_hwdep_dsp_image_t *info)
|
|
Packit Service |
db8eaa |
{
|
|
Packit Service |
db8eaa |
assert(info);
|
|
Packit Service |
db8eaa |
free(info);
|
|
Packit Service |
db8eaa |
}
|
|
Packit Service |
db8eaa |
|
|
Packit Service |
db8eaa |
/**
|
|
Packit Service |
db8eaa |
* \brief copy one snd_hwdep_dsp_image_t structure to another
|
|
Packit Service |
db8eaa |
* \param dst destination snd_hwdep_dsp_image_t structure
|
|
Packit Service |
db8eaa |
* \param src source snd_hwdep_dsp_image_t structure
|
|
Packit Service |
db8eaa |
*/
|
|
Packit Service |
db8eaa |
void snd_hwdep_dsp_image_copy(snd_hwdep_dsp_image_t *dst, const snd_hwdep_dsp_image_t *src)
|
|
Packit Service |
db8eaa |
{
|
|
Packit Service |
db8eaa |
assert(dst && src);
|
|
Packit Service |
db8eaa |
*dst = *src;
|
|
Packit Service |
db8eaa |
}
|
|
Packit Service |
db8eaa |
|
|
Packit Service |
db8eaa |
/**
|
|
Packit Service |
db8eaa |
* \brief get the DSP block index
|
|
Packit Service |
db8eaa |
* \param obj pointer to a snd_hwdep_dsp_image_t structure
|
|
Packit Service |
db8eaa |
* \return the index of the DSP block
|
|
Packit Service |
db8eaa |
*/
|
|
Packit Service |
db8eaa |
unsigned int snd_hwdep_dsp_image_get_index(const snd_hwdep_dsp_image_t *obj)
|
|
Packit Service |
db8eaa |
{
|
|
Packit Service |
db8eaa |
assert(obj);
|
|
Packit Service |
db8eaa |
return obj->index;
|
|
Packit Service |
db8eaa |
}
|
|
Packit Service |
db8eaa |
|
|
Packit Service |
db8eaa |
/**
|
|
Packit Service |
db8eaa |
* \brief get the name of the DSP block
|
|
Packit Service |
db8eaa |
* \param obj pointer to a snd_hwdep_dsp_image_t structure
|
|
Packit Service |
db8eaa |
* \return the name string of the DSP block
|
|
Packit Service |
db8eaa |
*/
|
|
Packit Service |
db8eaa |
const char *snd_hwdep_dsp_image_get_name(const snd_hwdep_dsp_image_t *obj)
|
|
Packit Service |
db8eaa |
{
|
|
Packit Service |
db8eaa |
assert(obj);
|
|
Packit Service |
db8eaa |
return (const char *)obj->name;
|
|
Packit Service |
db8eaa |
}
|
|
Packit Service |
db8eaa |
|
|
Packit Service |
db8eaa |
/**
|
|
Packit Service |
db8eaa |
* \brief get the length of the DSP block
|
|
Packit Service |
db8eaa |
* \param obj pointer to a snd_hwdep_dsp_image_t structure
|
|
Packit Service |
db8eaa |
* \return the length of the DSP block in bytes
|
|
Packit Service |
db8eaa |
*/
|
|
Packit Service |
db8eaa |
size_t snd_hwdep_dsp_image_get_length(const snd_hwdep_dsp_image_t *obj)
|
|
Packit Service |
db8eaa |
{
|
|
Packit Service |
db8eaa |
assert(obj);
|
|
Packit Service |
db8eaa |
return obj->length;
|
|
Packit Service |
db8eaa |
}
|
|
Packit Service |
db8eaa |
|
|
Packit Service |
db8eaa |
/**
|
|
Packit Service |
db8eaa |
* \brief get the image pointer of the DSP block
|
|
Packit Service |
db8eaa |
* \param obj pointer to a snd_hwdep_dsp_image_t structure
|
|
Packit Service |
db8eaa |
* \return the image pointer of the DSP block
|
|
Packit Service |
db8eaa |
*/
|
|
Packit Service |
db8eaa |
const void *snd_hwdep_dsp_image_get_image(const snd_hwdep_dsp_image_t *obj)
|
|
Packit Service |
db8eaa |
{
|
|
Packit Service |
db8eaa |
assert(obj);
|
|
Packit Service |
db8eaa |
return obj->image;
|
|
Packit Service |
db8eaa |
}
|
|
Packit Service |
db8eaa |
|
|
Packit Service |
db8eaa |
/**
|
|
Packit Service |
db8eaa |
* \brief set the DSP block index
|
|
Packit Service |
db8eaa |
* \param obj pointer to a snd_hwdep_dsp_image_t structure
|
|
Packit Service |
db8eaa |
* \param index the index value to set
|
|
Packit Service |
db8eaa |
*/
|
|
Packit Service |
db8eaa |
void snd_hwdep_dsp_image_set_index(snd_hwdep_dsp_image_t *obj, unsigned int index)
|
|
Packit Service |
db8eaa |
{
|
|
Packit Service |
db8eaa |
assert(obj);
|
|
Packit Service |
db8eaa |
obj->index = index;
|
|
Packit Service |
db8eaa |
}
|
|
Packit Service |
db8eaa |
|
|
Packit Service |
db8eaa |
/**
|
|
Packit Service |
db8eaa |
* \brief set the name of the DSP block
|
|
Packit Service |
db8eaa |
* \param obj pointer to a snd_hwdep_dsp_image_t structure
|
|
Packit Service |
db8eaa |
* \param name the name string
|
|
Packit Service |
db8eaa |
*/
|
|
Packit Service |
db8eaa |
void snd_hwdep_dsp_image_set_name(snd_hwdep_dsp_image_t *obj, const char *name)
|
|
Packit Service |
db8eaa |
{
|
|
Packit Service |
db8eaa |
assert(obj && name);
|
|
Packit Service |
db8eaa |
strncpy((char *)obj->name, name, sizeof(obj->name));
|
|
Packit Service |
db8eaa |
obj->name[sizeof(obj->name)-1] = 0;
|
|
Packit Service |
db8eaa |
}
|
|
Packit Service |
db8eaa |
|
|
Packit Service |
db8eaa |
/**
|
|
Packit Service |
db8eaa |
* \brief set the DSP block length
|
|
Packit Service |
db8eaa |
* \param obj pointer to a snd_hwdep_dsp_image_t structure
|
|
Packit Service |
db8eaa |
* \param length the length of the DSP block
|
|
Packit Service |
db8eaa |
*/
|
|
Packit Service |
db8eaa |
void snd_hwdep_dsp_image_set_length(snd_hwdep_dsp_image_t *obj, size_t length)
|
|
Packit Service |
db8eaa |
{
|
|
Packit Service |
db8eaa |
assert(obj);
|
|
Packit Service |
db8eaa |
obj->length = length;
|
|
Packit Service |
db8eaa |
}
|
|
Packit Service |
db8eaa |
|
|
Packit Service |
db8eaa |
/**
|
|
Packit Service |
db8eaa |
* \brief set the DSP block image pointer
|
|
Packit Service |
db8eaa |
* \param obj pointer to a snd_hwdep_dsp_image_t structure
|
|
Packit Service |
db8eaa |
* \param image the DSP image pointer
|
|
Packit Service |
db8eaa |
*/
|
|
Packit Service |
db8eaa |
void snd_hwdep_dsp_image_set_image(snd_hwdep_dsp_image_t *obj, void *image)
|
|
Packit Service |
db8eaa |
{
|
|
Packit Service |
db8eaa |
assert(obj);
|
|
Packit Service |
db8eaa |
obj->image = image;
|
|
Packit Service |
db8eaa |
}
|
|
Packit Service |
db8eaa |
|