mirror of
https://github.com/alsa-project/alsa-tools.git
synced 2025-10-29 05:40:25 -04:00
- use the generic hwdep DSP loader API.
- install the firmware to /usr/share/alsa/firmware. - separate configuration file for each card type.
This commit is contained in:
parent
47ce0c1fe1
commit
aa558b819b
10 changed files with 129 additions and 169 deletions
|
|
@ -1,7 +1,7 @@
|
||||||
# # Process this file with automake to produce Makefile.in.
|
# # Process this file with automake to produce Makefile.in.
|
||||||
AUTOMAKE_OPTIONS = 1.3 foreign
|
AUTOMAKE_OPTIONS = 1.3 foreign
|
||||||
|
|
||||||
CFLAGS = @CFLAGS@ -DDATAPATH=\"$(datadir)/vxloader\"
|
CFLAGS = @CFLAGS@ -DDATAPATH=\"$(datadir)/alsa/firmware\"
|
||||||
|
|
||||||
SUBDIRS = firmware
|
SUBDIRS = firmware
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -38,12 +38,10 @@ the post-install command. For example, add the following entry to
|
||||||
FILES
|
FILES
|
||||||
=====
|
=====
|
||||||
|
|
||||||
The firmware binaries are installed on /usr/share/vxloader
|
The firmware binaries are installed on /usr/share/alsa/firmware
|
||||||
(or /usr/local/share/vxloader, depending to the prefix option of
|
(or /usr/local/share/alsa/firmware, depending to the prefix option of
|
||||||
configure). The file "index" specifies which files are used for each
|
configure). There will be *.conf files, which define the dsp image
|
||||||
type of the soundcard. There are "board", "vx222", "vxpocket" and
|
files for each different card type.
|
||||||
"vxp440" types for the old VX222, VX222 v2/Mic, VXpocket v2, VXpocket
|
|
||||||
440, respectively.
|
|
||||||
|
|
||||||
|
|
||||||
COPYRIGHT
|
COPYRIGHT
|
||||||
|
|
|
||||||
|
|
@ -5,45 +5,6 @@ AC_PROG_INSTALL
|
||||||
AC_HEADER_STDC
|
AC_HEADER_STDC
|
||||||
AM_PATH_ALSA(0.9.0)
|
AM_PATH_ALSA(0.9.0)
|
||||||
|
|
||||||
dnl kernel header files
|
|
||||||
AC_MSG_CHECKING(for kernel header files)
|
|
||||||
AC_ARG_WITH(kernel,
|
|
||||||
[ --with-kernel=ver specify kernel version (for example 2.5.5-pre1)],
|
|
||||||
[kerneldir="$withval"], [kerneldir=""])
|
|
||||||
if test "$kerneldir" != "" -a -r "/lib/modules/$kerneldir/build/include/sound"; then
|
|
||||||
kerneldir="/lib/modules/$kerneldir/build/include"
|
|
||||||
AC_MSG_RESULT($kerneldir)
|
|
||||||
else
|
|
||||||
if test -z "$kerneldir"; then
|
|
||||||
AC_MSG_RESULT("not specified")
|
|
||||||
else
|
|
||||||
AC_MSG_RESULT("directory /lib/modules/$kerneldir/build/include/sound not found")
|
|
||||||
fi
|
|
||||||
kerneldir=""
|
|
||||||
fi
|
|
||||||
|
|
||||||
dnl path for sound/asound.h
|
|
||||||
AC_MSG_CHECKING(for directory with ALSA kernel headers)
|
|
||||||
AC_ARG_WITH(soundbase,
|
|
||||||
[ --with-soundbase=dir specify base directory with kernel sound headers (optional)],
|
|
||||||
[soundbasedir="$withval"], [soundbasedir="$kerneldir"])
|
|
||||||
if test "$soundbasedir" != "" -a -r "$soundbasedir/sound" ; then
|
|
||||||
ALSA_CFLAGS="$ALSA_CFLAGS -I$soundbasedir"
|
|
||||||
AC_MSG_RESULT($ALSA_CFLAGS)
|
|
||||||
else
|
|
||||||
if test "x$prefix" != xNONE; then
|
|
||||||
aprefix=$prefix
|
|
||||||
else
|
|
||||||
aprefix=$ac_default_prefix
|
|
||||||
fi
|
|
||||||
if test -z "$soundbasedir" -a -r "$aprefix/include/sound"; then
|
|
||||||
ALSA_CFLAGS="$ALSA_CFLAGS -I$aprefix/include"
|
|
||||||
AC_MSG_RESULT($ALSA_CFLAGS)
|
|
||||||
else
|
|
||||||
AC_MSG_RESULT("not specified - using C compilator defaults")
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
CFLAGS="$CFLAGS $ALSA_CFLAGS"
|
CFLAGS="$CFLAGS $ALSA_CFLAGS"
|
||||||
LDFLAGS="$LDFLAGS $ALSA_LIBS"
|
LDFLAGS="$LDFLAGS $ALSA_LIBS"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
cfg_files = index \
|
cfg_files = vx222.conf vxboard.conf vxpocket.conf vxp440.conf \
|
||||||
bd56002.boot \
|
bd56002.boot \
|
||||||
bd563s3.boot \
|
bd563s3.boot \
|
||||||
bd563v2.boot \
|
bd563v2.boot \
|
||||||
|
|
@ -15,6 +15,6 @@ cfg_files = index \
|
||||||
|
|
||||||
EXTRA_DIST = $(cfg_files)
|
EXTRA_DIST = $(cfg_files)
|
||||||
|
|
||||||
firmwaredir = $(datadir)/vxloader
|
firmwaredir = $(datadir)/alsa/firmware
|
||||||
firmware_DATA = $(cfg_files)
|
firmware_DATA = $(cfg_files)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,24 +0,0 @@
|
||||||
# boot firmwares for digigram VX cards
|
|
||||||
|
|
||||||
# VX222 v2 / Mic
|
|
||||||
vx222.xilinx x1_2_v22.rbt
|
|
||||||
vx222.dspboot bd563v2.boot
|
|
||||||
vx222.dspimage l_1_v22.d56
|
|
||||||
|
|
||||||
# old VX222
|
|
||||||
board.xilinx x1_1_vx2.rbt
|
|
||||||
board.dspboot bd56002.boot
|
|
||||||
board.dspimage l_1_vx2.d56
|
|
||||||
|
|
||||||
# VXpocket
|
|
||||||
vxpocket.boot bx_1_vxp.b56
|
|
||||||
vxpocket.xilinx x1_1_vxp.rbt
|
|
||||||
vxpocket.dspboot bd563s3.boot
|
|
||||||
vxpocket.dspimage l_1_vxp.d56
|
|
||||||
|
|
||||||
# VXpocket 440
|
|
||||||
vxp440.boot bx_1_vp4.b56
|
|
||||||
vxp440.xilinx x1_1_vp4.rbt
|
|
||||||
vxp440.dspboot bd563s3.boot
|
|
||||||
vxp440.dspimage l_1_vp4.d56
|
|
||||||
|
|
||||||
6
vxloader/firmware/vx222.conf
Normal file
6
vxloader/firmware/vx222.conf
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
# boot firmwares for digigram VX 222 v2/Mic cards
|
||||||
|
|
||||||
|
dsp0 x1_2_v22.rbt
|
||||||
|
dsp1 bd563v2.boot
|
||||||
|
dsp2 l_1_v22.d56
|
||||||
|
|
||||||
6
vxloader/firmware/vxboard.conf
Normal file
6
vxloader/firmware/vxboard.conf
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
# boot firmwares for digigram VX222 (old)
|
||||||
|
|
||||||
|
dsp0 x1_1_vx2.rbt
|
||||||
|
dsp1 bd56002.boot
|
||||||
|
dsp2 l_1_vx2.d56
|
||||||
|
|
||||||
6
vxloader/firmware/vxp440.conf
Normal file
6
vxloader/firmware/vxp440.conf
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
# boot firmwares for digigram VXpocket 440
|
||||||
|
|
||||||
|
dsp0 bx_1_vp4.b56
|
||||||
|
dsp1 x1_1_vp4.rbt
|
||||||
|
dsp2 bd563s3.boot
|
||||||
|
dsp3 l_1_vp4.d56
|
||||||
6
vxloader/firmware/vxpocket.conf
Normal file
6
vxloader/firmware/vxpocket.conf
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
# boot firmwares for digigram VXpocket
|
||||||
|
|
||||||
|
dsp0 bx_1_vxp.b56
|
||||||
|
dsp1 x1_1_vxp.rbt
|
||||||
|
dsp2 bd563s3.boot
|
||||||
|
dsp3 l_1_vxp.d56
|
||||||
|
|
@ -30,24 +30,15 @@
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <alsa/asoundlib.h>
|
#include <alsa/asoundlib.h>
|
||||||
|
|
||||||
#include <sound/vx_load.h>
|
|
||||||
|
|
||||||
#define PROGNAME "vxload"
|
#define PROGNAME "vxloader"
|
||||||
|
|
||||||
|
|
||||||
/* directory containing the firmware binaries */
|
|
||||||
#ifndef DATAPATH
|
|
||||||
#define DATAPATH "/usr/share/vxloader"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* firmware index file */
|
|
||||||
#define INDEX_FILE DATAPATH "/index"
|
|
||||||
|
|
||||||
/* max. number of cards (shouldn't be in the public header?) */
|
/* max. number of cards (shouldn't be in the public header?) */
|
||||||
#define SND_CARDS 8
|
#define SND_CARDS 8
|
||||||
|
|
||||||
|
|
||||||
static int verbose;
|
static int verbose = 0;
|
||||||
|
|
||||||
static void usage(void)
|
static void usage(void)
|
||||||
{
|
{
|
||||||
|
|
@ -71,11 +62,12 @@ static void error(const char *fmt, ...)
|
||||||
/*
|
/*
|
||||||
* read a xilinx bitstream file
|
* read a xilinx bitstream file
|
||||||
*/
|
*/
|
||||||
static int read_xilinx_image(struct snd_vx_image *img, const char *fname)
|
static int read_xilinx_image(snd_hwdep_dsp_image_t *img, const char *fname)
|
||||||
{
|
{
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
char buf[256];
|
char buf[256];
|
||||||
int data, c, idx, length;
|
int data, c, idx, length;
|
||||||
|
unsigned char *imgbuf;
|
||||||
char *p;
|
char *p;
|
||||||
|
|
||||||
if ((fp = fopen(fname, "r")) == NULL) {
|
if ((fp = fopen(fname, "r")) == NULL) {
|
||||||
|
|
@ -83,7 +75,7 @@ static int read_xilinx_image(struct snd_vx_image *img, const char *fname)
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
}
|
}
|
||||||
|
|
||||||
strcpy(img->name, fname);
|
snd_hwdep_dsp_image_set_name(img, fname);
|
||||||
|
|
||||||
c = 0;
|
c = 0;
|
||||||
data = 0;
|
data = 0;
|
||||||
|
|
@ -105,13 +97,14 @@ static int read_xilinx_image(struct snd_vx_image *img, const char *fname)
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
img->length = length;
|
snd_hwdep_dsp_image_set_length(img, length);
|
||||||
img->image = malloc(length);
|
imgbuf = malloc(length);
|
||||||
if (! img->image) {
|
if (! imgbuf) {
|
||||||
error("cannot alloc %d bytes\n", length);
|
error("cannot alloc %d bytes\n", length);
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
|
snd_hwdep_dsp_image_set_image(img, imgbuf);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (buf[0] != '0' && buf[1] != '1')
|
if (buf[0] != '0' && buf[1] != '1')
|
||||||
|
|
@ -125,7 +118,7 @@ static int read_xilinx_image(struct snd_vx_image *img, const char *fname)
|
||||||
data |= (*p - '0') << c;
|
data |= (*p - '0') << c;
|
||||||
c++;
|
c++;
|
||||||
if (c >= 8) {
|
if (c >= 8) {
|
||||||
img->image[idx] = data;
|
imgbuf[idx] = data;
|
||||||
data = 0;
|
data = 0;
|
||||||
c = 0;
|
c = 0;
|
||||||
idx++;
|
idx++;
|
||||||
|
|
@ -135,7 +128,7 @@ static int read_xilinx_image(struct snd_vx_image *img, const char *fname)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (c)
|
if (c)
|
||||||
img->image[idx++] = data;
|
imgbuf[idx++] = data;
|
||||||
if (idx != length) {
|
if (idx != length) {
|
||||||
error("length doesn't match: %d != %d\n", idx, length);
|
error("length doesn't match: %d != %d\n", idx, length);
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
|
|
@ -149,35 +142,38 @@ static int read_xilinx_image(struct snd_vx_image *img, const char *fname)
|
||||||
/*
|
/*
|
||||||
* read a binary image file
|
* read a binary image file
|
||||||
*/
|
*/
|
||||||
static int read_boot_image(struct snd_vx_image *img, const char *fname)
|
static int read_boot_image(snd_hwdep_dsp_image_t *img, const char *fname)
|
||||||
{
|
{
|
||||||
struct stat st;
|
struct stat st;
|
||||||
int fd;
|
int fd, length;
|
||||||
|
unsigned char *imgbuf;
|
||||||
|
|
||||||
strcpy(img->name, fname);
|
snd_hwdep_dsp_image_set_name(img, fname);
|
||||||
if (stat(fname, &st) < 0) {
|
if (stat(fname, &st) < 0) {
|
||||||
error("cannot call stat %s\n", fname);
|
error("cannot call stat %s\n", fname);
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
}
|
}
|
||||||
img->length = st.st_size;
|
length = st.st_size;
|
||||||
if (img->length == 0) {
|
if (length == 0) {
|
||||||
error("zero file size %s\n", fname);
|
error("zero file size %s\n", fname);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
img->image = malloc(img->length);
|
imgbuf = malloc(st.st_size);
|
||||||
if (! img->image) {
|
if (! imgbuf) {
|
||||||
error("cannot malloc %d bytes\n", img->length);
|
error("cannot malloc %d bytes\n", length);
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
|
snd_hwdep_dsp_image_set_length(img, length);
|
||||||
|
snd_hwdep_dsp_image_set_image(img, imgbuf);
|
||||||
|
|
||||||
fd = open(fname, O_RDONLY);
|
fd = open(fname, O_RDONLY);
|
||||||
if (fd < 0) {
|
if (fd < 0) {
|
||||||
error("cannot open %s\n", fname);
|
error("cannot open %s\n", fname);
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
}
|
}
|
||||||
if (read(fd, img->image, img->length) != (ssize_t)img->length) {
|
if (read(fd, imgbuf, length) != length) {
|
||||||
error("cannot read %d bytes from %s\n", img->length, fname);
|
error("cannot read %d bytes from %s\n", length, fname);
|
||||||
close(fd);
|
close(fd);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
@ -193,19 +189,20 @@ static int read_boot_image(struct snd_vx_image *img, const char *fname)
|
||||||
|
|
||||||
#define MAX_PATH 128
|
#define MAX_PATH 128
|
||||||
|
|
||||||
static int get_file_name(const char *key, const char *type, char *fname)
|
static int get_file_name(const char *key, unsigned int idx, char *fname)
|
||||||
{
|
{
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
char buf[128];
|
char buf[128];
|
||||||
char temp[32], *p;
|
char temp[32], *p;
|
||||||
int len;
|
int len;
|
||||||
|
|
||||||
if ((fp = fopen(INDEX_FILE, "r")) == NULL) {
|
snprintf(buf, sizeof(buf), "%s/%s.conf", DATAPATH, key);
|
||||||
error("cannot open the index file %s\n", INDEX_FILE);
|
if ((fp = fopen(buf, "r")) == NULL) {
|
||||||
|
error("cannot open the index file %s\n", buf);
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
}
|
}
|
||||||
|
|
||||||
sprintf(temp, "%s.%s", key, type);
|
sprintf(temp, "dsp%d", idx);
|
||||||
len = strlen(temp);
|
len = strlen(temp);
|
||||||
|
|
||||||
while (fgets(buf, sizeof(buf), fp)) {
|
while (fgets(buf, sizeof(buf), fp)) {
|
||||||
|
|
@ -233,105 +230,109 @@ static int get_file_name(const char *key, const char *type, char *fname)
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* read the firmware binaries
|
* read and transfer the firmware binary
|
||||||
*/
|
*/
|
||||||
static int read_firmware(int type, const char *key, struct snd_vx_loader *xilinx, struct snd_vx_loader *dsp)
|
static int load_firmware(snd_hwdep_t *hw, const char *id, unsigned int idx, int is_pcmcia)
|
||||||
{
|
{
|
||||||
int err;
|
int err;
|
||||||
char fname[MAX_PATH];
|
char fname[MAX_PATH];
|
||||||
|
int is_xilinx = 0;
|
||||||
|
snd_hwdep_dsp_image_t *dsp;
|
||||||
|
|
||||||
if (type >= VX_TYPE_VXPOCKET) {
|
if (get_file_name(id, idx, fname) < 0)
|
||||||
if (get_file_name(key, "boot", fname) < 0)
|
return -EINVAL;
|
||||||
return -EINVAL;
|
if (is_pcmcia) {
|
||||||
err = read_boot_image(&xilinx->boot, fname);
|
if (idx == 1)
|
||||||
if (err < 0)
|
is_xilinx = 1;
|
||||||
return err;
|
} else {
|
||||||
|
if (idx == 0)
|
||||||
|
is_xilinx = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (get_file_name(key, "xilinx", fname) < 0)
|
snd_hwdep_dsp_image_alloca(&dsp);
|
||||||
return -EINVAL;
|
snd_hwdep_dsp_image_set_index(dsp, idx);
|
||||||
err = read_xilinx_image(&xilinx->binary, fname);
|
if (is_xilinx)
|
||||||
|
err = read_xilinx_image(dsp, fname);
|
||||||
|
else
|
||||||
|
err = read_boot_image(dsp, fname);
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
return err;
|
return err;
|
||||||
|
|
||||||
if (get_file_name(key, "dspboot", fname) < 0)
|
err = snd_hwdep_dsp_load(hw, dsp);
|
||||||
return -EINVAL;
|
|
||||||
err = read_boot_image(&dsp->boot, fname);
|
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
return err;
|
error("error in loading %s\n", fname);
|
||||||
|
|
||||||
if (get_file_name(key, "dspimage", fname) < 0)
|
|
||||||
return -EINVAL;
|
|
||||||
err = read_boot_image(&dsp->binary, fname);
|
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* check the name id of the given hwdep handle
|
||||||
|
*/
|
||||||
|
static int check_hwinfo(snd_hwdep_t *hw, const char *id)
|
||||||
|
{
|
||||||
|
snd_hwdep_info_t *info;
|
||||||
|
int err;
|
||||||
|
|
||||||
|
snd_hwdep_info_alloca(&info);
|
||||||
|
if ((err = snd_hwdep_info(hw, info)) < 0)
|
||||||
|
return err;
|
||||||
|
if (strcmp(snd_hwdep_info_get_id(info), id))
|
||||||
|
return -ENODEV;
|
||||||
|
return 0; /* ok */
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* load the firmware binaries
|
* load the firmware binaries
|
||||||
*/
|
*/
|
||||||
static int vx_boot(const char *devname)
|
static int vx_boot(const char *devname)
|
||||||
{
|
{
|
||||||
snd_hwdep_t *hw;
|
snd_hwdep_t *hw;
|
||||||
const char *key;
|
const char *id;
|
||||||
int err;
|
int err, is_pcmcia;
|
||||||
struct snd_vx_version version;
|
unsigned int idx, dsps, loaded;
|
||||||
struct snd_vx_loader xilinx, dsp;
|
snd_hwdep_dsp_status_t *stat;
|
||||||
|
|
||||||
if ((err = snd_hwdep_open(&hw, devname, O_RDWR)) < 0) {
|
if ((err = snd_hwdep_open(&hw, devname, O_RDWR)) < 0) {
|
||||||
error("cannot open hwdep %s\n", devname);
|
error("cannot open hwdep %s\n", devname);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (check_hwinfo(hw, "VX Loader") < 0) {
|
||||||
|
error("invalid hwdep %s\n", devname);
|
||||||
|
snd_hwdep_close(hw);
|
||||||
|
return -ENODEV;
|
||||||
|
}
|
||||||
|
|
||||||
|
snd_hwdep_dsp_status_alloca(&stat);
|
||||||
/* get the current status */
|
/* get the current status */
|
||||||
if ((err = snd_hwdep_ioctl(hw, SND_VX_HWDEP_IOCTL_VERSION, &version)) < 0) {
|
if ((err = snd_hwdep_dsp_status(hw, stat)) < 0) {
|
||||||
error("cannot get version for %s\n", devname);
|
error("cannot get version for %s\n", devname);
|
||||||
|
snd_hwdep_close(hw);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (version.type) {
|
if (snd_hwdep_dsp_status_get_chip_ready(stat))
|
||||||
case VX_TYPE_BOARD:
|
return 0; /* already loaded */
|
||||||
key = "board";
|
|
||||||
break;
|
id = snd_hwdep_dsp_status_get_id(stat);
|
||||||
case VX_TYPE_V2:
|
if (strcmp(id, "vxpocket") == 0 ||
|
||||||
case VX_TYPE_MIC:
|
strcmp(id, "vxp440") == 0)
|
||||||
key = "vx222";
|
is_pcmcia = 1;
|
||||||
break;
|
else
|
||||||
case VX_TYPE_VXPOCKET:
|
is_pcmcia = 0;
|
||||||
key = "vxpocket";
|
|
||||||
break;
|
dsps = snd_hwdep_dsp_status_get_num_dsps(stat);
|
||||||
case VX_TYPE_VXP440:
|
loaded = snd_hwdep_dsp_status_get_dsp_loaded(stat);
|
||||||
key = "vxp440";
|
|
||||||
break;
|
for (idx = 0; idx < dsps; idx++) {
|
||||||
default:
|
if (loaded & (1 << idx))
|
||||||
error("invalid VX board type %d\n", version.type);
|
continue;
|
||||||
return -EINVAL;
|
if ((err = load_firmware(hw, id, idx, is_pcmcia)) < 0) {
|
||||||
|
snd_hwdep_close(hw);
|
||||||
|
return err;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
memset(&xilinx, 0, sizeof(xilinx));
|
|
||||||
memset(&dsp, 0, sizeof(dsp));
|
|
||||||
|
|
||||||
if ((err = read_firmware(version.type, key, &xilinx, &dsp)) < 0)
|
|
||||||
return err;
|
|
||||||
|
|
||||||
//fprintf(stderr, "loading xilinx..\n");
|
|
||||||
if (! (version.status & VX_STAT_XILINX_LOADED) &&
|
|
||||||
(err = snd_hwdep_ioctl(hw, SND_VX_HWDEP_IOCTL_LOAD_XILINX, &xilinx)) < 0) {
|
|
||||||
error("cannot load xilinx\n");
|
|
||||||
return err;
|
|
||||||
}
|
|
||||||
//fprintf(stderr, "loading dsp..\n");
|
|
||||||
if (! (version.status & VX_STAT_DSP_LOADED) &&
|
|
||||||
(err = snd_hwdep_ioctl(hw, SND_VX_HWDEP_IOCTL_LOAD_DSP, &dsp)) < 0) {
|
|
||||||
error("cannot load DSP\n");
|
|
||||||
return err;
|
|
||||||
}
|
|
||||||
//fprintf(stderr, "starting devices..\n");
|
|
||||||
if (! (version.status & VX_STAT_DEVICE_INIT) &&
|
|
||||||
(err = snd_hwdep_ioctl(hw, SND_VX_HWDEP_IOCTL_INIT_DEVICE, 0)) < 0) {
|
|
||||||
error("cannot initialize devices\n");
|
|
||||||
return err;
|
|
||||||
}
|
|
||||||
snd_hwdep_close(hw);
|
snd_hwdep_close(hw);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue