seq_device.h 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  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. #define ID_LEN 32
  26. /* status flag */
  27. #define SNDRV_SEQ_DEVICE_FREE 0
  28. #define SNDRV_SEQ_DEVICE_REGISTERED 1
  29. struct snd_seq_device {
  30. /* device info */
  31. struct snd_card *card; /* sound card */
  32. int device; /* device number */
  33. char id[ID_LEN]; /* driver id */
  34. char name[80]; /* device name */
  35. int argsize; /* size of the argument */
  36. void *driver_data; /* private data for driver */
  37. int status; /* flag - read only */
  38. void *private_data; /* private data for the caller */
  39. void (*private_free)(struct snd_seq_device *device);
  40. struct list_head list; /* link to next device */
  41. };
  42. /* driver operators
  43. * init_device:
  44. * Initialize the device with given parameters.
  45. * Typically,
  46. * 1. call snd_hwdep_new
  47. * 2. allocate private data and initialize it
  48. * 3. call snd_hwdep_register
  49. * 4. store the instance to dev->driver_data pointer.
  50. *
  51. * free_device:
  52. * Release the private data.
  53. * Typically, call snd_device_free(dev->card, dev->driver_data)
  54. */
  55. struct snd_seq_dev_ops {
  56. int (*init_device)(struct snd_seq_device *dev);
  57. int (*free_device)(struct snd_seq_device *dev);
  58. };
  59. /*
  60. * prototypes
  61. */
  62. void snd_seq_device_load_drivers(void);
  63. int snd_seq_device_new(struct snd_card *card, int device, char *id, int argsize, struct snd_seq_device **result);
  64. int snd_seq_device_register_driver(char *id, struct snd_seq_dev_ops *entry, int argsize);
  65. int snd_seq_device_unregister_driver(char *id);
  66. #define SNDRV_SEQ_DEVICE_ARGPTR(dev) (void *)((char *)(dev) + sizeof(struct snd_seq_device))
  67. /*
  68. * id strings for generic devices
  69. */
  70. #define SNDRV_SEQ_DEV_ID_MIDISYNTH "seq-midi"
  71. #define SNDRV_SEQ_DEV_ID_OPL3 "opl3-synth"
  72. #endif /* __SOUND_SEQ_DEVICE_H */