All of lore.kernel.org
 help / color / mirror / Atom feed
From: Laurent Vivier <laurent@vivier.eu>
To: qemu-devel@nongnu.org
Cc: Riku Voipio <riku.voipio@iki.fi>,
	Laurent Vivier <laurent@vivier.eu>,
	Filip Bozuta <Filip.Bozuta@rt-rk.com>,
	Aleksandar Markovic <amarkovic@wavecomp.com>,
	Aleksandar Rikalo <aleksandar.rikalo@rt-rk.com>,
	Aurelien Jarno <aurelien@aurel32.net>
Subject: [PULL 11/13] linux-user: Add support for selecting alsa timer using ioctl
Date: Thu, 20 Feb 2020 10:20:51 +0100	[thread overview]
Message-ID: <20200220092053.1510215-12-laurent@vivier.eu> (raw)
In-Reply-To: <20200220092053.1510215-1-laurent@vivier.eu>

From: Filip Bozuta <Filip.Bozuta@rt-rk.com>

This patch implements functionality of following ioctl:

SNDRV_TIMER_IOCTL_SELECT - Selecting timer

    Selects the timer which id is specified. The timer id is specified in the
    following strcuture:

    struct snd_timer_select {
        struct snd_timer_id id;         /* timer ID */
        unsigned char reserved[32];     /* reserved */
    };

    A pointer to this structure should be passed as the third ioctl's argument.
    Before calling the ioctl, the field "tid" should be initialized with the id
    information for the timer which is to be selected. If there is no timer
    device with the specified id, the error ENODEV ("No such device") is
    returned.

Implementation notes:

    Ioctl implemented in this patch has a pointer to a
    'struct snd_timer_select' as its third argument.
    That is the reason why a corresponding definition
    was added in 'linux-user/syscall_types.h'. The rest
    of the implementation was straightforward.

Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Signed-off-by: Filip Bozuta <Filip.Bozuta@rt-rk.com>
Message-Id: <1579117007-7565-11-git-send-email-Filip.Bozuta@rt-rk.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
---
 linux-user/ioctls.h        | 2 ++
 linux-user/syscall_defs.h  | 7 +++++++
 linux-user/syscall_types.h | 4 ++++
 3 files changed, 13 insertions(+)

diff --git a/linux-user/ioctls.h b/linux-user/ioctls.h
index 150aa680b018..8313af3672c6 100644
--- a/linux-user/ioctls.h
+++ b/linux-user/ioctls.h
@@ -470,6 +470,8 @@
         MK_PTR(MK_STRUCT(STRUCT_snd_timer_gparams)))
   IOCTL(SNDRV_TIMER_IOCTL_GSTATUS, IOC_RW,
         MK_PTR(MK_STRUCT(STRUCT_snd_timer_gstatus)))
+  IOCTL(SNDRV_TIMER_IOCTL_SELECT, IOC_W,
+        MK_PTR(MK_STRUCT(STRUCT_snd_timer_select)))
 
   IOCTL(HDIO_GETGEO, IOC_R, MK_PTR(MK_STRUCT(STRUCT_hd_geometry)))
   IOCTL(HDIO_GET_UNMASKINTR, IOC_R, MK_PTR(TYPE_INT))
diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h
index c714e8b67b6e..cac9228a37d0 100644
--- a/linux-user/syscall_defs.h
+++ b/linux-user/syscall_defs.h
@@ -2474,6 +2474,11 @@ struct target_snd_timer_gstatus {
     unsigned char reserved[32];
 };
 
+struct target_snd_timer_select {
+    struct target_snd_timer_id id;
+    unsigned char reserved[32];
+};
+
 /* alsa timer ioctls */
 #define TARGET_SNDRV_TIMER_IOCTL_PVERSION     TARGET_IOR('T', 0x00, int)
 #define TARGET_SNDRV_TIMER_IOCTL_NEXT_DEVICE  TARGET_IOWR('T', 0x01,           \
@@ -2484,6 +2489,8 @@ struct target_snd_timer_gstatus {
                                                 struct target_snd_timer_gparams)
 #define TARGET_SNDRV_TIMER_IOCTL_GSTATUS      TARGET_IOWR('T', 0x05,           \
                                                 struct target_snd_timer_gstatus)
+#define TARGET_SNDRV_TIMER_IOCTL_SELECT       TARGET_IOW('T', 0x10,            \
+                                                struct target_snd_timer_select)
 
 /* vfat ioctls */
 #define TARGET_VFAT_IOCTL_READDIR_BOTH    TARGET_IORU('r', 1)
diff --git a/linux-user/syscall_types.h b/linux-user/syscall_types.h
index adcfa2822468..81bc71938241 100644
--- a/linux-user/syscall_types.h
+++ b/linux-user/syscall_types.h
@@ -116,6 +116,10 @@ STRUCT(snd_timer_gstatus,
        TYPE_ULONG, /* resolution_den */
        MK_ARRAY(TYPE_CHAR, 32)) /* reserved */
 
+STRUCT(snd_timer_select,
+       MK_STRUCT(STRUCT_snd_timer_id), /* id */
+       MK_ARRAY(TYPE_CHAR, 32)) /* reserved */
+
 /* loop device ioctls */
 STRUCT(loop_info,
        TYPE_INT,                 /* lo_number */
-- 
2.24.1



  parent reply	other threads:[~2020-02-20  9:27 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-20  9:20 [PULL 00/13] Linux user for 5.0 patches Laurent Vivier
2020-02-20  9:20 ` [PULL 01/13] linux-user: Implement membarrier syscall Laurent Vivier
2020-02-20  9:20 ` [PULL 02/13] linux-user: implement getsockopt SO_RCVTIMEO and SO_SNDTIMEO Laurent Vivier
2020-02-20  9:20 ` [PULL 03/13] configure: linux-user doesn't need neither fdt nor slirp Laurent Vivier
2020-02-20  9:20 ` [PULL 04/13] linux-user/strace: Improve output of various syscalls Laurent Vivier
2020-02-20  9:20 ` [PULL 05/13] configure: Avoid compiling system tools on user build by default Laurent Vivier
2020-02-20  9:20 ` [PULL 06/13] linux-user: Use `qemu_log' for non-strace logging Laurent Vivier
2020-02-20  9:20 ` [PULL 07/13] linux-user: Use `qemu_log' for strace Laurent Vivier
2020-02-20  9:20 ` [PULL 08/13] linux-user: remove gemu_log from the linux-user tree Laurent Vivier
2020-02-20  9:20 ` [PULL 09/13] linux-user: Add support for getting alsa timer version and id Laurent Vivier
2020-02-20  9:20 ` [PULL 10/13] linux-user: Add support for getting/setting specified alsa timer parameters using ioctls Laurent Vivier
2020-02-20  9:20 ` Laurent Vivier [this message]
2020-02-20  9:20 ` [PULL 12/13] linux-user: Add support for getting/setting selected " Laurent Vivier
2020-02-20  9:20 ` [PULL 13/13] linux-user: Add support for selected alsa timer instructions " Laurent Vivier
2020-02-21 11:24 ` [PULL 00/13] Linux user for 5.0 patches Peter Maydell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200220092053.1510215-12-laurent@vivier.eu \
    --to=laurent@vivier.eu \
    --cc=Filip.Bozuta@rt-rk.com \
    --cc=aleksandar.rikalo@rt-rk.com \
    --cc=amarkovic@wavecomp.com \
    --cc=aurelien@aurel32.net \
    --cc=qemu-devel@nongnu.org \
    --cc=riku.voipio@iki.fi \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.