1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
32 33 34 35 36
37
38 package ti.sysbios.family.c64p.tesla;
39
40 /*!
41 * ======== Power ========
42 * Power Module
43 *
44 * This module is used to reduce power consumption of the Tesla subsystem.
45 * Three reduction techniques are supported:
46 *
47 * Suspend/Resume with Retention: The Tesla subsystem is put into standby,
48 * upon which PRCM will transition the power domain to closed-switch retention
49 * (CSWR). Upon release from retention reset, the CPU will start executing
50 * from reset; a reset hook function will hijack the boot process, restore CPU
51 * state to that before retention, and then return back into the
52 * Power_suspend() API, which will return to its caller, to resume the
53 * application.
54 *
55 * Suspend/Resume with Hibernation: The Tesla subsystem context is saved to
56 * external RAM, and GEM is put into standby. Upon the standby transition,
57 * PRCM will transition the power domain to off. Upon release from reset, the
58 * CPU will start executing from reset; a reset hook function will hijack the
59 * boot process, restore CPU state, return back into the Power_suspend() API,
60 * which will restore the remaining Tesla subsystem context, and then return
61 * to its caller, to resume the application.
62 *
63 * Idling in the Idle loop: A function will be inserted into the Idle loop,
64 * which will automatically idle the CPU while waiting for the next interrupt.
65 *
66 * The application must explicitly call to Power_suspend() for Suspend/Resume
67 * functionality. For idling functionality, this enabled statically, in the
68 * application configuration, and the idling in the idle loop will happen
69 * routinely upon execution of the Idle loop.
70 *
71 * Suspend/Resume can be invoked from Task, Swi, or Idle loop context.
72 * It cannot be invoked from Hwi context.
73 */
74 module Power
75 {
76 /*! Suspend Level. */
77 enum Suspend {
78 Suspend_RETENTION, /*! Suspend to RETENTION state */
79 Suspend_HIBERNATE /*! Suspend to HIBERNATE state */
80 };
81
82 /*! Base address of EDMA TPCC registers */
83 config Ptr tpccRegs = 0x01C00000;
84
85 /*! Base address of SYSC registers */
86 config Ptr syscRegs = 0x01C20000;
87
88 /*! Idle the CPU when threads blocked waiting for an interrupt? */
89 config Bool idle = false;
90
91 /*! Name of segment to load Power's reset code and saved context */
92 metaonly config String loadSegment = "EXT_RAM";
93
94 /*!
95 * ======== idleCPU ========
96 * Function used to automatically idle the CPU in the Idle loop.
97 *
98 * When the 'idle' configuration flag is set: this function will
99 * be added to the list of Idle loop functions. When called from the
100 * Idle loop, it will invoke the IDLE instruction, to idle the CPU until
101 * the next interrupt occurs. This function will idle the CPU, but will
102 * not put the whole megamodule (GEM) into standby.
103 */
104 @DirectCall
105 Void idleCPU();
106
107 /*!
108 * ======== suspend ========
109 * Function used for suspend/resume of the Tesla subsystem.
110 *
111 * This function will save Tesla subsystem context and then put GEM into
112 * standby, as the final steps for a transition to either retention
113 * (CSWR), or hibernate (also referred to as off-mode).
114 *
115 * Prior to invoking this function the application software must prepare
116 * for suspend, which includes: configuring PRCM for the appropriate
117 * transition once GEM goes to standby; disabling unintended wakeup
118 * interrupts, and configuring intended wakeups; taking care of any
119 * required notifications to software components; and 'quieting' of the
120 * DSP application (e.g., ensuring that all in-progress EDMA activity
121 * completes).
122 */
123 @DirectCall
124 UInt suspend(Suspend level);
125
126 internal:
127
128 struct CpuSysRegs {
129 UInt32 AMR;
130 UInt32 CSR;
131 UInt32 IER;
132 UInt32 ISTP;
133 UInt32 IRP;
134 UInt32 SSR;
135 UInt32 GPLYB;
136 UInt32 GFPGFR;
137 UInt32 TSR;
138 UInt32 ITSR;
139 UInt32 IERR;
140 }
141
142 struct IntcConfig {
143 UInt32 EVTMASK0;
144 UInt32 EVTMASK1;
145 UInt32 EVTMASK2;
146 UInt32 EVTMASK3;
147 UInt32 EXPMASK0;
148 UInt32 EXPMASK1;
149 UInt32 EXPMASK2;
150 UInt32 EXPMASK3;
151 UInt32 INTMUX1;
152 UInt32 INTMUX2;
153 UInt32 INTMUX3;
154 UInt32 AEGMUX0;
155 UInt32 AEGMUX1;
156 UInt32 INTDMASK;
157 };
158
159 struct SyscConfig {
160 UInt32 SYSCONFIG;
161 UInt32 VBUSM2OCP;
162 UInt32 EDMA;
163 UInt32 CORE;
164 UInt32 IVA_ICTRL;
165 UInt32 IDLEDLY;
166 };
167
168 struct UnicacheConfig {
169 UInt32 CONFIG;
170 UInt32 OCP;
171 };
172
173 struct AmmuConfig {
174 UInt32 largeAddr[8];
175 UInt32 largePolicy[8];
176 UInt32 medAddr[7];
177 UInt32 medPolicy[7];
178 UInt32 smallAddr[3];
179 UInt32 smallPolicy[3];
180 UInt32 mmuConfig;
181 };
182
183 struct EdmaConfig {
184 UInt32 CLKGDIS;
185 UInt32 DCHMAP[64];
186 UInt32 QCHMAP[8];
187 UInt32 DMAQNUM[8];
188 UInt32 QDMAQNUM;
189 UInt32 QUETCMAP;
190 UInt32 QUEPRI;
191 UInt32 regionAccessBits[24];
192 UInt32 QWMTHRA;
193 UInt32 AETCTL;
194 UInt32 IER;
195 UInt32 IERH;
196 UInt32 QEER;
197 UInt32 PaRAMs[1024];
198 };
199
200 struct SubsystemContext {
201 CpuSysRegs cpuSysRegs;
202 UnicacheConfig configL1;
203 UnicacheConfig configL2;
204 IntcConfig configINTC;
205 SyscConfig configSYSC;
206 AmmuConfig configAMMU;
207 EdmaConfig configEDMA;
208 Bool tscRunning;
209 };
210
211 /*!
212 * ======== resetFxn ========
213 * Startup reset function that checks if coming out of a processor reset
214 * due to Power_suspend(). If no, it will simply return. If yes, it
215 * will restore CPU context, and return using a saved return pointer,
216 * warping back into the Power_suspend API.
217 */
218 Void resetFxn();
219
220 /*!
221 * ======== standby ========
222 * Function used for final CPU register save and transition to standby.
223 */
224 UInt standby(UInt32 *cpuRegs);
225
226 }
227
228 229 230 231
232