cs46xx_dsp_task_types.h 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252
  1. /*
  2. * The driver for the Cirrus Logic's Sound Fusion CS46XX based soundcards
  3. * Copyright (c) by Jaroslav Kysela <perex@suse.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. * NOTE: comments are copy/paste from cwcemb80.lst
  22. * provided by Tom Woller at Cirrus (my only
  23. * documentation about the SP OS running inside
  24. * the DSP)
  25. */
  26. #ifndef __CS46XX_DSP_TASK_TYPES_H__
  27. #define __CS46XX_DSP_TASK_TYPES_H__
  28. #include "cs46xx_dsp_scb_types.h"
  29. /*********************************************************************************************
  30. Example hierarchy of stream control blocks in the SP
  31. hfgTree
  32. Ptr____Call (c)
  33. \
  34. -------+------ ------------- ------------- ------------- -----
  35. | SBlaster IF |______\| Foreground |___\| Middlegr'nd |___\| Background |___\| Nul |
  36. | |Goto /| tree header |g /| tree header |g /| tree header |g /| SCB |r
  37. -------------- (g) ------------- ------------- ------------- -----
  38. |c |c |c |c
  39. | | | |
  40. \/ ------------- ------------- -------------
  41. | Foreground |_\ | Middlegr'nd |_\ | Background |_\
  42. | tree |g/ | tree |g/ | tree |g/
  43. ------------- ------------- -------------
  44. |c |c |c
  45. | | |
  46. \/ \/ \/
  47. *********************************************************************************************/
  48. #define HFG_FIRST_EXECUTE_MODE 0x0001
  49. #define HFG_FIRST_EXECUTE_MODE_BIT 0
  50. #define HFG_CONTEXT_SWITCH_MODE 0x0002
  51. #define HFG_CONTEXT_SWITCH_MODE_BIT 1
  52. #define MAX_FG_STACK_SIZE 32 /* THESE NEED TO BE COMPUTED PROPERLY */
  53. #define MAX_MG_STACK_SIZE 16
  54. #define MAX_BG_STACK_SIZE 9
  55. #define MAX_HFG_STACK_SIZE 4
  56. #define SLEEP_ACTIVE_INCREMENT 0 /* Enable task tree thread to go to sleep
  57. This should only ever be used on the Background thread */
  58. #define STANDARD_ACTIVE_INCREMENT 1 /* Task tree thread normal operation */
  59. #define SUSPEND_ACTIVE_INCREMENT 2 /* Cause execution to suspend in the task tree thread
  60. This should only ever be used on the Background thread */
  61. #define HOSTFLAGS_DISABLE_BG_SLEEP 0 /* Host-controlled flag that determines whether we go to sleep
  62. at the end of BG */
  63. /* Minimal context save area for Hyper Forground */
  64. struct dsp_hf_save_area {
  65. u32 r10_save;
  66. u32 r54_save;
  67. u32 r98_save;
  68. ___DSP_DUAL_16BIT_ALLOC(
  69. status_save,
  70. ind_save
  71. )
  72. ___DSP_DUAL_16BIT_ALLOC(
  73. rci1_save,
  74. rci0_save
  75. )
  76. u32 r32_save;
  77. u32 r76_save;
  78. u32 rsd2_save;
  79. ___DSP_DUAL_16BIT_ALLOC(
  80. rsi2_save, /* See TaskTreeParameterBlock for
  81. remainder of registers */
  82. rsa2Save
  83. )
  84. /* saved as part of HFG context */
  85. };
  86. /* Task link data structure */
  87. struct dsp_tree_link {
  88. ___DSP_DUAL_16BIT_ALLOC(
  89. /* Pointer to sibling task control block */
  90. next_scb,
  91. /* Pointer to child task control block */
  92. sub_ptr
  93. )
  94. ___DSP_DUAL_16BIT_ALLOC(
  95. /* Pointer to code entry point */
  96. entry_point,
  97. /* Pointer to local data */
  98. this_spb
  99. )
  100. };
  101. struct dsp_task_tree_data {
  102. ___DSP_DUAL_16BIT_ALLOC(
  103. /* Initial tock count; controls task tree execution rate */
  104. tock_count_limit,
  105. /* Tock down counter */
  106. tock_count
  107. )
  108. /* Add to ActiveCount when TockCountLimit reached:
  109. Subtract on task tree termination */
  110. ___DSP_DUAL_16BIT_ALLOC(
  111. active_tncrement,
  112. /* Number of pending activations for task tree */
  113. active_count
  114. )
  115. ___DSP_DUAL_16BIT_ALLOC(
  116. /* BitNumber to enable modification of correct bit in ActiveTaskFlags */
  117. active_bit,
  118. /* Pointer to OS location for indicating current activity on task level */
  119. active_task_flags_ptr
  120. )
  121. /* Data structure for controlling movement of memory blocks:-
  122. currently unused */
  123. ___DSP_DUAL_16BIT_ALLOC(
  124. mem_upd_ptr,
  125. /* Data structure for controlling synchronous link update */
  126. link_upd_ptr
  127. )
  128. ___DSP_DUAL_16BIT_ALLOC(
  129. /* Save area for remainder of full context. */
  130. save_area,
  131. /* Address of start of local stack for data storage */
  132. data_stack_base_ptr
  133. )
  134. };
  135. struct dsp_interval_timer_data
  136. {
  137. /* These data items have the same relative locations to those */
  138. ___DSP_DUAL_16BIT_ALLOC(
  139. interval_timer_period,
  140. itd_unused
  141. )
  142. /* used for this data in the SPOS control block for SPOS 1.0 */
  143. ___DSP_DUAL_16BIT_ALLOC(
  144. num_FG_ticks_this_interval,
  145. num_intervals
  146. )
  147. };
  148. /* This structure contains extra storage for the task tree
  149. Currently, this additional data is related only to a full context save */
  150. struct dsp_task_tree_context_block {
  151. /* Up to 10 values are saved onto the stack. 8 for the task tree, 1 for
  152. The access to the context switch (call or interrupt), and 1 spare that
  153. users should never use. This last may be required by the system */
  154. ___DSP_DUAL_16BIT_ALLOC(
  155. stack1,
  156. stack0
  157. )
  158. ___DSP_DUAL_16BIT_ALLOC(
  159. stack3,
  160. stack2
  161. )
  162. ___DSP_DUAL_16BIT_ALLOC(
  163. stack5,
  164. stack4
  165. )
  166. ___DSP_DUAL_16BIT_ALLOC(
  167. stack7,
  168. stack6
  169. )
  170. ___DSP_DUAL_16BIT_ALLOC(
  171. stack9,
  172. stack8
  173. )
  174. u32 saverfe;
  175. /* Value may be overwriten by stack save algorithm.
  176. Retain the size of the stack data saved here if used */
  177. ___DSP_DUAL_16BIT_ALLOC(
  178. reserved1,
  179. stack_size
  180. )
  181. u32 saverba; /* (HFG) */
  182. u32 saverdc;
  183. u32 savers_config_23; /* (HFG) */
  184. u32 savers_DMA23; /* (HFG) */
  185. u32 saversa0;
  186. u32 saversi0;
  187. u32 saversa1;
  188. u32 saversi1;
  189. u32 saversa3;
  190. u32 saversd0;
  191. u32 saversd1;
  192. u32 saversd3;
  193. u32 savers_config01;
  194. u32 savers_DMA01;
  195. u32 saveacc0hl;
  196. u32 saveacc1hl;
  197. u32 saveacc0xacc1x;
  198. u32 saveacc2hl;
  199. u32 saveacc3hl;
  200. u32 saveacc2xacc3x;
  201. u32 saveaux0hl;
  202. u32 saveaux1hl;
  203. u32 saveaux0xaux1x;
  204. u32 saveaux2hl;
  205. u32 saveaux3hl;
  206. u32 saveaux2xaux3x;
  207. u32 savershouthl;
  208. u32 savershoutxmacmode;
  209. };
  210. struct dsp_task_tree_control_block {
  211. struct dsp_hf_save_area context;
  212. struct dsp_tree_link links;
  213. struct dsp_task_tree_data data;
  214. struct dsp_task_tree_context_block context_blk;
  215. struct dsp_interval_timer_data int_timer;
  216. };
  217. #endif /* __DSP_TASK_TYPES_H__ */