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