summaryrefslogtreecommitdiff
path: root/src/control/control_shm.c
diff options
context:
space:
mode:
authorJaroslav Kysela <perex@perex.cz>2001-04-19 13:53:39 +0000
committerJaroslav Kysela <perex@perex.cz>2001-04-19 13:53:39 +0000
commit12a47782cb0ae147a396b6bcbbe7909edd8a47be (patch)
treed01f13769040c918e5be629de9246ca7aeb3fc29 /src/control/control_shm.c
parent192d3c92263cf7330f7ddbd9cfe46751f4bd46df (diff)
downloadalsa-lib-12a47782cb0ae147a396b6bcbbe7909edd8a47be.tar.gz
Added ctl_elem_lock and unlock code...
Diffstat (limited to 'src/control/control_shm.c')
-rw-r--r--src/control/control_shm.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/control/control_shm.c b/src/control/control_shm.c
index f525f178..cbc5aef9 100644
--- a/src/control/control_shm.c
+++ b/src/control/control_shm.c
@@ -207,6 +207,34 @@ static int snd_ctl_shm_elem_write(snd_ctl_t *ctl, snd_ctl_elem_value_t *control)
return err;
}
+static int snd_ctl_shm_elem_lock(snd_ctl_t *ctl, snd_ctl_elem_id_t *id)
+{
+ snd_ctl_shm_t *shm = ctl->private_data;
+ volatile snd_ctl_shm_ctrl_t *ctrl = shm->ctrl;
+ int err;
+ ctrl->u.element_lock = *id;
+ ctrl->cmd = SNDRV_CTL_IOCTL_ELEM_LOCK;
+ err = snd_ctl_shm_action(ctl);
+ if (err < 0)
+ return err;
+ *id = ctrl->u.element_lock;
+ return err;
+}
+
+static int snd_ctl_shm_elem_unlock(snd_ctl_t *ctl, snd_ctl_elem_id_t *id)
+{
+ snd_ctl_shm_t *shm = ctl->private_data;
+ volatile snd_ctl_shm_ctrl_t *ctrl = shm->ctrl;
+ int err;
+ ctrl->u.element_unlock = *id;
+ ctrl->cmd = SNDRV_CTL_IOCTL_ELEM_UNLOCK;
+ err = snd_ctl_shm_action(ctl);
+ if (err < 0)
+ return err;
+ *id = ctrl->u.element_unlock;
+ return err;
+}
+
static int snd_ctl_shm_hwdep_next_device(snd_ctl_t *ctl, int * device)
{
snd_ctl_shm_t *shm = ctl->private_data;
@@ -362,6 +390,8 @@ snd_ctl_ops_t snd_ctl_shm_ops = {
element_info: snd_ctl_shm_elem_info,
element_read: snd_ctl_shm_elem_read,
element_write: snd_ctl_shm_elem_write,
+ element_lock: snd_ctl_shm_elem_lock,
+ element_unlock: snd_ctl_shm_elem_unlock,
hwdep_next_device: snd_ctl_shm_hwdep_next_device,
hwdep_info: snd_ctl_shm_hwdep_info,
pcm_next_device: snd_ctl_shm_pcm_next_device,