seq_kernel.h 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191
  1. #ifndef __SOUND_SEQ_KERNEL_H
  2. #define __SOUND_SEQ_KERNEL_H
  3. /*
  4. * Main kernel header file for the ALSA sequencer
  5. * Copyright (c) 1998 by Frank van de Pol <fvdpol@coil.demon.nl>
  6. *
  7. *
  8. * This program is free software; you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License as published by
  10. * the Free Software Foundation; either version 2 of the License, or
  11. * (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program; if not, write to the Free Software
  20. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  21. *
  22. */
  23. #include <linux/time.h>
  24. #include "asequencer.h"
  25. typedef sndrv_seq_tick_time_t snd_seq_tick_time_t;
  26. typedef sndrv_seq_position_t snd_seq_position_t;
  27. typedef sndrv_seq_frequency_t snd_seq_frequency_t;
  28. typedef sndrv_seq_instr_cluster_t snd_seq_instr_cluster_t;
  29. typedef enum sndrv_seq_client_type snd_seq_client_type_t;
  30. typedef enum sndrv_seq_stop_mode snd_seq_stop_mode_t;
  31. typedef struct sndrv_seq_port_info snd_seq_port_info_t;
  32. typedef struct sndrv_seq_port_subscribe snd_seq_port_subscribe_t;
  33. typedef struct sndrv_seq_event snd_seq_event_t;
  34. typedef struct sndrv_seq_addr snd_seq_addr_t;
  35. typedef struct sndrv_seq_ev_volume snd_seq_ev_volume_t;
  36. typedef struct sndrv_seq_ev_loop snd_seq_ev_loop_t;
  37. typedef struct sndrv_seq_remove_events snd_seq_remove_events_t;
  38. typedef struct sndrv_seq_query_subs snd_seq_query_subs_t;
  39. typedef struct sndrv_seq_real_time snd_seq_real_time_t;
  40. typedef struct sndrv_seq_system_info snd_seq_system_info_t;
  41. typedef struct sndrv_seq_client_info snd_seq_client_info_t;
  42. typedef struct sndrv_seq_queue_info snd_seq_queue_info_t;
  43. typedef struct sndrv_seq_queue_status snd_seq_queue_status_t;
  44. typedef struct sndrv_seq_queue_tempo snd_seq_queue_tempo_t;
  45. typedef struct sndrv_seq_queue_owner snd_seq_queue_owner_t;
  46. typedef struct sndrv_seq_queue_timer snd_seq_queue_timer_t;
  47. typedef struct sndrv_seq_queue_client snd_seq_queue_client_t;
  48. typedef struct sndrv_seq_client_pool snd_seq_client_pool_t;
  49. typedef struct sndrv_seq_instr snd_seq_instr_t;
  50. typedef struct sndrv_seq_instr_data snd_seq_instr_data_t;
  51. typedef struct sndrv_seq_instr_header snd_seq_instr_header_t;
  52. typedef union sndrv_seq_timestamp snd_seq_timestamp_t;
  53. #define snd_seq_event_bounce_ext_data sndrv_seq_event_bounce_ext_data
  54. #define snd_seq_ev_is_result_type sndrv_seq_ev_is_result_type
  55. #define snd_seq_ev_is_channel_type sndrv_seq_ev_is_channel_type
  56. #define snd_seq_ev_is_note_type sndrv_seq_ev_is_note_type
  57. #define snd_seq_ev_is_control_type sndrv_seq_ev_is_control_type
  58. #define snd_seq_ev_is_queue_type sndrv_seq_ev_is_queue_type
  59. #define snd_seq_ev_is_message_type sndrv_seq_ev_is_message_type
  60. #define snd_seq_ev_is_sample_type sndrv_seq_ev_is_sample_type
  61. #define snd_seq_ev_is_user_type sndrv_seq_ev_is_user_type
  62. #define snd_seq_ev_is_fixed_type sndrv_seq_ev_is_fixed_type
  63. #define snd_seq_ev_is_instr_type sndrv_seq_ev_is_instr_type
  64. #define snd_seq_ev_is_variable_type sndrv_seq_ev_is_variable_type
  65. #define snd_seq_ev_is_reserved sndrv_seq_ev_is_reserved
  66. #define snd_seq_ev_is_direct sndrv_seq_ev_is_direct
  67. #define snd_seq_ev_is_prior sndrv_seq_ev_is_prior
  68. #define snd_seq_ev_length_type sndrv_seq_ev_length_type
  69. #define snd_seq_ev_is_fixed sndrv_seq_ev_is_fixed
  70. #define snd_seq_ev_is_variable sndrv_seq_ev_is_variable
  71. #define snd_seq_ev_is_varusr sndrv_seq_ev_is_varusr
  72. #define snd_seq_ev_timestamp_type sndrv_seq_ev_timestamp_type
  73. #define snd_seq_ev_is_tick sndrv_seq_ev_is_tick
  74. #define snd_seq_ev_is_real sndrv_seq_ev_is_real
  75. #define snd_seq_ev_timemode_type sndrv_seq_ev_timemode_type
  76. #define snd_seq_ev_is_abstime sndrv_seq_ev_is_abstime
  77. #define snd_seq_ev_is_reltime sndrv_seq_ev_is_reltime
  78. #define snd_seq_queue_sync_port sndrv_seq_queue_sync_port
  79. #define snd_seq_queue_owner sndrv_seq_queue_owner
  80. /* maximum number of events dequeued per schedule interval */
  81. #define SNDRV_SEQ_MAX_DEQUEUE 50
  82. /* maximum number of queues */
  83. #define SNDRV_SEQ_MAX_QUEUES 8
  84. /* max number of concurrent clients */
  85. #define SNDRV_SEQ_MAX_CLIENTS 192
  86. /* max number of concurrent ports */
  87. #define SNDRV_SEQ_MAX_PORTS 254
  88. /* max number of events in memory pool */
  89. #define SNDRV_SEQ_MAX_EVENTS 2000
  90. /* default number of events in memory chunk */
  91. #define SNDRV_SEQ_DEFAULT_CHUNK_EVENTS 64
  92. /* default number of events in memory pool */
  93. #define SNDRV_SEQ_DEFAULT_EVENTS 500
  94. /* max number of events in memory pool for one client (outqueue) */
  95. #define SNDRV_SEQ_MAX_CLIENT_EVENTS 2000
  96. /* default number of events in memory pool for one client (outqueue) */
  97. #define SNDRV_SEQ_DEFAULT_CLIENT_EVENTS 200
  98. /* max delivery path length */
  99. #define SNDRV_SEQ_MAX_HOPS 10
  100. /* max size of event size */
  101. #define SNDRV_SEQ_MAX_EVENT_LEN 0x3fffffff
  102. /* typedefs */
  103. struct _snd_seq_user_client;
  104. struct _snd_seq_kernel_client;
  105. struct _snd_seq_client;
  106. struct _snd_seq_queue;
  107. typedef struct _snd_seq_user_client user_client_t;
  108. typedef struct _snd_seq_kernel_client kernel_client_t;
  109. typedef struct _snd_seq_client client_t;
  110. typedef struct _snd_seq_queue queue_t;
  111. /* call-backs for kernel client */
  112. typedef struct {
  113. void *private_data;
  114. unsigned allow_input: 1,
  115. allow_output: 1;
  116. /*...*/
  117. } snd_seq_client_callback_t;
  118. /* call-backs for kernel port */
  119. typedef int (snd_seq_kernel_port_open_t)(void *private_data, snd_seq_port_subscribe_t *info);
  120. typedef int (snd_seq_kernel_port_close_t)(void *private_data, snd_seq_port_subscribe_t *info);
  121. typedef int (snd_seq_kernel_port_input_t)(snd_seq_event_t *ev, int direct, void *private_data, int atomic, int hop);
  122. typedef void (snd_seq_kernel_port_private_free_t)(void *private_data);
  123. typedef struct {
  124. struct module *owner;
  125. void *private_data;
  126. snd_seq_kernel_port_open_t *subscribe;
  127. snd_seq_kernel_port_close_t *unsubscribe;
  128. snd_seq_kernel_port_open_t *use;
  129. snd_seq_kernel_port_close_t *unuse;
  130. snd_seq_kernel_port_input_t *event_input;
  131. snd_seq_kernel_port_private_free_t *private_free;
  132. unsigned int callback_all; /* call subscribe callbacks at each connection/disconnection */
  133. /*...*/
  134. } snd_seq_port_callback_t;
  135. /* interface for kernel client */
  136. extern int snd_seq_create_kernel_client(snd_card_t *card, int client_index, snd_seq_client_callback_t *callback);
  137. extern int snd_seq_delete_kernel_client(int client);
  138. extern int snd_seq_kernel_client_enqueue(int client, snd_seq_event_t *ev, int atomic, int hop);
  139. extern int snd_seq_kernel_client_dispatch(int client, snd_seq_event_t *ev, int atomic, int hop);
  140. extern int snd_seq_kernel_client_ctl(int client, unsigned int cmd, void *arg);
  141. #define SNDRV_SEQ_EXT_MASK 0xc0000000
  142. #define SNDRV_SEQ_EXT_USRPTR 0x80000000
  143. #define SNDRV_SEQ_EXT_CHAINED 0x40000000
  144. typedef int (*snd_seq_dump_func_t)(void *ptr, void *buf, int count);
  145. int snd_seq_expand_var_event(const snd_seq_event_t *event, int count, char *buf, int in_kernel, int size_aligned);
  146. int snd_seq_dump_var_event(const snd_seq_event_t *event, snd_seq_dump_func_t func, void *private_data);
  147. /* interface for OSS emulation */
  148. int snd_seq_set_queue_tempo(int client, snd_seq_queue_tempo_t *tempo);
  149. /* port callback routines */
  150. void snd_port_init_callback(snd_seq_port_callback_t *p);
  151. snd_seq_port_callback_t *snd_port_alloc_callback(void);
  152. /* port attach/detach */
  153. int snd_seq_event_port_attach(int client, snd_seq_port_callback_t *pcbp,
  154. int cap, int type, int midi_channels, int midi_voices, char *portname);
  155. int snd_seq_event_port_detach(int client, int port);
  156. #ifdef CONFIG_KMOD
  157. void snd_seq_autoload_lock(void);
  158. void snd_seq_autoload_unlock(void);
  159. #else
  160. #define snd_seq_autoload_lock()
  161. #define snd_seq_autoload_unlock()
  162. #endif
  163. #endif /* __SOUND_SEQ_KERNEL_H */