1 /* SPDX-License-Identifier: GPL-2.0-or-later */
3 * The driver for the Cirrus Logic's Sound Fusion CS46XX based soundcards
4 * Copyright (c) by Jaroslav Kysela <perex@perex.cz>
6 * NOTE: comments are copy/paste from cwcemb80.lst
7 * provided by Tom Woller at Cirrus (my only
8 * documentation about the SP OS running inside
12 #ifndef __CS46XX_DSP_TASK_TYPES_H__
13 #define __CS46XX_DSP_TASK_TYPES_H__
15 #include "cs46xx_dsp_scb_types.h"
17 /*********************************************************************************************
18 Example hierarchy of stream control blocks in the SP
23 -------+------ ------------- ------------- ------------- -----
24 | SBlaster IF |______\| Foreground |___\| Middlegr'nd |___\| Background |___\| Nul |
25 | |Goto /| tree header |g /| tree header |g /| tree header |g /| SCB |r
26 -------------- (g) ------------- ------------- ------------- -----
29 \/ ------------- ------------- -------------
30 | Foreground |_\ | Middlegr'nd |_\ | Background |_\
31 | tree |g/ | tree |g/ | tree |g/
32 ------------- ------------- -------------
37 *********************************************************************************************/
39 #define HFG_FIRST_EXECUTE_MODE 0x0001
40 #define HFG_FIRST_EXECUTE_MODE_BIT 0
41 #define HFG_CONTEXT_SWITCH_MODE 0x0002
42 #define HFG_CONTEXT_SWITCH_MODE_BIT 1
44 #define MAX_FG_STACK_SIZE 32 /* THESE NEED TO BE COMPUTED PROPERLY */
45 #define MAX_MG_STACK_SIZE 16
46 #define MAX_BG_STACK_SIZE 9
47 #define MAX_HFG_STACK_SIZE 4
49 #define SLEEP_ACTIVE_INCREMENT 0 /* Enable task tree thread to go to sleep
50 This should only ever be used on the Background thread */
51 #define STANDARD_ACTIVE_INCREMENT 1 /* Task tree thread normal operation */
52 #define SUSPEND_ACTIVE_INCREMENT 2 /* Cause execution to suspend in the task tree thread
53 This should only ever be used on the Background thread */
55 #define HOSTFLAGS_DISABLE_BG_SLEEP 0 /* Host-controlled flag that determines whether we go to sleep
58 /* Minimal context save area for Hyper Forground */
59 struct dsp_hf_save_area {
64 ___DSP_DUAL_16BIT_ALLOC(
69 ___DSP_DUAL_16BIT_ALLOC(
78 ___DSP_DUAL_16BIT_ALLOC(
79 rsi2_save, /* See TaskTreeParameterBlock for
80 remainder of registers */
83 /* saved as part of HFG context */
87 /* Task link data structure */
88 struct dsp_tree_link {
89 ___DSP_DUAL_16BIT_ALLOC(
90 /* Pointer to sibling task control block */
92 /* Pointer to child task control block */
96 ___DSP_DUAL_16BIT_ALLOC(
97 /* Pointer to code entry point */
99 /* Pointer to local data */
105 struct dsp_task_tree_data {
106 ___DSP_DUAL_16BIT_ALLOC(
107 /* Initial tock count; controls task tree execution rate */
109 /* Tock down counter */
113 /* Add to ActiveCount when TockCountLimit reached:
114 Subtract on task tree termination */
115 ___DSP_DUAL_16BIT_ALLOC(
117 /* Number of pending activations for task tree */
121 ___DSP_DUAL_16BIT_ALLOC(
122 /* BitNumber to enable modification of correct bit in ActiveTaskFlags */
124 /* Pointer to OS location for indicating current activity on task level */
125 active_task_flags_ptr
128 /* Data structure for controlling movement of memory blocks:-
130 ___DSP_DUAL_16BIT_ALLOC(
132 /* Data structure for controlling synchronous link update */
136 ___DSP_DUAL_16BIT_ALLOC(
137 /* Save area for remainder of full context. */
139 /* Address of start of local stack for data storage */
146 struct dsp_interval_timer_data
148 /* These data items have the same relative locations to those */
149 ___DSP_DUAL_16BIT_ALLOC(
150 interval_timer_period,
154 /* used for this data in the SPOS control block for SPOS 1.0 */
155 ___DSP_DUAL_16BIT_ALLOC(
156 num_FG_ticks_this_interval,
162 /* This structure contains extra storage for the task tree
163 Currently, this additional data is related only to a full context save */
164 struct dsp_task_tree_context_block {
165 /* Up to 10 values are saved onto the stack. 8 for the task tree, 1 for
166 The access to the context switch (call or interrupt), and 1 spare that
167 users should never use. This last may be required by the system */
168 ___DSP_DUAL_16BIT_ALLOC(
172 ___DSP_DUAL_16BIT_ALLOC(
176 ___DSP_DUAL_16BIT_ALLOC(
180 ___DSP_DUAL_16BIT_ALLOC(
184 ___DSP_DUAL_16BIT_ALLOC(
191 /* Value may be overwritten by stack save algorithm.
192 Retain the size of the stack data saved here if used */
193 ___DSP_DUAL_16BIT_ALLOC(
197 u32 saverba; /* (HFG) */
199 u32 savers_config_23; /* (HFG) */
200 u32 savers_DMA23; /* (HFG) */
224 u32 savershoutxmacmode;
228 struct dsp_task_tree_control_block {
229 struct dsp_hf_save_area context;
230 struct dsp_tree_link links;
231 struct dsp_task_tree_data data;
232 struct dsp_task_tree_context_block context_blk;
233 struct dsp_interval_timer_data int_timer;
237 #endif /* __DSP_TASK_TYPES_H__ */