Add resmgr support

Added the support for resmgr.  A new configure option --with-resmgr is added
to enable the resmgr support.
This commit is contained in:
Takashi Iwai 2005-01-26 10:50:28 +00:00
parent 7e74f2ef1b
commit 77c925a71f
9 changed files with 121 additions and 15 deletions

View file

@ -171,6 +171,18 @@ arm*)
;; ;;
esac esac
dnl Check for resmgr support...
AC_MSG_CHECKING(for resmgr support)
AC_ARG_WITH(resmgr,
[ --with-resmgr support resmgr (optional)],
resmgr="$withval", resmgr="no")
AC_MSG_RESULT($resmgr)
if test "$resmgr" = "yes"; then
AC_CHECK_LIB(resmgr, rsm_open_device,,
AC_ERROR([Cannot find libresmgr]))
AC_DEFINE(SUPPORT_RESMGR, "1", [Support resmgr with alsa-lib])
fi
dnl Make a symlink for inclusion of alsa/xxx.h dnl Make a symlink for inclusion of alsa/xxx.h
if test ! -L include/alsa ; then if test ! -L include/alsa ; then
echo "Making a symlink include/alsa" echo "Making a symlink include/alsa"

View file

@ -33,6 +33,9 @@
#include <fcntl.h> #include <fcntl.h>
#include <sys/ioctl.h> #include <sys/ioctl.h>
#include "control_local.h" #include "control_local.h"
#ifdef SUPPORT_RESMGR
#include <resmgr.h>
#endif
#ifndef DOC_HIDDEN #ifndef DOC_HIDDEN
#define SND_FILE_CONTROL "/dev/snd/controlC%i" #define SND_FILE_CONTROL "/dev/snd/controlC%i"
@ -51,10 +54,19 @@ int snd_card_load(int card)
sprintf(control, SND_FILE_CONTROL, card); sprintf(control, SND_FILE_CONTROL, card);
if ((open_dev=open(control, O_RDONLY)) < 0) { #ifdef SUPPORT_RESMGR
open_dev = rsm_open_device(control, O_RDONLY);
#else
open_dev = open(control, O_RDONLY);
#endif
if (open_dev < 0) {
char aload[32]; char aload[32];
sprintf(aload, SND_FILE_LOAD, card); sprintf(aload, SND_FILE_LOAD, card);
#ifdef SUPPORT_RESMGR
open_dev = rsm_open_device(aload, O_RDONLY);
#else
open_dev = open(aload, O_RDONLY); open_dev = open(aload, O_RDONLY);
#endif
} }
if (open_dev >= 0) { if (open_dev >= 0) {
close (open_dev); close (open_dev);

View file

@ -28,6 +28,9 @@
#include <fcntl.h> #include <fcntl.h>
#include <sys/ioctl.h> #include <sys/ioctl.h>
#include "control_local.h" #include "control_local.h"
#ifdef SUPPORT_RESMGR
#include <resmgr.h>
#endif
#ifndef PIC #ifndef PIC
/* entry for static linking */ /* entry for static linking */
@ -337,9 +340,19 @@ int snd_ctl_hw_open(snd_ctl_t **handle, const char *name, int card, int mode)
fmode |= O_NONBLOCK; fmode |= O_NONBLOCK;
if (mode & SND_CTL_ASYNC) if (mode & SND_CTL_ASYNC)
fmode |= O_ASYNC; fmode |= O_ASYNC;
if ((fd = open(filename, fmode)) < 0) { #ifdef SUPPORT_RESMGR
fd = rsm_open_device(filename, fmode);
#else
fd = open(filename, fmode);
#endif
if (fd < 0) {
snd_card_load(card); snd_card_load(card);
if ((fd = open(filename, O_RDWR)) < 0) #ifdef SUPPORT_RESMGR
fd = rsm_open_device(filename, fmode);
#else
fd = open(filename, fmode);
#endif
if (fd < 0)
return -errno; return -errno;
} }
#if 0 #if 0

View file

@ -26,6 +26,9 @@
#include <fcntl.h> #include <fcntl.h>
#include <sys/ioctl.h> #include <sys/ioctl.h>
#include "hwdep_local.h" #include "hwdep_local.h"
#ifdef SUPPORT_RESMGR
#include <resmgr.h>
#endif
#ifndef PIC #ifndef PIC
/* entry for static linking */ /* entry for static linking */
@ -115,9 +118,19 @@ int snd_hwdep_hw_open(snd_hwdep_t **handle, const char *name, int card, int devi
if (card < 0 || card >= 32) if (card < 0 || card >= 32)
return -EINVAL; return -EINVAL;
sprintf(filename, SNDRV_FILE_HWDEP, card, device); sprintf(filename, SNDRV_FILE_HWDEP, card, device);
if ((fd = open(filename, mode)) < 0) { #ifdef SUPPORT_RESMGR
fd = rsm_open_device(filename, mode);
#else
fd = open(filename, mode);
#endif
if (fd < 0) {
snd_card_load(card); snd_card_load(card);
if ((fd = open(filename, mode)) < 0) #ifdef SUPPORT_RESMGR
fd = rsm_open_device(filename, mode);
#else
fd = open(filename, mode);
#endif
if (fd < 0)
return -errno; return -errno;
} }
#if 0 #if 0

View file

@ -39,6 +39,9 @@
#include <sys/shm.h> #include <sys/shm.h>
#include "pcm_local.h" #include "pcm_local.h"
#include "../control/control_local.h" #include "../control/control_local.h"
#ifdef SUPPORT_RESMGR
#include <resmgr.h>
#endif
//#define DEBUG_RW /* use to debug readi/writei/readn/writen */ //#define DEBUG_RW /* use to debug readi/writei/readn/writen */
//#define DEBUG_MMAP /* debug mmap_commit */ //#define DEBUG_MMAP /* debug mmap_commit */
@ -1203,7 +1206,12 @@ int snd_pcm_hw_open(snd_pcm_t **pcmp, const char *name,
fmode |= O_NONBLOCK; fmode |= O_NONBLOCK;
if (mode & SND_PCM_ASYNC) if (mode & SND_PCM_ASYNC)
fmode |= O_ASYNC; fmode |= O_ASYNC;
if ((fd = open(filename, fmode)) < 0) { #ifdef SUPPORT_RESMGR
fd = rsm_open_device(filename, fmode);
#else
fd = open(filename, fmode);
#endif
if (fd < 0) {
ret = -errno; ret = -errno;
SYSMSG("open %s failed", filename); SYSMSG("open %s failed", filename);
goto _err; goto _err;

View file

@ -28,6 +28,9 @@
#include <sys/ioctl.h> #include <sys/ioctl.h>
#include "../control/control_local.h" #include "../control/control_local.h"
#include "rawmidi_local.h" #include "rawmidi_local.h"
#ifdef SUPPORT_RESMGR
#include <resmgr.h>
#endif
#ifndef PIC #ifndef PIC
/* entry for static linking */ /* entry for static linking */
@ -220,9 +223,19 @@ int snd_rawmidi_hw_open(snd_rawmidi_t **inputp, snd_rawmidi_t **outputp,
assert(!(mode & ~(SND_RAWMIDI_APPEND|SND_RAWMIDI_NONBLOCK|SND_RAWMIDI_SYNC))); assert(!(mode & ~(SND_RAWMIDI_APPEND|SND_RAWMIDI_NONBLOCK|SND_RAWMIDI_SYNC)));
if ((fd = open(filename, fmode)) < 0) { #ifdef SUPPORT_RESMGR
fd = rsm_open_device(filename, fmode);
#else
fd = open(filename, fmode);
#endif
if (fd < 0) {
snd_card_load(card); snd_card_load(card);
if ((fd = open(filename, fmode)) < 0) { #ifdef SUPPORT_RESMGR
fd = rsm_open_device(filename, fmode);
#else
fd = open(filename, fmode);
#endif
if (fd < 0) {
snd_ctl_close(ctl); snd_ctl_close(ctl);
SYSERR("open %s failed", filename); SYSERR("open %s failed", filename);
return -errno; return -errno;

View file

@ -23,6 +23,9 @@
#include <fcntl.h> #include <fcntl.h>
#include <sys/ioctl.h> #include <sys/ioctl.h>
#include "seq_local.h" #include "seq_local.h"
#ifdef SUPPORT_RESMGR
#include <resmgr.h>
#endif
#ifndef PIC #ifndef PIC
/* entry for static linking */ /* entry for static linking */
@ -415,7 +418,7 @@ snd_seq_ops_t snd_seq_hw_ops = {
int snd_seq_hw_open(snd_seq_t **handle, const char *name, int streams, int mode) int snd_seq_hw_open(snd_seq_t **handle, const char *name, int streams, int mode)
{ {
int fd, ver, client, fmode, ret; int fd, ver, client, fmode, ret;
char filename[32]; const char *filename;
snd_seq_t *seq; snd_seq_t *seq;
snd_seq_hw_t *hw; snd_seq_hw_t *hw;
@ -439,10 +442,26 @@ int snd_seq_hw_open(snd_seq_t **handle, const char *name, int streams, int mode)
if (mode & SND_SEQ_NONBLOCK) if (mode & SND_SEQ_NONBLOCK)
fmode |= O_NONBLOCK; fmode |= O_NONBLOCK;
sprintf(filename, SNDRV_FILE_SEQ); filename = SNDRV_FILE_SEQ;
if ((fd = open(filename, fmode)) < 0) { #ifdef SUPPORT_RESMGR
close(open(SNDRV_FILE_ALOADSEQ, O_RDWR)); fd = rsm_open_device(filename, fmode);
if ((fd = open(filename, fmode)) < 0) { #else
fd = open(filename, fmode);
#endif
if (fd < 0) {
#ifdef SUPPORT_RESMGR
fd = open(SNDRV_FILE_ALOADSEQ, O_RDWR);
#else
fd = open(SNDRV_FILE_ALOADSEQ, fmode);
#endif
if (fd >= 0)
close(fd);
#ifdef SUPPORT_RESMGR
fd = rsm_open_device(filename, fmode);
#else
fd = open(filename, fmode);
#endif
if (fd < 0) {
SYSERR("open %s failed", filename); SYSERR("open %s failed", filename);
return -errno; return -errno;
} }

View file

@ -27,6 +27,9 @@
#include <fcntl.h> #include <fcntl.h>
#include <sys/ioctl.h> #include <sys/ioctl.h>
#include "timer_local.h" #include "timer_local.h"
#ifdef SUPPORT_RESMGR
#include <resmgr.h>
#endif
#ifndef PIC #ifndef PIC
/* entry for static linking */ /* entry for static linking */
@ -211,7 +214,12 @@ int snd_timer_hw_open(snd_timer_t **handle, const char *name, int dev_class, int
tmode = O_RDONLY; tmode = O_RDONLY;
if (mode & SND_TIMER_OPEN_NONBLOCK) if (mode & SND_TIMER_OPEN_NONBLOCK)
tmode |= O_NONBLOCK; tmode |= O_NONBLOCK;
if ((fd = open(SNDRV_FILE_TIMER, tmode)) < 0) #ifdef SUPPORT_RESMGR
fd = rsm_open_device(SNDRV_FILE_TIMER, tmode);
#else
fd = open(SNDRV_FILE_TIMER, tmode);
#endif
if (fd < 0)
return -errno; return -errno;
#if 0 #if 0
/* /*

View file

@ -26,6 +26,9 @@
#include <fcntl.h> #include <fcntl.h>
#include <sys/ioctl.h> #include <sys/ioctl.h>
#include "timer_local.h" #include "timer_local.h"
#ifdef SUPPORT_RESMGR
#include <resmgr.h>
#endif
#ifndef PIC #ifndef PIC
/* entry for static linking */ /* entry for static linking */
@ -99,7 +102,12 @@ int snd_timer_query_hw_open(snd_timer_query_t **handle, const char *name, int mo
tmode = O_RDONLY; tmode = O_RDONLY;
if (mode & SND_TIMER_OPEN_NONBLOCK) if (mode & SND_TIMER_OPEN_NONBLOCK)
tmode |= O_NONBLOCK; tmode |= O_NONBLOCK;
if ((fd = open(SNDRV_FILE_TIMER, tmode)) < 0) #ifdef SUPPORT_RESMGR
fd = rsm_open_device(SNDRV_FILE_TIMER, tmode);
#else
fd = open(SNDRV_FILE_TIMER, tmode);
#endif
if (fd < 0)
return -errno; return -errno;
if (ioctl(fd, SNDRV_TIMER_IOCTL_PVERSION, &ver) < 0) { if (ioctl(fd, SNDRV_TIMER_IOCTL_PVERSION, &ver) < 0) {
close(fd); close(fd);