1 /******************************************************************************
2 ** File Name: deepsleep_drvapi.h *
3 ** Author: Richard Yang *
5 ** Copyright: 2003 Spreatrum, Incoporated. All Rights Reserved. *
6 ** Description: This file defines the basic operation interfaces of *
7 ** DSP and MCU for deep sleep. *
8 ******************************************************************************
10 ******************************************************************************
12 ** ------------------------------------------------------------------------- *
13 ** DATE NAME DESCRIPTION *
14 ** 08/25/2003 Richard.Yang Create. *
15 ******************************************************************************/
16 #ifndef _DEEPSLEEP_DRVAPI_H_
17 #define _DEEPSLEEP_DRVAPI_H_
19 /**---------------------------------------------------------------------------*
21 **---------------------------------------------------------------------------*/
23 /**---------------------------------------------------------------------------*
25 **---------------------------------------------------------------------------*/
31 /**---------------------------------------------------------------------------*
32 ** Constant Variables *
33 **---------------------------------------------------------------------------*/
34 #define ENABLE_DEEP_SLEEP 1
35 #define DISABLE_DEEP_SLEEP 0
37 #define ENABLE_AHB_SLEEP 1
38 #define DISABLE_AHB_SLEEP 0
52 DISABLE_APB_SLEEP = 0,
55 /**---------------------------------------------------------------------------*
56 ** Function Definitions *
57 **---------------------------------------------------------------------------*/
58 PUBLIC void SCI_UPM_EnableDeepSleep (uint32 mode);
59 PUBLIC void SLEEP_Init (void);
60 //@CR97469 jiexia.yu add to protect DMA transfer when in deepsleep
61 PUBLIC void SCI_DMA_EnableDeepSleep (uint32 mode);
63 PUBLIC void DPSLP_PWM_EnableApbSleep (PWM_PORT_ID_E port_id, uint32 mode);
64 /*****************************************************************************/
65 // Description: This function is used to config the apb clk request of uart.
66 // Author: Zhengjiang.Lei
68 //****************************************************************************/
69 PUBLIC void DPSLP_UART_EnableApbSleep(
70 UART_PORT_ID_E port_id,
73 // Enable Audio deep sleep
74 PUBLIC void SCI_AUD_EnableDeepSleep (uint32 mode);
75 /*****************************************************************************/
76 // Description: This function is dsp fiq handler
79 //****************************************************************************/
80 PUBLIC void DSP_FiqHandler (
81 uint32 fiq_num // fiq number
84 uint32 SLEEP_GetAHBModuleStatus (void);
85 uint32 SLEEP_GetAPBModuleStatus (void);
88 PUBLIC void SCI_TPC_EnableDeepSleep (uint32 mode);
90 // Enable MMI deep sleep
92 #if defined(PLATFORM_SC6600L) || defined(PLATFORM_SC6800H)
93 // Enable LCD backlight brightless deep sleep.
94 // For the brightless is controlled by PWM, if enter deepsleep, the mcu clk stop,
95 // and the PWM also stop.
96 PUBLIC void SCI_LCDBacklightBrightless_EnableDeepSleep (uint32 mode);
99 // Set charge deepsleep mode
101 PUBLIC void SCI_CHR_EnableDeepSleep (uint32 mode);
102 //enable tv deepsleep
103 PUBLIC void SCI_TV_EnableDeepSleep (uint32 mode);
104 PUBLIC void SCI_MMI_EnableDeepSleep (uint32 mode);
105 // Enable SIM deep sleep
106 PUBLIC void SCI_SIM_EnableDeepSleep (uint32 mode);
107 // Enable Layer1 deeep sleep
108 PUBLIC void SCI_L1_EnableDeepSleep (uint32 mode);
109 // Enable Bluetooth deep sleep
110 PUBLIC void SCI_BT_EnableDeepSleep (uint32 mode);
111 // Get DSP absolute time
112 PUBLIC uint32 SCI_GetDSPAbsoluteTime (void);
114 // Init delta time between DSP and MCU
115 PUBLIC void SCI_InitDSPDeltaTime (void);
117 // Check if enter deep sleep
118 PUBLIC void SCI_EnterDeepSleep (void);
121 PUBLIC void DS_CreateAbsoluteTimer (uint32 abs_time);
123 PUBLIC void deep_sleep_delay (uint32 count);
125 PUBLIC void SCI_PCM_EnableDeepSleep (uint32 mode);
127 PUBLIC void SCI_BTCLK_EnableDeepSleep (uint32 mode);
129 PUBLIC void SCI_DCAM_EnableDeepSleep (uint32 mode);
131 PUBLIC void SCI_Calibration_EnableDeepSleep (uint32 mode);
133 PUBLIC void SCI_SDIO_EnableDeepSleep (uint32 mode);
134 PUBLIC void SCI_UPM_EnableDeepSleep (uint32 mode);
135 /*****************************************************************************/
136 // Description: This function is used to config the apb clk request of pwm.
137 // Author: Younger.Yang
139 //****************************************************************************/
140 PUBLIC void DPSLP_Lcdc_EnableAhbSleep (uint32 mode);
141 PUBLIC void DPSLP_MpegEnc_EnableAhbSleep (uint32 mode);
142 PUBLIC void DPSLP_MpegDec_EnableAhbSleep (uint32 mode);
143 PUBLIC void DPSLP_ISP_EnableAhbSleep (uint32 mode);//just used for PLATFORM_SC6800H and PLATFORM_SC8800H
144 PUBLIC void DPSLP_DMA_EnableAhbSleep (uint32 mode);
145 PUBLIC void DPSLP_SetBklight_Sts (BOOLEAN bklight_on);
148 /*****************************************************************************/
149 // Description : This function is used to get the val of sleepmode.
150 // Global resource dependence :sleep_mode
151 // Author : kevin.wang
153 /*****************************************************************************/
154 PUBLIC uint32 SCI_Getsleepmode (void);
156 /*****************************************************************************/
157 // Description : This function is used to set the flag which indicate if xtl need open in deepsleep
158 // Global resource dependence :s_sleep_xtl_open_cnt
159 // Author : yuhua.shi
161 /*****************************************************************************/
162 PUBLIC void DPSLP_XTLOpenInSleep (
163 BOOLEAN is_open //indicate if xtl need open in deepsleep,
164 //SCI_TRUE: need open xtl in deepsleep; SCI_FALSE: can close xtl in deepsleep
167 /*****************************************************************************/
168 // Description : This function is used to enable or disable rf
169 // Global resource dependence :
172 /*****************************************************************************/
173 PUBLIC void DSLP_RFLDOControl (
174 BOOLEAN enable // TRUE:enable, FALSE:disable
177 /*****************************************************************************/
178 // Description : This function is used to get rf enable flag
179 // Global resource dependence :
182 /*****************************************************************************/
183 PUBLIC uint32 DSLP_GetRFEnableFlag (void);
185 #elif defined(PLATFORM_SC8800H)
186 /**---------------------------------------------------------------------------*
187 ** Function Definitions *
188 **---------------------------------------------------------------------------*/
189 // Enable LCD backlight brightless deep sleep.
190 // For the brightless is controlled by PWM, if enter deepsleep, the mcu clk stop,
191 // and the PWM also stop.
192 PUBLIC void SCI_LCDBacklightBrightless_EnableDeepSleep (uint32 mode);
195 // Set charge deepsleep mode
197 PUBLIC void SCI_CHR_EnableDeepSleep (uint32 mode);
199 // Enable Audio deep sleep
200 PUBLIC void SCI_AUD_EnableDeepSleep (uint32 mode);
201 // Enable MMI deep sleep
202 PUBLIC void SCI_MMI_EnableDeepSleep (uint32 mode);
203 // Enable SIM deep sleep
204 PUBLIC void SCI_SIM_EnableDeepSleep (uint32 mode);
205 // Enable Layer1 deeep sleep
206 PUBLIC void SCI_L1_EnableDeepSleep (uint32 mode);
207 // Enable Bluetooth deep sleep
208 PUBLIC void SCI_BT_EnableDeepSleep (uint32 mode);
209 // Get DSP absolute time
210 PUBLIC uint32 SCI_GetDSPAbsoluteTime (void);
212 // Init delta time between DSP and MCU
213 PUBLIC void SCI_InitDSPDeltaTime (void);
215 // Check if enter deep sleep
216 PUBLIC void SCI_EnterDeepSleep (void);
221 PUBLIC void SCI_RTC_TimerHandler (void);
223 PUBLIC void DS_CreateAbsoluteTimer (uint32 abs_time);
225 PUBLIC void deep_sleep_delay (uint32 count);
227 PUBLIC void SCI_PCM_EnableDeepSleep (uint32 mode);
229 PUBLIC void SCI_BTCLK_EnableDeepSleep (uint32 mode);
231 PUBLIC void SCI_AP_EnableDeepSleep (uint32 mode);
234 PUBLIC void SCI_Calibration_EnableDeepSleep (uint32 mode);
236 /*****************************************************************************/
237 // Description: This function is used to config the apb clk request of pwm.
238 // Author: Younger.Yang
240 //****************************************************************************/
241 PUBLIC void DPSLP_PWM_EnableApbSleep (PWM_PORT_ID_E port_id, uint32 mode);
242 PUBLIC void DPSLP_Lcdc_EnableAhbSleep (uint32 mode);
243 PUBLIC void DPSLP_MpegEnc_EnableAhbSleep (uint32 mode);
244 PUBLIC void DPSLP_MpegDec_EnableAhbSleep (uint32 mode);
245 PUBLIC void DPSLP_ISP_EnableAhbSleep (uint32 mode);//just used for PLATFORM_SC6800H and PLATFORM_SC8800H
246 PUBLIC void DPSLP_DCAM_EnableAhbSleep (uint32 mode);
247 PUBLIC void DPSLP_DMA_EnableAhbSleep (uint32 mode);
249 /*****************************************************************************/
250 // Description : This function is used to get the val of sleepmode.
251 // Global resource dependence : sleep_mode
252 // Author : kevin.wang
254 /*****************************************************************************/
255 PUBLIC uint32 SCI_Getsleepmode (void);
256 /*****************************************************************************/
257 // Description : This function is used to Enable
258 // LDO_RF power down when enter deepsleep
259 // Global resource dependence :
262 /*****************************************************************************/
263 PUBLIC void DSSLP_EnableLDORFAutoPD (void);
264 /*****************************************************************************/
265 // Description: This function is used to config the ahb clk request of dma.
266 // Author: Zhengjiang.Lei
268 //****************************************************************************/
269 PUBLIC void SCI_SDIO_EnableDeepSleep (uint32 mode);
271 /*****************************************************************************/
272 // Description : This function is used to enable arm CEVAX matrix to sleep.
273 // Global resource dependence :
276 /*****************************************************************************/
277 PUBLIC void DSLP_ARM_DAHB_SleepEn (void);
279 /*****************************************************************************/
280 // Description : This function is used to enable or disable rf
281 // Global resource dependence :
284 /*****************************************************************************/
285 PUBLIC void DSLP_RFLDOControl (
286 BOOLEAN enable // TRUE:enable, FALSE:disable
288 /*****************************************************************************/
289 // Description : This function is used to set sleep flag.
290 // Global resource dependence :
293 /*****************************************************************************/
294 PUBLIC void DSLP_SetEnableSleepFlag (void);
297 /*****************************************************************************/
298 // Description: This function is dsp semaphore fiq handler
301 //****************************************************************************/
302 PUBLIC void DSP_SEMA_Handler (
303 uint32 fiq_num // fiq number
306 /*****************************************************************************/
307 // Description: This function is used to init dsp amr share memeory
310 //****************************************************************************/
311 PUBLIC void SCI_InitDSP_MCU_SHR (void);
313 /*****************************************************************************/
314 // Description : This function is used to clear DSP semaphore0.
315 // Global resource dependence :
318 /*****************************************************************************/
319 PUBLIC void SCI_DSPSEMA0_Clear (void);
321 /*****************************************************************************/
322 // Description : This function is used to set the flag which indicate if xtl need open in deepsleep
323 // Global resource dependence :s_sleep_xtl_open_cnt
324 // Author : yuhua.shi
326 /*****************************************************************************/
327 PUBLIC void DPSLP_XTLOpenInSleep (
328 BOOLEAN is_open //indicated if xtl need open in deepsleep,
329 //SCI_TRUE: need open xtl in deepsleep; SCI_FALSE: can close xtl in deepsleep
331 PUBLIC void SCI_Deep_Sleep_Test (void);
334 /**---------------------------------------------------------------------------*
336 **---------------------------------------------------------------------------*/
344 #endif // _DEEPSLEEP_DRVAPI_H_