seq_device.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. #ifndef __SOUND_SEQ_DEVICE_H
  2. #define __SOUND_SEQ_DEVICE_H
  3. /*
  4. * ALSA sequencer device management
  5. * Copyright (c) 1999 by Takashi Iwai <tiwai@suse.de>
  6. *
  7. * This program is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License as published by
  9. * the Free Software Foundation; either version 2 of the License, or
  10. * (at your option) any later version.
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with this program; if not, write to the Free Software
  19. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  20. *
  21. */
  22. /*
  23. * registered device information
  24. */
  25. struct snd_seq_device {
  26. /* device info */
  27. struct snd_card *card; /* sound card */
  28. int device; /* device number */
  29. const char *id; /* driver id */
  30. char name[80]; /* device name */
  31. int argsize; /* size of the argument */
  32. void *driver_data; /* private data for driver */
  33. void *private_data; /* private data for the caller */
  34. void (*private_free)(struct snd_seq_device *device);
  35. struct device dev;
  36. };
  37. #define to_seq_dev(_dev) \
  38. container_of(_dev, struct snd_seq_device, dev)
  39. /* sequencer driver */
  40. /* driver operators
  41. * probe:
  42. * Initialize the device with given parameters.
  43. * Typically,
  44. * 1. call snd_hwdep_new
  45. * 2. allocate private data and initialize it
  46. * 3. call snd_hwdep_register
  47. * 4. store the instance to dev->driver_data pointer.
  48. *
  49. * remove:
  50. * Release the private data.
  51. * Typically, call snd_device_free(dev->card, dev->driver_data)
  52. */
  53. struct snd_seq_driver {
  54. struct device_driver driver;
  55. char *id;
  56. int argsize;
  57. };
  58. #define to_seq_drv(_drv) \
  59. container_of(_drv, struct snd_seq_driver, driver)
  60. /*
  61. * prototypes
  62. */
  63. #ifdef CONFIG_MODULES
  64. void snd_seq_device_load_drivers(void);
  65. #else
  66. #define snd_seq_device_load_drivers()
  67. #endif
  68. int snd_seq_device_new(struct snd_card *card, int device, const char *id,
  69. int argsize, struct snd_seq_device **result);
  70. #define SNDRV_SEQ_DEVICE_ARGPTR(dev) (void *)((char *)(dev) + sizeof(struct snd_seq_device))
  71. int __must_check __snd_seq_driver_register(struct snd_seq_driver *drv,
  72. struct module *mod);
  73. #define snd_seq_driver_register(drv) \
  74. __snd_seq_driver_register(drv, THIS_MODULE)
  75. void snd_seq_driver_unregister(struct snd_seq_driver *drv);
  76. #define module_snd_seq_driver(drv) \
  77. module_driver(drv, snd_seq_driver_register, snd_seq_driver_unregister)
  78. /*
  79. * id strings for generic devices
  80. */
  81. #define SNDRV_SEQ_DEV_ID_MIDISYNTH "seq-midi"
  82. #define SNDRV_SEQ_DEV_ID_OPL3 "opl3-synth"
  83. #endif /* __SOUND_SEQ_DEVICE_H */