pcm_local.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * pcm_local.h - a local header file for snd-pcm module.
  4. *
  5. * Copyright (c) Takashi Sakamoto <o-takashi@sakamocchi.jp>
  6. */
  7. #ifndef __SOUND_CORE_PCM_LOCAL_H
  8. #define __SOUND_CORE_PCM_LOCAL_H
  9. extern const struct snd_pcm_hw_constraint_list snd_pcm_known_rates;
  10. void snd_interval_mul(const struct snd_interval *a,
  11. const struct snd_interval *b, struct snd_interval *c);
  12. void snd_interval_div(const struct snd_interval *a,
  13. const struct snd_interval *b, struct snd_interval *c);
  14. void snd_interval_muldivk(const struct snd_interval *a,
  15. const struct snd_interval *b,
  16. unsigned int k, struct snd_interval *c);
  17. void snd_interval_mulkdiv(const struct snd_interval *a, unsigned int k,
  18. const struct snd_interval *b, struct snd_interval *c);
  19. int snd_pcm_hw_constraint_mask(struct snd_pcm_runtime *runtime,
  20. snd_pcm_hw_param_t var, u_int32_t mask);
  21. int pcm_lib_apply_appl_ptr(struct snd_pcm_substream *substream,
  22. snd_pcm_uframes_t appl_ptr);
  23. int snd_pcm_update_state(struct snd_pcm_substream *substream,
  24. struct snd_pcm_runtime *runtime);
  25. int snd_pcm_update_hw_ptr(struct snd_pcm_substream *substream);
  26. void snd_pcm_playback_silence(struct snd_pcm_substream *substream,
  27. snd_pcm_uframes_t new_hw_ptr);
  28. static inline snd_pcm_uframes_t
  29. snd_pcm_avail(struct snd_pcm_substream *substream)
  30. {
  31. if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
  32. return snd_pcm_playback_avail(substream->runtime);
  33. else
  34. return snd_pcm_capture_avail(substream->runtime);
  35. }
  36. static inline snd_pcm_uframes_t
  37. snd_pcm_hw_avail(struct snd_pcm_substream *substream)
  38. {
  39. if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
  40. return snd_pcm_playback_hw_avail(substream->runtime);
  41. else
  42. return snd_pcm_capture_hw_avail(substream->runtime);
  43. }
  44. #ifdef CONFIG_SND_PCM_TIMER
  45. void snd_pcm_timer_resolution_change(struct snd_pcm_substream *substream);
  46. void snd_pcm_timer_init(struct snd_pcm_substream *substream);
  47. void snd_pcm_timer_done(struct snd_pcm_substream *substream);
  48. #else
  49. static inline void
  50. snd_pcm_timer_resolution_change(struct snd_pcm_substream *substream) {}
  51. static inline void snd_pcm_timer_init(struct snd_pcm_substream *substream) {}
  52. static inline void snd_pcm_timer_done(struct snd_pcm_substream *substream) {}
  53. #endif
  54. void __snd_pcm_xrun(struct snd_pcm_substream *substream);
  55. void snd_pcm_group_init(struct snd_pcm_group *group);
  56. void snd_pcm_sync_stop(struct snd_pcm_substream *substream, bool sync_irq);
  57. #ifdef CONFIG_SND_DMA_SGBUF
  58. struct page *snd_pcm_sgbuf_ops_page(struct snd_pcm_substream *substream,
  59. unsigned long offset);
  60. #endif
  61. #define PCM_RUNTIME_CHECK(sub) snd_BUG_ON(!(sub) || !(sub)->runtime)
  62. #endif /* __SOUND_CORE_PCM_LOCAL_H */