blob: a4ca3934828ef6750b8ea6a9129f9dd8a33f12f6 [file] [log] [blame]
yuezonghe824eb0c2024-06-27 02:32:26 -07001/***********************************************************************
2* Copyright (C) 2001, ZTE Corporation.
3*
4* File Name: drvs_dpram_td.h
5* File Mark:
6* Description: dpram interface declaration.
7* Others:
8* Version: v1.0
9* Author: yan junhua
10* Date: 2007-10-19
11* History 1:
12* Date: 2007-12-26
13* Version: 1.1v
14* Author: yan junhua
15* Modification: modify macro defines according to IC's modification
16* different address define for different project
17* change parameter in macros sucn as IsSet_H2UINTSTAL from bit number to bitmap
18*
19*
20* History 2:
21* Date: 2008-05-07
22* Version: 1.2v
23* Author: yan junhua
24* Modification: remove macro defines
25* return base address by functions
26*
27* History 3:
28* Date: 2010-04-26
29* Version: 1.4.9
30* Author: wangxia
31* Modification: add function for HSPUA in CHIP ZX2963
32**********************************************************************/
33#ifndef _DRVS_DPRAM_TD_H
34#define _DRVS_DPRAM_TD_H
35
36
37/*************************************************************************
38 * Include files *
39 *************************************************************************/
40
41#include "drvs_dpram.h"
42/*************************************************************************
43 * Macro *
44 *************************************************************************/
45
46 /**************************************************************************
47 * Types *
48 **************************************************************************/
49
50/**************************************************************************
51 * Function Prototypes *
52 **************************************************************************/
53
54/*******************************************************************************
55* Function: zDrvTDpram_GetTdSfn
56* Description: get td sfn from dpram
57* Parameters:
58* Input:
59*
60* Output:td sfn
61*
62* Returns:
63*
64*
65*
66*
67* Others:
68********************************************************************************/
69UINT32 zDrvTDpram_GetTdSfn(void);
70
71#if 0
72/* error code define */
73typedef enum
74{
75 DPRAM_RET_SUCCESS = 0, /* successed */
76 DPRAM_RET_ERROR = 1, /* error occured */
77 DPRAM_RET_ERR_INVALID_PARAM = 2, /* the input parameter is invalid */
78 DPRAM_RET_ERR_NO_MEMORY = 3, /* no enough memory in dpram to store data of the required length */
79 DPRAM_RET_ERR_NO_DATA = 4, /* no data in ring */
80 DPRAM_RET_ERR_NOT_INITIALIZED = 5, /* not initialized yet */
81
82 MAX_DPRAM_ERR_CODE
83} T_ZDrvDpram_RetCode;
84
85typedef enum
86{
87#if (((defined ( _CHIP_ZX297502)||defined ( _CHIP_ZX2975)||defined ( _CHIP_ZX2960_02B)) && defined (_USE_DPRAM_ADDR_NEWSW))||defined ( _CHIP_ZX2804))
88 DPRAM_DATA_UL_PHY,
89 DPRAM_DATA_HSUPA,
90 DPRAM_DATA_BCH,
91 DPRAM_DATA_DL_PHY,
92 DPRAM_DATA_HSDPA,
93 DPRAM_DATA_EAGCH,
94#else
95 DPRAM_DATA_UL_PHY,
96 DPRAM_DATA_BCH,
97 DPRAM_DATA_DL_PHY,
98 DPRAM_DATA_HSDPA,
99
100#endif
101
102 MAX_DPRAM_DATA_ID
103} T_ZDrvDpram_DataId;
104
105/* will be invoked when command has been received
106 uiCmdId: command id
107 pData: command data
108 uiLen: length of command data. unit: byte
109 */
110typedef UINT32 (*ZDRV_DPRAM_CMD_RECVFUNC)( UINT16 uiCmdId, VOID *pData, UINT16 uiLen );
111typedef VOID (*ZDRV_DPRAM_ISR_CALLBACK)( VOID ); //for TD-DPRAM
112
113typedef struct
114{
115 ZDRV_DPRAM_CMD_RECVFUNC fCmdRecv;
116} T_ZDrvDpram_CallbackFuncs;
117
118typedef enum
119{
120 DPRAM_MSG_CFNSFN = 0xFF,
121 DPRAM_MSG_EXCEPT = 0xFE,
122
123 MAX_DPRAM_OTHER_MSG
124} T_ZDrvDpram_OtherMsg;
125
126typedef struct
127{
128 UINT32 uiCfn;
129 UINT32 uiSfn;
130} T_ZDrvDpram_CfnSfn;
131
132typedef struct
133{
134 UINT32 uiMemBaseAddr; /* base address of dpram memory */
135 UINT32 uiRegBaseAddr; /* base address of doram register */
136 UINT32 uiMemSize; /* memroy size of dpram */
137 BOOL bBigEndian; /* big-endian if true, else little-endian */
138} T_ZDrvDpram_Info;
139
140
141
142typedef enum
143{
144 ARMTOZSP_INT1 =0, /*in order to let sleep time tell zsp ,ÖеÚ0bitÓ÷¨ÊÇ֪ͨÎïÀí²ãϵͳ˯Ãßʱ¼ä */
145 ARMTOZSP_INT2 =1, /*ÆäÖеÚ1bitÓ÷¨ÊÇ֪ͨÎïÀí²ãϵͳ˯Ãßʱ¼ä,ÓÐЭÒéÕ»ÏûÏ¢£¬sendcmd ·¢mailboxÖжϻ½ÐÑzsp*/
146 ARMTOZSP_INT3 = 2,/*used in HSUPA*/
147 ARMTOZSP_INT4 = 3, //ps wakeup phy
148 MAX_ARMTOZSPINT = 100
149
150}T_ZDrvIcp_IntType;
151#ifdef _USE_PSM
152
153#define DPRAM_BASE_ADDR 0x19800
154#define DPRAM_TDL1SLEEP_FLAG (DPRAM_BASE_ADDR + 0x63CE)
155#define DPRAM_TDL1SLEEP_FC_ADDR (DPRAM_BASE_ADDR + 0x63D0)
156#define DPRAM_TDL1SLEEP_CC_ADDR (DPRAM_BASE_ADDR + 0x63D2)
157#define DPRAM_TDL1SLEEP_LEN_ADDR (DPRAM_BASE_ADDR + 0x63D4)
158#define DPRAM_TDL1SLEEP_FC1_ADDR (DPRAM_BASE_ADDR + 0x63D6)
159#define DPRAM_TDL1SLEEP_CC1_ADDR (DPRAM_BASE_ADDR + 0x63D8)
160#define DPRAM_DRX_ADDR (DPRAM_BASE_ADDR + 0x63DA)
161#define DPRAM_TDSLEEP_FORCE_GSM_WAKEUP_ADRR (DPRAM_BASE_ADDR + 0x63DC)
162#define DPRAM_TD_CAMPON_ADDR (DPRAM_BASE_ADDR + 0x63DE)
163#define DPRAM_L1G_WAKEUPOK_FLAG_ADDR (DPRAM_BASE_ADDR + 0x63E0)
164#define DPRAM_L1T_QUEUE_FLAG_ADDR (DPRAM_BASE_ADDR + 0x63E2)
165#define DPRAM_ZSP_CHANGE_FREQ_FLAG_ADDR (DPRAM_BASE_ADDR + 0x63E8)
166#define DPRAM_ZSP_TDT1_FLAG_ADDR (DPRAM_BASE_ADDR + 0x63EA)
167#endif
168/**************************************************************************
169 * Function Prototypes *
170 **************************************************************************/
171/**************************************************************************
172* Functin: zDrvDpram_Init
173* Description: This function is used to initialize dpram.
174* Parameters:
175* (IN)
176* None.
177* (OUT)
178* None.
179* Returns:
180* DRV_SUCCESS: successed.
181* DRV_ERROR: error
182* DRV_ERR_NOT_SUPPORTED: this device don't support open operation.
183* others: others error code. for detailed information, please refer to the header file of hal layer
184* Others:
185* None.
186**************************************************************************/
187SINT32 zDrvDpram_Init( VOID );
188
189/**************************************************************************
190* Functin: zDrvDpram_RegISRCallback
191* Description: This function is used to get the isr function. It just be used by TD Ret
192* Parameters:
193* (IN)
194* fISRCallback: isr function pointer.
195* (OUT)
196* None.
197* Returns:
198* DPRAM_RET_SUCCESS: successed.
199* DPRAM_RET_ERROR: failed.
200* Others:
201* None.
202**************************************************************************/
203UINT32 zDrvDpram_RegISRCallback( ZDRV_DPRAM_ISR_CALLBACK fISRCallback ); //for TD-DPRAM
204
205/**************************************************************************
206* Functin: zDrvDpram_Exit
207* Description: This function is used to uninitialize dpram.
208* Parameters:
209* (IN)
210* None.
211* (OUT)
212* None.
213* Returns:
214* DRV_SUCCESS: successed.
215* DRV_ERROR: error
216* DRV_ERR_NOT_SUPPORTED: this device don't support open operation.
217* others: others error code. for detailed information, please refer to the header file of hal layer
218* Others:
219* None.
220**************************************************************************/
221SINT32 zDrvDpram_Exit( VOID );
222
223
224/**************************************************************************
225* Functin: zDrvTDpram_RegCallback
226* Description: This function is used to register the interrupt callback function.
227* Parameters:
228* (IN)
229* ptCallbackStruct: callback functions struct pointer.
230* (OUT)
231* None.
232* Returns:
233* DPRAM_RET_SUCCESS: successed.
234* DPRAM_RET_ERROR: failed.
235* Others:
236* None.
237**************************************************************************/
238UINT32 zDrvTDpram_RegCallback( T_ZDrvDpram_CallbackFuncs *ptCallbackStruct );
239
240
241/**************************************************************************
242* Functin: zDrvDpram_SendCmd
243* Description: This function is used to send command.
244* Parameters:
245* (IN)
246* uiCmdId: cmd id.
247* pData: cmd data pointer
248* uiLen: cmd data length. uint: byte. must be multiples of 4. maybe 0 for null command
249* (OUT)
250* None.
251* Returns:
252* DPRAM_RET_SUCCESS: successed.
253* DPRAM_RET_ERR_INVALID_PARAM: the input parameters are invalid
254* DPRAM_RET_ERR_NO_MEMORY: no enough space to send this command.
255* Others:
256* None.
257**************************************************************************/
258UINT32 zDrvDpram_SendCmd( UINT16 uiCmdId, VOID *pData, UINT16 uiLen );
259
260
261/**************************************************************************
262* Functin: zDrvDpram_GetFreeData
263* Description: This function is used to get the free block.
264* Parameters:
265* (IN)
266* uiDataId: T_ZDrvDpram_DataId.
267* (OUT)
268* ppBlockAddr: pointer to store address of databuf in block.
269* puiBlockLen: pointer to store length of databuf in block. uint: byte
270* Returns:
271* DPRAM_RET_SUCCESS: successed.
272* DPRAM_RET_ERR_INVALID_PARAM: the input parameters are invalid
273* DPRAM_RET_ERR_NO_MEMORY: no free data space.
274* Others:
275* None.
276**************************************************************************/
277UINT32 zDrvDpram_GetFreeData ( UINT8 uiDataId, VOID **ppBlockAddr, UINT16 *puiBlockLen );
278
279
280/**************************************************************************
281* Functin: zDrvDpram_SendData
282* Description: This function is used to send data.
283* Parameters:
284* (IN)
285* uiDataId: T_ZDrvDpram_DataId.
286* ppBlockAddr: base address of databuf in block.
287* uiDataLen: data length. uint: byte
288* (OUT)
289* None.
290* Returns:
291* DPRAM_RET_SUCCESS: successed.
292* DPRAM_RET_ERR_INVALID_PARAM: the input parameters are invalid
293* DPRAM_RET_ERR_NO_MEMORY: no enough space to send this data.
294* Others:
295* None.
296**************************************************************************/
297UINT32 zDrvDpram_SendData( UINT8 uiDataId, VOID *ppBlockAddr, UINT16 uiDataLen );
298
299
300/**************************************************************************
301* Functin: zDrvDpram_DataExist
302* Description: This function is used to check if there is data.
303* Parameters:
304* (IN)
305* uiDataId: T_ZDrvDpram_DataId.
306* (OUT)
307* None.
308* Returns:
309* TRUE: have data; FALSE: no data.
310* Others:
311* None.
312**************************************************************************/
313#if 0
314#ifdef _USE_EVB2963
315BOOL zDrvDpram_DataExist( UINT8 uiDataId );
316#else
317BOOL zDrvDpram_DataExist( VOID );
318#endif
319#endif
320
321
322BOOL zDrvDpram_DataExist( UINT8 uiDataId ); /*zyj,20110330*/
323
324/**************************************************************************
325* Functin: zDrvDpram_GetData
326* Description: This function is used to get data.
327* Parameters:
328* (IN)
329* puiDataId: pointer to stord data id. T_ZDrvDpram_DataId.
330* (OUT)
331* ppBlockAddr: pointer to store address of databuf in block.
332* puiRealLen: pointer to store data length. uint: byte
333* Returns:
334* DPRAM_RET_SUCCESS: successed.
335* DPRAM_RET_ERR_INVALID_PARAM: the input parameters are invalid
336* DPRAM_RET_ERR_NO_DATA: no data.
337* Others:
338* None.
339**************************************************************************/
340#if (((defined ( _CHIP_ZX297502)||defined ( _CHIP_ZX2975)||defined ( _CHIP_ZX2960_02B)) && defined (_USE_DPRAM_ADDR_NEWSW))||defined ( _CHIP_ZX2804))
341UINT32 zDrvDpram_GetData( UINT8 uiDataId, VOID **ppBlockAddr, UINT16 *puiRealLen );
342#else
343UINT32 zDrvDpram_GetData( UINT8 *puiDataId, VOID **ppBlockAddr, UINT16 *puiRealLen );
344#endif
345
346/**************************************************************************
347* Functin: zDrvDpram_FreeData
348* Description: This function is used to free the data block.
349* Parameters:
350* (IN)
351* uiDataId: T_ZDrvDpram_DataId.
352* pBlockAddr: base address of databuf in block.
353* (OUT)
354* None.
355* Returns:
356* DPRAM_RET_SUCCESS: successed.
357* DPRAM_RET_ERR_INVALID_PARAM: the input parameters are invalid
358* Others:
359* None.
360**************************************************************************/
361UINT32 zDrvDpram_FreeData( UINT8 uiDataId, VOID *pBlockAddr );
362
363
364/**************************************************************************
365* Functin: zDrvTDpram_GetInfo
366* Description: This function is used to get the dpram information, such as base address.
367* Parameters:
368* (IN)
369* None.
370* (OUT)
371* ptInfo: information pointer.
372* Returns:
373* DPRAM_RET_SUCCESS: successed.
374* DPRAM_RET_ERR_INVALID_PARAM: the input parameters are invalid
375* Others:
376* None.
377**************************************************************************/
378UINT32 zDrvTDpram_GetInfo( T_ZDrvDpram_Info *ptInfo );
379
380
381
382#if ((defined ( _CHIP_ZX297502)||defined ( _CHIP_ZX2975)||defined ( _CHIP_ZX2960_02B)||defined ( _CHIP_ZX2804)) && defined (_USE_DPRAM_ADDR_NEWSW))
383/**************************************************************************
384* Functin: zDrvTDpram_GetUPHValue
385* Description: This function is used to get the UPH value in Dpram.
386* Parameters:
387* (IN)
388* None.
389* (OUT)
390* None.
391* Returns:
392* UINT16: 2 bytes UPH Value.
393* Others:
394* None.
395**************************************************************************/
396UINT16 zDrvTDpram_GetUPHValue( VOID );
397
398
399/**************************************************************************
400* Functin: zDrvTDpram_GetSNPLValue
401* Description: This function is used to get the SNPL value in Dpram.
402* Parameters:
403* (IN)
404* None.
405* (OUT)
406* None.
407* Returns:
408* UINT16: 2 bytes SNPL Value.
409* Others:
410* None.
411**************************************************************************/
412UINT16 zDrvTDpram_GetSNPLValue( VOID );
413#endif
414/**************************************************************************
415* Functin: zDrvDpram_IntGen
416* Description: This function is used to send mailbox int to zsp
417* Parameters:
418* (IN)
419* inttype
420* (OUT)
421* no
422* Returns:
423* DPRAM_RET_SUCCESS: successed.
424* DPRAM_RET_ERR_INVALID_PARAM: the input parameters are invalid
425* Others:
426* None.
427**************************************************************************/
428SINT32 zDrvDpram_IntGen(T_ZDrvIcp_IntType inttype);
429
430#ifdef _USE_PSM
431/**************************************************************************
432* Functin: zDrvDpram_GetDRXFlag
433* Description: This function is used to get drx flag
434* Parameters:
435* (IN)
436* pFlag :
437* (OUT)
438* no
439* Returns:
440* DPRAM_RET_SUCCESS: successed.
441* DPRAM_RET_ERR_INVALID_PARAM: the input parameters are invalid
442* Others:
443* None.
444**************************************************************************/
445
446SINT32 zDrvDpram_GetDRXFlag (UINT16 *pFlag);
447/**************************************************************************
448* Functin: zDrvDpram_ClearDRXFlag
449* Description: This function is used to clear drx flag
450* Parameters:
451* (IN)
452* no
453* (OUT)
454* no
455* Returns:
456* DPRAM_RET_SUCCESS: successed.
457* DPRAM_RET_ERR_INVALID_PARAM: the input parameters are invalid
458* Others:
459* None.
460**************************************************************************/
461
462SINT32 zDrvDpram_ClearDRXFlag (VOID );
463
464
465/**************************************************************************
466* Functin: zDrvDpram_WakeUpUphy
467* Description: This function is used to wakeup phy for ps
468* Parameters:
469* (IN)
470* no
471* (OUT)
472* no
473* Returns:
474* DPRAM_RET_SUCCESS: successed.
475* DPRAM_RET_ERR_INVALID_PARAM: the input parameters are invalid
476* Others:
477* None.
478**************************************************************************/
479extern VOID zDrvDpram_WakeUpUphy(VOID);//ps»½ÐÑphy
480
481#endif
482
483
484/**************************************************************************
485* Functin: zDrvDpram_L1tqueueFlag
486* Description: ÅжÏzspÊÇ·ñΪ¿ÕÏУ¬Èç¹û¿ÕÏз¢maiblox»½ÐÑzsp£¬²¢ÇÒÖ±dpramΪ0xa
487* Parameters:
488* (IN)
489* no
490* (OUT)
491* no
492* Returns:
493* DPRAM_RET_SUCCESS: successed.
494* DPRAM_RET_ERR_INVALID_PARAM: the input parameters are invalid
495* Others:
496* None.
497**************************************************************************/
498
499
500VOID zDrvDpram_L1tqueueFlag(VOID); /*ÅжÏ2963 l1t·ÅÏûÏ¢¶ÓÁÐÖÐÊÇ·ñÓÐÏûÏ¢*/
501/**************************************************************************
502* Functin: zDrvDpram_ClerrL1tqueueFlag
503* Description: This function is used to clear drx flag
504* Parameters:
505* (IN)
506* no
507* (OUT)
508* no
509* Returns:
510* DPRAM_RET_SUCCESS: successed.
511* DPRAM_RET_ERR_INVALID_PARAM: the input parameters are invalid
512* Others:
513* None.
514**************************************************************************/
515
516
517VOID zDrvDpram_ClearL1tqueueFlag(VOID); /*Çå³ýl1tÏûÏ¢¶ÓÁÐÊÇ·ñÓбê־λ*/
518
519#endif
520
521#endif /* _DRVSDPRAM_H */
522