seq_device.h 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  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. typedef struct snd_seq_device snd_seq_device_t;
  23. typedef struct snd_seq_dev_ops snd_seq_dev_ops_t;
  24. /*
  25. * registered device information
  26. */
  27. #define ID_LEN 32
  28. /* status flag */
  29. #define SNDRV_SEQ_DEVICE_FREE 0
  30. #define SNDRV_SEQ_DEVICE_REGISTERED 1
  31. struct snd_seq_device {
  32. /* device info */
  33. snd_card_t *card; /* sound card */
  34. int device; /* device number */
  35. char id[ID_LEN]; /* driver id */
  36. char name[80]; /* device name */
  37. int argsize; /* size of the argument */
  38. void *driver_data; /* private data for driver */
  39. int status; /* flag - read only */
  40. void *private_data; /* private data for the caller */
  41. void (*private_free)(snd_seq_device_t *device);
  42. struct list_head list; /* link to next device */
  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 {
  58. int (*init_device)(snd_seq_device_t *dev);
  59. int (*free_device)(snd_seq_device_t *dev);
  60. };
  61. /*
  62. * prototypes
  63. */
  64. void snd_seq_device_load_drivers(void);
  65. int snd_seq_device_new(snd_card_t *card, int device, char *id, int argsize, snd_seq_device_t **result);
  66. int snd_seq_device_register_driver(char *id, snd_seq_dev_ops_t *entry, int argsize);
  67. int snd_seq_device_unregister_driver(char *id);
  68. #define SNDRV_SEQ_DEVICE_ARGPTR(dev) (void *)((char *)(dev) + sizeof(snd_seq_device_t))
  69. /*
  70. * id strings for generic devices
  71. */
  72. #define SNDRV_SEQ_DEV_ID_MIDISYNTH "seq-midi"
  73. #define SNDRV_SEQ_DEV_ID_OPL3 "opl3-synth"
  74. #endif /* __SOUND_SEQ_DEVICE_H */