2 * 32bit -> 64bit ioctl wrapper for timer API
3 * Copyright (c) by Takashi Iwai <tiwai@suse.de>
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 #include <sound/driver.h>
22 #include <linux/time.h>
24 #include <linux/compat.h>
25 #include <sound/core.h>
26 #include <sound/timer.h>
27 #include <asm/uaccess.h>
30 struct sndrv_timer_info32 {
34 unsigned char name[80];
37 unsigned char reserved[64];
40 #define CVT_sndrv_timer_info()\
46 COPY_CVT(resolution);\
49 struct sndrv_timer_status32 {
50 struct compat_timespec tstamp;
55 unsigned char reserved[64];
58 #define CVT_sndrv_timer_status()\
60 COPY_CVT(tstamp.tv_sec);\
61 COPY_CVT(tstamp.tv_nsec);\
68 DEFINE_ALSA_IOCTL(timer_info);
69 DEFINE_ALSA_IOCTL(timer_status);
71 DEFINE_ALSA_IOCTL_ENTRY(timer_info, timer_info, SNDRV_TIMER_IOCTL_INFO);
72 DEFINE_ALSA_IOCTL_ENTRY(timer_status, timer_status, SNDRV_TIMER_IOCTL_STATUS);
77 #define AP(x) snd_ioctl32_##x
80 SNDRV_TIMER_IOCTL_INFO32 = _IOR('T', 0x11, struct sndrv_timer_info32),
81 SNDRV_TIMER_IOCTL_STATUS32 = _IOW('T', 0x14, struct sndrv_timer_status32),
84 struct ioctl32_mapper timer_mappers[] = {
85 MAP_COMPAT(SNDRV_TIMER_IOCTL_PVERSION),
86 MAP_COMPAT(SNDRV_TIMER_IOCTL_NEXT_DEVICE),
87 MAP_COMPAT(SNDRV_TIMER_IOCTL_SELECT),
88 { SNDRV_TIMER_IOCTL_INFO32, AP(timer_info) },
89 MAP_COMPAT(SNDRV_TIMER_IOCTL_PARAMS),
90 { SNDRV_TIMER_IOCTL_STATUS32, AP(timer_status) },
93 * The following four entries are disabled because they conflict
94 * with the TCOC* definitions.
95 * Unfortunately, the current ioctl32 wrapper uses a single
96 * hash table for all devices. Once when the wrapper is fixed
97 * with the table based on devices, they'll be back again.
99 MAP_COMPAT(SNDRV_TIMER_IOCTL_START),
100 MAP_COMPAT(SNDRV_TIMER_IOCTL_STOP),
101 MAP_COMPAT(SNDRV_TIMER_IOCTL_CONTINUE),
102 MAP_COMPAT(SNDRV_TIMER_IOCTL_PAUSE),