| 1 |
|
| 2 | #ifndef __SOUND_SEQ_DEVICE_H
|
| 3 | #define __SOUND_SEQ_DEVICE_H
|
| 4 |
|
| 5 | |
| 6 | * ALSA sequencer device management
|
| 7 | * Copyright (c) 1999 by Takashi Iwai <[email protected]>
|
| 8 |
|
| 9 |
|
| 10 | |
| 11 | * registered device information
|
| 12 |
|
| 13 |
|
| 14 | struct snd_seq_device {
|
| 15 |
|
| 16 | struct snd_card *card;
|
| 17 | int device;
|
| 18 | const char *id;
|
| 19 | char name[80];
|
| 20 | int argsize;
|
| 21 | void *driver_data;
|
| 22 | void *private_data;
|
| 23 | void (*private_free)(struct snd_seq_device *device);
|
| 24 | struct device dev;
|
| 25 | unsigned char args[];
|
| 26 | };
|
| 27 |
|
| 28 | #define to_seq_dev(_dev) \
|
| 29 | container_of(_dev, struct snd_seq_device, dev)
|
| 30 |
|
| 31 |
|
| 32 |
|
| 33 | |
| 34 | * probe:
|
| 35 | * Initialize the device with given parameters.
|
| 36 | * Typically,
|
| 37 | * 1. call snd_hwdep_new
|
| 38 | * 2. allocate private data and initialize it
|
| 39 | * 3. call snd_hwdep_register
|
| 40 | * 4. store the instance to dev->driver_data pointer.
|
| 41 | *
|
| 42 | * remove:
|
| 43 | * Release the private data.
|
| 44 | * Typically, call snd_device_free(dev->card, dev->driver_data)
|
| 45 |
|
| 46 | struct snd_seq_driver {
|
| 47 | int (*probe)(struct snd_seq_device *dev);
|
| 48 | void (*remove)(struct snd_seq_device *dev);
|
| 49 | struct device_driver driver;
|
| 50 | char *id;
|
| 51 | int argsize;
|
| 52 | };
|
| 53 |
|
| 54 | #define to_seq_drv(_drv) \
|
| 55 | container_of(_drv, struct snd_seq_driver, driver)
|
| 56 |
|
| 57 | |
| 58 | * prototypes
|
| 59 |
|
| 60 | #ifdef CONFIG_MODULES
|
| 61 | void snd_seq_device_load_drivers(void);
|
| 62 | #else
|
| 63 | #define snd_seq_device_load_drivers()
|
| 64 | #endif
|
| 65 | int snd_seq_device_new(struct snd_card *card, int device, const char *id,
|
| 66 | int argsize, struct snd_seq_device **result);
|
| 67 |
|
| 68 | #define SNDRV_SEQ_DEVICE_ARGPTR(dev) ((void *)(dev)->args)
|
| 69 |
|
| 70 | int __must_check __snd_seq_driver_register(struct snd_seq_driver *drv,
|
| 71 | struct module *mod);
|
| 72 | #define snd_seq_driver_register(drv) \
|
| 73 | __snd_seq_driver_register(drv, THIS_MODULE)
|
| 74 | void snd_seq_driver_unregister(struct snd_seq_driver *drv);
|
| 75 |
|
| 76 | #define module_snd_seq_driver(drv) \
|
| 77 | module_driver(drv, snd_seq_driver_register, snd_seq_driver_unregister)
|
| 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 | #define SNDRV_SEQ_DEV_ID_UMP "seq-ump-client"
|
| 85 |
|
| 86 | #endif
|