seq_clientmgr.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. /*
  2. * ALSA sequencer Client Manager
  3. * Copyright (c) 1998-1999 by Frank van de Pol <fvdpol@coil.demon.nl>
  4. *
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation; either version 2 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with this program; if not, write to the Free Software
  18. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  19. *
  20. */
  21. #ifndef __SND_SEQ_CLIENTMGR_H
  22. #define __SND_SEQ_CLIENTMGR_H
  23. #include <sound/seq_kernel.h>
  24. #include <linux/bitops.h>
  25. #include "seq_fifo.h"
  26. #include "seq_ports.h"
  27. #include "seq_lock.h"
  28. /* client manager */
  29. struct snd_seq_user_client {
  30. struct file *file; /* file struct of client */
  31. /* ... */
  32. /* fifo */
  33. struct snd_seq_fifo *fifo; /* queue for incoming events */
  34. int fifo_pool_size;
  35. };
  36. struct snd_seq_kernel_client {
  37. /* ... */
  38. };
  39. struct snd_seq_client {
  40. snd_seq_client_type_t type;
  41. unsigned int accept_input: 1,
  42. accept_output: 1;
  43. char name[64]; /* client name */
  44. int number; /* client number */
  45. unsigned int filter; /* filter flags */
  46. DECLARE_BITMAP(event_filter, 256);
  47. snd_use_lock_t use_lock;
  48. int event_lost;
  49. /* ports */
  50. int num_ports; /* number of ports */
  51. struct list_head ports_list_head;
  52. rwlock_t ports_lock;
  53. struct mutex ports_mutex;
  54. struct mutex ioctl_mutex;
  55. int convert32; /* convert 32->64bit */
  56. /* output pool */
  57. struct snd_seq_pool *pool; /* memory pool for this client */
  58. union {
  59. struct snd_seq_user_client user;
  60. struct snd_seq_kernel_client kernel;
  61. } data;
  62. };
  63. /* usage statistics */
  64. struct snd_seq_usage {
  65. int cur;
  66. int peak;
  67. };
  68. int client_init_data(void);
  69. int snd_sequencer_device_init(void);
  70. void snd_sequencer_device_done(void);
  71. /* get locked pointer to client */
  72. struct snd_seq_client *snd_seq_client_use_ptr(int clientid);
  73. /* unlock pointer to client */
  74. #define snd_seq_client_unlock(client) snd_use_lock_free(&(client)->use_lock)
  75. /* dispatch event to client(s) */
  76. int snd_seq_dispatch_event(struct snd_seq_event_cell *cell, int atomic, int hop);
  77. /* exported to other modules */
  78. int snd_seq_kernel_client_enqueue(int client, struct snd_seq_event *ev, int atomic, int hop);
  79. int snd_seq_kernel_client_enqueue_blocking(int client, struct snd_seq_event * ev,
  80. struct file *file, int atomic, int hop);
  81. int snd_seq_kernel_client_write_poll(int clientid, struct file *file, poll_table *wait);
  82. int snd_seq_client_notify_subscription(int client, int port,
  83. struct snd_seq_port_subscribe *info, int evtype);
  84. extern int seq_client_load[15];
  85. #endif