1 /******************************************************************************
2 ** File Name: chip_drvapi.h *
3 ** Author: Richard Yang *
5 ** Copyright: 2002 Spreatrum, Incoporated. All Rights Reserved. *
6 ** Description: This driver is for spreadtrum chip set. *
7 ******************************************************************************
9 ******************************************************************************
11 ** ------------------------------------------------------------------------- *
12 ** DATE NAME DESCRIPTION *
13 ** 08/14/2002 Richard.Yang Create. *
14 ** 09/16/2003 Xueliang.Wang Modify CR4013 *
15 ******************************************************************************/
16 #ifndef _CHIP_DRVAPI_H_
17 #define _CHIP_DRVAPI_H_
19 /**---------------------------------------------------------------------------*
21 **---------------------------------------------------------------------------*/
23 /**---------------------------------------------------------------------------*
25 **---------------------------------------------------------------------------*/
31 /**---------------------------------------------------------------------------*
33 **---------------------------------------------------------------------------*/
35 #define PLL_CLK_192M 192000000
37 #define CLK_DIV_1M 1000000
40 #define ARM_CLK_13M 13000000
41 #define ARM_CLK_20M 20000000
42 #define ARM_CLK_24M 24000000
43 #define ARM_CLK_26M 26000000
44 #define ARM_CLK_27M 27000000
45 #define ARM_CLK_28M 28800000
46 #define ARM_CLK_30M 30720000
47 #define ARM_CLK_32M 32000000
48 #define ARM_CLK_36M 36000000
49 #define ARM_CLK_39M 39000000
50 #define ARM_CLK_41M 41000000
51 #define ARM_CLK_48M 48000000
52 #define ARM_CLK_50M 50000000
53 #define ARM_CLK_52M 52000000
54 #define ARM_CLK_54M 54000000
55 #define ARM_CLK_60M 60000000
56 #define ARM_CLK_61M 61440000
57 #define ARM_CLK_64M 64000000
58 #define ARM_CLK_66M 66000000
59 #define ARM_CLK_78M 78000000
60 #define ARM_CLK_71M 71500000
61 #define ARM_CLK_72M 72000000
62 #define ARM_CLK_80M 80000000
63 #define ARM_CLK_82M 82000000
64 #define ARM_CLK_85M 85000000
65 #define ARM_CLK_96M 96000000
66 #define ARM_CLK_100M 100000000
67 #define ARM_CLK_102M 102000000
68 #define ARM_CLK_104M 104000000
69 #define ARM_CLK_109M 109000000
70 #define ARM_CLK_120M 120000000
71 #define ARM_CLK_128M 128000000
72 #define ARM_CLK_153M 153600000
73 #define ARM_CLK_164M 164000000
74 #define ARM_CLK_192M 192000000
75 #define ARM_CLK_200M 200000000
76 #define ARM_CLK_256M 256000000
77 #define ARM_CLK_384M 384000000
78 #define ARM_CLK_400M 400000000
79 #define ARM_CLK_512M 512000000
81 /**---------------------------------------------------------------------------*
82 ** Constant Variables *
83 **---------------------------------------------------------------------------*/
84 typedef enum chip_serial_tag
99 typedef enum chip_type_tag
101 SC6600I_ID_BASE = SERIAL_SC6600I << 16,
104 SC6600R_ID_BASE = SERIAL_SC6600R << 16,
111 SC6600H_ID_BASE = SERIAL_SC6600H << 16,
116 SC6800D_ID_BASE = SERIAL_SC6800D << 16,
119 SC8800D_ID_BASE = SERIAL_SC8800D << 16,
122 SC6600L_ID_BASE = SERIAL_SC6600L << 16,
129 SC8800H_ID_BASE = SERIAL_SC8800H << 16,
132 /* modified by zhengfei.xiao for SC8800H5 */
137 SC6800H_ID_BASE = SERIAL_SC6800H << 16,
140 SC8800G_ID_BASE = SERIAL_SC8800G << 16,
146 CHIP_TYPE_MAX = 0x7FFFFFFF
149 //define dsp rom code id
150 typedef enum chip_dsp_rom_id_tag
158 typedef enum module_clk
175 typedef enum module_clk_src
183 typedef struct _SYS_CLK_CFG_INFO
190 typedef struct _CHIP_INFO
196 /**---------------------------------------------------------------------------*
197 ** Function Prototypes *
198 **---------------------------------------------------------------------------*/
199 /*****************************************************************************/
200 // Description: The function is used to return chip ID (a uint32 number).
201 // Global resource dependence:
202 // Author: Xueliang.Wang
204 /*****************************************************************************/
205 PUBLIC uint32 CHIP_GetHWChipID (void); // return chip ID number.
207 /*****************************************************************************/
208 // Description: The function is used to detect the memory type
209 // Global resource dependence:
212 // 1 CS0 connects to SDRAM
213 // 0 CS0 connects to FLASH
214 /*****************************************************************************/
215 PUBLIC uint32 CHIP_DetectMemType (void);
217 /*****************************************************************************/
218 // Description : This function is used to get current ARM clock.
219 // Global resource dependence :
220 // Author : Xueliang.Wang
222 /*****************************************************************************/
223 uint32 CHIP_GetArmClk (void);
224 /*****************************************************************************/
225 // Description : This function is used to get current AHB clock.
226 // Global resource dependence :
227 // Author : Zhengjiang.Lei
229 /*****************************************************************************/
230 uint32 CHIP_GetAhbClk (void);
231 /*****************************************************************************/
232 // Description : This function is used to get current APB clock.
233 // Global resource dependence :
234 // Author : Xueliang.Wang
236 /*****************************************************************************/
237 uint32 CHIP_GetAPBClk (void);
238 /*****************************************************************************/
239 // Description : This function is used to get current PLL clock.
240 // Global resource dependence :
241 // Author : Xueliang.Wang
243 /*****************************************************************************/
244 uint32 CHIP_GetPllClk (void);
246 /*****************************************************************************/
247 // Description : This function is used to get current PLL clock.
248 // Global resource dependence :
249 // Author : Xueliang.Wang
251 /*****************************************************************************/
252 uint32 CHIP_GetMPllClk (void);
254 /*****************************************************************************/
255 // Description : This function is used to get current VPLL clock.
256 // Global resource dependence :
257 // Author : Xueliang.Wang
258 // Note : Daniel.ding add it for SC6800 .
259 /*****************************************************************************/
260 uint32 CHIP_GetVPllClk (void);
263 /*****************************************************************************/
264 // Description : This function is used to disable all fiqs on sc6600d
265 // Global resource dependence :
266 // Author : Xueliang.Wang
267 // Note : every bit indicates one fiq src
268 /*****************************************************************************/
269 void CHIP_DisableFIQ (void);
272 /*****************************************************************************/
273 // Description : This function is used to turn off the power.
274 // Global resource dependence :
275 // Author : Xueliang.Wang
277 /*****************************************************************************/
278 void CHIP_TurnOffPower (void);
280 /*****************************************************************************/
281 // Description : This function is used to reset MCU.
282 // Global resource dependence :
283 // Author : Xueliang.Wang
285 /*****************************************************************************/
286 void CHIP_ResetMCU (void);
288 /*****************************************************************************/
289 // Description : This function is used to reset MCU from boot code.
290 // Global resource dependence :
291 // Author : Xueliang.Wang
293 /*****************************************************************************/
294 void CHIP_BootReset (void);
297 /*****************************************************************************/
298 // Description : This function is used to get current DSP clock.
299 // Global resource dependence :
300 // Author : Benjamin.Wang
302 /*****************************************************************************/
303 uint32 CHIP_GetDspClk (void);
305 /*****************************************************************************/
306 // Description : This function is used to get current VPLL clock.
307 // Global resource dependence :
308 // Author : Xueliang.Wang
309 // Note : Aiguo.Miao update it for SC8800H .
310 /*****************************************************************************/
311 uint32 CHIP_GetTDPllClk (void);
313 /*********************************************************************************************/
314 //Description: This function is used to initializtion system clk and other
316 //Note: Can't use trace and assert in this funciton ;
318 /*********************************************************************************************/
319 void CHIP_Init (void);
321 /*****************************************************************************/
322 // Description : This function is used get the chip type
323 // Global resource dependence : none
324 // Author : yuhua.shi
326 /*****************************************************************************/
327 PUBLIC CHIP_TYPE_E CHIP_GetChipType (void);
330 /*****************************************************************************/
331 // Description : This function is used get the chip type
332 // Global resource dependence : none
333 // Author : yuhua.shi
335 /*****************************************************************************/
336 PUBLIC const char *CHIP_GetChipInfo (void);
339 /*****************************************************************************/
340 // Description : This function is active/deactive share-memory clock
341 // Global resource dependence : none
344 /*****************************************************************************/
345 PUBLIC void CHIP_ActiveSMCLK (BOOLEAN is_active);
346 /*****************************************************************************/
347 // Description : This function is Get Usb DM Value
348 // Global resource dependence : none
351 /*****************************************************************************/
352 PUBLIC BOOLEAN CHIP_GetUsbDMValue (void);
354 /*****************************************************************************/
355 // Description: The function is used to get the chip ID (a uint32 number).
356 // Global resource dependence:
357 // Author: Richard.Yang
358 // Note: It must be called before any hardware related settings
359 /*****************************************************************************/
360 PUBLIC void CHIP_InitHWChipID (void);
362 #ifdef PLATFORM_SC8800H
363 /*****************************************************************************/
364 // Description: The function is used to init TD Calibration clock
367 /*****************************************************************************/
368 PUBLIC void CHIP_TDCalClk_Init (void);
370 /*****************************************************************************/
371 // Description: The function is used to init TD clock
374 /*****************************************************************************/
375 PUBLIC void CHIP_CEVAClk_Init (uint8 dsp_clk_sel);
377 /*****************************************************************************/
378 // Description: The function is called by Layer1 when response to DSP sleep
380 // Note: Close RFLDO/TD CAL/UART
381 /*****************************************************************************/
382 PUBLIC void CHIP_DSPSleep (void);
384 /*****************************************************************************/
385 // Description: The function is called by Layer1 when response to DSP wake up
387 // Note: Open RFLDO/TD CAL/UART
388 /*****************************************************************************/
389 PUBLIC void CHIP_DSPWakeUp (void);
391 /*****************************************************************************/
392 // Description: The function is used to get to know wheather use UART1 for LOG or not
395 /*****************************************************************************/
396 PUBLIC uint32 CHIP_GetUART1LogMode (void);
398 /*****************************************************************************/
399 // Description: The function is used to set wheather use UART1 for LOG or not
402 /*****************************************************************************/
403 PUBLIC void CHIP_SetUART1LogMode (uint32 UART1LogEn);
405 /*****************************************************************************/
406 // Description: The function is called by Layer1 when response to DSP wake up
408 // Note: Disable UART1
409 /*****************************************************************************/
410 PUBLIC void CHIP_DSPUART1Dis (void);
412 /*****************************************************************************/
413 // Description: The function is called by Layer1 when response to DSP wake up
416 /*****************************************************************************/
417 PUBLIC void CHIP_DSPUART1En (void);
421 /*****************************************************************************/
422 // Description: This function is used to do something before assert.
423 // Global resource dependence:
424 // Author: Zhengjiang.Lei
426 /*****************************************************************************/
428 PUBLIC void CHIP_BeforeAssert (void);
430 /*below are removed from driver_export.c, wait clean up*/
431 // The function is used to reset dsp when arm system enter assert mode
432 PUBLIC BOOLEAN CHIP_ResetDspInAssertMode (void);
434 // The function is used to reset and set dsp to output dsp assert log to pc by uart1
435 PUBLIC void CHIP_DspOutPutAssertInfo (void);
437 // The function is used to get the IRAM/SHARE-MEMORY buf to store assert information
438 // in the assert mode.
439 // The buffer size must be larger than size(IRAM_buf) structure
440 PUBLIC void *CHIP_GetAssertInfoBufBase (void);
442 /******************************************************************************/
443 // Description: Enable MCU can access switched-ram and shared-ram.
445 // Author: Haifeng.Yang
446 // Note: Beforce invoking this function, the DSP/ISP should be hold on!
447 /******************************************************************************/
448 PUBLIC uint32 Chip_SwitchIRAM2Arm (void);
450 /******************************************************************************/
451 // Description: handle function when dsp exception
455 /******************************************************************************/
456 PUBLIC void L1API_DSPExceptionHandle(void);
458 extern SYS_CLK_CFG_INFO *Get_system_clk_cfg (void);
459 extern void EMC_Close (void);
460 extern void __tx_reset (void);
462 /**---------------------------------------------------------------------------*
464 **---------------------------------------------------------------------------*/
469 #endif // _CHIP_DRVAPI_H_