11da177e4SLinus Torvalds #ifndef __SOUND_SEQ_DEVICE_H 21da177e4SLinus Torvalds #define __SOUND_SEQ_DEVICE_H 31da177e4SLinus Torvalds 41da177e4SLinus Torvalds /* 51da177e4SLinus Torvalds * ALSA sequencer device management 61da177e4SLinus Torvalds * Copyright (c) 1999 by Takashi Iwai <tiwai@suse.de> 71da177e4SLinus Torvalds * 81da177e4SLinus Torvalds * This program is free software; you can redistribute it and/or modify 91da177e4SLinus Torvalds * it under the terms of the GNU General Public License as published by 101da177e4SLinus Torvalds * the Free Software Foundation; either version 2 of the License, or 111da177e4SLinus Torvalds * (at your option) any later version. 121da177e4SLinus Torvalds * 131da177e4SLinus Torvalds * This program is distributed in the hope that it will be useful, 141da177e4SLinus Torvalds * but WITHOUT ANY WARRANTY; without even the implied warranty of 151da177e4SLinus Torvalds * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 161da177e4SLinus Torvalds * GNU General Public License for more details. 171da177e4SLinus Torvalds * 181da177e4SLinus Torvalds * You should have received a copy of the GNU General Public License 191da177e4SLinus Torvalds * along with this program; if not, write to the Free Software 201da177e4SLinus Torvalds * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 211da177e4SLinus Torvalds * 221da177e4SLinus Torvalds */ 231da177e4SLinus Torvalds 241da177e4SLinus Torvalds /* 251da177e4SLinus Torvalds * registered device information 261da177e4SLinus Torvalds */ 271da177e4SLinus Torvalds 281da177e4SLinus Torvalds struct snd_seq_device { 291da177e4SLinus Torvalds /* device info */ 30c7e0b5bfSTakashi Iwai struct snd_card *card; /* sound card */ 311da177e4SLinus Torvalds int device; /* device number */ 32*af03c243STakashi Iwai const char *id; /* driver id */ 331da177e4SLinus Torvalds char name[80]; /* device name */ 341da177e4SLinus Torvalds int argsize; /* size of the argument */ 351da177e4SLinus Torvalds void *driver_data; /* private data for driver */ 361da177e4SLinus Torvalds void *private_data; /* private data for the caller */ 37c7e0b5bfSTakashi Iwai void (*private_free)(struct snd_seq_device *device); 387c37ae5cSTakashi Iwai struct device dev; 391da177e4SLinus Torvalds }; 401da177e4SLinus Torvalds 417c37ae5cSTakashi Iwai #define to_seq_dev(_dev) \ 427c37ae5cSTakashi Iwai container_of(_dev, struct snd_seq_device, dev) 431da177e4SLinus Torvalds 441da177e4SLinus Torvalds /* driver operators 451da177e4SLinus Torvalds * init_device: 461da177e4SLinus Torvalds * Initialize the device with given parameters. 471da177e4SLinus Torvalds * Typically, 481da177e4SLinus Torvalds * 1. call snd_hwdep_new 491da177e4SLinus Torvalds * 2. allocate private data and initialize it 501da177e4SLinus Torvalds * 3. call snd_hwdep_register 511da177e4SLinus Torvalds * 4. store the instance to dev->driver_data pointer. 521da177e4SLinus Torvalds * 531da177e4SLinus Torvalds * free_device: 541da177e4SLinus Torvalds * Release the private data. 551da177e4SLinus Torvalds * Typically, call snd_device_free(dev->card, dev->driver_data) 561da177e4SLinus Torvalds */ 571da177e4SLinus Torvalds struct snd_seq_dev_ops { 58c7e0b5bfSTakashi Iwai int (*init_device)(struct snd_seq_device *dev); 59c7e0b5bfSTakashi Iwai int (*free_device)(struct snd_seq_device *dev); 601da177e4SLinus Torvalds }; 611da177e4SLinus Torvalds 621da177e4SLinus Torvalds /* 631da177e4SLinus Torvalds * prototypes 641da177e4SLinus Torvalds */ 6572496edcSTakashi Iwai #ifdef CONFIG_MODULES 661da177e4SLinus Torvalds void snd_seq_device_load_drivers(void); 6772496edcSTakashi Iwai #else 6872496edcSTakashi Iwai #define snd_seq_device_load_drivers() 6972496edcSTakashi Iwai #endif 70*af03c243STakashi Iwai int snd_seq_device_new(struct snd_card *card, int device, const char *id, 71*af03c243STakashi Iwai int argsize, struct snd_seq_device **result); 72*af03c243STakashi Iwai int snd_seq_device_register_driver(const char *id, 73*af03c243STakashi Iwai struct snd_seq_dev_ops *entry, int argsize); 74*af03c243STakashi Iwai int snd_seq_device_unregister_driver(const char *id); 751da177e4SLinus Torvalds 76c7e0b5bfSTakashi Iwai #define SNDRV_SEQ_DEVICE_ARGPTR(dev) (void *)((char *)(dev) + sizeof(struct snd_seq_device)) 771da177e4SLinus Torvalds 781da177e4SLinus Torvalds 791da177e4SLinus Torvalds /* 801da177e4SLinus Torvalds * id strings for generic devices 811da177e4SLinus Torvalds */ 821da177e4SLinus Torvalds #define SNDRV_SEQ_DEV_ID_MIDISYNTH "seq-midi" 831da177e4SLinus Torvalds #define SNDRV_SEQ_DEV_ID_OPL3 "opl3-synth" 841da177e4SLinus Torvalds 851da177e4SLinus Torvalds #endif /* __SOUND_SEQ_DEVICE_H */ 86