blob: 204ca540c28ec0aa7998912c416a2665873e559c [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
24typedef struct snd_seq_device snd_seq_device_t;
25typedef struct snd_seq_dev_ops snd_seq_dev_ops_t;
26
27/*
28 * registered device information
29 */
30
31#define ID_LEN 32
32
33/* status flag */
34#define SNDRV_SEQ_DEVICE_FREE 0
35#define SNDRV_SEQ_DEVICE_REGISTERED 1
36
37struct snd_seq_device {
38 /* device info */
39 snd_card_t *card; /* sound card */
40 int device; /* device number */
41 char id[ID_LEN]; /* driver id */
42 char name[80]; /* device name */
43 int argsize; /* size of the argument */
44 void *driver_data; /* private data for driver */
45 int status; /* flag - read only */
46 void *private_data; /* private data for the caller */
47 void (*private_free)(snd_seq_device_t *device);
48 struct list_head list; /* link to next device */
49};
50
51
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 {
66 int (*init_device)(snd_seq_device_t *dev);
67 int (*free_device)(snd_seq_device_t *dev);
68};
69
70/*
71 * prototypes
72 */
73void snd_seq_device_load_drivers(void);
74int snd_seq_device_new(snd_card_t *card, int device, char *id, int argsize, snd_seq_device_t **result);
75int snd_seq_device_register_driver(char *id, snd_seq_dev_ops_t *entry, int argsize);
76int snd_seq_device_unregister_driver(char *id);
77
78#define SNDRV_SEQ_DEVICE_ARGPTR(dev) (void *)((char *)(dev) + sizeof(snd_seq_device_t))
79
80
81/*
82 * id strings for generic devices
83 */
84#define SNDRV_SEQ_DEV_ID_MIDISYNTH "seq-midi"
85#define SNDRV_SEQ_DEV_ID_OPL3 "opl3-synth"
86
87
88#endif /* __SOUND_SEQ_DEVICE_H */