msm-pcm-q6.h 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. /*
  2. * Copyright (C) 2008 Google, Inc.
  3. * Copyright (C) 2008 HTC Corporation
  4. * Copyright (c) 2008-2009,2011 The Linux Foundation. All rights reserved.
  5. *
  6. * This software is licensed under the terms of the GNU General Public
  7. * License version 2, as published by the Free Software Foundation, and
  8. * may be copied, distributed, and modified under those terms.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  13. *
  14. * See the GNU General Public License for more details.
  15. * You should have received a copy of the GNU General Public License
  16. * along with this program; if not, you can find it at http://www.fsf.org.
  17. */
  18. #ifndef _MSM_PCM_H
  19. #define _MSM_PCM_H
  20. #include <sound/apr_audio.h>
  21. #include <sound/q6asm.h>
  22. /* Support unconventional sample rates 12000, 24000 as well */
  23. #define USE_RATE \
  24. (SNDRV_PCM_RATE_8000_48000 | SNDRV_PCM_RATE_KNOT)
  25. extern int copy_count;
  26. struct buffer {
  27. void *data;
  28. unsigned size;
  29. unsigned used;
  30. unsigned addr;
  31. };
  32. struct buffer_rec {
  33. void *data;
  34. unsigned int size;
  35. unsigned int read;
  36. unsigned int addr;
  37. };
  38. struct audio_locks {
  39. spinlock_t event_lock;
  40. wait_queue_head_t read_wait;
  41. wait_queue_head_t write_wait;
  42. wait_queue_head_t eos_wait;
  43. wait_queue_head_t enable_wait;
  44. wait_queue_head_t flush_wait;
  45. };
  46. struct msm_audio {
  47. struct snd_pcm_substream *substream;
  48. unsigned int pcm_size;
  49. unsigned int pcm_count;
  50. unsigned int pcm_irq_pos; /* IRQ position */
  51. uint16_t source; /* Encoding source bit mask */
  52. struct audio_client *audio_client;
  53. struct audio_client *enc_audio_client;
  54. uint16_t session_id;
  55. uint32_t samp_rate;
  56. uint32_t channel_mode;
  57. uint32_t dsp_cnt;
  58. int abort; /* set when error, like sample rate mismatch */
  59. int enabled;
  60. int close_ack;
  61. int cmd_ack;
  62. atomic_t start;
  63. atomic_t stop;
  64. atomic_t out_count;
  65. atomic_t in_count;
  66. atomic_t out_needed;
  67. atomic_t eos;
  68. int out_head;
  69. int periods;
  70. int mmap_flag;
  71. atomic_t pending_buffer;
  72. bool set_channel_map;
  73. char channel_map[8];
  74. };
  75. struct output_meta_data_st {
  76. uint32_t meta_data_length;
  77. uint32_t frame_size;
  78. uint32_t timestamp_lsw;
  79. uint32_t timestamp_msw;
  80. uint32_t reserved[12];
  81. };
  82. #endif /*_MSM_PCM_H*/