initial commit with v2.6.9
[linux-2.6.9-moxart.git] / sound / core / ioctl32 / rawmidi32.c
blob5ff21249e556b237262e2b7dca300d0d5317e566
1 /*
2 * 32bit -> 64bit ioctl wrapper for raw MIDI 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>
23 #include <linux/fs.h>
24 #include <linux/compat.h>
25 #include <sound/core.h>
26 #include <sound/rawmidi.h>
27 #include <asm/uaccess.h>
28 #include "ioctl32.h"
30 struct sndrv_rawmidi_params32 {
31 s32 stream;
32 u32 buffer_size;
33 u32 avail_min;
34 unsigned int no_active_sensing; /* avoid bit-field */
35 unsigned char reserved[16];
36 } __attribute__((packed));
38 #define CVT_sndrv_rawmidi_params()\
40 COPY(stream);\
41 COPY(buffer_size);\
42 COPY(avail_min);\
43 COPY(no_active_sensing);\
46 struct sndrv_rawmidi_status32 {
47 s32 stream;
48 struct compat_timespec tstamp;
49 u32 avail;
50 u32 xruns;
51 unsigned char reserved[16];
52 } __attribute__((packed));
54 #define CVT_sndrv_rawmidi_status()\
56 COPY(stream);\
57 COPY(tstamp.tv_sec);\
58 COPY(tstamp.tv_nsec);\
59 COPY(avail);\
60 COPY(xruns);\
63 DEFINE_ALSA_IOCTL(rawmidi_params);
64 DEFINE_ALSA_IOCTL(rawmidi_status);
66 DEFINE_ALSA_IOCTL_ENTRY(rawmidi_params, rawmidi_params, SNDRV_RAWMIDI_IOCTL_PARAMS);
67 DEFINE_ALSA_IOCTL_ENTRY(rawmidi_status, rawmidi_status, SNDRV_RAWMIDI_IOCTL_STATUS);
69 #define AP(x) snd_ioctl32_##x
71 enum {
72 SNDRV_RAWMIDI_IOCTL_PARAMS32 = _IOWR('W', 0x10, struct sndrv_rawmidi_params32),
73 SNDRV_RAWMIDI_IOCTL_STATUS32 = _IOWR('W', 0x20, struct sndrv_rawmidi_status32),
76 struct ioctl32_mapper rawmidi_mappers[] = {
77 MAP_COMPAT(SNDRV_RAWMIDI_IOCTL_PVERSION),
78 MAP_COMPAT(SNDRV_RAWMIDI_IOCTL_INFO),
79 { SNDRV_RAWMIDI_IOCTL_PARAMS32, AP(rawmidi_params) },
80 { SNDRV_RAWMIDI_IOCTL_STATUS32, AP(rawmidi_status) },
81 MAP_COMPAT(SNDRV_RAWMIDI_IOCTL_DROP),
82 MAP_COMPAT(SNDRV_RAWMIDI_IOCTL_DRAIN),
84 MAP_COMPAT(SNDRV_CTL_IOCTL_RAWMIDI_NEXT_DEVICE),
85 MAP_COMPAT(SNDRV_CTL_IOCTL_RAWMIDI_INFO),
86 MAP_COMPAT(SNDRV_CTL_IOCTL_RAWMIDI_PREFER_SUBDEVICE),
88 { 0 },