seq_kernel.h 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. /* SPDX-License-Identifier: GPL-2.0-or-later */
  2. #ifndef __SOUND_SEQ_KERNEL_H
  3. #define __SOUND_SEQ_KERNEL_H
  4. /*
  5. * Main kernel header file for the ALSA sequencer
  6. * Copyright (c) 1998 by Frank van de Pol <[email protected]>
  7. */
  8. #include <linux/time.h>
  9. #include <sound/asequencer.h>
  10. typedef struct snd_seq_real_time snd_seq_real_time_t;
  11. typedef union snd_seq_timestamp snd_seq_timestamp_t;
  12. /* maximum number of queues */
  13. #define SNDRV_SEQ_MAX_QUEUES 32
  14. /* max number of concurrent clients */
  15. #define SNDRV_SEQ_MAX_CLIENTS 192
  16. /* max number of concurrent ports */
  17. #define SNDRV_SEQ_MAX_PORTS 254
  18. /* max number of events in memory pool */
  19. #define SNDRV_SEQ_MAX_EVENTS 2000
  20. /* default number of events in memory pool */
  21. #define SNDRV_SEQ_DEFAULT_EVENTS 500
  22. /* max number of events in memory pool for one client (outqueue) */
  23. #define SNDRV_SEQ_MAX_CLIENT_EVENTS 2000
  24. /* default number of events in memory pool for one client (outqueue) */
  25. #define SNDRV_SEQ_DEFAULT_CLIENT_EVENTS 200
  26. /* max delivery path length */
  27. /* NOTE: this shouldn't be greater than MAX_LOCKDEP_SUBCLASSES */
  28. #define SNDRV_SEQ_MAX_HOPS 8
  29. /* max size of event size */
  30. #define SNDRV_SEQ_MAX_EVENT_LEN 0x3fffffff
  31. /* call-backs for kernel port */
  32. struct snd_seq_port_callback {
  33. struct module *owner;
  34. void *private_data;
  35. int (*subscribe)(void *private_data, struct snd_seq_port_subscribe *info);
  36. int (*unsubscribe)(void *private_data, struct snd_seq_port_subscribe *info);
  37. int (*use)(void *private_data, struct snd_seq_port_subscribe *info);
  38. int (*unuse)(void *private_data, struct snd_seq_port_subscribe *info);
  39. int (*event_input)(struct snd_seq_event *ev, int direct, void *private_data, int atomic, int hop);
  40. void (*private_free)(void *private_data);
  41. /*...*/
  42. };
  43. /* interface for kernel client */
  44. __printf(3, 4)
  45. int snd_seq_create_kernel_client(struct snd_card *card, int client_index,
  46. const char *name_fmt, ...);
  47. int snd_seq_delete_kernel_client(int client);
  48. int snd_seq_kernel_client_enqueue(int client, struct snd_seq_event *ev,
  49. struct file *file, bool blocking);
  50. int snd_seq_kernel_client_dispatch(int client, struct snd_seq_event *ev, int atomic, int hop);
  51. int snd_seq_kernel_client_ctl(int client, unsigned int cmd, void *arg);
  52. #define SNDRV_SEQ_EXT_MASK 0xc0000000
  53. #define SNDRV_SEQ_EXT_USRPTR 0x80000000
  54. #define SNDRV_SEQ_EXT_CHAINED 0x40000000
  55. typedef int (*snd_seq_dump_func_t)(void *ptr, void *buf, int count);
  56. int snd_seq_expand_var_event(const struct snd_seq_event *event, int count, char *buf,
  57. int in_kernel, int size_aligned);
  58. int snd_seq_dump_var_event(const struct snd_seq_event *event,
  59. snd_seq_dump_func_t func, void *private_data);
  60. /* interface for OSS emulation */
  61. int snd_seq_set_queue_tempo(int client, struct snd_seq_queue_tempo *tempo);
  62. /* port callback routines */
  63. void snd_port_init_callback(struct snd_seq_port_callback *p);
  64. struct snd_seq_port_callback *snd_port_alloc_callback(void);
  65. /* port attach/detach */
  66. int snd_seq_event_port_attach(int client, struct snd_seq_port_callback *pcbp,
  67. int cap, int type, int midi_channels, int midi_voices, char *portname);
  68. int snd_seq_event_port_detach(int client, int port);
  69. #ifdef CONFIG_MODULES
  70. void snd_seq_autoload_init(void);
  71. void snd_seq_autoload_exit(void);
  72. #else
  73. #define snd_seq_autoload_init()
  74. #define snd_seq_autoload_exit()
  75. #endif
  76. #endif /* __SOUND_SEQ_KERNEL_H */