Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | #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 Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 24 | /* |
| 25 | * registered device information |
| 26 | */ |
| 27 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 28 | struct snd_seq_device { |
| 29 | /* device info */ |
Takashi Iwai | c7e0b5b | 2005-11-17 14:04:02 +0100 | [diff] [blame] | 30 | struct snd_card *card; /* sound card */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 31 | int device; /* device number */ |
Takashi Iwai | af03c24 | 2015-02-12 13:40:50 +0100 | [diff] [blame^] | 32 | const char *id; /* driver id */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 33 | char name[80]; /* device name */ |
| 34 | int argsize; /* size of the argument */ |
| 35 | void *driver_data; /* private data for driver */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 36 | void *private_data; /* private data for the caller */ |
Takashi Iwai | c7e0b5b | 2005-11-17 14:04:02 +0100 | [diff] [blame] | 37 | void (*private_free)(struct snd_seq_device *device); |
Takashi Iwai | 7c37ae5 | 2015-02-12 10:51:59 +0100 | [diff] [blame] | 38 | struct device dev; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 39 | }; |
| 40 | |
Takashi Iwai | 7c37ae5 | 2015-02-12 10:51:59 +0100 | [diff] [blame] | 41 | #define to_seq_dev(_dev) \ |
| 42 | container_of(_dev, struct snd_seq_device, dev) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 43 | |
| 44 | /* driver operators |
| 45 | * init_device: |
| 46 | * Initialize the device with given parameters. |
| 47 | * Typically, |
| 48 | * 1. call snd_hwdep_new |
| 49 | * 2. allocate private data and initialize it |
| 50 | * 3. call snd_hwdep_register |
| 51 | * 4. store the instance to dev->driver_data pointer. |
| 52 | * |
| 53 | * free_device: |
| 54 | * Release the private data. |
| 55 | * Typically, call snd_device_free(dev->card, dev->driver_data) |
| 56 | */ |
| 57 | struct snd_seq_dev_ops { |
Takashi Iwai | c7e0b5b | 2005-11-17 14:04:02 +0100 | [diff] [blame] | 58 | int (*init_device)(struct snd_seq_device *dev); |
| 59 | int (*free_device)(struct snd_seq_device *dev); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 60 | }; |
| 61 | |
| 62 | /* |
| 63 | * prototypes |
| 64 | */ |
Takashi Iwai | 72496ed | 2015-02-11 22:39:51 +0100 | [diff] [blame] | 65 | #ifdef CONFIG_MODULES |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 66 | void snd_seq_device_load_drivers(void); |
Takashi Iwai | 72496ed | 2015-02-11 22:39:51 +0100 | [diff] [blame] | 67 | #else |
| 68 | #define snd_seq_device_load_drivers() |
| 69 | #endif |
Takashi Iwai | af03c24 | 2015-02-12 13:40:50 +0100 | [diff] [blame^] | 70 | int snd_seq_device_new(struct snd_card *card, int device, const char *id, |
| 71 | int argsize, struct snd_seq_device **result); |
| 72 | int snd_seq_device_register_driver(const char *id, |
| 73 | struct snd_seq_dev_ops *entry, int argsize); |
| 74 | int snd_seq_device_unregister_driver(const char *id); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 75 | |
Takashi Iwai | c7e0b5b | 2005-11-17 14:04:02 +0100 | [diff] [blame] | 76 | #define SNDRV_SEQ_DEVICE_ARGPTR(dev) (void *)((char *)(dev) + sizeof(struct snd_seq_device)) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 77 | |
| 78 | |
| 79 | /* |
| 80 | * id strings for generic devices |
| 81 | */ |
| 82 | #define SNDRV_SEQ_DEV_ID_MIDISYNTH "seq-midi" |
| 83 | #define SNDRV_SEQ_DEV_ID_OPL3 "opl3-synth" |
| 84 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 85 | #endif /* __SOUND_SEQ_DEVICE_H */ |