cs46xx_dsp_spos.h 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235
  1. /*
  2. * The driver for the Cirrus Logic's Sound Fusion CS46XX based soundcards
  3. * Copyright (c) by Jaroslav Kysela <perex@perex.cz>
  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 __CS46XX_DSP_SPOS_H__
  22. #define __CS46XX_DSP_SPOS_H__
  23. #include "cs46xx_dsp_scb_types.h"
  24. #include "cs46xx_dsp_task_types.h"
  25. #define SYMBOL_CONSTANT 0x0
  26. #define SYMBOL_SAMPLE 0x1
  27. #define SYMBOL_PARAMETER 0x2
  28. #define SYMBOL_CODE 0x3
  29. #define SEGTYPE_SP_PROGRAM 0x00000001
  30. #define SEGTYPE_SP_PARAMETER 0x00000002
  31. #define SEGTYPE_SP_SAMPLE 0x00000003
  32. #define SEGTYPE_SP_COEFFICIENT 0x00000004
  33. #define DSP_SPOS_UU 0x0deadul /* unused */
  34. #define DSP_SPOS_DC 0x0badul /* don't care */
  35. #define DSP_SPOS_DC_DC 0x0bad0badul /* don't care */
  36. #define DSP_SPOS_UUUU 0xdeadc0edul /* unused */
  37. #define DSP_SPOS_UUHI 0xdeadul
  38. #define DSP_SPOS_UULO 0xc0edul
  39. #define DSP_SPOS_DCDC 0x0badf1d0ul /* don't care */
  40. #define DSP_SPOS_DCDCHI 0x0badul
  41. #define DSP_SPOS_DCDCLO 0xf1d0ul
  42. #define DSP_MAX_TASK_NAME 60
  43. #define DSP_MAX_SYMBOL_NAME 100
  44. #define DSP_MAX_SCB_NAME 60
  45. #define DSP_MAX_SCB_DESC 200
  46. #define DSP_MAX_TASK_DESC 50
  47. #define DSP_MAX_PCM_CHANNELS 32
  48. #define DSP_MAX_SRC_NR 14
  49. #define DSP_PCM_MAIN_CHANNEL 1
  50. #define DSP_PCM_REAR_CHANNEL 2
  51. #define DSP_PCM_CENTER_LFE_CHANNEL 3
  52. #define DSP_PCM_S71_CHANNEL 4 /* surround 7.1 */
  53. #define DSP_IEC958_CHANNEL 5
  54. #define DSP_SPDIF_STATUS_OUTPUT_ENABLED 1
  55. #define DSP_SPDIF_STATUS_PLAYBACK_OPEN 2
  56. #define DSP_SPDIF_STATUS_HW_ENABLED 4
  57. #define DSP_SPDIF_STATUS_INPUT_CTRL_ENABLED 8
  58. struct dsp_symbol_entry {
  59. u32 address;
  60. char symbol_name[DSP_MAX_SYMBOL_NAME];
  61. int symbol_type;
  62. /* initialized by driver */
  63. struct dsp_module_desc * module;
  64. int deleted;
  65. };
  66. struct dsp_symbol_desc {
  67. int nsymbols;
  68. struct dsp_symbol_entry *symbols;
  69. /* initialized by driver */
  70. int highest_frag_index;
  71. };
  72. struct dsp_segment_desc {
  73. int segment_type;
  74. u32 offset;
  75. u32 size;
  76. u32 * data;
  77. };
  78. struct dsp_module_desc {
  79. char * module_name;
  80. struct dsp_symbol_desc symbol_table;
  81. int nsegments;
  82. struct dsp_segment_desc * segments;
  83. /* initialized by driver */
  84. u32 overlay_begin_address;
  85. u32 load_address;
  86. int nfixups;
  87. };
  88. struct dsp_scb_descriptor {
  89. char scb_name[DSP_MAX_SCB_NAME];
  90. u32 address;
  91. int index;
  92. u32 *data;
  93. struct dsp_scb_descriptor * sub_list_ptr;
  94. struct dsp_scb_descriptor * next_scb_ptr;
  95. struct dsp_scb_descriptor * parent_scb_ptr;
  96. struct dsp_symbol_entry * task_entry;
  97. struct dsp_symbol_entry * scb_symbol;
  98. struct snd_info_entry *proc_info;
  99. int ref_count;
  100. u16 volume[2];
  101. unsigned int deleted :1;
  102. unsigned int updated :1;
  103. unsigned int volume_set :1;
  104. };
  105. struct dsp_task_descriptor {
  106. char task_name[DSP_MAX_TASK_NAME];
  107. int size;
  108. u32 address;
  109. int index;
  110. u32 *data;
  111. };
  112. struct dsp_pcm_channel_descriptor {
  113. int active;
  114. int src_slot;
  115. int pcm_slot;
  116. u32 sample_rate;
  117. u32 unlinked;
  118. struct dsp_scb_descriptor * pcm_reader_scb;
  119. struct dsp_scb_descriptor * src_scb;
  120. struct dsp_scb_descriptor * mixer_scb;
  121. void * private_data;
  122. };
  123. struct dsp_spos_instance {
  124. struct dsp_symbol_desc symbol_table; /* currently available loaded symbols in SP */
  125. int nmodules;
  126. struct dsp_module_desc * modules; /* modules loaded into SP */
  127. struct dsp_segment_desc code;
  128. /* Main PCM playback mixer */
  129. struct dsp_scb_descriptor * master_mix_scb;
  130. u16 dac_volume_right;
  131. u16 dac_volume_left;
  132. /* Rear/surround PCM playback mixer */
  133. struct dsp_scb_descriptor * rear_mix_scb;
  134. /* Center/LFE mixer */
  135. struct dsp_scb_descriptor * center_lfe_mix_scb;
  136. int npcm_channels;
  137. int nsrc_scb;
  138. struct dsp_pcm_channel_descriptor pcm_channels[DSP_MAX_PCM_CHANNELS];
  139. int src_scb_slots[DSP_MAX_SRC_NR];
  140. /* cache this symbols */
  141. struct dsp_symbol_entry * null_algorithm; /* used by PCMreaderSCB's */
  142. struct dsp_symbol_entry * s16_up; /* used by SRCtaskSCB's */
  143. /* proc fs */
  144. struct snd_card *snd_card;
  145. struct snd_info_entry * proc_dsp_dir;
  146. struct snd_info_entry * proc_sym_info_entry;
  147. struct snd_info_entry * proc_modules_info_entry;
  148. struct snd_info_entry * proc_parameter_dump_info_entry;
  149. struct snd_info_entry * proc_sample_dump_info_entry;
  150. /* SCB's descriptors */
  151. int nscb;
  152. int scb_highest_frag_index;
  153. struct dsp_scb_descriptor scbs[DSP_MAX_SCB_DESC];
  154. struct snd_info_entry * proc_scb_info_entry;
  155. struct dsp_scb_descriptor * the_null_scb;
  156. /* Task's descriptors */
  157. int ntask;
  158. struct dsp_task_descriptor tasks[DSP_MAX_TASK_DESC];
  159. struct snd_info_entry * proc_task_info_entry;
  160. /* SPDIF status */
  161. int spdif_status_out;
  162. int spdif_status_in;
  163. u16 spdif_input_volume_right;
  164. u16 spdif_input_volume_left;
  165. /* spdif channel status,
  166. left right and user validity bits */
  167. unsigned int spdif_csuv_default;
  168. unsigned int spdif_csuv_stream;
  169. /* SPDIF input sample rate converter */
  170. struct dsp_scb_descriptor * spdif_in_src;
  171. /* SPDIF input asynch. receiver */
  172. struct dsp_scb_descriptor * asynch_rx_scb;
  173. /* Capture record mixer SCB */
  174. struct dsp_scb_descriptor * record_mixer_scb;
  175. /* CODEC input SCB */
  176. struct dsp_scb_descriptor * codec_in_scb;
  177. /* reference snooper */
  178. struct dsp_scb_descriptor * ref_snoop_scb;
  179. /* SPDIF output PCM reference */
  180. struct dsp_scb_descriptor * spdif_pcm_input_scb;
  181. /* asynch TX task */
  182. struct dsp_scb_descriptor * asynch_tx_scb;
  183. /* record sources */
  184. struct dsp_scb_descriptor * pcm_input;
  185. struct dsp_scb_descriptor * adc_input;
  186. int spdif_in_sample_rate;
  187. };
  188. #endif /* __DSP_SPOS_H__ */