blob: 9058dbb845d835403690c8b8c4c3a7ab84206444 [file] [log] [blame]
/*******************************************************************************
* Copyright (C) 2007, ZTE Corporation.
*
* File Name: drvs_edcp.h
* File Mark:
* Description:
* Others:
* Version: 0.5
* Author: yangjupei
* Date: 2013-8-25
* History 1:
* Date:
* Version:
* Author:
* Modification:
* History 2:
********************************************************************************/
#ifndef _DRVS_EDCP_H
#define _DRVS_EDCP_H
/*************************************************************************
* Include files *
*************************************************************************/
#include "drvs_general.h"
/*************************************************************************
* Macro *
*************************************************************************/
#define Z_W_MAX_UL_EDCP_PDU_NUM (WORD)2
#define Z_W_MAX_UL_EDCP_CFG_NUM (WORD)256 /*EDCP1ÖÐÿ¸öPDU¶ÔÓ¦¶¯Ì¬ÅäÖÃÊý×éµÄ¸öÊý*/
#define Z_W_MAX_DL_EDCP_CFG_NUM (WORD)512 /*EDCP2ÖжÔÓ¦¶¯Ì¬ÅäÖÃÊý×éµÄ¸öÊý*/
#define Z_W_MAX_PDCP_EDCP_CFG_NUM (WORD)512 /*EDCP3ÖжÔÓ¦¶¯Ì¬ÅäÖÃÊý×éµÄ¸öÊý*/
#define Z_W_MAX_EDCP_CK_NUM (WORD)16
#define Z_EDCP_CK_LEN (WORD)16
/*EDCP INT type*/
#define EDCP_INT_UL_ASYN (UINT32)0x1
#define EDCP_INT_EMAC (UINT32)0x2
#define EDCP_INT_DL (UINT32)0x4
/*¼ÓÃÜ·½Ê½ºÍÍê±£Ëã·¨*/
#define EDCP_NOCIPHER (WORD)0 /*²»¼ÓÃÜ*/
#define EDCP_SNOW3G (WORD)1 /*SNOW3G*/
#define EDCP_AES (WORD)2 /*AES*/
#define EDCP_ZUC (WORD)3 /*ZUC*/
#define EDCP_KASUMI (WORD)4 /*KSAUMI*/
/**************************************************************************
* Types *
**************************************************************************/
typedef struct T_ZDrvEdcp_StaticConfigInfo
{
UINT8 CtrlPaneCk[16]; /*EDPCP_CK_I¼Ä´æÆ÷4*4bytes*/
UINT8 UserPaneCk[16]; /*EDPCP_CK_C¼Ä´æÆ÷4*4bytes*/
UINT8 Ik[16]; /*EDPCP_IK_I¼Ä´æÆ÷4*4bytes*/
UINT8 Direct; /*ÉÏÐÐ0£¬ÏÂÐÐ1*/
UINT8 CipherType; /*¼ÓÃÜָʾ: 0²»¼ÓÃÜ£¬1 snow3g£¬ 2 aes£¬ 3 zuc*/
UINT8 IntegType; /*ÍêÕûÐÔָʾ: 0ÎÞÍê±££¬1 snow3g£¬ 2 aes£¬ 3 zuc*/
} T_ZDrvEdcp_StaticConfigInfo;
typedef struct T_ZDrvEdcp_ULDynamicCtrlInfo
{
UINT8 CPInd; /*¼ÓÃÜָʾ: 0 ²»¼ÓÃÜ£¬1 ¼ÓÃÜ*/
UINT8 IPInd; /*ÍêÕûÐÔָʾ: 0 ÎÞÍê±££¬1 Íê±£*/
UINT8 DataSourceType; /*Êý¾ÝÔ´ÀàÐÍ 0 Óû§Ã棬1 ¿ØÖÆÃæ*/
UINT8 BearerId; /*¼ÓÃܲÎÊý*/
UINT8 *pDataSrc; /*Êý¾ÝÔ´µØÖ·*/
UINT16 DateLen; /*Êý¾ÝÔ´³¤¶È*/
UINT16 CompHeaderLen; /*ѹËõÍ·³¤¶È*/
UINT8 *pDataCompHeaderSrc; /*ѹËõÍ·µØÖ·*/
UINT8 *pDataDest; /*Ä¿±êµØÖ·*/
UINT32 Count; /*¼ÓÃܲÎÊý*/
} T_ZDrvEdcp_ULDynamicCtrlInfo;
/*EMAC ͬ²½´¦ÀíË÷ÒýRAM*/
typedef struct T_ZDrvEdcp_BusCopyCtrlInfo
{
UINT8 *pDataSrc;
UINT16 DataLen;
UINT8 *pDataDest;
} T_ZDrvEdcp_BusCopyCtrlInfo;
/*ÏÂÐд¦Àí¿ØÖÆË÷ÒýRAM*/
typedef struct T_ZDrvEdcp_DLDynamicCtrlInfo
{
UINT8 CPInd; /*¼ÓÃÜָʾ: 0 ²»¼ÓÃÜ£¬1 ¼ÓÃÜ*/
UINT8 IPInd; /*ÍêÕûÐÔָʾ: 0 ÎÞÍê±££¬1 ÓÐÍê±£*/
UINT8 DataSourceType; /*Êý¾ÝÔ´ÀàÐÍ 0 Óû§Ã棬1 ¿ØÖÆÃæ*/
UINT8 *pDataSrc; /*Êý¾ÝÔ´µØÖ·*/
UINT16 DateLen; /*Êý¾ÝÔ´³¤¶È*/
UINT8 *pDataDest; /*Ä¿±êµØÖ·*/
UINT8 BearerId; /*¼ÓÃܲÎÊý*/
UINT32 Count; /*¼ÓÃܲÎÊý*/
UINT16 DecipherLen; /*¼ÓÃܳ¤¶È²ÎÊý*/
UINT8 SegmentNum; /*·Ö¶Î×ÜÊý*/
} T_ZDrvEdcp_DLDynamicCtrlInfo;
/*UMTSÉÏÐÐ Òì²½´¦Àí¿ØÖÆË÷ÒýRAM*/
typedef struct T_ZDrvEdcp_ULDynamicCtrlInfo_umts
{
UINT8 bUea;//CPInd; /*ÊÇ·ñ¼ÓÃÜ bit0*/
UINT8 *pDataSrc; /*Êý¾ÝÔ´µØÖ·*/
UINT16 wDataLen; /*Êý¾ÝÔ´³¤¶È bitµ¥Î» bit15-0*/
UINT8 bSegNum; /*·Ö¶Î¸öÊý bit15-8*/
UINT8 BearerId; /*¼ÓÃܲÎÊý bit20-16*/
UINT8 CkIndex; /*Ñ¡ÔñÄÇ×éÃÜÔ¿ bit7-4*/
UINT32 Count; /*¼ÓÃܲÎÊý*/
} T_ZDrvEdcp_ULDynamicCtrlInfo_umts;
/*UMTSÏÂÐÐ Òì²½´¦Àí¿ØÖÆË÷ÒýRAM*/
typedef struct T_ZDrvEdcp_DLDynamicCtrlInfo_umts
{
UINT8 bUea;//CPInd; /*ÊÇ·ñ½âÃÜ bit0*/
UINT8 *pDataSrc; /*Êý¾ÝÔ´µØÖ·*/
UINT16 wDataLen; /*Êý¾ÝÔ´³¤¶È bitµ¥Î» bit15-0*/
UINT8 bDataOffset; /*Ñ¡ÔñÄÇ×éÃÜÔ¿ bit10-8*/
UINT8 *pDataDes; /*Ä¿±êµØÖ·*/
UINT8 BearerId; /*¼ÓÃܲÎÊý bit20-16*/
UINT8 CkIndex; /*Ñ¡ÔñÄÇ×éÃÜÔ¿ bit7-4*/
UINT32 Count; /*¼ÓÃܲÎÊý*/
} T_ZDrvEdcp_DLDynamicCtrlInfo_umts;
/*UMTS ÃÜÔ¿Ë÷ÒýRAM*/
typedef struct T_ZDrvEdcp_KeyIndexInfo_umts
{
UINT32 CK0; /*¼ÓÃÜÃÜÔ¿*/
UINT32 CK1;
UINT32 CK2;
UINT32 CK3;
} T_ZDrvEdcp_KeyIndexInfo_umts;
typedef VOID (*ZDRV_EDCP_CMD_RECVFUNC)(UINT32 intType);
typedef struct
{
ZDRV_EDCP_CMD_RECVFUNC fCmdRecv;
} T_ZDrvEdcp_CallbackFuncs;
typedef VOID (*ZDRV_PDCP_EDCP_ISR_CALLBACK)( VOID );
typedef struct
{
ZDRV_PDCP_EDCP_ISR_CALLBACK fCmdRecv;
} T_ZDrvEdcp_CallbackFuncs_ForW;
typedef struct
{
UINT32 DataSourceType:
1; //Êý¾Ý¿éÀàÐÍ
UINT32 IPInd:
1; //ÍêÕûÐÔ±£»¤
UINT32 CPInd:
1; //ÊÇ·ñ¼ÓÃÜ
UINT32 Reserve0:
1;
UINT32 MultiSegFlag:
1;
UINT32 Reserve1:
11;
UINT32 Total_DateLen:
14;
UINT32 Reserve2:
2;
}
Edcp_Conf;//lte
//define Uplink/ downlink lte control structure
typedef struct
{
UINT32 DataLen:
14;
UINT32 Reserve0:
2;
UINT32 Bearer:
5;
UINT32 Reserve1:
11;
}
Edcp_Length_Bearer;//lte
//define Uplink/ downlink control structure
typedef struct
{
Edcp_Conf conf;
UINT32 datain_addr;
Edcp_Length_Bearer length_bearer;
UINT32 dataout_addr;
UINT32 count;
}
T_ZDrvEdcp_Ctrl_Index;
/*==============================================================================
Ô­ÓT_zDrvEdcp_UlCfg
˵Ã÷: EDCP ULÅäÖòÎÊý
==============================================================================*/
typedef struct {
UINT8 bUea;//CPInd;
UINT8 *pDataSrc;
UINT16 wDataLen;
UINT8 bSegNum;
UINT8 BearerId;
UINT8 CkIndex;
UINT32 Count;
}T_zDrvEdcp_UlDynamicCtrlInfo;
typedef struct {
UINT16 wCfgNum;
UINT16 wTotalLen;
UINT8 *pDataDes;
UINT16 wTruncatedDataLen;
UINT8 *pTruncatedDataSrc;
UINT8 *pTruncatedDataDes;
T_zDrvEdcp_UlDynamicCtrlInfo tUlDynamicCtrlInfo[Z_W_MAX_UL_EDCP_CFG_NUM];
}T_zDrvEdcp_PduCfg;
typedef struct {
T_zDrvEdcp_PduCfg tPduCfg[Z_W_MAX_UL_EDCP_PDU_NUM];
}T_zDrvEdcp_UlCfg;
/*==============================================================================
Ô­ÓT_zDrvEdcp_DlCfg
˵Ã÷: EDCP DLÅäÖòÎÊý
==============================================================================*/
typedef struct {
UINT8 bUea; //CPInd;//7510 UMTS½öÖ§³ÖUEA1Ò»ÖÖ¼ÓÃÜ·½Ê½£¬CPIndΪ1ʱĬÈÏΪUEA1¼ÓÃÜ¡£
UINT8 *pDataSrc;
UINT16 wDataLen;
UINT8 bDataOffset;
UINT8 *pDataDes;
UINT8 BearerId;
UINT8 CkIndex;
UINT32 Count;
}T_zDrvEdcp_DlDynamicCtrlInfo;
typedef struct {
UINT16 wCfgNum;
T_zDrvEdcp_DlDynamicCtrlInfo tDlDynamicCtrlInfo[Z_W_MAX_DL_EDCP_CFG_NUM];
}T_zDrvEdcp_DlCfg;
/*==============================================================================
T_zDrvEdcp_PdcpCfg
˵Ã÷: PDCP EDCPÅäÖòÎÊý
==============================================================================*/
typedef struct{
UINT8 *pDataSrc;
UINT8 *pDataDes;
UINT16 wDataLen;
}T_zDrvEdcp_PdcpDynamicCtrlInfo;
typedef struct{
UINT16 wCfgNum;
T_zDrvEdcp_PdcpDynamicCtrlInfo tPdcpDynamicCtrlInfo[Z_W_MAX_PDCP_EDCP_CFG_NUM];
}T_zDrvEdcp_PdcpCfg;
/*==============================================================================
Ô­ÓT_zDrvEdcp_StaticCfgInfo
˵Ã÷: static EDCPÅäÖòÎÊý
==============================================================================*/
typedef struct{
// UINT8 Uea;
UINT8 CK[Z_W_MAX_EDCP_CK_NUM][Z_EDCP_CK_LEN];
}T_zDrvEdcp_StaticCfgInfo;
/* error code define */
typedef enum
{
EDCP_RET_SUCCESS = 0, /* successed */
EDCP_RET_BUSY = 1, /* busy */
EDCP_RET_ERR_INVALID_PARAM = 2, /* the input parameter is invalid */
MAX_EDCP_ERR_CODE
} T_ZDrvEdcp_RetCode;
typedef enum
{
EDCP_UL_MODULE,
EDCP_DL_MODULE,
EDCP_EMAC_MODULE
}T_ZDrvEdcp_ModuleSel;
//define Uplink syn ctrl index structure
typedef struct
{
UINT32 datain_addr;
UINT32 length_valid;
UINT32 dataout_addr;
}
T_ZDrvEdcp_Emac_Index;
/**************************************************************************
* Function Prototypes *
**************************************************************************/
/*******************************************************************************
* Function: zDrvEDCP_Initiate
* Description: initialize edcp module and globle Variables
* Parameters:
* Input:
*
* Output:
*
* Returns:
*
*
* Others:
********************************************************************************/
SINT32 zDrvEDCP_Initiate(VOID);
/*******************************************************************************
* Function: zDrvEdcp_StartHWOp
* Description: start lte EDCP hardware
* Parameters:
* Input:
* HWSource 0: UL_ASYN
* 1: DL
* 2: UL_SYN
* EnableInt 1:enable interrupt
* 0:disable interrupt
*
* Output:
*
* Returns:
*
*
* Others:
********************************************************************************/
SINT32 zDrvEdcp_StartHWOp(UINT8 HWSource, UINT8 EnableInt);
/*******************************************************************************
* Function: zDrvEdcp_InitULStaticPara
* Description: configure static parameters for up link
* Parameters:
* Input:
* StaticConfigInfo :CK_I,CK_C,IK,direct
*
* Output:
*
* Returns:
*
*
* Others:
********************************************************************************/
VOID zDrvEdcp_InitULStaticPara(T_ZDrvEdcp_StaticConfigInfo StaticConfigInfo);
/*******************************************************************************
* Function: zDrvEdcp_WriteULIndexRam
* Description: configure index for up link
* Parameters:
* Input:
*
* Output:
*
* Returns:
*
*
* Others:
********************************************************************************/
SINT32 zDrvEdcp_WriteULIndexRam(T_ZDrvEdcp_ULDynamicCtrlInfo ULDynamicCtrlInfo);
/*******************************************************************************
* Function: zDrvEdcp_WriteEmacIndexRam
* Description: configure EMAC index for EMAC channel
* Parameters:
* Input:
* BusCopyCtrlInfo:data source's address,data length,data des'address
* Output:
*
* Returns:
*
*
* Others:
********************************************************************************/
SINT32 zDrvEdcp_WriteEmacIndexRam(T_ZDrvEdcp_Emac_Index *BusCopyCtrlInfo, WORD dwNum);
/*******************************************************************************
* Function: zDrvEdcp_InitDLStaticPara
* Description: configure static parameters for down link
* Parameters:
* Input: StaticConfigInfo :CK_I,CK_C,IK,direct
*
* Output:
*
* Returns:
*
*
* Others:
********************************************************************************/
VOID zDrvEdcp_InitDLStaticPara(T_ZDrvEdcp_StaticConfigInfo StaticConfigInfo);
/*******************************************************************************
* Function: zDrvEdcp_WriteDLIndexRam
* Description: configure index for down link
* Parameters:
* Input:
*
* Output:
*
* Returns:
*
*
* Others:
********************************************************************************/
SINT32 zDrvEdcp_WriteDLIndexRam(T_ZDrvEdcp_Ctrl_Index *DLDynamicCtrlInfo, DWORD dwNum);
/*******************************************************************************
* Function: zDrvEdcp_RegCallback
* Description: enable EDCP interrupt,register EDCP ISR callback function
* Parameters:
* Input:
*
* Output:
*
* Returns:
*
*
* Others:
********************************************************************************/
SINT32 zDrvEdcp_RegCallback( T_ZDrvEdcp_CallbackFuncs *ptCallbackStruct );
/*******************************************************************************
* Function: zDrvEdcp_UnRegCallback
* Description: disable EDCP interrupt,release callback thread's source
* Parameters:
* Input:
*
* Output:
*
* Returns:
*
*
* Others:
********************************************************************************/
VOID zDrvEdcp_UnRegCallback(VOID);
/*******************************************************************************
* Function: zDrvEdcp_GetFreeDlIndexRamNum
* Description: Get Free Dl Index Ram Num
* Parameters:
* Input:
*
* Output: the remain Num
*
* Returns:
*
*
* Others:
********************************************************************************/
SINT32 zDrvEdcp_GetFreeDlIndexRamNum(VOID);
/*******************************************************************************
* Function: zDrvEdcp_IsBusy
* Description: judge edcp hardware busy or idle
* Parameters:
* Input:
*
* Output:
*
* Returns:
*
*
* Others:
********************************************************************************/
UINT8 zDrvEdcp_IsBusy(T_ZDrvEdcp_ModuleSel EdcpNum);
/*******************************************************************************
* Function: zDrvEdcp_Reset
* Description: Reset Edcp
* Parameters:
* Input:
*
* Output:
*
* Returns:
*
*
* Others:
********************************************************************************/
SINT32 zDrvEdcp_Reset( VOID);
/*******************************************************************************
* Function: zDrvEdcp_CleanEmacIndexCount
* Description:
* Parameters:
* Input:
*
* Output:
*
* Returns:
*
*
* Others:
********************************************************************************/
SINT32 zDrvEdcp_ClrUlSynEmacIndexCnt(VOID);
/*******************************************************************************
* Function: zDrvEdcp_UpDateEmacIndex
* Description:
* Parameters:
* Input:
*
* Output:
*
* Returns:
*
*
* Others:
********************************************************************************/
SINT32 zDrvEdcp_UpDateEmacIndexRam(UINT8 IndexNo,T_ZDrvEdcp_BusCopyCtrlInfo BusCopyCtrlInfo);
/*******************************************************************************
* Function: zDrvEdcp_EmacTotalIndex
* Description:
* Parameters:
* Input:
*
* Output:
*
* Returns:
*
*
* Others:
********************************************************************************/
UINT8 zDrvEdcp_EmacTotalIndex(VOID);
/*******************************************************************************
*For Wcdma
*
********************************************************************************/
/*******************************************************************************
* Function: zDrvEdcp_CKCfgForW
* Description: EDCP½âÃÜÃÜÔ¿ÅäÖÃ
* Parameters:
* Input:T_zDrvEdcp_StaticCfgInfo
*
* Output:
*
* Returns:
*
*
* Others:
********************************************************************************/
UINT32 zDrvEdcp_CKCfgForW(T_zDrvEdcp_StaticCfgInfo *ptCK,T_ZDrvEdcp_ModuleSel EdcpNum);
/*******************************************************************************
* Function: zDrvEdcp_IsBusyForW
* Description:
* Parameters:
* Input:EdcpNum
*
* Output:
*
* Returns:
*
*
* Others:
********************************************************************************/
UINT8 zDrvEdcp_IsBusyForW(UINT8 EdcpNum);
/*******************************************************************************
* Function: zDrvEdcp_ResetForW
* Description: Reset Edcp for W
* Parameters:
* Input:EdcpNum
*
* Output:
*
* Returns:
*
*
* Others:
********************************************************************************/
VOID zDrvEdcp_ResetForW(T_ZDrvEdcp_ModuleSel EdcpNum);
/*******************************************************************************
* Function: zDrvEdcp_UlCfgForW
* Description: ÉÏÐÐÄ£¿éÅäÖò¢Æô¶¯
* Parameters:
* Input:T_zDrvEdcp_UlCfg
*
* Output:
*
* Returns:
*
*
* Others:
********************************************************************************/
UINT32 zDrvEdcp_UlCfgForW(T_zDrvEdcp_UlCfg *ptUlCfg);
/*******************************************************************************
* Function: zDrvEdcp_DlCfgForW
* Description: ÏÂÐÐÄ£¿éÅäÖò¢Æô¶¯
* Parameters:
* Input:T_zDrvEdcp_DlCfg
*
* Output:
*
* Returns:
*
*
* Others:
********************************************************************************/
UINT32 zDrvEdcp_DlCfgForW(T_zDrvEdcp_DlCfg *ptDlCfg);
/*******************************************************************************
* Function: zDrvEdcp_PdcpCfgForW
* Description: edcpÏÂÐÐpdcp sdu°áÔËÄ£¿éÅäÖò¢Æô¶¯
* Parameters:
* Input:T_zDrvEdcp_PdcpCfg
*
* Output:
*
* Returns:
*
*
* Others:
********************************************************************************/
UINT32 zDrvEdcp_PdcpCfgForW(T_zDrvEdcp_PdcpCfg *ptPdcpCfg);
/*******************************************************************************
* Function: zDrvEdcp_RegCallback_ForW
* Description: register edcp isr callback function for wcdma
* Parameters:
* Input:
*
* Output:
*
* Returns:
*
*
* Others:
********************************************************************************/
UINT32 zDrvEdcp_RegCallback_ForW(T_ZDrvEdcp_CallbackFuncs_ForW *ptCallbackStruct);
/*******************************************************************************
* Function: zDrvEdcp_UlCfgNormForW
* Description: Normal UL data
* Parameters:
* Input:
*
* Output:
*
* Returns:
*
*
* Others:
********************************************************************************/
UINT32 zDrvEdcp_UlCfgNormForW(T_zDrvEdcp_UlCfg *ptUlCfg);
#ifdef _USE_PSM
/*******************************************************************************
* Function: zDrvEdcp_SaveConfiguration
* Description: Ê¡µçÄ£¿é¶Ïµçǰ±£´æÏÖ³¡
* Parameters:
* Input:
*
* Output:
*
* Returns:
*
*
* Others:
********************************************************************************/
SINT32 zDrvEdcp_SaveConfiguration(VOID);
/*******************************************************************************
* Function: zDrvEdcp_RestoreConfiguration
* Description: Ê¡µçÄ£¿é»Ö¸´¹©µçʱ»Ö¸´ÏÖ³¡
* Parameters:
* Input:
*
* Output:
*
* Returns:
*
*
* Others:
********************************************************************************/
SINT32 zDrvEdcp_RestoreConfiguration(VOID);
#endif
#endif/*_DRVS_EDCP_H*/