]> git.alsa-project.org Git - alsa-lib.git/commitdiff
Add resmgr support
authorTakashi Iwai <tiwai@suse.de>
Wed, 26 Jan 2005 10:50:28 +0000 (10:50 +0000)
committerTakashi Iwai <tiwai@suse.de>
Wed, 26 Jan 2005 10:50:28 +0000 (10:50 +0000)
Added the support for resmgr.  A new configure option --with-resmgr is added
to enable the resmgr support.

configure.in
src/control/cards.c
src/control/control_hw.c
src/hwdep/hwdep_hw.c
src/pcm/pcm_hw.c
src/rawmidi/rawmidi_hw.c
src/seq/seq_hw.c
src/timer/timer_hw.c
src/timer/timer_query_hw.c

index abfa12b1ddbfee5915952da5f8f32d520be810f3..c2bb6e5d683b23f3f2bc369d397b73ef39c09dcb 100644 (file)
@@ -171,6 +171,18 @@ arm*)
   ;;
 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
 if test ! -L include/alsa ; then
   echo "Making a symlink include/alsa"
index 994ffbe1f71113f577c37720514316a6ba211c52..fbadb17c12936b4543de741c0fd2c03d9b8d04df 100644 (file)
@@ -33,6 +33,9 @@
 #include <fcntl.h>
 #include <sys/ioctl.h>
 #include "control_local.h"
+#ifdef SUPPORT_RESMGR
+#include <resmgr.h>
+#endif
 
 #ifndef DOC_HIDDEN
 #define SND_FILE_CONTROL       "/dev/snd/controlC%i"
@@ -51,10 +54,19 @@ int snd_card_load(int 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];
                sprintf(aload, SND_FILE_LOAD, card);
+#ifdef SUPPORT_RESMGR
+               open_dev = rsm_open_device(aload, O_RDONLY);
+#else
                open_dev = open(aload, O_RDONLY);
+#endif
        }
        if (open_dev >= 0) {
                close (open_dev);
index 4e9dd07f0aea1a8cd9c9387047ee33ae0873f95f..eb4a594ab358d088b01ea2d0fabef65ca3803b6b 100644 (file)
@@ -28,6 +28,9 @@
 #include <fcntl.h>
 #include <sys/ioctl.h>
 #include "control_local.h"
+#ifdef SUPPORT_RESMGR
+#include <resmgr.h>
+#endif
 
 #ifndef PIC
 /* 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;
        if (mode & SND_CTL_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);
-               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;
        }
 #if 0
index 59ff6d17f93e4b01cfa77db896f73aa291d2815d..22b7da124a59a3927253fd5f682fb2fbb453f14f 100644 (file)
@@ -26,6 +26,9 @@
 #include <fcntl.h>
 #include <sys/ioctl.h>
 #include "hwdep_local.h"
+#ifdef SUPPORT_RESMGR
+#include <resmgr.h>
+#endif
 
 #ifndef PIC
 /* 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)
                return -EINVAL;
        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);
-               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;
        }
 #if 0
index 499bd0ccfe95c02e8157ca5dd954a262391e7966..91440540dccb4c6a3060cd6ea43028452fbe2945 100644 (file)
@@ -39,6 +39,9 @@
 #include <sys/shm.h>
 #include "pcm_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_MMAP           /* debug mmap_commit */
@@ -1203,7 +1206,12 @@ int snd_pcm_hw_open(snd_pcm_t **pcmp, const char *name,
                fmode |= O_NONBLOCK;
        if (mode & SND_PCM_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;
                SYSMSG("open %s failed", filename);
                goto _err;
index ff4d523fc91f03a06e3a1222a742bb1ee8fd29c8..279e6919d2c19a8ba0e7904c5b56b93d4ea739de 100644 (file)
@@ -28,6 +28,9 @@
 #include <sys/ioctl.h>
 #include "../control/control_local.h"
 #include "rawmidi_local.h"
+#ifdef SUPPORT_RESMGR
+#include <resmgr.h>
+#endif
 
 #ifndef PIC
 /* 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)));
 
-       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);
-               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);
                        SYSERR("open %s failed", filename);
                        return -errno;
index 6e9b70cb2fd5bbec38f42b41d444b68f836a4484..d1b3a3364ea8ae80fc22913d9a20bbc69f4e6539 100644 (file)
@@ -23,6 +23,9 @@
 #include <fcntl.h>
 #include <sys/ioctl.h>
 #include "seq_local.h"
+#ifdef SUPPORT_RESMGR
+#include <resmgr.h>
+#endif
 
 #ifndef PIC
 /* 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 fd, ver, client, fmode, ret;
-       char filename[32];
+       const char *filename;
        snd_seq_t *seq;
        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)
                fmode |= O_NONBLOCK;
 
-       sprintf(filename, SNDRV_FILE_SEQ);
-       if ((fd = open(filename, fmode)) < 0) {
-               close(open(SNDRV_FILE_ALOADSEQ, O_RDWR));
-               if ((fd = open(filename, fmode)) < 0) {
+       filename = SNDRV_FILE_SEQ;
+#ifdef SUPPORT_RESMGR
+       fd = rsm_open_device(filename, fmode);
+#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);
                        return -errno;
                }
index 2ea2aa982aec801c020a553d675187a000a9c615..d09c7a8f104d991cbf5d228f25606b2e2709b361 100644 (file)
@@ -27,6 +27,9 @@
 #include <fcntl.h>
 #include <sys/ioctl.h>
 #include "timer_local.h"
+#ifdef SUPPORT_RESMGR
+#include <resmgr.h>
+#endif
 
 #ifndef PIC
 /* 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;
        if (mode & SND_TIMER_OPEN_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;
 #if 0
        /*
index 5f1e5b6ab9d0f3de741a4fc6033c7992c09d37ff..cb0e03c8c8d5c5c6c0eb89f9c3b2f2bf736d6f05 100644 (file)
@@ -26,6 +26,9 @@
 #include <fcntl.h>
 #include <sys/ioctl.h>
 #include "timer_local.h"
+#ifdef SUPPORT_RESMGR
+#include <resmgr.h>
+#endif
 
 #ifndef PIC
 /* 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;
        if (mode & SND_TIMER_OPEN_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;
        if (ioctl(fd, SNDRV_TIMER_IOCTL_PVERSION, &ver) < 0) {
                close(fd);