blob: ea256b825146642480ba963169115700e331480c [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001#ifndef __SOUND_SEQ_DEVICE_H
2#define __SOUND_SEQ_DEVICE_H
3
4/*
5 * ALSA sequencer device management
6 * Copyright (c) 1999 by Takashi Iwai <tiwai@suse.de>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 *
22 */
23
Linus Torvalds1da177e2005-04-16 15:20:36 -070024/*
25 * registered device information
26 */
27
28#define ID_LEN 32
29
30/* status flag */
31#define SNDRV_SEQ_DEVICE_FREE 0
32#define SNDRV_SEQ_DEVICE_REGISTERED 1
33
34struct snd_seq_device {
35 /* device info */
Takashi Iwaic7e0b5b2005-11-17 14:04:02 +010036 struct snd_card *card; /* sound card */
Linus Torvalds1da177e2005-04-16 15:20:36 -070037 int device; /* device number */
38 char id[ID_LEN]; /* driver id */
39 char name[80]; /* device name */
40 int argsize; /* size of the argument */
41 void *driver_data; /* private data for driver */
42 int status; /* flag - read only */
43 void *private_data; /* private data for the caller */
Takashi Iwaic7e0b5b2005-11-17 14:04:02 +010044 void (*private_free)(struct snd_seq_device *device);
Linus Torvalds1da177e2005-04-16 15:20:36 -070045 struct list_head list; /* link to next device */
Takashi Iwai7c37ae52015-02-12 10:51:59 +010046 struct device dev;
Linus Torvalds1da177e2005-04-16 15:20:36 -070047};
48
Takashi Iwai7c37ae52015-02-12 10:51:59 +010049#define to_seq_dev(_dev) \
50 container_of(_dev, struct snd_seq_device, dev)
Linus Torvalds1da177e2005-04-16 15:20:36 -070051
52/* driver operators
53 * init_device:
54 * Initialize the device with given parameters.
55 * Typically,
56 * 1. call snd_hwdep_new
57 * 2. allocate private data and initialize it
58 * 3. call snd_hwdep_register
59 * 4. store the instance to dev->driver_data pointer.
60 *
61 * free_device:
62 * Release the private data.
63 * Typically, call snd_device_free(dev->card, dev->driver_data)
64 */
65struct snd_seq_dev_ops {
Takashi Iwaic7e0b5b2005-11-17 14:04:02 +010066 int (*init_device)(struct snd_seq_device *dev);
67 int (*free_device)(struct snd_seq_device *dev);
Linus Torvalds1da177e2005-04-16 15:20:36 -070068};
69
70/*
71 * prototypes
72 */
Takashi Iwai72496ed2015-02-11 22:39:51 +010073#ifdef CONFIG_MODULES
Linus Torvalds1da177e2005-04-16 15:20:36 -070074void snd_seq_device_load_drivers(void);
Takashi Iwai72496ed2015-02-11 22:39:51 +010075#else
76#define snd_seq_device_load_drivers()
77#endif
Takashi Iwaic7e0b5b2005-11-17 14:04:02 +010078int snd_seq_device_new(struct snd_card *card, int device, char *id, int argsize, struct snd_seq_device **result);
79int snd_seq_device_register_driver(char *id, struct snd_seq_dev_ops *entry, int argsize);
Linus Torvalds1da177e2005-04-16 15:20:36 -070080int snd_seq_device_unregister_driver(char *id);
81
Takashi Iwaic7e0b5b2005-11-17 14:04:02 +010082#define SNDRV_SEQ_DEVICE_ARGPTR(dev) (void *)((char *)(dev) + sizeof(struct snd_seq_device))
Linus Torvalds1da177e2005-04-16 15:20:36 -070083
84
85/*
86 * id strings for generic devices
87 */
88#define SNDRV_SEQ_DEV_ID_MIDISYNTH "seq-midi"
89#define SNDRV_SEQ_DEV_ID_OPL3 "opl3-synth"
90
Linus Torvalds1da177e2005-04-16 15:20:36 -070091#endif /* __SOUND_SEQ_DEVICE_H */