Commit | Line | Data |
---|---|---|
1da177e4 LT |
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 | ||
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 */ | |
74 | typedef struct _hf_save_area_t { | |
75 | u32 r10_save; | |
76 | u32 r54_save; | |
77 | u32 r98_save; | |
78 | ||
79 | ___DSP_DUAL_16BIT_ALLOC( | |
80 | status_save, | |
81 | ind_save | |
82 | ) | |
83 | ||
84 | ___DSP_DUAL_16BIT_ALLOC( | |
85 | rci1_save, | |
86 | rci0_save | |
87 | ) | |
88 | ||
89 | u32 r32_save; | |
90 | u32 r76_save; | |
91 | u32 rsd2_save; | |
92 | ||
93 | ___DSP_DUAL_16BIT_ALLOC( | |
94 | rsi2_save, /* See TaskTreeParameterBlock for | |
95 | remainder of registers */ | |
96 | rsa2Save | |
97 | ) | |
98 | /* saved as part of HFG context */ | |
99 | } hf_save_area_t; | |
100 | ||
101 | ||
102 | /* Task link data structure */ | |
103 | typedef struct _tree_link_t { | |
104 | ___DSP_DUAL_16BIT_ALLOC( | |
105 | /* Pointer to sibling task control block */ | |
106 | next_scb, | |
107 | /* Pointer to child task control block */ | |
108 | sub_ptr | |
109 | ) | |
110 | ||
111 | ___DSP_DUAL_16BIT_ALLOC( | |
112 | /* Pointer to code entry point */ | |
113 | entry_point, | |
114 | /* Pointer to local data */ | |
115 | this_spb | |
116 | ) | |
117 | } tree_link_t; | |
118 | ||
119 | ||
120 | typedef struct _task_tree_data_t { | |
121 | ___DSP_DUAL_16BIT_ALLOC( | |
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 */ | |
130 | ___DSP_DUAL_16BIT_ALLOC( | |
131 | active_tncrement, | |
132 | /* Number of pending activations for task tree */ | |
133 | active_count | |
134 | ) | |
135 | ||
136 | ___DSP_DUAL_16BIT_ALLOC( | |
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 */ | |
145 | ___DSP_DUAL_16BIT_ALLOC( | |
146 | mem_upd_ptr, | |
147 | /* Data structure for controlling synchronous link update */ | |
148 | link_upd_ptr | |
149 | ) | |
150 | ||
151 | ___DSP_DUAL_16BIT_ALLOC( | |
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 | } task_tree_data_t; | |
159 | ||
160 | ||
161 | ||
162 | typedef struct _interval_timer_data_t | |
163 | { | |
164 | /* These data items have the same relative locations to those */ | |
165 | ___DSP_DUAL_16BIT_ALLOC( | |
166 | interval_timer_period, | |
167 | itd_unused | |
168 | ) | |
169 | ||
170 | /* used for this data in the SPOS control block for SPOS 1.0 */ | |
171 | ___DSP_DUAL_16BIT_ALLOC( | |
172 | num_FG_ticks_this_interval, | |
173 | num_intervals | |
174 | ) | |
175 | } interval_timer_data_t; | |
176 | ||
177 | ||
178 | /* This structure contains extra storage for the task tree | |
179 | Currently, this additional data is related only to a full context save */ | |
180 | typedef struct _task_tree_context_block_t { | |
181 | /* Up to 10 values are saved onto the stack. 8 for the task tree, 1 for | |
182 | The access to the context switch (call or interrupt), and 1 spare that | |
183 | users should never use. This last may be required by the system */ | |
184 | ___DSP_DUAL_16BIT_ALLOC( | |
185 | stack1, | |
186 | stack0 | |
187 | ) | |
188 | ___DSP_DUAL_16BIT_ALLOC( | |
189 | stack3, | |
190 | stack2 | |
191 | ) | |
192 | ___DSP_DUAL_16BIT_ALLOC( | |
193 | stack5, | |
194 | stack4 | |
195 | ) | |
196 | ___DSP_DUAL_16BIT_ALLOC( | |
197 | stack7, | |
198 | stack6 | |
199 | ) | |
200 | ___DSP_DUAL_16BIT_ALLOC( | |
201 | stack9, | |
202 | stack8 | |
203 | ) | |
204 | ||
205 | u32 saverfe; | |
206 | ||
207 | /* Value may be overwriten by stack save algorithm. | |
208 | Retain the size of the stack data saved here if used */ | |
209 | ___DSP_DUAL_16BIT_ALLOC( | |
210 | reserved1, | |
211 | stack_size | |
212 | ) | |
213 | u32 saverba; /* (HFG) */ | |
214 | u32 saverdc; | |
215 | u32 savers_config_23; /* (HFG) */ | |
216 | u32 savers_DMA23; /* (HFG) */ | |
217 | u32 saversa0; | |
218 | u32 saversi0; | |
219 | u32 saversa1; | |
220 | u32 saversi1; | |
221 | u32 saversa3; | |
222 | u32 saversd0; | |
223 | u32 saversd1; | |
224 | u32 saversd3; | |
225 | u32 savers_config01; | |
226 | u32 savers_DMA01; | |
227 | u32 saveacc0hl; | |
228 | u32 saveacc1hl; | |
229 | u32 saveacc0xacc1x; | |
230 | u32 saveacc2hl; | |
231 | u32 saveacc3hl; | |
232 | u32 saveacc2xacc3x; | |
233 | u32 saveaux0hl; | |
234 | u32 saveaux1hl; | |
235 | u32 saveaux0xaux1x; | |
236 | u32 saveaux2hl; | |
237 | u32 saveaux3hl; | |
238 | u32 saveaux2xaux3x; | |
239 | u32 savershouthl; | |
240 | u32 savershoutxmacmode; | |
241 | } task_tree_context_block_t; | |
242 | ||
243 | ||
244 | typedef struct _task_tree_control_block_t { | |
245 | hf_save_area_t context; | |
246 | tree_link_t links; | |
247 | task_tree_data_t data; | |
248 | task_tree_context_block_t context_blk; | |
249 | interval_timer_data_t int_timer; | |
250 | } task_tree_control_block_t; | |
251 | ||
252 | ||
253 | #endif /* __DSP_TASK_TYPES_H__ */ |