[T106][ZXW-22]7520V3SCV2.01.01.02P42U09_VEC_V0.8_AP_VEC origin source commit
Change-Id: Ic6e05d89ecd62fc34f82b23dcf306c93764aec4b
diff --git a/cp/ps/driver/inc/cfg/drvs_cfg.h b/cp/ps/driver/inc/cfg/drvs_cfg.h
new file mode 100644
index 0000000..010e3aa
--- /dev/null
+++ b/cp/ps/driver/inc/cfg/drvs_cfg.h
@@ -0,0 +1,75 @@
+/*******************************************************************************
+ * Copyright (C) 2008, ZTE Corporation.
+ *
+ * File Name: drvs_cfg.h
+ * File Mark:
+ * Description: This file contains the
+ * Others:
+ * Version: V1.0
+ * Author: huji
+ * Date: 2008-11-18
+ * History 1:
+ * Date: 2008-12-31
+ * Version:
+ * Author: wangxia
+ * Modification: add flash address for zx2930,zx2960,zx2802
+ *********************************************************************************/
+
+#ifndef _DRV_CFG_H
+#define _DRV_CFG_H
+
+/****************************************************************************
+* Include files
+****************************************************************************/
+/*for iram ddr*/
+#include "ram_config.h"
+/*for registers*/
+#include "drvs_chip_cfg.h"
+/*for dma regions*/
+#include "dma_cfg.h"
+#include "drvs_int.h"
+
+/****************************************************************************
+* type
+****************************************************************************/
+
+/****************************************************************************
+* Macros
+****************************************************************************/
+//add for voice drv by xuxinqiang
+#define BASEADR_SM_INT (UINT16 *) 0xF6001000
+/****************************************************************************
+* i2S configuration
+****************************************************************************/
+#define ARM_TOP_REG_BASE 0x0010D000
+
+#define ARM_I2S_LOOP_CFG *((volatile UINT32 *)(0x00140060))
+
+#define ARM_FRAC_DIV_FREQ *((volatile UINT32 *)(0x0010D09C))
+#define ARM_CODEC_MCLK *((volatile UINT32 *)(0x0010D0a0))
+
+/*ARM I2S SEL & SET*/
+#define CRPM_CLKSEL *((volatile UINT32 *)(LSP_CRM_REG_BASE+0x00))
+#define I2S0_CLKDIV *((volatile UINT32 *)(LSP_CRM_REG_BASE+0x14))
+#define I2S1_CLKDIV *((volatile UINT32 *)(LSP_CRM_REG_BASE+0x18))
+
+
+/*xxxx config---------------------------------------------------------------*/
+#define DMA_SILLY_MODE_EN 0
+//zhouyuchao add for usb phy suspend
+#define NAND_USB_CTRL (0x00)
+
+/****************************************************************************
+* sd configuration
+****************************************************************************/
+#define SD_MAX_SLOT_NUM 1 //max slot numbers
+#if (defined _CHIP_ZX2975)||(defined _CHIP_ZX297520)||(defined _CHIP_ZX297520V2)
+#define IO_OUT_POWER_READ_REG ((volatile UINT32*)(0x60005098))
+#define IO_OUT_POWER_WRITE_REG ((volatile UINT32*)(0x60005098))
+#else
+#define IO_OUT_POWER_READ_REG ((volatile UINT32*)(0x60005068))
+#define IO_OUT_POWER_WRITE_REG ((volatile UINT32*)(0x60005098))
+#endif
+
+#endif/*_DRV_CFG_H*/
+
diff --git a/cp/ps/driver/inc/cfg/drvs_chip_cfg.h b/cp/ps/driver/inc/cfg/drvs_chip_cfg.h
new file mode 100644
index 0000000..425e621
--- /dev/null
+++ b/cp/ps/driver/inc/cfg/drvs_chip_cfg.h
@@ -0,0 +1,307 @@
+/*******************************************************************************
+ * Copyright (C) 2008, ZTE Corporation.
+ *
+ * File Name: drv_chip_cfg.h
+ * File Mark:
+ * Description: This file contains the
+ * Others:
+ * Version: V1.0
+ * Author: zhangdongdong
+ * Date: 2015-07-31
+ * History 1:
+ *
+ *********************************************************************************/
+
+#ifndef _DRV_CHIP_CFG_H
+#define _DRV_CHIP_CFG_H
+
+#include "drvs_bits.h"
+
+
+/****************************************************************************
+* type
+****************************************************************************/
+
+
+/****************************************************************************
+* MACRO
+****************************************************************************/
+
+#define TOP_MAIN_CLK_IN 26000000 /* 26MHz */
+
+/****************************************************************************
+* register map
+****************************************************************************/
+#ifdef _OS_TOS
+
+#include "drvs_regmap.inc"
+
+/*SYS*/
+#define TOP_SYS_REG_BASE ADDR_SOC_SYS
+#define SOC_SYS_REG_BASE ADDR_SOC_SYS
+#define A1_SYS_REG_BASE ADDR_SOC_SYS
+
+/*CRM*/
+#define SOC_CRM_REG_BASE ADDR_STD_CRM
+#define LSP_CRM_REG_BASE ADDR_LSP_CRM
+#define A1_CRM_REG_BASE ADDR_TOP_CRM
+#define PS_CRM_REG_BASE ADDR_MG_CRM
+
+/*PS*/
+#define PS_CFG_REG_BASE ADDR_MG_CFG
+
+#if defined (_CHIP_ZX297520V2)
+/*L2 CACHE*/
+#define L2CACHE_REG_BASE ADDR_MG_L2CACHE
+#endif
+
+/*PCU*/
+#define PCU_REG_BASE ADDR_PCU
+
+/*SCU*/
+#if defined (_CHIP_ZX297520V2)
+#define SCU_REG_BASE ADDR_MG_SCU /*only in 7520v2*/
+#endif
+
+/*GIC*/
+#define GICC_REG_BASE ADDR_MG_GICC
+#define GICD_REG_BASE ADDR_MG_GICD
+#if defined (_CHIP_ZX297520V3)
+#define GICR_REG_BASE ADDR_MG_GICR
+#endif
+
+/*TIMER*/
+#define TIMER0_REG_BASE ADDR_LSP_PS_TIMER0 /*ps tick*/
+#define TIMER1_REG_BASE ADDR_PS_TIMER1 /*psm wake timer*/
+#define TIMER2_REG_BASE ADDR_PS_TIMER2
+#define PSRM_TIMER_REG_BASE ADDR_LSP_PS_RM_TIMER /*uicc timer*/
+#define TIMER3_REG_BASE ADDR_RM_TIMER1 /*psm compensate timer*/
+
+/*WDT*/
+#define EXT_WDT_BASE ADDR_LSP_PS_WDT
+//#define PT_WDT_BASE ADDR_MG_PT_WDT
+
+/*I2C*/
+//#define I2C0_REG_BASE ADDR_APB_I2C0 /*V2¾«¼òµôÁËÒ»¸öI2C*/
+#define I2C1_REG_BASE ADDR_LSP_I2C1
+#define I2C_PMIC_REG_BASE ADDR_I2C_PMIC
+
+/*USB*/
+#define USB0_REG_BASE ADDR_HSIC
+#define USB1_REG_BASE ADDR_USB
+
+/*NAND*/
+#define NAND_REG_BASE ADDR_NAND_REG
+#define NAND_DATA_BASE ADDR_NAND_DATA
+
+/*DMA*/
+#define DMA0_REG_BASE ADDR_DMA_PS
+#define DMA1_REG_BASE ADDR_DMA_PHY
+
+/*SPI*/
+#define SPI0_REG_BASE ADDR_LSP_SSP0
+#define SPI1_REG_BASE ADDR_LSP_SSP1
+
+/*ICP*/
+#define ICP0_REG_BASE ADDR_ICP
+
+/*I2S*/
+#define I2S0_REG_BASE ADDR_LSP_I2S0
+#define I2S1_REG_BASE ADDR_LSP_I2S1
+
+/*SDMMC*/
+#define SDMMC0_REG_BASE ADDR_SD0
+#define SDMMC1_REG_BASE ADDR_SD1
+
+/*USIM*/
+#define USIM0_REG_BASE ADDR_GSM_USIM /*´ýÈ·ÈÏ£¬V2¾«¼òµôÁËÒ»¸öUSIM*/
+
+/*EDCP*/
+#define EDCP0_REG_BASE ADDR_EDCP
+
+/*CHECKSUM*/
+#define CHECKSUM0_REG_BASE 0
+
+/*UART*/
+#define UART0_REG_BASE ADDR_UART0
+#define UART1_REG_BASE ADDR_LSP_UART1
+#define UART2_REG_BASE ADDR_LSP_UART2
+
+/*PAD*/
+#define PAD_CTRL_REG_BASE ADDR_PAD_CTRL_A0
+
+/*GPIO*/
+#define GPIO0_REG_BASE ADDR_GPIO0
+#define GPIO1_REG_BASE ADDR_GPIO1
+
+/*PIN MUX*/
+#define GPIO_PINMUX_REG_BASE ADDR_PIN_MUX
+
+/*GSM_MODEM1*/
+#define GSM_MODEM1 ADDR_GSM_MODEM1
+
+/*GSM_MODEM2*/
+#define GSM_MODEM2 ADDR_GSM_MODEM2
+
+/*DDR*/
+#define DDR_CTRL_BASE ADDR_DDR_CTRL
+#define DDR_PHY_BASE ADDR_DDR_PHY
+#if defined (_CHIP_ZX297520V3)
+#define DDR_FFC_BASE ADDR_DDR_FFC
+#endif
+
+/*IRAM*/
+#define IRAM1_BASE ADDR_IRAM1 /*Ê¡µç½»»¥£¬²»µôµçIRAM*/
+#define IRAM2_BASE ADDR_IRAM2 /*ÔËÐÐM0Èí¼þ´úÂë*/
+
+/*LPM*/
+#define GSM_LPM_BASE ADDR_LPM_GSM
+#define LTE_LPM_BASE ADDR_LPM_LTE
+#define TD_LPM_BASE ADDR_LPM_TD
+#define W_LPM_BASE ADDR_LPM_W
+
+/*EFUSE*/
+#define EFUSE_BASE_ADDR ADDR_EFUSE
+
+#if defined (_CHIP_ZX297520V3)
+/*VOU*/
+#define VOU_CTRL_BASE ADDR_VOU_CFG
+#define VOU_CLK_CTRL_BASE ADDR_STD_CRM
+#endif
+#endif
+
+#ifdef _OS_LINUX
+#include <mach/iomap.h>
+
+/*SYS*/
+#define TOP_SYS_REG_BASE ((unsigned int)ZX_SOC_SYS_BASE)
+#define SOC_SYS_REG_BASE ((unsigned int)ZX_SOC_SYS_BASE)
+#define A1_SYS_REG_BASE ((unsigned int)ZX_SOC_SYS_BASE)
+
+/*CRM*/
+#define SOC_CRM_REG_BASE ((unsigned int)ZX_MATRIX_CRM_BASE)
+#define LSP_CRM_REG_BASE ((unsigned int)ZX_LSP_CRPM_BASE)
+#define A1_CRM_REG_BASE ((unsigned int)ZX_TOP_CRM_BASE)
+#define PS_CRM_REG_BASE ((unsigned int)ZX_AP_PERIPHERAL_BASE)
+
+/*PS*/
+//#define PS_CFG_REG_BASE ZX297520V3_MG_CFG
+
+/*L2 CACHE*/
+//#define L2CACHE_REG_BASE ZX297520V3_MG_L2CACHE
+
+/*PCU*/
+#define PCU_REG_BASE ((unsigned int)ZX_PCU_BASE)
+
+/*GIC*/
+#define GICC_REG_BASE ((unsigned int)ZX_GICC_BASE)
+#define GICD_REG_BASE ((unsigned int)ZX_GIC_BASE)
+#define GICR_REG_BASE ((unsigned int)GIC_REDIST_BASE)
+
+
+/*TIMER*/
+#define TIMER0_REG_BASE ((unsigned int)ZX_PS_TIMER0_BASE) /*ps tick*/
+#define TIMER1_REG_BASE ((unsigned int)ZX_PS_TIMER1_BASE) /*psm wake timer*/
+#define TIMER2_REG_BASE ((unsigned int)ZX_PS_TIMER2_BASE) /*psm compensate timer*/
+#define PSRM_TIMER_REG_BASE ((unsigned int)ZX_PS_RM_TIMER_BASE) /*uicc timer*/
+#define TIMER3_REG_BASE ((unsigned int)ZX_RM_TIMER1_BASE) /*rm timer1*/
+
+/*WDT*/
+#define EXT_WDT_BASE ((unsigned int)ZX_PS_WDT_BASE)
+//#define PT_WDT_BASE ZX297520V3_MG_PT_WDT
+
+/*I2C*/
+//#define I2C0_REG_BASE ZX297520V3_APB_I2C0 /*V2¾«¼òµôÁËÒ»¸öI2C*/
+#define I2C1_REG_BASE ((unsigned int)ZX_I2C1_BASE)
+#define I2C_PMIC_REG_BASE ((unsigned int)ZX_PMIC_I2C_BASE)
+
+/*USB*/
+#define USB0_REG_BASE ((unsigned int)ZX_HSIC_BASE)
+#define USB1_REG_BASE ((unsigned int)ZX_USB_BASE)
+
+/*NAND*/
+#define NAND_REG_BASE ((unsigned int)ZX_NAND_REG_BASE)
+#define NAND_DATA_BASE ((unsigned int)ZX_NAND_DATA_BASE)
+
+/*DMA*/
+#define DMA0_REG_BASE ((unsigned int)ZX_DMA_PS_BASE)
+#define DMA1_REG_BASE ((unsigned int)ZX_DMA_PHY_BASE)
+
+/*SPI*/
+#define SPI0_REG_BASE ((unsigned int)ZX_SSP0_BASE)
+#define SPI1_REG_BASE ((unsigned int)ZX_SSP1_BASE)
+
+/*ICP*/
+#define ICP0_REG_BASE ((unsigned int)ZX_ICP_BASE)
+
+/*I2S*/
+#define I2S0_REG_BASE ((unsigned int)ZX_I2S0_BASE)
+#define I2S1_REG_BASE ((unsigned int)ZX_I2S1_BASE)
+
+/*TDM*/
+#define TDM_REG_BASE ((unsigned int)ZX_TDM_BASE)
+
+/*SDMMC*/
+#define SDMMC0_REG_BASE ((unsigned int)ZX_SD0_BASE)
+#define SDMMC1_REG_BASE ((unsigned int)ZX_SD1_BASE)
+
+/*USIM*/
+//#define USIM0_REG_BASE ZX297520V3_GSM_USIM /*´ýÈ·ÈÏ£¬V2¾«¼òµôÁËÒ»¸öUSIM*/
+#define USIM1_REG_BASE ((unsigned int)ZX_USIM1_BASE)
+
+/*EDCP*/
+#define EDCP0_REG_BASE ((unsigned int)ZX_EDCP_BASE)
+
+/*CHECKSUM*/
+#define CHECKSUM0_REG_BASE 0
+
+/*UART*/
+#define UART0_REG_BASE ((unsigned int)ZX_UART0_BASE)
+#define UART1_REG_BASE ((unsigned int)ZX_UART1_BASE)
+#define UART2_REG_BASE ((unsigned int)ZX_UART2_BASE)
+
+/*PAD*/
+#define PAD_CTRL_REG_BASE ((unsigned int)ZX_PAD_CTRL_BASE)
+
+/*GPIO*/
+#define GPIO0_REG_BASE ((unsigned int)ZX_GPIO0_BASE)
+#define GPIO1_REG_BASE ((unsigned int)ZX_GPIO1_BASE)
+
+/*PIN MUX*/
+#define GPIO_PINMUX_REG_BASE ((unsigned int)ZX_PIN_MUX_BASE)
+
+/*GSM_CFG*/
+#define GSM_CFG_BASE ((unsigned int)ZX_GSM_CFG_BASE)
+
+/*GSM_MODEM1*/
+#define GSM_MODEM1 ((unsigned int)ZX_GSM_MODEM_BASE)
+
+/*GSM_MODEM2*/
+#define GSM_MODEM2 ((unsigned int)(ZX_GSM_MODEM_BASE+0x2000000))
+
+/*DDR*/
+#define DDR_CTRL_BASE ((unsigned int)ZX_DDR_CTRL_BASE)
+#define DDR_PHY_BASE ((unsigned int)ZX_DDR_PHY_BASE)
+#define DDR_FFC_BASE ((unsigned int)ZX_DDR_FFC_BASE)
+/**/
+#define SYS_CTRL_BASE ((unsigned int)ZX_SOC_SYS_BASE)
+
+/*IRAM*/
+#define IRAM1_BASE ((unsigned int)ZX_IRAM1_BASE) /*Ê¡µç½»»¥£¬²»µôµçIRAM*/
+#define IRAM2_BASE_ADDR ((unsigned int)ZX_IRAM2_BASE) /*ÔËÐÐM0Èí¼þ´úÂë*/
+
+/*LPM*/
+#define GSM_LPM_BASE ((unsigned int)ZX_LPM_GSM_BASE)
+#define LTE_LPM_BASE ((unsigned int)ZX_LPM_LTE_BASE)
+#define TD_LPM_BASE ((unsigned int)ZX_LPM_TD_BASE)
+#define W_LPM_BASE ((unsigned int)ZX_LPM_W_BASE)
+
+/*EFUSE*/
+#define EFUSE_BASE_ADDR ((unsigned int)ZX_EFUSE_BASE)
+/*VOU*/
+#define VOU_CTRL_BASE ((unsigned int)ZX_VOU_CFG_BASE)
+#define VOU_CLK_CTRL_BASE ((unsigned int)ZX_MATRIX_CRM_BASE)
+#endif
+
+#endif/*_DRV_CFG_H*/
+
diff --git a/cp/ps/driver/inc/cfg/drvs_debug.h b/cp/ps/driver/inc/cfg/drvs_debug.h
new file mode 100644
index 0000000..93f5cda
--- /dev/null
+++ b/cp/ps/driver/inc/cfg/drvs_debug.h
@@ -0,0 +1,77 @@
+/*******************************************************************************
+ * Copyright (C) 2007, ZTE Corporation.
+ *
+ * File Name:
+ * File Mark:
+ * Description:
+ * Others:
+ * Version: 1.0
+ * Author: geanfeng
+ * Date: 2013-09-25
+ * History 1:
+ * Date:
+ * Version:
+ * Author:
+ * Modification:
+ * History 2:
+ ********************************************************************************/
+
+#ifndef _DRVS_DEBUG_H_
+#define _DRVS_DEBUG_H_
+
+/****************************************************************************
+* Include files
+****************************************************************************/
+#include "drvs_general.h"
+
+/****************************************************************************
+* Macros
+****************************************************************************/
+
+/****************************************************************************
+* Types
+****************************************************************************/
+typedef enum _T_DRV_DEBUG_PRINT_CHANNEL
+{
+ DRV_DEBUG_PRINT_ZOSS,
+ DRV_DEBUG_PRINT_DCC
+}T_DRV_DEBUG_PRINT_CHANNEL;
+
+/****************************************************************************
+* Constants
+****************************************************************************/
+
+/****************************************************************************
+* Global Variables
+****************************************************************************/
+extern volatile T_DRV_DEBUG_PRINT_CHANNEL g_debugPrintChnSel;
+/****************************************************************************
+* Function Prototypes
+****************************************************************************/
+SINT32 debug_Print(const VOID *pFormat, ... );
+/*******************************************************************************
+* Function:zDrvDebug_Printf
+* Description: log´òÓ¡
+* Parameters:
+* pFormat:¸ñʽ»¯×Ö·û´®
+* Output:
+*
+* Returns:
+*
+*
+* Others:
+********************************************************************************/
+#define zDrvDebug_Printf(s...) \
+{ \
+ if (g_debugPrintChnSel == DRV_DEBUG_PRINT_ZOSS)\
+ {\
+ zOss_Printf(SUBMDL_HAL, PRINT_LEVEL_NORMAL, s);\
+ }\
+ else \
+ {\
+ debug_Print(s);\
+ }\
+}
+
+#endif/*_DRVS_IO_H_*/
+
diff --git a/cp/ps/driver/inc/cfg/drvs_int_internal.h b/cp/ps/driver/inc/cfg/drvs_int_internal.h
new file mode 100644
index 0000000..bcc9e14
--- /dev/null
+++ b/cp/ps/driver/inc/cfg/drvs_int_internal.h
@@ -0,0 +1,143 @@
+/*******************************************************************************
+ * Copyright (C) 2014, ZTE Corporation.
+ *
+ * File Name: hal_int_internal.h
+ * File Mark:
+ * Description: describe functions and related macros and types used by
+ * other driver modules
+ * Others:
+ * Version: 1.0
+ * Author: xuzhiguo
+ * Date: 2014-05-05
+ * History 1:
+ * Date:
+ * Version:
+ * Author:
+ * Modification:
+ * History 2:
+ ********************************************************************************/
+
+#ifndef _DRVS_INT_INTERNAL_H
+#define _DRVS_INT_INTERNAL_H
+
+/****************************************************************************
+* Include files
+****************************************************************************/
+#include "drvs_general.h"
+#include "drvs_int.h"
+
+/****************************************************************************
+* Macros
+****************************************************************************/
+
+/****************************************************************************
+* Types
+****************************************************************************/
+typedef enum _T_Int_State
+{
+ INT_UNINSTALL,
+ INT_PENDING,
+ INT_ACTIVE,
+} T_Int_State;
+
+/*
+* this struct presents the operation method
+* and state of interrupt controller chip
+*/
+typedef struct _T_Int_Chip
+{
+ VOID (*pMaskIrq)( UINT32 line );
+ VOID (*pUnmaskIrq)( UINT32 line );
+ VOID (*pSetLineLevel)(UINT32 line, T_zDrvIntLineLevel level);
+ VOID (*pSetLinePri)(UINT32 line, UINT32 pri);
+} T_Int_Chip;
+
+typedef VOID (*IsrFunc)(VOID);
+
+/**************************************************************************
+ * Global Variable
+ **************************************************************************/
+
+/**************************************************************************
+ * Function Prototypes
+ **************************************************************************/
+ /*******************************************************************************
+ * Function: zDrvInt_SetMaskRam
+ * Description: an inline function to set g_IntDev.MaskRegInRam
+ * Parameters:
+ * Input:
+ * index: which member in array MaskRegInRam
+ * value: be writen
+ *
+ * Output:
+ *
+ * Returns:
+ *
+ * Others:
+ ********************************************************************************/
+ VOID zDrvInt_SetMaskRam(UINT32 index, UINT32 value);
+
+/*******************************************************************************
+ * Function: zDrvInt_GetMaskRam
+ * Description: an inline function to get g_IntDev.MaskRegInRam
+ * Parameters:
+ * Input:
+ * index: which member in array MaskRegInRam
+ *
+ * Output:
+ *
+ * Returns:
+ * member's value in array MaskRegInRam
+ *
+ * Others:
+ ********************************************************************************/
+ UINT32 zDrvInt_GetMaskRam(UINT32 index);
+
+/*******************************************************************************
+ * Function: zDrvInt_GetExtraIsr
+ * Description: get a isr according to ex8in1 int and gpio int
+ * Parameters:
+ * Input:
+ * line: interrupt line
+ *
+ * Output:
+ *
+ * Returns:
+ * isr for ex8in1 int and gpio int
+ * Others:
+ ********************************************************************************/
+ VOID* zDrvInt_GetExtraIsr(UINT32 line);
+
+/*******************************************************************************
+ * Function: zDrvInt_GetIntState
+ * Description: an inline function to get g_IntDev.IntState
+ * Parameters:
+ * Input:
+ * line: interrupt line to be disabled 0--INT_LINES_NUM
+ *
+ * Output:
+ *
+ * Returns:
+ * member's value in array IntState
+ *
+ * Others:
+ ********************************************************************************/
+ T_Int_State zDrvInt_GetIntState(UINT32 line);
+
+/*******************************************************************************
+ * Function: zDrvInt_SetChipHandler
+ * Description:
+ * Parameters:
+ * Input:
+ * line: which member in array IntChipHandler, according to interrupt line
+ * pChip: point to struct T_Int_Chip to be set
+ *
+ * Output:
+ *
+ * Returns:
+ *
+ * Others:
+ ********************************************************************************/
+ VOID zDrvInt_SetChipHandler(UINT32 line, T_Int_Chip *pChip);
+
+ #endif
diff --git a/cp/ps/driver/inc/cfg/drvs_zx297510_regmap.inc b/cp/ps/driver/inc/cfg/drvs_zx297510_regmap.inc
new file mode 100644
index 0000000..849d18e
--- /dev/null
+++ b/cp/ps/driver/inc/cfg/drvs_zx297510_regmap.inc
@@ -0,0 +1,80 @@
+/*******************************************************************************
+ * Copyright (C) 2013, ZTE Corporation.
+ *
+ * File Name: drvs_zx297510_regmap.inc
+ * File Mark:
+ * Description: This file contains the register map of zx297510.
+ * Others:
+ * Version: V1.0
+ * Author: geanfeng
+ * Date: 2013-04-07
+ * History 1:
+ *
+ *********************************************************************************/
+#ifndef _DRVS_ZX297510_REGMAP_H
+#define _DRVS_ZX297510_REGMAP_H
+
+#define ZX297510_A1_SYS 0x00100000
+#define ZX297510_A1_CRM 0x00101000
+#define ZX297510_A1_UART0 0x00102000
+#define ZX297510_A1_UART1 0x00103000
+#define ZX297510_A1_SPI0 0x00104000
+#define ZX297510_A1_I2C0 0x00106000
+#define ZX297510_A1_TIMER0 0x00108000
+#define ZX297510_A1_TIMER1 0x00109000
+#define ZX297510_A1_RTC 0x0010B000
+
+#define ZX297510_SOC_CRM 0x0010C000
+#define ZX297510_TOP_SYS 0x0010D000
+#define ZX297510_APB_TIMER 0x00123000
+#define ZX297510_APB_WATCHDOG 0x00124000
+
+#define ZX297510_MG_ICU 0x00800000
+#define ZX297510_MG_TIMER 0x00801000
+#define ZX297510_MG_WATCHDOG 0x00802000
+#define ZX297510_MG_CRPM 0x00803000
+#define ZX297510_MG_INST_AS_CFG 0x00810000
+#define ZX297510_MG_DATA_AS_CFG 0x00811000
+#define ZX297510_MG_L2CACHE 0x00C00000
+
+#define ZX297510_DDR_CFG 0x01203000
+#define ZX297510_NAND_REG 0x01207000
+#define ZX297510_NAND_DATA 0x01208000
+#define ZX297510_EDCP 0x01210000
+#define ZX297510_CHECKSUM 0x01220000
+#define ZX297510_USB0_CFG 0x01240000
+#define ZX297510_USB1_CFG 0x01280000
+#define ZX297510_A2_DMA_INT_MUX 0x01300000
+#define ZX297510_DMA0_CFG 0x01301000
+#define ZX297510_DMA1_CFG 0x01302000
+#define ZX297510_SOC_SYS 0x01303000
+#define ZX297510_USIM 0x01304000
+#define ZX297510_SSC 0x01305000
+#define ZX297510_MG_LSP_CRPM 0x01400000
+#define ZX297510_MG_LSP_I2S0 0x01406000
+#define ZX297510_MG_LSP_I2S1 0x01407000
+#define ZX297510_MG_LSP_SDMMC0 0x01408000
+#define ZX297510_MG_LSP_I2C0 0x01409000
+#define ZX297510_MG_LSP_BLG 0x0140C000
+#define ZX297510_MG_LSP_TIMER0 0x0140E000
+#define ZX297510_MG_LSP_TIMER1 0x0140F000
+#define ZX297510_MG_LSP_SDMMC1 0x01415000
+#define ZX297510_IRAM1_IRAM3 0x10000000
+#define ZX297510_NIC301_GPV 0x10400000
+
+#define ZX297510_DDR_BASE 0x20000000
+
+#define ZX297510_ICP0 0x60000000
+#define ZX297510_ICP1 0x60001000
+#define ZX297510_ZSP_CFG 0x70000000
+
+#define ZX297510_IRAM0_IRAM2 0x90000000
+#define ZX297510_IRAM6 0x90020000
+#define ZX297510_TD_MODEM2 0xA0000000
+#define ZX297510_LTE_MODEM2 0xA0800000
+#define ZX297510_LTE_MODEM1 0xF0000000
+#define ZX297510_TD_MODEM1 0xF2000000
+#define ZX297510_GSM_MODEM1 0xF4000000
+#define ZX297510_GSM_MODEM2 0xF6000000
+
+#endif
diff --git a/cp/ps/driver/inc/cfg/drvs_zx297520_regmap.inc b/cp/ps/driver/inc/cfg/drvs_zx297520_regmap.inc
new file mode 100644
index 0000000..e710b26
--- /dev/null
+++ b/cp/ps/driver/inc/cfg/drvs_zx297520_regmap.inc
@@ -0,0 +1,107 @@
+/*******************************************************************************
+ * Copyright (C) 2014, ZTE Corporation.
+ *
+ * File Name: drvs_zx297520_regmap.inc
+ * File Mark:
+ * Description: This file contains the register map of zx297520.
+ * Others:
+ * Version: V1.0
+ * Author: xuzhiguo
+ * Date: 2014-01-06
+ * History 1:
+ *
+ *********************************************************************************/
+#ifndef _DRVS_ZX297520_REGMAP_H
+#define _DRVS_ZX297520_REGMAP_H
+
+/* AHB0 -- A1 */
+#define ZX297520_A1_SPI0 0x00130000
+#define ZX297520_A1_I2C_PMIC 0x00131000
+#define ZX297520_A1_TIMER0 0x00132000
+#define ZX297520_A1_TIMER1 0x00133000
+#define ZX297520_A1_TIMER2 0x00134000
+#define ZX297520_A1_TIMER3 0x00135000
+#define ZX297520_A1_TIMER4 0x00136000
+#define ZX297520_A1_TIMER5 0x00137000
+#define ZX297520_A1_UART0 0x00138000
+#define ZX297520_A1_RTC 0x00139000
+#define ZX297520_A1_WDT 0x0013A000
+#define ZX297520_A1_CRM 0x0013B000
+#define ZX297520_A1_PCU 0x0013C000
+#define ZX297520_A1_KEY 0x0013D000
+#define ZX297520_A1_GSM_CFG 0x0013E000
+#define ZX297520_A1_LPM 0x0013F000
+#define ZX297520_A1_PAD_CTRL0 0x00143000
+#define ZX297520_A1_GPIO0 0x00144000
+#define ZX297520_A1_GPIO1 0x00145000
+#define ZX297520_A1_SOC_SYS 0x00146000
+#define ZX297520_A1_TS_CTRL 0x00148000
+#define ZX297520_A1_USIM 0x00149000
+
+/* AHB0 */
+#define ZX297520_EDCP 0x01200000
+#define ZX297520_SD0 0x01210000
+#define ZX297520_NAND_REG 0x01211000
+#define ZX297520_NAND_DATA 0x01212000
+
+/* R7 MG */
+#define ZX297520_MG_CRM 0x00800000
+#define ZX297520_MG_CFG 0x00801000
+#define ZX297520_MG_AACFG 0x00802000
+#define ZX297520_MG_L2APB 0x00803000
+#define ZX297520_MG_L2CACHE 0x00804000
+
+#define ZX297520_MG_SCU 0xEF000000
+#define ZX297520_MG_GICC 0xEF000100
+#define ZX297520_MG_GICD 0xEF001000
+#define ZX297520_MG_GT 0xEF000200
+#define ZX297520_MG_PT_WDT 0xEF000600
+
+/* APB */
+#define ZX297520_DMA0_CFG 0x01300000
+#define ZX297520_DMA1_CFG 0x01301000
+#define ZX297520_ICP 0x01302000
+#define ZX297520_DDR_CRTL 0x01303000
+#define ZX297520_DDR_PHY 0x01304000
+#define ZX297520_SSC 0x01305000
+#define ZX297520_STD_CRM 0x01307000
+
+#define ZX297520_APB_CRM 0x01400000
+#define ZX297520_APB_UART0 0x01401000
+#define ZX297520_APB_UART1 0x01402000
+#define ZX297520_APB_I2S0 0x01403000
+#define ZX297520_APB_I2S1 0x01404000
+#define ZX297520_APB_I2C0 0x01405000
+#define ZX297520_APB_I2C1 0x01406000
+#define ZX297520_APB_SSP1 0x01407000
+#define ZX297520_APB_TIMER6 0x01408000
+#define ZX297520_APB_TIMER7 0x01409000
+#define ZX297520_MCU_LCD 0x0140A000
+#define ZX297520_APB_BLG 0x0140B000
+#define ZX297520_APB_SPIFC 0x0140C000
+
+/* AHB1 */
+#define ZX297520_USBHSIC 0x01500000
+#define ZX297520_SD1 0x01540000
+
+/* AXI */
+#define ZX297520_USB 0x02000000
+
+#define ZX297520_NIC400_CFG 0x10400000
+
+/* AXI */
+#define ZX297520_DDR_BASE 0x20000000
+
+/* MODEM */
+#define ZX297520_TD_MODEM_D 0xA0000000
+#define ZX297520_LTE_MODEM_D 0xA2000000
+#define ZX297520_WD_MODEM_D 0xA4000000
+
+#define ZX297520_TD_MODEM_C 0xC0000000
+#define ZX297520_LTE_MODEM_C 0xC2000000
+#define ZX297520_WD_MODEM_C 0xC4000000
+
+#define ZX297520_GSM_MODEM1 0xF4000000
+#define ZX297520_GSM_MODEM2 0xF6000000
+
+#endif
diff --git a/cp/ps/driver/inc/cfg/drvs_zx297520v2_regmap.inc b/cp/ps/driver/inc/cfg/drvs_zx297520v2_regmap.inc
new file mode 100644
index 0000000..8b61176
--- /dev/null
+++ b/cp/ps/driver/inc/cfg/drvs_zx297520v2_regmap.inc
@@ -0,0 +1,121 @@
+/*******************************************************************************
+ * Copyright (C) 2014, ZTE Corporation.
+ *
+ * File Name: drvs_zx297520_regmap.inc
+ * File Mark:
+ * Description: This file contains the register map of zx297520V2.
+ * Others:
+ * Version: V1.0
+ * Author: zhangdongdong
+ * Date: 2015-07-31
+ * History 1:
+ *
+ *********************************************************************************/
+#ifndef _DRVS_ZX297520V2_REGMAP_H
+#define _DRVS_ZX297520V2_REGMAP_H
+
+/* M0 -- A1 CFG */
+#define ZX297520V2_A1_IROM 0x00000000
+#define ZX297520V2_A1_IRAM2 0x00080000
+#define ZX297520V2_A1_IRAM1 0x00100000
+#define ZX297520V2_A1_KEY 0x00130000
+#define ZX297520V2_A1_UART0 0x00131000
+#define ZX297520V2_A1_I2C_PMIC 0x00132000
+#define ZX297520V2_A1_RTC 0x00133000
+#define ZX297520V2_A1_LPM_GSM 0x00134000
+#define ZX297520V2_A1_LPM_LTE 0x00134200
+#define ZX297520V2_A1_LPM_TD 0x00134400
+#define ZX297520V2_A1_LPM_W 0x00134600
+#define ZX297520V2_A1_PS_TIMER1 0x00138000
+#define ZX297520V2_A1_PS_TIMER2 0x00139000
+#define ZX297520V2_A1_PCU 0x0013A000
+#define ZX297520V2_A1_CRM 0x0013B000
+#define ZX297520V2_A1_PAD_CTRL0 0x0013C000
+#define ZX297520V2_A1_GPIO0 0x0013D000
+#define ZX297520V2_A1_GPIO1 0x0013E000
+#define ZX297520V2_A1_GSM_CFG 0x0013F000
+#define ZX297520V2_A1_SOC_SYS 0x00140000
+#define ZX297520V2_A1_RM_TIMER0 0x00142000
+#define ZX297520V2_A1_AP_TIMER1 0x00143000
+#define ZX297520V2_A1_AP_TIMER2 0x00144000
+#define ZX297520V2_A1_RM_TIMER1 0x00145000
+#define ZX297520V2_A1_AP_TIMER3 0x00146000
+#define ZX297520V2_A1_PHY_TIMER1 0x00147000
+#define ZX297520V2_A1_RM_WDT 0x00148000
+#define ZX297520V2_A1_RM2MATRIX 0x00200000
+
+#define ZX297520V2_NIC400_CFG 0x10400000
+
+/* M1 -- AHB CFG0 */
+#define ZX297520V2_EDCP 0x01200000
+#define ZX297520V2_SD0 0x01210000
+#define ZX297520V2_SD1 0x01211000
+#define ZX297520V2_NAND_REG 0x01214000
+#define ZX297520V2_NAND_DATA 0x01215000
+#define ZX297520V2_DDR_CTRL 0x01216000
+#define ZX297520V2_DDR_PHY 0x0121A000
+#define ZX297520V2_EFUSE 0x0121B000
+#define ZX297520V2_USB 0x01500000
+#define ZX297520V2_HSIC 0x01600000
+
+/* M1 -- APB CFG */
+#define ZX297520V2_DMA_PHY_CFG 0x01300000
+#define ZX297520V2_DMA_PS_CFG 0x01301000
+#define ZX297520V2_ICP 0x01302000
+#define ZX297520V2_PIN_MUX 0x01303000
+#define ZX297520V2_SSC 0x01304000
+#define ZX297520V2_STD_CRM 0x01306000
+#define ZX297520V2_GMAC 0x01307000
+
+/* M1 -- LSP */
+#define ZX297520V2_LSP_CRM 0x01400000
+#define ZX297520V2_LSP_PS_TIMER0 0x01401000
+#define ZX297520V2_LSP_PHY_WDT 0x01402000
+#define ZX297520V2_LSP_PS_WDT 0x01403000
+#define ZX297520V2_LSP_RM_WDT 0x01404000
+#define ZX297520V2_LSP_I2S0 0x01405000
+#define ZX297520V2_LSP_I2S1 0x01406000
+#define ZX297520V2_LSP_SPIFC0 0x01407000
+#define ZX297520V2_LSP_UART1 0x01408000
+#define ZX297520V2_LSP_I2C1 0x01409000
+#define ZX297520V2_LSP_SSP0 0x0140A000
+#define ZX297520V2_LSP_PS_RM_TIMER 0x0140B000
+#define ZX297520V2_LSP_PHY_TIMER0 0x0140C000
+#define ZX297520V2_LSP_UART2 0x0140D000
+#define ZX297520V2_LSP_AP_WDT 0x0140E000
+#define ZX297520V2_LSP_AP_TIMER0 0x0140F000
+#define ZX297520V2_LSP_SSP1 0x01410000
+#define ZX297520V2_LSP_AP_TIMER4 0x01411000
+#define ZX297520V2_LSP_TDM 0x01412000
+
+/* PS MG */
+
+#define ZX297520V2_MG_CRM 0x00800000
+#define ZX297520V2_MG_CFG 0x00801000
+#define ZX297520V2_MG_AACFG 0x00802000
+#define ZX297520V2_MG_L2APB 0x00803000
+#define ZX297520V2_MG_L2CACHE 0x00804000
+
+#define ZX297520V2_MG_SCU 0xEF000000
+#define ZX297520V2_MG_GICC 0xEF000100
+#define ZX297520V2_MG_GICD 0xEF001000
+#define ZX297520V2_MG_GT 0xEF000200
+#define ZX297520V2_MG_PT_WDT 0xEF000600
+
+/* M0 -- DDR */
+#define ZX297520V2_DDR_BASE 0x20000000
+
+/* MODEM */
+#define ZX297520V2_TD_MODEM_D 0xA0000000
+#define ZX297520V2_LTE_MODEM_D 0xA2000000
+#define ZX297520V2_WD_MODEM_D 0xA4000000
+
+#define ZX297520V2_TD_MODEM_C 0xC0000000
+#define ZX297520V2_LTE_MODEM_C 0xC2000000
+#define ZX297520V2_WD_MODEM_C 0xC4000000
+
+#define ZX297520V2_GSM_MODEM1 0xF4000000
+#define ZX297520V2_GSM_MODEM2 0xF6000000
+#define ZX297520V2_GSM_USIM 0xF6100000
+
+#endif
diff --git a/cp/ps/driver/inc/drv_api.h b/cp/ps/driver/inc/drv_api.h
new file mode 100644
index 0000000..d25fea9
--- /dev/null
+++ b/cp/ps/driver/inc/drv_api.h
@@ -0,0 +1,65 @@
+/*******************************************************************************
+ * Copyright (C) 2007, ZTE Corporation.
+ *
+ * File Name:
+ * File Mark:
+ * Description:
+ * Others:
+ * Version: 1.0
+ * Author: geanfeng
+ * Date: 2013-09-25
+ * History 1:
+ * Date:
+ * Version:
+ * Author:
+ * Modification:
+ * History 2:
+ ********************************************************************************/
+
+#ifndef _DRVS_API_H_
+#define _DRVS_API_H_
+
+/****************************************************************************
+* Include files
+****************************************************************************/
+#include "pub.h" /* for basic type */
+#include "oss_api.h" /* for oss function */
+
+#include "pub/drvs_ret.h" /* for driver return value define */
+#include "pub/drvs_assert.h" /* for driver assert function */
+
+
+/*For IO Devices*/
+#include "io/drvs_io.h" /* for io function*/
+#include "io/drvs_io_names.h" /* for io device names*/
+#include "io/drvs_io_dev.h" /* for io devices used function*/
+#include "io/drvs_io_keys.h" /* for io control keys*/
+#include "io/drvs_io_voice.h" /* for voice */
+#include "io/drvs_io_led.h" /* for led */
+#include "io/drvs_io_kpd.h" /* for kpd */
+#include "io/drvs_io_rtc.h" /*for rtc*/
+#include "io/drvs_io_charger.h" /*for charger*/
+#include "io/drvs_io_sio.h" /* for sio devices*/
+#include "io/drvs_io_lcd.h"
+#include "io/drvs_io_fm.h" /* for fm devices*/
+#include "io/drvs_io_vib.h" /* for vibrator devices*/
+#include "io/drvs_io_flashlight.h" /* for flashlight devices*/
+
+/*For Misc Devices*/
+#include "misc/drvs_int.h" /* for interrupt function */
+#include "misc/drvs_nand.h" /* for nand */
+#include "misc/drvs_comm.h" /* for common use */
+#include "misc/drvs_timer.h" /* for timer */
+#include "misc/drvs_cipher.h" /* for cipher */
+#include "misc/drvs_uicc.h" /* for uicc */
+#include "misc/drvs_icp.h" /* for icp */
+#include "misc/drvs_edcp.h" /* for edcp */
+
+#include "misc/drvs_dpram_td.h" /*for td dpram*/
+#include "misc/drvs_lpm.h" /*for lpm*/
+#include "misc/drvs_pow.h" /*for pow*/
+#include "misc/drvs_tsc.h" /*for tsc*/
+#include "misc/drvs_ddrnet.h" /*for ddrnet*/
+
+#endif/*_DRVS_API_H_*/
+
diff --git a/cp/ps/driver/inc/drvs_general.h b/cp/ps/driver/inc/drvs_general.h
new file mode 100644
index 0000000..1529574
--- /dev/null
+++ b/cp/ps/driver/inc/drvs_general.h
@@ -0,0 +1,88 @@
+/*******************************************************************************
+ * Copyright (C) 2007, ZTE Corporation.
+ *
+ * File Name:
+ * File Mark:
+ * Description: include all pubilc head file
+ * Others:
+ * Version: v0.1
+ * Author: weizhigang
+ * Date: 2009-7-3
+ * History 1:
+ * Date:
+ * Version:
+ * Author:
+ * Modification:
+ * History 2:
+ ********************************************************************************/
+
+#ifndef _DRVS_GENERAL_H
+#define _DRVS_GENERAL_H
+
+
+/****************************************************************************
+* Include files
+****************************************************************************/
+#include "pub.h" /* for basic type */
+#include "oss_api.h" /* for oss function */
+#include "ThreadPriority.h" /* for threadpriority */
+
+#include "pub/drvs_bits.h" /* for bits define */
+#include "pub/drvs_bitops.h" /* for bit operations*/
+#include "pub/drvs_regio.h" /* for register io read/write*/
+#include "pub/drvs_ret.h" /* for driver return value define */
+#include "pub/drvs_assert.h" /* for driver assert function */
+#include "pub/drvs_hisr.h" /* for hisr*/
+#include "pub/drvs_ring.h" /* for ring function */
+#include "pub/drvs_debug.h" /* for ring function */
+#include "pub/drvs_config.h" /* for drv configure */
+#include "pub/drvs_list.h" /* for drv list */
+#include "pub/drvs_ramlog.h" /* for ramlog*/
+
+
+#include "io/drvs_io.h" /* for io function*/
+#include "io/drvs_io_names.h" /* for io device names*/
+#include "io/drvs_io_dev.h" /* for io devices used function*/
+#include "io/drvs_io_keys.h" /* for io control keys*/
+#include "io/drvs_io_sio.h" /* for sio devices*/
+
+#include "misc/drvs_int.h" /* for isr function */
+#include "misc/drvs_gpio.h" /* for ring function */
+/*to be continue...*/
+
+/****************************************************************************
+* code section definition
+****************************************************************************/
+#ifdef _OS_OSE
+/*macro about TCM
+ *it can be used to place code and data to specific section in TCM
+ */
+#define PRAGMA(X) _Pragma(#X)
+#define RODATA_BEGIN(X) PRAGMA(arm section rodata=#X)
+#define RWDATA_BEGIN(X) PRAGMA(arm section rwdata=#X)
+#define ZIDATA_BEGIN(X) PRAGMA(arm section zidata=#X)
+#define CODE_BEGIN(X) PRAGMA(arm section code=#X)
+
+#define RODATA_END _Pragma("arm section rodata")
+#define RWDATA_END _Pragma("arm section rwdata")
+#define ZIDATA_END _Pragma("arm section zidata")
+#define CODE_END _Pragma("arm section code")
+#endif
+
+
+
+/****************************************************************************
+* general type
+****************************************************************************/
+typedef enum _T_ZDrv_CoreId
+{
+ CORE_ID_ARM0=0,
+ CORE_ID_ARM1=1,
+ CORE_ID_ZSP0=2,
+ CORE_ID_ZSP1=3,
+ CORE_NUM
+} T_ZDrv_CoreId;
+
+
+#endif/*_DRVS_GENERAL_H*/
+
diff --git a/cp/ps/driver/inc/hrdtest/drvs_hrdtst_voice.h b/cp/ps/driver/inc/hrdtest/drvs_hrdtst_voice.h
new file mode 100644
index 0000000..66d9cfc
--- /dev/null
+++ b/cp/ps/driver/inc/hrdtest/drvs_hrdtst_voice.h
@@ -0,0 +1,163 @@
+/*******************************************************************************
+ * Copyright (C) 2007, ZTE Corporation.
+ *
+ * File Name: drvs_hrdtst_voice.h
+ * File Mark:
+ * Description:
+ * Others:
+ * Version: v1.0
+ * Author: lvwenhua
+ * Date: 2010-8-26
+ * History 1:
+ * Date:
+ * Version:
+ * Author:
+ * Modification:
+ * History 2:
+ ********************************************************************************/
+
+#ifndef _DRVS_HRDTST_VOICE_H
+#define _DRVS_HRDTST_VOICE_H
+
+/****************************************************************************
+* Include files
+****************************************************************************/
+#include "voice_api.h"
+#include "drvs_pmic_audio.h"
+
+/****************************************************************************
+* Macros
+****************************************************************************/
+
+
+/****************************************************************************
+* Types
+****************************************************************************/
+typedef enum
+{
+ VOICE_PATH_MODE_HANDSET =0,
+ VOICE_PATH_MODE_SPEAKER,
+ VOICE_PATH_MODE_HEADSET,
+ VOICE_PATH_MODE_BLUETOOTH,
+
+ MAX_VOICE_PATH_MODE
+} T_ZDrvVoice_PathMode;
+
+typedef VOID (*T_ZDrvVoice_CallbackFunc) (BOOL isWorking, T_ZDrvVoice_PathMode path);
+
+typedef enum
+{
+ VOICE_SCAL_IN = 0,
+ VOICE_SCAL_MIC,
+ VOICE_LAMBDA0,
+ VOICE_GAMMA0,
+
+ VOICE_SCAL_I2S1,
+ VOICE_SCAL_OUT,
+ VOICE_SCAL_REC,
+ VOICE_GAIN_OUT,
+ VOICE_KAPPA0,
+
+ VOICE_SIDE_TONE,
+
+ MAX_VOICE_DIGITAL_GAIN_TYPE
+} T_ZDrvVoice_DigitalGainType;
+
+
+
+
+typedef struct
+{
+ UINT16 scal_in;
+ UINT16 scal_mic;
+ UINT16 lambda0;
+ UINT16 gamma0;
+
+ UINT16 scal_i2s1;
+ UINT16 scal_out;
+ UINT16 scal_rec;
+ UINT16 gain_out;
+ UINT16 kappa0;
+ //UINT16 beta0;
+
+ UINT16 side_tone;
+
+ SINT32 pga_tx;
+ SINT32 pga_rx;
+
+} T_ZDrvVoice_StaticGainConfig;
+
+typedef enum
+{
+ VOICE_BIQUAD_UPLINK =0,
+ VOICE_BIQUAD_DOWNLINK,
+
+ MAX_VOICE_BIQUAD_ENUM
+} T_ZDrvVoice_Biquad;
+
+typedef struct
+{
+ UINT16 a0_1;
+ UINT16 a1_1;
+ UINT16 a2_1;
+ UINT16 b1_1;
+ UINT16 b2_1;
+
+ UINT16 a0_2;
+ UINT16 a1_2;
+ UINT16 a2_2;
+ UINT16 b1_2;
+ UINT16 b2_2;
+} T_ZDrvVoice_BiquadParam;
+
+#if 0
+typedef struct
+{
+ UINT16 gain[MAX_VOICE_OUTPUT_VOL_LEVEL];
+} T_ZDrvVoice_VolGainConfig;
+#endif
+
+typedef struct
+{
+ UINT16 mode;
+} T_ZDrvVoice_HfOnParam;
+
+typedef struct
+{
+// UINT16 gain_analog;
+ UINT16 step_width;
+ UINT16 lms_length;
+ UINT16 lms_offset;
+ UINT16 block_length;
+ SINT16 rxtx_relation; // change cai
+ UINT16 nr_sw_2;
+ UINT16 nr_u_fak_0;
+ UINT16 nr_u_fak;
+ UINT16 add_atten;
+ UINT16 min_atten;
+ UINT16 max_atten;
+} T_ZDrvVoice_HfSetParam;
+
+typedef enum
+{
+ GSM = 0,
+ TD,
+ LTE,
+ MAX_MODETYPE
+} T_ZDrvVoice_Communication_Mode;
+
+
+/****************************************************************************
+* Constants
+****************************************************************************/
+
+/****************************************************************************
+* Global Variables
+****************************************************************************/
+
+/****************************************************************************
+* Function Prototypes
+****************************************************************************/
+
+#endif/*_DRVS_HRDTST_VOICE_H*/
+
diff --git a/cp/ps/driver/inc/io/audio_api.h b/cp/ps/driver/inc/io/audio_api.h
new file mode 100644
index 0000000..82786b2
--- /dev/null
+++ b/cp/ps/driver/inc/io/audio_api.h
@@ -0,0 +1,365 @@
+/***********************************************************************
+* Copyright (C) 2008, ZTE Corporation.
+*
+* File Name: audio_api.h
+* File Mark:
+* Description: Provide audio module function prototype declaration and type declaration.
+* For no multimedia processor platform.
+* Others:
+* Version: v0.5
+* Author: DangMaochang
+* Date: 2008-06-30
+*
+* History 1:
+* Date:
+* Version:
+* Author:
+* Modification:
+* History 2:
+**********************************************************************/
+
+#ifndef _AUDIO_API_H
+#define _AUDIO_API_H
+
+#include "drvs_io.h"
+#include "drvs_io_voice.h"
+
+/**************************************************************************
+ * Include files *
+ **************************************************************************/
+
+
+/**************************************************************************
+ * Macro *
+ **************************************************************************/
+#define ZDRV_DEV_AUDIO "audio" /*The device name of audio driver.*/
+
+/**************************************************************************
+ * Types *
+ **************************************************************************/
+
+/*Information from driver to upper application.*/
+typedef enum {
+ AUDIO_INFO_FILE_INVALID = 0,
+ AUDIO_INFO_PLAY_END ,
+ AUDIO_INFO_PLAY_ERR ,
+ AUDIO_INFO_REC_END ,
+ AUDIO_INFO_REC_ERR ,
+
+ MAX_AUDIO_INFO
+} T_ZDrvAudio_Info;
+
+/* Audio input channel volum level selection. */
+typedef enum{
+ AUDIO_INPUT_VOL_LEVEL_0 = 0,
+ AUDIO_INPUT_VOL_LEVEL_1,
+ AUDIO_INPUT_VOL_LEVEL_2,
+ AUDIO_INPUT_VOL_LEVEL_3,
+ AUDIO_INPUT_VOL_LEVEL_4,
+ AUDIO_INPUT_VOL_LEVEL_5,
+ AUDIO_INPUT_VOL_LEVEL_6,
+ AUDIO_INPUT_VOL_LEVEL_7,
+ AUDIO_INPUT_VOL_LEVEL_8,
+ AUDIO_INPUT_VOL_LEVEL_9,
+ AUDIO_INPUT_VOL_LEVEL_10,
+ AUDIO_INPUT_VOL_LEVEL_11,
+ MAX_AUDIO_INPUT_VOL_LEVEL
+} T_ZDrvAudio_InputVolLevel;
+
+/* Audio output channel volum level selection. */
+typedef enum{
+ AUDIO_OUTPUT_VOL_LEVEL_0 = 0,
+ AUDIO_OUTPUT_VOL_LEVEL_1,
+ AUDIO_OUTPUT_VOL_LEVEL_2,
+ AUDIO_OUTPUT_VOL_LEVEL_3,
+ AUDIO_OUTPUT_VOL_LEVEL_4,
+ AUDIO_OUTPUT_VOL_LEVEL_5,
+ AUDIO_OUTPUT_VOL_LEVEL_6,
+ AUDIO_OUTPUT_VOL_LEVEL_7,
+ AUDIO_OUTPUT_VOL_LEVEL_8,
+ AUDIO_OUTPUT_VOL_LEVEL_9,
+ AUDIO_OUTPUT_VOL_LEVEL_10,
+ AUDIO_OUTPUT_VOL_LEVEL_11,
+
+ MAX_AUDIO_OUTPUT_VOL_LEVEL
+} T_ZDrvAudio_OutputVolLevel;
+
+/* brief Select the audio data sampling rate for the Stereo DAC.
+ * note: This enumeration defines all of the possible sampling rates currently
+ * supported by the Stereo DAC. One of these sampling rates must be selected
+ * and it must match that of the audio stream or else signal distortion will
+ * occur.
+ */
+typedef enum
+{
+ AUDIO_RATE_8_KHZ, /* Use 8 kHz sampling rate. */
+ AUDIO_RATE_11_025_KHZ, /* Use 11.025 kHz sampling rate. */
+ AUDIO_RATE_12_KHZ, /* Use 12 kHz sampling rate. */
+ AUDIO_RATE_16_KHZ, /* Use 16 kHz sampling rate. */
+ AUDIO_RATE_22_050_KHZ, /* Use 22.050 kHz sampling rate. */
+ AUDIO_RATE_24_KHZ, /* Use 24 kHz sampling rate. */
+ AUDIO_RATE_32_KHZ, /* Use 32 kHz sampling rate. */
+ AUDIO_RATE_44_1_KHZ, /* Use 44.1 kHz sampling rate. */
+ AUDIO_RATE_48_KHZ, /* Use 48 kHz sampling rate. */
+ AUDIO_RATE_64_KHZ, /* Use 64 kHz sampling rate */
+ AUDIO_RATE_96_KHZ, /* Use 96 kHz sampling rate. */
+ MAX_AUDIO_RATE
+ } T_ZDrvAudio_SampleRate;
+
+/* Audio stereoDAC balance left level selection. */
+typedef enum{
+ AUDIO_STEREO_BALANCE_LEVEL_0 = 0,
+ AUDIO_STEREO_BALANCE_LEVEL_1,
+ AUDIO_STEREO_BALANCE_LEVEL_2,
+ AUDIO_STEREO_BALANCE_LEVEL_3,
+ AUDIO_STEREO_BALANCE_LEVEL_4,
+ AUDIO_STEREO_BALANCE_LEVEL_5,
+ AUDIO_STEREO_BALANCE_LEVEL_6,
+ AUDIO_STEREO_BALANCE_LEVEL_7,
+ MAX_AUDIO_STEREO_BALANCE_LEVEL
+} T_ZDrvAudio_BalanceLevel;
+
+/* Audio stereoDAC BANLANCE */
+typedef struct
+{
+ T_ZDrvAudio_BalanceLevel balanceLeft; /* left */
+ T_ZDrvAudio_BalanceLevel balanceright; /* right */
+} T_ZDrvAudio_Banlance;
+
+/* Audio 3DEFFECT */
+typedef struct
+{
+ UINT16 setbass; /*set bass effect*/
+ UINT16 setsurr; /*set surround effect*/
+}T_ZDrvAudio_3DEFFECT;
+
+/* Audio eq mode */
+typedef enum
+{
+ AUDIO_EQMODE_NORMAL=0,
+ AUDIO_EQMODE_CLASSIC,
+ AUDIO_EQMODE_POP,
+ AUDIO_EQMODE_JAZZ,
+ AUDIO_EQMODE_ROCK,
+ MAX_AUDIO_EQMODE
+}T_ZDrvAUDIO_EQMODE;
+
+/* Audio play info */
+typedef struct
+{
+ UINT32 DataLenth; /*Total play datalenth(byte).*/
+
+} T_ZDrvAudio_PlayInfo;
+
+/* Audio buffer info */
+typedef struct
+{
+ VOID *buf; /* Audio buffer pointer */
+ UINT32 buffersize; /* Audio buffer size */
+}T_ZDrvAudio_BufInfo;
+
+#if 0
+typedef enum
+{
+ AUDIO_MONO_CHANNEL,
+ AUDIO_DUAL_CHANNEL
+}T_ZDrvAudio_Channel;
+#endif
+
+/* Audio buffer size */
+typedef struct
+{
+ T_ZDrvAudio_Channel channel;
+ UINT32 buffersize;
+}T_ZDrvAudio_PlayParam;
+
+/**************************************************************************
+ * Global Variable *
+ **************************************************************************/
+
+
+/**************************************************************************
+ * Function Prototypes *
+ **************************************************************************/
+typedef void (*T_ZDrvAudio_CallbackFunc) (T_ZDrvAudio_Info);
+
+/**************************************************************************
+* Function: zDrv_Open
+* Description: This function is used to open device according to device name.
+* Parameters:
+* Input:
+ pathname:device name, ZDRV_DEV_AUDIO in audio
+* flags: no use
+* Output: None
+* Returns:
+* device file descriptor if successed. [1, ZDRV_MAX_DEV_FILE_NUM), please refer to dal_api.h
+* DRV_ERR_NO_THIS_DEVICE: this device hasn't been installed yet
+* DRV_ERR_FD_OVERFLOW: no free fd entry
+* DRV_ERR_NOT_SUPPORTED: this device don't support open operation.
+* DRV_ERR_OPEN_TIMES: has been opened already.
+* others: others error code. for detailed information, please refer to the header file of hal layer
+* Others: None
+**************************************************************************/
+/*SINT32 zDrv_Open (const CHAR *pathname, SINT32 flags)*/
+
+
+/**************************************************************************
+* Function: zDrv_Close
+* Description: This function is used to close a device according to device file descriptor.
+* Parameters:
+* Input:
+* fd :device file descriptor
+* Output:None
+* Returns:
+* DRV_SUCCESS: successed.
+* DRV_ERR_NOT_OPENED: has not been opend yet.
+* DRV_ERR_FD_TABLE: device driver table has been invalid.
+* DRV_ERR_NOT_SUPPORTED: this device don't support close operation.
+* others: others error code. for detailed information, please refer to the header file of hal layer
+* Others: None
+**************************************************************************/
+/*SINT32 zDrv_Close(UINT32 fd)*/
+
+/**************************************************************************
+* Function: zDrv_Write
+* Description: This function is used to write data to a device according to the device file descriptor.
+* Parameters:
+* (IN)
+* fd: device file descriptor
+* buf_len: buffer length
+* buf: pointer to the data to be written
+* (OUT)
+* None
+* Returns:
+* the write byte number of read data if successed
+* DRV_ERR_INVALID_PARAM: the input parameters are invalid
+* DRV_ERR_DEV_CLOSED: has not been opend yet.
+* DRV_ERR_NOT_SUPPORTED: this device don't support read operation.
+* others: for detailed information, please refer to the header file of hal layer
+* Others:
+* None.
+
+**************************************************************************/
+/* SINT32 zDrv_Write(UINT32 fd, VOID *buf, UINT32 buf_len) */
+
+/**************************************************************************
+* Function: zDrv_Ioctl
+* Description: This function is used to control audio device.
+* Parameters:
+* Input:
+* private:device private data
+* cmd:command code
+* param:command parameters
+* Output:None
+* Returns:
+* T_ZDrv_ErrCode
+* others: if errcode<-100 ,please refer to the hal layer errcode file
+
+* Others: cmd-arg
+ 1 CMD:IOCTL_AUDIO_RECORD_START:
+ arg: T_ZDrvRcd_InfoParam*
+ return:
+
+ 2 CMD:IOCTL_AUDIO_RECORD_STOP:
+ arg: void
+ return:
+
+ 3 CMD:IOCTL_AUDIO_SET_RECORD_PATH:
+ arg: T_HalAudio_Block*
+ return:
+
+ 4 CMD:IOCTL_AUDIO_SET_RECORD_VOL:
+ arg: T_HalAudio_Block*
+ return:
+
+ 5 CMD:IOCTL_AUDIO_RECORD_GETDATA:
+ arg: T_ZDrvAudio_BufInfo*
+ return:
+
+ 6 CMD:IOCTL_AUDIO_RCD_FREE_BUFF:
+ arg: VOID
+ return:
+
+ 7 CMD:IOCTL_AUDIO_SET_SAMPLE:
+ arg: T_ZDrvAudio_SampleRate*
+ return:
+
+ 8 CMD:IOCTL_AUDIO_SET_BANLANCE:
+ arg: T_ZDrvAudio_Banlance*
+ return:
+
+ 9 CMD:IOCTL_AUDIO_SET_OUTPUT_PATH:
+ arg: T_ZDrv_AudioOutputPath*
+ return:
+
+ 10 CMD:IOCTL_AUDIO_SET_OUTPUT_VOL:
+ arg: T_ZDrvAudio_OutputVolLevel*
+ return:
+
+ 11 CMD:IOCTL_AUDIO_SET_EQMODE:
+ arg: T_ZDrvAUDIO_EQMODE*
+ return:
+
+ 12 CMD:IOCTL_AUDIO_ENABLE_3DEFFECT:
+ arg: T_ZDrvAudio_3DEFFECT*
+ return:
+
+ 13 CMD:IOCTL_AUDIO_SET_MUTE:
+ arg: BOOL*
+ return:
+
+ 14 CMD:IOCTL_AUDIO_PLAY_START:
+ arg: VOID*;
+ return:
+
+ 15 CMD:IOCTL_AUDIO_PLAY_STOP:
+ arg: VOID*;
+ return:
+
+ 16 CMD:IOCTL_AUDIO_PLAY_PAUSE:
+ arg: VOID*;
+ return:
+
+ 17 CMD:IOCTL_AUDIO_PLAY_RESUME:
+ arg: VOID*;
+ return:
+
+ 18 CMD:IOCTL_AUDIO_GET_PLAY_INFO:
+ arg: T_ZDrvAudio_PlayInfo*
+ return:
+
+ 19 CMD:IOCTL_AUDIO_GET_BUFFER:
+ arg: T_ZDrvAudio_BufInfo*
+ return:
+ 20. CMD :IOCTL_AUDIO_SET_RECORD_SAMPLE:
+ arg: T_ZDrvAudio_SampleRate*
+ return:
+
+ 21 CMD:MAX_IOCTL_AUDIO
+ ERROR CMD INPUT
+
+**************************************************************************/
+/* SINT32 zDrv_Ioctl(UINT32 fd, UINT32 cmd, VOID* arg); */
+
+/**************************************************************************
+* Function: zDrv_Read
+* Description: This function is used to read data from a device according to device file descriptor.
+* Parameters:
+* Input:
+* fd:device file descriptor
+* buf: user buffer pointer
+* buf_len:buffer length
+* Output:
+* buf:pointer to the read data buffer
+* Returns:
+* DRV_SUCCESS:success to read data
+* DRV_ERR_NOT_OPENED:device is not openned before
+* DRV_ERROR:fail to read data
+* DRV_ERR_INVALID_PARAM: invalid paraments.
+* Others: None
+
+**************************************************************************/
+/*SINT32 zDrv_Read(UINT32 fd, VOID *buf, UINT32 buf_len)*/
+
+
+#endif /* _AUDIO_API_H */
diff --git a/cp/ps/driver/inc/io/drvs_io.h b/cp/ps/driver/inc/io/drvs_io.h
new file mode 100644
index 0000000..32b35cb
--- /dev/null
+++ b/cp/ps/driver/inc/io/drvs_io.h
@@ -0,0 +1,206 @@
+/*******************************************************************************
+ * Copyright (C) 2007, ZTE Corporation.
+ *
+ * File Name:
+ * File Mark:
+ * Description:
+ * Others:
+ * Version: 1.0
+ * Author: geanfeng
+ * Date: 2013-09-25
+ * History 1:
+ * Date:
+ * Version:
+ * Author:
+ * Modification:
+ * History 2:
+ ********************************************************************************/
+
+#ifndef _DRVS_IO_H_
+#define _DRVS_IO_H_
+
+/****************************************************************************
+* Include files
+****************************************************************************/
+#include "drvs_io_keys.h"
+#include "drvs_io_names.h"
+
+/****************************************************************************
+* Macros
+****************************************************************************/
+#define ZDRVIO_INVALID_HANDLE NULL
+
+
+/****************************************************************************
+* Types
+****************************************************************************/
+/*IO handle*/
+typedef void * T_ZDrvIO_Handle;
+
+/*Open Flags*/
+typedef struct _T_ZDRVIO_FLAGS
+{
+ UINT32 READ:1;
+ UINT32 WRITE:1;
+ UINT32 MULTI_READ:1;
+ UINT32 MULTI_WRITE:1;
+ UINT32 SHARED:1;
+ UINT32 RESERVE:27;
+}
+T_ZDRVIO_FLAGS;
+
+
+/*Global Notify Handle*/
+typedef VOID * T_ZDrvIO_GNotifyHandle;
+
+
+/*Global Notify Callback Function*/
+typedef VOID (*T_ZDrvIO_GNotifyCallBack)(const char* devName, T_DRVIO_EVENT event);
+
+/****************************************************************************
+* Constants
+****************************************************************************/
+
+/****************************************************************************
+* Global Variables
+****************************************************************************/
+
+/****************************************************************************
+* Function Prototypes
+****************************************************************************/
+/*******************************************************************************
+ * Function: zDrvIO_Open
+ * Description:search device by device name, open it, and set the action flags.
+ * Input:
+ name: device name.
+ flags: open flags, control the device action.
+ * Output:None
+ *
+ * Returns:
+ T_ZDrvIO_Handle: the opened device handle. if error happened, return NULL.
+ * Others:
+ ********************************************************************************/
+T_ZDrvIO_Handle zDrvIO_Open(const char *name, T_ZDRVIO_FLAGS flags);
+/*******************************************************************************
+ * Function: zDrvIO_Read
+ * Description:read data from device.
+ * Input:
+ handle:the device handle for read.
+ buffer: the read data buffer. the buffer space supplied by high layer.
+ length:the data length need to read.
+ * Output:None
+ *
+ * Returns:
+ ret >= 0: return the actual read length.
+ DRV_ERROR_NOCONNECT: the device disconnect event happend, need return error to inform higher user.
+ other: other error maked by device.
+ * Others:
+ ********************************************************************************/
+SINT32 zDrvIO_Read(T_ZDrvIO_Handle handle, UINT8* buffer, UINT32 length);
+/*******************************************************************************
+ * Function: zDrvIO_Write
+ * Description:write data to IO handle
+ * Input:
+ handle:the device handle for write.
+ buffer: the write data buffer. the buffer space supplied by high layer.
+ length:the write data length.
+* Output:None
+ *
+ * Returns:
+ ret >= 0: return the actual write length.
+ DRV_ERROR_NOCONNECT: the device disconnect event happend, need return error to inform higher user.
+ other: other error maked by device.
+ * Others:
+ ********************************************************************************/
+SINT32 zDrvIO_Write(T_ZDrvIO_Handle handle, UINT8* buffer, UINT32 length);
+/*******************************************************************************
+ * Function: zDrvIO_BRead
+ * Description:read data from device.
+ * Input:
+ handle:the device handle for read.
+ buffer: the read data buffer. the buffer space supplied by high layer.
+ length:the data length need to read.
+ pos:the read data position in device storage space.
+ * Output:None
+ *
+ * Returns:
+ ret >= 0: return the actual read length.
+ DRV_ERROR_NOCONNECT: the device disconnect event happend, need return error to inform higher user.
+ other: other error maked by device.
+ * Others:
+ ********************************************************************************/
+SINT32 zDrvIO_BRead(T_ZDrvIO_Handle handle, UINT8* buffer, UINT32 blkCnt, UINT32 pos);
+/*******************************************************************************
+ * Function: zDrvIO_BWrite
+ * Description:write data to IO handle
+ * Input:
+ handle:the device handle for write.
+ buffer: the write data buffer. the buffer space supplied by high layer.
+ length:the write data length.
+ pos:the write data position in device storage space.
+* Output:None
+ *
+ * Returns:
+ ret >= 0: return the actual write length.
+ DRV_ERROR_NOCONNECT: the device disconnect event happend, need return error to inform higher user.
+ other: other error maked by device.
+ * Others:
+ ********************************************************************************/
+SINT32 zDrvIO_BWrite(T_ZDrvIO_Handle handle, UINT8* buffer, UINT32 blkCnt, UINT32 pos);
+/*******************************************************************************
+ * Function: zDrvIO_Ctrl
+ * Description:control device.
+ * Input:
+ handle:the device handle for control.
+ function:the control function.
+ handle:the control function arguments.
+* Output:None
+ *
+ * Returns:
+ DRV_SUCCESS: success.
+ DRV_ERROR: error.
+ * Others:
+ ********************************************************************************/
+SINT32 zDrvIO_Ctrl(T_ZDrvIO_Handle handle, T_DRVIO_CTRL_KEY function, VOID *arg);
+/*******************************************************************************
+ * Function: zDrvIO_Close
+ * Description:close the device
+ * Input:
+ handle:the device handle to be closed.
+ * Output:None
+ *
+ * Returns:
+ DRV_SUCCESS: success.
+ DRV_ERROR: error.
+ * Others:
+ ********************************************************************************/
+SINT32 zDrvIO_Close(T_ZDrvIO_Handle handle);
+
+/*******************************************************************************
+ * Function: zDrvIO_RegisterGlobalNotify
+ * Description: register global notifier.
+ * Input:
+ * globalNotifyFn: global noitifier callback function
+ * Output:None
+ *
+ * Returns:
+ * T_ZDrvIO_GNotifyHandle : the global notifier handler.
+ * Others:
+ ********************************************************************************/
+T_ZDrvIO_GNotifyHandle zDrvIO_RegisterGlobalNotify(T_ZDrvIO_GNotifyCallBack globalNotifyFn);
+/*******************************************************************************
+ * Function: zDrvIO_UnregisterGlobalNotify
+ * Description: unregister global notifier.
+ * Input:
+ * gNotifyHandle: the global notifier handler
+ * Output:None
+ *
+ * Returns:
+ *
+ * Others:
+ ********************************************************************************/
+VOID zDrvIO_UnregisterGlobalNotify(T_ZDrvIO_GNotifyHandle gNotifyHandle);
+
+
+#endif/*_DRVS_IO_H_*/
+
diff --git a/cp/ps/driver/inc/io/drvs_io_charger.h b/cp/ps/driver/inc/io/drvs_io_charger.h
new file mode 100644
index 0000000..d34be61
--- /dev/null
+++ b/cp/ps/driver/inc/io/drvs_io_charger.h
@@ -0,0 +1,179 @@
+/*******************************************************************************
+ * Copyright (C) 2007, ZTE Corporation.
+ *
+ * File Name: drvs_io_led.h
+ * File Mark:
+ * Description:
+ * Others:
+ * Version: 1.0
+ * Author: yuxiang
+ * Date: 2014-07-03
+ * History 1:
+ * Date:
+ * Version:
+ * Author:
+ * Modification:
+ * History 2:
+ ********************************************************************************/
+
+#ifndef _DRVS_IO_CHG_H
+#define _DRVS_IO_CHG_H
+
+/****************************************************************************
+* Include files
+****************************************************************************/
+#include "drvs_io.h"
+/****************************************************************************
+* Macros
+****************************************************************************/
+#define ZDRV_DEV_CHG "charger"
+
+/****************************************************************************
+* Types
+****************************************************************************/
+typedef enum
+{
+ CHG_STATE_CALLBACK_AC_IN,
+ CHG_STATE_CALLBACK_AC_OUT,
+ CHG_STATE_CALLBACK_USB_IN,
+ CHG_STATE_CALLBACK_USB_OUT,
+ CHG_STATE_CALLBACK_START,
+ CHG_STATE_CALLBACK_STOP,
+ CHG_STATE_CALLBACK_FINISH,
+ CHG_STATE_CALLBACK_LOAD_IN,
+ CHG_STATE_CALLBACK_LOAD_OUT,
+ CHG_STATE_CALLBACK_ABNORMAL,
+ CHG_STATE_CALLBACK_LOW_VOL_DETECT,
+ CHG_STATE_CALLBACK_OVER_TEMP_PROTECT,
+
+ CHG_STATE_CALLBACK_MAX
+}T_ZDrvChg_CallbackState;
+
+/*the message that should send to dm*/
+ typedef enum
+ {
+ STATE_CHARGING, /*charge start msg*/
+ STATE_DISCHARGING, /*charge stop msg*/
+ STATE_FINISH, /*charge stop msg*/
+ STATE_TEMP_ABORT,
+ STATE_TEMP_ERROR,
+ STATE_ERROR,
+
+ STATE_MAX
+
+} T_ZDrvChg_Status;
+
+ typedef enum
+ {
+ DISCHG_STATUS_ON = 0,
+ DISCHG_STATUS_OFF,
+ DISCHG_STATUS_MAX
+ }T_ZDrvChg_DisChgStatus;
+
+ typedef enum
+ {
+ USB_STATUS_IN = 0,
+ USB_STATUS_OUT,
+ USB_STATUS_MAX
+ }T_ZDrvChg_UsbStatus;
+
+
+ typedef enum
+ {
+ CHG_TYPE_NOTHING,
+ CHG_TYPE_COMPUTER,
+ CHG_TYPE_CHARGER,
+
+ CHG_TYPE_MAX
+} T_ZDrvChg_ChgType;
+
+/*temperature detect*/
+typedef enum
+{
+ CHG_TEMP_DETECT_SUPER_LOW,
+ CHG_TEMP_DETECT_LOW,
+ CHG_TEMP_DETECT_NORMAL,
+ CHG_TEMP_DETECT_HIGH,
+ CHG_TEMP_DETECT_HIGH_55,
+ CHG_TEMP_DETECT_SUPER_HIGH,
+
+ CHG_TEMP_DETECT_MAX
+}T_ZDrvChg_TempDetect;
+
+typedef enum
+{
+ CHG_SWTICH_CHG_OFF,
+ CHG_SWTICH_CHG_ON,
+
+ CHG_SWTICH_CHG_MAX
+}T_ZDrvChg_ChgSwitch;
+
+typedef enum
+{
+ CHG_SWTICH_DISCHG_OFF,
+ CHG_SWTICH_DISCHG_ON,
+
+ CHG_SWTICH_DISCHG_MAX
+}T_ZDrvChg_DisChgSwitch;
+
+typedef enum
+{
+ CHG_OTG_STATE_OFF,
+ CHG_OTG_STATE_ON,
+
+ CHG_OTG_STATE_MAX
+}T_ZDrvChg_OTGState;
+
+typedef enum
+{
+ CHG_SHIPPINGMODE_OFF,
+ CHG_SHIPPINGMODE_ON,
+
+ CHG_SHIPPINGMODE_MAX
+}T_ZDrvChg_ShippingMode;
+
+
+typedef enum
+{
+ CHG_ERROR_DPM_STATE = 1<<11,
+ CHG_ERROR_POWER_BAD = 1<<10, /*the diff*/
+ CHG_ERROR_VSYS_MINI = 1<<8,
+ CHG_ERROR_TERM_STATE = 1<<9,
+ CHG_ERROR_WACHDOG_FAULT = 1<<7,
+ CHG_ERROR_OTG_FAULT = 1<<6,
+ CHG_ERROR_CHRG_OVP = 1<<5,
+ CHG_ERROR_CHRG_TIMEOUT = 1<<4,
+ CHG_ERROR_BAT_FAULT = 1<<3,
+ CHG_ERROR_NTC_COLD = 1<<1,
+ CHG_ERROR_NTC_HOT = 1<<0,
+ CHG_ERROR_STATE_CONFLIT = 1<<15,
+
+
+ CHG_ERROR_MAX = 1<<16,
+}T_ZDrvChg_ErrorCode;
+
+
+typedef enum
+{
+ CHG_QUICK_START_OFF,
+ CHG_QUICK_START_ON,
+
+ CHG_QUICK_START_MAX
+}T_ZDrvChg_QucikStartFlag;
+
+typedef enum
+{
+ CHG_NOT_STOP,
+ CHG_COMPLETE,
+ AC_NOT_EXIST,
+ CHG_TEMP_OVERFLOW,
+ CHG_OTHER_REASON
+}T_ZDrvChg_StopReason;
+/*charge stop reason*/
+
+
+typedef void(*T_ZDrvCHG_CALLBACK)(T_ZDrvChg_CallbackState); /*the send msg callback function */
+
+
+#endif/*_DRVS_IO_LED_H*/
+
diff --git a/cp/ps/driver/inc/io/drvs_io_dev.h b/cp/ps/driver/inc/io/drvs_io_dev.h
new file mode 100644
index 0000000..c59e20c
--- /dev/null
+++ b/cp/ps/driver/inc/io/drvs_io_dev.h
@@ -0,0 +1,123 @@
+/*******************************************************************************
+ * Copyright (C) 2007, ZTE Corporation.
+ *
+ * File Name:
+ * File Mark:
+ * Description:
+ * Others:
+ * Version: 1.0
+ * Author: geanfeng
+ * Date: 2013-09-25
+ * History 1:
+ * Date:
+ * Version:
+ * Author:
+ * Modification:
+ * History 2:
+ ********************************************************************************/
+
+#ifndef _DRVS_IODEV_H_
+#define _DRVS_IODEV_H_
+
+/****************************************************************************
+* Include files
+****************************************************************************/
+#include "drvs_general.h"
+#include "drvs_io.h"
+
+/****************************************************************************
+* Macros
+****************************************************************************/
+
+
+/****************************************************************************
+* Types
+****************************************************************************/
+/*µ×²ãÉ豸¾ä±ú*/
+typedef void * T_ZDrvIODev_Handle;
+
+
+/*É豸Çý¶¯¹Ò½ÓʵÏÖ½Ó¿Ú*/
+typedef struct _T_ZDrvIODev_Ops
+{
+ SINT32 (*open)(VOID *devData, T_ZDRVIO_FLAGS flags);
+ SINT32 (*read)(VOID *devData, VOID *buffer, UINT32 length);
+ SINT32 (*write)(VOID *devData, const VOID *buffer, UINT32 length);
+ SINT32 (*bread)(VOID *devData, VOID *buffer, UINT32 blkCnt, UINT32 pos);
+ SINT32 (*bwrite)(VOID *devData, const VOID *buffer, UINT32 blkCnt, UINT32 pos);
+ SINT32 (*ctrl)(VOID *devData, T_DRVIO_CTRL_KEY function, VOID* arg);
+ SINT32 (*close)(VOID *devData);
+}
+T_ZDrvIODev_Ops;
+
+
+/****************************************************************************
+* Constants
+****************************************************************************/
+
+/****************************************************************************
+* Global Variables
+****************************************************************************/
+
+/****************************************************************************
+* Function Prototypes
+****************************************************************************/
+
+/*******************************************************************************
+ * Function: zDrvIODev_Connect
+ * Description:install and connect io device to device table.
+ * Input:
+ name: the device name to connect.
+ devData: the device private data to be combined.
+ ops: the device I/O operation.
+ * Output:None
+ *
+ * Returns:
+ T_ZDrvIODev_Handle: none zero.
+ NULL: error.
+ * Others:
+ ********************************************************************************/
+T_ZDrvIODev_Handle zDrvIODev_Connect(const char *name, VOID *devData, T_ZDrvIODev_Ops *ops);
+
+/*******************************************************************************
+ * Function: zDrvIODev_Disconnect
+ * Description:uninstall the io device.
+ * Input:
+ handle: the device handle to disconnect.
+ * Output:None
+ *
+ * Returns:
+ NULL: error.
+ * Others:
+ ********************************************************************************/
+VOID zDrvIODev_Disconnect(T_ZDrvIODev_Handle handle);
+
+/*******************************************************************************
+ * Function: zDrvIODev_Show
+ * Description:show the device debug information.
+ * Input:
+ * Output:None
+ *
+ * Returns:None
+ * Others:
+ ********************************************************************************/
+VOID zDrvIODev_Show(VOID);
+
+/*******************************************************************************
+ * Function: zDrvIODev_Initiate
+ * Description:initialize the io base structure.
+ * Input:
+ * Output:None
+ *
+ * Returns:
+ DRV_SUCCESS: success.
+ DRV_ERROR: error.
+ * Others:
+ ********************************************************************************/
+SINT32 zDrvIODev_Initiate(VOID);
+
+
+
+
+#endif/*_DRVS_IO_H_*/
+
diff --git a/cp/ps/driver/inc/io/drvs_io_flashlight.h b/cp/ps/driver/inc/io/drvs_io_flashlight.h
new file mode 100644
index 0000000..6cdfc30
--- /dev/null
+++ b/cp/ps/driver/inc/io/drvs_io_flashlight.h
@@ -0,0 +1,57 @@
+/*******************************************************************************
+ * Copyright (C) 2007, ZTE Corporation.
+ *
+ * File Name: drvs_io_flashlight.h
+ * File Mark:
+ * Description:
+ * Others:
+ * Version: 1.0
+ * Author: liuyi
+ * Date: 2016-09-03
+ * History 1:
+ * Date:
+ * Version:
+ * Author:
+ * Modification:
+ * History 2:
+ ********************************************************************************/
+
+#ifndef _DRVS_IO_FLASHLIGHT_H
+#define _DRVS_IO_FLASHLIGHT_H
+
+/****************************************************************************
+* Include files
+****************************************************************************/
+#include "drvs_io.h"
+/****************************************************************************
+* Macros
+****************************************************************************/
+#define ZDRV_DEV_FLASHLIGHT "flashlight"
+/****************************************************************************
+* Types
+****************************************************************************/
+
+
+/* */
+typedef enum
+{
+ FLASHLIGHT_DISABLE,
+ FLASHLIGHT_ENABLE,
+
+ MAX_FLASHLIGHT_ENABLE
+}
+T_ZDrvFlashlight_Enable;
+
+typedef enum
+{
+ FLASHLIGHT_STATE_OFF,
+ FLASHLIGHT_STATE_ON,
+
+ MAX_FLASHLIGHT_STATE
+}
+T_ZDrvFlashlight_State;
+
+
+
+#endif/*_DRVS_IO_FLASHLIGHT_H*/
+
diff --git a/cp/ps/driver/inc/io/drvs_io_fm.h b/cp/ps/driver/inc/io/drvs_io_fm.h
new file mode 100644
index 0000000..3684b81
--- /dev/null
+++ b/cp/ps/driver/inc/io/drvs_io_fm.h
@@ -0,0 +1,65 @@
+/*******************************************************************************
+ * Copyright (C) 2007, ZTE Corporation.
+ *
+ * File Name: drvs_io_fm.h
+ * File Mark:
+ * Description:
+ * Others:
+ * Version: 1.0
+ * Author: liuyi
+ * Date: 2016-09-03
+ * History 1:
+ * Date:
+ * Version:
+ * Author:
+ * Modification:
+ * History 2:
+ ********************************************************************************/
+
+#ifndef _DRVS_IO_FM_H
+#define _DRVS_IO_FM_H
+
+/****************************************************************************
+* Include files
+****************************************************************************/
+#include "drvs_io.h"
+/****************************************************************************
+* Macros
+****************************************************************************/
+#define ZDRV_DEV_FM "fm"
+/****************************************************************************
+* Types
+****************************************************************************/
+
+
+/* stereo or mono */
+typedef enum
+{
+ MODE_STEREO,
+ MODE_MONO,
+
+ MAX_MODE
+}
+T_ZDrvFm_StereoMode;
+
+typedef struct
+{
+ SINT32 direction;
+ UINT32 ret_freq;
+}
+T_ZDrvFm_SeekInfo;
+
+
+
+/*IOCTL¿ØÖƲÙ×÷´«µÝ²ÎÊýÀàÐÍ*/
+typedef struct
+{
+ T_ZDrvFm_StereoMode TimeDate;
+ T_ZDrvFm_SeekInfo mode;
+}T_ZDrvfm_Descriptor;
+
+
+
+
+#endif/*_DRVS_IO_FM_H*/
+
diff --git a/cp/ps/driver/inc/io/drvs_io_keys.h b/cp/ps/driver/inc/io/drvs_io_keys.h
new file mode 100644
index 0000000..ef1a438
--- /dev/null
+++ b/cp/ps/driver/inc/io/drvs_io_keys.h
@@ -0,0 +1,370 @@
+/*******************************************************************************
+ * Copyright (C) 2007, ZTE Corporation.
+ *
+ * File Name: drvs_iokeys.h
+ * File Mark:
+ * Description:
+ * Others:
+ * Version: 1.0
+ * Author: geanfeng
+ * Date: 2014-02-11
+ * History 1:
+ * Date:
+ * Version:
+ * Author:
+ * Modification:
+ * History 2:
+ ********************************************************************************/
+
+#ifndef _DRVS_IOKEYS_H
+#define _DRVS_IOKEYS_H
+
+/****************************************************************************
+* Macros
+****************************************************************************/
+#define IOKEYS(x) (1)
+/****************************************************************************
+* Types
+****************************************************************************/
+/*IO CTRL Function KEY*/
+typedef enum _T_DRVIO_CTRL_KEY
+{
+// for io dal layer use
+ IOCTL_IODEV_REGISTER_NOTIFY = 2,
+ IOCTL_IODEV_GET_DEV_STATUS,
+ IOCTL_IODEV_WAIT_CONNECT,
+ IOCTL_IODEV_DISALLOW_DISCONNECT,
+ IOCTL_IODEV_ALLOW_DISCONNECT,
+ IOCTL_IODEV_VENDOR = 31,
+//end
+
+ /*ÒÔÏ¿ØÖÆ×ÖÔÚÉ豸Á¬½Óºó²ÅÓÐЧ*/
+
+// for common io device
+
+ IOCTL_IODEV_SET_BLOCKTIME = 0x1000,
+
+// for block device function
+
+ IOCTL_BLKDEV_GET_INFO=0x2000,
+ IOCTL_BLKDEV_EREASE,
+ IOCTL_BLKDEV_GET_STATE,
+
+// for serial device function
+
+ IOCTL_SERIAL_SET_CONFIG=0x3000,
+ IOCTL_SERIAL_UART_SET_CTSRTS,
+ IOCTL_SERIAL_UART_SET_CONFIG,
+
+// for virtual com port
+
+ IOCTL_VCOM_GET_USB_STATUS=0x4000,
+ IOCTL_VCOM_OPEN_ECHO,
+ IOCTL_VCOM_CLOSE_ECHO,
+
+
+// for virtual NIC(Netword Interface Card)
+
+ IOCTL_VNIC_CONNECT=0x5000,
+ IOCTL_VNIC_DISCONNECT,
+
+ IOCTL_VNIC_REG_CBK_XFER_STATISTICS,
+ IOCTL_VNIC_FREE_UNREAD_BUF,
+ IOCTL_VNIC_REG_CBK_NIC_DISABLE,
+ IOCTL_VNIC_GET_USB_STATUS,
+ IOCTL_VNIC_REG_CBK_NIC_ENABLE,
+ IOCTL_VNIC_GET_VNIC_STATE,
+ IOCTL_VNIC_SET_ECM_TPYE,
+ IOCTL_VNIC_SET_NET_DEV,
+
+// for io voice
+
+ IOCTL_VOICE_SET_SAMPLE = 0x6000, /*Set sample.param:T_ZDrvVoice_Sample*/
+ IOCTL_VOICE_SET_INPUT_PATH, /*Set input path. param:T_ZDrv_VoiceInputPath*/
+ IOCTL_VOICE_SET_OUTPUT_PATH, /*Set output path. param:T_ZDrv_VoiceOutputPath*/
+ IOCTL_VOICE_SET_INPUT_VOL, /*Set input volume. param:T_ZDrvVoice_InputVolLevel*/
+ IOCTL_VOICE_SET_OUTPUT_VOL, /*Set output volume. param:T_ZDrvVoice_OutputVolLevel*/
+ IOCTL_VOICE_ENABLE, /*enable voice channel.param:none*/
+ IOCTL_VOICE_DISABLE, /*disable voice channel.param:none*/
+
+ IOCTL_VOICE_SET_VT_START, /*Start voice for VideoTelephone. param:T_ZDrvVoice_AmrInfoPtr*/
+ IOCTL_VOICE_SET_VT_STOP, /*Stop voice for VideoTelephone. param:NULL*/
+ IOCTL_VOICE_SET_MUTE, /*Set voice mute or not. param:T_ZDrvVoice_MuteInfo*/
+ IOCTL_VOICE_RECORD_START, /*record start.param:T_ZDrvRcd_InfoParam*/
+ IOCTL_VOICE_RECORD_STOP, /*record stop.param:none*/
+ IOCTL_VOICE_RECORD_DATA_READ, /*read record data. param:T_ZDrvVoice_BufInfo*/
+ IOCTL_VOICE_TEST_LOOPBACK, /*Set voice loop or not. param:T_ZDrvVoice_Switch*/
+ IOCTL_VOICE_RCD_FREE_BUFF, /*free record buffer. param:VOID*/
+
+ IOCTL_VOICE_CONFIG_PARAM, /*config volte param .param:T_ZDrvVp_Cfg, for volte*/
+ IOCTL_VOICE_READ_START, /* volte read start .param:VOID, for volte*/
+ IOCTL_VOICE_READ_STOP, /* volte read stop .param:VOID, for volte*/
+ IOCTL_VOICE_WRITE_START, /* volte write start .param:VOID, for volte*/
+ IOCTL_VOICE_WRITE_STOP, /* volte write stop .param:VOID, for volte*/
+ IOCTL_VOICE_MODE_CONFIG,
+
+// for audio
+ IOCTL_AUDIO_RECORD_START, /* start record,param:T_ZDrvRcd_InfoParam */
+ IOCTL_AUDIO_RECORD_STOP, /* stop record,param:none */
+ IOCTL_AUDIO_SET_RECORD_PATH, /* set record input path,param:T_ZDrv_CodecInputPath */
+ IOCTL_AUDIO_SET_RECORD_VOL, /* set record volum,param:T_ZDrvAudio_InputVolLevel */
+ IOCTL_AUDIO_RCD_FREE_BUFF, /* free record buffer,param:VOID * */
+ IOCTL_AUDIO_SET_RECORD_SAMPLE, /* Set audio codec config for RECORD, SAMPLE param:T_ZDrvAudio_SampleRate */
+ IOCTL_AUDIO_SET_SAMPLE, /* Set audio codec config for PLAY, SAMPLE param:T_ZDrvAudio_SampleRate */
+ IOCTL_AUDIO_SET_BANLANCE, /* set balance,param:T_ZDrvAudio_Banlance */
+ IOCTL_AUDIO_SET_OUTPUT_PATH, /* Set OUTPUT path for play ,param:T_ZDrv_AudioOutputPath */
+ IOCTL_AUDIO_SET_OUTPUT_VOL, /* Set OUTPUT volume for play ,param:T_ZDrvAudio_OutputVolLevel */
+ IOCTL_AUDIO_SET_EQMODE, /* set EQmode,param:T_ZDrvAUDIO_EQMODE */
+ IOCTL_AUDIO_ENABLE_3DEFFECT, /* set 3deffect,param:T_ZDrvAudio_3DEFFECT */
+ IOCTL_AUDIO_SET_MUTE, /* set mute,param:BOOL */
+ IOCTL_AUDIO_PLAY_START, /* start audio play ,param:T_ZDrvAudio_PlayParam */
+ IOCTL_AUDIO_PLAY_STOP, /* stop audio play,param:none */
+ IOCTL_AUDIO_PLAY_PAUSE, /* pause audio play,param:none */
+ IOCTL_AUDIO_PLAY_RESUME, /* resume audio play ,param:none */
+ IOCTL_AUDIO_GET_PLAY_INFO, /* get the audio play info ,param:T_ZDrvAudio_PlayInfo */
+ IOCTL_AUDIO_GET_BUFFER, /* get the audio buffer ,param:T_ZDrvAudio_BufInfo */
+ IOCTL_AUDIO_SET_CALLBACK, /* set audio callback func,param:T_ZDrvAudio_CallbackFunc */
+
+//for earpiece
+ IOCTL_EARP_SET_CALLBACK , /*Set callback function, it is used to register the callback function which will send the earpiece switch status to user.*/
+ IOCTL_EARP_GET_PLUG_STATUS , /*Get earpiece plug status, replace the read function.*/
+ IOCTL_EARP_SET_HOOK_ENABLE,
+ IOCTL_EARP_SET_HOOK_DISABLE,
+
+// for io led
+ IOCTL_LED_WAN = 0x7000,
+ IOCTL_LED_LAN,
+ IOCTL_LED_SMS,
+ IOCTL_LED_BATTERY,
+ IOCTL_LED_TRAFFIC,
+ IOCTL_LED_SLEEP,
+ IOCTL_LED_LEFT_1,
+ IOCTL_LED_LEFT_2,
+ IOCTL_LED_LEFT_3,
+ IOCTL_LED_LEFT_4,
+ IOCTL_LED_1_2_ON,
+ IOCTL_LED_1_2_3_ON,
+ IOCTL_LED_ALL_ON,
+ IOCTL_LED_ALL_OFF,
+ IOCTL_LED_CTRL_MOD,
+ IOCTL_LED_LGP,
+
+// for rtc
+ IOCTL_PMIC_RTC_SET_TIME = 0x8000,
+ IOCTL_PMIC_RTC_GET_TIME,
+ IOCTL_PMIC_RTC_SET_ALARM,
+ IOCTL_PMIC_RTC_GET_ALARM,
+ IOCTL_PMIC_RTC_ENABLE_ALARM,
+ IOCTL_PMIC_RTC_ENABLE_CYCLE,
+ IOCTL_PMIC_RTC_REGIS_CYCLE_NOTIFY,
+ IOCTL_PMIC_RTC_REGIS_ALARM_NOTIFY,
+ IOCTL_PMIC_RTC_ENABLE_TIMER, //Éètimerʱ¼ä, 0¹Ø±Õ
+ IOCTL_PMIC_RTC_REGIS_TIMER_NOTIFY, //Éètimerʱ¼ä»Øµ÷º¯Êý
+ IOCTL_PMIC_RTC_GET_TIMER_REMAIN, //»ñÈ¡timerÊ£Óàʱ¼ä
+ IOCTL_PMIC_RTC_CYCLE_INT_SEL,
+
+
+//for charger
+ IOCTL_CHARGER_SET_CALLBACK = 0x9000,
+ IOCTL_CHARGER_GET_VOLTAGE,
+ IOCTL_CHARGER_GET_CHG_STATUS,
+ IOCTL_CHARGER_GET_DISCHG_STATUS,
+ IOCTL_CHARGER_TEMP_DETECT,
+ IOCTL_CHARGER_CHG_SWITCH,
+ IOCTL_CHARGER_DISCHG_SWITCH,
+ IOCTL_CHARGER_QUICK_START_FLAG,
+ IOCTL_CHARGER_GET_CHGTYPE,
+ IOCTL_CHARGER_BOOST_ON,
+ IOCTL_CHARGER_RELEASE_BUTTON,
+ IOCTL_CHARGER_GET_ELECQUAN,
+ IOCTL_CHARGER_DEBUG,
+
+
+ IOCTL_CHARGER_SET_OTG,
+ IOCTL_CHARGER_SET_SHIPPING_MODE,
+ IOCTL_CHARGER_GET_ERROR_CODE,
+ IOCTL_CHARGER_SET_STOP_CURRENT,
+ IOCTL_CHARGER_GET_STOP_REASON,
+ IOCTL_CHARGER_GET_USB_STATUS,
+
+//for LCD
+ IOCTL_LCD_UPDATE = 0xA000,
+ IOCTL_LCD_SLEEP,
+ IOCTL_LCD_BACKLIGHT,
+ IOCTL_LCD_BRIGHTNESS,
+ IOCTL_LCD_GET_INFO,
+ IOCTL_LCD_VOU_WBUPDATE,
+//for spi
+ IOCTL_SSP_SET_XFER_WIDTH,
+ IOCTL_SSP_SET_CHG_FREQ,
+ IOCTL_SSP_SET_MSMODE,
+ IOCTL_SSP_SET_TXTHES,
+ IOCTL_SSP_SET_RXTHES,
+
+//for FM
+ IOCTL_FM_SET_OUTPATH = 0xB000,
+ IOCTL_FM_SET_VOL,
+ IOCTL_FM_SET_SOUNDMODE,
+ IOCTL_FM_SET_FREQ,
+ IOCTL_FM_SET_SCANNEXT,
+ IOCTL_FM_GET_CURFREQ,
+ IOCTL_FM_GET_CURVOL,
+
+//for VIB
+ IOCTL_VIB_ENABLE = 0xC000,
+ IOCTL_VIB_CHECKSTA,
+
+/* for Keypad */
+ IOCTL_KPD_SET_BLG_ON = 0xD000,
+ IOCTL_KPD_SET_BLG_OFF,
+ IOCTL_KPD_SET_BLG_BRIGHTNESS,
+ IOCTL_KPD_GET_BLG_STATUS,
+ IOCTL_KPD_GET_KEYS_STATUS,
+ IOCTL_KPD_GET_HEADPHONE_STATE,
+
+//for FLASHLIGHT
+ IOCTL_FLASHLIGHT_ENABLE = 0xF000,
+ IOCTL_FLASHLIGHT_CHECKSTA,
+//for CAMERA
+ IOCTL_CAM_SENSOR_GET_INFO = 0x10000,
+ IOCTL_CAM_SENSOR_SELECT,
+ IOCTL_CAM_SET_ZOOM,
+ IOCTL_CAM_SET_IMG_SIZE,
+ IOCTL_CAM_SET_EFFECT,
+ IOCTL_CAM_SET_MIRRORFLIP,
+ IOCTL_CAM_SET_BRIGHTNESS,
+ IOCTL_CAM_SET_CONTRAST,
+ IOCTL_CAM_SET_SATURATION,
+ IOCTL_CAM_SET_WHITE_BALANCE,
+ IOCTL_CAM_SET_LIGHTMODE,
+ IOCTL_CAM_SET_NIGHTMODE,
+ IOCTL_CAM_SET_FRAMERATE,
+ IOCTL_CAM_GET_ONEFRAME,
+ IOCTL_CAM_FREE_FRAME_BUFFER,
+// IOCTL_CAM_SET_EXPOSURE_COMPENSATION,
+ IOCTL_CAM_SET_ANTIFLICKER,
+ IOCTL_CAM_START,
+ IOCTL_CAM_STOP,
+ IOCTL_UNDEFINE=0x7FFFFFFF
+
+} T_DRVIO_CTRL_KEY;
+
+//===================IO DEV===============
+
+#if IOKEYS(IOCTL_VNIC_GET_VNIC_STATE)
+/*VNIC State*/
+typedef enum _T_DRVIO_VNIC_STATE
+{
+ DRVIO_VNIC_DISABLE = 0x0, //½ûÓÃ״̬
+ DRVIO_VNIC_READY = 0x1, //δÁ¬½Ó£¬¿É²¦ºÅ
+ DRVIO_VNIC_CONNECT = 0x2, //ÒÑÁ¬½Ó
+ DRVIO_VNIC_ERR = 0xff, //Ò쳣״̬
+}
+T_DRVIO_VNIC_STATE;
+#endif
+
+#if IOKEYS(IOCTL_IODEV_GET_DEV_STATUS)
+/*Device Status*/
+typedef struct _T_DRVIO_DEV_STATUS
+{
+ UINT32 CONNECT: 1;
+ UINT32 reserved:31;
+}
+T_DRVIO_DEV_STATUS;
+#endif
+
+#if IOKEYS(IOCTL_IODEV_REGISTER_NOTIFY)
+/*Global Event*/
+typedef enum _T_DRVIO_EVENT
+{
+ DRVIO_EV_CONNECT = 2,
+ DRVIO_EV_PRE_DISCONNECT,
+ DRVIO_EV_DISCONNECT,
+} T_DRVIO_EVENT;
+
+/*Device Notify*/
+typedef struct _T_ZDrvIO_DevNotify
+{
+ VOID ( *notify_fn )(VOID *privData, T_DRVIO_EVENT event);
+ VOID *privData;
+}
+T_ZDrvIO_DevNotify;
+#endif
+
+//===================block device===============
+
+#if IOKEYS(IOCTL_BLKDEV_GET_INFO)
+typedef struct _T_BlkDev_Info
+{
+ UINT32 blkSize;
+ UINT32 blkCnt;
+}T_BlkDev_Info;
+#endif
+
+
+#if IOKEYS(IOCTL_BLKDEV_EREASE)
+typedef struct _T_BlkDev_EraseInfo
+{
+ UINT32 startBlk;
+ UINT32 blkCnt;
+}T_BlkDev_EraseInfo;
+#endif
+
+
+#if IOKEYS(IOCTL_SERIAL_SET_CONFIG)
+typedef struct _T_UartDev_ConfigInfo
+{
+ UINT8 dataBits;
+ UINT8 stopBits;
+ UINT8 parity;
+ UINT32 baudrate;
+}T_UartDev_ConfigInfo;
+#endif
+
+
+
+typedef union
+{
+ UINT8 nodeInBytes[8];
+ struct
+ {
+ UINT8* pNodeBuf;
+ UINT32 uiNodeBufLen;
+ }
+ node;
+}
+T_ZDrv_BufNode;
+
+typedef T_ZDrv_BufNode T_ZDrvVcom_BufNode;
+
+typedef unsigned long long UINT64;
+
+#if IOKEYS(IOCTL_VNIC_REG_CBK_XFER_STATISTICS)
+typedef struct _T_ZDrvVnic_XferStatistics
+{
+ UINT64 TxOkCnt;
+ UINT64 RxOkCnt;
+ UINT64 TxErrCnt;
+ UINT64 RxErrCnt;
+ UINT64 TxOverFlowCnt;
+ UINT64 RxOverFlowCnt;
+}
+T_ZDrvVnic_XferStatistics;
+
+typedef T_ZDrvVnic_XferStatistics* (* VnicCbk_XferStatistics) (VOID);
+#endif
+
+
+#if IOKEYS(IOCTL_VNIC_REG_CBK_NIC_DISABLE)
+typedef VOID (* VnicCbk_Disable) (VOID*privData);
+#endif
+
+
+#if IOKEYS(IOCTL_VNIC_REG_CBK_NIC_ENABLE)
+typedef VOID (* VnicCbk_Enable) (VOID*privData);
+#endif
+
+//typedef UINT32 (* VnicCbk_GetSpeed) (VOID);
+
+#endif/*_DRVS_IOKEYS_H*/
+
diff --git a/cp/ps/driver/inc/io/drvs_io_kpd.h b/cp/ps/driver/inc/io/drvs_io_kpd.h
new file mode 100644
index 0000000..a711853
--- /dev/null
+++ b/cp/ps/driver/inc/io/drvs_io_kpd.h
@@ -0,0 +1,134 @@
+/*******************************************************************************
+ * Copyright (C) 2014, ZTE Corporation.
+ *
+ * File Name: drvs_io_kpd.h
+ * File Mark:
+ * Description:
+ * Others:
+ * Version: 1.0
+ * Author: yuxiang
+ * Date: 2014-07-11
+ * History 1:
+ * Date:
+ * Version:
+ * Author:
+ * Modification:
+ * History 2:
+ ********************************************************************************/
+
+#ifndef _DRVS_IO_KPD_H
+#define _DRVS_IO_KPD_H
+
+/****************************************************************************
+* Include files
+****************************************************************************/
+#include "drvs_io.h"
+
+/****************************************************************************
+* Macros
+****************************************************************************/
+#define ZDRV_DEV_KPD "kpd"
+
+/****************************************************************************
+* Types
+****************************************************************************/
+
+/* tianbao zhou 20171122 */
+typedef enum
+{
+ KPD_VK_NULL,
+
+ KPD_VK_1, /* number 1 */
+ KPD_VK_2, /* number 2 */
+ KPD_VK_3, /* number 3 */
+ KPD_VK_4, /* number 4 */
+ KPD_VK_5, /* number 5 */
+ KPD_VK_6, /* number 6 */
+ KPD_VK_7, /* number 7 */
+ KPD_VK_8, /* number 8 */
+ KPD_VK_9, /* number 9 */
+ KPD_VK_0, /* number 0 */
+ KPD_VK_STAR, /* 11: key * */
+ KPD_VK_HASH, /* 12: key # */
+
+ KPD_VK_NV_UP, /* 13: key up */
+ KPD_VK_NV_DOWN, /* 14: key down */
+ KPD_VK_NV_LEFT, /* 15: key left */
+ KPD_VK_NV_RIGHT, /* 16: key right */
+ KPD_VK_NV_CENTER, /* 17: key ok */
+ KPD_VK_SOFT_LEFT, /* 18: left soft */
+ KPD_VK_SOFT_RIGHT, /* 19: right soft */
+ KPD_VK_CALL, /* 20: call key */
+
+ /* Use only KPD_VK_POWER if a key is both KPD_VK_CANCEL and KPD_VK_POWER */
+ KPD_VK_CANCEL, /* cancel key. */
+ KPD_VK_POWER, /* 22: power key. */
+
+ KPD_VK_SOFT_1, /* 23: soft key 1 for additional functional key */
+ KPD_VK_SOFT_2, /* 24: soft key 2 for additional functional key */
+ KPD_VK_SOFT_3, /* 25: soft key 3 for additional functional key */
+ KPD_VK_SOFT_4, /* 26: soft key 4 for additional functional key */
+
+ KPD_VK_SIDE_UP, /* 27: up key on the side */
+ KPD_VK_SIDE_DOWN, /* 28: down key on the side */
+ KPD_VK_WEB, /* 29: web key */
+ KPD_VK_CAMERA, /* 30: camera key */
+ KPD_VK_FLIP, /* 31: flip key */
+
+ KPD_VK_SHORTCUT1, /* 32: */
+ KPD_VK_SHORTCUT2,
+ KPD_VK_SHORTCUT3,
+ KPD_VK_SHORTCUT4,
+ KPD_VK_SHORTCUT5,
+ KPD_VK_SHORTCUT6,
+ KPD_VK_VOLUME, /* 38: ÒôÁ¿µ÷½Ú½çÃæ¿ì½Ý¼ü */
+ KPD_VK_SETTING, /* 39: ¿ì½ÝÉèÖà */
+ KPD_VK_WEATHERPORT, /* 40: ÌìÆøÔ¤±¨ */
+ KPD_VK_MESSAGE, /* 41: ¶ÌÐÅ */
+ KPD_VK_12580, /* 42: */
+ KPD_VK_SOS, /* 43: */
+ KPD_VK_REDIAL, /* 44: ÖØ²¥ */
+ KPD_VK_HEADFREE, /* 45: ÃâÌá¼ü */
+ KPD_VK_HEADSET, /* 46: Õª»ú »ò ¹Ò»ú */
+ KPD_VK_HEADSETUP, /* 47: ͻȜ */
+ KPD_VK_HEADSETDOWN, /* 48: ¹Ò»ú */
+
+ KPD_VK_WIFI,
+ KPD_VK_RESET,
+ KPD_VK_WPS,
+
+ KPD_VK_NUM /* 52 */
+} T_ZDrvKpd_VirtualKey;
+
+/* key state */
+typedef enum
+{
+ KEY_RELEASED, /* key has been released */
+ KEY_PRESSED, /* key has been pressed */
+
+ MAX_KEY_STATE
+} T_ZDrvKpd_KeyState;
+
+typedef struct
+{
+ T_ZDrvKpd_VirtualKey key; /* key code */
+ T_ZDrvKpd_KeyState state; /* key state */
+ UINT8 times; /* scaned times when pressed, and by this can get the de pressed
+ * time equal to times x scan interval( 100ms ) */
+} T_ZDrvKpd_KeyItem;
+
+#if IOKEYS(IOCTL_KPD_SET_BLG_BRIGHTNESS) || IOKEYS(IOCTL_KPD_GET_BLG_STATUS)
+typedef UINT8 T_ZDrvKpd_BlgBrightness; /* 0~255 */
+#endif
+
+#if IOKEYS(IOCTL_KPD_GET_BLG_STATUS)
+typedef struct
+{
+ UINT8 isBlgOn;
+ T_ZDrvKpd_BlgBrightness brightness;
+} T_ZDrvKpd_BlgStatus;
+#endif
+
+
+#endif/*_DRVS_IO_KPD_H*/
+
diff --git a/cp/ps/driver/inc/io/drvs_io_lcd.h b/cp/ps/driver/inc/io/drvs_io_lcd.h
new file mode 100644
index 0000000..7973e22
--- /dev/null
+++ b/cp/ps/driver/inc/io/drvs_io_lcd.h
@@ -0,0 +1,135 @@
+/***********************************************************************
+* Copyright (C) 2014, ZTE Corporation.
+*
+* File Name: drvs_io_lcd.h
+* File Mark:
+* Description: lcd define.
+* Others:
+* Version: 1.0
+* Author: YinWenguan
+* Date: 2014-11-11
+*
+* History 1:
+* Date:
+* Version:
+* Author:
+* Modification:
+
+* History 2:
+**********************************************************************/
+
+#ifndef _DRVS_IO_LCD_H_
+#define _DRVS_IO_LCD_H_
+#include "drvs_vou.h"
+#include "drvs_vou_ref.h"
+
+/*************************************************************************
+ * Include files *
+ *************************************************************************/
+
+
+/*************************************************************************
+ * Macro *
+ *************************************************************************/
+
+/**************************************************************************
+ * Types *
+ **************************************************************************/
+typedef enum
+{
+ LCD_DCX_CMD = 0, // µÍµçƽÃüÁî
+ LCD_DCX_DATA, // ¸ßµçƽ²ÎÊý»òÊý¾Ý
+
+ MAX_LCD_DCX_TYPE
+} T_ZDrvLcd_DcxType; // transmission byte type
+
+typedef enum
+{
+ LCD_XFER_POLL = 0, // ÂÖѯ·½Ê½
+ LCD_XFER_INT, // ÖжϷ½Ê½
+ LCD_XFER_DMA, // DMA·½Ê½
+ LCD_XFER_CPU,
+
+ MAX_LCD_XFER_TYPE
+} T_ZDrvLcd_XferType;
+
+/* lcd mode */
+typedef enum
+{
+ LCD_NORMAL, /* normal mode */
+ LCD_SLEEP, /* sleep mode */
+
+ MAX_LCD_MODE
+} T_ZDrvLcd_Mode;
+
+/* lcd instance */
+typedef struct
+{
+ BOOL bOpen; /* status: open, close */
+ T_ZDrvLcd_Mode eMode; /* working mode: normal, sleep */
+ T_ZDrvLcd_XferType eXferType; /* poll, interrupt or DMA */
+ T_ZDrvLcd_DcxType eDcxType; /* command or parameter/data */
+ ZOSS_MUTEX_ID mutexUpdate; /* mutex for updating rectangle */
+ ZOSS_SEMAPHORE_ID semDmaInt; /* semaphore for DMA transimision */
+} T_ZDrvLcd_Instance;
+
+#if IOKEYS(IOCTL_LCD_UPDATE)
+typedef struct
+{
+ UINT16 uiLeft;
+ UINT16 uiTop;
+ UINT16 uiWidth;
+ UINT16 uiHeight;
+ UINT8* pBuf;
+} T_ZDrvLcd_DisplayParam;
+#endif
+
+#if IOKEYS(IOCTL_LCD_SLEEP)
+typedef enum
+{
+ LCD_SLEEP_OUT = 0,
+ LCD_SLEEP_IN,
+
+} T_ZDrvLcd_SleepStatus;
+#endif
+
+#if IOKEYS(IOCTL_LCD_BACKLIGHT)
+typedef enum
+{
+ LCD_BACKLIGHT_OFF = 0,
+ LCD_BACKLIGHT_ON,
+
+} T_ZDrvLcd_BacklightStatus;
+#endif
+
+#if IOKEYS(IOCTL_LCD_BRIGHTNESS)
+typedef unsigned int T_ZDrvLcd_Brightness; /* [0, 255]: 0 - darkest; 255 - brightest */
+#endif
+
+#if IOKEYS(IOCTL_LCD_GET_INFO)
+typedef struct
+{
+ UINT16 width;
+ UINT16 height;
+ UINT16 bitsPerPixel;
+ UINT16 rMask;
+ UINT16 gMask;
+ UINT16 bMask;
+ UINT16 lcd_pow_st;
+ UINT16 lcd_pix_st;
+ T_ZDrvLcd_Instance instance;
+ T_ZDrvLcd_BacklightStatus backlight;
+ T_ZDrvLcd_Brightness brightness;
+
+} T_ZDrvLcd_Info;
+
+typedef struct
+{
+ T_ZDrv_OSDInfo *OSD_Info;
+ T_ZDrvLcd_Info *Lcd_Info;
+
+}T_ZDrv_LCDVOUInfo;
+
+#endif
+
+#endif
diff --git a/cp/ps/driver/inc/io/drvs_io_led.h b/cp/ps/driver/inc/io/drvs_io_led.h
new file mode 100644
index 0000000..5529ece
--- /dev/null
+++ b/cp/ps/driver/inc/io/drvs_io_led.h
@@ -0,0 +1,163 @@
+/*******************************************************************************
+ * Copyright (C) 2007, ZTE Corporation.
+ *
+ * File Name: drvs_io_led.h
+ * File Mark:
+ * Description:
+ * Others:
+ * Version: 1.0
+ * Author: yuxiang
+ * Date: 2014-07-03
+ * History 1:
+ * Date:
+ * Version:
+ * Author:
+ * Modification:
+ * History 2:
+ ********************************************************************************/
+
+#ifndef _DRVS_IO_LED_H
+#define _DRVS_IO_LED_H
+
+/****************************************************************************
+* Include files
+****************************************************************************/
+#include "drvs_io.h"
+/****************************************************************************
+* Macros
+****************************************************************************/
+#define ZDRV_DEV_LED "led"
+/****************************************************************************
+* Types
+****************************************************************************/
+typedef enum {
+ LED_BRIGHTNESS_0 = 0,
+ LED_BRIGHTNESS_1 , /* 0000 - 10mA */
+ LED_BRIGHTNESS_2 , /* 0001 - 15mA */
+ LED_BRIGHTNESS_3 , /* 0010 - 20mA */
+ LED_BRIGHTNESS_4 , /* 30mA */
+ LED_BRIGHTNESS_5 , /* 40mA */
+ LED_BRIGHTNESS_6 , /* 50mA */
+ LED_BRIGHTNESS_7 , /* 60mA */
+ LED_BRIGHTNESS_8 , /* 70mA */
+ LED_BRIGHTNESS_9 , /* 80mA */
+ LED_BRIGHTNESS_10 , /* 90mA */
+ LED_BRIGHTNESS_11 , /* 100mA */
+ LED_BRIGHTNESS_12 , /* 110mA */
+ LED_BRIGHTNESS_13 , /* 1100 - 120mA */
+ LED_BRIGHTNESS_14 , /* 1101 - 120mA */
+ LED_BRIGHTNESS_15 , /* 1110 - 120mA */
+ LED_BRIGHTNESS_16 , /* 1111 - 120mA */
+ LED_BRIGHTNESS_MAX,
+}T_ZDrvLed_Brightness;
+
+#define LED_RED_ON (1<<0)
+#define LED_GREEN_ON (1<<1)
+#define LED_BLUE_ON (1<<2)
+typedef enum
+{
+ LED_COLOR_RED =LED_RED_ON,
+ LED_COLOR_GREEN =LED_GREEN_ON,
+ LED_COLOR_BLUE =LED_BLUE_ON,
+ LED_COLOR_YELLOW=LED_RED_ON | LED_GREEN_ON,
+ LED_COLOR_PURPLE=LED_RED_ON | LED_BLUE_ON,
+ LED_COLOR_CYAN =LED_GREEN_ON | LED_BLUE_ON,
+ LED_COLOR_WHITE =LED_RED_ON |LED_GREEN_ON | LED_BLUE_ON,
+ //LED_COLOR_BLACK,
+ LED_COLOR_MAX,
+}T_ZDrvLed_Color;
+
+typedef enum
+{
+ LED_STATE_OFF = 0,
+ LED_STATE_ON ,
+ //LED_STATE_BLINK_OFF,
+ //LED_STATE_BLINK_ON,
+ LED_STATE_BLINK,
+ LED_STATE_MAX,
+}T_ZDrvLed_State;
+
+typedef enum
+{
+ LED_TRAFFIC_10 = 0,
+ LED_TRAFFIC_20 ,
+ LED_TRAFFIC_30,
+ LED_TRAFFIC_40,
+ LED_TRAFFIC_50,
+ LED_TRAFFIC_60,
+ LED_TRAFFIC_70,
+ LED_TRAFFIC_80,
+ LED_TRAFFIC_90,
+ LED_TRAFFIC_100,
+ LED_TRAFFIC_MAX,
+}T_ZDrvLed_Traffic;
+
+typedef enum
+{
+ LED_SLEEP_ENTER = 0,
+ LED_SLEEP_EXIT,
+ LED_SLEEP_MAX,
+
+}T_ZDrvLed_Sleep;
+
+typedef enum
+{
+ LED_DEVICE_NAME_WAN = 0,
+ LED_DEVICE_NAME_LAN,
+ LED_DEVICE_NAME_SMS,
+ LED_DEVICE_NAME_BATTERY,
+ LED_DEVICE_NAME_TRAFFIC,
+ LED_DEVICE_LEFT_1,
+ LED_DEVICE_LEFT_2,
+ LED_DEVICE_LEFT_3,
+ LED_DEVICE_LEFT_4,
+ LED_DEVICE_NAME_LGP,
+
+ LED_DEVICE_NAME_SLEEP,
+ LED_DEVICE_NAME_MAX,
+}T_ZDrvLed_DevName;
+
+typedef struct
+{
+ UINT32 uBlinkOnTime;
+ UINT32 uBlinkOffTime;
+}T_ZDrvLed_Blink;
+
+/*define for led ctrl mod by mcu or hardware 0x01 BLED_REG*/
+
+typedef enum
+{
+ LED_HW_CTRL = 0,
+ LED_MCU_CTRL,
+
+ LED_MAX_CTRL,
+}T_ZDrvLed_CtrlMod;
+
+
+/*IOCTL¿ØÖƲÙ×÷´«µÝ²ÎÊýÀàÐÍ*/
+typedef struct
+{
+ //T_ZDrvLed_DevName uDeviceName;
+ T_ZDrvLed_Brightness uBrightness;
+ T_ZDrvLed_Color uColor;
+ T_ZDrvLed_State uState;
+ T_ZDrvLed_Traffic uTraffic;
+ T_ZDrvLed_Sleep uSleep;
+ T_ZDrvLed_Blink ledBlink;
+ T_ZDrvLed_CtrlMod ledCtrlMod;
+}T_ZDrvLed_Descriptor;
+
+#if 0
+/*ÓÃÓÚ»ñÈ¡É豸ÐÅÏ¢*/
+typedef struct
+{
+ T_ZDrvLed_DevName ledName;
+ T_ZDrvLed_State ledState ;
+ T_ZDrvLed_Color ledColor ;
+ T_ZDrvLed_Brightness ledBrightNess;
+
+}T_LED_INFO;
+#endif
+
+#endif/*_DRVS_IO_LED_H*/
+
diff --git a/cp/ps/driver/inc/io/drvs_io_names.h b/cp/ps/driver/inc/io/drvs_io_names.h
new file mode 100644
index 0000000..fe6812a
--- /dev/null
+++ b/cp/ps/driver/inc/io/drvs_io_names.h
@@ -0,0 +1,125 @@
+/*******************************************************************************
+ * Copyright (C) 2007, ZTE Corporation.
+ *
+ * File Name:
+ * File Mark:
+ * Description:
+ * Others:
+ * Version: 1.0
+ * Author: geanfeng
+ * Date: 2014-07-23
+ * History 1:
+ * Date:
+ * Version:
+ * Author:
+ * Modification:
+ * History 2:
+ ********************************************************************************/
+
+#ifndef _DRVS_IO_NAMES_H_
+#define _DRVS_IO_NAMES_H_
+
+/****************************************************************************
+* Include files
+****************************************************************************/
+
+/****************************************************************************
+* Macros
+****************************************************************************/
+#define ZDRV_DEV_USBSIO_NAME "usbsio/%d"
+#define ZDRV_DEV_USBSIO_0 "usbsio/0"
+#define ZDRV_DEV_USBSIO_1 "usbsio/1"
+#define ZDRV_DEV_USBSIO_2 "usbsio/2"
+#define ZDRV_DEV_USBSIO_3 "usbsio/3"
+
+
+/*names of virtual serial port */
+#define ZDRV_DEV_VCOM_AT "USB-AT"
+#define ZDRV_DEV_VCOM_AT_02 "USB-AT2"
+#define ZDRV_DEV_VCOM_UPDATE "USB-UPDATE"
+#define ZDRV_DEV_VCOM_MODEM "USB-MODEM"
+#define ZDRV_DEV_VCOM_LOG "USB-LOG"
+#define ZDRV_DEV_VCOM_ADB "USB-ADB"
+#define ZDRV_DEV_VCOM_SOUND "USB-SOUND"
+#define ZDRV_DEV_VCOM_MUX "USB-MUX" //this port is used for mux!
+
+#define ZDRV_DEV_VCOM_AMT "USB-AMT" //For amt version
+
+/*names of virtual NIC */
+#define ZDRV_DEV_VNIC1 "USB-VNIC"
+#define ZDRV_DEV_VNIC2 "USB-VNIC2"
+#define ZDRV_DEV_VNIC3 "USB-VNIC3"
+#define ZDRV_DEV_VNIC4 "USB-VNIC4"
+#define ZDRV_DEV_VNIC5 "USB-VNIC5"
+#define ZDRV_DEV_VNIC6 "USB-VNIC6"
+#define ZDRV_DEV_VNIC7 "USB-VNIC7"
+
+
+/*names of uart device */
+
+#define ZDRV_DEV_UART_NAME "uart/%d"
+#define ZDRV_DEV_UART_0 "uart/0"
+#define ZDRV_DEV_UART_1 "uart/1"
+#define ZDRV_DEV_UART_BT "uart/2"
+
+
+//MUX COM PORT
+#define ZDRV_DEV_VCOM_DLC1 "mux/dlc1"
+#define ZDRV_DEV_VCOM_DLC2 "mux/dlc2"
+#define ZDRV_DEV_VCOM_DLC3 "mux/dlc3"
+#define ZDRV_DEV_VCOM_DLC4 "mux/dlc4"
+#define ZDRV_DEV_VCOM_DLC5 "mux/dlc5"
+#define ZDRV_DEV_VCOM_DLC6 "mux/dlc6"
+#define ZDRV_DEV_VCOM_DLC7 "mux/dlc7"
+#define ZDRV_DEV_VCOM_DLC8 "mux/dlc8"
+#define ZDRV_DEV_VCOM_DLC9 "mux/dlc9"
+#define ZDRV_DEV_VCOM_DLC10 "mux/dlc10"
+#define ZDRV_DEV_VCOM_DLC11 "mux/dlc11"
+#define ZDRV_DEV_VCOM_DLC12 "mux/dlc12"
+#define ZDRV_DEV_VCOM_DLC13 "mux/dlc13"
+#define ZDRV_DEV_VCOM_DLC14 "mux/dlc14"
+#define ZDRV_DEV_VCOM_DLC15 "mux/dlc15"
+#define ZDRV_DEV_VCOM_DLC16 "mux/dlc16"
+#define ZDRV_DEV_VCOM_DLC17 "mux/dlc17"
+#define ZDRV_DEV_VCOM_DLC18 "mux/dlc18"
+
+//SD define
+#define ZDRV_DEV_SD0 "sd0"
+#define ZDRV_DEV_SD0P1 "sd0p1"
+#define ZDRV_DEV_SD0P2 "sd0p2"
+
+#define ZDRV_DEV_SD1 "sd1"
+#define ZDRV_DEV_SD1P1 "sd1p1"
+#define ZDRV_DEV_SD1P2 "sd1p2"
+
+//CDROM define
+#define ZDRV_DEV_CDROM "cdrom"
+
+
+//EMMC define
+#define ZDRV_DEV_EMMC_FS "MMCuserdata"
+
+//LCD define
+#define ZDRV_DEV_LCD "lcd"
+//CAMERA define
+#define ZDRV_DEV_CAMERA1 "camera1"
+
+
+/****************************************************************************
+* Types
+****************************************************************************/
+
+/****************************************************************************
+* Constants
+****************************************************************************/
+
+/****************************************************************************
+* Global Variables
+****************************************************************************/
+
+/****************************************************************************
+* Function Prototypes
+****************************************************************************/
+
+#endif/*_DRVS_IO_NAMES_H_*/
+
diff --git a/cp/ps/driver/inc/io/drvs_io_rtc.h b/cp/ps/driver/inc/io/drvs_io_rtc.h
new file mode 100644
index 0000000..59de596
--- /dev/null
+++ b/cp/ps/driver/inc/io/drvs_io_rtc.h
@@ -0,0 +1,97 @@
+/*******************************************************************************
+ * Copyright (C) 2007, ZTE Corporation.
+ *
+ * File Name: drvs_io_led.h
+ * File Mark:
+ * Description:
+ * Others:
+ * Version: 1.0
+ * Author: yuxiang
+ * Date: 2014-07-03
+ * History 1:
+ * Date:
+ * Version:
+ * Author:
+ * Modification:
+ * History 2:
+ ********************************************************************************/
+
+#ifndef _DRVS_IO_RTC_H
+#define _DRVS_IO_RTC_H
+
+/****************************************************************************
+* Include files
+****************************************************************************/
+#include "drvs_io.h"
+/****************************************************************************
+* Macros
+****************************************************************************/
+#define ZDRV_DEV_RTC "rtc"
+/****************************************************************************
+* Types
+****************************************************************************/
+
+
+typedef struct
+{
+ BOOL mode_12_hour; /* TRUE->12 hour mode ; FALSE-> 24 hour mode */
+ BOOL PM_flag; /* if 12 hour flag = TRUE TRUE->PM ; FALSE->AM */
+ UINT8 second; /* seconds after the minute - [0,59] */
+ UINT8 minute; /* minutes after the hour - [0,59] */
+ UINT8 hour; /* hours after the midnight - [0,23] */
+ UINT8 day; /* day of the month - [1,31] */
+ UINT8 month; /* months - [01,12] */
+ UINT8 wday; /* days in a week - [1,7] */
+ UINT16 year; /* years - [0000,9999] */
+} T_ZDrvRtc_TimeDate;
+
+
+typedef enum
+{
+ RTC_IRQ_SEC_INT, /*second interrupt */
+ RTC_IRQ_MIN_INT, /* minute interrupt */
+ RTC_IRQ_HOUR_INT, /* hour interrupt */
+ RTC_IRQ_DAY_INT, /* day interrupt */
+
+ RTC_IRQ_INT_MAX
+} T_ZDrvRtc_EventInt;
+
+typedef enum
+{
+ RTC_INT_DISABLE,
+ RTC_INT_ENABLE,
+
+ MAX_RTC_INT_SETUP
+}T_ZDrvRtc_IntSetup;
+
+typedef enum
+{
+ ALARM_POWER_OFF,
+ ALARM_POWER_ON,
+
+ MAX_ALARM_POWER
+} T_ZDrvRtc_AlarmPower;
+
+typedef VOID (*zDrvRtc_AlarmCallbackFunc)(VOID);
+typedef VOID (*zDrvRtc_CycleCallbackFunc)(T_ZDrvRtc_EventInt);
+
+
+/*IOCTL¿ØÖƲÙ×÷´«µÝ²ÎÊýÀàÐÍ*/
+typedef struct
+{
+ T_ZDrvRtc_TimeDate TimeDate;
+ T_ZDrvRtc_AlarmPower AlarmEnable;
+ T_ZDrvRtc_IntSetup IntEnable;
+ zDrvRtc_CycleCallbackFunc CycleCallback;
+ zDrvRtc_AlarmCallbackFunc AlarmCallback;
+}T_ZDrvRtc_Descriptor;
+
+
+
+/*¶Ôƽ̨µ¥¶ÀÌṩµÄ¶ÁÈ¡ÓëÉèÖÃʱ¼äÈÕÆÚµÄ½Ó¿Ú*/
+SINT32 Rtc_GetDateTime(T_ZDrvRtc_TimeDate * pDateTime);
+SINT32 Rtc_SetDateTime(T_ZDrvRtc_TimeDate * pDateTime);
+
+
+#endif/*_DRVS_IO_LED_H*/
+
diff --git a/cp/ps/driver/inc/io/drvs_io_sio.h b/cp/ps/driver/inc/io/drvs_io_sio.h
new file mode 100644
index 0000000..8912b78
--- /dev/null
+++ b/cp/ps/driver/inc/io/drvs_io_sio.h
@@ -0,0 +1,138 @@
+/***********************************************************************
+* Copyright (C) 2001, ZTE Corporation.
+*
+* File Name: drvs_io_sio.h
+* File Mark:
+* Description: sio define.
+* Others:
+* Version: 1.4.9
+* Author: wangxia
+* Date: 2010-04-2
+*
+* History 1:
+* Date:
+* Version:
+* Author:
+* Modification:
+
+* History 2:
+**********************************************************************/
+#include "drvs_io_keys.h"
+#ifndef _DRVS_SIO_H_
+#define _DRVS_SIO_H_
+
+/*************************************************************************
+ * Include files *
+ *************************************************************************/
+
+
+/*************************************************************************
+ * Macro *
+ *************************************************************************/
+
+/**************************************************************************
+ * Types *
+ **************************************************************************/
+
+typedef struct _T_ZDrvSio_DataConfig
+{
+ UINT32 baudrate;
+ UINT32 flowControl;
+ UINT8 dataBits;
+ UINT8 stopBits;
+ UINT8 parity;
+ UINT8 workMode;
+}T_ZDrvSio_DataConfig;
+
+
+typedef enum
+{
+ ZDRV_DEV_UART_FCTL_OFF,
+ ZDRV_DEV_UART_FCTL_SW,
+ ZDRV_DEV_UART_FCTL_HW
+}T_ZDrvSio_UartFlowCtrl_Types;
+
+typedef enum
+{
+ ZDRV_DEV_UART_PARITY_EVEN,
+ ZDRV_DEV_UART_PARITY_ODD,
+ ZDRV_DEV_UART_PARITY_NULL
+}T_ZDrvSio_UartParity_Types;
+
+typedef enum
+{
+ ZDRV_DEV_UART_MODE_CPU,
+ ZDRV_DEV_UART_MODE_DMA,
+ ZDRV_DEV_UART_MODE_NULL
+}T_ZDrvSio_UartWorkMode_Types;
+
+/*sio ioctl command*/
+typedef enum
+{
+ IOCTL_SIO_SET_DATA, /*set data config command,set baudrate.param:T_ZDrvSio_DataConfig*/
+ IOCTL_SIO_SET_BUFFER, /*set data buffer command,param:T_ZDrvSio_SetConfig */
+ IOCTL_SIO_CLEAN_BLOCK, /*clean the sio block read*/
+ IOCTL_SIO_CALLBACK, /*set sio non block callback function.param:T_ZDrvSio_Read_CallBack*/
+
+ IOCTL_SIO_CMD_MAX
+} T_ZDrvSio_IOCTL; /*sio ioctl command*/
+
+
+
+typedef struct _T_ZDrvUsbSio_SetConfig
+{
+
+ UINT8 endpoint;
+ UINT32 txBufferSize;
+ UINT32 rxBufferSize;
+ BOOL block;
+ UINT32 blocktime;
+
+}T_ZDrvUsbSio_SetConfig; /*usbsio use to config the param*/
+
+typedef struct _T_ZDrvSio_SetConfig
+{
+
+ UINT8 endpoint;
+ UINT32 txBufferSize;
+ UINT32 rxBufferSize;
+ BOOL block;
+ UINT32 blocktime;
+ T_ZDrvSio_DataConfig dataconfig;
+}T_ZDrvSio_SetConfig; /*usbsio use to config the param*/
+
+
+typedef struct _T_Sio_Dev_Hw
+{
+ VOID * regs;
+ T_ZDrvSio_DataConfig settings;
+ VOID * upLayerSet;
+
+}
+T_Sio_Dev_Hw;
+
+
+typedef struct _T_Sio_HalOpt
+{
+ SINT32 (*open)(UINT32 portNum,T_ZDrvSio_DataConfig * portConfig);
+ SINT32 (*read)(UINT32 portNum, UINT8* pBuf, UINT32 len);
+ SINT32 (*write)(UINT32 portNum, UINT8* pBuf, UINT32 len);
+ SINT32 (*close)(UINT32 portNum);
+ SINT32 (*ctrl)(UINT32 portNum,T_DRVIO_CTRL_KEY function, VOID* arg);
+}
+T_Sio_HalOpt;
+
+/**************************************************************************
+ * Global Variable *
+ **************************************************************************/
+
+/**************************************************************************
+ * Function Prototypes *
+ **************************************************************************/
+SINT32 zDrvSio_Install(UINT32 portNum, CHAR* name, T_Sio_HalOpt * pDevHalOpt);
+
+
+#endif/*_DRVS_SIO_H_ */
+
+
+
diff --git a/cp/ps/driver/inc/io/drvs_io_vib.h b/cp/ps/driver/inc/io/drvs_io_vib.h
new file mode 100644
index 0000000..d7014c4
--- /dev/null
+++ b/cp/ps/driver/inc/io/drvs_io_vib.h
@@ -0,0 +1,57 @@
+/*******************************************************************************
+ * Copyright (C) 2007, ZTE Corporation.
+ *
+ * File Name: drvs_io_vib.h
+ * File Mark:
+ * Description:
+ * Others:
+ * Version: 1.0
+ * Author: liuyi
+ * Date: 2016-09-03
+ * History 1:
+ * Date:
+ * Version:
+ * Author:
+ * Modification:
+ * History 2:
+ ********************************************************************************/
+
+#ifndef _DRVS_IO_VIB_H
+#define _DRVS_IO_VIB_H
+
+/****************************************************************************
+* Include files
+****************************************************************************/
+#include "drvs_io.h"
+/****************************************************************************
+* Macros
+****************************************************************************/
+#define ZDRV_DEV_VIB "vib"
+/****************************************************************************
+* Types
+****************************************************************************/
+
+
+/* */
+typedef enum
+{
+ VIB_POWER_DISABLE,
+ VIB_POWER_ENABLE,
+
+ MAX_VIB_POWER
+}
+T_ZDrvVib_Power;
+
+typedef enum
+{
+ VIB_STATE_OFF,
+ VIB_STATE_ON,
+
+ MAX_VIB_STATE
+}
+T_ZDrvVib_State;
+
+
+
+#endif/*_DRVS_IO_VIB_H*/
+
diff --git a/cp/ps/driver/inc/io/drvs_io_voice.h b/cp/ps/driver/inc/io/drvs_io_voice.h
new file mode 100644
index 0000000..f157311
--- /dev/null
+++ b/cp/ps/driver/inc/io/drvs_io_voice.h
@@ -0,0 +1,224 @@
+/*******************************************************************************
+ * Copyright (C) 2007, ZTE Corporation.
+ *
+ * File Name: drvs_iokeys.h
+ * File Mark:
+ * Description:
+ * Others:
+ * Version: 1.0
+ * Author: geanfeng
+ * Date: 2014-02-11
+ * History 1:
+ * Date:
+ * Version:
+ * Author:
+ * Modification:
+ * History 2:
+ ********************************************************************************/
+
+#ifndef _DRVS_IO_VOICE_H
+#define _DRVS_IO_VOICE_H
+
+/****************************************************************************
+* Include files
+****************************************************************************/
+#include "drvs_io.h"
+/****************************************************************************
+* Macros
+****************************************************************************/
+#define ZDRV_DEV_VOICE "voice" /*The device name of voice driver.*/
+#define ZDRV_DEV_VOLTE "volte" /*The device name of voice driver.*/
+
+/****************************************************************************
+* Types
+****************************************************************************/
+/* Voice input channel selection. */
+typedef enum
+{
+ CODEC_INPUT_MICPHONE =0, /*input path in earphone mic*/
+ CODEC_INPUT_HEADSET, /*input path in headset*/
+ CODEC_INPUT_BLUETOOTH, /*input path in bluetooth*/
+ CODEC_INPUT_HANDSFREE, /*input path in mic(handsfree)*/
+
+ MAX_CODEC_INPUT_PATH
+} T_ZDrv_CodecInputPath;
+
+/* Voice output channel selection. */
+typedef enum
+{
+ CODEC_OUTPUT_RECEIVER =0, /*output path in receiver*/
+ CODEC_OUTPUT_SPEAKER, /*output path in speaker*/
+ CODEC_OUTPUT_HEADSET, /*output path in headset*/
+ CODEC_OUTPUT_BLUETOOTH, /*output path in bluetooth*/
+ CODEC_OUTPUT_HSANDSPK, /*output path in both headset and speaker*/
+
+
+ MAX_CODEC_OUTPUT_PATH
+}T_ZDrv_CodecOutputPath;
+
+#define T_ZDrv_AudioInputPath T_ZDrv_CodecInputPath
+#define T_ZDrv_VoiceInputPath T_ZDrv_CodecInputPath
+#define T_ZDrv_AudioOutputPath T_ZDrv_CodecOutputPath
+#define T_ZDrv_VoiceOutputPath T_ZDrv_CodecOutputPath
+
+
+typedef struct
+{
+ UINT16 uiStartX;
+ UINT16 uiStartY;
+ UINT16 uiWidth;
+ UINT16 uiHeight;
+} T_ZDrv_Rect;
+
+/* Record data format. */
+typedef enum
+{
+ RECORD_DATA_FORMAT_AMR = 0,
+ RECORD_DATA_FORMAT_FR,
+ RECORD_DATA_FORMAT_HR,
+ RECORD_DATA_FORMAT_EFR,
+
+ MAX_RECORD_DATA_FORMAT
+} T_ZDrvRcd_DataFormat;
+
+/*add on the platform of 7502 for record the different of channel online voice*/
+/* channel selection for voice record function */
+typedef enum
+{
+ VOICE_RECORD_UPLINK = 0,
+ VOICE_RECORD_DOWNLINK,
+ VOICE_RECORD_UPLINK_AND_DOWNLINK,
+ MAX_VOICE_RECORD_CHANNEL
+} T_ZDrvVoice_RecordChannel;
+
+typedef struct
+{
+ T_ZDrvRcd_DataFormat dataformat;
+ UINT32 bufsize;
+ T_ZDrvVoice_RecordChannel channel; /*add on the platform of 7502 for record the different of channel online voice*/
+} T_ZDrvRcd_InfoParam;
+
+/* Voice input channel volum level selection.*/
+typedef enum{
+ VOICE_INPUT_VOL_LEVEL_0 = 0,
+ VOICE_INPUT_VOL_LEVEL_1 ,
+ VOICE_INPUT_VOL_LEVEL_2 ,
+ VOICE_INPUT_VOL_LEVEL_3 ,
+ VOICE_INPUT_VOL_LEVEL_4 ,
+ VOICE_INPUT_VOL_LEVEL_5 ,
+
+ MAX_VOICE_INPUT_VOL_LEVEL
+} T_ZDrvVoice_InputVolLevel;
+
+/* Audio output channel volum level selection.*/
+typedef enum{
+ VOICE_OUTPUT_VOL_LEVEL_0 = 0,
+ VOICE_OUTPUT_VOL_LEVEL_1 ,
+ VOICE_OUTPUT_VOL_LEVEL_2 ,
+ VOICE_OUTPUT_VOL_LEVEL_3 ,
+ VOICE_OUTPUT_VOL_LEVEL_4 ,
+ VOICE_OUTPUT_VOL_LEVEL_5 ,
+ VOICE_OUTPUT_VOL_LEVEL_6 ,
+ VOICE_OUTPUT_VOL_LEVEL_7 ,
+ VOICE_OUTPUT_VOL_LEVEL_8 ,
+ VOICE_OUTPUT_VOL_LEVEL_9 ,
+ VOICE_OUTPUT_VOL_LEVEL_10 ,
+ VOICE_OUTPUT_VOL_LEVEL_11 ,
+
+ MAX_VOICE_OUTPUT_VOL_LEVEL
+} T_ZDrvVoice_OutputVolLevel;
+
+/* voice sample rate selection. */
+typedef enum
+{
+ VOICE_SAMPLE_8K =0, /* voice sample rate 8K. */
+ VOICE_SAMPLE_16K , /* voice sample rate 16K. */
+
+ MAX_VOICE_SAMPLE
+} T_ZDrvVoice_Sample;
+
+/* voice codec format, which is not the codec of PCM format */
+typedef enum
+{
+ VOICE_DATA_FORMAT_AMR = 0,
+ VOICE_DATA_FORMAT_FR,
+ VOICE_DATA_FORMAT_HR,
+ VOICE_DATA_FORMAT_EFR,
+ MAX_VOICE_DATA_FORMAT
+} T_ZDrvVoice_DataFormat;
+/* channel selection for voice mute function */
+typedef enum
+{
+ VOICE_UPLINK = 0,
+ VOICE_DOWNLINK,
+ VOICE_UPLINK_AND_DOWNLINK,
+ MAX_VOICE_MUTE_CHANNEL
+} T_ZDrvVoice_MuteChannel;
+
+/* voice mute switch */
+typedef enum
+{
+ VOICE_MUTE_DISABLE = 0,
+ VOICE_MUTE_ENABLE,
+ MAX_VOICE_MUTE_SWITCH
+} T_ZDrvVoice_mute_Switch;
+
+/* voice mute control information */
+typedef struct
+{
+ T_ZDrvVoice_mute_Switch enable;
+ T_ZDrvVoice_MuteChannel channel; /* input & output function */
+} T_ZDrvVoice_MuteInfo;
+
+/* voice switch */
+typedef enum
+{
+ VOICE_DISABLE = 0,
+ VOICE_ENABLE,
+ MAX_VOICE_SWITCH
+} T_ZDrvVoice_Switch;
+
+/* voice buffer information */
+typedef struct
+{
+ VOID *pBuf; /* voice buffer */
+ UINT32 bufferSize; /* voice buffer size */
+}T_ZDrvVoice_BufInfo;
+
+/* The frame type of AMR */
+typedef enum {
+ VOICE_FRAME_MR475 = 0,
+ VOICE_FRAME_MR515,
+ VOICE_FRAME_MR59,
+ VOICE_FRAME_MR67,
+ VOICE_FRAME_MR74,
+ VOICE_FRAME_MR795,
+ VOICE_FRAME_MR102,
+ VOICE_FRAME_MR122,
+
+ MAX_VOICE_FRAME_TYPE
+}T_ZDrvVoice_FrameType;
+
+/* The frame formate of AMR */
+typedef enum {
+ VOICE_AMR_IF2,
+ VOICE_AMR_IF1,
+
+ MAX_VOICE_AMR_IF
+}T_ZDrvVoice_AmrIf;
+
+/* The frame formate of AMR information*/
+typedef struct
+{
+ T_ZDrvVoice_FrameType frametype; /* The frame type of AMR */
+ T_ZDrvVoice_AmrIf amrif; /* The frame formate of AMR */
+}T_ZDrvVoice_AmrInfo, *T_ZDrvVoice_AmrInfoPtr;
+
+/* Audio channel */
+typedef enum
+{
+ AUDIO_MONO_CHANNEL,
+ AUDIO_DUAL_CHANNEL
+}T_ZDrvAudio_Channel;
+#endif/*_DRVS_IO_VOICE_H*/
+
diff --git a/cp/ps/driver/inc/io/drvs_serial_device.h b/cp/ps/driver/inc/io/drvs_serial_device.h
new file mode 100644
index 0000000..b4a7f68
--- /dev/null
+++ b/cp/ps/driver/inc/io/drvs_serial_device.h
@@ -0,0 +1,48 @@
+/*******************************************************************************
+ * Copyright (C) 2007, ZTE Corporation.
+ *
+ * File Name: drvs_serial_device.h
+ * File Mark:
+ * Description:
+ * Others:
+ * Version: 1.0
+ * Author: weizhigang
+ * Date: 2009-11-12
+ * History 1:
+ * Date:
+ * Version:
+ * Author:
+ * Modification:
+ * History 2:
+ ********************************************************************************/
+
+#ifndef _DRVS_SERIAL_DEVICE_H
+#define _DRVS_SERIAL_DEVICE_H
+
+
+/****************************************************************************
+* Include files
+****************************************************************************/
+#include "drvs_io.h"
+#include "drvs_io_keys.h"
+#include "drvs_io_sio.h"
+#include "drvs_io_names.h"
+/****************************************************************************
+* Macros
+****************************************************************************/
+
+
+/****************************************************************************
+* Types
+****************************************************************************/
+
+
+/****************************************************************************
+* Function Prototypes
+****************************************************************************/
+
+
+#endif/*_DRVS_SERIAL_DEVICE_H*/
+
+
+
diff --git a/cp/ps/driver/inc/io/earpiece_api.h b/cp/ps/driver/inc/io/earpiece_api.h
new file mode 100644
index 0000000..e4d6716
--- /dev/null
+++ b/cp/ps/driver/inc/io/earpiece_api.h
@@ -0,0 +1,161 @@
+/***********************************************************************
+* Copyright (C) 2001, ZTE Corporation.
+*
+* File Name: earpiece_api.h
+* File Mark:
+* Description: Provide earpiece module function prototype declaration and type declaration.
+* Others:
+* Version: v0.5
+* Author: LvWenhua
+* Date: 2007-10-25
+*
+* History 1:
+* Date:
+* Version:
+* Author:
+* Modification:
+* History 2:
+**********************************************************************/
+
+#ifndef _EARPIECE_API_H
+#define _EARPIECE_API_H
+
+/**************************************************************************
+ * Include files *
+ **************************************************************************/
+
+/**************************************************************************
+ * Macro *
+ **************************************************************************/
+#define ZDRV_DEV_EARP "earpiece" /*The device name of earpiece driver.*/
+
+/**************************************************************************
+ * Types *
+ **************************************************************************/
+/*Information from driver to upper application.*/
+typedef enum {
+ EARP_INFO_PLUG = 0, /*Earpiece is plugged.*/
+ EARP_INFO_UNPLUG , /*Earpiece is unplugged.*/
+ EARP_INFO_HOOK_SWITCH , /*Earpiece hook key is pressed and released.*/
+
+ MAX_EARP_INFO
+} T_ZDrvEarp_Info;
+
+typedef enum {
+ EARP_STATE_PLUG = 0, /*Earpiece is plugged.*/
+ EARP_STATE_UNPLUG , /*Earpiece is unplugged.*/
+
+ MAX_EARP_STATE
+} T_ZDrvEarp_State;
+
+typedef void (*T_ZDrvEarp_CallbackFunc) (T_ZDrvEarp_Info);
+
+#if 0
+typedef enum
+{
+ IOCTL_EARP_SET_CALLBACK = 0, /*Set callback function, it is used to register the callback function which will send the earpiece switch status to user.*/
+ IOCTL_EARP_GET_PLUG_STATUS , /*Get earpiece plug status, replace the read function.*/
+ IOCTL_EARP_SET_HOOK_ENABLE,
+ IOCTL_EARP_SET_HOOK_DISABLE,
+ MAX_IOCTL_EARP
+}T_ZDrvEarp_IoCtl;
+#endif
+
+/**************************************************************************
+ * Global Variable *
+ **************************************************************************/
+
+/**************************************************************************
+ * Function Prototypes *
+ **************************************************************************/
+
+/**************************************************************************
+* Function: zDrv_Open
+* Description: This function is used to open device according to device name.
+* Parameters:
+* Input:
+ pathname:device name, ZDRV_DEV_EARP in earpiece
+* flags: no use, 0
+* Output: None
+* Returns:
+* device file descriptor if successed. [1, ZDRV_MAX_DEV_FILE_NUM), please refer to dal_api.h
+* DRV_ERR_NO_THIS_DEVICE: this device hasn't been installed yet
+* DRV_ERR_FD_OVERFLOW: no free fd entry
+* DRV_ERR_NOT_SUPPORTED: this device don't support open operation.
+* DRV_ERR_OPEN_TIMES: has been opened already.
+* others: others error code. for detailed information, please refer to the header file of hal layer
+* Others: None
+**************************************************************************/
+/*SINT32 zDrv_Open (const CHAR *pathname, SINT32 flags)*/
+
+/**************************************************************************
+* Function: zDrv_Close
+* Description: This function is used to close a device according to device file descriptor.
+* Parameters:
+* Input:
+* fd :device file descriptor
+* Output:None
+* Returns:
+* DRV_SUCCESS: successed.
+* DRV_ERR_NOT_OPENED: has not been opend yet.
+* DRV_ERR_FD_TABLE: device driver table has been invalid.
+* DRV_ERR_NOT_SUPPORTED: this device don't support close operation.
+* others: others error code. for detailed information, please refer to the header file of hal layer
+* Others: None
+**************************************************************************/
+/*SINT32 zDrv_Close(UINT32 fd)*/
+
+/**************************************************************************
+* Function: zDrv_Ioctl
+* Description: This function is used to control device according to fd(device file descriptor).
+* Parameters:
+* Input:
+* fd:device file descriptor
+* cmd:command code
+* arg:command parameters
+* Output:None
+* Returns:
+* DRV_SUCCESS: successed.
+* DRV_ERR_INVALID_PARAM: the input parameters are invalid
+* DRV_ERR_NOT_OPENED: has not been opend yet.
+* DRV_ERR_FD_TABLE: device driver table has been invalid.
+* DRV_ERR_NOT_SUPPORTED: this device don't support ioctrl operation.
+* DRV_ERR_INVALID_IOCTL_CMD: this command has not been supported yet.
+* others: for detailed information, please refer to the header file of hal layer
+*
+* Others: None
+**************************************************************************/
+/*SINT32 zDrv_Ioctl(UINT32 fd, UINT32 cmd, VOID* arg)*/
+
+/**************************************************************************
+* Function: zDrvEarp_Init
+* Description: This function is used to install earpiece driver.
+* Parameters:
+* Input:None
+* Output:None
+* Returns:
+* DRV_SUCCESS: successed.
+* DRV_ERROR: error
+* DRV_ERR_DEV_OVERFLOW: no free device driver entry in table
+* DRV_ERR_MEM_ALLOC: failed to alloc memory
+* Others: None
+**************************************************************************/
+SINT32 zDrvEarp_Init(VOID);
+
+/**************************************************************************
+* Function: zDrvEarp_Exit
+* Description: This function is used to uninstall earpiece driver.
+* Parameters:
+* Input:None
+* Output:None
+* Returns:
+* DRV_SUCCESS: successed.
+* DRV_ERROR: error
+* DRV_ERR_DEV_TABLE: device driver table has been invalid.
+* DRV_ERR_NO_THIS_DEVICE: this device hasn't been installed yet
+* Others: None
+**************************************************************************/
+SINT32 zDrvEarp_Exit(VOID);
+
+#endif /* _EARPIECE_API_H */
+
diff --git a/cp/ps/driver/inc/misc/NvParam_tsc.h b/cp/ps/driver/inc/misc/NvParam_tsc.h
new file mode 100644
index 0000000..93a0197
--- /dev/null
+++ b/cp/ps/driver/inc/misc/NvParam_tsc.h
@@ -0,0 +1,79 @@
+/***********************************************************************
+* Copyright (C) 2001, ZTE Corporation.
+*
+* File Name: nvparam_tsc.h
+* File Mark:
+* Description:
+* Others:
+* Version:
+* Author:
+* Date:
+*
+* History 1:
+* Date:
+* Version:
+* Author:
+* Modification:
+* History 2:
+**********************************************************************/
+
+#ifndef NVPARAM_TSC_H
+#define NVPARAM_TSC_H
+
+/**************************************************************************
+ * Include files *
+ **************************************************************************/
+#include "RWNvConfig.h"
+/**************************************************************************
+ * Macro *
+ **************************************************************************/
+/****************************************************************************
+* Types
+****************************************************************************/
+
+/******************************************************
+* TSC NV
+******************************************************/
+#define PROBE_MAX_NUM (6)
+
+typedef struct
+{
+ UINT8 THROSHOLD_0; /*fail_th0*/
+ UINT8 THROSHOLD_1; /*rise_t0*/
+ UINT8 THROSHOLD_2; /*fail_t1*/
+ UINT8 THROSHOLD_3; /*rise_t1*/
+ UINT8 THROSHOLD_4; /*fail_t2*/
+ UINT8 THROSHOLD_5; /*rise_t2*/
+ UINT8 THROSHOLD_6; /*fail_t3*/
+ UINT8 THROSHOLD_7; /*rise_t3*/
+ UINT8 THROSHOLD_8; /*fail_t4*/
+ UINT8 THROSHOLD_9; /*rise_t4*/
+ UINT8 THROSHOLD_10; /*rise_t5*/
+ }
+T_SYS_NV_TSC_THRESHOLD;
+
+typedef struct
+{
+ T_SYS_NV_TSC_THRESHOLD Threshods[PROBE_MAX_NUM]; /*ÓëÔÚdrvs_tscÖж¨ÒåµÄPROBE_MAX±£³ÖÒ»ÖÂ*/
+ UINT8 reserved1[22];
+ UINT8 DetectEn; /*οØ×Ü¿ª¹Ø£¬0xB2±íʾοشò¿ª,ÆäËûÖµ²»¿ª*/
+ UINT8 Wifi_TxBackOff_En; /*ÏÞÖÆWIFI×î´ó¹¦ÂÊ¿ª¹Ø,0xB2±íʾÏÞÖÆÏÞÖÆWIFI×î´ó¹¦ÂÊ´ò¿ª,ÆäËûÖµ²»¿ª*/
+ UINT8 Wifi_RateLmite_En; /*ÏÞÖÆWIFI¹¦ÂÊ¿ª¹Ø£¬0xB2±íʾÏÞÖÆWIFI¹¦ÂÊ´ò¿ª,ÆäËûÖµ²»¿ª*/
+ UINT8 Wifi_IntervalTime;/*wifi½µËÙʱ¼ä¼ä¸ô£¬Ä¬ÈÏ0ʱΪĬÈÏʱ³¤1min£¬ÆäÓàÖµÉèÖöàÉÙ¼ä¸ôΪ¶àÉÙ*/
+ UINT8 Aprate_En; /*AP²àËÙÂÊ¿ØÖÆ¿ª¹Ø£¬0xB2±íʾAP²àËÙÂÊ¿ØÖÆ´ò¿ª,ÆäËûÖµ²»¿ª*/
+ UINT8 Modemrate_En; /*modem ²àËÙÂÊ¿ØÖÆ¿ª¹Ø£¬0xB2±íʾmodem²àËÙÂÊ¿ØÖÆ´ò¿ª,ÆäËûÖµ²»¿ª*/
+ UINT8 Dfs_En; /*ps ²àDFS¿ØÖÆ¿ª¹Ø£¬0xB2±íʾps ²àDFS¿ØÖÆ´ò¿ª,ÆäËûÖµ²»¿ª*/
+ UINT8 TansmitPower_En; /* modem²à½µ·¢É书ÂÊ¿ØÖÆ¿ª¹Ø, 0xB2±íʾmodem²à½µ·¢É书ÂÊ¿ØÖÆ´ò¿ª,ÆäËûÖµ²»¿ª*/
+ UINT8 User_En; /*Óû§²ßÂÔ¿ØÖÆ¿ª¹Ø0xB2±íʾ¿ª,ÆäËûÖµ²»¿ª*/
+ UINT8 reserved2[3];
+}T_SYS_NV_TSC_CONFIG;
+
+/******************************************************
+* Drv NV Config
+******************************************************/
+
+/****************************************************************************
+* Function Prototypes
+****************************************************************************/
+
+#endif /* NVPARAM_TSC_H */
diff --git a/cp/ps/driver/inc/misc/aud_drv.h b/cp/ps/driver/inc/misc/aud_drv.h
new file mode 100644
index 0000000..0fde9db
--- /dev/null
+++ b/cp/ps/driver/inc/misc/aud_drv.h
@@ -0,0 +1,1603 @@
+/**
+ * Copyright (C) Infineon Technologies Denmark A/S. All rights reserved.
+ *
+ * This document contains proprietary information belonging to Infineon
+ * Technologies Denmark A/S. Passing on and copying of this document, use
+ * and communication of its contents is not permitted without prior written
+ * authorisation.
+ *
+ * Description:
+ * Interface header file for the audio driver
+ *
+ * Revision Information:
+ * File name: \dwddrvif\inc\aud_drv.h
+ * Version: \main\34
+ * Date: 2007-10-03 09:23:08
+ * Responsible: soerenek
+ * Comment:
+ * added HW available for I2S1
+ */
+
+#if !defined (_AUD_INTERFACES)
+#define _AUD_INTERFACES
+
+#if !defined (_WIN32) /* QQQQ Problem with including bastypes.h in the test suite - fix this later */
+#include "bastypes.h"
+//#include "scttypes.h" /* QQQQ For including SDL_Pid - scttypes.h ought to be included in the file that includes aud_drv.h */
+#include "base_api.h"
+#endif /* QQQQ */
+
+/*changed by wangjun for NV change.[20090214]*/
+#include "aud_nv.h" //#include "eep.h"
+
+/* Temporarily inserted to protect the old I2S interface until it is no longer used */
+#define aud_old_I2S_interface
+
+/******************************************************************************
+*
+* Feature defines
+*
+******************************************************************************/
+#if defined(AUD_EXTERNAL_RINGER) && !defined(AUD_EXTERNAL_RINGER_MA2)
+ #define AUD_EXTERNAL_RINGER_MA3
+#endif
+
+/******************************************************************************
+*
+* Type defines
+*
+******************************************************************************/
+/* QQQQ UINT8, UINT16, UINT32, SINT8, SINT16, and SINT32 should not be used *
+ * - remove the defines when they are not used any longer */
+ #if 0 //huojishan 200801.01
+#if !defined (UNITEST) /* UINT8 and UINT16 are already defined in Microsoft Visual Studio which is used for Unitest UMAC test environment build */
+ #if !defined (UINT8)
+ typedef unsigned char UINT8;
+ #endif
+
+ #if !defined (UINT16)
+ typedef unsigned short UINT16;
+ #endif
+#endif /* UNITEST */
+
+#if !defined (UINT32)
+ #if defined (_WIN32)
+ typedef unsigned int UINT32;
+ #else
+ typedef unsigned long UINT32;
+ #endif
+#endif /* UINT32 */
+
+#if !defined (SINT8)
+ typedef signed char SINT8;
+#endif
+
+#if !defined (SINT16)
+ typedef signed short SINT16;
+#endif
+
+#if !defined (SINT32)
+ #if !defined (_WIN32)
+ typedef signed long SINT32;
+ #else
+ typedef signed int SINT32;
+ #endif
+#endif /* SINT32 */
+
+#if defined (_WIN32) /* QQQQ Problem with including bastypes.h in the test suite - fix this later */
+ #if !defined (U8)
+ typedef unsigned char U8;
+ #endif
+ #if !defined (U16)
+ typedef unsigned short U16;
+ #endif
+ #if !defined (U32)
+ typedef unsigned int U32;
+ #endif
+ #if !defined (S8)
+ typedef signed char S8;
+ #endif
+ #if !defined (S16)
+ typedef signed short S16;
+ #endif
+ #if !defined (S32)
+ typedef signed int S32;
+ #endif
+#endif /* QQQQ _WIN32 */
+#endif
+
+/* Defines/includes for PC/target builds */
+#if defined (_WIN32)
+#define SDL_Pid U8
+#define SDL_boolean BOOL
+#endif /* _WIN32 */
+
+#define DWD_HUGE
+#define DWD_AUDIO_FAR
+
+/* Return codes */
+#define aud_rc_ok 0
+#define aud_rc_resource_in_use -1
+#define aud_rc_resource_conflict -2
+#define aud_rc_handle_not_used -3
+#define aud_rc_no_hw_support -4
+#define aud_rc_sharing_violation -5
+#define aud_rc_parameter_out_of_range -6
+#define aud_rc_audio_driver_disabled -7
+#define aud_rc_missing_dsp_resources -8
+#define aud_rc_format_not_supported -10
+#define aud_rc_no_playback -11
+#define aud_rc_unknown_position -12
+#define aud_rc_request_error -13
+#define aud_rc_syntax_error -14
+#define aud_rc_tone_error -15
+#define aud_rc_storage_problems -16
+#define aud_rc_performance_problems -17
+#define aud_rc_ram_buffer_used -18
+#define aud_rc_suspend_resume_error -19
+#define aud_rc_info -20
+#define aud_rc_playback_finish -21
+#define aud_rc_playback_started -22
+#define aud_rc_playback_stopped -23
+#define aud_rc_playback_suspended -24
+#define aud_rc_playback_loop -25
+#define aud_rc_recording_finish -26
+#define aud_rc_recording_started -27
+#define aud_rc_user_event -28
+#define aud_rc_elapsed_time -29
+#define aud_rc_total_playtime -30
+#define aud_rc_not_supported -31
+#define aud_rc_mapi -32
+#define aud_rc_current_frame -33
+#define aud_rc_backwardforward_info -34
+#define aud_rc_path_removal_success -35
+#define aud_rc_path_addition_success -36
+#define aud_rc_path_addition_conflict -37
+#define aud_rc_path_removal_error -38
+#define aud_rc_user_message -39
+#define aud_rc_encoding_started -40
+#define aud_rc_encoding_stopped -41
+#define aud_rc_encoder_suspended -42
+#define aud_rc_I2S_started -43
+#define aud_rc_I2S_stopped -44
+#define aud_rc_I2S_setup_error -45
+#define aud_rc_path_in_use -46
+/* !!! Please inform the MobileAnalyzer decoding maintainer (HHE) when adding new return codes */
+
+/* Used for defining which HW is present in the system in question - must be updated when aud_resource_enum is updated */
+#define AUD_HW_AVAILABLE_SPEECH 0x00000001
+#define AUD_HW_AVAILABLE_TONE_GENERATOR 0x00000002
+#define AUD_HW_AVAILABLE_RINGER 0x00000004
+#define AUD_HW_AVAILABLE_EXTERNAL_VIBRATOR 0x00000008
+#define AUD_HW_AVAILABLE_EXTERNAL_AMPLIFIER 0x00000010
+#define AUD_HW_AVAILABLE_FM_RADIO 0x00000020
+#define AUD_HW_AVAILABLE_RECORDING_VM 0x00000040
+#define AUD_HW_AVAILABLE_PLAYBACK_VM 0x00000080
+#define AUD_HW_AVAILABLE_PLAYBACK_MP3 0x00000100
+#define AUD_HW_AVAILABLE_I2S_PCM 0x00000200
+#define AUD_HW_AVAILABLE_INTERNAL_MIDI 0x00000400
+#define AUD_HW_AVAILABLE_TTY 0x00000800
+#define AUD_HW_AVAILABLE_PLAYBACK_PCM 0x00001000
+#define AUD_HW_AVAILABLE_RECORD_PCM 0x00002000
+#define AUD_HW_AVAILABLE_MAPI 0x00004000
+#define AUD_HW_AVAILABLE_INBAND 0x00008000
+#define AUD_HW_ABAILABLE_SMPOWER_BACKSPEAKER 0x00010000
+#define AUD_HW_AVAILABLE_SBC_ENCODER 0x00020000
+#define AUD_HW_AVAILABLE_I2S2_RX 0x00040000
+#define AUD_HW_AVAILABLE_I2S2_TX 0x00080000
+
+#define AUD_HW_AVAILABLE_I2S1_RX 0x00000000
+#define AUD_HW_AVAILABLE_I2S1_TX 0x00000000
+#define AUD_HW_AVAILABLE_I2S1_BLUETOOTH 0x00400000
+/* Test handles - update this list when the list above is updated */
+#define AUD_TEST_HANDLE 0xFF
+#define AUD_SPEECH_TEST_HANDLE 0xFE
+#define AUD_TONE_GENERATOR_TEST_HANDLE 0xFD
+#define AUD_AMPLIFIER_TEST_HANDLE 0xFC
+#define AUD_RINGER_TEST_HANDLE 0xFB
+#define AUD_FM_RADIO_TEST_HANDLE 0xFA
+#define AUD_RECORDING_VM_TEST_HANDLE 0xF9
+#define AUD_PLAYBACK_VM_TEST_HANDLE 0xF8
+#define AUD_PLAYBACK_MP3_TEST_HANDLE 0xF7
+#define AUD_TTY_TEST_HANDLE 0xF6
+#define AUD_VIBRATOR_TEST_HANDLE 0xF5
+#define AUD_MIDI_PLAYER_TEST_HANDLE 0xF4
+#define AUD_PCM_CHANNEL_TEST_HANDLE 0xF3
+#define AUD_PLAYBACK_PCM_TEST_HANDLE 0xF2
+#define AUD_RECORD_PCM_TEST_HANDLE 0xF1
+#define AUD_MAPI_TEST_HANDLE 0xF0
+#define AUD_INBAND_TEST_HANDLE 0xEF
+#define AUD_SMPOWER_BACKSPEAKER_TEST_HANDLE 0xEE
+#define AUD_SBC_ENCODER_TEST_HANDLE 0xED
+#define AUD_I2S2_RX_TEST_HANDLE 0xEC
+#define AUD_I2S2_TX_TEST_HANDLE 0xEB
+
+/* For compatility reasons with atcptst */
+#define AUD_MIC 1
+#define AUD_EARPIECE 2
+
+/******************************************************************************
+*
+* External enumerations and structures
+*
+******************************************************************************/
+
+/* Resources */
+typedef enum {
+ aud_resource_speech, /* 0 */
+ aud_resource_tone_generator,
+ aud_resource_ringer, /* This Does NOT include the vibrator */
+ aud_resource_vibrator,
+ aud_resource_amplifier, /* External amplifier for speaker phone */
+ aud_resource_radio, /* 5 */
+ aud_resource_record_vm,
+ aud_resource_playback_vm,
+ aud_resource_playback_mp3,
+ aud_resource_PCM_channel, /* Replaced by I2S2_Rx and I2S2_Tx (05-12-2006) */
+ aud_resource_midi_player, /* 10 */
+ aud_resource_tty,
+ aud_resource_playback_pcm,
+ aud_resource_record_pcm,
+ aud_resource_mapi,
+ aud_resource_inband, /* 15 */ /* Virtual resource used to indicate whether non-baseband audio is active. */
+ aud_resource_smpower_backspeaker, /* SM power only if other devices input audio through SP power gain. */
+ aud_resource_sbc_encoder, /*SBC Encoder */
+ aud_resource_I2S2_Rx,
+ aud_resource_I2S2_Tx,
+ aud_resource_end
+} aud_resource_enum; /* When adding more resources, also add them to the defines at the top of this file, and notify PhoneTool group */
+
+/* Priorities for resource allocation */
+typedef enum {
+ aud_priority_normal,
+ aud_priority_high,
+ aud_priority_end
+} aud_priority_enum;
+
+/* Mute-related enumerations */
+typedef enum {
+ aud_mute_enable,
+ aud_mute_disable,
+ aud_mute_end
+} aud_mute_enum;
+
+typedef enum {
+ aud_mute_left_channel_dac,
+ aud_mute_right_channel_dac,
+ aud_mute_dac_end
+} aud_mute_dac_enum;
+
+typedef enum {
+ aud_direction_uplink, /* 0 */
+ aud_direction_downlink,
+ aud_direction_updownlink,
+ aud_direction_downlink_left,
+ aud_direction_downlink_right,
+ aud_direction_uplink_speech, /* 5 */
+ aud_direction_downlink_speech,
+ aud_direction_updownlink_speech,
+ aud_direction_end
+} aud_direction_enum;
+
+typedef enum {
+ aud_direction_resource_uplink,
+ aud_direction_resource_downlink,
+ aud_direction_resource_updownlink,
+ aud_direction_resource_end
+} aud_ul_dl_direction_enum;
+
+/* Path-related enumerations */
+typedef enum {
+ aud_disable_path,
+ aud_enable_path,
+ aud_audio_path_end
+} aud_audio_path_enum;
+
+typedef enum {
+ aud_handset_mic, /* 0 */
+ aud_headset_mic,
+ aud_I2S1_rx, /*Now used for any kind of bluetooth device connection*/
+ aud_tty_uplink,
+ aud_hfcarkit_mic,
+ aud_I2S1_inband_rx, /* 5 */
+ aud_handset_mic_42dB,
+ aud_handset_dthf_uplink,
+ aud_mic_mute,
+ aud_handset_mic_slidedown,
+ aud_handset_mic_loopback, /* 10 */
+ aud_I2S1_rx_loopback,
+ aud_media_to_uplink,
+ aud_media_to_uplink_hifi,
+ aud_stereo_mic,
+ aud_scheduler_8kHz, /* 15 */
+ aud_scheduler_16kHz,
+ aud_scheduler_48kHz,
+ aud_external_stereo_input,
+ aud_headset_mic_42dB,
+ aud_uplink_source_end
+} aud_uplink_source_enum; /* When adding more paths, remember to notify the PhoneTool group */
+
+typedef enum {
+ aud_normal_earpiece, /* 0 */
+ aud_mono_headset,
+ aud_stereo_headset,
+ aud_backspeaker,
+ aud_I2S1_tx,
+ aud_tty_downlink, /* 5 */
+ aud_mono_headset_external_ringer,
+ aud_stereo_headset_external_ringer,
+ aud_backspeaker_path_downlink,
+ aud_earpiece_path_downlink,
+ aud_backspeaker_external_ringer, /* 10 */
+ aud_hfcarkit_speaker,
+ aud_I2S1_inband_tx, /*Special path used for routing inband audio (like ringtones) to the bt headset*/
+ aud_backspeaker_stereo,
+ aud_fmradio_backspeaker,
+ aud_fmradio_headset, /* 15 */
+ aud_companion_mono_headset,
+ aud_companion_stereo_headset,
+ aud_companion_mono_backspeaker,
+ aud_companion_stereo_backspeaker,
+ aud_smpower_backspeaker, /* 20 */ /*Special path to backspeaker for non baseband audio*/
+ aud_normal_earpiece_loopback,
+ aud_I2S1_tx_loopback,
+ aud_media_to_downlink_mute,
+ aud_sidetone_loopback,
+ aud_I2S2_external, /* 25 */
+ aud_tmp_downlink_path, /* To be replaced when a new path is added. Preserved for PhoneTool compatibility. */
+ aud_downlink_source_end
+} aud_downlink_source_enum; /* When adding more paths, remember to notify the PhoneTool group */
+
+/* Enable/disable enumerations */
+typedef enum {
+ aud_enable,
+ aud_disable,
+ aud_enable_disable_end
+} aud_enable_disable_enum;
+
+/* Volume enumerations */
+typedef enum {
+ aud_ringer_volume_off,
+ aud_ringer_volume_1,
+ aud_ringer_volume_2,
+ aud_ringer_volume_3,
+ aud_ringer_volume_4,
+ aud_ringer_volume_5,
+ aud_ringer_volume_in_call,
+ aud_ringer_volume_init, /* Only for internal use in audio driver */
+ aud_ringer_volume_end
+} aud_ringer_volume_enum;
+
+typedef enum {
+ aud_speech_volume_1,
+ aud_speech_volume_2,
+ aud_speech_volume_3,
+ aud_speech_volume_4,
+ aud_speech_volume_5,
+ aud_speech_volume_6,
+ aud_speech_volume_7,
+ aud_speech_volume_8,
+ aud_speech_volume_9,
+ aud_speech_volume_10,
+ aud_speech_volume_special, /* For test purpose only */
+ aud_speech_volume_end
+} aud_speech_volume_enum;
+
+typedef enum {
+ aud_volume_0=0,
+ aud_volume_1=1,
+ aud_volume_2,
+ aud_volume_3,
+ aud_volume_4,
+ aud_volume_5,
+ aud_volume_6,
+ aud_volume_7,
+ aud_volume_8,
+ aud_volume_9,
+ aud_volume_10,
+ aud_volume_11,
+ aud_volume_12,
+ aud_volume_13,
+ aud_volume_14,
+ aud_volume_15,
+ aud_volume_16,
+ aud_volume_17,
+ aud_volume_18,
+ aud_volume_19,
+ aud_volume_20,
+ aud_volume_21,
+ aud_volume_22,
+ aud_volume_23,
+ aud_volume_24,
+ aud_volume_25,
+ aud_volume_26,
+ aud_volume_27,
+ aud_volume_28,
+ aud_volume_29,
+ aud_volume_30,
+ aud_volume_31,
+ aud_volume_32,
+ aud_volume_33,
+ aud_volume_34,
+ aud_volume_35,
+ aud_volume_36,
+ aud_volume_37,
+ aud_volume_38,
+ aud_volume_39,
+ aud_volume_40,
+ aud_volume_41,
+ aud_volume_42,
+ aud_volume_43,
+ aud_volume_44,
+ aud_volume_45,
+ aud_volume_46,
+ aud_volume_47,
+ aud_volume_48,
+ aud_volume_49,
+ aud_volume_50,
+ aud_volume_51,
+ aud_volume_52,
+ aud_volume_53,
+ aud_volume_54,
+ aud_volume_55,
+ aud_volume_56,
+ aud_volume_57,
+ aud_volume_58,
+ aud_volume_59,
+ aud_volume_60,
+ aud_volume_61,
+ aud_volume_62,
+ aud_volume_63,
+ aud_volume_64,
+ aud_volume_65,
+ aud_volume_66,
+ aud_volume_67,
+ aud_volume_68,
+ aud_volume_69,
+ aud_volume_70,
+ aud_volume_71,
+ aud_volume_72,
+ aud_volume_73,
+ aud_volume_74,
+ aud_volume_75,
+ aud_volume_76,
+ aud_volume_77,
+ aud_volume_78,
+ aud_volume_79,
+ aud_volume_80,
+ aud_volume_81,
+ aud_volume_82,
+ aud_volume_83,
+ aud_volume_84,
+ aud_volume_85,
+ aud_volume_86,
+ aud_volume_87,
+ aud_volume_88,
+ aud_volume_89,
+ aud_volume_90,
+ aud_volume_91,
+ aud_volume_92,
+ aud_volume_93,
+ aud_volume_94,
+ aud_volume_95,
+ aud_volume_96,
+ aud_volume_97,
+ aud_volume_98,
+ aud_volume_99,
+ aud_volume_100,
+ aud_volume_special, /* For test purpose only */
+ aud_volume_end
+} aud_volume_enum;
+
+/* Tone enumerations */
+typedef enum {
+ aud_tone_DTMF_0, /* 0 */
+ aud_tone_DTMF_1,
+ aud_tone_DTMF_2,
+ aud_tone_DTMF_3,
+ aud_tone_DTMF_4,
+ aud_tone_DTMF_5, /* 5 */
+ aud_tone_DTMF_6,
+ aud_tone_DTMF_7,
+ aud_tone_DTMF_8,
+ aud_tone_DTMF_9,
+ aud_tone_DTMF_hash, /* 10 */
+ aud_tone_DTMF_asterix,
+ aud_tone_key_tone_1, // Not in use.
+ aud_tone_key_tone_2, // Not in use.
+ aud_tone_key_tone_3, // Not in use.
+ aud_tone_key_tone_4, /* 15 */ /* Not in use. */
+ aud_tone_key_tone_5, // Not in use.
+ aud_tone_sv_subscriber_busy,
+ aud_tone_sv_congestion,
+ aud_tone_sv_radio_path_ack,
+ aud_tone_sv_radio_path_not_avail, /* 20 */
+ aud_tone_sv_error_info,
+ aud_tone_sv_call_waiting,
+ aud_tone_info_free_tone,
+ aud_tone_info_connection,
+ aud_tone_info_disconnect, /* 25 */
+ aud_tone_info_device_in,
+ aud_tone_info_device_out,
+ aud_tone_info_msg_full,
+ aud_tone_info_ussd,
+ aud_tone_info_minutte_minder, /* 30 */
+ aud_tone_info_error_1,
+ aud_tone_info_error_2,
+ aud_tone_info_sms_in_call,
+ aud_tone_info_broadcast_in_call,
+ aud_tone_info_alarm_in_call, /* 35 */
+ aud_tone_info_low_bat_in_call,
+ aud_tone_info_power_off,
+ aud_tone_info_power_on,
+ aud_tone_info_single_beep,
+ aud_tone_info_positive_acknowledgement, /* 40 */
+ aud_tone_info_negative_acknowledgement,
+ aud_tone_info_auto_redial,
+ aud_tone_info_network_attention,
+ aud_tone_info_dial_tone,
+ aud_tone_info_low_bat, /* 45 */
+ aud_tone_id_end
+} aud_tone_id_enum;
+
+typedef enum {
+ aud_single_user_tone,
+ aud_dual_user_tone,
+ aud_triple_user_tone,
+ aud_tone_type_end
+} aud_tone_type_enum;
+
+/* Tone generator structures */
+typedef struct {
+ U16 freq1;
+ S16 amp1;
+ U16 duration;
+} aud_single_user_tone_type;
+
+typedef struct {
+ U16 freq1;
+ S16 amp1;
+ U16 freq2;
+ S16 amp2;
+ U16 duration;
+} aud_dual_user_tone_type;
+
+typedef struct {
+ U16 freq1;
+ S16 amp1;
+ U16 freq2;
+ S16 amp2;
+ U16 freq3;
+ S16 amp3;
+ U16 duration;
+} aud_triple_user_tone_type;
+
+/* Ringer enumerations */
+typedef enum {
+ aud_ringer_info_power_off, /* 0 */
+ aud_ringer_info_power_on,
+ aud_ringer_info_low_bat,
+ aud_ringer_info_connection,
+ aud_ringer_info_error_1,
+ aud_ringer_info_error_2, /* 5 */
+ aud_ringer_info_device_in,
+ aud_ringer_info_device_out,
+ aud_ringer_info_msg_full,
+ aud_ringer_message_1,
+ aud_ringer_message_2, /* 10 */
+ aud_ringer_message_3,
+ aud_ringer_message_4,
+ aud_ringer_message_5,
+ aud_ringer_message_6,
+ aud_ringer_message_7, /* 15 */
+ aud_ringer_message_8,
+ aud_ringer_message_9,
+ aud_ringer_message_10,
+ aud_ringer_broadcast_1,
+ aud_ringer_broadcast_2, /* 20 */
+ aud_ringer_broadcast_3,
+ aud_ringer_broadcast_4,
+ aud_ringer_broadcast_5,
+ aud_ringer_broadcast_6,
+ aud_ringer_broadcast_7, /* 25 */
+ aud_ringer_broadcast_8,
+ aud_ringer_broadcast_9,
+ aud_ringer_broadcast_10,
+ aud_ringer_alarm_1,
+ aud_ringer_alarm_2, /* 30 */
+ aud_ringer_alarm_3,
+ aud_ringer_alarm_4,
+ aud_ringer_alarm_5,
+ aud_ringer_alarm_6,
+ aud_ringer_alarm_7, /* 35 */
+ aud_ringer_alarm_8,
+ aud_ringer_alarm_9,
+ aud_ringer_alarm_10,
+ aud_ringer_1,
+ aud_ringer_2, /* 40 */
+ aud_ringer_3,
+ aud_ringer_4,
+ aud_ringer_5,
+ aud_ringer_6,
+ aud_ringer_7, /* 45 */
+ aud_ringer_8,
+ aud_ringer_9,
+ aud_ringer_10,
+ aud_ringer_11,
+ aud_ringer_12, /* 50 */
+ aud_ringer_13,
+ aud_ringer_14,
+ aud_ringer_15,
+ aud_ringer_16,
+ aud_ringer_17, /* 55 */
+ aud_ringer_18,
+ aud_ringer_19,
+ aud_ringer_20,
+ aud_ringer_21,
+ aud_ringer_22, /* 60 */
+ aud_ringer_23,
+ aud_ringer_24,
+ aud_ringer_25,
+ aud_ringer_26,
+ aud_ringer_27, /* 65 */
+ aud_ringer_28,
+ aud_ringer_29,
+ aud_ringer_30,
+ aud_ringer_31,
+ aud_ringer_32, /* 70 */
+ aud_ringer_33,
+ aud_ringer_34,
+ aud_ringer_35,
+ aud_ringer_36,
+ aud_ringer_37, /* 75 */
+ aud_ringer_38,
+ aud_ringer_39,
+ aud_ringer_40,
+ aud_ringer_41,
+ aud_ringer_42, /* 80 */
+ aud_ringer_43,
+ aud_ringer_44,
+ aud_ringer_45,
+ aud_ringer_46,
+ aud_ringer_47, /* 85 */
+ aud_ringer_48,
+ aud_ringer_49,
+ aud_ringer_50,
+ aud_ringer_game_1,
+ aud_ringer_game_2, /* 90 */
+ aud_ringer_game_3,
+ aud_ringer_game_4,
+ aud_ringer_game_5,
+ aud_ringer_game_6,
+ aud_ringer_game_7, /* 95 */
+ aud_ringer_game_8,
+ aud_ringer_game_9,
+ aud_ringer_game_10,
+ aud_ringer_camera_1,
+ aud_ringer_prod_test_1, /* 100 */
+ aud_ringer_prod_test_2,
+ aud_ringer_prod_test_3,
+ aud_ringer_prod_test_4,
+ ringer_test_01,
+ ringer_test_02, /* 105 */
+ ringer_test_03,
+ ringer_test_04,
+ ringer_test_05,
+ ringer_test_06,
+ ringer_test_07, /* 110 */
+ ringer_test_08,
+ ringer_test_09,
+ ringer_test_10,
+ ringer_test_11,
+ ringer_test_12, /* 115 */
+ ringer_test_13,
+ ringer_test_14,
+ ringer_test_15,
+ ringer_test_16,
+ ringer_test_17, /* 120 */
+ ringer_test_18,
+ ringer_test_19,
+ ringer_test_20,
+ ringer_test_21,
+ ringer_test_22, /* 125 */
+ ringer_test_23,
+ ringer_test_24,
+ ringer_test_25,
+ ringer_test_26,
+ ringer_test_rambuff,
+
+ aud_ringer_tone_id_end
+} aud_ringer_tone_id_enum;
+
+typedef enum {
+ aud_ringer_device_sound,
+ aud_ringer_device_vibrator, /* Not used anymore (the functions for starting/stopping vibrator should be used) */
+ aud_ringer_device_sound_and_vibrator, /* Not used anymore (the functions for starting/stopping vibrator should be used) */
+ aud_ringer_device_end
+} aud_ringer_device_enum;
+
+typedef enum {
+ aud_format_smaf, /* MA2/MA3 NB: SMAF is not just SMAF. With the MA3 came extentions
+ to the SMAF, which cannot be played on a MA2 */
+ aud_format_midi, /* MA2/MA3 NB: Be aware that MIDI is many different formats,
+ only following formats are supported: SP-MIDI, SMF format 0 and 1 */
+ aud_format_smaf_phrase_l1, /* MA3/MA2 */
+ aud_format_rmd, /* MA3 */
+ aud_format_imelody, /* MA2/MA3 */
+ aud_format_buzzer, /* Buzzer */
+ aud_format_wav, /* wav */
+ aud_format_mp3, /* mp3 */
+ aud_format_smafaudio, /* pcm data in smaf header container*/
+ aud_format_end
+} aud_format_enum;
+
+/* Vibrator enumerations */
+typedef enum {
+ Aud_vibrator_mode_async_1,
+ Aud_vibrator_mode_async_2,
+ Aud_vibrator_mode_sync_1,
+ Aud_vibrator_mode_sync_2,
+ aud_vibmode_end
+} aud_vibrator_mode_enum;
+
+typedef enum {
+ aud_vibrator_on, /* 0 */
+ aud_vibrator_async_blinking1,
+ aud_vibrator_async_blinking2,
+ aud_vibrator_async_blinking3,
+ aud_vibrator_async_blinking4,
+ aud_vibrator_async_blinking5, /* 5 */
+ aud_vibrator_async_blinking6,
+ aud_vibrator_async_blinking7,
+ aud_vibrator_async_blinking8,
+ aud_vibrator_async_blinking9,
+ aud_vibrator_async_blinking10, /* 10 */
+ aud_vibrator_async_blinking11,
+ aud_vibrator_async_blinking12,
+ aud_vibrator_async_blinking13,
+ aud_vibrator_async_blinking14,
+ aud_vibrator_async_blinking15, /* 15 */
+ aud_vibrator_async_blinking16,
+ aud_vibrator_sync1,
+ aud_vibrator_sync2,
+ aud_vibrator_sync3,
+ aud_vibrator_sync4, /* 20 */
+ aud_vib_mode_end
+} aud_vib_mode;
+
+typedef enum {
+ Aud_vibrator_on_200ms,
+ Aud_vibrator_on_300ms,
+ Aud_vibrator_on_400ms,
+ Aud_vibrator_on_600ms,
+ Aud_vibrator_on_800ms,
+ Aud_vibrator_on_1000ms,
+ Aud_vibrator_on,
+ Aud_vibrator_on_end
+} aud_vibrator_on_enum;
+
+typedef enum {
+ Aud_vibrator_off_200ms,
+ Aud_vibrator_off_300ms,
+ Aud_vibrator_off_400ms,
+ Aud_vibrator_off_600ms,
+ Aud_vibrator_off,
+ Aud_vibrator_off_end
+} aud_vibrator_off_enum;
+
+/* FM radio enumerations */
+typedef enum {
+ aud_fm_radio_rssi_0,
+ aud_fm_radio_rssi_1,
+ aud_fm_radio_rssi_2,
+ aud_fm_radio_rssi_3,
+ aud_fm_radio_rssi_4,
+ aud_fm_radio_rssi_5,
+ aud_fm_radio_rssi_6,
+ aud_fm_radio_rssi_7,
+ aud_fm_radio_rssi_8,
+ aud_fm_radio_rssi_9,
+ aud_fm_radio_rssi_enum_end
+} aud_fm_radio_rssi_enum;
+
+typedef enum {
+ aud_fm_radio_seek_off, /* Station preset */
+ aud_fm_radio_seek_up, /* Auto seek up */
+ aud_fm_radio_seek_down, /* Auto seek down */
+ aud_fm_radio_seek_enum_end
+} aud_fm_radio_seek_mode_enum;
+
+typedef enum {
+ aud_fm_radio_rssi_info, /* SDL message contains RSSI level */
+ aud_fm_radio_seek_info, /* SDL message contains station seek result */
+ aud_fm_radio_rds_info, /* SDL message contains RDS data - only used for module testing */
+ aud_fm_radio_freq_info, /* SDL message contains frequency returned during seeking */
+ aud_fm_radio_sdl_opcodes_end
+} aud_fm_radio_sdl_opcodes_enum;
+
+/* Voice memo enumerations */
+typedef enum {
+ aud_vm_mode_standby,
+ aud_vm_mode_tch,
+ aud_vm_mode_end
+} aud_vm_mode_enum;
+
+typedef enum {
+ aud_dsp_format_fr,
+ aud_dsp_format_amr,
+ aud_dsp_format_pcm,
+ aud_dsp_format_amr_if2,
+ aud_dsp_format_end
+} aud_dsp_format_enum;
+
+typedef enum {
+ aud_media_ffs,
+ aud_media_mmc,
+ aud_media_ram,
+ aud_media_test_ram,
+ aud_media_I2S,
+ aud_media_mmf, /* Support for Multimedia framework */
+ aud_media_mmf_test, /* Support for Multimedia framework */
+ aud_media_vr,
+ aud_media_fs_cdrive, /*FS_FTL_DEVICE1 RW mode*/
+ aud_media_fs_edrive, /*FS_FTL_DEVICE2, RO only */
+ aud_media_fs_fdrive, /*FS_FTL_DEVICE1 RW mode*/
+ aud_media_end
+} aud_media_enum;
+
+typedef enum {
+ aud_amr_475, /* 0 */
+ aud_amr_515,
+ aud_amr_590,
+ aud_amr_670,
+ aud_amr_740,
+ aud_amr_795, /* 5 */
+ aud_amr_102,
+ aud_amr_122,
+ aud_amr_end
+} aud_amr_bitrate;
+
+
+/* PCM player/recorder enumerations */
+typedef enum {
+ aud_pcm_mode_mono,
+ aud_pcm_mode_dual_mono,
+ aud_pcm_mode_stereo,
+ aud_pcm_mode_end
+} aud_pcm_mode_enum;
+
+typedef enum {
+ aud_pcm_rate_1,
+ aud_pcm_rate_2,
+ aud_pcm_rate_3,
+ aud_pcm_rate_4,
+ aud_pcm_rate_5,
+ aud_pcm_rate_6,
+ aud_pcm_rate_7,
+ aud_pcm_rate_8,
+ aud_pcm_rate_9,
+ aud_pcm_rate_end
+} aud_pcm_sample_rate_enum;
+
+typedef enum {
+ aud_pcm_format_pcm,
+ aud_pcm_format_adpcm,
+ aud_pcm_format_wave,
+ aud_pcm_format_end
+} aud_pcm_format_enum;
+
+/* Yamaha Music API (mapi) enumerations */
+typedef enum {
+ aud_mapi_getmode, /* 0 */
+ aud_mapi_setmode,
+ aud_mapi_resetmode,
+ aud_mapi_initialize,
+ aud_mapi_terminate,
+ aud_mapi_checkload, /* 5 */
+ aud_mapi_checkunload,
+ aud_mapi_getcontentsdata,
+ aud_mapi_getphraselist,
+ aud_mapi_realtime_midiopen,
+ aud_mapi_realtime_midisendchmessage, /* 10 */
+ aud_mapi_realtime_starttimer,
+ aud_mapi_realtime_stoptimer,
+ aud_mapi_realtime_midiclose,
+ aud_mapi_realtime_midisendsysexmessage,
+ aud_mapi_realtime_midisetapivolume, /* 15 */
+ aud_mapi_realtime_midigetchvolume,
+ aud_mapi_phrase_audioload,
+ aud_mapi_phrase_audioopen,
+ aud_mapi_phrase_audiostandby,
+ aud_mapi_phrase_audiocontrol, /* 20 */
+ aud_mapi_phrase_audiostart,
+ aud_mapi_phrase_audiostop,
+ aud_mapi_phrase_audioclose,
+ aud_mapi_phrase_audiounload,
+ aud_mapi_phrase_getposition, /* 25 */
+ aud_mapi_phrase_setevhandler,
+ aud_mapi_phrase_getlink,
+ aud_mapi_phrase_setlink,
+ aud_mapi_phrase_kill,
+ aud_mapi_phrase_setdata, /* 30 */
+ aud_mapi_phrase_seek,
+ aud_mapi_phrase_getlength,
+ aud_mapi_phrase_setvolume,
+ aud_mapi_phrase_setpanpot,
+ aud_mapi_phrase_play, /* 35 */
+ aud_mapi_phrase_stop,
+ aud_mapi_phrase_removedata,
+ aud_mapi_phrase_getstatus,
+ aud_mapi_phrase_pause,
+ aud_mapi_phrase_restart, /* 40 */
+ aud_mapi_melody_control,
+ aud_mapi_melody_openarginit,
+ aud_mapi_melody_open,
+ aud_mapi_melody_standby,
+ aud_mapi_melody_waitready, /* 45 */
+ aud_mapi_melody_start,
+ aud_mapi_melody_stop,
+ aud_mapi_melody_seek,
+ aud_mapi_melody_close,
+ aud_mapi_melody_load, /* 50 */
+ aud_mapi_melody_unload,
+ aud_mapi_devicecontrol,
+ aud_mapi_melody_end
+} aud_mapi_if_enum;
+
+/* SBC Encoder enumerations */
+typedef enum {
+ aud_sbc_mono,
+ aud_sbc_dual_channel,
+ aud_sbc_stereo,
+ aud_sbc_joint_stereo,
+ aud_sbc_channel_mode_end
+} aud_sbc_encoder_channel_mode_enum;
+
+typedef enum {
+ aud_sbc_sample_rate_16_khz,
+ aud_sbc_sample_rate_32_khz,
+ aud_sbc_sample_rate_44_1_khz,
+ aud_sbc_sample_rate_48_khz,
+ aud_sbc_sample_rate_end
+} aud_sbc_encoder_sample_rate_enum;
+
+typedef enum {
+ aud_sbc_number_of_blocks_4,
+ aud_sbc_number_of_blocks_8,
+ aud_sbc_number_of_blocks_12,
+ aud_sbc_number_of_blocks_16,
+ aud_sbc_number_of_blocks_end
+} aud_sbc_encoder_number_of_blocks_enum;
+
+typedef enum {
+ aud_sbc_internal_data_encoding_mode,
+ aud_sbc_external_data_encoding_mode,
+ aud_sbc_data_mode_end
+} aud_sbc_encoder_data_mode_enum;
+
+/* I2S enumerations */
+typedef enum {
+ aud_dai_mode_normal,
+ aud_dai_mode_codec_test,
+ aud_dai_mode_acoustic_test,
+ aud_dai_mode_loopback,
+ aud_dai_mode_end
+} aud_dai_mode_enum;
+
+#if defined (aud_old_I2S_interface)
+typedef enum {
+ aud_I2Sx_mode1, /* Mode 1: 16 bit 8 kHz Master, Burst Mode, Mono */
+ aud_I2Sx_mode2, /* Mode 2: 16 bit 8 kHz Slave, Burst Mode, Mono */
+ aud_I2Sx_mode3, /* Mode 3: 16 bit 8 kHz Master, Normal Mode, Mono */
+ aud_I2Sx_mode4, /* Mode 4: 16 bit 8 kHz Slave, Normal Mode, Mono */
+ aud_I2Sx_mode5, /* Mode 5: 16 bit 16 kHz Master, Normal Mode, Mono */
+ aud_I2Sx_mode6, /* Mode 6: 16 bit 16 kHz Slave, Normal Mode, Mono */
+ aud_I2Sx_mode7, /* Mode 7: 16 bit 32 kHz Master, Normal Mode, Mono */
+ aud_I2Sx_mode8, /* Mode 8: 16 bit 32 kHz Master, Normal Mode, Stereo */
+ aud_I2Sx_mode9, /* Mode 9: 16 bit 32 kHz Slave, Normal Mode, Mono*/
+ aud_I2Sx_mode10, /* Mode 10: 16 bit 44.1 kHz Master, Normal Mode, Mono */
+ aud_I2Sx_mode11, /* Mode 11: 16 bit 44.1 kHz Master, Normal Mode, Stereo */
+ aud_I2Sx_mode12, /* Mode 12: 16 bit 44.1 kHz Slave, Normal Mode, Mono */
+ aud_I2Sx_mode13, /* Mode 13: 16 bit 48 kHz Master, Normal Mode, Mono */
+ aud_I2Sx_mode14, /* Mode 14: 16 bit 48 kHz Master, Normal Mode, Stereo */
+ aud_I2Sx_mode15, /* Mode 15: 16 bit 48 kHz Slave, Normal Mode, Mono */
+ aud_I2S2_mode_dai, /* set up the I2S2 to dai mode*/
+ aud_I2Sx_mode16, /* Mode 16: 16bit 8 kHz, Slave, Normal mode, Stereo*/
+ aud_I2Sx_mode17, /* Mode 17: 16bit 11.025 kHz, Slave, Normal mode, Stereo*/
+ aud_I2Sx_mode18, /* Mode 18: 16bit 12 kHz, Slave, Normal mode, Stereo*/
+ aud_I2Sx_mode19, /* Mode 19: 16bit 16 kHz, Slave, Normal mode, Stereo*/
+ aud_I2Sx_mode20, /* Mode 20: 16bit 22.05 kHz, Slave, Normal mode, Stereo*/
+ aud_I2Sx_mode21, /* Mode 21: 16bit 24 kHz, Slave, Normal mode, Stereo*/
+ aud_I2Sx_mode22, /* Mode 22: 16bit 32 kHz, Slave, Normal mode, Stereo*/
+ aud_I2Sx_mode23, /* Mode 23: 16bit 44.1 kHz, Slave, Normal mode, Stereo*/
+ aud_I2Sx_mode24, /* Mode 24: 16bit 48k Hz, Slave, Normal mode, Stereo*/
+ aud_I2Sx_mode25, /* Mode 25: 16bit 8kHz, Master, Normal mode, DualMono*/
+ aud_I2Sx_mode_end
+} aud_I2Sx_mode_enum;
+#endif /* aud_old_I2S_interface */
+
+typedef enum {
+ aud_I2S2_clk0,
+ aud_I2S2_clk1,
+ aud_I2S_clk_end
+} aud_I2S_clk_enum;
+
+typedef enum { /* Changes in this enum will change the validation matrix */
+ aud_I2S_master,
+ aud_I2S_slave,
+ aud_I2S_Master_Slave_end
+} aud_I2S_Master_Slave_enum;
+
+typedef enum { /* Changes in this enum will change the validation matrix */
+ aud_I2S_samplerate_08000,
+ aud_I2S_samplerate_11025,
+ aud_I2S_samplerate_12000,
+ aud_I2S_samplerate_16000,
+ aud_I2S_samplerate_22050,
+ aud_I2S_samplerate_24000,
+ aud_I2S_samplerate_32000,
+ aud_I2S_samplerate_44100,
+ aud_I2S_samplerate_48000,
+ aud_I2S_samplerate_end
+} aud_I2S_samplerate_enum;
+
+typedef enum {
+ aud_I2S_sample_width_16,
+ aud_I2S_sample_width_18,
+ aud_I2S_sample_width_20,
+ aud_I2S_sample_width_24,
+ aud_I2S_sample_width_32,
+ aud_I2S_sample_width_end
+} aud_I2S_sample_width_enum;
+
+typedef enum { /* Changes in this enum will change the validation matrix */
+ aud_I2S_transmission_mode_PCM,
+ aud_I2S_transmission_mode_normal, /* Normal I2S */
+ aud_I2S_transmission_mode_end
+} aud_I2S_transmission_mode_emum;
+
+typedef enum {
+ aud_I2S_setting_normal,
+ aud_I2S_setting_special_case1,
+ aud_I2S_setting_special_case2,
+ aud_I2S_setting_end
+} aud_I2S_setting_enum;
+
+typedef enum { /* Changes in this enum will change the validation matrix */
+ aud_I2S_mode_mono,
+ aud_I2S_mode_dual_mono,
+ aud_I2S_mode_stereo,
+ aud_I2S_mode_end
+} aud_I2S_mode_enum;
+
+typedef enum { /* Changes in this enum will change the validation matrix */
+ aud_I2S_entry_point_MMS,
+ aud_I2S_entry_point_MMS_FB, /* located at the frame-based part of the voiceband processing system */
+ aud_I2S_entry_point_External,
+ aud_I2S_entry_point_DAI,
+ aud_I2S_entry_point_end
+} aud_I2S_entry_point_enum;
+
+typedef enum {
+ aud_8_KHz,
+ aud_16_KHz,
+ aud_sample_rate_end
+}aud_sample_rate_enum;
+
+#if defined (aud_old_I2S_interface)
+typedef enum {
+ aud_disable_pcm_channel,
+ aud_enable_pcm_channel,
+ aud_enable_pcm_channel_and_Dai,
+ aud_enable_pcm_channel_externalmode,
+ aud_audio_pcm_end
+} aud_audio_pcm_enum;
+
+typedef enum {
+ aud_pcm_direction_rx,
+ aud_pcm_direction_tx,
+ aud_pcm_direction_rx_tx,
+ aud_pcm_direction_end
+} aud_pcm_direction_enum;
+#endif /* aud_old_I2S_interface */
+
+/* smaf enumerations */
+typedef enum {
+ aud_smaf_err_ok, /* 0 */
+ aud_smf_err_initialize_failed,
+ aud_smf_err_create_failed,
+ aud_smf_err_load_failed,
+ aud_smf_err_open_failed,
+ aud_smf_err_evhand_failed, /* 5 */
+ aud_smf_err_standby_failed,
+ aud_smf_err_seek_failed,
+ aud_smf_err_control_failed,
+ aud_smf_err_start_failed,
+ aud_smf_err_stop_failed, /* 10 */
+ aud_smf_err_close_failed,
+ aud_smf_err_unload_failed,
+ aud_smf_err_delete_failed,
+ aud_smf_err_invalid_parameters,
+ aud_smf_err_wrong_state /* 15 */
+} aud_smaf_error_enum;
+
+/* DSP info */
+typedef enum {
+ aud_dsp_tch_mode,
+ aud_dsp_pdch_mode,
+ aud_dsp_idle_mode,
+ aud_dsp_bb_off_mode,
+ aud_dsp_bb_off_tch_26_mode,
+ aud_dsp_mode_end
+} aud_dsp_info_enum;
+
+/* Accessory enumeration (deprecated) */
+typedef enum {
+ aud_accessory_normal, /* 0 */
+ aud_accessory_headset,
+ aud_accessory_back_speaker_normal_mic,
+ aud_accessory_midi_louder_speaker,
+ aud_accessory_bt_headset,
+ aud_accessory_stereo_phones, /* 5 */
+ aud_accessory_car_kit,
+ aud_accessory_end
+} aud_accessory_enum;
+
+/* Layer 1 info (deprecated) */
+typedef enum {
+ aud_layer1_tch_mode,
+ aud_layer1_pdch_mode,
+ aud_layer1_idle_mode,
+ aud_layer1_bb_off_mode,
+ aud_layer1_bb_off_tch_26_mode,
+ aud_layer1_mode_end
+} aud_layer1_info_enum;
+
+/* Resource capability enumerations (deprecated) */
+typedef enum {
+ uplink_paths_supported, //deprecated
+ downlink_paths_supported, //deprecated
+ resource_conflict, //deprecated
+ features_supported //deprecated
+} aud_resource_capability_enum; //this enum is only used by deprecated function AUD_get_resource_capability
+
+/* Test ram buffer enumerations */
+typedef enum {
+ aud_testrambufferstatus_free, /* ram buffer is free to allocate */
+ aud_testrambufferstatus_busy, /* ram buffer is used by players */
+ aud_testrambufferstatus_copy, /* copying is ongoing */
+ aud_testrambufferstatus_idle, /* ram buffer is allocated and copied but not used */
+ aud_testrambufferstatus_end
+} aud_testrambuffer_status_enum;
+
+/* Callback function type definitions */
+typedef int (*ptr_GetAudioBufferFunction)(
+ /* audiobuffer */ U8 **,
+ /* size */ U16 *,
+ /* user_data */ void *user_data);
+typedef void (*ptr_SetVbOnStatusFunction)(
+ /* Status */ U8);
+typedef void (*ptr_FmRadioRdsCallbackFunction)(
+ /* rds_buffer */ U8 *,
+ /* num_bytes */ U16);
+
+/* Structures for acoustic test */
+#define AUD_MAX_MIC_FREQ_NUM 3
+typedef struct {
+ U16 freq_mid;
+ U16 UpperLimit;
+ U16 LowerLimit;
+} InputMicVal_Type;
+
+typedef struct {
+ U16 actest_no_of_freq;
+ U16 actest_no_of_freq_outoflim;
+ U16 actest_scal;
+ U16 actest_ppeak;
+ U16 actest_npeak;
+ U16 actest_level_f1;
+ U16 actest_level_f2;
+ U16 actest_level_f3;
+ U16 actest_level_f4;
+ U16 actest_level_f5;
+ U16 actest_level_f6;
+} T_DSP_CMD_ACOUSTIC_TEST_RESULT_PAR;
+
+/******************************************************************************
+*
+* Global variables
+*
+******************************************************************************/
+extern U8 aud_mon_gaim_setting[2];
+
+#if defined (VMS_PRESENT)
+extern ptr_GetAudioBufferFunction getAudioBuffer;
+#endif
+
+#if defined (MP3_PRESENT)
+extern ptr_GetAudioBufferFunction mp3_getAudioBuffer;
+#endif
+
+#define AUD_GLOBAL_TONE_DUR_INTER_DEFAULT_VALUE 10
+extern U16 aud_global_tone_dur_inter;
+
+
+#ifdef _OS_WIN
+#define DISABLE_CLOCK
+#define ENABLE_CLOCK
+
+#define ATOMIC_BEGIN
+#define ATOMIC_END
+#else
+#define DISABLE_CLOCK ZOSS_DISABLE_IRQ();
+#define ENABLE_CLOCK ZOSS_ENABLE_IRQ();
+
+#define ATOMIC_BEGIN ZOSS_DISABLE_IRQ();
+#define ATOMIC_END ZOSS_ENABLE_IRQ();
+#endif
+
+#ifndef MAX
+#define MAX(A,B) ( (A) > (B) ? (A) : (B) )
+#endif
+
+/******************************************************************************
+*
+* Prototypes for interface functions
+*
+******************************************************************************/
+
+/* Resource allocation */
+S8 AUD_allocate_resource(U16 id, aud_resource_enum resource, aud_priority_enum priority);
+S8 AUD_release_resource(U8 handle);
+
+/* Path control */
+U32 AUD_get_downlnk_parallel_path_configuration(aud_downlink_source_enum path);
+U32 AUD_get_uplink_parallel_path_configuration(aud_uplink_source_enum path);
+S8 AUD_add_uplinkpath(aud_uplink_source_enum path);
+S8 AUD_remove_uplinkpath(aud_uplink_source_enum path);
+S8 AUD_add_downlinkpath(aud_downlink_source_enum path);
+S8 AUD_remove_downlinkpath(aud_downlink_source_enum path);
+S8 AUD_Pathupdate_Enable(void);
+S8 AUD_Pathupdate_Disable(void);
+S8 AUD_set_eq_vol_threshold(aud_downlink_source_enum path, aud_volume_enum eq_volume_threshold);
+
+/* Volume control */
+S8 AUD_set_resource_volume(U8 handle, aud_volume_enum volume);
+S8 AUD_set_master_volume(aud_volume_enum volume);
+S8 AUD_mute_resource(U8 handle, aud_mute_enum enable_disable,
+ aud_ul_dl_direction_enum direction);
+S8 AUD_mute_master(aud_mute_enum enable_disable);
+
+/* Speech */
+S8 AUD_speech_enable(U8 handle);
+S8 AUD_speech_disable(U8 handle);
+S8 AUD_set_EC_NR(U8 EC_on, U8 NR_on);
+
+/* Tone generator */
+S8 AUD_tone_start(U8 handle, aud_tone_id_enum tone_id,
+ U16 nof_repeats, S16 mix_factor);
+S8 AUD_tone_start_user_tone(U8 handle, void *tone_data, aud_tone_type_enum type,
+ U32 nof_tones, U16 nof_repeats, S16 mix_factor);
+S8 AUD_tone_stop(U8 handle);
+S8 AUD_tone_suspend(U8 handle, U8 slot_id);
+S8 AUD_tone_resume(U8 handle, U8 slot_id);
+S8 AUD_tone_get_total_playtime(U8 handle, aud_tone_id_enum tone_id, void *tone_data,
+ U32 nof_tones, aud_tone_type_enum type);
+S8 AUD_tone_get_play_position(U8 handle);
+S8 AUD_tone_set_play_position(U8 handle, U32 pos);
+
+/* Ringer */
+S8 AUD_ringer_start(U8 handle, aud_ringer_tone_id_enum tone_id,
+ U16 nof_repeats, aud_ringer_device_enum device);
+S8 AUD_ringer_start_user_tone(U8 handle, U8 DWD_HUGE *ringer_data,
+ U32 size, aud_format_enum format, U16 nof_repeats,
+ aud_ringer_device_enum device, U8 channel, U8 channel_volume);
+S8 AUD_ringer_stop(U8 handle, U8 channel);
+S8 AUD_ringer_set_channel_volume(U8 handle, U8 channel_volume, U8 channel);
+S8 AUD_ringer_suspend(U8 handle, U8 SlotID, U8 channel);
+S8 AUD_ringer_resume(U8 handle, U8 SlotID, U8 channel);
+S8 AUD_ringer_stop_suspend(U8 handle, U8 SlotID, U8 channel);
+S8 AUD_ringer_get_total_playtime(U8 handle, U8 DWD_HUGE *data, U32 data_size,
+ aud_format_enum format, aud_ringer_tone_id_enum tone_id);
+S8 AUD_ringer_get_playposition(U8 handle);
+S8 AUD_ringer_set_playposition(U8 handle, U8 channel, U32 offset);
+
+/* Vibrator */
+void AUD_vibrator_enable(aud_vib_mode mode, U8 channel);
+void AUD_vibrator_pause(void);
+void AUD_vibrator_disable(void);
+
+/* FM Radio */
+S8 AUD_radio_enable(U8 handle);
+S8 AUD_radio_disable(U8 handle);
+S8 AUD_radio_rssi_subscribe(U8 handle, aud_fm_radio_rssi_enum lower_threshold,
+ aud_fm_radio_rssi_enum upper_threshold);
+S8 AUD_radio_rds_subscribe(U8 handle, ptr_FmRadioRdsCallbackFunction pCbFunc);
+S8 AUD_radio_set_station(U8 handle, aud_fm_radio_seek_mode_enum seekmode,
+ U32 frequency, aud_fm_radio_rssi_enum detect_level, U8 force_mono);
+S8 AUD_radio_get_frequency(U8 handle);
+
+/* Voice memo */
+S8 AUD_vm_start_recording(
+ U8 handle,
+ aud_vm_mode_enum vm_mode,
+ aud_media_enum media_type,
+ aud_dsp_format_enum format,
+ U8 rate,
+ U16 DWD_HUGE *file_handle,
+ U32 buffer_size,
+ U32 offset);
+S8 AUD_vm_stop_recording(U8 handle);
+S8 AUD_vm_start_playback(
+ U8 handle,
+ aud_vm_mode_enum vm_mode,
+ aud_media_enum media_type,
+ aud_dsp_format_enum format,
+ U16 DWD_HUGE *file_handle,
+ U32 buffer_size,
+ U16 nof_repeats,
+ U32 offset);
+S8 AUD_vm_stop_playback(U8 handle);
+void Aud_vms_set_getbuffer_function(U8 handle, ptr_GetAudioBufferFunction func,
+ void * user_data);
+S8 AUD_vm_suspend(U8 handle, U8 slot_id);
+S8 AUD_vm_resume(U8 handle, U8 slot_id);
+S8 AUD_vm_get_total_playtime(
+ U8 handle,
+ aud_media_enum media_type,
+ aud_dsp_format_enum format,
+ U16 DWD_HUGE *file_handle,
+ U32 buffer_size,
+ U32 offset);
+S8 AUD_vm_get_play_position(U8 handle);
+S8 AUD_vm_set_play_position(
+ U8 handle,
+ U32 pos,
+ U16 DWD_HUGE *file_handle,
+ U32 buffer_size);
+S8 AUD_vm_stop_suspend(U8 handle, U8 slot_id);
+
+/* MP3 Player */
+S8 AUD_mp3_start(U8 handle, aud_media_enum media_type, U16 DWD_HUGE *file_handle,
+ U32 buffer_size, U32 id_offset, U32 start_frame, U16 nof_repeats);
+S8 AUD_mp3_stop(U8 handle);
+S8 AUD_mp3_suspend(U8 handle, U16 slot_id);
+S8 AUD_mp3_resume(U8 handle, U16 slot_id);
+S8 AUD_mp3_fastforward(U8 handle, U32 frame, U16 slot_id);
+S8 AUD_mp3_backward(U8 handle, U32 frame, U16 slot_id);
+void Aud_mp3_set_getbuffer_function(U8 handle, ptr_GetAudioBufferFunction func,
+ void * user_data);
+S8 Aud_mp3_get_current_frame(U8 handle, U16 slot_id);
+S8 AUD_mp3_get_total_playtime(U8 handle, aud_media_enum media_type,
+ U16 DWD_HUGE *file_handle, U32 buffer_size,
+ U32 id_offset );
+S8 AUD_mp3_get_play_position(U8 handle);
+S8 AUD_mp3_set_play_position(U8 handle, U32 pos, U16 DWD_HUGE *file_handle,
+ U32 buffer_size);
+S8 AUD_mp3_stop_suspend(U8 handle, U8 SlotID);
+
+/* TTY */
+S8 AUD_tty_enable(U8 handle);
+S8 AUD_tty_disable(U8 handle);
+S8 AUD_tty_set_negotiation(U8 handle,U8 on_off);
+
+/* PCM player/recorder */
+S8 AUD_pcm_intern_start_playback(
+ U8 handle,
+ aud_pcm_mode_enum mode,
+ aud_pcm_sample_rate_enum sample_rate,
+ U8 bit_rate,
+ aud_media_enum media_type,
+ aud_pcm_format_enum format,
+ U16 DWD_HUGE *file_handle,
+ U32 buffer_size,
+ U16 nof_repeats,
+ U32 start_offset);
+S8 AUD_pcm_intern_stop_playback(U8 handle);
+S8 AUD_pcm_intern_start_recording(
+ U8 handle,
+ aud_pcm_sample_rate_enum sample_rate,
+ aud_media_enum media_type,
+ aud_pcm_format_enum format,
+ U16 DWD_HUGE *file_handle,
+ U32 buffer_size,
+ U32 start_offset);
+S8 AUD_pcm_intern_stop_recording(U8 handle);
+S8 AUD_pcm_intern_getbuffer_function(U8 handle, ptr_GetAudioBufferFunction func,
+ void * user_data);
+S8 AUD_pcm_intern_suspend(U8 handle, U8 slot_id);
+S8 AUD_pcm_intern_resume(U8 handle, U8 slot_id);
+S8 AUD_pcm_intern_stop_suspend(U8 handle, U8 slot_id);
+S8 AUD_pcm_intern_get_total_playtime(U8 handle, aud_media_enum media_type,
+ aud_pcm_format_enum format, aud_pcm_sample_rate_enum sample_rate,
+ aud_pcm_mode_enum mode, U8 bit_rate,
+ U16 DWD_HUGE *file_handle, U32 buffer_size, U32 offset);
+S8 AUD_pcm_intern_get_play_position(U8 handle);
+S8 AUD_pcm_intern_set_play_position(U8 handle, U32 pos,
+ U16 DWD_HUGE *file_handle, U32 buffer_size);
+
+/* Yamaha Music API (mapi) */
+S8 AUD_mapi(U8 handle, aud_mapi_if_enum func_id, U32 parm1, U32 parm2,
+ U32 parm3, U32 parm4, U32 parm5, U32 parm6, U32 parm7);
+
+/* Inband resource, used for non-baseband audio */
+/**
+ * AUD_non_baseband_resource_start
+ *
+ * This function activates the inband virtual resource, used for non-baseband audio.
+ * Only use this when aud_resource_inband is allocated. The resource is virtual,
+ * so the usecase is non-baseband audio output on whatever paths are enabled.
+ *
+ * @param handle (generated by AUD_allocate_resource)
+ * @see AUD_allocate_resource
+ * @return signed 8bit integer (error code)
+ */
+S8 AUD_non_baseband_resource_start(U8 handle);
+
+/**
+ * AUD_non_baseband_resource_stop
+ *
+ * This function deactivates the inband virtual resource, used for non-baseband audio.
+ * Only use this when aud_resource_inband is allocated. The resource is virtual,
+ * so the usecase is non-baseband audio output on whatever paths are enabled.
+ *
+ * @param handle (generated by AUD_allocate_resource)
+ * @see AUD_allocate_resource
+ * @return signed 8bit integer (error code)
+ */
+S8 AUD_non_baseband_resource_stop(U8 handle);
+
+/* SM Power */
+/**
+ * AUD_SMPower_enable
+ *
+ * This function is to trigger the power-on of the SM Power Gain Amplifier
+ * Only use this when allocating the aud_resource_smpower. The resource is virtual,
+ * so the usecase is an external device outputting through SM power.
+ *
+ * @param handle (generated by AUD_allocate_resource)
+ * @see AUD_allocate_resource
+ * @return signed 8bit integer (error code)
+ */
+S8 AUD_SMPower_enable(U8 handle);
+/**
+ * AUD_SMPower_disable
+ *
+ * This function is to trigger the power-off of the SM Power Gain Amplifier
+ * Only use this when allocating the aud_resource_smpower. The resource is virtual,
+ * so the usecase is an external device outputting through SM power.
+ *
+ * @param handle (generated by AUD_allocate_resource)
+ * @see AUD_allocate_resource
+ * @return signed 8bit integer (error code)
+ */
+S8 AUD_SMPower_disable(U8 handle);
+
+/* SBC Encoder */
+S8 AUD_sbc_encoder_start (U8 handle,
+ aud_sbc_encoder_data_mode_enum data_mode,
+ aud_sbc_encoder_channel_mode_enum channel_mode,
+ aud_sbc_encoder_sample_rate_enum sample_rate,
+ aud_sbc_encoder_number_of_blocks_enum no_of_blocks,
+ U8 bitpool);
+S8 AUD_sbc_encoder_stop(U8 handle);
+S8 AUD_sbc_encoder_suspend(U8 handle, U8 slot_id);
+S8 AUD_sbc_encoder_resume (U8 handle, U8 slot_id);
+S8 AUD_sbc_encoder_set_getinputbuffer_function(U8 handle,
+ ptr_GetAudioBufferFunction input_buffer_function,
+ void * user_data);
+S8 AUD_sbc_encoder_set_getoutputbuffer_function(U8 handle,
+ ptr_GetAudioBufferFunction output_buffer_function,
+ void * user_data);
+
+/* I2S2 Rx and Tx*/
+#if defined (aud_old_I2S_interface)
+S8 AUD_configure_pcm_channel(U8 handle, aud_I2Sx_mode_enum mode);
+S8 AUD_pcm_channel_routing(U8 handle, U8 input_to_uplink, U8 input_to_downlink,
+ U8 output_from_uplink, U8 output_from_downlink);
+S8 AUD_pcm_channel_enable(U8 handle, aud_pcm_direction_enum direction);
+S8 AUD_pcm_channel_disable(U8 handle);
+#endif /* aud_old_I2S_interface */
+S8 AUD_I2S_enable_resource(U8 handle);
+S8 AUD_I2S_disable_resource (U8 handle);
+S8 AUD_I2S_setup_clock(aud_I2S_clk_enum clock,
+ aud_I2S_Master_Slave_enum Master_Slave,
+ aud_I2S_samplerate_enum samplerate,
+ aud_I2S_sample_width_enum sample_width,
+ aud_I2S_transmission_mode_emum transmission_mode,
+ aud_I2S_setting_enum settings,
+ aud_I2S_mode_enum I2S_mode);
+S8 AUD_I2S_setup_resource(U8 handle,
+ aud_I2S_clk_enum clock,
+ aud_I2S_entry_point_enum entry_point);
+
+/* I2S1 */
+S8 AUD_configure_bluetooth(U8 handle, aud_I2Sx_mode_enum mode);
+
+/* 3D stereo */
+S8 AUD_3D_mode_enable(void);
+S8 AUD_3D_mode_disable(void);
+
+/* Interrupts */
+void AUD_tone_handle_int(void);
+void AUD_TONE_int_handler(int vector);
+void AUD_poak_int2_handle_int(void);
+void AUD_POAK_INT2_int_handler(int vector);
+void AUD_TEAK_INT5_int_handler(int vector);
+void AUD_teak_int5_handle_int(void);
+void AUD_TEAK_INT4_int_handler(int vector);
+void AUD_teak_int4_handle_int(void);
+void AUD_TEAK_INT6_int_handler(int vector);
+void AUD_teak_int6_handle_int(void);
+void AUD_TEAK_INT7_int_handler(int vector);
+void AUD_teak_int7_handle_int(void);
+void AUD_hal_fm_radio_lisr_int_handler(int vector); /* LISR for FM Radio interrupt */
+
+/* Misc functions */
+U32 AUD_info_hw_available(void);
+void AUD_misc_dsp_info(aud_dsp_info_enum dsp_info); /* Only to be used on interface between DSP and AUD */
+S8 Aud_set_vb_on_status_function(ptr_SetVbOnStatusFunction func);
+
+/* Misc functions */
+void aud_drv_check_timeout(void);
+void aud_dai_mode(aud_dai_mode_enum dai_mode);
+void aud_drv_restart_hf(void);
+
+/* Test functions */
+U16 AUD_ptest_generic_func(void *func_req_ptr); /* generic ATCP test interface */
+U16 AUD_ptest_generic_func_memaligned(void *func_req_ptr);
+
+/* FFT analysis */
+S8 AUD_FFT_Start(U16 NoOfFrames, U16 AverageExponent, U16 RefLevel, U16 QFormat,
+ InputMicVal_Type *pMicVal);
+S8 AUD_FFT_GetResult(T_DSP_CMD_ACOUSTIC_TEST_RESULT_PAR **pFFT_Result);
+
+/* Audio Dispatcher - should only be used in aud_intf.c and aud_op.c */
+void AudioDispatcher(
+ SDL_Pid sender,
+ U8 event,
+ U16 caller_id,
+ U32 parm1,
+ U32 parm2,
+ U32 parm3,
+ U32 parm4,
+ U32 parm5,
+ U32 parm6,
+ U32 parm7,
+ U32 parm8,
+ U8 *ptr1,
+ U8 *ptr2);
+
+/******************************************************************************
+*
+* Deprecated functions
+*
+******************************************************************************/
+/* Do not remove the following functions here - file is shared between EGold, SGold and other systems */
+/* This is old stuff that has to be removed when Apoxi has cleaned out their inclusion of old files - depending on this */
+
+S8 AUD_media_to_uplink(U8 enable_disable); /* deprecated - use new path aud_media_to_uplink instead */
+S8 AUD_media_to_downlink(U8 enable_disable); /* deprecated - use new path aud_media_to_downlink_mute instead */
+U32 AUD_get_resource_capability(aud_resource_enum resource, aud_resource_capability_enum capability);
+S8 AUD_key_tone(aud_tone_id_enum key_tone, S16 mix_factor);
+S8 AUD_amp_enable(U8 handle);
+S8 AUD_amp_disable(U8 handle);
+S8 AUD_vibrator_start(U8 handle, aud_vibrator_mode_enum mode,
+ aud_vibrator_on_enum on, aud_vibrator_off_enum off);
+S8 AUD_vibrator_stop(U8 handle);
+void AUD_misc_set_accessory(aud_accessory_enum accessory);
+void AUD_misc_set_vmic(U8 status);
+S8 AUD_set_volume(U8 handle, aud_volume_enum volume);
+S8 AUD_speech_set_volume(U8 handle, aud_speech_volume_enum volume);
+S8 AUD_ringer_set_volume(U8 handle,aud_ringer_volume_enum volume);
+void AUD_init(void);
+S8 AUD_radio_init(U8 handle);
+S8 AUD_radio_config(U8 handle, void * aud_radio_config_data);
+S8 AUD_radio_read_current_status(U8 handle);
+S8 AUD_radio_mute(U8 handle,U8 mute);
+S8 AUD_speech_mute(U8 handle,aud_mute_enum status,aud_direction_enum direction);
+#ifdef USE_VOICE_SUPPORT
+void AUD_misc_layer1_info(aud_layer1_info_enum layer1_info); /* Only to be used on interface between AUD and Layer1 */
+#endif
+#endif /* _AUD_INTERFACES */
+/* End of file. */
diff --git a/cp/ps/driver/inc/misc/aud_nv.h b/cp/ps/driver/inc/misc/aud_nv.h
new file mode 100644
index 0000000..3d171b3
--- /dev/null
+++ b/cp/ps/driver/inc/misc/aud_nv.h
@@ -0,0 +1,1232 @@
+/***********************************************************************
+* Copyright (C) 2001, ZTE Corporation.
+*
+* File Name: aud_nv.h
+* File Mark:
+* Description: Provide audio NV function prototype declaration and type declaration. The audio NV type declaration is moved from eep.h.
+* Others:
+* Version: v0.5
+* Author: Wangjun
+* Date: 2009-02-14
+*
+* History 1:
+* Date:
+* Version:
+* Author:
+* Modification:
+* History 2:
+**********************************************************************/
+
+#ifndef _AUD_NV_H
+#define _AUD_NV_H
+
+
+
+/**************************************************************************
+ * Include files *
+ **************************************************************************/
+
+
+
+/**************************************************************************
+ * Macro *
+ **************************************************************************/
+#ifndef int16
+#define int16 short int
+#endif
+#ifndef int32
+#define int32 long
+#endif
+
+/* Defines to determine array sizes */
+#if 0
+#define EEP_AUD_BIQUAD_FILTERS_UL 30
+#define EEP_AUD_BIQUAD_FILTERS_DL 20
+#define EEP_AUD_BIQUAD_FILTERS_CBUF 10
+#endif
+#if 0
+#define EEP_AUD_FIR_FILTERS_UL 5
+#define EEP_AUD_FIR_FILTERS_DL 5
+#define EEP_AUD_FIR_FILTERS_CBUF 5
+#endif
+#if 0
+#define EEP_AUD_HF 8
+#endif
+#if 0
+#define EEP_AUD_ASP_UL 5
+#define EEP_AUD_DL_NR 5
+#endif
+#define EEP_AUD_UPLINK_PATHS 22
+#define EEP_AUD_DOWNLINK_PATHS 29
+
+#define AUDIO_PATHS 10 /*defined multiple places -also in aud_data.h*/
+
+/*[Begin] [lvwenhua-2010/9/16]*/
+#define EEP_CODEC_UPLINK_PATHS 3 //MAX_CODEC_INPUT_PATH
+#define EEP_CODEC_DOWNLINK_PATHS 5 //MAX_CODEC_OUTPUT_PATH
+#define EEP_VOICE_OUTPUT_VOL_LEVELS 12 /* MAX_VOICE_OUTPUT_VOL_LEVEL */
+#define EEP_MIDI_OUTPUT_VOL_LEVELS 12 /* MAX_MIDI_OUTPUT_VOL_LEVEL */
+#define EEP_TONE_OUTPUT_VOL_LEVELS 12 /* MAX_TONE_OUTPUT_VOL_LEVEL */
+#define EEP_PCM_OUTPUT_VOL_LEVELS 12 /* MAX_AUDIO_OUTPUT_VOL_LEVEL */
+/*[End] [lvwenhua-2010/9/16]*/
+
+#define EEP_AUD_CEPT 0
+#define EEP_AUD_ANSI 1
+#define EEP_AUD_JAPAN 2
+#define EEP_AUD_REGION_END 3
+
+typedef struct
+{
+ UINT16 gain_out; /********************************************************************************
+ ¹¦ÄÜ£º ÉèÖÃteak ÏÂÐеÄgain_outÔöÒæ£»
+ ȡֵ·¶Î§£º0 µ½0x7FFF,
+ 0 db ֵΪ0x1FFF£»
+ ³ö³§Öµ£º
+ Êý×éÖÐ,µ±n =0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,23,25,26,27,28ʱ:
+ aud_audio_downlink_parms[n].downlink_gain_cells.gain_out = 8192;
+ µ±n =20,21,22,24ʱ:
+ aud_audio_downlink_parms[n].downlink_gain_cells.gain_out = 0;
+ *********************************************************************************/
+
+ UINT16 gain_out_use; /********************************************************************************
+ ¹¦ÄÜ£º ÉèÖÃteak ÏÂÐеÄgain_outÔöÒæÊÇ·ñÊÇÓÉNV²ÎÊýÉèÖã»
+ ȡֵ·¶Î§£º0: ²»Ê¹ÓÃ
+ 1: ʹÓÃNV²ÎÊý
+
+ ³ö³§Öµ£º
+ Êý×éÖÐ,µ±n =0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,21,22,25,26,27,28ʱ:
+ aud_audio_downlink_parms[n].downlink_gain_cells.gain_out_use=1;
+ µ±n =20,23,24ʱ:
+ aud_audio_downlink_parms[n].downlink_gain_cells.gain_out_use=0;
+ *********************************************************************************/
+
+ UINT16 kappa0; /********************************************************************************
+ ¹¦ÄÜ£º ÉèÖÃteak ÏÂÐеÄkappa0ÔöÒæ£»
+ ȡֵ·¶Î§£º0 µ½0x7FFF,
+ 0 db ֵΪ0x7FFF£»
+ ³ö³§Öµ£º
+ Êý×éÖÐ,µ±n =0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,23,25,26,27,28ʱ:
+ aud_audio_downlink_parms[n].downlink_gain_cells.kappa0=32767;
+ µ±n =21,22,24ʱ:
+ aud_audio_downlink_parms[0].downlink_gain_cells.kappa0=0;
+ *********************************************************************************/
+
+ UINT16 kappa0_use; /********************************************************************************
+ ¹¦ÄÜ£º ÉèÖÃteak ÏÂÐеÄkappa0ÔöÒæÊÇ·ñÊÇÓÉNV²ÎÊýÉèÖã»
+ ȡֵ·¶Î§£º0: ²»Ê¹ÓÃ
+ 1: ʹÓÃNV²ÎÊý
+
+ ³ö³§Öµ£º
+ Êý×éÖÐ,µ±n =0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,25,26,27,28ʱ:
+ aud_audio_downlink_parms[n].downlink_gain_cells.kappa0_use = 1;
+ µ±n =20,21,22,23,24ʱ:
+ aud_audio_downlink_parms[n].downlink_gain_cells.kappa0_use = 0;
+ *********************************************************************************/
+
+ UINT16 mix_afe; /********************************************************************************
+ ¹¦ÄÜ£º ÉèÖÃteak ÏÂÐеĻìºÏµ½AFEµÄmix_afeÔöÒæ£»
+ ȡֵ·¶Î§£º0 µ½0x7FFF,
+ 0 db ֵΪ0x3FFF£»
+ ³ö³§Öµ£º
+ Êý×éÖÐ,µ±n =0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,24,25,26,27,28ʱ:
+ aud_audio_downlink_parms[n].downlink_gain_cells.mix_afe=1;
+ µ±n =21,22,23ʱ:
+ aud_audio_downlink_parms[n].downlink_gain_cells.mix_afe=0;
+ *********************************************************************************/
+
+ UINT16 mix_afe_use; /********************************************************************************
+ ¹¦ÄÜ£º ÉèÖÃteak ÏÂÐеĻìºÏµ½AFEµÄmix_afeÔöÒæÊÇ·ñÓÉNV²ÎÊýÉèÖã»
+ ȡֵ·¶Î§£º0: ²»Ê¹ÓÃ
+ 1: ʹÓÃNV²ÎÊý
+
+ ³ö³§Öµ£º
+ Êý×éÖÐ,µ±n =0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,24,25,26,27,28ʱ:
+ aud_audio_downlink_parms[n].downlink_gain_cells.mix_afe_use=0;
+ µ±n =21,22,23ʱ:
+ aud_audio_downlink_parms[n].downlink_gain_cells.mix_afe_use=1;
+ *********************************************************************************/
+}
+eep_aud_downlink_gain_cells_type;
+
+typedef struct
+{
+ SINT16 hf_algorithm_init; /********************************************************************************
+ ¹¦ÄÜ£º ÉèÖÃteak µÄhandsfreeµÄµÚÒ»´ÎÆô¶¯£»
+ ȡֵ·¶Î§£º0µ½0xFF
+
+ ³ö³§Öµ£º
+ ÔÚÊý×éÖУ¬aud_hf[3].hf_algorithm_init=0£¬ÆäÓ඼Ϊ397¡£
+ *********************************************************************************/
+
+ SINT16 hf_algorithm_restart; /********************************************************************************
+ ¹¦ÄÜ£º ÉèÖÃteak µÄhandsfreeµÄÖØÐÂÆô¶¯£»
+ ȡֵ·¶Î§£º0µ½0xFF
+
+ ³ö³§Öµ£º
+ ÔÚÊý×éÖУ¬aud_hf[3].hf_algorithm_restart=0£¬ÆäÓ඼Ϊ270¡£
+ *********************************************************************************/
+
+ UINT16 step_width; /********************************************************************************
+ ¹¦ÄÜ£º ÉèÖÃteak µÄhandsfreeµÄLMSµ÷½ÚµÄ²½³¤£»
+ ȡֵ·¶Î§£º0µ½32767
+
+ ³ö³§Öµ£º
+ 2200
+ *********************************************************************************/
+
+ UINT16 lms_length; /********************************************************************************
+ ¹¦ÄÜ£º ÉèÖÃteak µÄLMSÂ˲¨Æ÷ϵÊý¸öÊý£»
+ ȡֵ·¶Î§£º2µ½400
+
+ ³ö³§Öµ£º
+ 250
+ *********************************************************************************/
+
+ UINT16 lms_offset; /********************************************************************************
+ ¹¦ÄÜ£º ÉèÖÃteak µÄLMSÂ˲¨Æ÷ϵÊý¸öÊýµÄÆ«ÒÆ£»
+ ȡֵ·¶Î§£º0µ½400
+
+ ³ö³§Öµ£º
+ 8
+ *********************************************************************************/
+
+ UINT16 block_length; /********************************************************************************
+ ¹¦ÄÜ£º ÉèÖÃteak µÄLMS¿é¸üÐÂÏòÁ¿³¤¶È£»
+ ȡֵ·¶Î§£º2£¬4£¬5£¬8
+
+ ³ö³§Öµ£º
+ 5
+ *********************************************************************************/
+
+ SINT16 rxtx_relation; /********************************************************************************
+ ¹¦ÄÜ£º ÉèÖÃteakÊäÈëÊä³ö¼ûµÄ¹ØÏµ£»
+ ȡֵ·¶Î§£º-960µ½960
+
+ ³ö³§Öµ£º
+ ÔÚÊý×éÖÐ:
+ aud_hf[0].rxtx_relation=-200£»
+ aud_hf[1].rxtx_relation=150£»
+ ÆäÓ඼Ϊ-400¡£
+
+ *********************************************************************************/
+
+ UINT16 add_atten; /********************************************************************************
+ ¹¦ÄÜ£º ÉèÖÃteakµÄ×Ô¶¯Ôö񾀣¿éµÄË¥¼õ£»
+ ȡֵ·¶Î§£º0µ½960
+
+ ³ö³§Öµ£º
+ 0
+ *********************************************************************************/
+
+ UINT16 min_atten; /********************************************************************************
+ ¹¦ÄÜ£º ÉèÖÃteakµÄ×Ô¶¯Ôö񾀣¿éµÄ×îС˥¼õ£»
+ ȡֵ·¶Î§£º0µ½960
+
+ ³ö³§Öµ£º
+ 0
+ *********************************************************************************/
+
+ UINT16 max_atten; /********************************************************************************
+ ¹¦ÄÜ£º ÉèÖÃteakµÄ×Ô¶¯Ôö񾀣¿éµÄ×î´óË¥¼õ£»
+ ȡֵ·¶Î§£º0µ½960
+
+ ³ö³§Öµ£º
+ 500
+ *********************************************************************************/
+
+ UINT16 nr_sw_2; /********************************************************************************
+ ¹¦ÄÜ£º ÉèÖÃteakµÄÔëÒôÒÖÖÆÄ£¿éµÄ×î´óË¥¼õ£»
+ ȡֵ·¶Î§£º0µ½32767
+
+ ³ö³§Öµ£º
+ 16384
+ *********************************************************************************/
+
+ UINT16 nr_u_fak_0; /********************************************************************************
+ ¹¦ÄÜ£º ÉèÖÃteakµÄÔëÒôÒÖÖÆÄ£¿éµÄ´ø¿í0µÄ½µÔëÒòËØ£»
+ ȡֵ·¶Î§£º0µ½16384
+
+ ³ö³§Öµ£º
+ 16384
+ *********************************************************************************/
+
+ UINT16 nr_u_fak; /********************************************************************************
+ ¹¦ÄÜ£º ÉèÖÃteakµÄÔëÒôÒÖÖÆÄ£¿éµÄ´ø¿í1µ½7µÄ½µÔëÒòËØ£»
+ ȡֵ·¶Î§£º0µ½16384
+
+ ³ö³§Öµ£º
+ 16384
+ *********************************************************************************/
+}
+eep_aud_hf_type;
+
+typedef struct
+{
+ UINT16 coeffi; /********************************************************************************
+ ¹¦ÄÜ£º ÉèÖÃteak µÄbiquadÂ˲¨Æ÷ÊÇÉÏÐÐÂ˲¨»¹ÊÇÏÂÐÐÂ˲¨£»
+ ȡֵ·¶Î§£º0: ÉÏÐÐ
+ 1: ÏÂÐÐ
+ 2: CBuf
+
+ ³ö³§Öµ£º
+ ÉÏÐеÄÂ˲¨Æ÷(aud_uplink_biquad_filters)Ϊ: 0
+ ÏÂÐеÄÂ˲¨Æ÷(aud_downlink_biquad_filters)Ϊ: 1
+ CBuf Â˲¨Æ÷ Ϊ: 2
+ *********************************************************************************/
+
+ UINT16 a1_1; /********************************************************************************
+ ¹¦ÄÜ£º ÉèÖÃteak µÄbiquadÂ˲¨Æ÷²ÎÊý£»
+ ȡֵ·¶Î§£º0µ½0xFFFF
+
+ ³ö³§Öµ£º
+ ÉÏÐÐÂ˲¨Æ÷µÄaud_uplink_biquad_filters[0].a1_1=14878£¬ÆäÓ඼Ϊ0£»
+ ÏÂÐÐÂ˲¨Æ÷µÄaud_downlink_biquad_filters[0].a1_1=35445£¬ÆäÓ඼Ϊ0£»
+ CBuf Â˲¨Æ÷µÄaud_cbuf_biquad_filters[0].a1_1=57878; ÆäÓ඼Ϊ0¡£
+ *********************************************************************************/
+
+ UINT16 b1_1; /********************************************************************************
+ ¹¦ÄÜ£º ÉèÖÃteak µÄbiquadÂ˲¨Æ÷²ÎÊý£»
+ ȡֵ·¶Î§£º0µ½0xFFFF
+
+ ³ö³§Öµ£º
+ ÉÏÐÐÂ˲¨Æ÷µÄaud_uplink_biquad_filters[0].b1_1=13372£¬ÆäÓ඼Ϊ0£»
+ ÏÂÐÐÂ˲¨Æ÷µÄaud_downlink_biquad_filters[0].b1_1=35572£¬ÆäÓ඼Ϊ0£»
+ CBuf Â˲¨Æ÷µÄaud_cbuf_biquad_filters[0].b1_1=45294£¬ÆäÓ඼Ϊ0¡£
+ *********************************************************************************/
+
+ UINT16 a2_1; /********************************************************************************
+ ¹¦ÄÜ£º ÉèÖÃteak µÄbiquadÂ˲¨Æ÷²ÎÊý£»
+ ȡֵ·¶Î§£º0µ½0xFFFF
+
+ ³ö³§Öµ£º
+ ÉÏÐÐÂ˲¨Æ÷µÄa2_1¶¼Îª0£»
+ ÏÂÐÐÂ˲¨Æ÷µÄaud_downlink_biquad_filters[0].a2_1=30091£¬ÆäÓ඼Ϊ0£»
+ CBuf Â˲¨Æ÷µÄaud_cbuf_biquad_filters[0].a2_1=5321£¬ÆäÓ඼Ϊ0¡£
+ *********************************************************************************/
+
+ UINT16 b2_1; /********************************************************************************
+ ¹¦ÄÜ£º ÉèÖÃteak µÄbiquadÂ˲¨Æ÷²ÎÊý£»
+ ȡֵ·¶Î§£º0µ½0xFFFF
+
+ ³ö³§Öµ£º
+ ÉÏÐÐÂ˲¨Æ÷µÄb2_1¶¼Îª0£»
+ ÏÂÐÐÂ˲¨Æ÷µÄaud_downlink_biquad_filters[0].b2_1=27668£¬ÆäÓ඼Ϊ0£»
+ CBuf Â˲¨Æ÷µÄaud_cbuf_biquad_filters[0].b2_1=14049£¬ÆäÓ඼Ϊ0¡£
+ *********************************************************************************/
+
+ UINT16 a0_1; /********************************************************************************
+ ¹¦ÄÜ£º ÉèÖÃteak µÄbiquadÂ˲¨Æ÷²ÎÊý£»
+ ȡֵ·¶Î§£º0µ½0xFFFF
+
+ ³ö³§Öµ£º
+ ÉÏÐÐÂ˲¨Æ÷µÄaud_uplink_biquad_filters[0].a0_1=29756£¬ÆäÓ඼Ϊ32767£»
+ ÏÂÐÐÂ˲¨Æ÷µÄaud_downlink_biquad_filters[0].a0_1=30091£¬ÆäÓ඼Ϊ32767£»
+ CBuf Â˲¨Æ÷µÄaud_cbuf_biquad_filters[0].a0_1=14315£¬ÆäÓ඼Ϊ32767¡£
+ *********************************************************************************/
+
+ UINT16 a1_2; /********************************************************************************
+ ¹¦ÄÜ£º ÉèÖÃteak µÄbiquadÂ˲¨Æ÷²ÎÊý£»
+ ȡֵ·¶Î§£º0µ½0xFFFF
+
+ ³ö³§Öµ£º
+ ÉÏÐÐÂ˲¨Æ÷µÄaud_uplink_biquad_filters[0].a1_2=39151£¬ÆäÓ඼Ϊ0£»
+ ÏÂÐÐÂ˲¨Æ÷µÄaud_downlink_biquad_filters[0].a1_2=26488£¬ÆäÓ඼Ϊ0£»
+ CBuf Â˲¨Æ÷µÄa1_2¶¼Îª0¡£
+ *********************************************************************************/
+
+ UINT16 b1_2; /********************************************************************************
+ ¹¦ÄÜ£º ÉèÖÃteak µÄbiquadÂ˲¨Æ÷²ÎÊý£»
+ ȡֵ·¶Î§£º0µ½0xFFFF
+
+ ³ö³§Öµ£º
+ ÉÏÐÐÂ˲¨Æ÷µÄaud_uplink_biquad_filters[0].b1_2=36192£¬ÆäÓ඼Ϊ0£»
+ ÏÂÐÐÂ˲¨Æ÷µÄaud_downlink_biquad_filters[0].b1_2=24996£¬ÆäÓ඼Ϊ0£»
+ CBuf Â˲¨Æ÷µÄb1_2¶¼Îª0¡£
+ *********************************************************************************/
+
+ UINT16 a2_2; /********************************************************************************
+ ¹¦ÄÜ£º ÉèÖÃteak µÄbiquadÂ˲¨Æ÷²ÎÊý£»
+ ȡֵ·¶Î§£º0µ½0xFFFF
+
+ ³ö³§Öµ£º
+ ÉÏÐÐÂ˲¨Æ÷µÄaud_uplink_biquad_filters[0].a2_2=26385£¬ÆäÓ඼Ϊ0£»
+ ÏÂÐÐÂ˲¨Æ÷µÄaud_downlink_biquad_filters[0].a2_2=26488£¬ÆäÓ඼Ϊ0£»
+ CBuf Â˲¨Æ÷µÄa2_2¶¼Îª0¡£
+ *********************************************************************************/
+
+ UINT16 b2_2; /********************************************************************************
+ ¹¦ÄÜ£º ÉèÖÃteak µÄbiquadÂ˲¨Æ÷²ÎÊý£»
+ ȡֵ·¶Î§£º0µ½0xFFFF
+
+ ³ö³§Öµ£º
+ ÉÏÐÐÂ˲¨Æ÷µÄaud_uplink_biquad_filters[0].b2_2=26962£¬ÆäÓ඼Ϊ0£»
+ ÏÂÐÐÂ˲¨Æ÷µÄaud_downlink_biquad_filters[0].b2_2=23168£¬ÆäÓ඼Ϊ0£»
+ CBuf Â˲¨Æ÷µÄb2_2¶¼Îª0¡£
+ *********************************************************************************/
+
+ UINT16 a0_2; /********************************************************************************
+ ¹¦ÄÜ£º ÉèÖÃteak µÄbiquadÂ˲¨Æ÷²ÎÊý£»
+ ȡֵ·¶Î§£º0µ½0xFFFF
+
+ ³ö³§Öµ£º
+ ÉÏÐÐÂ˲¨Æ÷µÄaud_uplink_biquad_filters[0].a0_2=26385£¬ÆäÓ඼Ϊ32767£»
+ ÏÂÐÐÂ˲¨Æ÷µÄaud_downlink_biquad_filters[0].a0_2=26488£¬ÆäÓ඼Ϊ32767£»
+ CBuf Â˲¨Æ÷µÄa0_2¶¼Îª32767¡£
+ *********************************************************************************/
+}
+eep_aud_biquad_filters_type;
+
+
+typedef struct
+{
+ eep_aud_downlink_gain_cells_type downlink_gain_cells; /********************************************************************************
+ ¹¦ÄÜ£º ÉèÖÃteak ÏÂÐеÄÔöÒæ£»
+ ȡֵ·¶Î§£º¼ûeep_aud_downlink_gain_cells_type½á¹¹Ìå
+
+ ³ö³§Öµ£º
+ ¼ûeep_aud_downlink_gain_cells_type½á¹¹Ìå
+ *********************************************************************************/
+
+ #if 0
+ int16 biquad_filter_dl_index_8kHz; /********************************************************************************
+ ¹¦ÄÜ£º ÉèÖÃÏÂÐÐ8KHZ biquad_filterµÄË÷ÒýÖµ£»
+ ȡֵ·¶Î§£º0µ½20
+
+ ³ö³§Öµ£º
+ Êý×éÖÐ,µ±n =0,1,2,3,4,6,7,10,11,12,13,14,15,16,17,18,19,20,23,24,25,26,27,28ʱ:
+ aud_audio_downlink_parms[n].biquad_filter_dl_index_8kHz=0;
+ µ±n =5,8,9,21,22,ʱ:
+ aud_audio_downlink_parms[n].biquad_filter_dl_index_8kHz=1;
+ *********************************************************************************/
+ #endif
+ eep_aud_biquad_filters_type biquad_filter_dl_8kHz;
+
+ #if 0
+ int16 biquad_filter_dl_index_16kHz; /********************************************************************************
+ ¹¦ÄÜ£º ÉèÖÃÏÂÐÐ16KHZ biquad_filterµÄË÷ÒýÖµ£»
+ ȡֵ·¶Î§£º0µ½20
+
+ ³ö³§Öµ£º
+ Êý×éÖÐ,µ±n =0,1,2,3,4,6,7,10,11,12,13,14,15,16,17,18,19,20,23,24,25,26,27,28ʱ:
+ aud_audio_downlink_parms[n].biquad_filter_dl_index_16kHz=0;
+ µ±n =5,8,9,21,22,ʱ:
+ aud_audio_downlink_parms[n].biquad_filter_dl_index_16kHz=1;
+ *********************************************************************************/
+ #endif
+ eep_aud_biquad_filters_type biquad_filter_dl_16kHz;
+
+ #if 0
+ int16 biquad_filter_cbuf_index; /********************************************************************************
+ ¹¦ÄÜ£º ÉèÖÃCBUF biquad_filterµÄË÷ÒýÖµ£»
+ ȡֵ·¶Î§£º0µ½10
+
+ ³ö³§Öµ£º
+ Êý×éÖÐ,µ±n =0,1,2,3,4,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28ʱ:
+ aud_audio_downlink_parms[n].biquad_filter_cbuf_index=0;
+ µ±n =5ʱ:
+ aud_audio_downlink_parms[n].biquad_filter_cbuf_index=1;
+ *********************************************************************************/
+ #endif
+ eep_aud_biquad_filters_type biquad_filter_cbuf;
+
+ #if 0
+ int16 fir_filter_dl_index; /********************************************************************************
+ ¹¦ÄÜ£º ÉèÖà teakÏÂÐеÄfir_filterµÄË÷ÒýÖµ£»
+ ȡֵ·¶Î§£º0µ½5
+
+ ³ö³§Öµ£º
+ 0
+ *********************************************************************************/
+
+ int16 fir_filter_cbuf_index; /********************************************************************************
+ ¹¦ÄÜ£º ÉèÖà teakµÄCBUFµÄ fir_filterµÄË÷ÒýÖµ£»
+ ȡֵ·¶Î§£º0µ½5
+
+ ³ö³§Öµ£º
+ 0
+ *********************************************************************************/
+
+ int16 dl_nr_index; /********************************************************************************
+ ¹¦ÄÜ£º ÉèÖà teakµÄÏÂÐеÄÔëÒôÒÖÖÆµÄͨµÀµÄË÷ÒýÖµ£»
+ ȡֵ·¶Î§£º0µ½5
+
+ ³ö³§Öµ£º
+ 0
+ *********************************************************************************/
+
+ #endif
+ UINT16 side_tone_fact; /********************************************************************************
+ ¹¦ÄÜ£º ÉèÖà teakµÄside_toneµÄÖµ£»
+ ȡֵ·¶Î§£º0µ½0x7FFF
+
+ ³ö³§Öµ£º
+ Êý×éÖÐ,µ±n =0,1,2,4,6,7,8,9,10,11,12,13,16,17,18,19,24,25,26,27,28ʱ:
+ aud_audio_downlink_parms[n].side_tone_fact=500;
+ µ±n =3,5,14,15,20,23,ʱ:
+ aud_audio_downlink_parms[n].side_tone_fact=0;
+ µ±n =21,22,ʱ:
+ aud_audio_downlink_parms[n].side_tone_fact=5787;
+ *********************************************************************************/
+
+ UINT16 side_tone_fact_use; /********************************************************************************
+ ¹¦ÄÜ£º ÉèÖÃteak µÄside_toneµÄÖµÊÇ·ñÓÉNV²ÎÊýÉèÖã»
+ ȡֵ·¶Î§£º0: ²»Ê¹ÓÃ
+ 1: ʹÓÃNV²ÎÊý
+
+ ³ö³§Öµ£º
+ Êý×éÖÐ,µ±n =0,1,2,3,4,5,6,7,8,9,10,11,12,13,16,17,18,19,20,21,22,24,25,26,27,28ʱ:
+ aud_audio_downlink_parms[n].side_tone_fact_use=1;
+ µ±n =14,15,23ʱ:
+ aud_audio_downlink_parms[n].side_tone_fact_use=0;
+ *********************************************************************************/
+}
+eep_audio_downlink_parms_type; /* 14*2 bytes */
+
+typedef struct
+{
+ UINT16 scal_mic; /********************************************************************************
+ ¹¦ÄÜ£º ÉèÖÃteak ÉÏÐеÄscal_micÔöÒæ£»
+ ȡֵ·¶Î§£º0 µ½0x7FFF,
+ 0 db ֵΪ0x1FFF£»
+ ³ö³§Öµ£º
+ Êý×éÖÐ,µ±n = 0,1,4,6,7,9,13,18,19,20,21ʱ:
+ aud_audio_uplink_parms[n].uplink_gain_cells.scal_mic=6143;
+ µ±n = 2,3,5,12,14ʱ:
+ aud_audio_uplink_parms[2].uplink_gain_cells.scal_mic=8192;
+ µ±n = 10,11ʱ:
+ aud_audio_uplink_parms[2].uplink_gain_cells.scal_mic=8191;
+ µ±n = 8,15,16,17ʱ:
+ aud_audio_uplink_parms[n].uplink_gain_cells.scal_mic=0;
+ *********************************************************************************/
+
+ UINT16 scal_mic_use; /********************************************************************************
+ ¹¦ÄÜ£º ÉèÖÃteak ÉÏÐеÄscal_micÔöÒæÊÇ·ñÊÇÓÉNV²ÎÊýÉèÖã»
+ ȡֵ·¶Î§£º0: ²»Ê¹ÓÃ
+ 1: ʹÓÃNV²ÎÊý
+
+ ³ö³§Öµ£º
+ Êý×éÖÐ,µ±n =0,1,2,3,4,6,7,8,9,10,11,13,14,18,19,20,21ʱ:
+ aud_audio_uplink_parms[n].uplink_gain_cells.scal_mic_use=1;
+ µ±n =5,12,15,16,17ʱ:
+ aud_audio_uplink_parms[n].uplink_gain_cells.scal_mic_use=0;
+ *********************************************************************************/
+
+ UINT16 lambda0; /********************************************************************************
+ ¹¦ÄÜ£º ÉèÖÃteak ÉÏÐеÄlambda0ÔöÒæ£»
+ ȡֵ·¶Î§£º0 µ½0x7FFF,
+ 0 db ֵΪ0x7FFF£»
+ ³ö³§Öµ£º
+ Êý×éÖÐ,µ±n =0,1,2,3,4,5,6,7,9,12,13,14,19,20,21ʱ:
+ aud_audio_uplink_parms[n].uplink_gain_cells.lambda0=32767;
+ µ±n =8,10,11,15,16,17,18ʱ:
+ aud_audio_uplink_parms[n].uplink_gain_cells.lambda0=0;
+ *********************************************************************************/
+
+ UINT16 lambda0_use; /********************************************************************************
+ ¹¦ÄÜ£º ÉèÖÃteak ÉÏÐеÄlambda0ÔöÒæÊÇ·ñÊÇÓÉNV²ÎÊýÉèÖã»
+ ȡֵ·¶Î§£º0: ²»Ê¹ÓÃ
+ 1: ʹÓÃNV²ÎÊý
+
+ ³ö³§Öµ£º
+ Êý×éÖÐ,µ±n =0,1,2,3,4,6,7,8,9,13,19,20,21ʱ:
+ aud_audio_uplink_parms[n].uplink_gain_cells.lambda0_use=1;
+ µ±n =5,10,11,12,14,15,16,17,18ʱ:
+ aud_audio_uplink_parms[n].uplink_gain_cells.lambda0_use=0;
+ *********************************************************************************/
+
+ UINT16 gamma0; /********************************************************************************
+ ¹¦ÄÜ£º ÉèÖÃteak ÉÏÐеÄgamma0ÔöÒæ£»
+ ȡֵ·¶Î§£º0 µ½0x7FFF,
+ 0 db ֵΪ0x7FFF£»
+ ³ö³§Öµ£º
+ Êý×éÖÐ,µ±n =0,1,2,3,4,5,6,7,8,9,12,13,14,19,20,21ʱ:
+ aud_audio_uplink_parms[n].uplink_gain_cells.gamma0=32767;
+ µ±n =10,11,15,16,17,18ʱ:
+ aud_audio_uplink_parms[n].uplink_gain_cells.gamma0=0;
+ *********************************************************************************/
+
+ UINT16 gamma0_use; /********************************************************************************
+ ¹¦ÄÜ£º ÉèÖÃteak ÉÏÐеÄgamma0ÔöÒæÊÇ·ñÊÇÓÉNV²ÎÊýÉèÖã»
+ ȡֵ·¶Î§£º0: ²»Ê¹ÓÃ
+ 1: ʹÓÃNV²ÎÊý
+
+ ³ö³§Öµ£º
+ Êý×éÖÐ,µ±n =5,8,10,11,12,14,15,16,17,18ʱ:
+ aud_audio_uplink_parms[n].uplink_gain_cells.gamma0_use=0
+ µ±n =0,1,2,3,4,6,7,9,13,19,20,21ʱ:
+ aud_audio_uplink_parms[n].uplink_gain_cells.gamma0_use=1
+ *********************************************************************************/
+
+ UINT16 scal_afe; /********************************************************************************
+ ¹¦ÄÜ£º ÉèÖÃteak ÉÏÐеÄscal_afeÔöÒæ£»
+ ȡֵ·¶Î§£º0 µ½0x7FFF,
+ 0 db ֵΪ0x1FFF£»
+ ³ö³§Öµ£º
+ Êý×éÖУ¬³ýÁËaud_audio_uplink_parms[5].uplink_gain_cells.scal_afe=8192,
+ ÆäÓ඼Ϊ0.
+ *********************************************************************************/
+
+ UINT16 scal_afe_use; /********************************************************************************
+ ¹¦ÄÜ£º ÉèÖÃteak ÉÏÐеÄscal_afeÔöÒæÊÇ·ñÊÇÓÉNV²ÎÊýÉèÖã»
+ ȡֵ·¶Î§£º0: ²»Ê¹ÓÃ
+ 1: ʹÓÃNV²ÎÊý
+
+ ³ö³§Öµ£º
+ Êý×éÖУ¬³ýÁËaud_audio_uplink_parms[5].uplink_gain_cells.scal_afe_use=1,
+ ÆäÓàaud_audio_uplink_parms[n].uplink_gain_cells.scal_afe_use=0.
+ *********************************************************************************/
+
+ UINT16 scal_mic2; /********************************************************************************
+ ¹¦ÄÜ£º ÉèÖÃteak ÉÏÐеÄscal_mic2ÔöÒæ£»
+ ȡֵ·¶Î§£º0 µ½0x7FFF,
+ 0 db ֵΪ0x1FFF£»
+ ³ö³§Öµ£º
+ Êý×éÖÐ,aud_audio_uplink_parms[5].uplink_gain_cells.scal_mic2=8192;
+ ÆäÓ඼Ϊ0.
+ *********************************************************************************/
+
+ UINT16 scal_mic2_use; /********************************************************************************
+ ¹¦ÄÜ£º ÉèÖÃteak ÉÏÐеÄscal_mic2ÔöÒæÊÇ·ñÊÇÓÉNV²ÎÊýÉèÖã»
+ ȡֵ·¶Î§£º0: ²»Ê¹ÓÃ
+ 1: ʹÓÃNV²ÎÊý
+
+ ³ö³§Öµ£º
+ Êý×éÖÐ,µ±n =0,1,2,3,4,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21ʱ:
+ aud_audio_uplink_parms[n].uplink_gain_cells.scal_mic2_use=0;
+ µ±n =5ʱ:
+ aud_audio_uplink_parms[n].uplink_gain_cells.scal_mic2_use=1;
+ *********************************************************************************/
+
+ UINT16 afe_tone; /********************************************************************************
+ ¹¦ÄÜ£º ÉèÖÃteak ÉÏÐеÄafe_toneÔöÒæ£»
+ ȡֵ·¶Î§£º0 µ½0x7FFF,
+ 0 db ֵΪ0x3FFF£»
+ ³ö³§Öµ£º
+ Êý×éÖÐ,aud_audio_uplink_parms[5].uplink_gain_cells.afe_tone=16384;
+ ÆäÓ඼Ϊ0.
+ *********************************************************************************/
+
+ UINT16 afe_tone_use; /********************************************************************************
+ ¹¦ÄÜ£º ÉèÖÃteak ÉÏÐеÄafe_toneÔöÒæÊÇ·ñÊÇÓÉNV²ÎÊýÉèÖã»
+ ȡֵ·¶Î§£º0: ²»Ê¹ÓÃ
+ 1: ʹÓÃNV²ÎÊý
+
+ ³ö³§Öµ£º
+ Êý×éÖÐ,aud_audio_uplink_parms[5].uplink_gain_cells.afe_tone_use=1;
+ ÆäÓ඼Ϊ0.
+ *********************************************************************************/
+
+ UINT16 mix_pcmrec; /********************************************************************************
+ ¹¦ÄÜ£º ÉèÖÃteak ÉÏÐеĻìºÏPCMÒôÀÖµÄmix_pcmrecÔöÒæ£»
+ ȡֵ·¶Î§£º0 µ½0x7FFF,
+ 0 db ֵΪ0x3FFF£»
+ ³ö³§Öµ£º
+ Êý×éÖÐ,aud_audio_uplink_parms[12].uplink_gain_cells.mix_pcmrec=1;
+ ÆäÓ඼Ϊ0.
+ *********************************************************************************/
+}
+eep_aud_uplink_gain_cells_type;
+
+
+typedef struct
+{
+ eep_aud_uplink_gain_cells_type uplink_gain_cells; /********************************************************************************
+ ¹¦ÄÜ£º ÉèÖÃteak ÉÏÐеÄÔöÒæ£»
+ ȡֵ·¶Î§£º¼ûeep_aud_uplink_gain_cells_type½á¹¹Ìå
+
+ ³ö³§Öµ£º
+ ¼ûeep_aud_uplink_gain_cells_type½á¹¹Ìå
+ *********************************************************************************/
+
+ #if 0
+ int16 biquad_filter_ul_index_8kHz; /********************************************************************************
+ ¹¦ÄÜ£º ÉèÖÃÉÏÐÐ8KHZ biquad_filterµÄË÷ÒýÖµ£»
+ ȡֵ·¶Î§£º0µ½30
+
+ ³ö³§Öµ£º
+ Êý×éÖÐ,µ±n =0,1,2,4,5,6,7,8,9,12,13,14,15,16,17,18,19,20,21ʱ:
+ aud_audio_uplink_parms[n].biquad_filter_ul_index_8kHz=0;
+ µ±n =3,10,11ʱ:
+ aud_audio_uplink_parms[n].biquad_filter_ul_index_8kHz=1;
+ *********************************************************************************/
+ #endif
+ eep_aud_biquad_filters_type biquad_filter_ul_8kHz;
+
+ #if 0
+ int16 biquad_filter_ul_index_16kHz; /********************************************************************************
+ ¹¦ÄÜ£º ÉèÖÃÉÏÐÐ16KHZ biquad_filterµÄË÷ÒýÖµ£»
+ ȡֵ·¶Î§£º0µ½30
+
+ ³ö³§Öµ£º
+ Êý×éÖÐ,µ±n =0,1,2,4,5,6,7,8,9,12,13,14,15,16,17,18,19,20,21ʱ:
+ aud_audio_uplink_parms[n].biquad_filter_ul_index_16kHz=0;
+ µ±n =3,10,11ʱ:
+ aud_audio_uplink_parms[n].biquad_filter_ul_index_16kHz=1;
+ *********************************************************************************/
+ #endif
+ eep_aud_biquad_filters_type biquad_filter_ul_16kHz;
+
+ #if 0
+ int16 biquad_filter_ul_index_48kHz; /********************************************************************************
+ ¹¦ÄÜ£º ÉèÖÃÉÏÐÐ48KHZ biquad_filterµÄË÷ÒýÖµ£»
+ ȡֵ·¶Î§£º0µ½30
+
+ ³ö³§Öµ£º
+ Êý×éÖÐ,µ±n =0,1,2,4,5,6,7,8,9,12,13,14,15,16,17,18,19,20,21ʱ:
+ aud_audio_uplink_parms[n].biquad_filter_ul_index_48kHz=0;
+ µ±n =3,10,11ʱ:
+ aud_audio_uplink_parms[n].biquad_filter_ul_index_48kHz=1;
+ *********************************************************************************/
+ #endif
+ eep_aud_biquad_filters_type biquad_filter_ul_48kHz;
+
+ #if 0
+ int16 fir_filter_ul_index; /********************************************************************************
+ ¹¦ÄÜ£º ÉèÖà teakÉÏÐеÄfir_filterµÄË÷ÒýÖµ£»
+ ȡֵ·¶Î§£º0µ½5
+
+ ³ö³§Öµ£º
+ 0
+ *********************************************************************************/
+ #endif
+
+ #if 0
+ int16 hf_index; /********************************************************************************
+ ¹¦ÄÜ£º ÉèÖà teakµÄhandsfreeµÄË÷ÒýÖµ£»
+ ȡֵ·¶Î§£º0µ½8
+
+ ³ö³§Öµ£º
+ Êý×éÖÐ,µ±n =0,6,8,9,20,21ʱ:
+ aud_audio_uplink_parms[n].hf_index=0;
+ µ±n =1,2,4,5,10,11,12,13,14,15,16,17,18,19ʱ:
+ aud_audio_uplink_parms[n].hf_index=1;
+ µ±n =7ʱ:
+ aud_audio_uplink_parms[n].hf_index=2;
+ µ±n =3ʱ:
+ aud_audio_uplink_parms[n].hf_index=3;
+ *********************************************************************************/
+ #endif
+ eep_aud_hf_type hf;
+
+ #if 0
+ int16 asp_ul_index; /********************************************************************************
+ ¹¦ÄÜ£º ÉèÖà teakµÄÉÏÐеÄASPµÄË÷ÒýÖµ£»
+ ȡֵ·¶Î§£º0µ½5
+
+ ³ö³§Öµ£º
+ 0
+ *********************************************************************************/
+ #endif
+
+ UINT16 mic_gain; /********************************************************************************
+ ¹¦ÄÜ£º ÉèÖà teakµÄÉÏÐеÄmic_gainÔöÒæ£»
+ ȡֵ·¶Î§£º0x0µ½0x10
+
+ ³ö³§Öµ£º
+ Êý×éÖÐ,µ±n =0,1,4,7,12,13,14,18,20,21ʱ:
+ aud_audio_uplink_parms[n].mic_gain=10;
+ µ±n =2,3,ʱ:
+ aud_audio_uplink_parms[n].mic_gain=6;
+ µ±n =5,ʱ:
+ aud_audio_uplink_parms[n].mic_gain=2;
+ µ±n =6,19ʱ:
+ aud_audio_uplink_parms[n].mic_gain=14;
+ µ±n =8,9,ʱ:
+ aud_audio_uplink_parms[n].mic_gain=5;
+ µ±n =10,11,15,16,17,ʱ:
+ aud_audio_uplink_parms[n].mic_gain=0;
+ *********************************************************************************/
+
+ UINT16 mic_gain_use; /********************************************************************************
+ ¹¦ÄÜ£º ÉèÖÃteak ÏÂÐеÄmic_gainÔöÒæÊÇ·ñÓÉNV²ÎÊýÉèÖã»
+ ȡֵ·¶Î§£º0: ²»Ê¹ÓÃ
+ 1: ʹÓÃNV²ÎÊý
+
+ ³ö³§Öµ£º
+ Êý×éÖÐ,µ±n =0,1,2,4,5,6,7,9,10,11,13,14,18,19,20,21ʱ:
+ aud_audio_uplink_parms[n].mic_gain_use=1;
+ µ±n =8,12,15,16,17ʱ:
+ aud_audio_uplink_parms[n].mic_gain_use=0;
+ *********************************************************************************/
+
+ #if 0
+ UINT16 tx_dither; /********************************************************************************
+ ¹¦ÄÜ£º AFEµÄÏà¹ØÉèÖã»
+ ȡֵ·¶Î§£ºnot used
+
+
+ ³ö³§Öµ£º
+ 0
+ *********************************************************************************/
+
+ UINT16 tx_dither_use; /********************************************************************************
+ ¹¦ÄÜ£º AFEµÄÏà¹ØÉèÖÃÊÇ·ñÓÉNV²ÎÊýÉèÖã»
+ ȡֵ·¶Î§£º0: ²»Ê¹ÓÃ
+ 1: ʹÓÃNV²ÎÊý
+
+ ³ö³§Öµ£º
+ 0
+ *********************************************************************************/
+ #endif
+}
+eep_audio_uplink_parms_type; /* 23*2 bytes */
+
+typedef struct
+{
+ unsigned char audio_parms_from_eep_used; /********************************************************************************
+ ¹¦ÄÜ£º ÉèÖÃteak ÊÇ·ñʹÓÃNV²ÎÊýµÄÖµ£»
+ ȡֵ·¶Î§£º0: ²»Ê¹ ÓÃ(false)
+ 1: ʹÓã»(true)
+ ³ö³§Öµ£º
+ 1
+ *********************************************************************************/
+
+ #if 0
+ unsigned char aud_use_filters_ul; /********************************************************************************
+ ¹¦ÄÜ£º ÉèÖÃteak ÊÇ·ñʹÓÃÓïÒôͨ·µÄÉÏÐÐÂ˲¨Æ÷£»
+ ȡֵ·¶Î§£º0: ²»Ê¹ ÓÃ(none)
+ 1: ʹÓÃfirÂ˲¨Æ÷ (fir)
+ 4: ʹÓÃbiquadÂ˲¨Æ÷ (biquad)
+ 5: ʹÓÃfir+biquadÂ˲¨Æ÷(fir+biquad)
+ ³ö³§Öµ£º
+ 1
+ *********************************************************************************/
+
+
+ unsigned char aud_use_filters_dl; /********************************************************************************
+ ¹¦ÄÜ£º ÉèÖÃteak ÊÇ·ñʹÓÃÓïÒôͨ·µÄÏÂÐÐÂ˲¨Æ÷£»
+ ȡֵ·¶Î§£º0: ²»Ê¹ ÓÃ(none)
+ 1: ʹÓÃfirÂ˲¨Æ÷ (fir)
+ 4: ʹÓÃbiquadÂ˲¨Æ÷ (biquad)
+ 5: ʹÓÃfir+biquadÂ˲¨Æ÷(fir+biquad)
+ ³ö³§Öµ£º
+ 1
+ *********************************************************************************/
+
+ unsigned char aud_use_filters_cbuf; /********************************************************************************
+ ¹¦ÄÜ£º ÉèÖÃteak ÊÇ·ñʹÓÃcircular buffer 48KHZͨ·ÉϵÄÂ˲¨Æ÷£»
+ ȡֵ·¶Î§£º0: ²»Ê¹ ÓÃ(none)
+ 1: ʹÓÃfirÂ˲¨Æ÷ (fir)
+ 4: ʹÓÃbiquadÂ˲¨Æ÷ (biquad)
+ 5: ʹÓÃfir+biquadÂ˲¨Æ÷(fir+biquad)
+ ³ö³§Öµ£º
+ 1
+ *********************************************************************************/
+
+ #endif
+ #if 0
+ eep_aud_biquad_filters_type aud_uplink_biquad_filters[EEP_AUD_BIQUAD_FILTERS_UL]; /********************************************************************************
+ ¹¦ÄÜ£º ÉèÖÃteak ÉÏÐеÄbiquadÂ˲¨Æ÷²ÎÊý£»
+ ȡֵ·¶Î§£º
+ ¼ûeep_aud_biquad_filters_type½á¹¹Ì壻
+ ³ö³§Öµ£º
+ ¼ûeep_aud_biquad_filters_type½á¹¹Ì壻
+ *********************************************************************************/
+
+
+ eep_aud_biquad_filters_type aud_downlink_biquad_filters[EEP_AUD_BIQUAD_FILTERS_DL]; /********************************************************************************
+ ¹¦ÄÜ£º ÉèÖÃteak ÏÂÐеÄbiquadÂ˲¨Æ÷²ÎÊý£»
+ ȡֵ·¶Î§£º
+ ¼ûeep_aud_biquad_filters_type½á¹¹Ì壻
+ ³ö³§Öµ£º
+ ¼ûeep_aud_biquad_filters_type½á¹¹Ì壻
+ *********************************************************************************/
+
+ eep_aud_biquad_filters_type aud_cbuf_biquad_filters[EEP_AUD_BIQUAD_FILTERS_CBUF]; /********************************************************************************
+ ¹¦ÄÜ£º ÉèÖÃteak µÄcircular buffer 48KHZͨ·ÉϵÄÂ˲¨Æ÷²ÎÊý£»
+ ȡֵ·¶Î§£º
+ ¼ûeep_aud_biquad_filters_type½á¹¹Ì壻
+ ³ö³§Öµ£º
+ ¼ûeep_aud_biquad_filters_type½á¹¹Ì壻
+ *********************************************************************************/
+
+ #endif
+ #if 0
+ eep_aud_fir_filter_type aud_uplink_fir_filters[EEP_AUD_FIR_FILTERS_UL]; /********************************************************************************
+ ¹¦ÄÜ£º ÉèÖÃteak ÉÏÐеÄfirÂ˲¨Æ÷²ÎÊý£»
+ ȡֵ·¶Î§£º
+ ¼ûeep_aud_fir_filter_type½á¹¹Ì壻
+ ³ö³§Öµ£º
+ ¼ûeep_aud_fir_filter_type½á¹¹Ì壻
+ *********************************************************************************/
+
+ eep_aud_fir_filter_type aud_downlink_fir_filters[EEP_AUD_FIR_FILTERS_DL]; /********************************************************************************
+ ¹¦ÄÜ£º ÉèÖÃteak ÏÂÐеÄfirÂ˲¨Æ÷²ÎÊý£»
+ ȡֵ·¶Î§£º
+ ¼ûeep_aud_fir_filter_type½á¹¹Ì壻
+ ³ö³§Öµ£º
+ ¼ûeep_aud_fir_filter_type½á¹¹Ì壻
+ *********************************************************************************/
+
+
+ eep_aud_fir_filter_type aud_cbuf_fir_filters[EEP_AUD_FIR_FILTERS_CBUF]; /********************************************************************************
+ ¹¦ÄÜ£º ÉèÖÃteakµÄcircular buffer 48KHZͨ·ÉϵÄÂ˲¨Æ÷²ÎÊý£»
+ ȡֵ·¶Î§£º
+ ¼ûeep_aud_fir_filter_type½á¹¹Ì壻
+ ³ö³§Öµ£º
+ ¼ûeep_aud_fir_filter_type½á¹¹Ì壻
+ *********************************************************************************/
+
+ eep_aud_hf_type aud_hf[EEP_AUD_HF]; /********************************************************************************
+ ¹¦ÄÜ£º ÉèÖÃteakµÄhandsfreeµÄ²ÎÊý£»
+ ȡֵ·¶Î§£º
+ ¼ûeep_aud_hf_type½á¹¹Ì壻
+ ³ö³§Öµ£º
+ ¼ûeep_aud_hf_type½á¹¹Ì壻
+ *********************************************************************************/
+
+ #endif
+ #if 0
+ eep_aud_asp_ul_type aud_asp_ul[EEP_AUD_ASP_UL]; /********************************************************************************
+ ¹¦ÄÜ£º ÉèÖÃteakµÄÉÏÐÐͨµÀÉÏÕðµ´±£»¤µÄ²ÎÊý£»
+ ȡֵ·¶Î§£º
+ ¼ûeep_aud_asp_ul_type½á¹¹Ì壻
+ ³ö³§Öµ£º
+ ¼ûeep_aud_asp_ul_type½á¹¹Ì壻
+ *********************************************************************************/
+
+ eep_aud_dl_nr_type aud_dl_nr[EEP_AUD_DL_NR]; /********************************************************************************
+ ¹¦ÄÜ£º ÉèÖÃteakµÄÏÂÐÐͨµÀÉϽµµÍÔëÒôµÄ²ÎÊý£»
+ ȡֵ·¶Î§£º
+ ¼ûeep_aud_dl_nr_type½á¹¹Ì壻
+ ³ö³§Öµ£º
+ ¼ûeep_aud_dl_nr_type½á¹¹Ì壻
+ *********************************************************************************/
+
+ #endif
+ eep_audio_uplink_parms_type aud_audio_uplink_parms[EEP_AUD_UPLINK_PATHS]; /********************************************************************************
+ ¹¦ÄÜ£º ÉèÖÃteakµÄÉÏÐÐÓïÒôͨ·ÉϵIJÎÊý£»
+ ȡֵ·¶Î§£º
+ ¼ûeep_audio_uplink_parms_type½á¹¹Ì壻
+ ³ö³§Öµ£º
+ ¼ûeep_audio_uplink_parms_type½á¹¹Ì壻
+ *********************************************************************************/
+
+ eep_audio_downlink_parms_type aud_audio_downlink_parms[EEP_AUD_DOWNLINK_PATHS]; /********************************************************************************
+ ¹¦ÄÜ£º ÉèÖÃteakµÄÏÂÐÐÓïÒôͨ·ÉϵIJÎÊý£»
+ ȡֵ·¶Î§£º
+ ¼ûeep_audio_downlink_parms_type½á¹¹Ì壻
+ ³ö³§Öµ£º
+ ¼ûeep_audio_downlink_parms_type½á¹¹Ì壻
+ *********************************************************************************/
+
+ #if 0
+ unsigned char fill[2]; /********************************************************************************
+ ¹¦ÄÜ£º Ìî³äλ£»
+ ȡֵ·¶Î§£º0 µ½ 255
+
+ ³ö³§Öµ£º
+ 255
+ *********************************************************************************/
+ #endif
+}
+eep_aud_path_data_type;
+
+typedef struct
+{
+ SINT16 mix_afe; /********************************************************************************
+ ¹¦ÄÜ£º ÉèÖûìºÏµ½AFEµÄÒôƵ×ÊÔ´ÔöÒæÖµ£»
+ ȡֵ·¶Î§£º0 µ½0x7FFF,
+ 0 db ֵΪ0x3FFF£»
+ ³ö³§Öµ£º
+ aud_cbuf_mix_parms[5].mix_afe=0,ÆäÓ඼Ϊ32767¡£
+ *********************************************************************************/
+
+ SINT16 mix_i2s1; /********************************************************************************
+ ¹¦ÄÜ£º ÉèÖûìºÏµ½I2S1µÄÒôƵ×ÊÔ´ÔöÒæÖµ£»
+ ȡֵ·¶Î§£º0 µ½0x7FFF,
+ 0 db ֵΪ0x3FFF£»
+ ³ö³§Öµ£º
+ aud_cbuf_mix_parms[5].mix_i2s1=0£¬ÆäÓ඼Ϊ32767¡£
+ *********************************************************************************/
+}
+eepaud_static_cbuf_mix_parms_type;
+
+typedef SINT16 eep_aud_region_type;
+
+/********************************************************************************
+¹¦ÄÜ£º ÉèÖÃteakµÄÉÏÐÐÓïÒôͨµÀµÄÔöÒæ£»
+ȡֵ·¶Î§£º0 µ½0x7FFF,
+ 0 db ֵΪ0x1FFF£»
+
+³ö³§Öµ£º
+ ÔÚ³ÌÐòÖÐΪһ¸ö32λµÄÊý×é
+ ÔÚÊý×é[0] µ½ [31] ÖУ¬³ýÁË[3]Ϊ0x5000£¬ÆäÓ඼Ϊ0x2000
+*********************************************************************************/
+typedef struct
+{
+ SINT16 scal_in;
+}
+eepaud_static_scal_in_parms_type;
+
+/********************************************************************************
+¹¦ÄÜ£º ÉèÖÃteakµÄÏÂÐÐÓïÒôͨµÀµÄÔöÒæ£»
+ȡֵ·¶Î§£º0 µ½0x7FFF,
+ 0 db ֵΪ0x1FFF£»
+
+³ö³§Öµ£º
+ 0x2000
+*********************************************************************************/
+typedef struct
+{
+ SINT16 scal_out;
+}
+eepaud_static_scal_out_parms_type;
+
+/*[Begin] [lvwenhua-2010/9/16]*/
+typedef struct
+{
+ SINT16 scal_i2s1;
+}
+eepaud_static_scal_i2s1_parms_type;
+
+typedef struct
+{
+ SINT16 scal_rec;
+}
+eepaud_static_scal_rec_parms_type;
+/*[End] [lvwenhua-2010/9/16]*/
+
+typedef struct
+{
+ UINT16 gain[EEP_VOICE_OUTPUT_VOL_LEVELS];
+} eep_voice_volume_config_type;
+
+typedef struct
+{
+ UINT16 gain[EEP_MIDI_OUTPUT_VOL_LEVELS];
+} eep_midi_volume_config_type;
+
+typedef struct
+{
+ UINT16 gain[EEP_TONE_OUTPUT_VOL_LEVELS];
+} eep_tone_volume_config_type;
+
+#ifdef _USE_CODEC_TLV3212
+typedef enum
+{
+ PMIC_MIC_GAIN_MINUS_12DB = 0,
+ PMIC_MIC_GAIN_MINUS_9DB,
+ PMIC_MIC_GAIN_MINUS_6DB,
+ PMIC_MIC_GAIN_MINUS_3DB,
+ PMIC_MIC_GAIN_0DB,
+ PMIC_MIC_GAIN_PLUS_3DB,
+ PMIC_MIC_GAIN_PLUS_6DB,
+ PMIC_MIC_GAIN_PLUS_9DB,
+ PMIC_MIC_GAIN_PLUS_12DB,
+ PMIC_MIC_GAIN_PLUS_15DB,
+ PMIC_MIC_GAIN_PLUS_18DB,
+ PMIC_MIC_GAIN_MAX
+
+} EEP_PMIC_AUDIO_MIC_GAIN;
+
+typedef enum
+{
+ PMIC_OUTPGA_GAIN_PLUS_24DB = 0,
+ PMIC_OUTPGA_GAIN_PLUS_21DB,
+ PMIC_OUTPGA_GAIN_PLUS_18DB,
+ PMIC_OUTPGA_GAIN_PLUS_15DB,
+ PMIC_OUTPGA_GAIN_PLUS_12DB,
+ PMIC_OUTPGA_GAIN_PLUS_9DB,
+ PMIC_OUTPGA_GAIN_PLUS_6DB,
+ PMIC_OUTPGA_GAIN_PLUS_3DB,
+ PMIC_OUTPGA_GAIN_0DB,
+ PMIC_OUTPGA_GAIN_MINUS_3DB,
+ PMIC_OUTPGA_GAIN_MINUS_6DB,
+ PMIC_OUTPGA_GAIN_MINUS_9DB,
+ PMIC_OUTPGA_GAIN_MINUS_12DB,
+ PMIC_OUTPGA_GAIN_MINUS_15DB,
+ PMIC_OUTPGA_GAIN_MINUS_18DB,
+ PMIC_OUTPGA_GAIN_MINUS_21DB,
+ PMIC_OUTPGA_GAIN_MINUS_24DB,
+ PMIC_OUTPGA_GAIN_MINUS_27DB,
+ PMIC_OUTPGA_GAIN_MINUS_30DB,
+ PMIC_OUTPGA_GAIN_MINUS_33DB,
+ PMIC_OUTPGA_GAIN_MINUS_36DB,
+ PMIC_OUTPGA_GAIN_MINUS_39DB,
+ PMIC_OUTPGA_GAIN_MINUS_42DB,
+ PMIC_OUTPGA_GAIN_MINUS_45DB,
+ PMIC_OUTPGA_GAIN_MINUS_48DB,
+ PMIC_OUTPGA_GAIN_MINUS_51DB,
+ PMIC_OUTPGA_GAIN_MINUS_54DB,
+ PMIC_OUTPGA_GAIN_MINUS_57DB,
+ PMIC_OUTPGA_GAIN_MINUS_60DB,
+ PMIC_OUTPGA_GAIN_MINUS_63DB,
+ PMIC_OUTPGA_GAIN_MAX
+
+} EEP_PMIC_AUDIO_OUTPUT_PGA_GAIN;
+/*added by miaolin 20130805*/
+
+#else
+
+typedef enum
+{
+ PMIC_MIC_GAIN_MINUS_12DB = 0,
+ PMIC_MIC_GAIN_MINUS_9DB,
+ PMIC_MIC_GAIN_MINUS_6DB,
+ PMIC_MIC_GAIN_MINUS_3DB,
+ PMIC_MIC_GAIN_0DB,
+ PMIC_MIC_GAIN_PLUS_3DB,
+ PMIC_MIC_GAIN_PLUS_6DB,
+ PMIC_MIC_GAIN_PLUS_9DB,
+ PMIC_MIC_GAIN_PLUS_12DB,
+ PMIC_MIC_GAIN_PLUS_15DB,
+ PMIC_MIC_GAIN_PLUS_18DB,
+ PMIC_MIC_GAIN_MAX
+
+} EEP_PMIC_AUDIO_MIC_GAIN;
+
+typedef enum
+{
+ PMIC_OUTPGA_GAIN_PLUS_24DB = 0,
+ PMIC_OUTPGA_GAIN_PLUS_21DB,
+ PMIC_OUTPGA_GAIN_PLUS_18DB,
+ PMIC_OUTPGA_GAIN_PLUS_15DB,
+ PMIC_OUTPGA_GAIN_PLUS_12DB,
+ PMIC_OUTPGA_GAIN_PLUS_9DB,
+ PMIC_OUTPGA_GAIN_PLUS_6DB,
+ PMIC_OUTPGA_GAIN_PLUS_3DB,
+ PMIC_OUTPGA_GAIN_0DB,
+ PMIC_OUTPGA_GAIN_MINUS_3DB,
+ PMIC_OUTPGA_GAIN_MINUS_6DB,
+ PMIC_OUTPGA_GAIN_MINUS_9DB,
+ PMIC_OUTPGA_GAIN_MINUS_12DB,
+ PMIC_OUTPGA_GAIN_MINUS_15DB,
+ PMIC_OUTPGA_GAIN_MINUS_18DB,
+ PMIC_OUTPGA_GAIN_MINUS_21DB,
+ PMIC_OUTPGA_GAIN_MINUS_24DB,
+ PMIC_OUTPGA_GAIN_MINUS_27DB,
+ PMIC_OUTPGA_GAIN_MINUS_30DB,
+ PMIC_OUTPGA_GAIN_MINUS_33DB,
+ PMIC_OUTPGA_GAIN_MINUS_36DB,
+ PMIC_OUTPGA_GAIN_MINUS_39DB,
+ PMIC_OUTPGA_GAIN_MINUS_42DB,
+ PMIC_OUTPGA_GAIN_MINUS_45DB,
+ PMIC_OUTPGA_GAIN_MINUS_48DB,
+ PMIC_OUTPGA_GAIN_MINUS_51DB,
+ PMIC_OUTPGA_GAIN_MINUS_54DB,
+ PMIC_OUTPGA_GAIN_MINUS_57DB,
+ PMIC_OUTPGA_GAIN_MINUS_60DB,
+ PMIC_OUTPGA_GAIN_MINUS_63DB,
+ PMIC_OUTPGA_GAIN_MAX
+
+} EEP_PMIC_AUDIO_OUTPUT_PGA_GAIN;
+#endif
+
+#ifndef _USE_DATACARD
+typedef struct
+{
+ EEP_PMIC_AUDIO_OUTPUT_PGA_GAIN gain[EEP_PCM_OUTPUT_VOL_LEVELS];
+} eep_pcm_volume_config_type;
+#endif
+
+
+typedef struct
+{
+ eep_voice_volume_config_type voice_vol_gain_config[EEP_CODEC_DOWNLINK_PATHS];
+ eep_midi_volume_config_type midi_vol_gain_config[EEP_CODEC_DOWNLINK_PATHS];
+ eep_tone_volume_config_type tone_vol_gain_config[EEP_CODEC_DOWNLINK_PATHS];
+#ifndef _USE_DATACARD
+ eep_pcm_volume_config_type pcm_vol_gain_config[EEP_CODEC_DOWNLINK_PATHS];
+#endif
+}aud_eep_volume_config_type;
+
+
+#ifndef _USE_DATACARD
+typedef struct
+{
+ EEP_PMIC_AUDIO_MIC_GAIN pga_tx;
+}aud_pmic_eep_pga_tx_type;
+
+typedef struct
+{
+ EEP_PMIC_AUDIO_OUTPUT_PGA_GAIN pga_rx;
+}aud_pmic_eep_pga_rx_type;
+/*[End] [lvwenhua-2010/9/16]*/
+#endif
+
+typedef volatile struct _aud_eep_static_type
+{
+ eep_aud_path_data_type aud_path_data; /********************************************************************************
+ ¹¦ÄÜ£º ÉèÖÃteak ÓïÒôÉÏÏÂÐÐͨ·ÉϵÄÔöÒæÂ˲¨²ÎÊýµÈ£»
+ ȡֵ·¶Î§£º¸Ã½á¹¹ÌåµÄȡֵ·¶Î§¼ûeep_aud_path_data_type½á¹¹Ì壻
+
+ ³ö³§Öµ£º
+ ¼ûeep_aud_path_data_type½á¹¹Ì壻
+ *********************************************************************************/
+
+ #if 0
+ eep_external_audio_type external_audio; /********************************************************************************
+ ¹¦ÄÜ£º ÉèÖÃteak ÊÇ·ñʹÓÃÍⲿÒôƵÉ豸£»
+ ȡֵ·¶Î§£º0: ʹÄÜ
+ 1: ²»Ê¹ÄÜ£»
+ ³ö³§Öµ£º
+ 0
+ *********************************************************************************/
+ #endif
+
+ eepaud_static_cbuf_mix_parms_type aud_cbuf_mix_parms[AUDIO_PATHS]; /********************************************************************************
+ ¹¦ÄÜ£º ÉèÖûìºÏµ½I2S1ºÍAFEµÄÒôƵ×ÊÔ´ÔöÒæÖµ£»
+ ȡֵ·¶Î§£º0 µ½0x7FFF,
+ 0 db ֵΪ0x3FFF£»
+ ³ö³§Öµ£º
+ ¼ûeepaud_static_cbuf_mix_parms_type½á¹¹Ì壻
+ *********************************************************************************/
+
+
+ #if 0
+ eep_aud_fm_radio_type aud_fm_radio; /********************************************************************************
+ ¹¦ÄÜ£º ÉèÖÃteakµÄÊÕÒô»úµÄÉèÖ㬷½°¸ÖÐûÓÐʹÓøù¦ÄÜ£¬
+ Õâ¸ö²ÎÊýÔڽṹÌåÖпÉÒÔÈ¥µô£»
+ ȡֵ·¶Î§£º¸Ã½á¹¹ÌåµÄȡֵ·¶Î§¼ûeep_aud_fm_radio_type½á¹¹Ìå¡£
+
+ ³ö³§Öµ£º
+ ¼ûeep_aud_fm_radio_type½á¹¹Ìå¡£
+ *********************************************************************************/
+ #endif
+
+ eep_aud_region_type aud_region; /********************************************************************************
+ ¹¦ÄÜ£º ÉèÖÃteakµÄʹÓÃÇøÓò£»
+ ȡֵ·¶Î§£º0: EEP_AUD_CEPT
+ 1: EEP_AUD_ANSI
+ 2: EEP_AUD_JAPAN£»
+ ³ö³§Öµ£º
+ 0
+ *********************************************************************************/
+
+ eepaud_static_scal_in_parms_type aud_scal_in_parms[EEP_AUD_UPLINK_PATHS]; /********************************************************************************
+ ¹¦ÄÜ£º ÉèÖÃteakµÄÉÏÐÐÓïÒôͨµÀµÄÔöÒæ£»
+ ȡֵ·¶Î§£º0 µ½0x7FFF,
+ 0 db ֵΪ0x1FFF£»
+
+ ³ö³§Öµ£º
+ ¼ûeepaud_static_scal_in_parms_type½á¹¹Ìå¡£
+ *********************************************************************************/
+
+ eepaud_static_scal_out_parms_type aud_scal_out_parms[EEP_AUD_DOWNLINK_PATHS]; /********************************************************************************
+ ¹¦ÄÜ£º ÉèÖÃteakµÄÏÂÐÐÓïÒôͨµÀµÄÔöÒæ£»
+ ȡֵ·¶Î§£º0 µ½0x7FFF,
+ 0 db ֵΪ 0x1FFF£»
+
+ ³ö³§Öµ£º
+ ¼ûeepaud_static_scal_out_parms_type½á¹¹Ìå¡£
+ *********************************************************************************/
+ /*[Begin] [lvwenhua-2010/9/16]*/
+ eepaud_static_scal_i2s1_parms_type aud_scal_i2s1_parms[EEP_AUD_DOWNLINK_PATHS];
+ eepaud_static_scal_rec_parms_type aud_scal_rec_parms[EEP_AUD_DOWNLINK_PATHS];
+ /*[End] [lvwenhua-2010/9/16]*/
+
+#ifndef _USE_DATACARD
+ /*[Begin] [lvwenhua-2010/9/16]*/
+ aud_pmic_eep_pga_tx_type pmic_pga_tx_parms[EEP_AUD_UPLINK_PATHS];
+ aud_pmic_eep_pga_rx_type pmic_pga_rx_parms[EEP_AUD_DOWNLINK_PATHS];
+#endif
+
+ aud_eep_volume_config_type aud_volume_config;
+ /*[End] [lvwenhua-2010/9/16]*/
+}
+aud_eep_static_type;
+
+#endif /* _AUD_NV_H */
+
+
diff --git a/cp/ps/driver/inc/misc/drvs_audiomanager.h b/cp/ps/driver/inc/misc/drvs_audiomanager.h
new file mode 100644
index 0000000..3180831
--- /dev/null
+++ b/cp/ps/driver/inc/misc/drvs_audiomanager.h
@@ -0,0 +1,64 @@
+/***********************************************************************
+* Copyright (C) 2001, ZTE Corporation.
+*
+* File Name: drvs_audiomanager.h
+* File Mark:
+* Description: audio manager interface declaration.
+* Others:
+* Version: v1.0
+* Author: lvwenhua
+* Date: 2016-07-07
+*
+* History 1:
+* Date:
+* Version:
+* Author:
+* Modification:
+
+* History 2:
+**********************************************************************/
+#ifndef _DRVS_AUDIOM_H
+#define _DRVS_AUDIOM_H
+
+
+/*************************************************************************
+ * Include files *
+ *************************************************************************/
+#include "drvs_general.h"
+
+/*************************************************************************
+ * Macro *
+ *************************************************************************/
+
+
+/**************************************************************************
+ * Types *
+ **************************************************************************/
+
+typedef enum {
+ AUDIO_MANAGER_RESOURCE_VOICE=0, /* 0 */
+ AUDIO_MANAGER_RESOURCE_VOLTE, /* 1*/
+ AUDIO_MANAGER_RESOURCE_TONE_IN_SPEECH, /* 2 */
+ AUDIO_MANAGER_RESOURCE_AUDIO, /* 3*/
+ AUDIO_MANAGER_RESOURCE_FM, /* 4 */
+
+ MAX_AUDIO_MANAGER_RESOURCE
+} T_ZDrvAudioM_Resource;
+
+
+
+
+
+
+/**************************************************************************
+ * Global Variable *
+ **************************************************************************/
+
+
+
+extern SINT32 zDrvAudioM_GetResource(T_ZDrvAudioM_Resource res);
+extern SINT32 zDrvAudioM_FreeResource(T_ZDrvAudioM_Resource res);
+
+
+#endif /* _DRVS_AUDIOM_H */
+
diff --git a/cp/ps/driver/inc/misc/drvs_backlight.h b/cp/ps/driver/inc/misc/drvs_backlight.h
new file mode 100644
index 0000000..2f4e549
--- /dev/null
+++ b/cp/ps/driver/inc/misc/drvs_backlight.h
@@ -0,0 +1,62 @@
+/*********************************************************************
+ Copyright 2007 by ZTE Corporation.
+ *
+ * FileName:: drvs_backlight.h
+ * File Mark:
+* Description: This file contains the hardware interface for lcd blg driver
+* Others:
+* Version: v0.5
+* Author: zhangyingjun
+* Date: 2009-06-25
+
+* History 1:
+* Date:
+* Version:
+* Author:
+* Modification:
+* History 2:
+**********************************************************************/
+
+#ifndef _DRVS_BLG_H
+#define _DRVS_BLG_H
+
+
+/**************************************************************************
+* Function: BlgEvb_Init
+* Description: initiate the battery device
+* Parameters:
+* Input:
+* None
+* Outpu: None
+* Returns:
+* DRV_SUCCESS
+* Others: None
+**************************************************************************/
+ SINT32 BlgEvb_Open(void);
+/**************************************************************************
+* Function: BlgEvb_LcdEnable
+* Description: open the LCD backlight
+* Parameters:
+* Input:
+* bl: TRUE or FALSE value,TRUE open the blg,FALSE close theblg
+* Outpu: None
+* Returns:
+* DRV_SUCCESS
+* Others: None
+**************************************************************************/
+SINT32 BlgEvb_LcdEnable(BOOL bl);
+/**************************************************************************
+* Function: halBlg_LcdSetBrightness
+* Description: set the LCD brightness
+* Parameters:
+* Input:
+* val_brightness the value of lcd brightness
+*
+* Outpu: None
+* Returns:
+* DRV_SUCCESS
+* Others: None
+**************************************************************************/
+SINT32 BlgEvb_LcdSetBrightness(UINT32 val_brightness );
+
+#endif
diff --git a/cp/ps/driver/inc/misc/drvs_cam.h b/cp/ps/driver/inc/misc/drvs_cam.h
new file mode 100644
index 0000000..5c533a9
--- /dev/null
+++ b/cp/ps/driver/inc/misc/drvs_cam.h
@@ -0,0 +1,351 @@
+/*******************************************************************************
+ * Copyright by ZTE Corporation.
+ *
+ * File Name:
+ * File Mark:
+ * Description:
+ * Others:
+ * Version: V1.0
+ * Author: wuhui
+ * Date: 2016-9-6
+ * History 1:
+ * Date:
+ * Version:
+ * Author:
+ * Modification:
+ * History 2:
+ ********************************************************************************/
+
+#ifndef _DRVS_CAM_H
+#define _DRVS_CAM_H
+
+
+/****************************************************************************
+* Include files
+****************************************************************************/
+#include "drvs_general.h"
+
+/****************************************************************************
+* Macros
+****************************************************************************/
+//#define ZDRV_DEV_CAMERA "camera" /* device name of camera */
+
+typedef UINT32 PhyAddr;
+typedef UINT8 * T_HalCam_Buff_Addr;
+
+/****************************************************************************
+* Types
+****************************************************************************/
+typedef enum
+{
+ HAL_CAM_BUF_FREE= 0, /* Buffer isn't full filled */
+ HAL_CAM_BUF_READY= 1,
+ HAL_CAM_BUF_BUSY= 2,
+ MAX_HAL_CAM_BUF_FLAG =3
+}T_HalCam_EBufFlag;
+#if defined(_USE_RAW_BUFFER)
+typedef struct
+{
+ T_HalCam_Buff_Addr bufaddr;
+ T_HalCam_EBufFlag bufflag;
+} T_HalSensor_Buff;
+#endif
+/* sensors */
+typedef enum
+{
+ SENSOR_MAIN, /* main sensor */
+ SENSOR_SUB, /* sub sensor */
+ MAX_SENSOR_ID
+} T_ZDrv_SensorId;
+typedef enum
+{
+ //SENSOR_OV9656,
+ //SENSOR_OV7670,
+ //SENSOR_MT9D113,
+ //SENSOR_MT9V113,
+ //SENSOR_HI704,
+ #if defined(_USE_TYPE_GC6133)
+ SENSOR_GC6133,
+ #endif
+ #if defined(_USE_TYPE_BF3A01CS)
+ SENSOR_BF3A01CS,
+ #endif
+ MAX_SENSOR_DEV_TYPE
+} T_ZDrv_Sensor_DevType;
+
+/* sensor info */
+typedef struct
+{
+ T_ZDrv_Sensor_DevType tDevType; /* the sensor now using*/
+ T_ZDrv_SensorId tActivedSensor; /* the sensor now using*/
+ UINT16 uiWidth; /* max pixel width of the actived sensor */
+ UINT16 uiHeight; /* max pixel height of the actived sensor */
+ UINT16 pixelBytes;
+ BOOL fucSetZoom; /*whether to support set_zoom function */
+ BOOL fucSetImgSize; /*whether to support set_img_Size function */
+ BOOL fucSetEffect; /*whether to support set_effect function */
+ BOOL fucSetMirrorFlip; /*whether to support set MirrorFlip function */
+ BOOL fucSetBrightness; /*whether to support set Brightness function */
+ BOOL fucSetContrast; /*whether to support SetContrast function */
+ BOOL fucSetSaturation; /*whether to support SetSaturation function */
+ BOOL fucSetWhiteBalance; /*whether to support SetWhiteBalance function */
+ BOOL fucSetLightMode; /*whether to support SetLightMode function */
+ BOOL fucSetNightMode; /*whether to support SetNightMode function */
+ BOOL fucSetFrameRate; /*whether to support SetFrameRate function */
+
+ //BOOL funcSetExposureCompensation; /*whether to support ExposureCompensation function */
+ BOOL funcSetAntiFlicker;
+
+} T_ZDrv_SensorInfo;
+/* camera frame rate*/
+typedef enum
+{
+ Fps714 = 0,
+ Fps75 ,
+ Fps143 ,
+ Fps15 ,
+ Fps25 ,
+ Fps30 ,
+
+ MAX_FPS_SIZE
+} T_ZDrv_CamFps;
+
+/* output size */
+typedef enum
+{
+ OUTPUT_IMG_SXGA =0,
+ OUTPUT_IMG_VGA,
+ OUTPUT_IMG_QVGA,
+ OUTPUT_IMG_QQVGA,
+ OUTPUT_IMG_CIF ,
+ OUTPUT_IMG_QCIF,
+ OUTPUT_IMG_QQCIF ,
+ OUTPUT_IMG_USVGA,
+
+ MAX_OUTPUT_IMG_SIZE
+} T_ZDrv_CamOutputSize;
+
+/* night mode */
+typedef enum
+{
+ NIGHT_MODE_0, /* level 0*/
+ NIGHT_MODE_1, /* level 1 */
+ NIGHT_MODE_2, /* level 2 */
+
+ MAX_NIGHT_MODE
+} T_ZDrv_CamNightMode;
+
+/* zomm level */
+typedef enum
+{
+ ZOOM_LEVEL_0, /* level 0 */
+ ZOOM_LEVEL_1, /* level 1 */
+ ZOOM_LEVEL_2, /* level 2 */
+ ZOOM_LEVEL_3, /* level 3 */
+ ZOOM_LEVEL_4, /* level 4 */
+
+ MAX_ZOOM_LEVEL
+} T_ZDrv_CamZoom;
+
+/* brightness level */
+typedef enum
+{
+ BRI_LEVEL_0 = 0, /* level 0 (darkest) */
+ BRI_LEVEL_1, /* level 1 */
+ BRI_LEVEL_2, /* level 2 */
+ BRI_LEVEL_3, /* level 3 */
+ BRI_LEVEL_4, /* level 4 */
+ BRI_LEVEL_5, /* level 5 */
+ BRI_LEVEL_6, /* level 6 */
+
+ MAX_BRI_LEVEL
+} T_ZDrv_CamBrightness;
+
+/* contrast level*/
+typedef enum
+{
+ CON_LEVEL_0 = 0, /* level 0 (thinnest) */
+ CON_LEVEL_1, /* level 1 */
+ CON_LEVEL_2, /* level 2 */
+ CON_LEVEL_3, /* level 3 */
+ CON_LEVEL_4, /* level 4 */
+ CON_LEVEL_5, /* level 5 */
+ CON_LEVEL_6, /* level 6 (sharpest) */
+
+ MAX_CON_LEVEL
+} T_ZDrv_CamContrast;
+
+/* saturation level */
+typedef enum
+{
+ SAT_LEVEL_0,
+ SAT_LEVEL_1,
+ SAT_LEVEL_2,
+ SAT_LEVEL_3,
+ SAT_LEVEL_4,
+
+ MAX_SAT_LEVEL
+} T_ZDrv_CamSaturation;
+
+/* camera effect */
+typedef enum
+{
+ EFF_NORMAL = 0,
+ EFF_ANTIQUE,
+ EFF_BLUISH,
+ EFF_GREENISH,
+ EFF_REDISH,
+ EFF_YELLOW,
+ EFF_NEGATIVE,
+ EFF_BLACK_AND_WHITE,
+ EFF_BW_NEGATIVE,
+ EFF_SEPIA_GREEN,
+
+ MAX_EFF_TYPE
+} T_ZDrv_CamEffect;
+
+/* camera whiteblance */
+typedef enum
+{
+ WB_AUTO = 0,
+ WB_INSCANDSENCE,
+ WB_FLUORESCENT,//CWF
+ // WB_FLUORECWF, //cool white FLUORESCENT
+ WB_TUNGSTEN,
+ WB_SUNNY,
+ WB_CLOUDY,
+
+ MAX_WB_MODE
+} T_ZDrv_CamWhiteBalance;
+
+/* camera light mode */
+typedef enum
+{
+ LIGTH_AUTO, /* auto */
+ LIGTH_SUNNY, /* sunny */
+ LIGTH_CLOUDY, /* cloudy */
+ LIGTH_OFFICE, /* office */
+ LIGTH_HOME, /* home */
+ LIGTH_NIGHT, /* night */
+
+ MAX_LIGTH_MODE
+} T_ZDrv_CamLightMode;
+
+/* exposure compesation level */
+typedef enum
+{
+ EV_NEG_4_3 = 0, /* EV -2 */
+ EV_NEG_3_3, /* EV -1.5 */
+ EV_NEG_2_3, /* EV -1 */
+ EV_NEG_1_3, /* EV -0.5 */
+ EV_ZERO, /* EV 0 */
+ EV_POS_1_3, /* EV +0.5 */
+ EV_POS_2_3, /* EV +1 */
+ EV_POS_3_3, /* EV +1.5 */
+ EV_POS_4_3, /* EV +2 */
+
+ MAX_EV_LEVEL
+} T_ZDrv_CamExpCom;
+
+typedef enum
+{
+ HAL_CAM_WORD_MODE_YUV,
+ HAL_CAM_WORD_MODE_RGB,
+
+ MAX_HAL_CAM_WORD_MODE
+}T_HalCam_EWorkMode;
+
+typedef struct
+{
+ PhyAddr *Y;
+ PhyAddr *Cb;
+ PhyAddr *Cr;
+}T_ZDrv_YuvBuf;
+
+/* Image data buffer */
+typedef union
+{
+ T_ZDrv_YuvBuf YuvBuf;
+ PhyAddr *streamDataBuf;
+ PhyAddr*ARGBdataBuf;
+} T_ZDrv_ImageDataBuf;
+/* Pixel format. */
+typedef enum
+{
+ PIXEL_YCbCr400,
+ PIXEL_YCbCr420,
+ PIXEL_YUYV,
+// PIXEL_YCbCr422 = PIXEL_YUYV,
+// PIXEL_YCbCr422H = PIXEL_YUYV,
+// PIXEL_YCbCr422V = PIXEL_YUYV,
+ PIXEL_YCbCr444,
+ PIXEL_RGB_PLANAR,
+ PIXEL_RGB555,
+ PIXEL_RGB565,
+ PIXEL_RGB666,
+ PIXEL_RGB888,
+ PIXEL_ARGB888,
+
+ MAX_PIXEL_FORMAT
+} T_ZDrv_PixelFmt;
+
+/* camera data info */
+typedef struct
+{
+ T_ZDrv_ImageDataBuf dataBuf; /* image data buffer */
+ UINT32 Width; /* image width */
+ UINT32 Height; /* image height */
+ T_ZDrv_PixelFmt pixeFmt; /* pixel format */
+} T_ZDrv_CamDataInfo;
+
+typedef struct
+{
+ UINT32 ySize;
+ UINT32 uSize;
+ UINT32 vSize;
+
+} T_ZDrv_YuvBufSize;
+
+/* Image buffer size */
+typedef union
+{
+ T_ZDrv_YuvBufSize YuvBufSize;
+ UINT32 streamBufSize;
+ UINT32 ARGBBufSize;
+} T_ZDrv_ImageBufSzie;
+
+/* mirror type */
+typedef enum
+{
+ MIR_NONE,
+ MIR_V,
+ MIR_H,
+ MIR_V_H,
+
+ MAX_MIR_TYPE
+} T_ZDrv_MirrorType;
+
+typedef enum
+{
+ FLICKER_50HZ,
+ FLICKER_60HZ,
+
+ MAX_FLICKER_TYPE
+} T_ZDrv_AntiFlicker;
+
+
+/****************************************************************************
+* Constants
+****************************************************************************/
+
+/****************************************************************************
+* Global Variables
+****************************************************************************/
+
+/****************************************************************************
+* Function Prototypes
+****************************************************************************/
+
+
+#endif/*_FILENAME_H*/
+
diff --git a/cp/ps/driver/inc/misc/drvs_cipher.h b/cp/ps/driver/inc/misc/drvs_cipher.h
new file mode 100644
index 0000000..f6a9cc5
--- /dev/null
+++ b/cp/ps/driver/inc/misc/drvs_cipher.h
@@ -0,0 +1,223 @@
+/***********************************************************************
+* Copyright (C) 2001, ZTE Corporation.
+*
+* File Name: drvs_cipher.h
+* File Mark:
+* Description: Provide cipher module Function prototype declaration
+* and type declaration.
+* Others:
+* Version: v0.5
+* Author: Wangxia
+* Date: 2008-07-06
+*
+* History 1:
+* History 2:
+**********************************************************************/
+#ifndef _DRVS_CIPHER_H
+#define _DRVS_CIPHER_H
+/**************************************************************************
+ * Include files *
+ **************************************************************************/
+
+
+
+
+/**************************************************************************
+ * Macro
+ *
+ **************************************************************************/
+ #define ZDRV_DEV_CIPHER "cipher"
+
+
+ /**************************************************************************
+ * Types *
+ **************************************************************************/
+
+/* param of cipher interface function */
+typedef struct
+{
+ UINT32 uiDirection; /* direction param*/
+ UINT32 uiCount; /* count param for encrypt and integrity check */
+ UINT8 pcKey[16]; /* key param */
+ union
+ {
+ UINT32 uiBearer; /* bearer param for encrypt */
+ UINT32 uiFresh; /* fresh param for integrity check */
+ }uOthers;
+} T_ZDrvCipher_Param;
+
+
+typedef UINT8 aCiphKey[4][16];
+
+/*GPRS cipher struct, GPRS uses GEA1/2,GEA3 algorithm*/
+ typedef struct
+{
+ UINT8 *headerStart_ptr;
+ UINT16 headerLength;
+ UINT8 *payloadStart_ptr;
+ UINT16 payloadLength;
+ UINT16 crcLength;
+ UINT8 *destination_ptr;
+ UINT8 cipherOn;
+ UINT8 *kc_ptr;
+ UINT32 cipherInput;
+} T_ZDrvCipher_GEACipherData;
+
+
+ typedef struct
+{
+ SINT32 Direction_CK_index;
+ UINT32 Count;
+ UINT32 Bearer;
+ UINT32 Length;
+ UINT32 Fresh;
+ UINT32 *Message;
+ UINT32 Direction;
+ SINT32 IK_index;
+ UINT32 MAC_I;
+}T_ZDrvCipher_RequestListType;
+
+typedef struct
+{
+ SINT32 CiphContext;
+ SINT32 CallerId;
+ SINT32 NoRequests;
+ aCiphKey *IK;
+ aCiphKey *CK;
+ T_ZDrvCipher_RequestListType RequestList[2];
+}T_ZDrvCipher_SCiphF8;
+
+typedef T_ZDrvCipher_SCiphF8 T_ZDrvCipher_SCiphF9;
+
+/**************************************************************************
+ * Global Variables *
+ **************************************************************************/
+
+
+
+
+/**************************************************************************
+ * Function Prototypes *
+ **************************************************************************/
+/**************************************************************************
+* Functin: zDrvCipher_Encrypt
+* Description: This function is used to encrypt the input data.
+* Parameters:
+* (IN)
+* pBufferInOut: Data buffer for input and output, and its size must be a multiple of 32
+* uiBitLenInOut: Data length of input and output, 1-20000bit.
+* pPara: Stuct T_ZDrvCipher_PARA
+* (OUT)
+* pBufferInOut: Data buffer for input and output, and its size must be a multiple of 32
+* Returns:
+* T_ZDrv_ErrCode
+* Others:
+* 1. Param pBufferInOut is both for input and output.
+* 2. The data length of input and output is the same.
+ **************************************************************************/
+SINT32 zDrvCipher_Encrypt( CHAR *pBufferInOut, UINT32 uiBitLenInOut, T_ZDrvCipher_Param *pParam );
+
+
+/**************************************************************************
+* Functin: zDrvCipher_Integrity
+* Description: This function is used to chech the integrity.
+* Parameters:
+* (IN)
+* pBufferInOut: Data buffer for input and output, and its size must be a multiple of 32
+* uiBitLenInOut: Data length of input and output.
+* pPara: Stuct T_ZDrvCipher_PARA
+* (OUT)
+* pBufferInOut: Data buffer for input and output, and its size must be a multiple of 32
+* Returns:
+* T_ZDrv_ErrCode
+* Others:
+* 1. Param pBufferInOut is both for input and output.
+* 2. The data length of output is 32bit.
+ **************************************************************************/
+SINT32 zDrvCipher_Integrity( CHAR *pBufferInOut, UINT32 uiBitLenIn, T_ZDrvCipher_Param *pParam );
+
+/***************************************************************************************
+* Function: zDrvCipher_GprsUintInitialise
+* Description: This function is used to initialize ciphering semaphoreme,olny using for GPRS communication
+* Parameters:
+* Input:
+* None
+* Output:
+* None
+* Returns:
+* None
+***************************************************************************************/
+VOID zDrvCipher_GprsUnitInitialise (VOID);
+
+
+/***************************************************************************************
+* Function: zDrvCipher_GprsUnitEncode
+* Description: This function is used to encode data of uplink,olny using for GPRS communication
+* Parameters:
+* Input:
+* pointer of T_ZDrvCipher_GEACipherData struct
+* Output:
+* None
+* Returns:
+* None
+***************************************************************************************/
+VOID zDrvCipher_GprsUnitEncode(T_ZDrvCipher_GEACipherData * ciData_ptr);
+
+/***************************************************************************************
+* Function: zDrvCipher_GgprsUnitEncode
+* Description: This function is used to encode data of uplink,olny using for GPRS communication
+* Parameters:
+* Input:
+* pointer of T_ZDrvCipher_GEACipherData struct
+* Output:
+* None
+* Returns:
+* None
+***************************************************************************************/
+VOID zDrvCipher_GgprsUnitEncode(T_ZDrvCipher_GEACipherData * ciData_ptr);
+
+
+/***************************************************************************************
+* Function: zDrvCipher_GprsUnitDecode
+* Description: This function is used to encode data of downlink,olny using for GPRS communication
+* Parameters:
+* Input:
+* pointer of T_ZDrvCipher_GEACipherData struct
+* Output:
+* None
+* Returns:
+* None
+***************************************************************************************/
+BOOL zDrvCipher_GprsUnitDecode(T_ZDrvCipher_GEACipherData * ciData_ptr);
+
+/****************************************************************************************
+* Function: zDrvCipher_F8
+* Description: This function is used to cipher data using f8 algorithm which be used in UMTS communication
+* Parameters:
+* Input:
+* pointer of T_ZDrvCipher_SCiphF8 struct
+* Output:
+* None
+* Returns:
+* 1: faild
+* 0:success
+****************************************************************************************/
+BOOL zDrvCipher_F8(T_ZDrvCipher_SCiphF8 *f8_ctrl);
+
+
+/***************************************************************************************
+* Function: zDrvCipher_F9
+* Description: This function is used to cipher data using f9 algorithm which be used in UMTS communication
+* Parameters:
+* Input:
+* pointer of T_ZDrvCipher_GEACipherData struct
+* Output:
+* None
+* Returns:
+* None
+***************************************************************************************/
+VOID zDrvCipher_F9(T_ZDrvCipher_SCiphF9 *f9_ctrl);
+
+
+#endif /* _CIPHER_API_H */
+
diff --git a/cp/ps/driver/inc/misc/drvs_codec.h b/cp/ps/driver/inc/misc/drvs_codec.h
new file mode 100644
index 0000000..b93e577
--- /dev/null
+++ b/cp/ps/driver/inc/misc/drvs_codec.h
@@ -0,0 +1,581 @@
+/**
+ * @file drvs_codec.h
+ * @brief Public APIs of Codec drivers
+ *
+ * Copyright (C) 2017 Sanechips Technology Co., Ltd.
+ * @author Xinqiang Xu <xu.xinqiang@sanechips.com.cn>
+ * @ingroup si_cp_drv_id
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ */
+
+#ifndef _DRV_CODEC_TLV3100_H
+#define _DRV_CODEC_TLV3100_H
+
+
+/****************************************************************************
+* Include files
+****************************************************************************/
+#include "drvs_i2s.h"
+#include "drvs_voiceprocess.h"
+
+/*******************************************************************************
+ * Macro definitions *
+ ******************************************************************************/
+
+/*******************************************************************************
+ * Type definitions *
+ ******************************************************************************/
+typedef unsigned long T_ZDrvCodec_Handle;
+
+typedef enum {
+ VOICE_SOURCE,
+ AUDIO_SOURCE,
+ EXTERN_AUDIO,
+
+ SOURCE_MAX
+} T_ZDrvCodec_SourceType;
+
+typedef enum {
+ AUDIO_I2S_NONE,
+ AUDIO_I2S0,
+ AUDIO_I2S1,
+
+ AUDIO_I2S_MAX
+} T_ZDrvCodec_AudioI2SChannel;
+
+typedef enum {
+ I2S_MASTER_MODE,
+ I2S_SLAVE_MODE,
+
+ I2S_MODE_MAX
+} T_ZDrvCodec_AudioI2SMode;
+
+typedef enum {
+ AUDIO_SAMPLE_8K,
+ AUDIO_SAMPLE_11_025_KHZ, /* Use 11.025 kHz sampling rate. */
+ AUDIO_SAMPLE_12_KHZ, /* Use 12 kHz sampling rate. */
+ AUDIO_SAMPLE_16K,
+ AUDIO_SAMPLE_22_050_KHZ, /* Use 22.050 kHz sampling rate. */
+ AUDIO_SAMPLE_24_KHZ, /* Use 24 kHz sampling rate. */
+ AUDIO_SAMPLE_32K,
+ AUDIO_SAMPLE_44_1K,
+ AUDIO_SAMPLE_48K,
+ AUDIO_SAMPLE_64_KHZ, /* Use 64 kHz sampling rate */
+ AUDIO_SAMPLE_96_KHZ, /* Use 96 kHz sampling rate. */
+
+ AUDIO_SAMPLE_MAX
+} T_ZDrvCodec_AudioSample;
+
+typedef enum {
+ AUDIO_INPUT_HANDSET,
+ AUDIO_INPUT_SPEAKER,
+ AUDIO_INPUT_HEADSET,
+ AUDIO_INPUT_BLUETOOTH,
+ AUDIO_INPUT_FM_ANATODIG,
+ AUDIO_INPUT_FM_ANATOANA,
+
+ AUDIO_INPUT_MAX
+} T_ZDrvCodec_InDevice;
+
+typedef enum {
+ AUDIO_OUTPUT_RECEIVER,
+ AUDIO_OUTPUT_SPEAKER,
+ AUDIO_OUTPUT_HEADSET,
+ AUDIO_OUTPUT_BLUETOOTH,
+ AUDIO_OUTPUT_HEADSET_SPEAKER,
+ AUDIO_OUTPUT_FM_ANATODIG_HEADSET,
+ AUDIO_OUTPUT_FM_ANATODIG_SPEAKER,
+ AUDIO_OUTPUT_FM_ANATOANA_HEADSET,
+ AUDIO_OUTPUT_FM_ANATOANA_SPEAKER,
+
+ AUDIO_OUTPUT_MAX
+} T_ZDrvCodec_OutDevice;
+
+typedef enum {
+ CLSD_GAIN_PLUS_6DB,
+ CLSD_GAIN_PLUS_12DB,
+ CLSD_GAIN_PLUS_18DB,
+ CLSD_GAIN_PLUS_24DB,
+
+ CLSD_GAIN_MAX
+} T_ZDrvCodec_ClsD_Vol;
+
+typedef enum {
+ CLSAB_GAIN_PLUS_0DB,
+ CLSAB_GAIN_PLUS_1DB,
+ CLSAB_GAIN_PLUS_2DB,
+ CLSAB_GAIN_PLUS_3DB,
+ CLSAB_GAIN_PLUS_4DB,
+ CLSAB_GAIN_PLUS_5DB,
+ CLSAB_GAIN_PLUS_6DB,
+ CLSAB_GAIN_PLUS_7DB,
+ CLSAB_GAIN_PLUS_8DB,
+ CLSAB_GAIN_PLUS_9DB,
+
+ CLSAB_GAIN_MAX
+} T_ZDrvCodec_ClsAB_Vol;
+
+typedef enum {
+ CODEC_INPATH_DIG_GAIN_MINUS_12DB = 0,
+ CODEC_INPATH_DIG_GAIN_MINUS_11DB,
+ CODEC_INPATH_DIG_GAIN_MINUS_10DB,
+ CODEC_INPATH_DIG_GAIN_MINUS_9DB,
+ CODEC_INPATH_DIG_GAIN_MINUS_8DB,
+ CODEC_INPATH_DIG_GAIN_MINUS_7DB,
+ CODEC_INPATH_DIG_GAIN_MINUS_6DB,
+ CODEC_INPATH_DIG_GAIN_MINUS_5DB,
+ CODEC_INPATH_DIG_GAIN_MINUS_4DB,
+ CODEC_INPATH_DIG_GAIN_MINUS_3DB,
+ CODEC_INPATH_DIG_GAIN_MINUS_2DB,
+ CODEC_INPATH_DIG_GAIN_MINUS_1DB,
+ CODEC_INPATH_DIG_GAIN_0DB,
+ CODEC_INPATH_DIG_GAIN_PLUS_1DB,
+ CODEC_INPATH_DIG_GAIN_PLUS_2DB,
+ CODEC_INPATH_DIG_GAIN_PLUS_3DB,
+ CODEC_INPATH_DIG_GAIN_PLUS_4DB,
+ CODEC_INPATH_DIG_GAIN_PLUS_5DB,
+ CODEC_INPATH_DIG_GAIN_PLUS_6DB,
+ CODEC_INPATH_DIG_GAIN_PLUS_7DB,
+ CODEC_INPATH_DIG_GAIN_PLUS_8DB,
+ CODEC_INPATH_DIG_GAIN_PLUS_9DB,
+ CODEC_INPATH_DIG_GAIN_PLUS_10DB,
+ CODEC_INPATH_DIG_GAIN_PLUS_11DB,
+ CODEC_INPATH_DIG_GAIN_PLUS_12DB,
+ CODEC_INPATH_DIG_GAIN_PLUS_13DB,
+ CODEC_INPATH_DIG_GAIN_PLUS_14DB,
+ CODEC_INPATH_DIG_GAIN_PLUS_15DB,
+ CODEC_INPATH_DIG_GAIN_PLUS_16DB,
+ CODEC_INPATH_DIG_GAIN_PLUS_17DB,
+ CODEC_INPATH_DIG_GAIN_PLUS_18DB,
+ CODEC_INPATH_DIG_GAIN_PLUS_19DB,
+ CODEC_INPATH_DIG_GAIN_PLUS_20DB,
+
+ CODEC_INPATH_DIG_GAIN_MAX
+} T_ZDrvCodec_InPath_Digital_Gain;
+
+typedef enum {
+ CODEC_OUTPATH_DIG_GAIN_PLUS_24DB = 0,
+ CODEC_OUTPATH_DIG_GAIN_PLUS_23DB,
+ CODEC_OUTPATH_DIG_GAIN_PLUS_22DB,
+ CODEC_OUTPATH_DIG_GAIN_PLUS_21DB,
+ CODEC_OUTPATH_DIG_GAIN_PLUS_20DB,
+ CODEC_OUTPATH_DIG_GAIN_PLUS_19DB,
+ CODEC_OUTPATH_DIG_GAIN_PLUS_18DB,
+ CODEC_OUTPATH_DIG_GAIN_PLUS_17DB,
+ CODEC_OUTPATH_DIG_GAIN_PLUS_16DB,
+ CODEC_OUTPATH_DIG_GAIN_PLUS_15DB,
+ CODEC_OUTPATH_DIG_GAIN_PLUS_14DB,
+ CODEC_OUTPATH_DIG_GAIN_PLUS_13DB,
+ CODEC_OUTPATH_DIG_GAIN_PLUS_12DB,
+ CODEC_OUTPATH_DIG_GAIN_PLUS_11DB,
+ CODEC_OUTPATH_DIG_GAIN_PLUS_10DB,
+ CODEC_OUTPATH_DIG_GAIN_PLUS_9DB,
+ CODEC_OUTPATH_DIG_GAIN_PLUS_8DB,
+ CODEC_OUTPATH_DIG_GAIN_PLUS_7DB,
+ CODEC_OUTPATH_DIG_GAIN_PLUS_6DB,
+ CODEC_OUTPATH_DIG_GAIN_PLUS_5DB,
+ CODEC_OUTPATH_DIG_GAIN_PLUS_4DB,
+ CODEC_OUTPATH_DIG_GAIN_PLUS_3DB,
+ CODEC_OUTPATH_DIG_GAIN_PLUS_2DB,
+ CODEC_OUTPATH_DIG_GAIN_PLUS_1DB,
+ CODEC_OUTPATH_DIG_GAIN_0DB,
+ CODEC_OUTPATH_DIG_GAIN_MINUS_1DB,
+ CODEC_OUTPATH_DIG_GAIN_MINUS_2DB,
+ CODEC_OUTPATH_DIG_GAIN_MINUS_3DB,
+ CODEC_OUTPATH_DIG_GAIN_MINUS_4DB,
+ CODEC_OUTPATH_DIG_GAIN_MINUS_5DB,
+ CODEC_OUTPATH_DIG_GAIN_MINUS_6DB,
+ CODEC_OUTPATH_DIG_GAIN_MINUS_7DB,
+ CODEC_OUTPATH_DIG_GAIN_MINUS_8DB,
+ CODEC_OUTPATH_DIG_GAIN_MINUS_9DB,
+ CODEC_OUTPATH_DIG_GAIN_MINUS_10DB,
+ CODEC_OUTPATH_DIG_GAIN_MINUS_11DB,
+ CODEC_OUTPATH_DIG_GAIN_MINUS_12DB,
+ CODEC_OUTPATH_DIG_GAIN_MINUS_13DB,
+ CODEC_OUTPATH_DIG_GAIN_MINUS_14DB,
+ CODEC_OUTPATH_DIG_GAIN_MINUS_15DB,
+ CODEC_OUTPATH_DIG_GAIN_MINUS_16DB,
+ CODEC_OUTPATH_DIG_GAIN_MINUS_17DB,
+ CODEC_OUTPATH_DIG_GAIN_MINUS_18DB,
+ CODEC_OUTPATH_DIG_GAIN_MINUS_19DB,
+ CODEC_OUTPATH_DIG_GAIN_MINUS_20DB,
+ CODEC_OUTPATH_DIG_GAIN_MINUS_21DB,
+ CODEC_OUTPATH_DIG_GAIN_MINUS_22DB,
+ CODEC_OUTPATH_DIG_GAIN_MINUS_23DB,
+ CODEC_OUTPATH_DIG_GAIN_MINUS_24DB,
+ CODEC_OUTPATH_DIG_GAIN_MINUS_25DB,
+ CODEC_OUTPATH_DIG_GAIN_MINUS_26DB,
+ CODEC_OUTPATH_DIG_GAIN_MINUS_27DB,
+ CODEC_OUTPATH_DIG_GAIN_MINUS_28DB,
+ CODEC_OUTPATH_DIG_GAIN_MINUS_29DB,
+ CODEC_OUTPATH_DIG_GAIN_MINUS_30DB,
+ CODEC_OUTPATH_DIG_GAIN_MINUS_31DB,
+ CODEC_OUTPATH_DIG_GAIN_MINUS_32DB,
+ CODEC_OUTPATH_DIG_GAIN_MINUS_33DB,
+ CODEC_OUTPATH_DIG_GAIN_MINUS_34DB,
+ CODEC_OUTPATH_DIG_GAIN_MINUS_35DB,
+ CODEC_OUTPATH_DIG_GAIN_MINUS_36DB,
+ CODEC_OUTPATH_DIG_GAIN_MINUS_37DB,
+ CODEC_OUTPATH_DIG_GAIN_MINUS_38DB,
+ CODEC_OUTPATH_DIG_GAIN_MINUS_39DB,
+ CODEC_OUTPATH_DIG_GAIN_MINUS_40DB,
+ CODEC_OUTPATH_DIG_GAIN_MINUS_41DB,
+ CODEC_OUTPATH_DIG_GAIN_MINUS_42DB,
+ CODEC_OUTPATH_DIG_GAIN_MINUS_43DB,
+ CODEC_OUTPATH_DIG_GAIN_MINUS_44DB,
+ CODEC_OUTPATH_DIG_GAIN_MINUS_45DB,
+ CODEC_OUTPATH_DIG_GAIN_MINUS_46DB,
+ CODEC_OUTPATH_DIG_GAIN_MINUS_47DB,
+ CODEC_OUTPATH_DIG_GAIN_MINUS_48DB,
+ CODEC_OUTPATH_DIG_GAIN_MINUS_49DB,
+ CODEC_OUTPATH_DIG_GAIN_MINUS_50DB,
+ CODEC_OUTPATH_DIG_GAIN_MINUS_51DB,
+ CODEC_OUTPATH_DIG_GAIN_MINUS_52DB,
+ CODEC_OUTPATH_DIG_GAIN_MINUS_53DB,
+ CODEC_OUTPATH_DIG_GAIN_MINUS_54DB,
+ CODEC_OUTPATH_DIG_GAIN_MINUS_55DB,
+ CODEC_OUTPATH_DIG_GAIN_MINUS_56DB,
+ CODEC_OUTPATH_DIG_GAIN_MINUS_57DB,
+ CODEC_OUTPATH_DIG_GAIN_MINUS_58DB,
+ CODEC_OUTPATH_DIG_GAIN_MINUS_59DB,
+ CODEC_OUTPATH_DIG_GAIN_MINUS_60DB,
+ CODEC_OUTPATH_DIG_GAIN_MINUS_61DB,
+ CODEC_OUTPATH_DIG_GAIN_MINUS_62DB,
+ CODEC_OUTPATH_DIG_GAIN_MINUS_63DB,
+
+ CODEC_OUTPATH_DIG_GAIN_MAX
+} T_ZDrvCodec_OutPath_Digital_Gain;
+
+typedef enum {
+ MICBIAS_OUT_POWERDOWN = 0,
+ MICBIAS_OUT_2V,
+ MICBIAS_OUT_2_5V,
+ MICBIAS_OUT_AVDD,
+
+ MICBIAS_OUT_MAX
+} T_ZDrvMicBias_Ctrl;
+
+/**
+ * @brief describe the codec agc Parameter
+ * @param onOff agc function enable
+ * @param targetLevel the Level of target
+ * @param attackTime attack Time
+ * @param decayTime decay Time
+ * @param noiseDebounce noise Debounce
+ * @param signalDebounce signal Debounce
+ * @param noiseThreshold the Threshold of the noise
+ * @param maxgain the max gain
+ */
+typedef struct _T_AudCodec_AGC_Parameter {
+ SINT8 onOff;
+ SINT8 targetLevel;
+ SINT8 attackTime;
+ SINT8 decayTime;
+ SINT8 noiseDebounce;
+ SINT8 signalDebounce;
+ SINT8 noiseThreshold;
+
+ SINT8 maxgain;
+} T_ZDrvAudCodec_AGC_Parameter;
+
+/**
+ * @brief describe the codec drc Parameter
+ * @param onOff drc function enable
+ * @param threshold threshold value
+ * @param hysteresis hysteresis value
+ * @param holdTime hold Time
+ * @param attackRate attack Rate
+ * @param decayRate decay Rate
+ */
+typedef struct _T_AudCodec_DRC_Parameter {
+ SINT8 onOff;
+ SINT8 threshold;
+ SINT8 hysteresis;
+ SINT8 holdTime;
+ SINT8 attackRate;
+ SINT8 decayRate;
+} T_ZDrvAudCodec_DRC_Parameter;
+
+typedef enum {
+ CODEC_DATA_LEGTH_8BIT = 0,
+ CODEC_DATA_LEGTH_16BIT,
+ CODEC_DATA_LEGTH_20BIT,
+ CODEC_DATA_LEGTH_24BIT,
+ CODEC_DATA_LEGTH_32BIT,
+
+ CODEC_DATA_LEGTH_MAX
+} T_ZDrvCodec_DataLength;
+
+typedef enum {
+ CODEC_DATA_TRACK_DOUBLE = 0,
+ CODEC_DATA_TRACK_LEFT,
+ CODEC_DATA_TRACK_RIGHT,
+
+ CODEC_DATA_TRACK_MAX
+} T_ZDrvCodec_DataTrack;
+
+typedef enum {
+ CODEC_BUS_I2S,
+ CODEC_BUS_RJF, /* Right-Justified Mode */
+ CODEC_BUS_LJF, /* Left-Justified Mode */
+ CODEC_BUS_DSP,
+ CODEC_BUS_TDM,
+ CODEC_BUS_MAX
+} T_AudCodec_BusMode;
+
+#define T_ZDrvCodec_BusMode T_AudCodec_BusMode
+
+/**
+ * @brief describe the i2s transfer protocol
+ * @param audI2SChannel Audio I2S Channel
+ * @param masterSlave Audio I2S Mode;
+ * @param busMode bus mode
+ * @param dataLength Codec Data Length
+ * @param dataTrack codec data type
+ */
+typedef struct _T_Codec_UseProtocol {
+ T_ZDrvCodec_AudioI2SChannel audI2SChannel;
+ T_ZDrvCodec_AudioI2SMode masterSlave;
+ T_ZDrvCodec_BusMode busMode;
+ T_ZDrvCodec_DataLength dataLength;
+ T_ZDrvCodec_DataTrack dataTrack;
+} T_ZDrvCodec_UseProtocol;
+
+/*******************************************************************************
+ * Global variable declarations *
+ ******************************************************************************/
+
+
+/*******************************************************************************
+ * Global function declarations *
+ ******************************************************************************/
+/**
+ * @brief Open codec,set parameters.
+ *
+ * @param handle Pointer to T_ZDrvCodec_Handle.
+ * @param srcType Pointer to T_ZDrvCodec_SourceType
+ *
+ * @return 0-DRV_SUCCESS, other-error
+ */
+SINT32 zDrvCodec_Open(T_ZDrvCodec_Handle *handle, T_ZDrvCodec_SourceType srcType);
+
+/**
+* @brief close codec, power off.
+*
+* @param handle T_ZDrvCodec_Handle
+*
+* @return 0-DRV_SUCCESS, other-error
+*/
+SINT32 zDrvCodec_Close(T_ZDrvCodec_Handle *handle);
+
+/**
+* @brief Set i2s protocol.
+*
+* @param handle T_ZDrvCodec_Handle
+* @param channel T_ZDrvCodec_AudioI2SChannel
+* @param masterSlave T_ZDrvCodec_AudioI2SMode
+*
+* @return 0-DRV_SUCCESS, other-error
+*/
+SINT32 zDrvCodec_SetProtocal(T_ZDrvCodec_Handle handle, T_ZDrvCodec_AudioI2SChannel channel, T_ZDrvCodec_AudioI2SMode masterSlave);
+
+/**
+* @brief Set i2s clock.
+*
+* @param handle T_ZDrvCodec_Handle
+* @param sample T_ZDrvCodec_AudioSample
+*
+* @return 0-DRV_SUCCESS, other-error
+*/
+SINT32 zDrvCodec_SetClock(T_ZDrvCodec_Handle handle, T_ZDrvCodec_AudioSample sample);
+
+/**
+* @brief reset codec.
+*
+* @param handle T_ZDrvCodec_Handle
+* @return 0-DRV_SUCCESS, other-error
+*/
+SINT32 zDrvCodec_Reset(T_ZDrvCodec_Handle handle);
+
+/**
+* @brief Set the input path of the codec.
+*
+* @param handle T_ZDrvCodec_Handle
+* @param dev T_ZDrvCodec_InDevice
+* @param onoff BOOL
+*
+* @return 0-DRV_SUCCESS, other-error
+*/
+SINT32 zDrvCodec_SetInPath(T_ZDrvCodec_Handle handle, T_ZDrvCodec_InDevice dev, BOOL onoff);
+
+/**
+* @brief Set the output path of the codec.
+*
+* @param handle T_ZDrvCodec_Handle
+* @param dev T_ZDrvCodec_InDevice
+* @param onoff BOOL
+*
+* @return 0-DRV_SUCCESS, other-error
+*/
+SINT32 zDrvCodec_SetOutPath(T_ZDrvCodec_Handle handle, T_ZDrvCodec_OutDevice dev, BOOL onoff);
+
+/**
+* @brief Enable the audio path.
+*
+* @param handle T_ZDrvCodec_Handle
+* @return 0-DRV_SUCCESS, other-error
+*/
+SINT32 zDrvCodec_AudioEnable(T_ZDrvCodec_Handle handle);
+
+/**
+* @brief Disable the audio path.
+*
+* @param handle T_ZDrvCodec_Handle
+*
+* @return 0-DRV_SUCCESS, other-error
+*/
+SINT32 zDrvCodec_AudioDisable(T_ZDrvCodec_Handle handle);
+
+/**
+* @brief Set the ClsD volume.
+*
+* @param handle T_ZDrvCodec_Handle
+* @param vol T_ZDrvCodec_ClsD_Vol
+* @return 0-DRV_SUCCESS, other-error
+*/
+SINT32 zDrvCodec_Set_ClsD_Vol(T_ZDrvCodec_Handle handle, T_ZDrvCodec_ClsD_Vol vol);
+
+/**
+* @brief Set the ClsAB volume.
+*
+* @param handle T_ZDrvCodec_Handle
+* @param vol UINT8
+*
+* @return 0-DRV_SUCCESS, other-error
+*/
+SINT32 zDrvCodec_Set_ClsAB_Vol(T_ZDrvCodec_Handle handle, UINT8 vol);
+
+/**
+* @brief Set the output Analog volume of the Output path.
+*
+* @param handle T_ZDrvCodec_Handle
+* @param vol SINT8
+*
+* @return 0-DRV_SUCCESS, other-error
+*/
+SINT32 zDrvCodec_Set_Outpath_Ana_Vol(T_ZDrvCodec_Handle handle, SINT8 vol);
+
+/**
+* @brief Set the Analog volume of the Input path.
+*
+* @param handle T_ZDrvCodec_Handle
+* @param vol SINT8
+* @return 0-DRV_SUCCESS, other-error
+*/
+SINT32 zDrvCodec_Set_Inpath_Ana_Vol(T_ZDrvCodec_Handle handle, SINT8 vol);
+
+/**
+* @brief Set the Digital volume of the Input path.
+*
+* @param handle T_ZDrvCodec_Handle
+* @param invol T_ZDrvCodec_InPath_Digital_Gain
+*
+* @return 0-DRV_SUCCESS, other-error
+*/
+SINT32 zDrvCodec_Set_Inpath_Dig_Vol(T_ZDrvCodec_Handle handle, T_ZDrv_VpVol vol);
+
+/**
+* @brief Set the Digital volume of the Output path.
+*
+* @param handle T_ZDrvCodec_Handle
+* @param invol T_ZDrv_VpVol
+* @return 0-DRV_SUCCESS, other-error
+*/
+SINT32 zDrvCodec_Set_Outpath_Dig_Vol(T_ZDrvCodec_Handle handle, T_ZDrv_VpVol vol);
+
+/**
+* @brief Set the Side Tone.
+*
+* @param handle T_ZDrvCodec_Handle
+* @param onoff BOOL
+*
+* @return 0-DRV_SUCCESS, other-error
+*/
+SINT32 zDrvCodec_SetSideTone(T_ZDrvCodec_Handle handle, BOOL onoff);
+
+/**
+* @brief Set the Mic Bias.
+*
+* @param handle T_ZDrvCodec_Handle
+* @param micBiasCtrl T_ZDrvMicBias_Ctrl
+*
+* @return 0-DRV_SUCCESS, other-error
+*/
+SINT32 zDrvCodec_SetMicBias(T_ZDrvCodec_Handle handle, T_ZDrvMicBias_Ctrl micBiasCtrl);
+
+/**
+* @brief Set the Input Agc.
+*
+* @param handle T_ZDrvCodec_Handle
+* @param AGCPara Poiter to T_ZDrvAudCodec_AGC_Parameter
+*
+* @return 0-DRV_SUCCESS, other-error
+*/
+SINT32 zDrvCodec_SetInputAgc(T_ZDrvCodec_Handle handle, T_ZDrvAudCodec_AGC_Parameter *AGCPara);
+
+/**
+* @brief Set the Output Agc.
+*
+* @param handle T_ZDrvCodec_Handle
+* @param DRCPara Poiter to T_ZDrvAudCodec_DRC_Parameter
+* @return 0-DRV_SUCCESS, other-error
+*/
+SINT32 zDrvCodec_SetOutputDrc(T_ZDrvCodec_Handle handle, T_ZDrvAudCodec_DRC_Parameter *DRCPara);
+
+/**
+* @brief Set the Loop Back.
+*
+* @param handle T_ZDrvCodec_Handle
+* @param onoff BOOL
+*
+* @return 0-DRV_SUCCESS, other-error
+*/
+SINT32 zDrvCodec_SetLoopBack(T_ZDrvCodec_Handle handle, BOOL onoff);
+
+/**
+* @brief Set the mute function in the input path.
+*
+* @param handle T_ZDrvCodec_Handle
+* @param onoff BOOL
+*
+* @return 0-DRV_SUCCESS, other-error
+*/
+SINT32 zDrvCodec_SetInpathMute(T_ZDrvCodec_Handle handle, BOOL onoff);
+
+/**
+* @brief Set the mute function in the output path.
+*
+* @param handle T_ZDrvCodec_Handle
+* @param onoff BOOL
+*
+* @return 0-DRV_SUCCESS, other-error
+*/
+SINT32 zDrvCodec_SetOutpathMute(T_ZDrvCodec_Handle handle, BOOL onoff);
+
+/**
+* @brief read data to codec
+*
+* @param regPage the page number of the register
+* @param regAddress register address
+* @param regValue register value
+*
+* @return 0-DRV_SUCCESS, other-error
+*/
+//SINT32 codec_I2CRead(UINT8 regPage, UINT8 regAddress, UINT8 *regValue);
+
+#endif/*#ifndef _DRV_CODEC_TLV3100_H*/
+
diff --git a/cp/ps/driver/inc/misc/drvs_comm.h b/cp/ps/driver/inc/misc/drvs_comm.h
new file mode 100644
index 0000000..dc9fde7
--- /dev/null
+++ b/cp/ps/driver/inc/misc/drvs_comm.h
@@ -0,0 +1,143 @@
+/***********************************************************************
+* Copyright (C) 2001, ZTE Corporation.
+*
+* File Name: drvs_comm.h
+* File Mark:
+* Description: comm hal interface declaration.
+* Others:
+* Version: v1.0
+* Author: zhangyingjun
+* Date: 2009-05-26
+*
+* History 1:
+* Date:
+* Version:
+* Author:
+* Modification:
+
+* History 2:
+**********************************************************************/
+
+#ifndef _DRVS_COMM_H_
+#define _DRVS_COMM_H_
+
+/**************************************************************************
+ * Include files *
+ **************************************************************************/
+
+
+
+
+
+ /**************************************************************************
+ * Macro *
+ **************************************************************************/
+
+
+
+/**************************************************************************
+ * Types *
+ **************************************************************************/
+/*the diffrent reset info*/
+typedef enum
+{
+ RESET_TO_NORMAL, /*reset to idle*/
+ RESET_TO_CHARGER, /*reset to charger*/
+ RESET_TO_ALRAM, /*reset to alarm*/
+ RESET_TO_EXCEPTRESET,
+ MAX_RESET_TYPE,
+} T_ZDrvSys_RESET_TYPE;
+
+/*the power on info*/
+typedef enum
+{
+ POWER_ON_NORMAL = 0,
+ POWER_ON_FOTA,
+ POWER_ON_CHARGING,
+ POWER_ON_RTC,
+ POWER_ON_RESET,
+ POWER_ON_HDT_TEST,
+ POWER_ON_EXCEPTRESET,
+ POWER_ON_LOCALUPDATE,
+ POWER_ON_BOOST_IN,
+ POWER_ON_AMT,
+ POWER_ON_PRODUCTION,
+ POWER_ON_INVALID,
+}T_ZDrvSys_PowerOn_Type;
+
+typedef struct _HAL_COMM_OPT_
+{
+ SINT32 (*halComm_ShutDown)(VOID); /*system powerdown Device Initialize Handler*/
+ SINT32 (*halComm_Soft_Reset)(T_ZDrvSys_RESET_TYPE reset_type); /*system reset Handler*/
+ T_ZDrvSys_PowerOn_Type (*halComm_Get_PowerOnStat)(VOID);
+}HAL_COMM_OPT, *HAL_COMM_OPT_PTR;
+
+
+/**************************************************************************
+ * Global Variable *
+ **************************************************************************/
+
+
+
+/**************************************************************************
+ * Function Prototypes *
+ **************************************************************************/
+
+/*******************************************************************************
+ * Function: zDrv_ShutDown
+ * Description: shut down the mobile
+ * Parameters:
+ * Input: None
+ * Output: None
+ *
+ * Returns:
+* DRV_SUCCESS:success to init
+* DRV_ERROR:fail to init
+ * Others: None
+ ********************************************************************************/
+SINT32 zDrv_ShutDown(VOID);
+
+
+/*******************************************************************************
+ * Function: zDrv_Soft_Reset
+ * Description: reset the mobile
+ * Parameters:
+ * Input: None
+ * Output: None
+ *
+ * Returns:
+* DRV_SUCCESS:success to reset
+* DRV_ERROR:fail to shutdown
+* others: others error code. for detailed information, please refer to the header file of hal layer
+ * Others: None
+ ********************************************************************************/
+SINT32 zDrv_Soft_Reset(T_ZDrvSys_RESET_TYPE reset_type);
+
+/**************************************************************************
+* Function: halChg_SetInstance
+* Description: this function used for put semp
+* Parameters:
+* Input:
+* None
+* Outpu: None
+* Returns:
+* None
+* Others: None
+**************************************************************************/
+VOID zDrvComm_SetOperations(HAL_COMM_OPT_PTR CommObjPtr);
+
+/**************************************************************************
+* Function: zDrvComm_GetPowerOnState
+* Description: get the systerm power on reason.
+* Parameters:
+* Input:
+* None
+* Outpu: None
+* Returns:
+* T_ZDrvSys_PowerOn_Type
+* Others: None
+**************************************************************************/
+T_ZDrvSys_PowerOn_Type zDrvComm_GetPowerOnState(VOID);
+
+#endif /* HAL_COMM_H */
+/*last line of file ends with a newline*/
diff --git a/cp/ps/driver/inc/misc/drvs_ddrnet.h b/cp/ps/driver/inc/misc/drvs_ddrnet.h
new file mode 100644
index 0000000..f292526
--- /dev/null
+++ b/cp/ps/driver/inc/misc/drvs_ddrnet.h
@@ -0,0 +1,6 @@
+#ifndef _DDRNET_PUB_H
+#define _DDRNET_PUB_H
+
+SINT32 zDrvDdrNet_Initiate(void);
+
+#endif
diff --git a/cp/ps/driver/inc/misc/drvs_disk.h b/cp/ps/driver/inc/misc/drvs_disk.h
new file mode 100644
index 0000000..8a89304
--- /dev/null
+++ b/cp/ps/driver/inc/misc/drvs_disk.h
@@ -0,0 +1,94 @@
+/*******************************************************************************
+ * Copyright (C) 2007, ZTE Corporation.
+ *
+ * File Name:
+ * File Mark:
+ * Description:
+ * Others:
+ * Version: 1.0
+ * Author: geanfeng
+ * Date: 2013-09-25
+ * History 1:
+ * Date:
+ * Version:
+ * Author:
+ * Modification:
+ * History 2:
+ ********************************************************************************/
+#ifndef _DRVS_DISK_H
+#define _DRVS_DISK_H
+
+#include "drvs_list.h"
+#include "drvs_io.h"
+#include "drvs_io_dev.h"
+
+
+typedef struct _T_ZDrvDisk_PartDevice T_ZDrvDisk_PartDevice;
+
+typedef struct _T_ZDrvDisk_DevDesc {
+ char dev_name[32]; /* device name */
+ unsigned char part_type; /* partition type */
+ unsigned char target; /* target SCSI ID */
+ unsigned char type; /* device type */
+ unsigned char removable; /* removable device */
+ unsigned long lba; /* number of blocks */
+ unsigned long blksz; /* block size */
+ char vendor [40+1]; /* IDE model, SCSI Vendor */
+ char product[20+1]; /* IDE Serial no, SCSI product */
+ char revision[8+1]; /* firmware revision */
+
+ T_ZDrvDisk_PartDevice *partition;
+
+ SINT32 (*block_read)(VOID *priv_data,
+ UINT32 start,
+ UINT32 blkcnt,
+ VOID *buffer);
+ SINT32 (*block_write)(VOID *priv_data,
+ UINT32 start,
+ UINT32 blkcnt,
+ const VOID *buffer);
+ SINT32 (*block_erase)(VOID *priv_data,
+ UINT32 start,
+ UINT32 blkcnt);
+ VOID *priv_data; /* device private data */
+}T_ZDrvDisk_DevDesc;
+
+
+/* Part types */
+#define PART_TYPE_UNKNOWN 0x00
+#define PART_TYPE_MAC 0x01
+#define PART_TYPE_DOS 0x02
+#define PART_TYPE_ISO 0x03
+#define PART_TYPE_AMIGA 0x04
+#define PART_TYPE_EFI 0x05
+#define PART_TYPE_TSP 0x06
+
+
+/* device types */
+#define DEV_TYPE_UNKNOWN 0xff /* not connected */
+#define DEV_TYPE_HARDDISK 0x00 /* harddisk */
+#define DEV_TYPE_TAPE 0x01 /* Tape */
+#define DEV_TYPE_CDROM 0x05 /* CD-ROM */
+#define DEV_TYPE_OPDISK 0x07 /* optical disk */
+
+typedef struct _T_ZDrvDisk_Partition {
+ unsigned long start; /* # of first block in partition */
+ unsigned long size; /* number of blocks in partition */
+ unsigned long blksz; /* block size in bytes */
+ unsigned char name[48]; /* partition name */
+ unsigned char type[32]; /* string type description */
+} T_ZDrvDisk_Partition;
+
+typedef struct _T_ZDrvDisk_PartDevice
+{
+ struct list_head node;
+ T_ZDrvDisk_Partition part_info;
+ T_ZDrvDisk_DevDesc *blk_dev;
+ T_ZDrvIODev_Handle *io_dev;
+}
+T_ZDrvDisk_PartDevice;
+
+SINT32 zDrvDisk_Register(T_ZDrvDisk_DevDesc *dev_desc);
+VOID zDrvDisk_Unregister(T_ZDrvDisk_DevDesc *dev_desc);
+
+#endif /* _DRVS_DISK_H */
diff --git a/cp/ps/driver/inc/misc/drvs_dma.h b/cp/ps/driver/inc/misc/drvs_dma.h
new file mode 100644
index 0000000..93d0892
--- /dev/null
+++ b/cp/ps/driver/inc/misc/drvs_dma.h
@@ -0,0 +1,494 @@
+/*******************************************************************************
+ * Copyright (C) 2014, ZTE Corporation.
+ *
+ * File Name: drvs_dma.h
+ * File Mark:
+ * Description:
+ * Others:
+ * Version: v0.1
+ * Author: limeifeng
+ * Date: 2014-03-03
+ * History 1:
+ * Date:
+ * Version:
+ * Author:
+ * Modification:
+ * History 2:
+ ********************************************************************************/
+
+#ifndef _DRVS_DMA_H
+#define _DRVS_DMA_H
+/****************************************************************************
+* Include files
+****************************************************************************/
+
+/****************************************************************************
+* Macros
+****************************************************************************/
+#if defined (_CHIP_ZX297520V3)
+#define DMAC0_CH_NUM 23 /*dmac0¿ØÖÆÆ÷µÄͨµÀÊý*/
+#elif defined (_CHIP_ZX297520V2)
+#define DMAC0_CH_NUM 19 /*dmac0¿ØÖÆÆ÷µÄͨµÀÊý*/
+#endif
+
+//#define DMAC1_CH_NUM 9 /*dmac1¿ØÖÆÆ÷µÄͨµÀÊý*/
+#define DMAC_CH_MAX DMAC0_CH_NUM
+/****************************************************************************
+* Type
+****************************************************************************/
+typedef enum _T_ZDrv_DmaId
+{
+ DMAC0=0,
+ DMAC_NUM
+}T_ZDrv_DmaId;
+
+/*ÊÇ·ñΪ×èÈû·½Ê½´«Êä*/
+typedef enum _T_ZDrvDma_IsBlock
+{
+ DMA_NOT_BLOCK=0,
+ DMA_BLOCK=1,
+}T_ZDrvDma_IsBlock;
+
+#if defined (_CHIP_ZX297520V3)
+typedef enum
+{
+/*DMAC0ͨµÀºÅ¶¨Òå*/
+ DMAC0_CH_UART0_TX = 0,
+ DMAC0_CH_UART0_RX,
+ DMAC0_CH_UART1_TX,
+ DMAC0_CH_UART1_RX, /* or DMAC0_CH_HASH_RX*/
+ DMAC0_CH_SSP0_TX,
+ DMAC0_CH_SSP0_RX,
+ DMAC0_CH_GPRS0,
+ DMAC0_CH_GPRS1,
+ DMAC0_CH_USIM,
+ DMAC0_CH_I2S0_TX, /*or DMAC0_CH_TDM_TX*/
+ DMAC0_CH_I2S0_RX0, /*or DMAC0_CH_TDM_RX*/
+ DMAC0_CH_I2S1_TX, /*or DMAC0_CH_TDM_TX*/
+ DMAC0_CH_I2S1_RX0, /*or DMAC0_CH_TDM_RX*/
+ DMAC0_CH_SPIFC0_TX,
+ DMAC0_CH_SPIFC0_RX,
+ DMAC0_CH_SSP1_TX,
+ DMAC0_CH_SSP1_RX,
+ DMAC0_CH_UART2_TX, /*or DMAC0_CH_I2S0_RX1*/
+ DMAC0_CH_UART2_RX, /*or DMAC0_CH_I2S1_RX1*/
+ DMAC0_CH_EMBMS,
+ DMAC0_CH_USIM1,
+ DMAC0_CH_M2M_TX,
+ DMAC0_CH_M2M_RX,
+ DMAC0_CH_MEMORY, /*ÓÃÓÚÉêÇëDMAC0ÉϵĿÕÏÐͨµÀ*/
+}T_Dma_Peripheral_Id;
+#elif defined (_CHIP_ZX297520V2)
+typedef enum
+{
+/*DMAC0ͨµÀºÅ¶¨Òå*/
+ DMAC0_CH_UART0_TX = 0,
+ DMAC0_CH_UART0_RX,
+ DMAC0_CH_UART1_TX,
+ DMAC0_CH_UART1_RX,
+ DMAC0_CH_SSP0_TX,
+ DMAC0_CH_SSP0_RX,
+ DMAC0_CH_GPRS0,
+ DMAC0_CH_GPRS1,
+ DMAC0_CH_USIM,
+ DMAC0_CH_I2S0_TX,
+ DMAC0_CH_I2S0_RX,
+ DMAC0_CH_I2S1_TX,
+ DMAC0_CH_I2S1_RX,
+ DMAC0_CH_SPIFC0_TX,
+ DMAC0_CH_SPIFC0_RX,
+ DMAC0_CH_SSP1_TX,
+ DMAC0_CH_SSP1_RX,
+ DMAC0_CH_UART2_TX,
+ DMAC0_CH_UART2_RX,
+ DMAC0_CH_MEMORY, /*ÓÃÓÚÉêÇëDMAC0ÉϵĿÕÏÐͨµÀ*/
+}T_Dma_Peripheral_Id;
+#endif
+
+/*----DMA Transfer Control Set------*/
+typedef enum
+{
+ DMA_DISABLE = 0, /*disable DMA transmission*/
+ DMA_ENABLE = 1, /*enable DMA transmission*/
+
+ DMA_ENABLE_ALL
+}T_DMA_ENABLE;
+
+
+/*----DMA Request mode set------*/
+typedef enum
+{
+ DMA_PERIPHERAL_REQ = 0, /*peripheral request*/
+ DMA_SOFT_REQ = 1, /*soft request for single transfer*/
+ DMA_REQ_MOD_ALL
+}T_DMA_REQ_MOD;
+
+/*----DMA Source or Dest address mode------*/
+typedef enum
+{
+ DMA_ADDRMOD_RAM = 0, /*RAM mode, address will increase when transmission*/
+ DMA_ADDRMOD_FIFO = 1, /*FIFO mode, address will not change during transmission*/
+
+ DMA_ADDRMOD_ALL
+}T_DMA_ADDR_MOD;
+
+/*----DMA IRQ Mode------*/
+typedef enum
+{
+ DMA_ALL_IRQ_DISABLE = 0, /*½ûÄÜËùÓÐÖжÏ*/
+ DMA_TC_IRQ_ENABLE = 1, /*Íê³ÉÖжÏʹÄÜ*/
+ DMA_ERR_IRQ_ENABLE =2, /*´«ÊäºÍÅäÖôíÎóÖжÏʹÄÜ*/
+ DMA_ALL_IRQ_ENABLE = 3, /*ʹÄÜËùÓÐÖжÏ*/
+
+ DMA_IRQMOD_ALL
+}T_DMA_IRQ_MOD;
+
+/*----DMA Burst Size------*/
+typedef enum
+{
+ DMA_BURST_SIZE_8BIT = 0,
+ DMA_BURST_SIZE_16BIT = 1,
+ DMA_BURST_SIZE_32BIT = 2,
+ DMA_BURST_SIZE_64BIT = 3,
+ DMA_BURST_SIZE_128BIT = 4,
+ DMA_BURST_SIZE_ALL
+}
+T_DMA_BURST_SIZE;
+
+
+/*----DMA Burst Len------*/
+typedef enum
+{
+ DMA_BURST_LEN_1 = 0, /* 1 tranfer in each burst*/
+ DMA_BURST_LEN_2 , /* 2 tranfers in each burst*/
+ DMA_BURST_LEN_3 , /* 3 tranfers in each burst*/
+ DMA_BURST_LEN_4 , /* 4 tranfers in each burst*/
+ DMA_BURST_LEN_5 , /* 5 tranfers in each burst*/
+ DMA_BURST_LEN_6 , /* 6 tranfers in each burst*/
+ DMA_BURST_LEN_7 , /* 7 tranfers in each burst*/
+ DMA_BURST_LEN_8 , /* 8 tranfers in each burst*/
+ DMA_BURST_LEN_9 , /* 9 tranfers in each burst*/
+ DMA_BURST_LEN_10, /* 10 tranfers in each burst*/
+ DMA_BURST_LEN_11 , /* 11 tranfers in each burst*/
+ DMA_BURST_LEN_12 , /* 12 tranfers in each burst*/
+ DMA_BURST_LEN_13 , /* 13 tranfers in each burst*/
+ DMA_BURST_LEN_14 , /* 14 tranfers in each burst*/
+ DMA_BURST_LEN_15 , /* 15 tranfers in each burst*/
+ DMA_BURST_LEN_16 , /* 16 tranfers in each burst*/
+
+ DMA_BURST_LEN_ALL
+}
+T_DMA_BURST_LEN;
+
+/*----DMA Int Select------*/
+typedef enum
+{
+ DMA_INT_TO_PS,
+ DMA_INT_TO_PHY,
+ DMA_INT_TO_M0,
+ DMA_INT_SEL_ALL
+}T_DMA_INT_SEL;
+typedef enum
+{
+ DMA_INT_ERR, /*transmission error*/
+ DMA_INT_END, /*transmission done*/
+
+ MAX_DMA_INT
+} T_ZDrvDma_IntStatus; /*T_HalDma_IntStatus;*/
+
+/*----DMA Control reg para------*/
+typedef struct _T_DMA_CONTROL
+{
+ T_DMA_REQ_MOD BurstReqMod; /*DMA Request mode*/
+ T_DMA_ADDR_MOD SrcMod; /*DMA Source address mode*/
+ T_DMA_ADDR_MOD DestMod; /*DMA Destination address mode*/
+ T_DMA_IRQ_MOD IrqMod;
+ T_DMA_BURST_SIZE SrcBurstSize; /*DMA burst size£¬ÍâÉèÄÚ´æ¼ä´«ÊäʱҪÂú×ãCountÊÇ
+ max(SrcBurstSize,DestBurstSize)µÄÕûÊý±¶*/
+ T_DMA_BURST_LEN SrcBurstLen;
+ T_DMA_BURST_SIZE DestBurstSize; /*DMA burst size£¬ÍâÉèÄÚ´æ¼ä´«ÊäʱҪÂú×ãCountÊÇ
+ max(SrcBurstSize,DestBurstSize)µÄÕûÊý±¶*/
+ T_DMA_INT_SEL IntSel; /* select witch core will deal with the dma int*/
+} T_DMA_CONTROL;
+
+/*----DMA channel para ------*/
+typedef struct
+{
+ UINT32 SrcAddr; /*DMA source address*/
+ UINT32 DestAddr; /*DMA Destination address*/
+ UINT16 Count; /*һά´«Êäʱ´«ÊäµÄÊý¾Ý×Ü×Ö½ÚÊý*/
+ UINT16 YCount; /*һά´«ÊäʱΪ0*/
+ UINT16 ZCount; /*һά´«ÊäʱΪ0*/
+ UINT16 SrcYstep; /*һά´«ÊäʱΪ0*/
+ UINT16 SrcZstep; /*һά´«ÊäʱΪ0*/
+ UINT16 DestYstep; /*һά´«ÊäʱΪ0*/
+ UINT16 DestZstep; /*һά´«ÊäʱΪ0*/
+ UINT32 LLI; /*Á´±íµØÖ·£¬²»ÊÇÁ´±í´«Êäʱһ¶¨ÒªÉèΪ0*/
+ T_DMA_CONTROL CONTROL;
+}T_ZDrvDma_ChannelDef;
+
+typedef struct
+{
+ UINT32 SrcAddr; /*DMA source address*/
+ UINT32 DestAddr; /*DMA Destination address*/
+ UINT16 Count; /*һά´«Êäʱ´«ÊäµÄÊý¾Ý×Ü×Ö½ÚÊý*/
+}T_ZDrvDma_EmbmsChannelDef;
+
+/*----DMA Group------*/
+typedef enum
+{
+ DMA_GROUP_1234_5678 = 0,
+ DMA_GROUP_2341_5678 ,
+ DMA_GROUP_3412_5678 ,
+ DMA_GROUP_4123_5678 ,
+ DMA_GROUP_1234_6785 ,
+ DMA_GROUP_2341_6785 ,
+ DMA_GROUP_3412_6785 ,
+ DMA_GROUP_4123_6785 ,
+ DMA_GROUP_1234_7856 ,
+ DMA_GROUP_2341_7856 ,
+ DMA_GROUP_3412_7856 ,
+ DMA_GROUP_4123_7856 ,
+ DMA_GROUP_1234_8567 ,
+ DMA_GROUP_2341_8567 ,
+ DMA_GROUP_3412_8567 ,
+ DMA_GROUP_4123_8567 ,
+ DMA_GROUP_5678_1234 ,
+ DMA_GROUP_5678_2341 ,
+ DMA_GROUP_5678_3412 ,
+ DMA_GROUP_5678_4123 ,
+ DMA_GROUP_6785_1234 ,
+ DMA_GROUP_6785_2341 ,
+ DMA_GROUP_6785_3412 ,
+ DMA_GROUP_6785_4123 ,
+ DMA_GROUP_7856_1234 ,
+ DMA_GROUP_7856_2341 ,
+ DMA_GROUP_7856_3412 ,
+ DMA_GROUP_7856_4123 ,
+ DMA_GROUP_8567_1234 ,
+ DMA_GROUP_8567_2341 ,
+ DMA_GROUP_8567_3412 ,
+ DMA_GROUP_8567_4123 ,
+ DMA_GROUP_ALL
+}
+T_DMA_GROUP_ORDER;
+
+/*----DMA Group Arbi Mode------*/
+typedef enum
+{
+ DMA_MODE_RR = 0, /*ÂÖѯ·½Ê½,DMA·Ö×éÎÞЧ*/
+ DMA_MODE_8PRI, /*ÿËĸöͨµÀÒ»×飬°´ÇëÇóÏß´ÓµÍλµ½¸ßλ·Ö³É8×é
+ Àý:1234_5678,1>2>3>4>5>6>7>8*/
+ DMA_MODE_4PRI, /*Àý:1234_5678,1>2>3>4,5>6>7>8,1234Óë5678×é¼äͬÓÅÏȼ¶*/
+ DMA_MODE_2PRI, /*Àý:1234_5678,1234>5678*/
+ DMA_MODE_ALL
+}
+T_DMA_GROUP_MODE;
+
+/*----T_DMA_STATUS------*/
+typedef enum
+{
+ DMA_TRANSFER_DONE = 0,
+ DMA_CFG_ERROR,
+ DMA_NOT_DONE,
+
+ DMA_STATUS_ALL
+}
+T_DMA_STATUS;
+
+typedef VOID (*zDrvDma_CallbackFunc)(T_ZDrvDma_IntStatus);
+
+/****************************************************************************
+* Global Function Prototypes
+****************************************************************************/
+/*******************************************************************************
+* Function: zDrvDma_SetPriority
+* Description:
+* Parameters:dmacID :DMAC0¡¢DMAC1
+* groupOrder:ÓÅÏȼ¶·Ö×é˳Ðò1 2 3 4 5 6 7 8 ÿËĸöͨµÀÒ»×飬°´ÇëÇóÏߴӵ͵½¸ß
+ ·ÖΪ8×é¡£
+ groupMode:ÓÅÏȼ¶·Ö×éģʽ£¬ DMA_MODE_RR : ÂÖѯ·½Ê½£¬²»·Ö×飬ÎÞÓÅÏȼ¶²î±ð
+ DMA_MODE_8PRI:ÿËĸöͨµÀÒ»×飬°´ÇëÇóÏß´ÓµÍλµ½¸ßλ·Ö³É8×é
+ Àý:1234_5678,1>2>3>4>5>6>7>8
+ DMA_MODE_4PRI: Àý:1234_5678,1>2>3>4,5>6>7>8,1234Óë5678×é¼äͬÓÅÏȼ¶
+ DMA_MODE_2PRI: Àý:1234_5678,1234>5678
+* Input:
+*
+* Output:
+*
+* Returns:
+*
+* Others:
+********************************************************************************/
+SINT32 zDrvDma_SetPriority(T_ZDrv_DmaId dmacID, T_DMA_GROUP_ORDER groupOrder, T_DMA_GROUP_MODE groupMode);
+
+/*******************************************************************************
+* Function: zDrvDma_Initiate
+* Description: reset dma controller,the reset line will hold 2ms
+* Parameters:
+* Input:
+*
+* Output:
+*
+* Returns:
+*
+* Others:
+********************************************************************************/
+SINT32 zDrvDma_Initiate(VOID);
+
+
+/*******************************************************************************
+* Function: zDrvDma_AllocChannel
+* Description:
+ for users, they don't konw with channel chould be used to do the transfer.
+ so they should first call this function to get a free channel id;
+
+ afer dma transfer is over , zDrvDma_DeAllocChannel should be called to release the
+ channedl resoure
+* Parameters:
+* Input:
+* peripheralID: peripheral request line defined by structure T_Dma_Peripheral_Id
+
+* Output:
+*
+* Returns:
+*
+* Others:
+********************************************************************************/
+SINT32 zDrvDma_AllocChannel(T_Dma_Peripheral_Id peripheralID);
+
+
+/**************************************************************************
+* Function: zDrvDma_ConfigChannel
+* Description:
+* Parameters:
+* Input:
+* channelID: the return value from zDrvDma_AllocChannel
+* tChanPar:parameter of channel
+* CallBack:when dma transfer is over, isr will call cbk
+
+* Output: None
+* Returns:
+* T_ZDrvDma_Ret
+* Others:
+* 1. ÔÚÔ´»òÄ¿µÄµØÖ·Ö»ÒªÓÐÒ»¶ËÓй̶¨µØÖ·£¬¼´T_DMA_ADDR_MODΪ
+* DMA_ADDRMOD_FIFOʱ£¬tChanPar µÄCount ±ØÐëÊǽϴóburstsize
+* µÄÕûÊý±¶!!!
+* 2.ÔÚ BurstReqMod = DMA_PERIPHERAL_REQʱ£¬ÐèÒªÌØ±ð×¢Òâ:Èç¹û¶ÔÓ¦ÍâÉèÖ»ÄܲúÉú
+* burstÇëÇó¶øÃ»ÓÐsingleÇëÇóÊä³ö¹¦ÄÜ£¬ÄÇôtChanPar µÄCount ±ØÐëÊÇburstsize*burstlen
+* µÄÕûÊý±¶!!!
+* 3.SrcAddrºÍDestAddrÒªÇóΪburstsizeµÄÕûÊý±¶£¬¼´ÒÔburstsizeΪµ¥Î»µØÖ·¶ÔÆë¡£
+* 4.tChanPar µÄ²ÎÊýCount µÄȡֵҪСÓÚµÈÓÚ64K-1×Ö½Ú£¬Countµ¥Î»Îª×Ö½Ú!!
+**************************************************************************/
+SINT32 zDrvDma_ConfigChannel(UINT32 channelID,T_ZDrvDma_ChannelDef tChanPar);
+
+/**************************************************************************
+* Function: zDrvDma_StartChannel
+* Description:
+* Parameters:
+* Input:
+* channelID: the return value from zDrvDma_AllocChannel
+* CallBack:if not null, when dma transfer is over, 'callback' will be called in the dma isr
+ isBlock: if set true, the process will be suspended until the dma transfer is done
+* Output: None
+* Returns:
+* T_ZDrvDma_Ret
+* Others: None
+**************************************************************************/
+SINT32 zDrvDma_StartChannel(UINT32 channelID, zDrvDma_CallbackFunc CallBack, T_ZDrvDma_IsBlock isBlock);
+
+
+/*******************************************************************************
+* Function: zDrvDma_DeAllocChannel
+* Description:ÊÍ·ÅÒѾÉêÇë³É¹¦µÄDMA ͨµÀ£¬ÈçûÓÐÉêÇë³É¹¦Ôò²»ÄÜÊÍ·Å
+* Ò»°ãÔÚ¸ÃDMAͨµÀÅäÖ÷µ»Ø´íÎóÐÅÏ¢»òʹÓÃÕß²»ÔÙʹÓøÃDMAͨµÀ
+* ʱµ÷Óô˺¯Êý¡£
+* Parameters:
+* Input:
+*
+* Output:
+*
+* Returns:
+*
+* Others:ÈôΪ×èÈû´«Êä(zDrvDma_StartChannelµÄisBlock²ÎÊýΪTRUE)
+* ÏàͬͨµÀµÄzDrvDma_DeAllocChannel±ØÐëÔÚºÍzDrvDma_StartChannelͬһ¸öÏ̱߳»µ÷ÓÃ
+* ·ñÔò¿ÉÄܻᵼÖµ÷ÓÃzDrvDma_StartChannelµÄÏß³ÌÒòdmaδÀ´Íê³ÉÖж϶øÓÀÔ¶ÏÝËÀ
+********************************************************************************/
+SINT32 zDrvDma_DeAllocChannel(UINT32 channelID);
+/**************************************************************************
+* Function: zDrvDma_GetTransferNumber
+* Description:»ñÈ¡ucChannel ´ú±íµÄͨµÀµÄÊý¾ÝµÄ´«ÊäÊ£Óà´óС
+* Parameters:
+* Input: zDrvDma_AllocChannel µÄ·µ»ØÖµ:¸ß16λ:dma¿ØÖÆÆ÷µÍ16λ:ͨµÀºÅ(0~15)
+* Output: None
+* Output: None
+* Returns:
+* None
+* Others: None
+**************************************************************************/
+UINT32 zDrvDma_GetTransferNumber(UINT32 ucChannel);
+
+/**************************************************************************
+* Function: zDrvDma_DisableChannel
+* Description: Ç¿ÖÆÍ£Ö¹ucChannelËùָͨµÀºÅµÄ´«Êä¡£
+* Í£Ö¹ºóÈôÏëÖØÐÂÆô¶¯´«Ê䣬ÐèÖØÐÂÅäÖòÎÊý¡£
+* Parameters:
+* Input:
+* ucChannel: zDrvDma_AllocChannelµÄ·µ»ØÖµ¡£
+* Output: None
+* Returns:
+*
+* Others: ´Ëº¯ÊýÍ£Ö¹DMA´«Ê䣬²»ÊÇÔÝÍ£¡£
+**************************************************************************/
+SINT32 zDrvDma_DisableChannel(UINT32 ucChannel);
+
+/**************************************************************************
+* Function: zDrvDma_GetStatus
+* Description:Ê¡µçרÓýӿڣ¬ÓÃÓÚ²»²úÉúÖжϵÄDMA´«Êä
+* Parameters:
+* Input: zDrvDma_AllocChannel µÄ·µ»ØÖµ:¸ß16λ:dma¿ØÖÆÆ÷µÍ16λ:ͨµÀºÅ(0~15)
+* Output: None
+* Returns:
+* DMA_TRANSFER_DONE: channelID 's dma transfer has done.
+* DMA_CFG_ERROR:something wrong with channelID's dma configuration
+* DMA_NOT_DONE: if dma not done and dma config has no problem,return this value.
+*
+* Others: None
+**************************************************************************/
+T_DMA_STATUS zDrvDma_GetStatus(UINT32 channelID);
+
+/**************************************************************************
+* Function: zDrvDma_ConfigLLI
+* Description:Ê¡µçרÓýӿڣ¬ÓÃÓÚ²»²úÉúÖжϵÄDMA´«Êä
+* Parameters:
+* Input: channelID:zDrvDma_AllocChannel µÄ·µ»ØÖµ:¸ß16λ:dma¿ØÖÆÆ÷µÍ16λ:ͨµÀºÅ(0~15)
+ channelaPara:DMA²ÎÊýÊý×é
+ LLIParaCnt:Êý×éÔªËØ¸öÊý:×î´óΪ32
+ isLoop:TRUE--Ñ»·´«ËÍ FALSE--normal
+* Output: None
+* Returns:
+*
+* Others: None
+**************************************************************************/
+SINT32 zDrvDma_ConfigLLI(UINT32 channelID,T_ZDrvDma_ChannelDef channelaPara[], UINT32 LLIParaCnt, BOOL isLoop);
+
+/*******************************************************************************
+* Function: zDrvDma_Mem2MemForEmbms
+* Description:
+ this function implement a mem to mem dma transfer function,
+ note: the memery involved must be set to non-cacheable
+* Parameters:
+* Input:
+* embmsChannel:
+ LLIParaCnt:number of embmsChannel[]
+ CallBack: callback func
+* Output:
+*
+* Returns:
+*
+* Others:
+********************************************************************************/
+SINT32 zDrvDma_Mem2MemForEmbms(T_ZDrvDma_EmbmsChannelDef embmsChannel[], UINT32 LLIParaCnt, zDrvDma_CallbackFunc CallBack);
+
+#endif/*_DRVS_DMA_H*/
+
diff --git a/cp/ps/driver/inc/misc/drvs_dpram.h b/cp/ps/driver/inc/misc/drvs_dpram.h
new file mode 100644
index 0000000..05e33f4
--- /dev/null
+++ b/cp/ps/driver/inc/misc/drvs_dpram.h
@@ -0,0 +1,696 @@
+/*******************************************************************************
+ * Copyright by ZTE Corporation.
+ *
+ * File Name: drvs_dpram.h
+ * File Mark:
+ * Description: dpram interface declaration(W&TD).
+ * Others:
+ * Version: v0.1
+ * Author: shideyou
+ * Date: 2013-6-19
+ * History 1:
+ * Date:
+ * Version:
+ * Author:
+ * Modification:
+ * History 2:
+ ********************************************************************************/
+
+#ifndef _DRVS_DPRAM_H
+#define _DRVS_DPRAM_H
+
+
+/****************************************************************************
+* Include files
+****************************************************************************/
+//#include "ps_ephy_interface.h"
+
+/****************************************************************************
+* Macros
+****************************************************************************/
+
+/****************************************************************************
+* Types
+****************************************************************************/
+typedef enum
+{
+ DPRAM_RAT_W,
+ DPRAM_RAT_TD,
+ DPRAM_RAT_LTE,
+
+ MAX_DPRAM_RAT
+}
+T_ZDrvDpram_Rat;
+
+/* error code define */
+typedef enum
+{
+ DPRAM_RET_SUCCESS = 0, /* successed */
+ DPRAM_RET_ERROR = 1, /* error occured */
+ DPRAM_RET_ERR_INVALID_PARAM = 2, /* the input parameter is invalid */
+ DPRAM_RET_ERR_NO_MEMORY = 3, /* no enough memory in dpram to store data of the required length */
+ DPRAM_RET_ERR_NO_DATA = 4, /* no data in ring */
+ DPRAM_RET_ERR_NOT_INITIALIZED = 5, /* not initialized yet */
+
+ MAX_DPRAM_ERR_CODE
+} T_ZDrvDpram_RetCode;
+
+typedef enum
+{
+ DPRAM_DATA_UL_PHY,
+ DPRAM_DATA_HSUPA,
+ DPRAM_DATA_BCH,
+ DPRAM_DATA_DL_PHY,
+ DPRAM_DATA_HSDPA,
+ DPRAM_DATA_EAGCH,
+
+ MAX_DPRAM_DATA_ID
+} T_ZDrvDpram_DataId; //used for TD
+
+/* will be invoked when command has been received
+ uiCmdId: command id
+ pData: command data
+ uiLen: length of command data. unit: byte
+ */
+
+typedef enum
+{
+ DPRAM_MSG_CFNSFN = 0xFF,
+ DPRAM_MSG_EXCEPT = 0xFE,
+
+ MAX_DPRAM_OTHER_MSG
+} T_ZDrvDpram_OtherMsg;
+
+
+typedef struct
+{
+ UINT32 uiCfn;
+ UINT32 uiSubfn;
+ UINT32 uiSfn;
+ UINT32 uiRtCfn;
+ UINT32 uiRtSfn;
+} T_ZDrvDpram_CfnSfnForW;
+
+typedef struct
+{
+ UINT32 uiMemBaseAddr; /* base address of dpram memory */
+ //UINT32 uiRegBaseAddr; /* base address of doram register */
+ UINT32 uiMemSize; /* memroy size of dpram */
+ BOOL bBigEndian; /* big-endian if true, else little-endian */
+} T_ZDrvDpram_Info; //used for TD
+
+#if 0
+typedef enum
+{
+ DPRAM_UPA_ADDR_1 ,
+ DPRAM_UPA_ADDR_2 ,
+
+ MAX_DPRAM_UPAAddr_ID
+} T_ZDrvDpram_UPAAddrSel;
+#endif
+
+/*used by td*/
+typedef enum
+{
+ ARMTOZSP_INT1 =0, /*in order to let sleep time tell zsp ,ÖеÚ0bitÓ÷¨ÊÇ֪ͨÎïÀí²ãϵͳ˯Ãßʱ¼ä */
+ ARMTOZSP_INT2 =1, /*ÆäÖеÚ1bitÓ÷¨ÊÇ֪ͨÎïÀí²ãϵͳ˯Ãßʱ¼ä,ÓÐÐÒéÕ»ÏûÏ¢£¬sendcmd ·¢mailboxÖжϻ½ÐÑzsp*/
+ ARMTOZSP_INT3 = 2,/*used in HSUPA*/
+ ARMTOZSP_INT4 = 3, //ps wakeup phy
+ MAX_ARMTOZSPINT = 100
+
+}T_ZDrvIcp_IntType; //used for TD
+
+
+typedef struct
+{
+ UINT32 uiCfn;
+ UINT32 uiSfn;
+} T_ZDrvDpram_CfnSfn; //used for TD
+
+typedef UINT32 (*ZDRV_DPRAM_CMD_RECVFUNC)(UINT16 uiCmdId, VOID *pData, UINT16 uiLen);
+
+typedef struct
+{
+ ZDRV_DPRAM_CMD_RECVFUNC fCmdRecv;
+} T_ZDrvDpram_CallbackFuncs;
+
+typedef VOID (*ZDRV_DPRAM_ISR_CALLBACK)( VOID );
+
+/****************************************************************************
+* Constants
+****************************************************************************/
+
+/****************************************************************************
+* Global Variables
+****************************************************************************/
+
+/****************************************************************************
+* Function Prototypes
+****************************************************************************/
+
+/**************************************************************************
+* Functin: zDrvWDpram_RegCallback
+* Description: This function is used to register the interrupt callback function.
+* Parameters:
+* (IN)
+* ptCallbackStruct: callback functions struct pointer.
+* (OUT)
+* None.
+* Returns:
+* DPRAM_RET_SUCCESS: successed.
+* DPRAM_RET_ERROR: failed.
+* Others:
+* None.
+**************************************************************************/
+extern SINT32 zDrvWDpram_RegCallback(T_ZDrvDpram_CallbackFuncs *ptCallbackStruct );
+/**************************************************************************
+* Functin: zDrvDpram_SendCmdForW
+* Description: This function is used to send command.
+* Parameters:
+* (IN)
+* uiCmdId: cmd id.
+* pData: cmd data pointer
+* uiLen: cmd data length. uint: byte. must be multiples of 4. maybe 0 for null command
+* (OUT)
+* None.
+* Returns:
+* DPRAM_RET_SUCCESS: successed.
+* DPRAM_RET_ERR_INVALID_PARAM: the input parameters are invalid
+* DPRAM_RET_ERR_NO_MEMORY: no enough space to send this command.
+* Others:
+* None.
+**************************************************************************/
+//extern UINT32 zDrvDpram_SendCmdForW( UINT16 uiCmdId, VOID *pData, UINT16 uiLen );
+/**************************************************************************
+* Functin: zDrvWDpram_FrameInfoGet
+* Description: This function is used to get the frameinfo block.
+* Parameters:
+* (IN)
+* None.
+* (OUT)
+* ppBlockAddr: pointer to store address of databuf in block.
+* puiBlockLen: pointer to store length of databuf in block. uint: byte
+* Returns:
+* DPRAM_RET_SUCCESS: successed.
+* DPRAM_RET_ERROR: unknow error
+* DPRAM_RET_ERR_NO_DATA: no data.
+* Others:
+* None.
+**************************************************************************/
+extern UINT32 zDrvWDpram_FrameInfoGet(VOID **ppBlockAddr, UINT32 *puiRealLen);
+/**************************************************************************
+* Functin: zDrvWDpram_FrameInfoFree
+* Description: This function is used to free the frameinfo block.
+* Parameters:
+* (IN)
+* pBlockAddr: pointer to store address of databuf in block.
+* (OUT)
+* None
+* Returns:
+* DPRAM_RET_SUCCESS: successed.
+* DPRAM_RET_ERR_INVALID_PARAM: the input parameters are invalid
+* Others:
+* None.
+**************************************************************************/
+extern UINT32 zDrvWDpram_FrameInfoFree(VOID *pBlockAddr);/*ΪÁ˱ÜÃâÎïÀí²ãƵ·±Ð´Ö¡ÖжÏÐÅÏ¢£¨Õë¶Ô10msʱ²»ÊÇÿ¸ö×ÓÖ¡µÄÖ¡ÖжÏÐÅÏ¢¶¼ÓÐЧ£©£¬Òò´Ë£¬ÐÒéÕ»ÔÚ¶ÁÍêÖ¡ÖжÏÐÅÏ¢ºó×îºÃÇå³ýÖ¡ÖжÏÐÅÏ¢¡£Çå³ý¶¯×÷Ôڴ˺¯ÊýÖд¦Àí*/
+/**************************************************************************
+* Functin: zDrvWDpram_UlDataGet
+* Description: This function is used to get the free block of UL data.
+* Parameters:
+* (IN)
+* None
+* (OUT)
+* pBlockAddr: pointer to store address of databuf in block.
+* Returns:
+* DPRAM_RET_SUCCESS: successed.
+* DPRAM_RET_ERROR: unknow error
+* DPRAM_RET_ERR_NO_MEMORY: no free block.
+* Others:
+* None.
+**************************************************************************/
+extern UINT32 zDrvWDpram_UlDataGet(VOID **pBlockAddr);
+/**************************************************************************
+* Functin: zDrvWDpram_UlDataSend
+* Description: This function is used to send ul data.
+* Parameters:
+* (IN)
+* pBlockAddr: ul data pointer.
+* (OUT)
+* None.
+* Returns:
+* DPRAM_RET_SUCCESS: successed.
+* Others:
+* None.
+**************************************************************************/
+extern UINT32 zDrvWDpram_UlDataSend(VOID *pBlockAddr);
+/**************************************************************************
+* Functin: zDrvDpram_GetDlDataForW
+* Description: This function is used to get dl data.
+* Parameters:
+* (IN)
+* Ret: DPRAM_RET_W.
+* (OUT)
+* ppBlockAddr: pointer to store address of databuf in block.
+* Returns:
+* DPRAM_RET_SUCCESS: successed.
+* DPRAM_RET_ERR_INVALID_PARAM: the input parameters are invalid
+* DPRAM_RET_ERR_NO_DATA: no data.
+* Others:
+* None.
+**************************************************************************/
+extern UINT32 zDrvDpram_GetDlDataForW(VOID **ppBlockAddr, T_ZDrvDpram_Rat Rat);
+/**************************************************************************
+* Functin: zDrvWDpram_PsDlDataFree
+* Description: This function is used to free the DL data block.
+* Parameters:
+* (IN)
+* Ret: DPRAM_RET_W.
+* ppBlockAddr: pointer to store address of databuf in block.
+* (OUT)
+* None.
+* Returns:
+* DPRAM_RET_SUCCESS: successed.
+* DPRAM_RET_ERR_INVALID_PARAM: the input parameters are invalid
+* Others:
+* None.
+**************************************************************************/
+extern UINT32 zDrvWDpram_PsDlDataFree(VOID *pBlockAddr, T_ZDrvDpram_Rat Rat);
+/**************************************************************************
+* Functin: zDrvWDpram_UpaDataGet
+* Description: This function is used to get the free block of upadata.
+* Parameters:
+* (IN)
+* uiHARQId
+* (OUT)
+* ppBlockAddr: pointer to store address of upadata in block.
+* Returns:
+* DPRAM_RET_SUCCESS: successed.
+* DPRAM_RET_ERR_INVALID_PARAM: the input parameters are invalid
+* DPRAM_RET_ERR_NO_MEMORY: no free block.
+* Others:
+* None.
+**************************************************************************/
+extern UINT32 zDrvWDpram_UpaDataGet(UINT8 uiHARQId, VOID **ppBlockAddr);
+/**************************************************************************
+* Functin: zDrvWDpram_UpaDataSend
+* Description: This function is used to send upa data.
+* Parameters:
+* (IN)
+* uiHARQId: harq id of upa data.
+* pBlockAddr:upa data pointer
+* (OUT)
+* None.
+* Returns:
+* DPRAM_RET_SUCCESS: successed.
+* DPRAM_RET_ERR_INVALID_PARAM: the input parameters are invalid
+* Others:
+* None.
+**************************************************************************/
+extern UINT32 zDrvWDpram_UpaDataSend(UINT8 uiHARQId, VOID *pBlockAddr);
+
+#if 0
+/**************************************************************************
+* Functin: zDrvDpram_GetUpaPhyBufAddrForW
+* Description: This function is used to get UPA buffer data of phy.
+* Parameters:
+* (IN)
+* uiHARQId: harq id of upa data.
+* cho: 0 or 1
+* (OUT)
+* ppBlockAddr: pointer to store address of phy databuf .
+* Returns:
+* DPRAM_RET_SUCCESS: successed.
+* DPRAM_RET_ERR_INVALID_PARAM: the input parameters are invalid
+* Others:
+* None.
+**************************************************************************/
+extern UINT32 zDrvDpram_GetUpaPhyBufAddrForW(UINT8 uiHARQId, VOID **ppBlockAddr, T_ZDrvDpram_UPAAddrSel addsel);
+
+#endif
+/**************************************************************************
+* Functin: zDrvWDpram_GrantMonitorReqSend
+* Description: This function is used to send GrantMonitor request.
+* Parameters:
+* (IN)
+* pBlockAddr: address of GrantMonitor request.
+* uiLen:length of data
+* (OUT)
+* None.
+* Returns:
+* DPRAM_RET_ERR_NO_MEMORY: PHY is processing
+* DPRAM_RET_SUCCESS: successed.
+* Others:
+* None.
+**************************************************************************/
+extern UINT32 zDrvWDpram_GrantMonitorReqSend(VOID *pBlockAddr, UINT16 uiLen);
+
+/**************************************************************************
+* Functin: zDrvWDpram_UlDataFree
+* Description: This function is used to get free data of UL.
+* Parameters:
+* (IN)
+* pBlockAddr: address of UL.
+* (OUT)
+* None.
+* Returns:
+* DPRAM_RET_ERR_NO_DATA: no data in this buf
+* DPRAM_RET_SUCCESS: successed.
+* Others:
+* None.
+**************************************************************************/
+extern UINT32 zDrvWDpram_UlDataFree(VOID *pBlockAddr);
+
+/**************************************************************************
+* Functin: zDrvWDpram_PsDlDataGet
+* Description: This function is used to get free data of DL.
+* Parameters:
+* (IN)
+* uiLen:length of data
+* (OUT)
+* ppBlockAddr: address of DL free data.
+* Returns:
+* DPRAM_RET_ERR_NO_MEMORY: no free memory
+* DPRAM_RET_SUCCESS: successed.
+* Others:
+* None.
+**************************************************************************/
+extern UINT32 zDrvWDpram_PsDlDataGet(VOID **ppBlockAddr, UINT16 uiLen);
+
+/**************************************************************************
+* Functin: zDrvWDpram_UpaDataFree
+* Description: This function is used to send GrantMonitor request.
+* Parameters:
+* (IN)
+* pBlockAddr: address of GrantMonitor request.
+* uiHARQId: id of harq
+* (OUT)
+* None.
+* Returns:
+* DPRAM_RET_ERR_NO_DATA: no data in this buf
+* DPRAM_RET_SUCCESS: successed.
+* DPRAM_RET_ERR_INVALID_PARAM: the input parameters are invalid
+* Others:
+* None.
+**************************************************************************/
+extern UINT32 zDrvWDpram_UpaDataFree(UINT8 uiHARQId, VOID *pBlockAddr);
+
+/*-------------------------used for TD---------------------------*/
+/**************************************************************************
+* Functin: zDrvTDpram_Initiate
+* Description: This function is used to initialize dpram.
+* Parameters:
+* (IN)
+* None.
+* (OUT)
+* None.
+* Returns:
+* DRV_SUCCESS: successed.
+* DRV_ERROR: error
+* DRV_ERR_NOT_SUPPORTED: this device don't support open operation.
+* others: others error code. for detailed information, please refer to the header file of hal layer
+* Others:
+* None.
+**************************************************************************/
+SINT32 zDrvTDpram_Initiate( VOID );
+
+/**************************************************************************
+* Functin: zDrvTDpram_RegCallback
+* Description: This function is used to register the interrupt callback function.
+* Parameters:
+* (IN)
+* ptCallbackStruct: callback functions struct pointer.
+* (OUT)
+* None.
+* Returns:
+* DPRAM_RET_SUCCESS: successed.
+* DPRAM_RET_ERROR: failed.
+* Others:
+* None.
+**************************************************************************/
+UINT32 zDrvTDpram_RegCallback( T_ZDrvDpram_CallbackFuncs *ptCallbackStruct );
+
+
+/**************************************************************************
+* Functin: zDrvDpram_SendCmd
+* Description: This function is used to send command.
+* Parameters:
+* (IN)
+* uiCmdId: cmd id.
+* pData: cmd data pointer
+* uiLen: cmd data length. uint: byte. must be multiples of 4. maybe 0 for null command
+* (OUT)
+* None.
+* Returns:
+* DPRAM_RET_SUCCESS: successed.
+* DPRAM_RET_ERR_INVALID_PARAM: the input parameters are invalid
+* DPRAM_RET_ERR_NO_MEMORY: no enough space to send this command.
+* Others:
+* None.
+**************************************************************************/
+//UINT32 zDrvDpram_SendCmd( UINT16 uiCmdId, VOID *pData, UINT16 uiLen );
+
+
+/**************************************************************************
+* Functin: zDrvDpram_GetFreeData
+* Description: This function is used to get the free block.
+* Parameters:
+* (IN)
+* uiDataId: T_ZDrvDpram_DataId.
+* (OUT)
+* ppBlockAddr: pointer to store address of databuf in block.
+* puiBlockLen: pointer to store length of databuf in block. uint: byte
+* Returns:
+* DPRAM_RET_SUCCESS: successed.
+* DPRAM_RET_ERR_INVALID_PARAM: the input parameters are invalid
+* DPRAM_RET_ERR_NO_MEMORY: no free data space.
+* Others:
+* None.
+**************************************************************************/
+//UINT32 zDrvDpram_GetFreeData ( UINT8 uiDataId, VOID **ppBlockAddr, UINT16 *puiBlockLen );
+
+
+/**************************************************************************
+* Functin: zDrvDpram_SendData
+* Description: This function is used to send data.
+* Parameters:
+* (IN)
+* uiDataId: T_ZDrvDpram_DataId.
+* ppBlockAddr: base address of databuf in block.
+* uiDataLen: data length. uint: byte
+* (OUT)
+* None.
+* Returns:
+* DPRAM_RET_SUCCESS: successed.
+* DPRAM_RET_ERR_INVALID_PARAM: the input parameters are invalid
+* DPRAM_RET_ERR_NO_MEMORY: no enough space to send this data.
+* Others:
+* None.
+**************************************************************************/
+//UINT32 zDrvDpram_SendData( UINT8 uiDataId, VOID *ppBlockAddr, UINT16 uiDataLen );
+
+
+/**************************************************************************
+* Functin: zDrvDpram_DataExist
+* Description: This function is used to check if there is data.
+* Parameters:
+* (IN)
+* uiDataId: T_ZDrvDpram_DataId.
+* (OUT)
+* None.
+* Returns:
+* TRUE: have data; FALSE: no data.
+* Others:
+* None.
+**************************************************************************/
+//BOOL zDrvDpram_DataExist( UINT8 uiDataId ); /*zyj,20110330*/
+
+/**************************************************************************
+* Functin: zDrvDpram_GetData
+* Description: This function is used to get data.
+* Parameters:
+* (IN)
+* puiDataId: pointer to stord data id. T_ZDrvDpram_DataId.
+* (OUT)
+* ppBlockAddr: pointer to store address of databuf in block.
+* puiRealLen: pointer to store data length. uint: byte
+* Returns:
+* DPRAM_RET_SUCCESS: successed.
+* DPRAM_RET_ERR_INVALID_PARAM: the input parameters are invalid
+* DPRAM_RET_ERR_NO_DATA: no data.
+* Others:
+* None.
+**************************************************************************/
+//UINT32 zDrvDpram_GetData( UINT8 uiDataId, VOID **ppBlockAddr, UINT16 *puiRealLen );
+
+/**************************************************************************
+* Functin: zDrvDpram_FreeData
+* Description: This function is used to free the data block.
+* Parameters:
+* (IN)
+* uiDataId: T_ZDrvDpram_DataId.
+* pBlockAddr: base address of databuf in block.
+* (OUT)
+* None.
+* Returns:
+* DPRAM_RET_SUCCESS: successed.
+* DPRAM_RET_ERR_INVALID_PARAM: the input parameters are invalid
+* Others:
+* None.
+**************************************************************************/
+//UINT32 zDrvDpram_FreeData( UINT8 uiDataId, VOID *pBlockAddr );
+
+
+/**************************************************************************
+* Functin: zDrvTDpram_GetInfo
+* Description: This function is used to get the dpram information, such as base address.
+* Parameters:
+* (IN)
+* None.
+* (OUT)
+* ptInfo: information pointer.
+* Returns:
+* DPRAM_RET_SUCCESS: successed.
+* DPRAM_RET_ERR_INVALID_PARAM: the input parameters are invalid
+* Others:
+* None.
+**************************************************************************/
+UINT32 zDrvTDpram_GetInfo( T_ZDrvDpram_Info *ptInfo );
+
+#if ((defined ( _CHIP_ZX297502)||defined ( _CHIP_ZX2975)||defined ( _CHIP_ZX2960_02B)||defined ( _CHIP_ZX2804)) && defined (_USE_DPRAM_ADDR_NEWSW))
+/**************************************************************************
+* Functin: zDrvTDpram_GetUPHValue
+* Description: This function is used to get the UPH value in Dpram.
+* Parameters:
+* (IN)
+* None.
+* (OUT)
+* None.
+* Returns:
+* UINT16: 2 bytes UPH Value.
+* Others:
+* None.
+**************************************************************************/
+UINT16 zDrvTDpram_GetUPHValue( VOID );
+
+
+/**************************************************************************
+* Functin: zDrvTDpram_GetSNPLValue
+* Description: This function is used to get the SNPL value in Dpram.
+* Parameters:
+* (IN)
+* None.
+* (OUT)
+* None.
+* Returns:
+* UINT16: 2 bytes SNPL Value.
+* Others:
+* None.
+**************************************************************************/
+UINT16 zDrvTDpram_GetSNPLValue( VOID );
+#endif
+/**************************************************************************
+* Functin: zDrvDpram_IntGen
+* Description: This function is used to send mailbox int to zsp
+* Parameters:
+* (IN)
+* inttype
+* (OUT)
+* no
+* Returns:
+* DPRAM_RET_SUCCESS: successed.
+* DPRAM_RET_ERR_INVALID_PARAM: the input parameters are invalid
+* Others:
+* None.
+**************************************************************************/
+//SINT32 zDrvDpram_IntGen(UINT32 inttype);
+
+#ifdef _USE_PSM
+
+/**************************************************************************
+* Functin: zDrvDpram_WakeUpUphy
+* Description: This function is used to wakeup phy for ps
+* Parameters:
+* (IN)
+* no
+* (OUT)
+* no
+* Returns:
+* DPRAM_RET_SUCCESS: successed.
+* DPRAM_RET_ERR_INVALID_PARAM: the input parameters are invalid
+* Others:
+* None.
+**************************************************************************/
+//extern VOID zDrvDpram_WakeUpUphy(VOID);//ps»½ÐÑphy
+
+#endif
+
+
+/**************************************************************************
+* Functin: zDrvDpram_L1tqueueFlag
+* Description: ÅжÏzspÊÇ·ñΪ¿ÕÏУ¬Èç¹û¿ÕÏз¢maiblox»½ÐÑzsp£¬²¢ÇÒÖ±dpramΪ0xa
+* Parameters:
+* (IN)
+* no
+* (OUT)
+* no
+* Returns:
+* DPRAM_RET_SUCCESS: successed.
+* DPRAM_RET_ERR_INVALID_PARAM: the input parameters are invalid
+* Others:
+* None.
+**************************************************************************/
+
+
+//VOID zDrvDpram_L1tqueueFlag(VOID); /*ÅжÏ2963 l1t·ÅÏûÏ¢¶ÓÁÐÖÐÊÇ·ñÓÐÏûÏ¢*/
+/**************************************************************************
+* Functin: zDrvDpram_ClerrL1tqueueFlag
+* Description: This function is used to clear drx flag
+* Parameters:
+* (IN)
+* no
+* (OUT)
+* no
+* Returns:
+* DPRAM_RET_SUCCESS: successed.
+* DPRAM_RET_ERR_INVALID_PARAM: the input parameters are invalid
+* Others:
+* None.
+**************************************************************************/
+//VOID zDrvDpram_ClearL1tqueueFlag(VOID); /*Çå³ýl1tÏûÏ¢¶ÓÁÐÊÇ·ñÓбê־λ*/
+
+/**************************************************************************
+* Functin: zDrvDpram_MsgExist
+* Description: This function is used to check PS <-->TD buffer has msg.
+* Parameters:
+* (IN)
+* None.
+* (OUT)
+* None.
+* Returns:
+* TRUE:PS <-->TD has msg
+* FALSE:PS <-->TD no msg
+* Others:
+* none
+**************************************************************************/
+//BOOL zDrvDpram_MsgExist(VOID);
+
+/**************************************************************************
+* Functin: zDrvDpram_MsgExistForW
+* Description: This function is used to check WPS ->WPHY cmd ring buffer has msg.
+* Parameters:
+* (IN)
+* None.
+* (OUT)
+* None.
+* Returns:
+* TRUE:WPS ->WPHY has msg
+* FALSE:WPS <-->WPHY has no msg
+* Others:
+* none
+**************************************************************************/
+//BOOL zDrvDpram_MsgExistForW(VOID);
+
+
+
+#endif/*_FILENAME_H*/
+
diff --git a/cp/ps/driver/inc/misc/drvs_dpram_td.h b/cp/ps/driver/inc/misc/drvs_dpram_td.h
new file mode 100644
index 0000000..a4ca393
--- /dev/null
+++ b/cp/ps/driver/inc/misc/drvs_dpram_td.h
@@ -0,0 +1,522 @@
+/***********************************************************************
+* Copyright (C) 2001, ZTE Corporation.
+*
+* File Name: drvs_dpram_td.h
+* File Mark:
+* Description: dpram interface declaration.
+* Others:
+* Version: v1.0
+* Author: yan junhua
+* Date: 2007-10-19
+* History 1:
+* Date: 2007-12-26
+* Version: 1.1v
+* Author: yan junhua
+* Modification: modify macro defines according to IC's modification
+* different address define for different project
+* change parameter in macros sucn as IsSet_H2UINTSTAL from bit number to bitmap
+*
+*
+* History 2:
+* Date: 2008-05-07
+* Version: 1.2v
+* Author: yan junhua
+* Modification: remove macro defines
+* return base address by functions
+*
+* History 3:
+* Date: 2010-04-26
+* Version: 1.4.9
+* Author: wangxia
+* Modification: add function for HSPUA in CHIP ZX2963
+**********************************************************************/
+#ifndef _DRVS_DPRAM_TD_H
+#define _DRVS_DPRAM_TD_H
+
+
+/*************************************************************************
+ * Include files *
+ *************************************************************************/
+
+#include "drvs_dpram.h"
+/*************************************************************************
+ * Macro *
+ *************************************************************************/
+
+ /**************************************************************************
+ * Types *
+ **************************************************************************/
+
+/**************************************************************************
+ * Function Prototypes *
+ **************************************************************************/
+
+/*******************************************************************************
+* Function: zDrvTDpram_GetTdSfn
+* Description: get td sfn from dpram
+* Parameters:
+* Input:
+*
+* Output:td sfn
+*
+* Returns:
+*
+*
+*
+*
+* Others:
+********************************************************************************/
+UINT32 zDrvTDpram_GetTdSfn(void);
+
+#if 0
+/* error code define */
+typedef enum
+{
+ DPRAM_RET_SUCCESS = 0, /* successed */
+ DPRAM_RET_ERROR = 1, /* error occured */
+ DPRAM_RET_ERR_INVALID_PARAM = 2, /* the input parameter is invalid */
+ DPRAM_RET_ERR_NO_MEMORY = 3, /* no enough memory in dpram to store data of the required length */
+ DPRAM_RET_ERR_NO_DATA = 4, /* no data in ring */
+ DPRAM_RET_ERR_NOT_INITIALIZED = 5, /* not initialized yet */
+
+ MAX_DPRAM_ERR_CODE
+} T_ZDrvDpram_RetCode;
+
+typedef enum
+{
+#if (((defined ( _CHIP_ZX297502)||defined ( _CHIP_ZX2975)||defined ( _CHIP_ZX2960_02B)) && defined (_USE_DPRAM_ADDR_NEWSW))||defined ( _CHIP_ZX2804))
+ DPRAM_DATA_UL_PHY,
+ DPRAM_DATA_HSUPA,
+ DPRAM_DATA_BCH,
+ DPRAM_DATA_DL_PHY,
+ DPRAM_DATA_HSDPA,
+ DPRAM_DATA_EAGCH,
+#else
+ DPRAM_DATA_UL_PHY,
+ DPRAM_DATA_BCH,
+ DPRAM_DATA_DL_PHY,
+ DPRAM_DATA_HSDPA,
+
+#endif
+
+ MAX_DPRAM_DATA_ID
+} T_ZDrvDpram_DataId;
+
+/* will be invoked when command has been received
+ uiCmdId: command id
+ pData: command data
+ uiLen: length of command data. unit: byte
+ */
+typedef UINT32 (*ZDRV_DPRAM_CMD_RECVFUNC)( UINT16 uiCmdId, VOID *pData, UINT16 uiLen );
+typedef VOID (*ZDRV_DPRAM_ISR_CALLBACK)( VOID ); //for TD-DPRAM
+
+typedef struct
+{
+ ZDRV_DPRAM_CMD_RECVFUNC fCmdRecv;
+} T_ZDrvDpram_CallbackFuncs;
+
+typedef enum
+{
+ DPRAM_MSG_CFNSFN = 0xFF,
+ DPRAM_MSG_EXCEPT = 0xFE,
+
+ MAX_DPRAM_OTHER_MSG
+} T_ZDrvDpram_OtherMsg;
+
+typedef struct
+{
+ UINT32 uiCfn;
+ UINT32 uiSfn;
+} T_ZDrvDpram_CfnSfn;
+
+typedef struct
+{
+ UINT32 uiMemBaseAddr; /* base address of dpram memory */
+ UINT32 uiRegBaseAddr; /* base address of doram register */
+ UINT32 uiMemSize; /* memroy size of dpram */
+ BOOL bBigEndian; /* big-endian if true, else little-endian */
+} T_ZDrvDpram_Info;
+
+
+
+typedef enum
+{
+ ARMTOZSP_INT1 =0, /*in order to let sleep time tell zsp ,ÖеÚ0bitÓ÷¨ÊÇ֪ͨÎïÀí²ãϵͳ˯Ãßʱ¼ä */
+ ARMTOZSP_INT2 =1, /*ÆäÖеÚ1bitÓ÷¨ÊÇ֪ͨÎïÀí²ãϵͳ˯Ãßʱ¼ä,ÓÐÐÒéÕ»ÏûÏ¢£¬sendcmd ·¢mailboxÖжϻ½ÐÑzsp*/
+ ARMTOZSP_INT3 = 2,/*used in HSUPA*/
+ ARMTOZSP_INT4 = 3, //ps wakeup phy
+ MAX_ARMTOZSPINT = 100
+
+}T_ZDrvIcp_IntType;
+#ifdef _USE_PSM
+
+#define DPRAM_BASE_ADDR 0x19800
+#define DPRAM_TDL1SLEEP_FLAG (DPRAM_BASE_ADDR + 0x63CE)
+#define DPRAM_TDL1SLEEP_FC_ADDR (DPRAM_BASE_ADDR + 0x63D0)
+#define DPRAM_TDL1SLEEP_CC_ADDR (DPRAM_BASE_ADDR + 0x63D2)
+#define DPRAM_TDL1SLEEP_LEN_ADDR (DPRAM_BASE_ADDR + 0x63D4)
+#define DPRAM_TDL1SLEEP_FC1_ADDR (DPRAM_BASE_ADDR + 0x63D6)
+#define DPRAM_TDL1SLEEP_CC1_ADDR (DPRAM_BASE_ADDR + 0x63D8)
+#define DPRAM_DRX_ADDR (DPRAM_BASE_ADDR + 0x63DA)
+#define DPRAM_TDSLEEP_FORCE_GSM_WAKEUP_ADRR (DPRAM_BASE_ADDR + 0x63DC)
+#define DPRAM_TD_CAMPON_ADDR (DPRAM_BASE_ADDR + 0x63DE)
+#define DPRAM_L1G_WAKEUPOK_FLAG_ADDR (DPRAM_BASE_ADDR + 0x63E0)
+#define DPRAM_L1T_QUEUE_FLAG_ADDR (DPRAM_BASE_ADDR + 0x63E2)
+#define DPRAM_ZSP_CHANGE_FREQ_FLAG_ADDR (DPRAM_BASE_ADDR + 0x63E8)
+#define DPRAM_ZSP_TDT1_FLAG_ADDR (DPRAM_BASE_ADDR + 0x63EA)
+#endif
+/**************************************************************************
+ * Function Prototypes *
+ **************************************************************************/
+/**************************************************************************
+* Functin: zDrvDpram_Init
+* Description: This function is used to initialize dpram.
+* Parameters:
+* (IN)
+* None.
+* (OUT)
+* None.
+* Returns:
+* DRV_SUCCESS: successed.
+* DRV_ERROR: error
+* DRV_ERR_NOT_SUPPORTED: this device don't support open operation.
+* others: others error code. for detailed information, please refer to the header file of hal layer
+* Others:
+* None.
+**************************************************************************/
+SINT32 zDrvDpram_Init( VOID );
+
+/**************************************************************************
+* Functin: zDrvDpram_RegISRCallback
+* Description: This function is used to get the isr function. It just be used by TD Ret
+* Parameters:
+* (IN)
+* fISRCallback: isr function pointer.
+* (OUT)
+* None.
+* Returns:
+* DPRAM_RET_SUCCESS: successed.
+* DPRAM_RET_ERROR: failed.
+* Others:
+* None.
+**************************************************************************/
+UINT32 zDrvDpram_RegISRCallback( ZDRV_DPRAM_ISR_CALLBACK fISRCallback ); //for TD-DPRAM
+
+/**************************************************************************
+* Functin: zDrvDpram_Exit
+* Description: This function is used to uninitialize dpram.
+* Parameters:
+* (IN)
+* None.
+* (OUT)
+* None.
+* Returns:
+* DRV_SUCCESS: successed.
+* DRV_ERROR: error
+* DRV_ERR_NOT_SUPPORTED: this device don't support open operation.
+* others: others error code. for detailed information, please refer to the header file of hal layer
+* Others:
+* None.
+**************************************************************************/
+SINT32 zDrvDpram_Exit( VOID );
+
+
+/**************************************************************************
+* Functin: zDrvTDpram_RegCallback
+* Description: This function is used to register the interrupt callback function.
+* Parameters:
+* (IN)
+* ptCallbackStruct: callback functions struct pointer.
+* (OUT)
+* None.
+* Returns:
+* DPRAM_RET_SUCCESS: successed.
+* DPRAM_RET_ERROR: failed.
+* Others:
+* None.
+**************************************************************************/
+UINT32 zDrvTDpram_RegCallback( T_ZDrvDpram_CallbackFuncs *ptCallbackStruct );
+
+
+/**************************************************************************
+* Functin: zDrvDpram_SendCmd
+* Description: This function is used to send command.
+* Parameters:
+* (IN)
+* uiCmdId: cmd id.
+* pData: cmd data pointer
+* uiLen: cmd data length. uint: byte. must be multiples of 4. maybe 0 for null command
+* (OUT)
+* None.
+* Returns:
+* DPRAM_RET_SUCCESS: successed.
+* DPRAM_RET_ERR_INVALID_PARAM: the input parameters are invalid
+* DPRAM_RET_ERR_NO_MEMORY: no enough space to send this command.
+* Others:
+* None.
+**************************************************************************/
+UINT32 zDrvDpram_SendCmd( UINT16 uiCmdId, VOID *pData, UINT16 uiLen );
+
+
+/**************************************************************************
+* Functin: zDrvDpram_GetFreeData
+* Description: This function is used to get the free block.
+* Parameters:
+* (IN)
+* uiDataId: T_ZDrvDpram_DataId.
+* (OUT)
+* ppBlockAddr: pointer to store address of databuf in block.
+* puiBlockLen: pointer to store length of databuf in block. uint: byte
+* Returns:
+* DPRAM_RET_SUCCESS: successed.
+* DPRAM_RET_ERR_INVALID_PARAM: the input parameters are invalid
+* DPRAM_RET_ERR_NO_MEMORY: no free data space.
+* Others:
+* None.
+**************************************************************************/
+UINT32 zDrvDpram_GetFreeData ( UINT8 uiDataId, VOID **ppBlockAddr, UINT16 *puiBlockLen );
+
+
+/**************************************************************************
+* Functin: zDrvDpram_SendData
+* Description: This function is used to send data.
+* Parameters:
+* (IN)
+* uiDataId: T_ZDrvDpram_DataId.
+* ppBlockAddr: base address of databuf in block.
+* uiDataLen: data length. uint: byte
+* (OUT)
+* None.
+* Returns:
+* DPRAM_RET_SUCCESS: successed.
+* DPRAM_RET_ERR_INVALID_PARAM: the input parameters are invalid
+* DPRAM_RET_ERR_NO_MEMORY: no enough space to send this data.
+* Others:
+* None.
+**************************************************************************/
+UINT32 zDrvDpram_SendData( UINT8 uiDataId, VOID *ppBlockAddr, UINT16 uiDataLen );
+
+
+/**************************************************************************
+* Functin: zDrvDpram_DataExist
+* Description: This function is used to check if there is data.
+* Parameters:
+* (IN)
+* uiDataId: T_ZDrvDpram_DataId.
+* (OUT)
+* None.
+* Returns:
+* TRUE: have data; FALSE: no data.
+* Others:
+* None.
+**************************************************************************/
+#if 0
+#ifdef _USE_EVB2963
+BOOL zDrvDpram_DataExist( UINT8 uiDataId );
+#else
+BOOL zDrvDpram_DataExist( VOID );
+#endif
+#endif
+
+
+BOOL zDrvDpram_DataExist( UINT8 uiDataId ); /*zyj,20110330*/
+
+/**************************************************************************
+* Functin: zDrvDpram_GetData
+* Description: This function is used to get data.
+* Parameters:
+* (IN)
+* puiDataId: pointer to stord data id. T_ZDrvDpram_DataId.
+* (OUT)
+* ppBlockAddr: pointer to store address of databuf in block.
+* puiRealLen: pointer to store data length. uint: byte
+* Returns:
+* DPRAM_RET_SUCCESS: successed.
+* DPRAM_RET_ERR_INVALID_PARAM: the input parameters are invalid
+* DPRAM_RET_ERR_NO_DATA: no data.
+* Others:
+* None.
+**************************************************************************/
+#if (((defined ( _CHIP_ZX297502)||defined ( _CHIP_ZX2975)||defined ( _CHIP_ZX2960_02B)) && defined (_USE_DPRAM_ADDR_NEWSW))||defined ( _CHIP_ZX2804))
+UINT32 zDrvDpram_GetData( UINT8 uiDataId, VOID **ppBlockAddr, UINT16 *puiRealLen );
+#else
+UINT32 zDrvDpram_GetData( UINT8 *puiDataId, VOID **ppBlockAddr, UINT16 *puiRealLen );
+#endif
+
+/**************************************************************************
+* Functin: zDrvDpram_FreeData
+* Description: This function is used to free the data block.
+* Parameters:
+* (IN)
+* uiDataId: T_ZDrvDpram_DataId.
+* pBlockAddr: base address of databuf in block.
+* (OUT)
+* None.
+* Returns:
+* DPRAM_RET_SUCCESS: successed.
+* DPRAM_RET_ERR_INVALID_PARAM: the input parameters are invalid
+* Others:
+* None.
+**************************************************************************/
+UINT32 zDrvDpram_FreeData( UINT8 uiDataId, VOID *pBlockAddr );
+
+
+/**************************************************************************
+* Functin: zDrvTDpram_GetInfo
+* Description: This function is used to get the dpram information, such as base address.
+* Parameters:
+* (IN)
+* None.
+* (OUT)
+* ptInfo: information pointer.
+* Returns:
+* DPRAM_RET_SUCCESS: successed.
+* DPRAM_RET_ERR_INVALID_PARAM: the input parameters are invalid
+* Others:
+* None.
+**************************************************************************/
+UINT32 zDrvTDpram_GetInfo( T_ZDrvDpram_Info *ptInfo );
+
+
+
+#if ((defined ( _CHIP_ZX297502)||defined ( _CHIP_ZX2975)||defined ( _CHIP_ZX2960_02B)||defined ( _CHIP_ZX2804)) && defined (_USE_DPRAM_ADDR_NEWSW))
+/**************************************************************************
+* Functin: zDrvTDpram_GetUPHValue
+* Description: This function is used to get the UPH value in Dpram.
+* Parameters:
+* (IN)
+* None.
+* (OUT)
+* None.
+* Returns:
+* UINT16: 2 bytes UPH Value.
+* Others:
+* None.
+**************************************************************************/
+UINT16 zDrvTDpram_GetUPHValue( VOID );
+
+
+/**************************************************************************
+* Functin: zDrvTDpram_GetSNPLValue
+* Description: This function is used to get the SNPL value in Dpram.
+* Parameters:
+* (IN)
+* None.
+* (OUT)
+* None.
+* Returns:
+* UINT16: 2 bytes SNPL Value.
+* Others:
+* None.
+**************************************************************************/
+UINT16 zDrvTDpram_GetSNPLValue( VOID );
+#endif
+/**************************************************************************
+* Functin: zDrvDpram_IntGen
+* Description: This function is used to send mailbox int to zsp
+* Parameters:
+* (IN)
+* inttype
+* (OUT)
+* no
+* Returns:
+* DPRAM_RET_SUCCESS: successed.
+* DPRAM_RET_ERR_INVALID_PARAM: the input parameters are invalid
+* Others:
+* None.
+**************************************************************************/
+SINT32 zDrvDpram_IntGen(T_ZDrvIcp_IntType inttype);
+
+#ifdef _USE_PSM
+/**************************************************************************
+* Functin: zDrvDpram_GetDRXFlag
+* Description: This function is used to get drx flag
+* Parameters:
+* (IN)
+* pFlag :
+* (OUT)
+* no
+* Returns:
+* DPRAM_RET_SUCCESS: successed.
+* DPRAM_RET_ERR_INVALID_PARAM: the input parameters are invalid
+* Others:
+* None.
+**************************************************************************/
+
+SINT32 zDrvDpram_GetDRXFlag (UINT16 *pFlag);
+/**************************************************************************
+* Functin: zDrvDpram_ClearDRXFlag
+* Description: This function is used to clear drx flag
+* Parameters:
+* (IN)
+* no
+* (OUT)
+* no
+* Returns:
+* DPRAM_RET_SUCCESS: successed.
+* DPRAM_RET_ERR_INVALID_PARAM: the input parameters are invalid
+* Others:
+* None.
+**************************************************************************/
+
+SINT32 zDrvDpram_ClearDRXFlag (VOID );
+
+
+/**************************************************************************
+* Functin: zDrvDpram_WakeUpUphy
+* Description: This function is used to wakeup phy for ps
+* Parameters:
+* (IN)
+* no
+* (OUT)
+* no
+* Returns:
+* DPRAM_RET_SUCCESS: successed.
+* DPRAM_RET_ERR_INVALID_PARAM: the input parameters are invalid
+* Others:
+* None.
+**************************************************************************/
+extern VOID zDrvDpram_WakeUpUphy(VOID);//ps»½ÐÑphy
+
+#endif
+
+
+/**************************************************************************
+* Functin: zDrvDpram_L1tqueueFlag
+* Description: ÅжÏzspÊÇ·ñΪ¿ÕÏУ¬Èç¹û¿ÕÏз¢maiblox»½ÐÑzsp£¬²¢ÇÒÖ±dpramΪ0xa
+* Parameters:
+* (IN)
+* no
+* (OUT)
+* no
+* Returns:
+* DPRAM_RET_SUCCESS: successed.
+* DPRAM_RET_ERR_INVALID_PARAM: the input parameters are invalid
+* Others:
+* None.
+**************************************************************************/
+
+
+VOID zDrvDpram_L1tqueueFlag(VOID); /*ÅжÏ2963 l1t·ÅÏûÏ¢¶ÓÁÐÖÐÊÇ·ñÓÐÏûÏ¢*/
+/**************************************************************************
+* Functin: zDrvDpram_ClerrL1tqueueFlag
+* Description: This function is used to clear drx flag
+* Parameters:
+* (IN)
+* no
+* (OUT)
+* no
+* Returns:
+* DPRAM_RET_SUCCESS: successed.
+* DPRAM_RET_ERR_INVALID_PARAM: the input parameters are invalid
+* Others:
+* None.
+**************************************************************************/
+
+
+VOID zDrvDpram_ClearL1tqueueFlag(VOID); /*Çå³ýl1tÏûÏ¢¶ÓÁÐÊÇ·ñÓбê־λ*/
+
+#endif
+
+#endif /* _DRVSDPRAM_H */
+
diff --git a/cp/ps/driver/inc/misc/drvs_dsp.h b/cp/ps/driver/inc/misc/drvs_dsp.h
new file mode 100644
index 0000000..a3f95a4
--- /dev/null
+++ b/cp/ps/driver/inc/misc/drvs_dsp.h
@@ -0,0 +1,83 @@
+/***********************************************************************
+* Copyright (C) 2001, ZTE Corporation.
+*
+* File Name: hal_dsp.h
+* File Mark:
+* Description: tu hal interface declaration.
+* Others:
+* Version: v1.0
+* Author: wangxia
+* Date: 2008-08-28
+*
+* History 1:
+* Date:
+* Version:
+* Author:
+* Modification:
+
+* History 2:
+**********************************************************************/
+
+#ifndef HAL_DSP_H
+#define HAL_DSP_H
+
+
+/*************************************************************************
+ * Include files *
+ *************************************************************************/
+
+
+/*************************************************************************
+ * Macro *
+ *************************************************************************/
+
+
+/**************************************************************************
+ * Types *
+ **************************************************************************/
+typedef enum
+{
+ GSM_DSP_INT0 ,/*90*/
+ GSM_DSP_INT1,/*91*/
+ GSM_DSP_INT2,/*92*/
+ GSM_DSP_INT3,/*93*/
+ GSM_DSP_INT4,/*94*/
+ GSM_DSP_INT5,/*95*/
+ GSM_DSP_INT6,/*96*/
+ GSM_DSP_INT7,/*97*/
+
+ MAX_DSP_INT
+} T_ZDrvDsp_IntId;
+
+/**************************************************************************
+ * Global Variable *
+ **************************************************************************/
+
+
+/**************************************************************************
+ * Function Prototypes *
+ **************************************************************************/
+/**************************************************************************
+* Functin: zDrvDsp_IntRegister
+* Description: This function is used to regist isr callback for l1g.
+* Parameters:
+* (IN)
+* intNumber: T_ZDrvDsp_IntId.
+* cb: isr callback.
+* intPrio:prio of interrupt
+* (OUT)
+* None.
+* Returns:
+* DRV_SUCCESS: successed.
+* DRV_ERR_NOT_SUPPORTED: this device don't support ioctrl operation.
+* DRV_ERR_INVALID_PARAM: the input parameters are invalid
+* DRV_ERROR: error
+* others: others programmer defined error code. for detailed information, please contact with the programmer
+* Others:
+* others error code should be a negative number, and not equal to the value that already be defined in T_ZDrv_ErrCode in drv_pub.h.
+**************************************************************************/
+SINT32 zDrvDsp_IntRegister(T_ZDrvDsp_IntId intNumber,VOID (*cb)(VOID),UINT32 intPrio);
+
+
+#endif /* HAL_DSP_H */
+
diff --git a/cp/ps/driver/inc/misc/drvs_edcp.h b/cp/ps/driver/inc/misc/drvs_edcp.h
new file mode 100644
index 0000000..9058dbb
--- /dev/null
+++ b/cp/ps/driver/inc/misc/drvs_edcp.h
@@ -0,0 +1,693 @@
+/*******************************************************************************
+* 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*/
+
diff --git a/cp/ps/driver/inc/misc/drvs_efuse.h b/cp/ps/driver/inc/misc/drvs_efuse.h
new file mode 100644
index 0000000..2cca866
--- /dev/null
+++ b/cp/ps/driver/inc/misc/drvs_efuse.h
@@ -0,0 +1,110 @@
+/*******************************************************************************
+ * Copyright (C) 2014, ZTE Corporation.
+ *
+ * File Name:
+ * File Mark:
+ * Description:
+ * Others:
+ * Version: 1.0
+ * Author:
+ * Date:
+ * History 1:
+ * Date:
+ * Version:
+ * Author:
+ * Modification:
+ * History 2:
+ ********************************************************************************/
+
+#ifndef _DRVS_EFUSE_H
+#define _DRVS_EFUSE_H
+
+/****************************************************************************
+* Include files
+****************************************************************************/
+#ifndef _OS_LINUX
+#include "oss_api.h"
+
+/****************************************************************************
+* Macros
+****************************************************************************/
+
+
+/****************************************************************************
+* Types
+****************************************************************************/
+typedef struct
+{
+ UINT32 pubKeyRsaE[32];
+ UINT32 pubKeyRsaN[32];
+ UINT32 secureFlag;
+ UINT32 pubKeyHash[4];
+ UINT32 secureDevId[3];
+}T_ZDrvEfuse_Secure;
+
+typedef enum
+{
+ SECURE_EN,
+ PUB_KEY_HASH,
+ DEVICE_ID,
+ MAX_ENUM
+}E_ZDrvEfuse_SecureMsg;
+#endif
+
+/****************************************************************************
+* Constants
+****************************************************************************/
+
+/****************************************************************************
+* Global Variables
+****************************************************************************/
+
+/****************************************************************************
+* Function Prototypes
+****************************************************************************/
+
+/*******************************************************************************
+* Function: zDrvEfuse_IsSpe
+* Description:
+* Parameters:
+* Input:
+* None
+* Output:
+* None
+* Returns:
+* Others:
+*******************************************************************************/
+UINT32 zDrvEfuse_IsSpe(VOID);
+
+#ifndef _OS_LINUX
+
+/*******************************************************************************
+ * Function: zDrvEfuse_GetSecureMsg
+ * Description:¸Ãº¯ÊýÓÃÓÚ»ñÈ¡¹«Ô¿¶Ô¡¢°²È«¿ªÆô±ê¼Ç¡¢¹«Ô¿hashÖµ¡¢É豸ID¡£
+ * Parameters:
+ * Input:
+ *
+ * Output:
+ *
+ * Returns:
+ *
+ * Others:
+ ********************************************************************************/
+VOID zDrvEfuse_GetSecureMsg(T_ZDrvEfuse_Secure *secure);
+
+/*******************************************************************************
+* Function: zDrvEfuse_SetSecureMsg
+* Description:¸Ãº¯ÊýÓÃÓÚÉèÖð²È«¿ªÆô±ê¼Ç¡¢¹«Ô¿hashÖµ¡¢É豸ID¡£
+* Parameters:
+* Input:
+* None
+* Output:
+* None
+* Returns:
+* None
+* Others:
+*******************************************************************************/
+SINT32 zDrvEfuse_SetSecureMsg(E_ZDrvEfuse_SecureMsg secure_msg, UINT32 *secure_buf);
+#endif
+
+#endif
diff --git a/cp/ps/driver/inc/misc/drvs_gpio.h b/cp/ps/driver/inc/misc/drvs_gpio.h
new file mode 100644
index 0000000..96ebc53
--- /dev/null
+++ b/cp/ps/driver/inc/misc/drvs_gpio.h
@@ -0,0 +1,1137 @@
+/**
+* @file drvs_gpio.h
+* @brief Public APIs of gpio drivers
+*
+* Copyright (C) 2017 Sanechips Technology Co., Ltd.
+* @author Dongdong Zhang <Zhang.Dongdong@sanechips.com.cn>
+*
+* This program is free software; you can redistribute it and/or modify
+* it under the terms of the GNU General Public License version 2 as
+* published by the Free Software Foundation.
+*
+*/
+#ifndef _DRVS_GPIO_H
+#define _DRVS_GPIO_H
+
+#ifdef _OS_LINUX
+#include <linux/gpio.h>
+#else
+/*******************************************************************************
+* Include header files *
+******************************************************************************/
+
+/*******************************************************************************
+* Macro definitions *
+******************************************************************************/
+#define GPIO0 0
+#define GPIO1 1
+#define GPIO2 2
+#define GPIO3 3
+#define GPIO4 4
+#define GPIO5 5
+#define GPIO6 6
+#define GPIO7 7
+#define GPIO8 8
+#define GPIO9 9
+#define GPIO10 10
+#define GPIO11 11
+#define GPIO12 12
+#define GPIO13 13
+#define GPIO14 14
+#define GPIO15 15
+#define GPIO16 16
+#define GPIO17 17
+#define GPIO18 18
+#define GPIO19 19
+#define GPIO20 20
+#define GPIO21 21
+#define GPIO22 22
+#define GPIO23 23
+#define GPIO24 24
+#define GPIO25 25
+#define GPIO26 26
+#define GPIO27 27
+#define GPIO28 28
+#define GPIO29 29
+#define GPIO30 30
+#define GPIO31 31
+#define GPIO32 32
+#define GPIO33 33
+#define GPIO34 34
+#define GPIO35 35
+#define GPIO36 36
+#define GPIO37 37
+#define GPIO38 38
+#define GPIO39 39
+#define GPIO40 40
+#define GPIO41 41
+#define GPIO42 42
+#define GPIO43 43
+#define GPIO44 44
+#define GPIO45 45
+#define GPIO46 46
+#define GPIO47 47
+#define GPIO48 48
+#define GPIO49 49
+#define GPIO50 50
+#define GPIO51 51
+#define GPIO52 52
+#define GPIO53 53
+#define GPIO54 54
+#define GPIO55 55
+#define GPIO56 56
+#define GPIO57 57
+#define GPIO58 58
+#define GPIO59 59
+#define GPIO60 60
+#define GPIO61 61
+#define GPIO62 62
+#define GPIO63 63
+#define GPIO64 64
+#define GPIO65 65
+#define GPIO66 66
+#define GPIO67 67
+#define GPIO68 68
+#define GPIO69 69
+#define GPIO70 70
+#define GPIO71 71
+#define GPIO72 72
+#define GPIO73 73
+#define GPIO74 74
+#define GPIO75 75
+#define GPIO76 76
+#define GPIO77 77
+#define GPIO78 78
+#define GPIO79 79
+#define GPIO80 80
+#define GPIO81 81
+#define GPIO82 82
+#define GPIO83 83
+#define GPIO84 84
+#define GPIO85 85
+#define GPIO86 86
+#define GPIO87 87
+#define GPIO88 88
+#define GPIO89 89
+#define GPIO90 90
+#define GPIO91 91
+#define GPIO92 92
+#define GPIO93 93
+#define GPIO94 94
+#define GPIO95 95
+#define GPIO96 96
+#define GPIO97 97
+#define GPIO98 98
+#define GPIO99 99
+#define GPIO100 100
+#define GPIO101 101
+#define GPIO102 102
+#define GPIO103 103
+#define GPIO104 104
+#define GPIO105 105
+#define GPIO106 106
+#define GPIO107 107
+#define GPIO108 108
+#define GPIO109 109
+#define GPIO110 110
+#define GPIO111 111
+#define GPIO112 112
+#define GPIO113 113
+#define GPIO114 114
+#define GPIO115 115
+#define GPIO116 116
+#define GPIO117 117
+#define GPIO118 118
+#define GPIO119 119
+#define GPIO120 120
+#define GPIO121 121
+#define GPIO122 122
+#define GPIO123 123
+#define GPIO124 124
+#define GPIO125 125
+#define GPIO126 126
+#define GPIO127 127
+#define GPIO128 128
+#define GPIO129 129
+#define GPIO130 130
+#define GPIO131 131
+#define GPIO132 132
+#define GPIO133 133
+#define GPIO134 134
+#define GPIO135 135
+#define GPIO136 136
+#define GPIO137 137
+#define GPIO138 138
+#define GPIO139 139
+#define GPIO140 140
+#define GPIO141 141
+#define GPIO142 142
+#define GPIO143 143
+#define GPIO144 144
+#define GPIO145 145
+#define GPIO146 146
+#define GPIO147 147
+#define GPIO148 148
+#define GPIO149 149
+#define GPIO150 150
+#define GPIO151 151
+#define GPIO152 152
+#define GPIO153 153
+#define GPIO154 154
+#define GPIO155 155
+
+#if defined (_CHIP_ZX297520V3)
+#define MAX_GPIO_NUM GPIO135
+#elif defined (_CHIP_ZX297520V2)
+#define MAX_GPIO_NUM GPIO155
+#endif
+
+#define INVLID_GPIO 0xffff
+
+/*******************************************************************************
+* Type definitions *
+******************************************************************************/
+typedef enum{
+ GPIO_IN = 101,
+ GPIO_OUT = 102,
+}T_ZDrvGpio_IoDirection;
+
+typedef enum{
+ GPIO_LOW = 201,
+ GPIO_HIGH = 202,
+}T_ZDrvGpio_IoVal;
+
+typedef enum{
+ GPIO_PULL_DOWN = 0x1,
+ GPIO_NO_ACTION = 0x2,
+ GPIO_PULL_UP = 0x3,
+}T_ZDrvGpio_PullUp;
+
+#if defined (_CHIP_ZX297520V3)
+typedef enum
+{
+ /*[31:24]:gpio_id [23:12]:level1_sel [11:0]:level2_sel*/
+ GPIO0_GPIO0 = 0x00000000,
+ GPIO0_NAND_WE = 0x00001000,
+ GPIO0_LCD_OE_N = 0x00001001,
+ GPIO1_GPIO1 = 0x01000000,
+ GPIO1_NAND_CS0 = 0x01001000,
+ GPIO1_LCD_CS_N = 0x01001001,
+ GPIO2_GPIO2 = 0x02000000,
+ GPIO2_NAND_READY = 0x02001000,
+ GPIO2_LCD_RS = 0x02001001,
+ GPIO3_GPIO3 = 0x03000000,
+ GPIO3_NAND_CLE = 0x03001000,
+ GPIO3_LCD_RESET_N = 0x03001001,
+ GPIO4_GPIO4 = 0x04000000,
+ GPIO4_NAND_ALE = 0x04001000,
+ GPIO4_LCD_WE_N = 0x04001001,
+ GPIO5_GPIO5 = 0x05000000,
+ GPIO5_NAND_RE = 0x05001000,
+ GPIO5_LCD_TE = 0x05001001,
+ GPIO6_GPIO6 = 0x06000000,
+ GPIO6_NAND_WRITE_PROTECT = 0x06001000,
+ GPIO6_LCD_D0 = 0x06001001,
+ GPIO7_GPIO7 = 0x07000000,
+ GPIO7_NAND_DATA0 = 0x07001000,
+ GPIO7_LCD_D1 = 0x07001001,
+ GPIO8_GPIO8 = 0x08000000,
+ GPIO8_NAND_DATA1 = 0x08001000,
+ GPIO8_LCD_D2 = 0x08001001,
+ GPIO9_GPIO9 = 0x09000000,
+ GPIO9_NAND_DATA2 = 0x09001000,
+ GPIO9_LCD_D3 = 0x09001001,
+ GPIO10_GPIO10 = 0x0A000000,
+ GPIO10_NAND_DATA3 = 0x0A001000,
+ GPIO10_LCD_D4 = 0x0A001001,
+ GPIO11_GPIO11 = 0x0B000000,
+ GPIO11_NAND_DATA4 = 0x0B001000,
+ GPIO11_LCD_D5 = 0x0B001001,
+ GPIO12_GPIO12 = 0x0C000000,
+ GPIO12_NAND_DATA5 = 0x0C001000,
+ GPIO12_LCD_D6 = 0x0C001001,
+ GPIO13_GPIO13 = 0x0D000000,
+ GPIO13_NAND_DATA6 = 0x0D001000,
+ GPIO13_LCD_D7 = 0x0D001001,
+ GPIO14_GPIO14 = 0x0E000000,
+ GPIO14_NAND_DATA7 = 0x0E001000,
+ GPIO14_LCD_D8 = 0x0E001001,
+ GPIO15_CLK_OUT0 = 0x0F000000,
+ GPIO15_GPIO15 = 0x0F000001,
+ GPIO16_GPIO16 = 0x10000000,
+ GPIO16_CLK_OUT1 = 0x10000001,
+ GPIO17_GPIO17 = 0x11000000,
+ GPIO17_CLK_OUT2 = 0x11000001,
+ GPIO17_TEST_CLK_OUT = 0x11000002,
+ GPIO17_TDM_MCLK_OUT = 0x11001000,
+ GPIO17_I2S0_MCLK_OUT = 0x11001001,
+ GPIO17_I2S1_MCLK_OUT = 0x11001002,
+ GPIO18_GPIO18 = 0x12000000,
+ GPIO18_CLK_32K_OUT = 0x12000001,
+ GPIO19_GPIO19 = 0x13000000,
+ GPIO19_RMII_CLK_I = 0x13001000,
+ GPIO20_GPIO20 = 0x14000000,
+ GPIO20_RMII_CLK_O = 0x14001000,
+ GPIO21_CLK_REQ0 = 0x15000000,
+ GPIO21_GPIO21 = 0x15000001,
+ GPIO22_CLK_REQ1 = 0x16000000,
+ GPIO22_GPIO22 = 0x16000001,
+ GPIO23_PWRCTRL = 0x17000000,
+ GPIO23_GPIO23 = 0x17000001,
+ GPIO24_GPIO24 = 0x18000000,
+ GPIO25_GPIO25 = 0x19000000,
+ GPIO25_SSP0_CS = 0x19001000,
+ GPIO26_GPIO26 = 0x1A000000,
+ GPIO26_SSP0_CLK = 0x1A001000,
+ GPIO27_GPIO27 = 0x1B000000,
+ GPIO27_SSP0_RXD = 0x1B001000,
+ GPIO28_GPIO28 = 0x1C000000,
+ GPIO28_SSP0_TXD = 0x1C001000,
+ GPIO29_UART0_RXD = 0x1D000000,
+ GPIO29_GPIO29 = 0x1D000001,
+ GPIO29_UART0_TXD = 0x1D000002,
+ GPIO29_FRAME_SYNC = 0x1D001000,
+ GPIO29_TEST_PIN10 = 0x1D001001,
+ GPIO30_UART0_TXD = 0x1E000000,
+ GPIO30_GPIO30 = 0x1E000001,
+ GPIO30_UART0_RXD = 0x1E000002,
+ GPIO30_LTE_PRE_TX = 0x1E001000,
+ GPIO30_TEST_PIN11 = 0x1E001001,
+ GPIO31_UART0_CTS = 0x1F000000,
+ GPIO31_GPIO31 = 0x1F000001,
+ GPIO31_LTE_TPU_OUT3 = 0x1F001000,
+ GPIO31_UART1_TXD = 0x1F001001,
+ GPIO31_TEST_PIN12 = 0x1F001002,
+ GPIO32_UART0_RTS = 0x20000000,
+ GPIO32_GPIO32 = 0x20000001,
+ GPIO32_LTE_TPU_OUT4 = 0x20001000,
+ GPIO32_UART1_RXD = 0x20001001,
+ GPIO33_GPIO33 = 0x21000000,
+ GPIO33_UART1_RXD = 0x21001000,
+ GPIO33_UART2_TXD = 0x21001001,
+ GPIO33_UART2_RXD = 0x21001002,
+ GPIO34_GPIO34 = 0x22000000,
+ GPIO34_UART1_TXD = 0x22001000,
+ GPIO34_UART2_RXD = 0x22001001,
+ GPIO34_UART2_TXD = 0x22001002,
+ GPIO35_GPIO35 = 0x23000000,
+ GPIO35_I2S0_WS = 0x23001000,
+ GPIO35_TEST_PIN0 = 0x23001001,
+ GPIO35_TDM_FS = 0x23001002,
+ GPIO36_GPIO36 = 0x24000000,
+ GPIO36_I2S0_CLK = 0x24001000,
+ GPIO36_TEST_PIN1 = 0x24001001,
+ GPIO36_TDM_CLK = 0x24001002,
+ GPIO37_GPIO37 = 0x25000000,
+ GPIO37_I2S0_DIN = 0x25001000,
+ GPIO37_TEST_PIN2 = 0x25001001,
+ GPIO37_TDM_DATA_IN = 0x25001002,
+ GPIO38_GPIO38 = 0x26000000,
+ GPIO38_I2S0_DOUT = 0x26001000,
+ GPIO38_TEST_PIN3 = 0x26001001,
+ GPIO38_TDM_DATA_OUT = 0x26001002,
+ GPIO39_GPIO39 = 0x27000000,
+ GPIO39_I2S1_WS = 0x27001000,
+ GPIO39_TEST_PIN4 = 0x27001001,
+ GPIO39_TDM_FS = 0x27001002,
+ GPIO39_PWM0 = 0x27001003,
+ GPIO40_GPIO40 = 0x28000000,
+ GPIO40_I2S1_CLK = 0x28001000,
+ GPIO40_TEST_PIN5 = 0x28001001,
+ GPIO40_TDM_CLK = 0x28001002,
+ GPIO40_PWM1 = 0x28001003,
+ GPIO41_GPIO41 = 0x29000000,
+ GPIO41_I2S1_DIN = 0x29001000,
+ GPIO41_TEST_PIN6 = 0x29001001,
+ GPIO41_TDM_DATA_IN = 0x29001002,
+ GPIO42_GPIO42 = 0x2A000000,
+ GPIO42_I2S1_DOUT = 0x2A001000,
+ GPIO42_TEST_PIN7 = 0x2A001001,
+ GPIO42_TDM_DATA_OUT = 0x2A001002,
+ GPIO43_SCL0 = 0x2B000000,
+ GPIO43_GPIO43 = 0x2B000001,
+ GPIO44_SDA0 = 0x2C000000,
+ GPIO44_GPIO44 = 0x2C000001,
+ GPIO45_GPIO45 = 0x2D000000,
+ GPIO45_SCL1 = 0x2D001000,
+ GPIO46_GPIO46 = 0x2E000000,
+ GPIO46_SDA1 = 0x2E001000,
+ GPIO47_GPIO47 = 0x2F000000,
+ GPIO47_EXT_INT0 = 0x2F000001,
+ GPIO48_GPIO48 = 0x30000000,
+ GPIO48_EXT_INT1 = 0x30000001,
+ GPIO49_GPIO49 = 0x31000000,
+ GPIO49_EXT_INT2 = 0x31000001,
+ GPIO50_GPIO50 = 0x32000000,
+ GPIO50_EXT_INT3 = 0x32000001,
+ GPIO50_TEST_PIN8 = 0x32001000,
+ GPIO51_GPIO51 = 0x33000000,
+ GPIO51_EXT_INT4 = 0x33000001,
+ GPIO51_TEST_PIN9 = 0x33001000,
+ GPIO52_GPIO52 = 0x34000000,
+ GPIO52_EXT_INT5 = 0x34000001,
+ GPIO52_TEST_PIN13 = 0x34001000,
+ GPIO53_GPIO53 = 0x35000000,
+ GPIO53_EXT_INT6 = 0x35000001,
+ GPIO53_TEST_PIN14 = 0x35001000,
+ GPIO54_GPIO54 = 0x36000000,
+ GPIO54_EXT_INT7 = 0x36000001,
+ GPIO54_TEST_PIN15 = 0x36001000,
+ GPIO55_GPIO55 = 0x37000000,
+ GPIO55_RMII_TXEN = 0x37001000,
+ GPIO56_GPIO56 = 0x38000000,
+ GPIO56_RMII_RXEN = 0x38001000,
+ GPIO57_GPIO57 = 0x39000000,
+ GPIO57_RMII_RXD0 = 0x39001000,
+ GPIO58_GPIO58 = 0x3A000000,
+ GPIO58_RMII_RXD1 = 0x3A001000,
+ GPIO59_GPIO59 = 0x3B000000,
+ GPIO59_RMII_TXD0 = 0x3B001000,
+ GPIO60_GPIO60 = 0x3C000000,
+ GPIO60_RMII_TXD1 = 0x3C001000,
+ GPIO61_GPIO61 = 0x3D000000,
+ GPIO61_MDC_SCLK = 0x3D001000,
+ GPIO62_GPIO62 = 0x3E000000,
+ GPIO62_MDC_SDIO = 0x3E001000,
+ GPIO63_GPIO63 = 0x3F000000,
+ GPIO63_PHY_RST = 0x3F001000,
+ GPIO64_GPIO64 = 0x40000000,
+ GPIO64_PHY_INT = 0x40001000,
+ GPIO65_GPIO65 = 0x41000000,
+ GPIO66_GPIO66 = 0x42000000,
+ GPIO66_KEY_COL2 = 0x42000001,
+ GPIO66_EMMC_CLK = 0x42001000,
+ GPIO67_GPIO67 = 0x43000000,
+ GPIO67_KEY_COL3 = 0x43000001,
+ GPIO67_EMMC_CMD = 0x43001000,
+ GPIO68_GPIO68 = 0x44000000,
+ GPIO68_KEY_COL4 = 0x44000001,
+ GPIO68_EMMC_DATA0 = 0x44001000,
+ GPIO69_GPIO69 = 0x45000000,
+ GPIO69_KEY_ROW2 = 0x45000001,
+ GPIO69_EMMC_DATA1 = 0x45001000,
+ GPIO70_GPIO70 = 0x46000000,
+ GPIO70_KEY_ROW3 = 0x46000001,
+ GPIO70_EMMC_DATA2 = 0x46001000,
+
+ GPIO71_GPIO71 = 0x47000000,
+ GPIO71_KEY_ROW4 = 0x47000001,
+ GPIO71_EMMC_DATA3 = 0x47001000,
+ GPIO72_GPIO72 = 0x48000000,
+ GPIO72_SD1_HOST_SDCLK = 0x48001000,
+ GPIO73_GPIO73 = 0x49000000,
+ GPIO73_M_JTAG_TDO = 0x49000001,
+ GPIO73_SD1_CMD = 0x49001000,
+ GPIO73_PS_JTAG_TDO = 0x49001001,
+ GPIO73_PHY_JTAG_TDO = 0x49001002,
+ GPIO73_AP_JTAG_TDO = 0x49001003,
+ GPIO74_GPIO74 = 0x4A000000,
+ GPIO74_M_JTAG_TCK = 0x4A000001,
+ GPIO74_SD1_DATA0 = 0x4A001000,
+ GPIO74_PS_JTAG_TCK = 0x4A001001,
+ GPIO74_PHY_JTAG_TCK = 0x4A001002,
+ GPIO74_AP_JTAG_TCK = 0x4A001003,
+ GPIO75_GPIO75 = 0x4B000000,
+ GPIO75_M_JTAG_TRST = 0x4B000001,
+ GPIO75_SD1_DATA1 = 0x4B001000,
+ GPIO75_PS_JTAG_TRST = 0x4B001001,
+ GPIO75_PHY_JTAG_TRST = 0x4B001002,
+ GPIO75_AP_JTAG_TRST = 0x4B001003,
+ GPIO76_GPIO76 = 0x4C000000,
+ GPIO76_M_JTAG_TMS = 0x4C000001,
+ GPIO76_SD1_DATA2 = 0x4C001000,
+ GPIO76_PS_JTAG_TMS = 0x4C001001,
+ GPIO76_PHY_JTAG_TMS = 0x4C001002,
+ GPIO76_AP_JTAG_TMS = 0x4C001003,
+ GPIO77_GPIO77 = 0x4D000000,
+ GPIO77_M_JTAG_TDI = 0x4D000001,
+ GPIO77_SD1_DATA3 = 0x4D001000,
+ GPIO77_PS_JTAG_TDI = 0x4D001001,
+ GPIO77_PHY_JTAG_TDI = 0x4D001002,
+ GPIO77_AP_JTAG_TDI = 0x4D001003,
+ GPIO78_M_JTAG_TCK = 0x4E000000,
+ GPIO78_GPIO78 = 0x4E000001,
+ GPIO78_PS_JTAG_TCK = 0x4E001000,
+ GPIO78_PHY_JTAG_TCK = 0x4E001001,
+ GPIO78_AP_JTAG_TCK = 0x4E001002,
+ GPIO79_M_JTAG_TDI = 0x4F000000,
+ GPIO79_GPIO79 = 0x4F000001,
+ GPIO79_PS_JTAG_TDI = 0x4F001000,
+ GPIO79_PHY_JTAG_TDI = 0x4F001001,
+ GPIO79_AP_JTAG_TDI = 0x4F001002,
+ GPIO80_M_JTAG_TDO = 0x50000000,
+ GPIO80_GPIO80 = 0x50000001,
+ GPIO80_PS_JTAG_TDO = 0x50001000,
+ GPIO80_PHY_JTAG_TDO = 0x50001001,
+ GPIO80_AP_JTAG_TDO = 0x50001002,
+ GPIO81_M_JTAG_TMS = 0x51000000,
+ GPIO81_GPIO81 = 0x51000001,
+ GPIO81_PS_JTAG_TMS = 0x51001000,
+ GPIO81_PHY_JTAG_TMS = 0x51001001,
+ GPIO81_AP_JTAG_TMS = 0x51001002,
+ GPIO82_M_JTAG_TRST = 0x52000000,
+ GPIO82_GPIO82 = 0x52000001,
+ GPIO82_PS_JTAG_TRST = 0x52001000,
+ GPIO82_PHY_JTAG_TRST = 0x52001001,
+ GPIO82_AP_JTAG_TRST = 0x52001002,
+ GPIO83_KEY_COL0 = 0x53000000,
+ GPIO83_GPIO83 = 0x53000001,
+ GPIO84_KEY_COL1 = 0x54000000,
+ GPIO84_GPIO84 = 0x54000001,
+ GPIO85_KEY_ROW0 = 0x55000000,
+ GPIO85_GPIO85 = 0x55000001,
+ GPIO86_KEY_ROW1 = 0x56000000,
+ GPIO86_GPIO86 = 0x56000001,
+ GPIO87_GPIO87 = 0x57000000,
+ GPIO87_CAM_SPI_CS = 0x57001000,
+ GPIO88_GPIO88 = 0x58000000,
+ GPIO88_CAM_SPI_CLK = 0x58001000,
+ GPIO89_GPIO89 = 0x59000000,
+ GPIO89_CAM_SPI_DATA0 = 0x59001000,
+ GPIO90_GPIO90 = 0x5A000000,
+ GPIO90_CAM_SPI_DATA1 = 0x5A001000,
+ GPIO90_CAM_SPI_TXD = 0x5A001001,
+ GPIO91_GPIO91 = 0x5B000000,
+ GPIO91_CAM_SPI_DATA2 = 0x5B001000,
+ GPIO92_GPIO92 = 0x5C000000,
+ GPIO92_CAM_SPI_DATA3 = 0x5C001000,
+ GPIO93_GPIO93 = 0x5D000000,
+ GPIO93_SPIFC_CS = 0x5D001000,
+ GPIO94_GPIO94 = 0x5E000000,
+ GPIO94_SPIFC_CLK = 0x5E001000,
+ GPIO95_GPIO95 = 0x5F000000,
+ GPIO95_SPIFC_DATA0 = 0x5F001000,
+ GPIO96_GPIO96 = 0x60000000,
+ GPIO96_SPIFC_DATA1 = 0x60001000,
+ GPIO97_GPIO97 = 0x61000000,
+ GPIO97_SPIFC_DATA2 = 0x61001000,
+ GPIO98_GPIO98 = 0x62000000,
+ GPIO98_SPIFC_DATA3 = 0x62001000,
+ GPIO99_GPIO99 = 0x63000000,
+ GPIO100_GPIO100 = 0x64000000,
+ GPIO100_RF_SPI_STR = 0x64001000,
+ GPIO101_GPIO101 = 0x65000000,
+ GPIO101_RF_SPI_CLK = 0x65001000,
+ GPIO102_GPIO102 = 0x66000000,
+ GPIO102_RF_SPI_DATA = 0x66001000,
+ GPIO103_GPIO103 = 0x67000000,
+ GPIO104_GPIO104 = 0x68000000,
+ GPIO104_TD_G0_GPIO2 = 0x68001081,
+ GPIO104_LTE_TPU_OUT0_5 = 0x68001009,
+ GPIO104_W_G0_GPIO2 = 0x68001011,
+ GPIO104_GSM_T_OUT_O_0 = 0x68001021,
+ GPIO105_GPIO105 = 0x69000000,
+ GPIO105_TD_G0_GPIO3 = 0x69001081,
+ GPIO105_LTE_TPU_OUT0_6 = 0x69001009,
+ GPIO105_W_G0_GPIO3 = 0x69001011,
+ GPIO105_GSM_T_OUT_O_1 = 0x69001021,
+ GPIO106_GPIO106 = 0x6A000000,
+ GPIO106_TD_G0_GPIO4 = 0x6A001081,
+ GPIO106_LTE_TPU_OUT0_7 = 0x6A001009,
+ GPIO106_W_G0_GPIO4 = 0x6A001011,
+ GPIO106_GSM_T_OUT_O_2 = 0x6A001021,
+ GPIO107_GPIO107 = 0x6B000000,
+ GPIO107_TD_G0_GPIO5 = 0x6B001081,
+ GPIO107_LTE_TPU_OUT0_8 = 0x6B001009,
+ GPIO107_W_G0_GPIO5 = 0x6B001011,
+ GPIO107_GSM_T_OUT_O_3 = 0x6B001021,
+ GPIO108_GPIO108 = 0x6C000000,
+ GPIO108_TD_G0_GPIO6 = 0x6C001081,
+ GPIO108_LTE_TPU_OUT0_9 = 0x6C001009,
+ GPIO108_W_G0_GPIO6 = 0x6C001011,
+ GPIO108_GSM_T_OUT_O_4 = 0x6C001021,
+ GPIO109_GPIO109 = 0x6D000000,
+ GPIO109_TD_G0_GPIO7 = 0x6D001081,
+ GPIO109_LTE_TPU_OUT0_10 = 0x6D001009,
+ GPIO109_W_G0_GPIO7 = 0x6D001011,
+ GPIO109_GSM_T_OUT_O_5 = 0x6D001021,
+ GPIO110_GPIO110 = 0x6E000000,
+ GPIO110_TD_G0_GPIO8 = 0x6E001081,
+ GPIO110_LTE_TPU_OUT0_11 = 0x6E001009,
+ GPIO110_W_G0_GPIO8 = 0x6E001011,
+ GPIO110_GSM_T_OUT_O_6 = 0x6E001021,
+ GPIO111_GPIO111 = 0x6F000000,
+ GPIO111_TD_G0_GPIO9 = 0x6F001081,
+ GPIO111_LTE_TPU_OUT0_12 = 0x6F001009,
+ GPIO111_W_G0_GPIO9 = 0x6F001011,
+ GPIO111_GSM_T_OUT_O_7 = 0x6F001021,
+ GPIO112_GPIO112 = 0x70000000,
+ GPIO112_MIPI_RFFE_CLK0 = 0x70001006,
+ GPIO112_TD_G0_GPIO10 = 0x70001081,
+ GPIO112_LTE_TPU_OUT0_13 = 0x70001009,
+ GPIO112_W_G0_GPIO10 = 0x70001011,
+ GPIO112_GSM_T_OUT_O_8 = 0x70001021,
+ GPIO113_GPIO113 = 0x71000000,
+ GPIO113_MIPI_RFFE_DATA0 = 0x71001006,
+ GPIO113_TD_G0_GPIO11 = 0x71001081,
+ GPIO113_LTE_TPU_OUT0_14 = 0x71001009,
+ GPIO113_W_G0_GPIO11 = 0x71001011,
+ GPIO113_GSM_T_OUT_O_9 = 0x71001021,
+ GPIO114_GPIO114 = 0x72000000,
+ GPIO114_MIPI_RFFE_CLK1 = 0x72001006,
+ GPIO114_ABB_I2C_SEL_PINMUX = 0x72000001,
+ GPIO114_TD_G0_GPIO12 = 0x72001081,
+ GPIO114_LTE_TPU_OUT0_15 = 0x72001009,
+ GPIO114_W_G0_GPIO12 = 0x72001011,
+ GPIO114_GSM_T_OUT_O_10 = 0x72001021,
+ GPIO115_GPIO115 = 0x73000000,
+ GPIO115_ABB_I2C_SDA_PINMUX = 0x73000001,
+ GPIO115_MIPI_RFFE_DATA1 = 0x73001006,
+ GPIO115_TD_G1_GPIO0 = 0x73001081,
+ GPIO115_LTE_TPU_OUT1_0 = 0x73001009,
+ GPIO115_W_G1_GPIO0 = 0x73001011,
+ GPIO115_GSM_T_OUT_O_11 = 0x73001021,
+
+ GPIO133_GPIO133 = 0x85000000,
+ GPIO133_SIM1_RST = 0x85000001,
+ GPIO133_TD_G1_GPIO1 = 0x85001081,
+ GPIO133_LTE_TPU_OUT1_1 = 0x85001009,
+ GPIO133_W_G1_GPIO1 = 0x85001011,
+ GPIO133_GSM_T_OUT_O_12 = 0x85001021,
+ GPIO134_GPIO134 = 0x86000000,
+ GPIO134_SIM1_CLK = 0x86000001,
+ GPIO134_TD_G1_GPIO2 = 0x86001081,
+ GPIO134_LTE_TPU_OUT1_2 = 0x86001009,
+ GPIO134_W_G1_GPIO2 = 0x86001011,
+ GPIO134_GSM_T_OUT_O_13 = 0x86001021,
+ GPIO135_GPIO135 = 0x87000000,
+ GPIO135_SIM1_DATA = 0x87000001,
+ GPIO135_TD_G1_GPIO3 = 0x87001081,
+ GPIO135_LTE_TPU_OUT1_3 = 0x87001009,
+ GPIO135_W_G1_GPIO3 = 0x87001011,
+ GPIO135_GSM_T_OUT_O_14 = 0x87001021,
+
+ GPIO116_SIM_RST = 0x74000000,
+ GPIO116_GPIO116 = 0x74000001,
+ GPIO117_SIM_CLK = 0x75000000,
+ GPIO117_GPIO117 = 0x75000001,
+ GPIO118_SIM_DATA = 0x76000000,
+ GPIO118_GPIO118 = 0x76000001,
+ GPIO119_GPIO119 = 0x77000000,
+ GPIO119_EXT_INT8 = 0x77000001,
+ GPIO119_M_JTAG_TDO = 0x77000002,
+ GPIO119_URAT0_RTS = 0x77000003,
+ GPIO119_PSJTAG_TDO = 0x77001000,
+ GPIO119_PHYJTAG_TDO = 0x77001001,
+ GPIO119_APJTAG_TDO = 0x77001002,
+ GPIO119_PWM0 = 0x77001003,
+ GPIO120_GPIO120 = 0x78000000,
+ GPIO120_EXT_INT9 = 0x78000001,
+ GPIO120_M_JTAG_TCK = 0x78000002,
+ GPIO120_UART0_CTS = 0x78000003,
+ GPIO120_PSJTAG_TCK = 0x78001000,
+ GPIO120_PHYJTAG_TCK = 0x78001001,
+ GPIO120_APJTAG_TCK = 0x78001002,
+ GPIO120_PWM1 = 0x78001003,
+ GPIO121_GPIO121 = 0x79000000,
+ GPIO121_EXT_INT10 = 0x79000001,
+ GPIO121_M_JTAG_TRST = 0x79000002,
+ GPIO121_PSJTAG_TRST = 0x79001000,
+ GPIO121_PHYJTAG_TRST = 0x79001001,
+ GPIO121_APJTAG_TRST = 0x79001002,
+ GPIO121_UART2_RXD = 0x79001003,
+ GPIO122_GPIO122 = 0x7A000000,
+ GPIO122_EXT_INT11 = 0x7A000001,
+ GPIO122_M_JTAG_TMS = 0x7A000002,
+ GPIO122_PSJTAG_TMS = 0x7A001000,
+ GPIO122_PHYJTAG_TMS = 0x7A001001,
+ GPIO122_APJTAG_TMS = 0x7A001002,
+ GPIO122_UART2_TXD = 0x7A001003,
+ GPIO123_GPIO123 = 0x7B000000,
+ GPIO123_EXT_INT12 = 0x7B000001,
+ GPIO123_M_JTAG_TDI = 0x7B000002,
+ GPIO123_PSJTAG_TDI = 0x7B001000,
+ GPIO123_PHYJTAG_TDI = 0x7B001001,
+ GPIO123_APJTAG_TDI = 0x7B001002,
+ GPIO123_UART2_RTS = 0x7B001003,
+ GPIO124_GPIO124 = 0x7C000000,
+ GPIO124_EXT_INT13 = 0x7C000001,
+ GPIO124_UART2_CTS = 0x7C001000,
+ GPIO125_GPIO125 = 0x7D000000,
+ GPIO125_EXT_INT14 = 0x7D000001,
+ GPIO125_UART1_RTS = 0x7D001000,
+ GPIO126_GPIO126 = 0x7E000000,
+ GPIO126_EXT_INT15 = 0x7E000001,
+ GPIO126_KEY_COL2 = 0x7E000002,
+ GPIO126_UART1_CTS = 0x7E001000,
+ GPIO127_GPIO127 = 0x7F000000,
+ GPIO127_EXT_INT8 = 0x7F000001,
+ GPIO127_KEY_COL3 = 0x7F000002,
+ GPIO128_GPIO128 = 0x80000000,
+ GPIO128_EXT_INT9 = 0x80000001,
+ GPIO128_KEY_COL4 = 0x80000002,
+ GPIO129_GPIO129 = 0x81000000,
+ GPIO129_EXT_INT10 = 0x81000001,
+ GPIO129_KEY_COL5 = 0x81000002,
+ GPIO130_GPIO130 = 0x82000000,
+ GPIO130_EXT_INT11 = 0x82000001,
+ GPIO130_KEY_ROW2 = 0x82000002,
+ GPIO131_GPIO131 = 0x83000000,
+ GPIO131_EXT_INT12 = 0x83000001,
+ GPIO131_KEY_ROW3 = 0x83000002,
+ GPIO132_GPIO132 = 0x84000000,
+ GPIO132_EXT_INT13 = 0x84000001,
+ GPIO132_KEY_ROW4 = 0x84000002,
+
+
+}T_ZDrvGpio_FuncSel;
+#elif defined (_CHIP_ZX297520V2)
+typedef enum
+{
+ /*[31:24]:gpio_id [23:12]:level1_sel [11:0]:level2_sel*/
+ GPIO0_GPIO0 = 0x00000000,
+ GPIO0_NAND_WE = 0x00001000,
+ GPIO1_GPIO1 = 0x01000000,
+ GPIO1_NAND_CS0 = 0x01001000,
+ GPIO2_GPIO2 = 0x02000000,
+ GPIO2_NAND_READY = 0x02001000,
+ GPIO3_GPIO3 = 0x03000000,
+ GPIO3_NAND_CLE = 0x03001000,
+ GPIO3_SPIFC0_SCLK = 0x03001001,
+ GPIO4_GPIO4 = 0x04000000,
+ GPIO4_NAND_ALE = 0x04001000,
+ GPIO5_GPIO5 = 0x05000000,
+ GPIO5_NAND_RE = 0x05001000,
+ GPIO5_SPIFC0_CS = 0x05001001,
+ GPIO6_GPIO6 = 0x06000000,
+ GPIO6_NAND_WRITE_PROTECT = 0x06001000,
+ GPIO7_GPIO7 = 0x07000000,
+ GPIO7_NAND_DATA0 = 0x07001000,
+ GPIO7_SSP1_CS = 0x07001001,
+ GPIO8_GPIO8 = 0x08000000,
+ GPIO8_NAND_DATA1 = 0x08001000,
+ GPIO8_SSP1_CLK = 0x08001001,
+ GPIO9_GPIO9 = 0x09000000,
+ GPIO9_NAND_DATA2 = 0x09001000,
+ GPIO9_SPIFC0_DATA0 = 0x09001001,
+ GPIO10_GPIO10 = 0x0A000000,
+ GPIO10_NAND_DATA3 = 0x0A001000,
+ GPIO10_SPIFC0_DATA1 = 0x0A001001,
+ GPIO11_GPIO11 = 0x0B000000,
+ GPIO11_NAND_DATA4 = 0x0B001000,
+ GPIO11_SPIFC0_DATA2 = 0x0B001001,
+ GPIO12_GPIO12 = 0x0C000000,
+ GPIO12_NAND_DATA5 = 0x0C001000,
+ GPIO12_SPIFC0_DATA3 = 0x0C001001,
+ GPIO13_GPIO13 = 0x0D000000,
+ GPIO13_NAND_DATA6 = 0x0D001000,
+ GPIO13_SSP1_RXD = 0x0D001001,
+ GPIO14_GPIO14 = 0x0E000000,
+ GPIO14_NAND_DATA7 = 0x0E001000,
+ GPIO14_SSP1_TXD = 0x0E001001,
+ GPIO23_CLK_OUT0 = 0x17000000,
+ GPIO23_GPIO23 = 0x17000001,
+ GPIO24_GPIO24 = 0x18000000,
+ GPIO24_CLK_OUT1 = 0x18000001,
+ GPIO25_GPIO25 = 0x19000000,
+ GPIO25_CLK_OUT2 = 0x19000001,
+ GPIO25_TEST_CLK_OUT = 0x19000002,
+ GPIO26_GPIO26 = 0x1A000000,
+ GPIO26_CLK_32K_OUT = 0x1A000001,
+ GPIO27_CLK_REQ0 = 0x1B000000,
+ GPIO27_GPIO27 = 0x1B000001,
+ GPIO29_PWRCTRL1 = 0x1D000000,
+ GPIO29_GPIO29 = 0x1D000001,
+ GPIO30_GPIO30 = 0x1E000000,
+ GPIO30_SSP0_CS = 0x1E001000,
+ GPIO31_GPIO31 = 0x1F000000,
+ GPIO31_SSP0_CLK = 0x1F001000,
+ GPIO32_GPIO32 = 0x20000000,
+ GPIO32_SSP0_RXD = 0x20001000,
+ GPIO33_GPIO33 = 0x21000000,
+ GPIO33_SSP0_TXD = 0x21001000,
+ GPIO34_UART0_RXD = 0x22000000,
+ GPIO34_GPIO34 = 0x22000001,
+ GPIO34_UART0_TXD = 0x22000002,
+ GPIO34_FRAME_SYNC = 0x22001000,
+ GPIO34_TEST_PIN10 = 0x22001001,
+ GPIO35_UART0_TXD = 0x23000000,
+ GPIO35_GPIO35 = 0x23000001,
+ GPIO35_UART0_RXD = 0x23000002,
+ GPIO35_LTE_PRE_TX = 0x23001000,
+ GPIO35_TEST_PIN11 = 0x23001001,
+ GPIO36_UART0_CTS = 0x24000000,
+ GPIO36_GPIO36 = 0x24000001,
+ GPIO36_UART1_RXD = 0x24001000,
+ GPIO36_LTE_TPU_OUT3 = 0x24001001,
+ GPIO36_TEST_PIN12 = 0x24001002,
+ GPIO36_UART1_TXD = 0x24001003,
+ GPIO37_UART0_RTS = 0x25000000,
+ GPIO37_GPIO37 = 0x25000001,
+ GPIO37_UART1_TXD = 0x25001000,
+ GPIO37_LTE_TPU_OUT4 = 0x25001001,
+ GPIO37_UART1_RXD = 0x25001002,
+ GPIO38_GPIO38 = 0x26000000,
+ GPIO38_I2S0_WS = 0x26001000,
+ GPIO38_TEST_PIN0 = 0x26001001,
+ GPIO38_LTE_DATA_DONGLE_CLK = 0x26001002,
+ GPIO38_TDM_FS = 0x26001003,
+ GPIO39_GPIO39 = 0x27000000,
+ GPIO39_I2S0_CLK = 0x27001000,
+ GPIO39_TEST_PIN1 = 0x27001001,
+ GPIO39_LTE_DATA_DONGLE_CMD = 0x27001002,
+ GPIO39_TDM_CLK = 0x27001003,
+ GPIO40_GPIO40 = 0x28000000,
+ GPIO40_I2S0_DIN = 0x28001000,
+ GPIO40_TEST_PIN2 = 0x28001001,
+ GPIO40_LTE_DATA_DONGLE0 = 0x28001002,
+ GPIO40_TDM_DATA_IN = 0x28001003,
+ GPIO41_GPIO41 = 0x29000000,
+ GPIO41_I2S0_DOUT = 0x29001000,
+ GPIO41_TEST_PIN3 = 0x29001001,
+ GPIO41_LTE_DATA_DONGLE1 = 0x29001002,
+ GPIO41_TDM_DATA_OUT = 0x29001003,
+ GPIO42_GPIO42 = 0x2A000000,
+ GPIO42_I2S1_WS = 0x2A001000,
+ GPIO42_TEST_PIN4 = 0x2A001001,
+ GPIO42_LTE_DATA_DONGLE2 = 0x2A001002,
+ GPIO42_TDM_FS = 0x2A001003,
+ GPIO43_GPIO43 = 0x2B000000,
+ GPIO43_I2S1_CLK = 0x2B001000,
+ GPIO43_TEST_PIN5 = 0x2B001001,
+ GPIO43_LTE_DATA_DONGLE3 = 0x2B001002,
+ GPIO43_TDM_CLK = 0x2B001003,
+ GPIO44_GPIO44 = 0x2C000000,
+ GPIO44_I2S1_DIN = 0x2C001000,
+ GPIO44_TEST_PIN6 = 0x2C001001,
+ GPIO44_TDM_DATA_IN = 0x2C001002,
+ GPIO45_GPIO45 = 0x2D000000,
+ GPIO45_I2S1_DOUT = 0x2D001000,
+ GPIO45_TEST_PIN7 = 0x2D001001,
+ GPIO45_TDM_DATA_OUT = 0x2D001002,
+ GPIO46_SCL0 = 0x2E000000,
+ GPIO46_GPIO46 = 0x2E000001,
+ GPIO47_SDA0 = 0x2F000000,
+ GPIO47_GPIO47 = 0x2F000001,
+ GPIO48_GPIO48 = 0x30000000,
+ GPIO48_SCL1 = 0x30001000,
+ GPIO49_GPIO49 = 0x31000000,
+ GPIO49_SDA1 = 0x31001000,
+ GPIO50_GPIO50 = 0x32000000,
+ GPIO50_EXT_INT0 = 0x32000001,
+ GPIO51_GPIO51 = 0x33000000,
+ GPIO51_EXT_INT1 = 0x33000001,
+ GPIO52_GPIO52 = 0x34000000,
+ GPIO52_EXT_INT2 = 0x34000001,
+ GPIO53_GPIO53 = 0x35000000,
+ GPIO53_EXT_INT3 = 0x35000001,
+ GPIO53_TEST_PIN8 = 0x35001000,
+ GPIO54_GPIO54 = 0x36000000,
+ GPIO54_EXT_INT4 = 0x36000001,
+ GPIO54_TEST_PIN9 = 0x36001000,
+ GPIO55_GPIO55 = 0x37000000,
+ GPIO55_EXT_INT5 = 0x37000001,
+ GPIO55_TEST_PIN13 = 0x37001000,
+ GPIO56_GPIO56 = 0x38000000,
+ GPIO56_EXT_INT6 = 0x38000001,
+ GPIO56_CLK_REQ1 = 0x38000002,
+ GPIO56_TEST_PIN14 = 0x38001000,
+ GPIO57_GPIO57 = 0x39000000,
+ GPIO57_EXT_INT7 = 0x39000001,
+ GPIO57_TEST_PIN15 = 0x39001000,
+ GPIO58_GPIO58 = 0x3A000000,
+ GPIO58_SD1_HOST_SDCLK = 0x3A001000,
+ GPIO59_GPIO59 = 0x3B000000,
+ GPIO59_M_JTAG_TDO = 0x3B000001,
+ GPIO59_SD1_CMD = 0x3B001000,
+ GPIO59_PS_JTAG_TDO = 0x3B001001,
+ GPIO59_PHY_JTAG_TDO = 0x3B001002,
+ GPIO59_AP_JTAG_TDO = 0x3B001003,
+ GPIO60_GPIO60 = 0x3C000000,
+ GPIO60_M_JTAG_TCK = 0x3C000001,
+ GPIO60_SD1_DATA0 = 0x3C001000,
+ GPIO60_PS_JTAG_TCK = 0x3C001001,
+ GPIO60_PHY_JTAG_TCK = 0x3C001002,
+ GPIO60_AP_JTAG_TCK = 0x3C001003,
+ GPIO61_GPIO61 = 0x3D000000,
+ GPIO61_M_JTAG_TRST = 0x3D000001,
+ GPIO61_SD1_DATA1 = 0x3D001000,
+ GPIO61_PS_JTAG_TRST = 0x3D001001,
+ GPIO61_PHY_JTAG_TRST = 0x3D001002,
+ GPIO61_AP_JTAG_TRST = 0x3D001003,
+ GPIO62_GPIO62 = 0x3E000000,
+ GPIO62_M_JTAG_TMS = 0x3E000001,
+ GPIO62_SD1_DATA2 = 0x3E001000,
+ GPIO62_PS_JTAG_TMS = 0x3E001001,
+ GPIO62_PHY_JTAG_TMS = 0x3E001002,
+ GPIO62_AP_JTAG_TMS = 0x3E001003,
+ GPIO63_GPIO63 = 0x3F000000,
+ GPIO63_M_JTAG_TDI = 0x3F000001,
+ GPIO63_SD1_DATA3 = 0x3F001000,
+ GPIO63_PS_JTAG_TDI = 0x3F001001,
+ GPIO63_PHY_JTAG_TDI = 0x3F001002,
+ GPIO63_AP_JTAG_TDI = 0x3F001003,
+ GPIO64_M_JTAG_TCK = 0x40000000,
+ GPIO64_GPIO64 = 0x40000001,
+ GPIO64_PS_JTAG_TCK = 0x40001000,
+ GPIO64_PHY_JTAG_TCK = 0x40001001,
+ GPIO64_AP_JTAG_TCK = 0x40001002,
+ GPIO66_M_JTAG_TDI = 0x42000000,
+ GPIO66_GPIO66 = 0x42000001,
+ GPIO66_PS_JTAG_TDI = 0x42001000,
+ GPIO66_PHY_JTAG_TDI = 0x42001001,
+ GPIO66_AP_JTAG_TDI = 0x42001002,
+ GPIO67_M_JTAG_TDO = 0x43000000,
+ GPIO67_GPIO67 = 0x43000001,
+ GPIO67_PS_JTAG_TDO = 0x43001000,
+ GPIO67_PHY_JTAG_TDO = 0x43001001,
+ GPIO67_AP_JTAG_TDO = 0x43001002,
+ GPIO68_M_JTAG_TMS = 0x44000000,
+ GPIO68_GPIO68 = 0x44000001,
+ GPIO68_PS_JTAG_TMS = 0x44001000,
+ GPIO68_PHY_JTAG_TMS = 0x44001001,
+ GPIO68_AP_JTAG_TMS = 0x44001002,
+ GPIO69_M_JTAG_TRST = 0x45000000,
+ GPIO69_GPIO69 = 0x45000001,
+ GPIO69_PS_JTAG_TRST = 0x45001000,
+ GPIO69_PHY_JTAG_TRST = 0x45001001,
+ GPIO69_AP_JTAG_TRST = 0x45001002,
+ GPIO70_KEY_COL0 = 0x46000000,
+ GPIO70_GPIO70 = 0x46000001,
+ GPIO70_EXT_INT8 = 0x46000002,
+ GPIO70_M_JTAG_TDO = 0x46000003,
+ GPIO70_PS_JTAG_TDO = 0x46001000,
+ GPIO70_PHY_JTAG_TDO = 0x46001001,
+ GPIO70_AP_JTAG_TDO = 0x46001002,
+ GPIO70_LTE_DATA_DONGLE4 = 0x46001003,
+ GPIO71_KEY_COL1 = 0x47000000,
+ GPIO71_GPIO71 = 0x47000001,
+ GPIO71_EXT_INT9 = 0x47000002,
+ GPIO71_LTE_DATA_DONGLE5 = 0x47001000,
+ GPIO72_KEY_COL2 = 0x48000000,
+ GPIO72_GPIO72 = 0x48000001,
+ GPIO72_EXT_INT10 = 0x48000002,
+ GPIO72_M_JTAG_TCK = 0x48000003,
+ GPIO72_PS_JTAG_TCK = 0x48001000,
+ GPIO72_PHY_JTAG_TCK = 0x48001001,
+ GPIO72_AP_JTAG_TCK = 0x48001002,
+ GPIO72_LTE_DATA_DONGLE6 = 0x48001003,
+ GPIO73_KEY_COL3 = 0x49000000,
+ GPIO73_GPIO73 = 0x49000001,
+ GPIO73_EXT_INT11 = 0x49000002,
+ GPIO73_LTE_DATA_DONGLE7 = 0x49001000,
+ GPIO74_KEY_ROW0 = 0x4A000000,
+ GPIO74_GPIO74 = 0x4A000001,
+ GPIO74_EXT_INT12 = 0x4A000002,
+ GPIO74_M_JTAG_TRST = 0x4A000003,
+ GPIO74_PS_JTAG_TRST = 0x4A001000,
+ GPIO74_PHY_JTAG_TRST = 0x4A001001,
+ GPIO74_AP_JTAG_TRST = 0x4A001002,
+ GPIO74_LTE_DATA_DONGLE8 = 0x4A001003,
+ GPIO75_KEY_ROW1 = 0x4B000000,
+ GPIO75_GPIO75 = 0x4B000001,
+ GPIO75_EXT_INT13 = 0x4B000002,
+ GPIO75_M_JTAG_TMS = 0x4B000003,
+ GPIO75_PS_JTAG_TMS = 0x4B001000,
+ GPIO75_PHY_JTAG_TMS = 0x4B001001,
+ GPIO75_AP_JTAG_TMS = 0x4B001002,
+ GPIO75_LTE_DATA_DONGLE9 = 0x4B001003,
+ GPIO76_KEY_ROW2 = 0x4C000000,
+ GPIO76_GPIO76 = 0x4C000001,
+ GPIO76_EXT_INT14 = 0x4C000002,
+ GPIO76_M_JTAG_TDI = 0x4C000003,
+ GPIO76_PS_JTAG_TDI = 0x4C001000,
+ GPIO76_PHY_JTAG_TDI = 0x4C001001,
+ GPIO76_AP_JTAG_TDI = 0x4C001002,
+ GPIO76_UART2_RXD = 0x4C001003,
+ GPIO77_KEY_ROW3 = 0x4D000000,
+ GPIO77_GPIO77 = 0x4D000001,
+ GPIO77_EXT_INT15 = 0x4D000002,
+ GPIO77_UART2_TXD = 0x4D001000,
+ GPIO78_GPIO78 = 0x4E000000,
+ GPIO78_MODEM_TXRX_DATA0 = 0x4E001000,
+ GPIO79_GPIO79 = 0x4F000000,
+ GPIO79_MODEM_TXRX_DATA1 = 0x4F001000,
+ GPIO80_GPIO80 = 0x50000000,
+ GPIO80_MODEM_TXRX_DATA2 = 0x50001000,
+ GPIO81_GPIO81 = 0x51000000,
+ GPIO81_MODEM_TXRX_DATA3 = 0x51001000,
+ GPIO82_GPIO82 = 0x52000000,
+ GPIO82_MODEM_TXRX_DATA4 = 0x52001000,
+ GPIO83_GPIO83 = 0x53000000,
+ GPIO83_MODEM_TXRX_DATA5 = 0x53001000,
+ GPIO84_GPIO84 = 0x54000000,
+ GPIO84_MODEM_TXRX_DATA6 = 0x54001000,
+ GPIO85_GPIO85 = 0x55000000,
+ GPIO85_MODEM_TXRX_DATA7 = 0x55001000,
+ GPIO86_GPIO86 = 0x56000000,
+ GPIO86_MODEM_TXRX_DATA8 = 0x56001000,
+ GPIO87_GPIO87 = 0x57000000,
+ GPIO87_MODEM_TXRX_DATA9 = 0x57001000,
+ GPIO88_GPIO88 = 0x58000000,
+ GPIO88_MODEM_TXRX_DATA10 = 0x58001000,
+ GPIO89_GPIO89 = 0x59000000,
+ GPIO89_MODEM_TXRX_DATA11 = 0x59001000,
+ GPIO90_GPIO90 = 0x5A000000,
+ GPIO90_MODEM_RX_DATA0 = 0x5A001000,
+ GPIO91_GPIO91 = 0x5B000000,
+ GPIO91_MODEM_RX_DATA1 = 0x5B001000,
+ GPIO92_GPIO92 = 0x5C000000,
+ GPIO92_MODEM_RX_DATA2 = 0x5C001000,
+ GPIO93_GPIO93 = 0x5D000000,
+ GPIO93_MODEM_RX_DATA3 = 0x5D001000,
+ GPIO94_GPIO94 = 0x5E000000,
+ GPIO94_MODEM_RX_DATA4 = 0x5E001000,
+ GPIO95_GPIO95 = 0x5F000000,
+ GPIO95_MODEM_RX_DATA5 = 0x5F001000,
+ GPIO96_GPIO96 = 0x60000000,
+ GPIO96_MODEM_RX_DATA6 = 0x60001000,
+ GPIO97_GPIO97 = 0x61000000,
+ GPIO97_MODEM_RX_DATA7 = 0x61001000,
+ GPIO98_GPIO98 = 0x62000000,
+ GPIO98_MODEM_RX_DATA8 = 0x62001000,
+ GPIO99_GPIO99 = 0x63000000,
+ GPIO99_MODEM_RX_DATA9 = 0x63001000,
+ GPIO100_GPIO100 = 0x64000000,
+ GPIO100_MODEM_RX_DATA10 = 0x64001000,
+ GPIO101_GPIO101 = 0x65000000,
+ GPIO101_MODEM_RX_DATA11 = 0x65001000,
+ GPIO102_GPIO102 = 0x66000000,
+ GPIO102_MODEM_FCLK_O = 0x66001000,
+ GPIO103_GPIO103 = 0x67000000,
+ GPIO103_MODEM_FRAME_TX_O = 0x67001000,
+ GPIO104_GPIO104 = 0x68000000,
+ GPIO104_MODEM_FRAME_RX_I = 0x68001000,
+ GPIO105_GPIO105 = 0x69000000,
+ GPIO105_MODEM_MCLK_I = 0x69001000,
+ GPIO106_GPIO106 = 0x6A000000,
+ GPIO106_LTE_REF_CLK = 0x6A001000,
+ /*GPIO107 GPIO108*/
+ GPIO109_GPIO109 = 0x6D000000,
+ GPIO110_GPIO110 = 0x6E000000,
+ GPIO110_GSM_OUT_OLD_O_12 = 0x6E000001,
+ GPIO111_PWRCTRL2 = 0x6F000000,
+ GPIO111_GPIO111 = 0x6F000001,
+ GPIO112_GPIO112 = 0x70000000,
+ GPIO112_RF_SPI0_STR0 = 0x70001000,
+ GPIO113_GPIO113 = 0x71000000,
+ GPIO113_RF_SPI0_STR1 = 0x71001000,
+ GPIO114_GPIO114 = 0x72000000,
+ GPIO114_RF_SPI0_CLK = 0x72001000,
+ GPIO115_GPIO115 = 0x73000000,
+ GPIO115_RF_SPI0_DIN = 0x73001000,
+ GPIO116_GPIO116 = 0x74000000,
+ GPIO116_RF_SPI0_DATA = 0x74001000,
+ GPIO117_GPIO117 = 0x75000000,
+ GPIO117_RF_SPI1_STR0 = 0x75001000,
+ GPIO118_GPIO118 = 0x76000000,
+ GPIO118_RF_SPI1_CLK = 0x76001000,
+ GPIO119_GPIO119 = 0x77000000,
+ GPIO119_RF_SPI1_DIN = 0x77001000,
+ GPIO120_GPIO120 = 0x78000000,
+ GPIO120_RF_SPI1_DATA = 0x78001000,
+ /*GPIO121 --GPIO144*/
+ GPIO145_GPIO145 = 0x91000000,
+ GPIO145_RMII_TXEN = 0x91001000,
+ GPIO146_GPIO146 = 0x92000000,
+ GPIO146_RMII_RXEN = 0x92001000,
+ GPIO147_GPIO147 = 0x93000000,
+ GPIO147_RMII_RXD0 = 0x93001000,
+ GPIO148_GPIO148 = 0x94000000,
+ GPIO148_RMII_RXD1 = 0x94001000,
+ GPIO149_GPIO149 = 0x95000000,
+ GPIO149_RMII_TXD0 = 0x95001000,
+ GPIO150_GPIO150 = 0x96000000,
+ GPIO150_RMII_TXD1 = 0x96001000,
+ GPIO151_GPIO151 = 0x97000000,
+ GPIO151_MDC_SCLK = 0x97001000,
+ GPIO152_GPIO152 = 0x98000000,
+ GPIO152_MDC_SDIO = 0x98001000,
+ GPIO153_GPIO153 = 0x99000000,
+ GPIO153_PHY_RST = 0x99001000,
+ GPIO154_GPIO154 = 0x9A000000,
+ GPIO154_RMII_CLK_O = 0x9A001000,
+ GPIO155_GPIO155 = 0x9B000000,
+ GPIO155_RMII_CLK_I = 0x9B001000,
+
+}T_ZDrvGpio_FuncSel;
+#endif
+/*******************************************************************************
+ * Global function declarations *
+ ******************************************************************************/
+/**
+*@brief This function is used to get descriptor of pin.
+*@param name the name used to distinguish gpio, must added in g_GpioConfig[](in gpio_ref.c)
+*
+*@return pointer of gpio descriptor if success, errcode otherwise
+*/
+UINT32 zDrvGpio_Request(CHAR *name);
+
+/**
+ *@brief This function is used to free this gpio, so others can request it
+ *@param gpio_id pointer of gpio descriptor
+ *
+ *@return 0 if success, errcode otherwise.
+ */
+SINT32 zDrvGpio_Free(UINT32 gpio_id);
+
+/**
+ *@brief This function is used to set the pin use ,used as GPIO or other function
+ *@param gpio_id gpio id
+ *@param func_sel gpio function sel
+ *
+ *@return 0 if success, errcode otherwise.
+ */
+SINT32 zDrvGpio_SetFunc(UINT32 gpio_id, T_ZDrvGpio_FuncSel func_sel);
+
+/**
+ *@brief This function is used to set gpio internal pull up or pull down or none
+ *@param gpio_id gpio id
+ *@param val pull function sel
+ *
+ *@return 0 if success, errcode otherwise.
+ */
+SINT32 zDrvGpio_PullUpDown(UINT32 gpio_id, T_ZDrvGpio_PullUp val);
+
+/**
+ *@brief This function is used to set direction of gpio, in or out
+ *@param gpio_id gpio id
+ *@param value gpio direction sel
+ *
+ *@return none.
+ */
+VOID zDrvGpio_SetDirection(UINT32 gpio_id, T_ZDrvGpio_IoDirection value);
+
+/**
+ *@brief This function is used to get direction of gpio
+ *@param gpio_id gpio id
+ *
+ *@return gpio direction.
+ */
+T_ZDrvGpio_IoDirection zDrvGpio_GetDirection(UINT32 gpio_id);
+
+/**
+ *@brief This function is used to set output value
+ *@param gpio_id gpio id
+ *@param value gpio output val sel
+ *
+ *@return none.
+ */
+VOID zDrvGpio_SetOutputValue(UINT32 gpio_id, T_ZDrvGpio_IoVal value);
+
+/**
+ *@brief This function is used to get output value
+ *@param gpio_id gpio id
+ *
+ *@return output value(high or low).
+ */
+T_ZDrvGpio_IoVal zDrvGpio_GetOutputValue(UINT32 gpio_id);
+
+/**
+ *@brief This function is used to get input value
+ *@param gpio_id gpio id
+ *
+ *@return input value(high or low).
+ */
+T_ZDrvGpio_IoVal zDrvGpio_GetInputValue(UINT32 gpio_id);
+
+/**
+ *@brief This function is used to set gpio pin for jtag
+ *@param jtagNum jtag id 0/1/2
+ *@param function sel jtag connect to which core(0:m0jtag, 1:psjtag, 2:phyjtag, 3:apjtag)
+ *
+ *@return none.
+ */
+VOID zDrvGpio_JtagConfig(UINT32 jtagNum, UINT32 function);
+#endif
+#endif
diff --git a/cp/ps/driver/inc/misc/drvs_headsetkey.h b/cp/ps/driver/inc/misc/drvs_headsetkey.h
new file mode 100644
index 0000000..3c496e7
--- /dev/null
+++ b/cp/ps/driver/inc/misc/drvs_headsetkey.h
@@ -0,0 +1,39 @@
+/*******************************************************************************
+ * Copyright (C) 2007, ZTE Corporation.
+ *
+ * File Name: drvs_headsetkey.h
+ * File Mark:
+ * Description:
+ * Others:
+ * Version: V0.5
+ * Author: zhangyingjun
+ * Date: 2010-02-12
+ * History 1:
+ * Date:
+ * Version:
+ * Author:
+ * Modification:
+ * History 2:
+ ********************************************************************************/
+
+#ifndef _DRVS_HEADSETKEY_H
+#define _DRVS_HEADSETKEY_H
+
+
+
+typedef enum
+{
+ HEADSET_TAKEOFF, /*ÌýͲÄÃÆð */
+ HEADSET_PUTDOWN, /* ÌýͲ¹ÒÉÏ*/
+
+ MAX_HEADSET_EVENT_INT
+} T_ZDrvHeadset_EventInt;
+
+typedef VOID (*zDrvHeadset_CallbackFunc)(T_ZDrvHeadset_EventInt);
+
+
+SINT32 zDrvHeadsetkey_RegisterCallback(zDrvHeadset_CallbackFunc headset_callback);
+
+SINT32 zDrvHeadsetkey_UnregisterCallback(VOID);
+
+#endif
diff --git a/cp/ps/driver/inc/misc/drvs_i2c.h b/cp/ps/driver/inc/misc/drvs_i2c.h
new file mode 100644
index 0000000..8a70f1e
--- /dev/null
+++ b/cp/ps/driver/inc/misc/drvs_i2c.h
@@ -0,0 +1,283 @@
+/*******************************************************************************
+ * Copyright (C) 2007, ZTE Corporation.
+ *
+ * File Name:
+ * File Mark:
+ * Description:
+ * Others:
+ * Version: V0.5
+ * Author: Zhenghong
+ * Date: 2008-01-10
+ * History 1:
+ * Date: 2012-07-16
+ * Version: V1.0
+ * Author: zhouqi
+ * Modification: 1. Ôö¼Ó T_ZDrvI2c_BusFreq ö¾ÙÖÐ 300KHZ ¶¨Òå
+ 2. ÐÞ¸Ä T_ZDrvI2c_DevFlagType ÖеÚÒ»¸ö I2C_DFLT_ADDR_DEV Ϊ I2C_10BIT_SLAVE_ADDR
+ 3. ÔÚ T_ZDrvI2c_DevFlagType Ôö¼Ó I2C_USE_INT ¶¨Òå
+ 4. Ôö¼Ó²¿·Ö×¢ÊÍÓë˵Ã÷
+ * History 2:
+ ******************************************************************************/
+#ifndef _DRVS_I2C_H
+#define _DRVS_I2C_H
+
+
+
+/**********************************************************/
+/** @defgroup T_ZDrvI2c_BusNum 7520ÓÐ 3 ¸öI2C½Ó¿Ú, 7520V2 È¥µôÒ»¸öI2C
+ */
+typedef enum
+{
+ //I2C_BUS_0 = 0,
+ I2C_BUS_1 = 1,
+ I2C_BUS_2 = 2, /* pmic i2c */
+ MAX_I2C_BUS_NUM
+}T_ZDrvI2c_BusNum;
+
+
+/**********************************************************/
+/** @defgroup T_ZDrvI2c_BusFreq
+ */
+typedef enum{
+ I2C_FREQ_ONE_HUNDRED_KILO_HZ = 100*1000,
+ I2C_FREQ_THREE_HUNDRED_KILO_HZ = 300*1000,
+ I2C_FREQ_FOUR_HUNDRED_KILO_HZ = 400*1000,
+ MAX_I2C_BUS_FREQ
+}T_ZDrvI2c_BusFreq;
+
+
+/**********************************************************/
+/** @defgroup T_ZDrvI2c_DevFlagType
+ */
+typedef enum {
+ I2C_10BIT_SLAVE_ADDR = 0x0001 << 0, /* ±êʶʹÓà --10λ´Ó»úµØÖ·-- */
+ /* ĬÈϲ»Ê¹ÓÃλ 7λ´Ó»úµØÖ· */
+
+ I2C_MEM_DEV = 0x0001 << 1, /* ±êʶʹÓà --16λ¼Ä´æÆ÷µØÖ·-- */
+ I2C_REG_DEV = 0x0001 << 2, /* ±êʶʹÓà --8λ¼Ä´æÆ÷µØÖ·-- */
+
+ I2C_NACK_LAST_BYTE = 0x0001 << 3, /* NACK last byte read from slave */
+ I2C_NOP_LAST_BYTE = 0x0001 << 4, /* Let slave release SDA after last */
+ I2C_M_COMBINE = 0x0001 << 5, /* ¾µäµÄ×éºÏ¶Áģʽ */
+ I2C_STOP_START_BEFORE_READ = 0x0001 << 6, /* During a read transaction, gen. */
+ /* a STOP & START after writing */
+ /* the slave addr(just before read) */
+ I2C_CLK_START_BEFORE_RW = 0x0001 << 7, /* Generate a clock and a START */
+ /* before every I/O operation. */
+ I2C_USE_INT = 0x0001 << 8 /* ʹÓÃÖжÏģʽ´«ÊäÊý¾Ý */
+ /* Çø±ðΪ START ºó£¬»ñÈ¡ÐźÅÁ¿£¬Ïß³Ì¹ÒÆð*/
+ /* ½¨ÒéÔÚ´«ËͶà×Ö½ÚʱʹÓà */
+} T_ZDrvI2c_DevFlagType;
+
+/**********************************************************************/
+/* ˵Ã÷:
+
+ 1. ÔÚĬÈÏÇé¿öÏ£¬Ê¹Óà 7λ ´Ó»úµØÖ·£¬
+ 8λ ¼Ä´æÆ÷µØÖ·
+ ±ê׼ʱÐòµÄ ¼òµ¥Ð´¡¢ ¼òµ¥¶Á¡¢ ×éºÏ¶Áģʽ--
+ ²»Ê¹ÓÃÖжÏ
+
+ 2. ÒÔǰÅäÖÃµÄ ÒÔϲÎÊýÏÖÔÚ²»ÔÙʹÓã¬ÏÈǰÅäÖõÄÒ²²»Óøü¸Ä£¬µ«¶¼Ä¬ÈÏΪ --±ê×¼×éºÏ¶ÁʱÐò--
+ Èç¹ûÓÐÌØÊâʱÐò£¬Çë¸æÖª
+
+ I2C_NACK_LAST_BYTE ÔÚU207ûÓз¢ÏÖʹÓÃ
+ I2C_NOP_LAST_BYTE ÔÚU207ûÓз¢ÏÖʹÓÃ
+ I2C_M_COMBINE RDA5802\mt9d113ʹÓÃ
+ I2C_STOP_START_BEFORE_READ PMIC\OV7670\0V9656ʹÓÃ
+ I2C_CLK_START_BEFORE_RW ÔÚU207ûÓз¢ÏÖʹÓÃ
+
+ 3. ÏÖÔڿɸù¾ÝÒ»ÏÂÁÐ×ÓÅäÖÃ:
+
+ static T_ZDrvI2c_Device s_mt9d113I2cDev =
+ {
+ I2C_BUS_0,
+ EXAMPLE_SLAVE_ADDRESS,
+ I2C_FREQ_THREE_HUNDRED_KILO_HZ,
+ 100,
+ 1,
+ -----------------------------------------------------------
+ I2C_10BIT_SLAVE_ADDR | I2C_REG_DEV | I2C_USE_INT,
+ // ʹÓÃ10´Ó»úµØÖ· 8λ¼Ä´æÆ÷µØÖ· ʹÓÃÖжϷ½Ê½
+
+ I2C_MEM_DEV,
+ // 16λ¼Ä´æÆ÷µØÖ·, 8´Ó»úµØÖ· ²»Ê¹ÓÃÖжÏ
+ ----------------------------------------------------------
+ NULL,
+ };
+*********************************************************************/
+/**********************************************************/
+/** @defgroup T_ZDrvI2c_Device
+ */
+typedef struct _T_ZDrvI2c_Device
+{
+
+ T_ZDrvI2c_BusNum bus_num; /* indicate which i2c bus the device belongs to */
+ UINT16 slv_addr; /* device addr on the i2c bus, 10bits for memory device and 7bits for registers */
+ T_ZDrvI2c_BusFreq bus_freq; /* the i2c bus transfer freq according to the device require*/
+ UINT32 timeout; /* time threshold waiting for bus idle */
+ UINT8 retries; /* times we'll try again if the bus is busy */
+ T_ZDrvI2c_DevFlagType flags; /* indicate the operation features */
+
+ VOID *privData;
+}T_ZDrvI2c_Device;
+
+
+/*******************************************************************************
+* Function Prototypes *
+*******************************************************************************/
+
+
+/*******************************************************************************
+ * Function: zDrvI2c_DevRead
+ * Description: I2C×ÜÏß¼òµ¥¶Á
+ * Parameters:
+ * Input:
+ *
+ * Output:
+ *
+ * Returns:
+ *
+ *
+ * Others: 1. ×ñÑI2C×ÜÏß ×éºÏ¶Á ±êÏßÐÒé¡£
+ 2. ×î´óÒ»´Î¶ÁÈ¡ --32-- ¸ö×Ö½ÚÊý¾Ý¡£
+ ********************************************************************************/
+SINT32 zDrvI2c_DevRead( T_ZDrvI2c_Device *i2c_dev, UINT16 regAddr, UINT8 *readBuf, UINT32 readNum );
+
+
+
+/*******************************************************************************
+ * Function: zDrvI2c_DevWrite
+ * Description: I2C×ÜÏß¼òµ¥Ð´
+ * Parameters:
+ * Input:
+ *
+ * Output:
+ *
+ * Returns:
+ *
+ *
+ * Others: 1. ×ñÑI2C×ÜÏß ¼òµ¥Ð´ ±êÏßÐÒé¡£
+ 2. ×î´óÒ»´ÎдÈë --30-- ¸ö×Ö½ÚÊý¾Ý¡£
+ ********************************************************************************/
+SINT32 zDrvI2c_DevWrite( T_ZDrvI2c_Device *i2c_dev, UINT16 regAddr, UINT8 *writeBuf, UINT32 writeNum );
+
+
+
+/*******************************************************************************
+ * Function: zDrvI2c_DevLock_BeforePSM
+ * Description: ÔÚ¹ØÖжϲ¢µ÷Óà PSM ½Ó¿Úǰ£¬»ñÈ¡ I2C Éè±¸Ëø¡£
+ * Parameters:
+ * Input:
+ *
+ * Output:
+ *
+ * Returns:
+ *
+ *
+ * Others: 1. ¹ØÖжϲ¢µ÷Óà PSM ½Ó¿Úʱ£¬I2C ¿ÉÄÜÕýÔÚ±»ÆäËûÏß³ÌʹÓá£
+ * ʹÓô˽ӿڵȴýÆäËûÏß³ÌʹÓÃÍê±ÏºóÍ˳ö¡£
+ ********************************************************************************/
+SINT32 zDrvI2c_DevLock_BeforePSM( T_ZDrvI2c_BusNum busNum);
+
+
+
+/*******************************************************************************
+ * Function: zDrvI2c_DevUnlock_AfterPSM
+ * Description: ²»ÔÙʹÓà PSM ½Ó¿Úʱ£¬ÊÍ·Å I2C Éè±¸Ëø¡£
+ * Parameters:
+ * Input:
+ *
+ * Output:
+ *
+ * Returns:
+ *
+ *
+ * Others: 1. ÓëzDrvI2c_DevLock_BeforePSM½á¶ÔʹÓá£
+ ********************************************************************************/
+SINT32 zDrvI2c_DevUnlock_AfterPSM( T_ZDrvI2c_BusNum busNum);
+
+
+
+/*******************************************************************************
+ * Function: zDrvI2c_DevRead
+ * Description: I2C×ÜÏß¼òµ¥¶Á£¬Ê¹ÓÃÊ¡µçģʽ
+ * Parameters:
+ * Input:
+ *
+ * Output:
+ *
+ * Returns:
+ *
+ *
+ * Others: 1. ×ñÑI2C×ÜÏß ×éºÏ¶Á ±êÏßÐÒé¡£
+ 2. ×î´óÒ»´Î¶ÁÈ¡ --32-- ¸ö×Ö½ÚÊý¾Ý¡£
+ 3. Ö÷ÒªÊÇÔÚ²Ù×÷ÖÐ --²»»ñÈ¡»¥³âÁ¿--£¬ Á½µÄÏ̲߳»ÄÜͬʱµ÷ÓÃ
+ ********************************************************************************/
+SINT32 zDrvI2c_DevRead_PSM( T_ZDrvI2c_Device *i2c_dev, UINT16 regAddr, UINT8 *readBuf, UINT32 readNum );
+
+
+
+
+/*******************************************************************************
+ * Function: zDrvI2c_DevWrite
+ * Description: I2C×ÜÏß¼òµ¥Ð´£¬Ê¹ÓÃÊ¡µçģʽ
+ * Parameters:
+ * Input:
+ *
+ * Output:
+ *
+ * Returns:
+ *
+ *
+ * Others: 1. ×ñÑI2C×ÜÏß ¼òµ¥Ð´ ±êÏßÐÒé¡£
+ 2. ×î´óÒ»´ÎдÈë --30-- ¸ö×Ö½ÚÊý¾Ý¡£
+ 3. Ö÷ÒªÊÇÔÚ²Ù×÷ÖÐ --²»»ñÈ¡»¥³âÁ¿--£¬ Á½µÄÏ̲߳»ÄÜͬʱµ÷ÓÃ
+ ********************************************************************************/
+SINT32 zDrvI2c_DevWrite_PSM( T_ZDrvI2c_Device *i2c_dev, UINT16 regAddr, UINT8 *writeBuf, UINT32 writeNum );
+
+
+
+/*******************************************************************************
+ * Function: zDrvI2c_DevRead_ByteStream
+ * Description: I2C×ÜÏß×Ö½ÚÁ÷¶Á
+ * Parameters:
+ * Input:
+ *
+ * Output:
+ *
+ * Returns:
+ *
+ *
+ * Others: 1. ×ñÑI2C×ÜÏß ¼òµ¥¶Á ±êÏßÐÒé¡£
+ 2. ֻд I2C Æ÷¼þµØÖ·£¬----------²»Ê¹ÓüĴæÆ÷µØÖ·-----¡£
+ 2. ×î´óÒ»´Î¶ÁÈ¡ 32 ¸ö×Ö½ÚÊý¾Ý¡£
+ ********************************************************************************/
+SINT32 zDrvI2c_DevRead_ByteStream( T_ZDrvI2c_Device *i2c_dev, UINT8 *readBuf, UINT32 readNum );
+
+
+
+
+/*******************************************************************************
+ * Function: zDrvI2c_DevWrite_ByteStream
+ * Description: I2C×ÜÏß×Ö½ÚÁ÷д
+ * Parameters:
+ * Input:
+ *
+ * Output:
+ *
+ * Returns:
+ *
+ *
+ * Others: 1. ×ñÑI2C×ÜÏß ¼òµ¥Ð´ ±êÏßÐÒé¡£
+ 2. ֻд I2C Æ÷¼þµØÖ·£¬----------²»Ê¹ÓüĴæÆ÷µØÖ·-----¡£
+ 2. ×î´óÒ»´ÎдÈë 30 ¸ö×Ö½ÚÊý¾Ý¡£
+ ********************************************************************************/
+SINT32 zDrvI2c_DevWrite_ByteStream( T_ZDrvI2c_Device *i2c_dev, UINT8 *writeBuf, UINT32 writeNum );
+
+
+
+
+
+#endif /* _DRVS_I2C_H */
+
+
diff --git a/cp/ps/driver/inc/misc/drvs_i2s.h b/cp/ps/driver/inc/misc/drvs_i2s.h
new file mode 100644
index 0000000..2f19362
--- /dev/null
+++ b/cp/ps/driver/inc/misc/drvs_i2s.h
@@ -0,0 +1,489 @@
+/**
+ * @file drvs_i2s.h
+ * @brief Public APIs of i2s drivers
+ *
+ * Copyright (C) 2017 Sanechips Technology Co., Ltd.
+ * @author Xinqiang Xu <xu.xinqiang@sanechips.com.cn>
+ * @ingroup si_cp_drv_id
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ */
+
+#ifndef _HAL_I2S_H
+#define _HAL_I2S_H
+
+/*******************************************************************************
+ * Include header files *
+ ******************************************************************************/
+#include "drvs_general.h"
+#include "drvs_io_voice.h"
+
+/*******************************************************************************
+ * Macro definitions *
+ ******************************************************************************/
+
+/*******************************************************************************
+ * Type definitions *
+ ******************************************************************************/
+/* i2s index */
+typedef enum {
+ I2S_1 = 0,
+ I2S_2 = 1,
+
+ MAX_I2S_ID
+} T_ZDrvI2S_Id;
+
+typedef enum {
+ I2S_TX = 0,
+ I2S_RX = 1
+} T_ZDrvI2S_TransDirection;
+
+typedef enum {
+ I2S_NORMAL_MODE,
+ I2S_LOOPBACK_MODE,
+
+ MAX_TEST_MODE
+} T_ZDrvI2S_TestMode;
+
+typedef enum {
+ PCM_NORMAL_MODE,
+ PCM_TEAK_MODE,
+
+ MAX_PCM_MODE
+} T_ZDrvI2S_PcmMode;
+
+typedef enum {
+ PCM_LSB_FIRST,
+ PCM_MSB_FIRST,
+
+ MAX_PCM_FIRSTBIT
+} T_ZDrvI2S_PcmFirstBitSel;
+
+typedef enum {
+ PCM_1TIME_SLOT = 0x00,
+ PCM_2TIME_SLOT = 0x01,
+ PCM_4TIME_SLOT = 0x03,
+ PCM_8TIME_SLOT = 0x07,
+ PCM_16TIME_SLOT = 0x0f,
+
+ MAX_PCM_SLOTNUM
+} T_ZDrvI2S_PcmSlotNum;
+
+/* i2s operation mode */
+typedef enum {
+ I2S_DATA_16BIT = 0x0f,
+ I2S_DATA_17BIT = 0x10,
+ I2S_DATA_18BIT = 0x11,
+ I2S_DATA_19BIT = 0x12,
+ I2S_DATA_20BIT = 0x13,
+ I2S_DATA_21BIT = 0x14,
+ I2S_DATA_22BIT = 0x15,
+ I2S_DATA_23BIT = 0x16,
+ I2S_DATA_24BIT = 0x17,
+ I2S_DATA_25BIT = 0x18,
+ I2S_DATA_26BIT = 0x19,
+ I2S_DATA_27BIT = 0x1a,
+ I2S_DATA_28BIT = 0x1b,
+ I2S_DATA_29BIT = 0x1c,
+ I2S_DATA_30BIT = 0x1d,
+ I2S_DATA_31BIT = 0x1e,
+ I2S_DATA_32BIT = 0x1f,
+
+ MAX_I2S_DATA_FMT
+} T_ZDrvI2S_DataFmt;
+
+typedef enum {
+ I2S_TS_16CYCLE = 0x0f,
+ I2S_TS_17CYCLE = 0x10,
+ I2S_TS_18CYCLE = 0x11,
+ I2S_TS_19CYCLE = 0x12,
+ I2S_TS_20CYCLE = 0x13,
+ I2S_TS_21CYCLE = 0x14,
+ I2S_TS_22CYCLE = 0x15,
+ I2S_TS_23CYCLE = 0x16,
+ I2S_TS_24CYCLE = 0x17,
+ I2S_TS_25CYCLE = 0x18,
+ I2S_TS_26CYCLE = 0x19,
+ I2S_TS_27CYCLE = 0x1a,
+ I2S_TS_28CYCLE = 0x1b,
+ I2S_TS_29CYCLE = 0x1c,
+ I2S_TS_30CYCLE = 0x1d,
+ I2S_TS_31CYCLE = 0x1e,
+ I2S_TS_32CYCLE = 0x1f,
+
+ MAX_I2S_TS_WIDTH
+} T_ZDrvI2S_TsWidth;
+
+#if 1//defined _USE_EVB2963
+/*i2s track select*/
+typedef enum {
+ DOUBLE_TRACK = 0x00,
+ LEFT_TRACK = 0x01,
+ RIGHT_TRACK = 0x02,
+
+ MAX_I2S_TRACK_FMT
+} T_ZDrvI2S_TrackFmt;
+
+/*i2s clock source in master mode*/
+typedef enum {
+ PCLK_DIVIDE = 0x00,
+ I2S_SCLK_DIVIDE = 0x01,
+ EQUAL_TO_SCLK = 0x02,
+
+ MAX_I2S_CLK_SOURCE
+} T_ZDrvI2S_ClkSource;
+
+/*i2s clock mode*/
+typedef enum {
+ TRANS_POSITIVE_NEGATIVE = 0,
+ TRANS_NEGATIVE_POSITIVE ,
+
+ MAX_EDGE_SELECT
+} T_ZDrvI2S_ClkEdgeSel;
+
+#endif
+
+typedef VOID (*T_ZDrvI2S_AUD_PLAY_CB)(VOID);
+
+/* i2s configuration */
+
+/*i2s clock mode*/
+typedef enum {
+ I2S_TIME_MODE = 0,
+ PCM_TIME_MODE ,
+
+ MAX_I2S_TIME_MODE
+} T_ZDrvI2S_ClkMode;
+
+typedef enum {
+ PCM_FSYNC_LENGTH_1CLK,
+ PCM_FSYNC_LENGTH_2CLK,
+ PCM_FSYNC_LENGTH_3CLK,
+ PCM_FSYNC_LENGTH_4CLK,
+ PCM_FSYNC_LENGTH_5CLK,
+ PCM_FSYNC_LENGTH_6CLK,
+ PCM_FSYNC_LENGTH_7CLK,
+ PCM_FSYNC_LENGTH_8CLK,
+
+ MAX_PCM_FSYNC
+} T_ZDrvI2S_PcmFsyncLen;
+
+typedef enum {
+ FIRST_DATA_ALIGN_TO_FIRST_CYCLE,
+ FIRST_DATA_ALIGN_TO_SECOND_CYCLE,
+
+ MAX_7510_DATA_ALIGN_MODE
+} T_ZDrvI2S_DataAlignMode;
+
+typedef enum {
+ TIMING_I2S_MONO_RIGHT = 0,
+ TIMING_I2S_MONO_LEFT,
+ TIMING_I2S_ST_2CHN_1LANE,
+ TIMING_I2S_ST_4CHN_2LANE,
+ TIMING_I2S_ST_6CHN_3LANE,
+ TIMING_I2S_ST_8CHN_4LANE,
+ TIMING_TDM_1CHN_1LANE_1TS,
+ TIMING_TDM_2CHN_1LANE_2TS,
+
+ MAX_TMING_SELECT
+} T_ZDrvI2S_TimingType;
+
+/**
+ * @brief describe the i2s device timing config info
+ * @param tTimingTp tTimingTp
+ * @param tTimingSel tTimingSel
+ * @param tChnNum tChnNum
+ * @param tLaneNum tLaneNum
+ * @param tTsCfg tTsCfg
+ */
+typedef struct {
+ T_ZDrvI2S_TimingType tTimingTp;
+ T_ZDrvI2S_ClkMode tTimingSel;
+ UINT8 tChnNum;
+ UINT8 tLaneNum;
+ UINT8 tTsCfg;
+
+} T_ZDrvI2S_TimingCfg;
+
+typedef enum {
+ PCM_LONG_FSYNC,
+ PCM_SHORT_FSYNC,
+ MAX_PCM_LS_FSYNC
+} T_ZDrvI2S_PcmFsync;
+
+typedef enum {
+ TDM_TEAK_EXTRA_CYCLE,
+ TDM_NO_EXTRA_CYCLE,
+ MAX_TDM_EXTRA_CYCLE
+} T_ZDrvI2S_TdmExtCycle;
+
+typedef enum {
+ DATA_ALIGN_STD_I2S,
+ DATA_ALIGN_MSB_JUSTIF,
+ DATA_ALIGN_LSB_JUSTIF,
+ DATA_ALIGN_NORMAL,
+ MAX_DATA_ALIGN_MODE
+} T_ZDrvI2S_TransMode;
+
+typedef enum {
+ REF_CLK26M,
+ REF_CLK104M,
+ REF_CLK122M88,
+
+ REF_CLK_MAX
+} T_I2s_RefClkForI2s;
+
+/**
+ * @brief describe the i2s device config info
+ * @param bMaster TRUE: master mode; FALSE: slave mode
+ * @param tDataFmt T_ZDrvI2S_DataFmt
+ * @param tTsWidth T_ZDrvI2S_TsWidth
+ * @param sample_rate sample rate of auido file
+ * @param tClkMode the clk mode of i2s
+ * @param tTansmit_edge the clk edge select
+ * @param tTrackFmt tTrackFmt
+ * @param tTestMode tTestMode
+ * @param tDataAlignMode tDataAlignMode
+ * @param tPcmMode; tPcmMode
+ * @param tPcmFirstBit tPcmFirstBit
+ * @param tPcmFsynLen tPcmFsynLen
+ * @param tPcmSlotNum tPcmSlotNum
+ * @param tTimingType tTimingType
+ * @param tPcmFsync tPcmFsync
+ * @param tTdmExtCycle only exit in the 7520
+ * @param tTransMode tTransMode
+ * @param refclk refclk
+ */
+typedef struct {
+ BOOL bMaster;
+ T_ZDrvI2S_DataFmt tDataFmt;
+ T_ZDrvI2S_TsWidth tTsWidth;
+ UINT32 sample_rate;
+ T_ZDrvI2S_ClkMode tClkMode;
+ T_ZDrvI2S_ClkEdgeSel tTansmit_edge;
+ T_ZDrvI2S_TrackFmt tTrackFmt;
+ T_ZDrvI2S_TestMode tTestMode;
+ T_ZDrvI2S_DataAlignMode tDataAlignMode;
+ T_ZDrvI2S_PcmMode tPcmMode;
+ T_ZDrvI2S_PcmFirstBitSel tPcmFirstBit;
+ T_ZDrvI2S_PcmFsyncLen tPcmFsynLen;
+ T_ZDrvI2S_PcmSlotNum tPcmSlotNum;
+
+ T_ZDrvI2S_TimingType tTimingType;
+ T_ZDrvI2S_PcmFsync tPcmFsync;
+ T_ZDrvI2S_TdmExtCycle tTdmExtCycle;
+ T_ZDrvI2S_TransMode tTransMode;
+ T_I2s_RefClkForI2s refclk;
+
+} T_ZDrvI2S_Cfg;
+
+typedef enum {
+ I2S_IDLE,
+ I2S_OPEN,
+ I2S_PLAY_INUSE,
+ I2S_RECORD_INUSE,
+ I2S_BOTH_INUSE,
+
+ MAX_I2S_STATUS
+}T_I2s_Status;
+
+/**
+ * @brief describe the codec agc Parameter
+ * @param channel audio channel
+ * @param buffersize buffer size
+ * @param p_cb the callback of audio play
+ */
+typedef struct {
+ T_ZDrvAudio_Channel channel;
+ UINT32 buffersize;
+ T_ZDrvI2S_AUD_PLAY_CB p_cb;
+} T_ZDrvI2s_Params;
+
+typedef enum {
+ TRANS_CPU_MODE,
+ TRANS_INT_MODE,
+ TRANS_DMA_MODE,
+
+ MAX_TRANS_FUNC
+}T_ZDrvI2s_TransMode;
+
+/*******************************************************************************
+ * Global variable declarations *
+ ******************************************************************************/
+
+
+/*******************************************************************************
+ * Global function declarations *
+ ******************************************************************************/
+
+/**
+* @brief open i2s device.
+*
+* @param tId i2s selete struct
+* @param i2sTransMode T_ZDrvI2s_TransMode
+*
+* @return 0-DRV_SUCCESS, other-error
+*/
+SINT32 zDrvI2S_Open(T_ZDrvI2S_Id tId, T_ZDrvI2s_TransMode i2sTransMode);
+
+/**
+* @brief reset i2s device.
+*
+* @param tId i2s select i2s0 or i2s1
+*
+* @return 0-DRV_SUCCESS, other-error
+*/
+SINT32 zDrvI2S_Reset(T_ZDrvI2S_Id tId);
+
+/**
+* @brief close i2s device.
+*
+* @param tId i2s selete struct
+*
+* @return 0-DRV_SUCCESS, other-error
+*/
+SINT32 zDrvI2S_Close(T_ZDrvI2S_Id tId);
+
+/**
+* @brief i2s write stop ,use to stop playing or recording.
+*
+* @param tId i2s index select i2s0 or i2s1
+*
+* @return 0-DRV_SUCCESS, other-error
+*/
+SINT32 zDrvI2S_Write_Stop(T_ZDrvI2S_Id tId);
+
+/**
+* @brief i2s read stop ,use to stop playing or recording.
+*
+* @param tId i2s select i2s0 or i2s1
+*
+* @return 0-DRV_SUCCESS, other-error
+*/
+SINT32 zDrvI2S_Read_Stop(T_ZDrvI2S_Id tId);
+
+/**
+* @brief This function is used to read data by i2s.
+*
+* @param tId i2s select i2s0 or i2s1
+* @param pBuf one buffer is how many bytes
+* @param uiLen buffer length
+*
+* @return 0-DRV_SUCCESS, other-error
+*/
+SINT32 zDrvI2S_Read(T_ZDrvI2S_Id tId, UINT8 **pBuf, UINT32 *uiLen);
+
+/**
+* @brief i2s trans data to fifo from ram while playing.
+*
+* @param tId i2s selete struct
+* @param pBuf one buffer is how many bytes
+* @param uiLen buffer length
+*
+* @return 0-DRV_SUCCESS, other-error
+*/
+SINT32 zDrvI2S_Write(T_ZDrvI2S_Id tId, const UINT8 *pBuf, UINT32 uiLen);
+
+/**
+* @brief i2s write start .
+*
+* @param tId i2s selete struct
+* @param params pointer to struct T_ZDrvI2s_Params
+* @param ptCfg pointer to struct T_ZDrvI2S_Cfg
+* @return 0-DRV_SUCCESS, other-error
+*/
+SINT32 zDrvI2S_Write_Start(T_ZDrvI2S_Id tId, T_ZDrvI2s_Params *params, T_ZDrvI2S_Cfg *ptCfg);
+
+/**
+* @brief i2s read start.
+*
+* @param tId i2s selete struct
+* @param params pointer to T_ZDrvI2s_Params
+* @param ptCfg pointer to T_ZDrvI2S_Cfg
+* @return 0-DRV_SUCCESS, other-error
+*/
+SINT32 zDrvI2S_Read_Start(T_ZDrvI2S_Id tId, T_ZDrvI2s_Params *params, T_ZDrvI2S_Cfg *ptCfg);
+
+/**
+* @brief start to trans data,use in playing.
+*
+* @param tId i2s selete struct
+* @param params T_ZDrvI2s_Params
+* @param ptCfg config param
+* @return 0-DRV_SUCCESS, other-error
+*/
+SINT32 zDrvI2S_Vousb_Start(T_ZDrvI2S_Id tId, T_ZDrvI2s_Params *params, T_ZDrvI2S_Cfg *ptCfg);
+
+/**
+* @brief i2s get buffer ,get buffer to write playing data.
+*
+* @param tId i2s select i2s0 or i2s1
+* @param pBuf playing data buffer
+* @param uiLen buffer length
+* @return 0-DRV_SUCCESS, other-error
+*/
+SINT32 zDrvI2S_GetBuf(T_ZDrvI2S_Id tId, UINT8 **pBuf, UINT32 *uiLen);
+
+/**
+* @brief i2s free buffer ,get buffer to write playing data.
+*
+* @param tId i2s select i2s0 or i2s1
+* @param pBuf data buffer
+* @return 0-DRV_SUCCESS, other-error
+*/
+SINT32 zDrvI2S_GetRemained(T_ZDrvI2S_Id tId, UINT32 *len);
+
+/**
+* @brief i2s free buffer ,get buffer to write playing data.
+*
+* @param tId i2s select i2s0 or i2s1
+* @param pBuf data buffer
+* @return 0-DRV_SUCCESS, other-error
+*/
+SINT32 zDrvI2S_FreeBuf(T_ZDrvI2S_Id tId, UINT8 *pBuf);
+
+/**
+* @brief pause while playing.
+*
+* @param tId i2s select i2s0 or i2s1
+* @return 0-DRV_SUCCESS, other-error
+*/
+VOID zDrvI2S_Pause(T_ZDrvI2S_Id tId);
+
+/**
+* @brief resume playing if pause.
+*
+* @param tId i2s select i2s0 or i2s1
+* @return 0-DRV_SUCCESS, other-error
+*/
+VOID zDrvI2S_Resume(T_ZDrvI2S_Id tId);
+
+/**
+* @brief Release the rx semaphore before stop.
+*
+* @param tId i2s select i2s0 or i2s1
+* @return 0-DRV_SUCCESS, other-error
+*/
+VOID zDrvI2s_RxRlsSemaBeforeStop(T_ZDrvI2S_Id tId);
+
+/**
+* @brief Release the tx semaphore before stop.
+*
+* @param tId i2s select i2s0 or i2s1
+* @return 0-DRV_SUCCESS, other-error
+*/
+VOID zDrvI2s_TxRlsSemaBeforeStop(T_ZDrvI2S_Id tId);
+
+/**
+* @brief get i2s status.
+*
+* @param tId i2s select i2s0 or i2s1
+* @return 0-DRV_SUCCESS, other-error
+*/
+T_I2s_Status zDrvI2s_GetI2sStatus(T_ZDrvI2S_Id tId);
+
+#endif /* #ifndef _HAL_I2S_H */
+
diff --git a/cp/ps/driver/inc/misc/drvs_icp.h b/cp/ps/driver/inc/misc/drvs_icp.h
new file mode 100644
index 0000000..e39edba
--- /dev/null
+++ b/cp/ps/driver/inc/misc/drvs_icp.h
@@ -0,0 +1,232 @@
+/*******************************************************************************
+ * Copyright by ZTE Corporation.
+ *
+ * File Name:
+ * File Mark:
+ * Description:
+ * Others:
+ * Version: 0.1
+ * Author: shideyou
+ * Date: 2013-7-8
+ * History 1:
+ * Date:
+ * Version:
+ * Author:
+ * Modification:
+ * History 2:
+ ********************************************************************************/
+
+#ifndef _DRVS_ICP_H
+#define _DRVS_ICP_H
+
+#include "ram_config.h"
+#include "drvs_rpmsg.h"
+/*******************************************************************************
+* Macro *
+*******************************************************************************/
+
+/*******************************************************************************
+* Types *
+*******************************************************************************/
+#if 0
+typedef enum _T_HalIcp_MsgActor
+{
+ ICP_MSG_ACTOR_M0,
+ ICP_MSG_ACTOR_PHY,
+ ICP_MSG_ACTOR_ARM = ICP_MSG_ACTOR_PHY,
+ MAX_ICP_MSG_ACTOR
+} T_HalIcp_MsgActor;
+
+typedef enum _T_HalIcp_ModuleId
+{
+ ICP_ARM0_MODULE_ID_BASE, // 0
+ ICP_ARM0_MODULE_ID_DRV = ICP_ARM0_MODULE_ID_BASE,
+ ICP_ARM0_MODULE_ID_PSM, // 1
+ ICP_ARM0_MODULE_ID_OS, // 2
+ ICP_ARM0_MODULE_ID_LTEPS, // 3
+ ICP_ARM0_MODULE_ID_TDPS, // 4
+ ICP_ARM0_MODULE_ID_WPS, // 5
+ ICP_ARM0_MODULE_ID_LTEPSM, // 6
+ ICP_ARM0_MODULE_ID_TDPSM, // 7
+ ICP_ARM0_MODULE_ID_WPSM, // 8
+ MAX_ICP_ARM0_MODULE_ID = ICP_ARM0_MODULE_ID_WPSM,
+
+ ICP_ARM1_MODULE_ID_BASE, // 9
+ ICP_ARM1_MODULE_ID_DRV = ICP_ARM1_MODULE_ID_BASE,
+ ICP_ARM1_MODULE_ID_PSM, // 10
+ ICP_ARM1_MODULE_ID_OS, // 11
+ ICP_ARM1_MODULE_ID_LTEPHY, // 12
+ ICP_ARM1_MODULE_ID_TDPHY, // 13
+ ICP_ARM1_MODULE_ID_WPHY, // 14
+ ICP_ARM1_MODULE_ID_LTEPSM, // 15
+ ICP_ARM1_MODULE_ID_TDPSM, // 16
+ ICP_ARM1_MODULE_ID_WPSM, // 17
+ MAX_ICP_ARM1_MODULE_ID = ICP_ARM1_MODULE_ID_WPSM,
+
+ ICP_M0_MODULE_ID_BASE, // 18
+ ICP_M0_MODULE_ID_DRV = ICP_M0_MODULE_ID_BASE,
+ ICP_M0_MODULE_ID_PSM, // 19
+ ICP_M0_MODULE_ID_OS, // 20
+ MAX_ICP_M0_MODULE_ID = ICP_M0_MODULE_ID_OS,
+
+ MAX_ICP_MODULE_ID // 21
+} T_HalIcp_ModuleId;
+
+typedef enum _T_HalIcp_CallbackType
+{
+ ICP_ISR_CALLBACK,
+ ICP_HISR_CALLBACK,
+
+ MAX_ICP_CALLBACK_TYPE
+}T_HalIcp_CallbackType;
+#endif
+typedef struct _T_HalIcp_Dword
+{
+ UINT32 low_word;
+ UINT32 high_word;
+} T_HalIcp_Dword;
+
+typedef struct _T_HalIcp_Msg
+{
+ UINT32 SrcModId;
+ UINT32 desModId;
+ T_HalIcp_Dword IntInfo;
+ UINT32 sfn;
+ VOID *pBuf;
+ UINT32 len;
+} T_HalIcp_Msg;
+#if 0
+typedef VOID (*T_HalIcp_CallbackFunction)(const T_HalIcp_Msg *pMsg);
+
+
+/*******************************************************************************
+* Function Prototypes *
+*******************************************************************************/
+/*******************************************************************************
+* Function: zDrvIcp_RegCallback
+* Description: This function is used for registing callback functions;
+* Parameters:
+* Input:
+* me: which module regists callback function.
+* from: which is this function for.
+* callback: the callback function.
+* callbackType: where is this function, isr or hisr.
+*
+* Output:None
+*
+* Returns:
+* DRV_SUCCESS
+* DRV_ERROR
+*
+* Others:
+********************************************************************************/
+SINT32 zDrvIcp_RegCallback(UINT32 me,
+ UINT32 from,
+ T_HalIcp_CallbackFunction callback,
+ T_HalIcp_CallbackType callbackType);
+
+/*******************************************************************************
+* Function: zDrvIcp_SendMsg
+* Description: This function is used for sending ICP MSG;
+* Parameters:
+* Input:
+* pMsg: the msg which will be sent
+* Output:None
+*
+* Returns:
+* DRV_SUCCESS: successfully send msg.
+* DRV_ERROR: fail to send msg.
+*
+*
+* Others:
+********************************************************************************/
+SINT32 zDrvIcp_SendMsg(const T_HalIcp_Msg *pMsg);
+
+/*******************************************************************************
+* Function: zDrvIcp_SendMsg_Psm
+* Description: This function is used for sending ICP MSG during interrupt disabled;
+* Parameters:
+* Input:
+* pMsg: the msg which will be sent
+* Output:None
+*
+* Returns:
+* DRV_SUCCESS: successfully send msg.
+* DRV_ERROR: fail to send msg.
+*
+*
+* Others:
+********************************************************************************/
+SINT32 zDrvIcp_SendMsg_Psm(const T_HalIcp_Msg *pMsg);
+
+
+/*******************************************************************************
+* Function: zDrvIcp_Mask
+* Description: This function is used for mask ICP interrupt from another core;
+* Parameters:
+* Input:
+* actor: which core.
+* bit_map: which interrupts will be masked.
+* Output:None
+*
+* Returns:
+* None
+*
+*
+* Others:
+********************************************************************************/
+SINT32 zDrvIcp_Mask(T_HalIcp_MsgActor actor, T_HalIcp_Dword bit_map);
+
+ /*******************************************************************************
+ * Function: zDrvIcp_Unmask
+ * Description: This function is used for unmask ICP interrupt from another core;
+ * Parameters:
+ * Input:
+ * actor: which core.
+ * bit_map: which interrupts will be unmasked.
+ * Output:None
+ *
+ * Returns:
+ * None
+ *
+ *
+ * Others:
+ ********************************************************************************/
+ SINT32 zDrvIcp_Unmask(T_HalIcp_MsgActor actor, T_HalIcp_Dword bit_map);
+
+ /*******************************************************************************
+* Function: zDrvIcp_GetState
+* Description: This function is used for getting state;
+* Parameters:
+* Input:
+* actor: which core.
+* Output:None
+* pState: the current state.
+*
+* Returns:
+* DRV_ERR_INVALID_PARAM
+* DRV_SUCCESS
+*
+* Others:
+********************************************************************************/
+ SINT32 zDrvIcp_GetState(T_HalIcp_MsgActor actor, T_HalIcp_Dword *pState);
+
+ /*******************************************************************************
+* Function: zDrvIcp_ClearState
+* Description: This function is used for clear state;
+* Parameters:
+* Input:
+* actor: which core.
+* bit_map: which bits' state will be clear, 0-not clear, 1-clear.
+* Output:None
+*
+* Returns:
+* None
+*
+*
+* Others:
+********************************************************************************/
+ SINT32 zDrvIcp_ClearState(T_HalIcp_MsgActor actor, T_HalIcp_Dword bit_map);
+#endif
+#endif /* _DRVS_ICP_H */
+
diff --git a/cp/ps/driver/inc/misc/drvs_int.h b/cp/ps/driver/inc/misc/drvs_int.h
new file mode 100644
index 0000000..9b378f5
--- /dev/null
+++ b/cp/ps/driver/inc/misc/drvs_int.h
@@ -0,0 +1,416 @@
+/**
+* @file drvs_int.h
+* @brief Public APIs of int drivers
+*
+* Copyright (C) 2017 Sanechips Technology Co., Ltd.
+* @author Dongdong Zhang <Zhang.Dongdong@sanechips.com.cn>
+*
+* This program is free software; you can redistribute it and/or modify
+* it under the terms of the GNU General Public License version 2 as
+* published by the Free Software Foundation.
+*
+*/
+#ifndef _DRVS_INT_H
+#define _DRVS_INT_H
+
+/*******************************************************************************
+ * Include header files *
+ ******************************************************************************/
+#include "drvs_general.h"
+
+#ifdef _OS_LINUX
+#include <linux/irq.h>
+#endif
+
+/*******************************************************************************
+ * Macro definitions *
+ ******************************************************************************/
+#define INT_PRI_NUM 15 /* 0-highest, 15-lowest, but 15 is always be masked in gic*/
+ /*so in fact, only 0-14 can generate interrupt*/
+
+#define MAX_NEST_NUM 32 /* maximum number of nested interrupt */
+
+
+#define INT_TABLE_END 0xFFFF
+#define INT_VECTOR_DEFAULT 0xFFFF
+#define INT_PRIORITY_DEFAULT 14
+#define INT_INVALID_INTLINE 0xFFFFFFFF
+
+#if 1//modify by xxx ndef _OS_LINUX
+
+/*
+ * 0-15: SGI (software generated interrupts)
+ * 16-31: PPI (private peripheral interrupts)
+ * 32+: SPI (shared peripheral interrupts)
+ */
+#define GIC_PPI_START 16
+#define GIC_SPI_START 32
+
+#define RESERVED_INT 0xffff
+
+/*
+ * software generated interrupts
+ */
+#define SGI0_INT (0)
+#define SGI1_INT (1)
+#define SGI2_INT (2)
+#define SGI3_INT (3)
+#define SGI4_INT (4)
+#define SGI5_INT (5)
+#define SGI6_INT (6)
+#define SGI7_INT (7)
+#define SGI8_INT (8)
+#define SGI9_INT (9)
+#define SGI10_INT (10)
+#define SGI11_INT (11)
+#define SGI12_INT (12)
+#define SGI13_INT (13)
+#define SGI14_INT (14)
+#define SGI15_INT (15)
+
+/*
+ * private peripheral interrupts
+ */
+#define GLOBAL_TIMER_INT (27)
+#define LEGACY_FIQ_INT (28)
+#define PRIVATE_TIMER_INT (29)
+#define PRIVATE_WDT_INT (30)
+#define LEGACY_IRQ_INT (31)
+
+/*
+ * shared peripheral interrupts
+ */
+#define UART0_INT (GIC_SPI_START+0)
+#define UART1_INT (GIC_SPI_START+1)
+#define UART2_INT (GIC_SPI_START+2)
+#define SSP0_INT (GIC_SPI_START+3)
+#define PS_SYS_COUNTER (GIC_SPI_START+4)
+#define RTC_ALARM_INT (GIC_SPI_START+5)
+#define RTC_TIMER_INT (GIC_SPI_START+6)
+#define I2S0_INT (GIC_SPI_START+7)
+#define I2S1_INT (GIC_SPI_START+8)
+#define USIM1_INT (GIC_SPI_START+9)
+#define I2C1_INT (GIC_SPI_START+10)
+#define PMIC_I2C_INT (GIC_SPI_START+11)
+#define KEYPAD_INT (GIC_SPI_START+12)
+#define SD1_INT (GIC_SPI_START+13)
+#define WLAN_PRIORITY_POS_INT (GIC_SPI_START+14)
+#define WLAN_PRIORITY_NEG_INT (GIC_SPI_START+15)
+#define SD0_INT (GIC_SPI_START+16)
+#define ICP_PHY_INT (GIC_SPI_START+17)
+#define ICP_M0_INT (GIC_SPI_START+18)
+#define TIMER0_INT (GIC_SPI_START+19) /*ps timer0*/
+#define TIMER1_INT (GIC_SPI_START+20) /*ps timer1*/
+#define PS_RM_TIMER_INT (GIC_SPI_START+21) /*ps rm timer*/
+#define GSMIF_RFSSCR_INT (GIC_SPI_START+22)
+#define GSMIF_RFSSCT_INT (GIC_SPI_START+23)
+#define GSMIF_GP0_INT (GIC_SPI_START+24)
+#define GSMIF_T_INT (GIC_SPI_START+25)
+#define GSMIF_TL_INT (GIC_SPI_START+26)
+#define GPRS_INT0 (GIC_SPI_START+27)
+#define GPRS_INT1 (GIC_SPI_START+28)
+#define DSP_INT0 (GIC_SPI_START+29)
+#define DSP_INT1 (GIC_SPI_START+30)
+#define DSP_INT2 (GIC_SPI_START+31)
+#define DSP_INT3 (GIC_SPI_START+32)
+#define DSP_INT4 (GIC_SPI_START+33)
+#define DSP_INT6 (GIC_SPI_START+34)
+#define DSP_INT7 (GIC_SPI_START+35)
+#define GSM_LPM_INT0 (GIC_SPI_START+36)
+#define RCOUT1_INT (GIC_SPI_START+37)
+#define DMAC0_INT (GIC_SPI_START+38) /*ps dma int1 to ps*/
+#define DMAC1_INT (GIC_SPI_START+39) /*phy dma int1 to ps*/
+#define NAND_INT (GIC_SPI_START+40)
+#define USB_INT (GIC_SPI_START+41)
+#define USB_POWERDWN_UP_INT (GIC_SPI_START+42)
+#define USB_POWERDWN_DOWN_INT (GIC_SPI_START+43)
+#define HSIC_INT (GIC_SPI_START+44)
+#define HSIC_POWERDWN_UP_INT (GIC_SPI_START+45)
+#define HSIC_POWERDWN_DOWN_INT (GIC_SPI_START+46)
+
+#define GSM_USIM_INT (GIC_SPI_START+48)
+
+#define EX8IN1_INT (GIC_SPI_START+51) /*only used by int driver*/
+#define EX0_INT (GIC_SPI_START+52)
+#define EX1_INT (GIC_SPI_START+53)
+#define EX2_INT (GIC_SPI_START+54)
+#define EX3_INT (GIC_SPI_START+55)
+#define EX4_INT (GIC_SPI_START+56)
+#define EX5_INT (GIC_SPI_START+57)
+#define EX6_INT (GIC_SPI_START+58)
+#define EX7_INT (GIC_SPI_START+59)
+#define SSC0_CONFLICT_INT (GIC_SPI_START+60)
+#define TD_LPM4_INT (GIC_SPI_START+61)
+#define TD_FRM_INT (GIC_SPI_START+62)
+#define TD_FRM32K_INT (GIC_SPI_START+63)
+#define LTE_LPM2_INT (GIC_SPI_START+64)
+#define LTE_LPM4_INT (GIC_SPI_START+65)
+#define LTE_LPM5_INT (GIC_SPI_START+66)
+#define GSM_LPM_INT1 (GIC_SPI_START+67)
+#define LTE_TPU_INT (GIC_SPI_START+68)
+#define WD_LPM4_INT (GIC_SPI_START+69)
+#define WD_FRM_INT (GIC_SPI_START+70)
+#define EDCP_INT (GIC_SPI_START+71)
+#define SD1_DATA1_INT (GIC_SPI_START+72)
+
+#if defined (_CHIP_ZX297520V3)
+#define UART0_RXD_INT (GIC_SPI_START+73)
+#elif defined (_CHIP_ZX297520V2)
+#define UART0_CTS_INT (GIC_SPI_START+73)
+#endif
+
+#define SPIFC0_INT (GIC_SPI_START+74)
+#define TIMER2_INT (GIC_SPI_START+75) /*ps timer2*/
+#define PS_WDT_INT (GIC_SPI_START+76)
+#define ICP_AP_INT (GIC_SPI_START+77)
+#define SSP1_INT (GIC_SPI_START+78)
+#define SD0_DATA1_INT (GIC_SPI_START+79)
+#define TDM_INT (GIC_SPI_START+80)
+#define PHY_TIMER0_INT (GIC_SPI_START+81)
+#define PHY_TIMER1_INT (GIC_SPI_START+82)
+#define TD_MODEM_INT0 (GIC_SPI_START+83)
+#define TD_MODEM_INT1 (GIC_SPI_START+84)
+#define TD_MODEM_INT2 (GIC_SPI_START+85)
+#define LTE_MODEM_INT0 (GIC_SPI_START+86)
+#define LTE_MODEM_INT1 (GIC_SPI_START+87)
+#define LTE_MODEM_INT2 (GIC_SPI_START+88)
+#define WD_MODEM_INT0 (GIC_SPI_START+89)
+#define WD_MODEM_INT1 (GIC_SPI_START+90)
+#define WD_MODEM_INT2 (GIC_SPI_START+91)
+#define TD_LPM_ZSP_EXT_INT (GIC_SPI_START+92)
+#define LTE_LPM1_INT (GIC_SPI_START+93)
+#define WD_LPM3_INT (GIC_SPI_START+94)
+#define EDCP_PHY_INT (GIC_SPI_START+95)
+
+#define GIC_INT_NUM (EDCP_PHY_INT+1)
+
+/*virtual external 8in1 interrupts*/
+#define EX8_INT (GIC_SPI_START+96)
+#define EX9_INT (GIC_SPI_START+97)
+#define EX10_INT (GIC_SPI_START+98)
+#define EX11_INT (GIC_SPI_START+99)
+#define EX12_INT (GIC_SPI_START+100)
+#define EX13_INT (GIC_SPI_START+101)
+#define EX14_INT (GIC_SPI_START+102)
+#define EX15_INT (GIC_SPI_START+103)
+
+#define EX8IN1_INT_NUM (8)
+
+#define INT_LINES_NUM (EX15_INT+1)
+
+#if 0 /*7520V2 reserved*/
+/*
+ *virtual gpio interrupts
+ *interrupt number should be defined by user
+ *example:
+ * #define GPIO23_INT (GPIO_INT0_START+23)
+ * #define GPIO130_INT (GPIO_INT1_START+3) or (GPIO_INT0_START+130)
+ */
+
+/*
+ *gpio0 --- GPIO_INT0_START
+ *gpio127 --- GPIO_INT0_END
+ */
+#define GPIO_INT0_START (EX15_INT+1)
+#define GPIO_INT0_END (GPIO_INT0_START+127)
+
+/*
+ *gpio128 --- GPIO_INT1_START
+ *gpio255 --- GPIO_INT1_END
+ */
+#define GPIO_INT1_START (GPIO_INT0_END+1)
+#define GPIO_INT1_END (GPIO_INT1_START+127)
+
+
+#define INT_LINES_NUM (GPIO_INT1_END + 1) /*ÖжϸöÊý*/
+#endif
+
+#endif
+
+/*******************************************************************************
+* Type definitions *
+******************************************************************************/
+typedef struct _T_zDrvIntTable
+{
+ UINT32 uIntLine; /*the intline of the dev*/
+ UINT32 uIntPri; /*hardware priority*/
+ UINT32 vector; /*OSE vector,should be convert to type OSVECTOR */
+ UINT32 level; /*CPU trigger level*/
+}
+T_zDrvIntTable;
+
+#ifdef _OS_TOS
+typedef enum _T_zDrvIntLineLevel
+{
+ INT_HIGHLEVEL = 0x00, /* 00: high level */
+ INT_LOWLEVEL = 0x01, /* 01: low level */
+ INT_POSEDGE = 0x02, /* 10: raise edge */
+ INT_NEGEDGE = 0x03, /* 11: fall edge */
+ INT_DEFAULT_LEVEL,
+}
+T_zDrvIntLineLevel;
+#endif
+
+#ifdef _OS_LINUX
+typedef enum _T_zDrvIntLineLevel
+{
+ INT_HIGHLEVEL = IRQ_TYPE_LEVEL_HIGH, /* 0x4: high level */
+ INT_LOWLEVEL = IRQ_TYPE_LEVEL_LOW, /* 0x8: low level */
+ INT_POSEDGE = IRQ_TYPE_EDGE_RISING, /* 0x1: raise edge */
+ INT_NEGEDGE = IRQ_TYPE_EDGE_FALLING, /* 0x2: fall edge */
+ INT_DUALEDGE = IRQ_TYPE_EDGE_BOTH, /* 0x3: fall and raise edge, it can only be applyed to GPIO int */
+ INT_DEFAULT_LEVEL = 0xf,
+}
+T_zDrvIntLineLevel;
+#endif
+
+/*******************************************************************************
+ * Global function declarations *
+ ******************************************************************************/
+
+/**
+ *@brief This function is used to install isr into tos
+ *@param line interrupt line(0--INT_LINES_NUM)
+ *@param pEntry the point to isr entry
+ *@param pName isr name
+ *@param level int line trigger level
+ *
+ *@note the level is source trigger level. if you don't know the int trigger level, you can set the level:INT_DEFAULT_LEVEL.
+ *
+ *@return id of interrupt handler process if successed, errcode otherwise.
+ */
+SINT32 zDrvInt_InstallIsr(UINT32 line, VOID *pEntry, const CHAR * pName,
+ T_zDrvIntLineLevel level);
+
+/**
+ *@brief This function is used to uninstall isr
+ *@param line interrupt line(0--INT_LINES_NUM)
+ *
+ *@return 0 if successed, errcode otherwise.
+ */
+SINT32 zDrvInt_UninstallIsr(UINT32 line);
+
+/**
+ *@brief This function is used to mask irq
+ *@param line interrupt line(0--INT_LINES_NUM)
+ *
+ *@return 0 if successed, errcode otherwise.
+ */
+VOID zDrvInt_MaskIrq(UINT32 line);
+
+/**
+ *@brief This function is used to unmask irq
+ *@param line interrupt line(0--INT_LINES_NUM)
+ *
+ *@return 0 if successed, errcode otherwise.
+ */
+VOID zDrvInt_UnmaskIrq(UINT32 line);
+
+/**
+ *@brief This function is used to set int trigger level
+ *@param line interrupt line(0--INT_LINES_NUM)
+ *@param level int line trigger level
+ *
+ *@return 0 if successed, errcode otherwise.
+ */
+SINT32 zDrvInt_SetLineLevel(UINT32 line, T_zDrvIntLineLevel level);
+
+/**
+ *@brief This function is used to clear int status
+ *@param line interrupt line(0--INT_LINES_NUM)
+ *
+ *@return 0 if successed, errcode otherwise.
+ */
+SINT32 zDrvInt_ClearInt(UINT32 line);
+
+/**
+ *@brief This function is used to set int priority
+ *@param line interrupt line(0--INT_LINES_NUM)
+ *@param pri priority number
+ *
+ *@return 0 if successed, errcode otherwise.
+ */
+VOID zDrvInt_SetLinePri(UINT32 line, UINT32 pri);
+
+#ifdef _OS_LINUX
+/**
+ *@brief This function is used to install isr into linux
+ *@param line interrupt line(0--INT_LINES_NUM)
+ *@param pEntry the point to isr entry
+ *@param pName isr name
+ *@param level int line trigger level
+ *
+ *@note the level is source trigger level. if you don't know the int trigger level, you can set the level:INT_DEFAULT_LEVEL.
+ *
+ *@return id of interrupt handler process if successed, errcode otherwise.
+ */
+SINT32 zDrvInt_InstallFastIsr( UINT32 uiLine, VOID *pEntry, const CHAR * pName,
+ T_zDrvIntLineLevel level);
+
+/**
+ *@brief This function is used to install nested isr for interrupt line uiLine.
+ *@param line interrupt line(0--INT_LINES_NUM)
+ *@param pEntry the point to isr entry
+ *@param pName isr name
+ *
+ *@return id of interrupt handler process if successed, errcode otherwise.
+ */
+SINT32 zDrvInt_InstallNestedIsr( UINT32 uiLine, VOID *pEntry, const CHAR * pName);
+
+#endif
+
+#ifdef _OS_TOS
+/**
+ *@brief This function is used to install isr into tos
+ *@param line interrupt line(0--INT_LINES_NUM)
+ *@param pEntry the point to isr entry
+ *@param pName isr name
+ *@param level int line trigger level
+ *
+ *@note the level is source trigger level. if you don't know the int trigger level, you can set the level:INT_DEFAULT_LEVEL.
+ *
+ *@return id of interrupt handler process if successed, errcode otherwise.
+ */
+SINT32 zDrvInt_InstallIsrDsr(UINT32 line, VOID *pIsrEntry,
+ VOID *pDsrEntry, T_zDrvIntLineLevel level);
+
+/**
+ *@brief This function is used to distinguish whether this interrupt need to delay umask or not
+ *@param line interrupt line(0--INT_LINES_NUM)
+ *
+ *@note invoked by os.
+ *
+ *@return 0 if need to delay umask; 1 otherwise.
+ */
+SINT32 zDrvInt_DelayUnmask(UINT32 intLine);
+
+/**
+ *@brief This function is used to initiate interrupt controller, can only be used when system bringing up
+ *
+ *@param none.
+ *
+ *@return none.
+ */
+VOID zDrvInt_Initiate(VOID);
+
+/**
+ *@brief This function is used to delay unmask an interrupt when isr is completed.
+ *@param line interrupt line(0--INT_LINES_NUM)
+ *
+ *@note it must be used before installing irq, and you should unmask this int manually after isr is completed.
+ *
+ *@return none.
+ */
+VOID zDrvInt_DelayUnmaskAdd(UINT32 intLine);
+
+/**
+ *@brief This function is used to remove the delay unmask function for an interrupt.
+ *@param line interrupt line(0--INT_LINES_NUM)
+ *
+ *@return none.
+ */
+VOID zDrvInt_DelayUnmaskRemove(UINT32 intLine);
+
+#endif
+
+#endif /* DRVS_INT_H */
diff --git a/cp/ps/driver/inc/misc/drvs_kpdbacklight.h b/cp/ps/driver/inc/misc/drvs_kpdbacklight.h
new file mode 100644
index 0000000..d0285b0
--- /dev/null
+++ b/cp/ps/driver/inc/misc/drvs_kpdbacklight.h
@@ -0,0 +1,79 @@
+/*********************************************************************
+ Copyright 2007 by ZTE Corporation.
+ *
+ * FileName:: drvs_backlight.h
+ * File Mark:
+* Description: This file contains the hardware interface for lcd blg driver
+* Others:
+* Version: v0.5
+* Author: zhangyingjun
+* Date: 2009-06-25
+
+* History 1:
+* Date:
+* Version:
+* Author:
+* Modification:
+* History 2:
+**********************************************************************/
+
+#ifndef _DRVS_KPDBLG_H
+#define _DRVS_KPDBLG_H
+
+
+/**************************************************************************
+* Function: KpdBlgEvb_Init
+* Description: initiate the battery device
+* Parameters:
+* Input:
+* None
+* Outpu: None
+* Returns:
+* DRV_SUCCESS
+* Others: None
+**************************************************************************/
+SINT32 KpdBlgEvb_Init(void);
+/**************************************************************************
+* Function: halBlg_LEDEnable
+* Description: open the LED
+* Parameters:
+* Input:
+* chan_1 LED channel
+* bl: TRUE or FALSE value,TRUE open the blg,FALSE close theblg
+* Outpu: None
+* Returns:
+* DRV_SUCCESS
+* Others: None
+**************************************************************************/
+SINT32 BlgEvb_LEDEnable(T_ZDrvBlg_LEDCHAN chan_1,BOOL bl) ;
+/**************************************************************************
+* Function: BlgEvb_LEDOn
+* Description: set the LED light frequence
+* Parameters:
+* Input:
+* channel LED channel
+* Freq the value of LED light frequence
+*
+* Outpu: None
+* Returns:
+* DRV_SUCCESS
+* Others: None
+**************************************************************************/
+SINT32 BlgEvb_LEDOn(T_ZDrvBlg_LEDCHAN channel,UINT32 period ,UINT32 Freq);
+/**************************************************************************
+* Function: BlgEVB_LEDOff
+* Description: set the LED light frequence
+* Parameters:
+* Input:
+* channel LED channel
+* Freq the value of LED light frequence
+*
+* Outpu: None
+* Returns:
+* DRV_SUCCESS
+* Others: None
+**************************************************************************/
+
+SINT32 BlgEVB_LEDOff(T_ZDrvBlg_LEDCHAN channel );
+
+#endif
diff --git a/cp/ps/driver/inc/misc/drvs_l2cache.h b/cp/ps/driver/inc/misc/drvs_l2cache.h
new file mode 100644
index 0000000..7cfa8b2
--- /dev/null
+++ b/cp/ps/driver/inc/misc/drvs_l2cache.h
@@ -0,0 +1,195 @@
+/*******************************************************************************
+ * Copyright (C) 2013, ZTE Corporation.
+ *
+ * File Name: drvs_l2cache.h
+ * File Mark:
+ * Description: This file contains the interface to operate L2 cache
+ * controller(L2C310) on zx297510 platform .
+ * Others:
+ * Version: V1.0
+ * Author: xuzhiguo
+ * Date: 2013-11-11
+ * History 1:
+ *
+ *********************************************************************************/
+#ifndef _DRVS_L2CACHE_H
+#define _DRVS_L2CACHE_H
+
+
+/*********************************************************************************
+* Include files
+**********************************************************************************/
+
+/*********************************************************************************
+* Macros
+**********************************************************************************/
+
+/*********************************************************************************
+* Type
+**********************************************************************************/
+
+/*********************************************************************************
+ * Global Variable *
+ *********************************************************************************/
+
+
+/*********************************************************************************
+* Global Function Prototypes
+**********************************************************************************/
+
+/*******************************************************************************
+* Function: zDrvL2x0_Sync
+* Description: Drain the STB. Operation complete when all buffers, LRB, LFB, STB,
+* and EB, are empty,
+* Parameters:
+* Input:
+* None
+* Outpu:
+* None
+* Returns:
+* None
+* Others: this fucntion can not be used when l2 cache is not initialized.
+* if you use it, nothing would be done.
+*******************************************************************************/
+void zDrvL2x0_Sync(void);
+
+/*******************************************************************************
+* Function: zDrvL2x0_Flush_All
+* Description: clean and invalidate entire L2 cache by way
+* Parameters:
+* Input:
+* None
+* Outpu:
+* None
+* Returns:
+* None
+* Others: this fucntion can not be used when l2 cache is not initialized.
+* if you use it, nothing would be done.
+*******************************************************************************/
+void zDrvL2x0_Flush_All(void);
+
+/*******************************************************************************
+* Function: zDrvL2x0_Clean_All
+* Description: clean entire L2 cache by way
+* Parameters:
+* Input:
+* None
+* Outpu:
+* None
+* Returns:
+* None
+* Others: this fucntion can not be used when l2 cache is not initialized.
+* if you use it, nothing would be done.
+*******************************************************************************/
+void zDrvL2x0_Clean_All(void);
+
+/*******************************************************************************
+* Function: zDrvL2x0_Inv_All
+* Description: invalidate entire L2 cache by way
+* Parameters:
+* Input:
+* None
+* Outpu:
+* None
+* Returns:
+* None
+* Others: this fucntion can not be used when l2 cache is not initialized.
+* if you use it, nothing would be done.
+*******************************************************************************/
+void zDrvL2x0_Inv_All(void);
+
+/*******************************************************************************
+* Function: zDrvL2x0_Flush_Range
+* Description: clean and invalidate L2 cache by line
+* Parameters:
+* Input:
+* base: base physical address of space needs to be flushed
+* size: size of space needs to be flushed
+* Outpu:
+* None
+* Returns:
+* None
+* Others: this fucntion can not be used when l2 cache is not initialized.
+* if you use it, nothing would be done.
+*******************************************************************************/
+void zDrvL2x0_Flush_Range(unsigned long base, unsigned long size);
+
+/*******************************************************************************
+* Function: zDrvL2x0_Clean_Range
+* Description: clean L2 cache by line
+* Parameters:
+* Input:
+* base: base physical address of space needs to be cleaned
+* size: size of space needs to be cleaned
+* Outpu:
+* None
+* Returns:
+* None
+* Others: this fucntion can not be used when l2 cache is not initialized.
+* if you use it, nothing would be done.
+*******************************************************************************/
+void zDrvL2x0_Clean_Range(unsigned long base, unsigned long size);
+
+/*******************************************************************************
+* Function: zDrvL2x0_Inv_Range
+* Description: invalidate L2 cache by line
+* Parameters:
+* Input:
+* base: base physical address of space needs to be invalidated
+* size: size of space needs to be invalidated
+* Outpu:
+* None
+* Returns:
+* None
+* Others: this fucntion can not be used when l2 cache is not initialized.
+* if you use it, nothing would be done.
+*******************************************************************************/
+void zDrvL2x0_Inv_Range(unsigned long base, unsigned long size);
+
+/*******************************************************************************
+* Function: zDrvL2x0_Enable
+* Description: enable l2 cache simply
+* Parameters:
+* Input:
+* None
+* Outpu:
+* None
+* Returns:
+* None
+* Others: this fucntion can not be used when l2 cache is not initialized.
+* if you use it, nothing would be done.
+*******************************************************************************/
+void zDrvL2x0_Enable(void);
+
+/*******************************************************************************
+* Function: zDrvL2x0_Disable
+* Description: disable l2 cache simply
+* Parameters:
+* Input:
+* None
+* Outpu:
+* None
+* Returns:
+* None
+* Others: this fucntion can not be used when l2 cache is not initialized.
+* if you use it, nothing would be done.
+* this function can not be used in complex case of operating L1 cache,
+* L2 cache and mmu.
+*******************************************************************************/
+void zDrvL2x0_Disable(void);
+
+/*******************************************************************************
+* Function: zDrvL2x0_Initiate
+* Description: Initiate l2 cache controller
+* Parameters:
+* Input:
+* None
+* Outpu:
+* None
+* Returns:
+* None
+* Others: None
+*******************************************************************************/
+void zDrvL2x0_Initiate(void);
+
+#endif
diff --git a/cp/ps/driver/inc/misc/drvs_led.h b/cp/ps/driver/inc/misc/drvs_led.h
new file mode 100644
index 0000000..0134203
--- /dev/null
+++ b/cp/ps/driver/inc/misc/drvs_led.h
@@ -0,0 +1,153 @@
+/*******************************************************************************
+ * Copyright (C) 2010, ZTE Corporation.
+ *
+ * File Name: drvs_led.h
+ * File Mark:
+ * Description:
+ * Others:
+ * Version: V1.0
+ * Author: yuxiang
+ * Date: 2014-07-07
+ * History 1:
+ * Date:
+ * Version:
+ * Author:
+ * Modification:
+ * History 2:
+ ********************************************************************************/
+
+#ifndef _DRVS_LED_H
+#define _DRVS_LED_H
+
+
+/****************************************************************************
+* Include files
+****************************************************************************/
+
+/****************************************************************************
+* Macros
+****************************************************************************/
+/* */
+#define SN3216_REG_MODE_CONFIG 0x00 /* D7=SSD, D6:D5=MODE, D4=AE */
+#define SN3216_REG_OUT_STATUS1 0x01 /* out16:out9 led on/off, default all on */
+#define SN3216_REG_OUT_STATUS2 0x02 /* out8:out1 led on/off, default all off */
+
+#define SN3216_REG_CURRENT 0x03 /* D7=CM, D6:D4=CS, D3=AGCE, D2:D0=AGS */
+#define SN3216_REG_GPIO_CONFIG 0x04 /* */
+#define SN3216_REG_GPIO_DIRECT 0x05 /* */
+#define SN3216_REG_GPIO_VALUE 0x06 /* */
+
+#define SN3216_REG_OUT16_PWM 0x10 /* out16~out1 pwm level 10h~1fh */
+
+#define SN3216_REG_UPDATE_PWM 0xB0 /* update pwm regs */
+
+/*00h*/
+#define SN3216_REG_MODE_CONFIG_AE_LSH (4)
+#define SN3216_REG_MODE_CONFIG_MODE_LSH (5)
+#define SN3216_REG_MODE_CONFIG_SSD_LSH (7)
+
+/*03h*/
+#define SN3216_REG_CURRENT_CS_LSH (4)
+
+
+#define SN3216_BITFVAL(var, lsh) ( (var) << (lsh) )
+#define SN3216_BITFMASK(wid, lsh) ( ((1U << (wid)) - 1) << (lsh) )
+#define SN3216_BITFEXT(var, wid, lsh) ((var & SN3216_BITFMASK(wid, lsh)) >> (lsh))
+/****************************************************************************
+* Types
+****************************************************************************/
+#if 1
+typedef enum sn3216_channel {
+ SN3216_LED1 =0x0,
+ SN3216_LED2,
+ SN3216_LED3,
+ SN3216_LED4,
+ SN3216_LED5,
+ SN3216_LED6,
+ SN3216_LED7,
+ SN3216_LED8,
+
+ SN3216_LED9,
+ SN3216_LED10,
+ SN3216_LED11,
+ SN3216_LED12,
+ SN3216_LED13,
+ SN3216_LED14,
+ SN3216_LED15,
+ SN3216_LED16,
+
+ SN3216_LED_MAX
+}sn3216_channel;
+#else
+
+typedef enum sn3216_channel {
+
+ SN3216_LED16 = 0x0,
+ SN3216_LED15,
+ SN3216_LED14,
+ SN3216_LED13,
+ SN3216_LED12,
+ SN3216_LED11,
+ SN3216_LED10,
+ SN3216_LED9,
+
+ SN3216_LED8,
+ SN3216_LED7,
+ SN3216_LED6,
+ SN3216_LED5,
+ SN3216_LED4,
+ SN3216_LED3,
+ SN3216_LED2,
+ SN3216_LED1,
+
+ SN3216_LED_MAX
+}sn3216_channel;
+#endif
+typedef enum sn3216_current {
+ SN3216_CURRENT_20 =0x0,
+ SN3216_CURRENT_15,
+ SN3216_CURRENT_10,
+ SN3216_CURRENT_5,
+ SN3216_CURRENT_40,
+ SN3216_CURRENT_35,
+ SN3216_CURRENT_30,
+ SN3216_CURRENT_25,
+
+ SN3216_CURRENT_MAX
+}sn3216_current;
+
+typedef enum sn3216_status {
+ SN3216_LED_STATUS_OFF = 0x0,
+ SN3216_LED_STATUS_ON = 0x1,
+
+ SN3216_LED_STATUS_MAX,
+}sn3216_status;
+
+typedef enum sn3216_sleep {
+ SN3216_SLEEP_OFF = 0x0,
+ SN3216_SLEEP_ON = 0x1,
+ SN3216_SLEEP_MAX,
+}sn3216_sleep;
+
+/****************************************************************************
+* Constants
+****************************************************************************/
+
+/****************************************************************************
+* Global Variables
+****************************************************************************/
+
+/****************************************************************************
+* Function Prototypes
+****************************************************************************/
+SINT32 sn3216_I2cRead(UINT8 reg_addr, UINT8 *reg_val);
+SINT32 sn3216_I2cRead(UINT8 reg_addr, UINT8 *reg_val);
+SINT32 sn3216_GetRegister(UINT8 addr, UINT8* data);
+SINT32 sn3216_SetRegister(UINT8 addr, UINT8 data, UINT8 mask);
+SINT32 sn3216_SetStatus(sn3216_channel channel, sn3216_status status);
+SINT32 sn3216_SetBlink(sn3216_channel channel, UINT32 delay_on, UINT32 delay_off);
+SINT32 sn3216_SetCurrent(sn3216_current sn_current);
+SINT32 sn3216_SetPwm(sn3216_channel channel, UINT16 level);
+SINT32 sn3216_SetSleep(sn3216_sleep sleep);
+#endif/*_DRVS_LED_H*/
+
diff --git a/cp/ps/driver/inc/misc/drvs_lpm.h b/cp/ps/driver/inc/misc/drvs_lpm.h
new file mode 100644
index 0000000..8ae3555
--- /dev/null
+++ b/cp/ps/driver/inc/misc/drvs_lpm.h
@@ -0,0 +1,206 @@
+/*******************************************************************************
+ * Copyright by ZTE Corporation.
+ *
+ * File Name:
+ * File Mark:
+ * Description:
+ * Others:
+ * Version: v0.1
+ * Author: shideyou
+ * Date: 2013-6-29
+ * History 1:
+ * Date:
+ * Version:
+ * Author:
+ * Modification:
+ * History 2:
+ ********************************************************************************/
+
+#ifndef _DRVS_LPM_H
+#define _DRVS_LPM_H
+
+
+/****************************************************************************
+* Include files
+****************************************************************************/
+//#include "drvs_general.h"
+#include "drvs_dpram.h"
+
+
+/****************************************************************************
+* Macros
+****************************************************************************/
+
+/****************************************************************************
+* Types
+****************************************************************************/
+ typedef enum
+{
+ LPM_RAT_TD,
+ LPM_RAT_LTE,
+ LPM_RAT_W,
+ LPM_T4_RAT_TD,
+ LPM_T4_RAT_W,
+ LPM_T2_RAT_LTE,
+
+ MAX_LPM_RAT
+} T_ZDrvLpm_RAT;
+
+typedef struct
+{
+ UINT16 wWFrmCnt; /*0~4095 Fn*/
+ UINT16 wWSlotCnt; /*0~14 slot*/
+ UINT16 wWSymbolCnt; /*0~9 symbol*/
+ UINT16 wWChipCnt; /*0~255 chip*/
+}T_WLpmTime;
+
+typedef struct
+{
+ UINT16 wTdFrmCnt; /*0~8191 Fn*/
+ UINT16 wTdChipCnt; /*0~6400 chip*/
+}T_TdLpmTime;
+
+typedef struct
+{
+ UINT16 wLteSuperFrmCnt;
+ UINT16 wLteFrmCnt;
+ UINT16 wLteSubFrmCnt;
+}T_LteLpmTime;
+
+
+typedef VOID (*T_ZDrvLpm_CallbackFunction)(VOID); //used for LTE
+
+/****************************************************************************
+* Constants
+****************************************************************************/
+
+/****************************************************************************
+* Global Variables
+****************************************************************************/
+
+/****************************************************************************
+* Function Prototypes
+****************************************************************************/
+/*******************************************************************************
+ * Function: zDrvLpm_RegCallbackForLTE
+ * Description: regist callback function for LTE_lpm interrupt
+ * Parameters:
+ * Input:
+ * callback: function be register
+ * Output:
+ * None
+ * Returns:
+ * DRV_ERROR:interrupt install failed
+ * Drv_SUCCESS:successful!
+ *
+ * Others:
+ ********************************************************************************/
+SINT32 zDrvLpm_RegCallbackForLTE(T_ZDrvLpm_CallbackFunction callback);
+
+/*******************************************************************************
+ * Function: zDrvLpm_RegCallbackForTD
+ * Description: regist callback function for TD_lpm interrupt
+ * Parameters:
+ * Input:
+ * callback: function be register
+ * Output:
+ * None
+ * Returns:
+ * DRV_ERROR:interrupt install failed
+ * Drv_SUCCESS:successful!
+ *
+ * Others:
+ ********************************************************************************/
+ SINT32 zDrvLpm_RegCallbackForTD(T_ZDrvLpm_CallbackFunction callback);
+
+ /*******************************************************************************
+ * Function: zDrvLpm_RegCallbackForW
+ * Description: regist callback function for W_lpm interrupt
+ * Parameters:
+ * Input:
+ * callback: function be register
+ * Output:
+ * None
+ * Returns:
+ * DRV_ERROR:interrupt install failed
+ * Drv_SUCCESS:successful!
+ *
+ * Others:
+ ********************************************************************************/
+ SINT32 zDrvLpm_RegCallbackForW(T_ZDrvLpm_CallbackFunction callback);
+/*******************************************************************************
+ * Function: zDrvLpm_IrqEnable
+ * Description: enable interrupt of lpm
+ * Parameters:
+ * Input:
+ * rat: TD/W/LTE
+ * Output:
+ * None
+ * Returns:
+ * None
+ *
+ * Others:
+ ********************************************************************************/
+VOID zDrvLpm_IrqEnable(T_ZDrvLpm_RAT rat);
+
+/*******************************************************************************
+ * Function: zDrvLpm_IrqDisable
+ * Description: disable interrupt of lpm
+ * Parameters:
+ * Input:
+ * rat: TD/W/LTE
+ * Output:
+ * None
+ * Returns:
+ * None
+ *
+ * Others:
+ ********************************************************************************/
+VOID zDrvLpm_IrqDisable(T_ZDrvLpm_RAT rat);
+
+/**************************************************************************
+* º¯ÊýÃû³Æ£º lpm_WDpramSfnIsValid
+* ¹¦ÄÜÃèÊö£º »ñÈ¡WDpramÄÚÖ¡ºÅÐÅÏ¢ÊÇ·ñÓÐЧ
+* ²ÎÊý˵Ã÷£º
+* ·µ »Ø Öµ £ºTRUE ÓÐЧ£» FALSE ÎÞЧ
+* ÆäËü˵Ã÷£º
+**************************************************************************/
+BOOL zDrvLpm_WDpramSfnIsValid(void);
+
+/**************************************************************************
+* º¯ÊýÃû³Æ£º Lpm_GetWCfnSfn
+* ¹¦ÄÜÃèÊö£º PS»ñÈ¡WÖ¡ºÅµ÷¶ÈÐÅÏ¢
+* ²ÎÊý˵Ã÷£º
+* ·µ »Ø Öµ £º
+* ÆäËü˵Ã÷£º
+**************************************************************************/
+VOID zDrvLpm_GetWCfnSfn(T_ZDrvDpram_CfnSfnForW* ptCfnSfn);
+/**************************************************************************
+* º¯ÊýÃû³Æ£º zDrvLpm_GetSfn_Lte
+* ¹¦ÄÜÃèÊö£º PS»ñÈ¡LTEÖ¡ºÅÐÅÏ¢
+* ²ÎÊý˵Ã÷£º
+* ·µ »Ø Öµ £º
+* ÆäËü˵Ã÷£º
+**************************************************************************/
+UINT32 zDrvLpm_GetSfn_Lte(VOID);
+
+/**************************************************************************
+* º¯ÊýÃû³Æ£º zDrvLpm_TdDpramSfnIsValid
+* ¹¦ÄÜÃèÊö£º »ñÈ¡TdDpramÄÚÖ¡ºÅÐÅÏ¢ÊÇ·ñÓÐЧ
+* ²ÎÊý˵Ã÷£º
+* ·µ »Ø Öµ £ºTRUE ÓÐЧ£» FALSE ÎÞЧ
+* ÆäËü˵Ã÷£º
+**************************************************************************/
+BOOL zDrvLpm_TdDpramSfnIsValid(void);
+
+/**************************************************************************
+* º¯ÊýÃû³Æ£º zDrvLpm_GetTdCfnSfn
+* ¹¦ÄÜÃèÊö£º PS»ñÈ¡TDÖ¡ºÅµ÷¶ÈÐÅÏ¢
+* ²ÎÊý˵Ã÷£º
+* ·µ »Ø Öµ £ºTD NT ×ÓÖ¡ºÅ\Cfn
+* ÆäËü˵Ã÷£º
+**************************************************************************/
+VOID zDrvLpm_GetTdCfnSfn(T_ZDrvDpram_CfnSfn* ptTdCfnSfn);
+
+#endif/*_FILENAME_H*/
+
diff --git a/cp/ps/driver/inc/misc/drvs_nand.h b/cp/ps/driver/inc/misc/drvs_nand.h
new file mode 100644
index 0000000..daa6ad1
--- /dev/null
+++ b/cp/ps/driver/inc/misc/drvs_nand.h
@@ -0,0 +1,438 @@
+/***********************************************************************
+* Copyright (C) 2001, ZTE Corporation.
+*
+* File Name: drvs_nand.h
+* File Mark:
+* Description: tu hal interface declaration.
+* Others:
+* Version: v1.0
+* Author: wangxia
+* Date: 2008-08-28
+*
+* History 1:
+* Date:
+* Version:
+* Author:
+* Modification:
+
+* History 2:
+**********************************************************************/
+
+#ifndef HAL_NAND_H
+#define HAL_NAND_H
+
+#ifdef _OS_TOS
+#include <cyg/fs/tos_yaffs_nand.h>
+#endif
+#include "drvs_io.h"
+/*************************************************************************
+ * Include files *
+ *************************************************************************/
+
+
+/*************************************************************************
+ * Macro *
+ *************************************************************************/
+#define ZDRV_NAND_PART_NVRO "nvr"
+#define ZDRV_NAND_PART_NVRW "nvrw"
+#define ZDRV_NAND_PART_YAFFS "cpfs"
+/**************************************************************************
+ * Types *
+ **************************************************************************/
+typedef struct{
+ UINT8 pbyManu; /* ÖÆÔìÉÌid */
+ UINT8 pbyDevice; /* оƬid */
+ UINT8 pbyID3; /* ¸½¼Óid */
+ UINT8 pbyID4; /* ¸½¼Óid */
+ UINT8 pbyID5; /* ¸½¼Óid */
+}T_ZDrvNand_DeviceID;
+
+typedef struct{
+ UINT32 nvBase; /* NVÆðʼµØÖ·*/
+ UINT32 nvSize; /* NV´óС */
+}T_ZDrvNand_NVParam;
+
+/**
+ * NAND Flash part information
+*/
+typedef struct _T_Nand_Part_Info
+{
+
+ UINT32 PageSize;
+ UINT32 PageSpareSize;
+ UINT32 BlockSize;
+ UINT32 PartOffset;
+ UINT32 PartSize;
+ UINT32 TotalSize;
+ UINT8 *PartName;
+ T_ZDrvIO_Handle pIoHnd;
+}T_Nand_Part_Info;
+
+typedef enum {
+
+ ZFTL_PART_NVRO_NVRW=0,
+ ZFTL_PART_NVFAC,
+ ZFTL_PART_SMS,
+ ZFTL_PART_SIMNV,
+ ZFTL_PART_SIMNVFAC,
+ ZFTL_PART_MAX
+
+} T_ZFTL_PART_NO;
+
+
+/**************************************************************************
+ * Global Variable *
+ **************************************************************************/
+
+
+/**************************************************************************
+ * Function Prototypes *
+ **************************************************************************/
+/**************************************************************************
+* Function: zDrvNand_Initiate
+* Description:initialize nand for hal_init.c
+* Parameters:
+* Input:None
+* Output: None
+* Returns:None
+**************************************************************************/
+SINT32 zDrvNand_Initiate(VOID);
+
+/**************************************************************************
+* Function: zDrvNand_PartRead
+* Description:read nand base partition.
+* Parameters:
+* Input:None
+* Output: None
+* Returns:None
+**************************************************************************/
+SINT32 zDrvNand_PartRead(char* part_name,UINT32 offset,UINT32 size,UINT8* buffer);
+/**************************************************************************
+* Function: zDrvNand_PartGetSize
+* Description:get nand partition size.
+* Parameters:
+* Input:None
+* Output: None
+* Returns:None
+**************************************************************************/
+UINT32 zDrvNand_PartGetSize(char* part_name);
+
+
+/*******************************************************************************
+ * Function: zDrvNand_ReadBootflag
+ * Description: read the bootflag of zx297510
+ * Parameters:
+ * Input:
+ *
+ * Output:
+ *
+ * Returns: 0: open dl usb
+ * 1: close dl usb
+ *
+ * Others: 0xffffffff_ffffffff: USB DL;
+ * "ZTE7510\0" : NO USB DL
+ ********************************************************************************/
+UINT32 zDrvNand_ReadBootflag( void );
+
+/*******************************************************************************
+ * Function: zDrvNand_WriteBootflag
+ * Description: write the bootflag of zx297510
+ * Parameters:
+ * Input:
+ *
+ * Output:
+ *
+ * Returns:0 success
+ * 1 fail
+ *
+ *
+ * Others: 0xffffffff_ffffffff: USB DL;
+ * "ZTE7510\0" : NO USB DL
+ ********************************************************************************/
+UINT32 zDrvNand_WriteBootflag( UINT32 flag );
+
+/*******************************************************************************
+ * Function: zDrvNand_ReadUsbtimeout
+ * Description: read the usbtimeout flag of zx297510
+ * Parameters:
+ * Input:
+ *
+ * Output:
+ *
+ * Returns: flag:usb time out (1~10)
+ *
+ *
+ * Others:
+ ********************************************************************************/
+UINT32 zDrvNand_ReadUsbtimeout( void );
+
+/*******************************************************************************
+ * Function: zDrvNand_WriteUsbtimeout
+ * Description: write the usbtimeout flag of zx297510
+ * Parameters:
+ * Input:flag (1~10)
+ *
+ * Output:
+ *
+ * Returns:
+ *
+ *
+ * Others:
+ ********************************************************************************/
+UINT32 zDrvNand_WriteUsbtimeout( UINT32 flag );
+
+
+/**************************************************************************
+* º¯ÊýÃû³Æ£º zDrvNand_GetNVParam
+* ¹¦ÄÜÃèÊö£º This function is used to get nv param
+
+* ²ÎÊý˵Ã÷£º (IN)
+ none.
+ (OUT)
+ nvParam: nvÆðʼµØÖ·´óС.
+
+* ·µ »Ø Öµ£º 0: ³É¹¦
+* !=0: ʧ°Ü
+
+* ÆäËü˵Ã÷£º none.
+**************************************************************************/
+extern SINT32 zDrvNand_GetNVParam(T_ZDrvNand_NVParam *nvParam);
+
+/**************************************************************************
+* º¯ÊýÃû³Æ£º zDrvNand_ReadID
+* ¹¦ÄÜÃèÊö£º This function is used to identify the nand chip
+
+* ²ÎÊý˵Ã÷£º (IN)
+ none.
+ (OUT)
+ pbyDevice: ³§ÉÌid,оƬid,¸½¼Óid,¸½¼Óid.
+
+* ·µ »Ø Öµ£º 0: ³É¹¦
+* !=0: ʧ°Ü
+
+* ÆäËü˵Ã÷£º none.
+**************************************************************************/
+extern SINT32 zDrvNand_ReadID(T_ZDrvNand_DeviceID *pbyDevice);
+
+
+/**************************************************************************
+* º¯ÊýÃû³Æ£º zDrvNand_Initialize
+* ¹¦ÄÜÃèÊö£º This function is used to initialize the nand chip
+
+* ²ÎÊý˵Ã÷£º (IN)
+ none.
+ (OUT)
+ none.
+
+* ·µ »Ø Öµ£º none.
+
+* ÆäËü˵Ã÷£º none.
+***************************************************************************/
+extern SINT32 zDrvNand_Initialize(void);
+
+/**************************************************************************
+* º¯ÊýÃû³Æ£º zDrvNand_Erase
+* ¹¦ÄÜÃèÊö£º This function is used to erase the nand blocks spcified by
+ dwStart and dwEnd.
+
+* ²ÎÊý˵Ã÷£º (IN)
+ dwStart: start address to erase
+ dwEnd: end address to erase
+ µØÖ··¶Î§£º( NAND_BASE ~ NAND_BASE + BYTES_IN_NAND )
+ (OUT)
+ none.
+
+* ·µ »Ø Öµ£º 0: ³É¹¦
+* !=0: ʧ°Ü
+
+* ÆäËü˵Ã÷£º ¸Ã¹¦ÄܽöÔÚÕû¿é²Á³ýºÍ¸ñʽ»¯Ê±Ê¹Óá£
+ дµÄʱºòÎÞÐè²Á³ý±»Ð´ÇøÓò.
+ ²Á³ýʱdwStart¡¢dwEndËù¿çµÄ¿é£¨Ã¿¿é16K byte£©½«±»È«²¿²Á³ý¡£
+**************************************************************************/
+extern SINT32 zDrvNand_Erase(UINT32 dwStart, UINT32 dwEnd);
+
+extern SINT32 zDrvNand_Program_1(T_ZFTL_PART_NO partNo, UINT32 offset, UINT32 len, UINT8* from);
+extern SINT32 zDrvNand_Read_1(T_ZFTL_PART_NO partNo, UINT32 offset, UINT32 len, UINT8* to);
+
+#ifdef _OS_TOS
+/**************************************************************************
+* Function: zDrvNand_PartOpen
+* Description:get nand parameters for ecos fs.
+* Parameters:
+* Input: part_name:partition name
+* Output: pNandPartInfo:part information
+* Returns:0: success
+* other: error
+**************************************************************************/
+SINT32 zDrvNand_PartOpen(UINT8* part_name, T_zYaffs_PartInfo *pNandPartInfo);
+
+/*******************************************************************************
+ * Function: zDrvNand_PartReadMain
+ * Description: yaffs read nand main
+ * Parameters:
+ * Input:pNandPartInfo:yaffs information;
+ * dwAddr:start addr;
+ * dwLen:read length;
+ * pbyBuf:read buffer;
+ * Output:
+ *
+ * Returns: 0:success;
+ * others:fail
+ *
+ *
+ * Others:
+ ********************************************************************************/
+
+SINT32 zDrvNand_PartReadMain(T_zYaffs_PartInfo *pNandPartInfo, UINT32 dwAddr, UINT32 dwLen, UINT8 *pbyBuf);
+
+/**************************************************************************
+* Function: zDrvNand_PartReadSpare
+* Description: read data from flash
+* Parameters:
+* Input: pNandPartInfo:yaffs information;
+* dwAddr: address
+* dwLen: length to read
+* Output: None
+* Returns:
+* 0: success
+* other: error
+* Others: Éϲãµ÷ÓÃzDrvNand_PartReadSpare()µÄº¯Êý dwLen ¶ÁÈ¡µÄ³¤¶È¶¼Îª Õû¸öOOB
+ dwAddr ¶ÁÈ¡µØÖ·¶¼Îª Ò³µØÖ·¶ÔÆë
+
+**************************************************************************/
+SINT32 zDrvNand_PartReadSpare(T_zYaffs_PartInfo *pNandPartInfo,UINT32 dwAddr, UINT32 dwLen, UINT8 *pbyBuf);
+
+/**************************************************************************
+* Function: zDrvNand_PartWriteMain
+* Description: write data to flash of main area
+* Parameters:
+* Input: pNandPartInfo:yaffs information;
+* dwAddr: address
+* dwLen: length to read
+* pMBuf: buffer in which data is stored
+* Output: None
+* Returns:
+* 0: success
+* other: error
+* Others: Éϲãµ÷ÓÃzDrvNand_PartWriteMain()µÄº¯Êý dwLen дÈëµÄ³¤¶È1 page,
+ dwAddr дÈëµØÖ·¶¼Îª Ò³µØÖ·¶ÔÆë
+
+**************************************************************************/
+SINT32 zDrvNand_PartWriteMain(T_zYaffs_PartInfo *pNandPartInfo, UINT32 dwAddr, UINT32 dwLen, UINT8 *pbyBuf);
+
+/**************************************************************************
+* Function: zDrvNand_PartWriteSpare
+* Description: write data to flash of spare area
+* Parameters:
+* Input: pNandPartInfo:yaffs information;
+* dwAddr: address
+* dwLen: length to read
+* pbyBuf: buffer in which data is stored
+* Output: None
+* Returns:
+* 0: success
+* other: error
+* Others: Éϲãµ÷ÓÃzDrvNand_PartWriteSpare()µÄº¯Êý dwLen дÈëµÄ³¤¶È¶¼ÎªÕû¸öOOB
+ dwAddr дÈëµØÖ·¶¼Îª Ò³µØÖ·¶ÔÆë
+
+**************************************************************************/
+SINT32 zDrvNand_PartWriteSpare(T_zYaffs_PartInfo *pNandPartInfo, UINT32 dwAddr, UINT32 dwLen, UINT8 *pbyBuf);
+
+/**************************************************************************
+* Function: zDrvNand_PartErase
+* Description: erase a block
+* Parameters:
+* Input: pNandPartInfo:yaffs information;
+* dwAddr: address,block aliagn
+* Output: None
+* Returns:
+* 0: success
+* other: error
+* Others:
+**************************************************************************/
+SINT32 zDrvNand_PartErase(T_zYaffs_PartInfo *pNandPartInfo, UINT32 dwAddr);
+
+/**************************************************************************
+* Function: zDrvNand_PartCheckBadBlock
+* Description:check badblock for ecos fs.
+* Parameters:
+* Input: pNandPartInfo:part information
+* dwAddr:start addrress
+* Output: None
+* Returns:DRV_SUCCESS: good block
+* DRV_ERROR: bad block
+**************************************************************************/
+
+SINT32 zDrvNand_PartCheckBadBlock(T_zYaffs_PartInfo *pNandPartInfo,UINT32 dwAddr);
+
+/**************************************************************************
+* Function: zDrvNand_PartMarkBadBlock
+* Description:mark badblock for ecos fs.
+* Parameters:
+* Input: pNandPartInfo:part information
+* dwAddr:start addrress
+* Output: None
+* Returns:DRV_SUCCESS: mark bad success
+* DRV_ERROR: mark bad fail
+**************************************************************************/
+
+SINT32 zDrvNand_PartMarkBadBlock(T_zYaffs_PartInfo *pNandPartInfo,UINT32 dwAddr);
+#endif
+
+/**************************************************************************
+* Function: zDrvNand_PartMtdOpen
+* Description:get nand parameters for FOTA.
+* Parameters:
+* Input:None
+* Output: None
+* Returns:None
+**************************************************************************/
+SINT32 zDrvNand_PartMtdOpen(UINT8* part_name, T_Nand_Part_Info *pNandPartInfo);
+
+/**************************************************************************
+* Function: zDrvNand_PartMtdRead
+* Description:read data for FOTA.
+* Parameters:
+* Input:None
+* Output: None
+* Returns:None
+**************************************************************************/
+SINT32 zDrvNand_PartMtdRead(T_Nand_Part_Info *pNandPartInfo,UINT32 dwAddr, UINT32 dwLen, UINT8 *pbyBuf);
+/**************************************************************************
+* Function: zDrvNand_PartMtdWrite
+* Description:read data for FOTA.
+* Parameters:
+* Input:None
+* Output: None
+* Returns:None
+**************************************************************************/
+SINT32 zDrvNand_PartMtdWrite(T_Nand_Part_Info *pNandPartInfo,UINT32 dwAddr, UINT32 dwLen, UINT8 *pbyBuf);
+/**************************************************************************
+* Function: zDrvNand_PartMtdErase
+* Description:erase data for FOTA.
+* Parameters:
+* Input:None
+* Output: None
+* Returns:None
+**************************************************************************/
+SINT32 zDrvNand_PartMtdErase(T_Nand_Part_Info *pNandPartInfo,UINT32 dwAddr);
+
+/**************************************************************************
+* Function: zDrvNand_NvRwEccMake
+* Description:
+* Parameters:
+* Input:
+*
+* Output: None
+* Returns: 0: ÕýÈ·
+ ÆäËû: ´íÎó
+*
+*
+* Others:
+**************************************************************************/
+SINT32 zDrvNand_NvRwEccMake(UINT32 dwStart, UINT32 dwLen);
+
+
+
+#endif /* HAL_NAND_H */
+
diff --git a/cp/ps/driver/inc/misc/drvs_nand_ids.h b/cp/ps/driver/inc/misc/drvs_nand_ids.h
new file mode 100644
index 0000000..b8a1318
--- /dev/null
+++ b/cp/ps/driver/inc/misc/drvs_nand_ids.h
@@ -0,0 +1,166 @@
+/***********************************************************************
+* Copyright (C) 2001, ZTE Corporation.
+*
+* File Name: drvs_nand.h
+* File Mark:
+* Description: tu hal interface declaration.
+* Others:
+* Version: v1.0
+* Author: wangxia
+* Date: 2008-08-28
+*
+* History 1:
+* Date:
+* Version:
+* Author:
+* Modification:
+
+* History 2:
+**********************************************************************/
+
+#ifndef DRV_NAND_IDS_H
+#define DRV_NAND_IDS_H
+
+/*************************************************************************
+ * Include files *
+ *************************************************************************/
+
+
+/*************************************************************************
+ * Macro *
+ *************************************************************************/
+
+
+/**************************************************************************
+ * Types *
+ **************************************************************************/
+#if 1
+/*
+* nand_flash_timing
+*/
+struct nand_flash_timing
+{
+ unsigned char Twhr; /*reg offset 0x100*/ /*spi nand: rd delay*/
+ unsigned char Trr1; /*spi nand: cs setup*/
+ unsigned char Tadl; /*reg offset 0x110*/ /*spi nand: cs hold*/
+ unsigned char Trr2; /*spi nand: cs desel*/
+ unsigned char Trhw; /*reg offset 0x120*/
+ unsigned char Trea; /*reg offset 0x130*/
+ unsigned char Trp; /*reg offset 0x1f0, or Twp*/
+ unsigned char Treh; /*reg offset 0x200, or Tweh*/
+ unsigned char Tcs; /*reg offset 0x220*/
+ unsigned char Trhz; /*reg offset 0x290*/
+};
+
+
+struct nand_ecc
+{
+ unsigned int strength; /*ECC ¾À´íÄÜÁ¦*/
+ unsigned int sector_size; /*ECC ¾À´íµÄÊý¾Ý¿é´óС*/
+};
+
+
+/*nand É豸ÃèÊö½á¹¹Ìå*/
+struct nand_flash_device_para
+{
+ unsigned char manuf_id; /* ³§¼ÒID */
+ unsigned char device_id; /* É豸ID */
+ unsigned char res_id; /* Æ÷¼þID */
+ unsigned char bus_num; /* 0:8λ 1:16λ */
+ unsigned int page_size; /* ÿҳmainÇøÓò´óС */
+ unsigned int oob_size; /* ÿҳspareÇøÓò´óС */
+ unsigned int column_addr_num; /* ÁеØÖ·Ñ°Ö·ÖÜÆÚÊý */
+ unsigned int row_addr_num; /* ÐеØÖ·Ñ°Ö·ÖÜÆÚÊý */
+ unsigned int block_size; /* ÿ¿éµÄ´óС */
+ unsigned int pages_per_block; /* ÿ¿éµÄÒ³Êý */
+ unsigned int block_num; /* ¿éÊý */
+ unsigned int die_num;
+ unsigned int bad_block_markpos; /* »µ¿é±ê־λλÖÃ,´Ó0¿ªÊ¼ */
+ struct nand_flash_timing nand_timeing;
+
+ struct nand_ecc ecc;
+};
+#endif
+
+
+/**
+ * struct nand_flash_dev - NAND Flash Device ID Structure
+ * @name: Identify the device type
+ * @id: device ID code
+ * @pagesize: Pagesize in bytes. Either 256 or 512 or 0
+ * If the pagesize is 0, then the real pagesize
+ * and the eraseize are determined from the
+ * extended id bytes in the chip
+ * @erasesize: Size of an erase block in the flash device.
+ * @chipsize: Total chipsize in Mega Bytes
+ * @options: Bitfield to store chip relevant options
+ */
+struct nand_flash_dev {
+ char *name;
+ int id;
+ unsigned long pagesize;
+ unsigned long chipsize;
+ unsigned long erasesize;
+ unsigned long options;
+};
+
+/**
+ * struct nand_manufacturers - NAND Flash Manufacturer ID Structure
+ * @name: Manufacturer name
+ * @id: manufacturer ID code of device.
+*/
+struct nand_manufacturers {
+ int id;
+ char * name;
+};
+
+
+
+
+/* Option constants for bizarre disfunctionality and real
+* features
+*/
+/* Chip can not auto increment pages */
+#define NAND_NO_AUTOINCR 0x00000001
+/* Buswitdh is 16 bit */
+#define NAND_BUSWIDTH_16 0x00000002
+/* Device supports partial programming without padding */
+#define NAND_NO_PADDING 0x00000004
+/* Chip has cache program function */
+#define NAND_CACHEPRG 0x00000008
+/* Chip has copy back function */
+#define NAND_COPYBACK 0x00000010
+/* AND Chip which has 4 banks and a confusing page / block
+ * assignment. See Renesas datasheet for further information */
+#define NAND_IS_AND 0x00000020
+/* Chip has a array of 4 pages which can be read without
+ * additional ready /busy waits */
+#define NAND_4PAGE_ARRAY 0x00000040
+/* Chip requires that BBT is periodically rewritten to prevent
+ * bits from adjacent blocks from 'leaking' in altering data.
+ * This happens with the Renesas AG-AND chips, possibly others. */
+#define BBT_AUTO_REFRESH 0x00000080
+/* Chip does not require ready check on read. True
+ * for all large page devices, as they do not support
+ * autoincrement.*/
+#define NAND_NO_READRDY 0x00000100
+/* Chip does not allow subpage writes */
+#define NAND_NO_SUBPAGE_WRITE 0x00000200
+
+/*
+ * NAND Flash Manufacturer ID Codes
+ */
+#define NAND_MFR_TOSHIBA 0x98
+#define NAND_MFR_SAMSUNG 0xec
+#define NAND_MFR_FUJITSU 0x04
+#define NAND_MFR_NATIONAL 0x8f
+#define NAND_MFR_RENESAS 0x07
+#define NAND_MFR_STMICRO 0x20
+#define NAND_MFR_HYNIX 0xad
+#define NAND_MFR_MICRON 0x2c
+#define NAND_MFR_AMD 0x01
+#define NAND_MFR_GIGADEVICE 0xC8
+
+
+#endif /* DRV_NAND_IDS_H */
+
diff --git a/cp/ps/driver/inc/misc/drvs_nv.h b/cp/ps/driver/inc/misc/drvs_nv.h
new file mode 100644
index 0000000..3ea5b57
--- /dev/null
+++ b/cp/ps/driver/inc/misc/drvs_nv.h
@@ -0,0 +1,59 @@
+/***********************************************************************
+* Copyright (C) 2013, ZTE Corporation.
+*
+* File Name: drvs_nv.h
+* File Mark:
+* Description: Provide audio NV function prototype declaration and type declaration. The audio NV type declaration is moved from eep.h.
+* Others:
+* Version: v0.5
+* Author: zhouqi
+* Date: 2013-05-8
+*
+* History 1:
+* Date:2013-07-23
+* Version:
+* Author:geanfeng
+* Modification:add NV macro
+* History 2:
+**********************************************************************/
+
+#ifndef _DRVS_NV_H
+#define _DRVS_NV_H
+/****************************************************************************
+* Include files
+****************************************************************************/
+#include "drvs_general.h"
+/****************************************************************************
+* Macros
+****************************************************************************/
+/****************************************************************************
+* Types
+****************************************************************************/
+/****************************************************************************
+* Constants
+****************************************************************************/
+
+/****************************************************************************
+* Global Variables
+****************************************************************************/
+
+/****************************************************************************
+* Function Prototypes
+****************************************************************************/
+/**************************************************************************
+* Function: zDrvNand_ChangeNvrAttr
+* Description: ÉèÖÃNV_R·ÖÇøµÄ¶ÁдÊôÐÔ£¬Ä¬ÈÏΪֻ¶Á
+* Parameters:
+* Input:
+*
+* Output: None
+* Returns:
+*
+*
+* Others: ĬÈÏֵΪ 0x0 Ö»¶Á
+ 0x1 ¶Áд
+**************************************************************************/
+SINT32 zDrvNand_ChangeNvrAttr( UINT32 rw );
+
+#endif /* _DRVS_NV_H */
+
diff --git a/cp/ps/driver/inc/misc/drvs_p_sio_mux_ata.h b/cp/ps/driver/inc/misc/drvs_p_sio_mux_ata.h
new file mode 100644
index 0000000..22be837
--- /dev/null
+++ b/cp/ps/driver/inc/misc/drvs_p_sio_mux_ata.h
@@ -0,0 +1,227 @@
+/* ==========================================================================
+** Copyright (C) 1999 - 2007 COMNEON GmbH. All rights reserved.
+** ==========================================================================
+**
+** ==========================================================================
+**
+** This document contains proprietary information belonging to COMNEON.
+** Passing on and copying of this document, use and communication of its
+** contents is not permitted without prior written authorisation.
+**
+** ==========================================================================
+** Revision Information :
+** File name: sio_scc.h
+** Version: /main/sio_main/66
+** Date: 2007-05-09 15:43:50
+**
+** ==========================================================================
+** Project: Mobile Station (MS)
+** Block: -
+** Process: -
+**
+** ==========================================================================
+** Contents: DTE-AT adapter to receive at commands from the DTE
+**
+** ==========================================================================
+** History:
+**
+** Date Author Comment
+** --------------------------------------------------------------------------
+** 04.11.03 ges Added ata_control.
+** 13.05.03 wein Added TCP/IP over serial mode.
+** 19.03.03 wein Removed USB from ata_op1.c.
+** 23.01.03 hwe Merge: Added ata_linestate().
+** 02.10.02 hwe Added WAP DS.
+** 04.12.01 ges added ata_set_pec_size().
+** 06.11.01 ges added ATA_OFFLINE_PTEST and ATA_OFFLINE_END_PTEST
+** (production test modes).
+** 26.07.01 rha added ata_free_tx_buf().
+** 13.09.99 ges created.
+**
+** ==========================================================================
+*/
+
+#ifndef SIO_MUX_ATA_H
+#define SIO_MUX_ATA_H
+
+/*
+** =========================================================================
+** GLOBAL DEFINES
+** =========================================================================
+*/
+/* mux dev define begin */
+#define ZDRV_DEV_SIO_MUX_1 "/mux/1"
+#define ZDRV_DEV_SIO_MUX_2 "/mux/2"
+#define ZDRV_DEV_SIO_MUX_3 "/mux/3"
+#define ZDRV_DEV_SIO_MUX_4 "/mux/4"
+#define ZDRV_DEV_SIO_MUX_5 "/mux/5"
+#define ZDRV_DEV_SIO_MUX_6 "/mux/6"
+#define ZDRV_DEV_SIO_MUX_7 "/mux/7"
+#define ZDRV_DEV_SIO_MUX_8 "/mux/8"
+#define ZDRV_DEV_SIO_MUX_9 "/mux/9"
+#define ZDRV_DEV_SIO_MUX_10 "/mux/10"
+#define ZDRV_DEV_SIO_MUX_11 "/mux/11"
+#define ZDRV_DEV_SIO_MUX_12 "/mux/12"
+#define ZDRV_DEV_SIO_MUX_13 "/mux/13"
+#define ZDRV_DEV_SIO_MUX_14 "/mux/14"
+#define ZDRV_DEV_SIO_MUX_15 "/mux/15"
+/* mux dev define end */
+#define SIO_USE_SOCKET_CONCEPT 0
+#define SIO_FBUS_AVAILABLE 0
+/*
+** =========================================================================
+** GLOBAL TYPES
+** =========================================================================
+*/
+
+
+/*
+** =========================================================================
+** GLOBAL FUNCTIONS
+** =========================================================================
+*/
+/****************************************************************************
+* Type: cmux_cmd_par_t
+*----------------------------------------------------------------------------
+* Purpose: the parameters of the at command AT+CMUX.
+*
+* Parameters: None.
+*
+* Returns: None - on error the function exits.
+****************************************************************************/
+typedef struct
+{
+ unsigned char mode;
+ unsigned char subset;
+ unsigned int port_speed;
+ unsigned int n1;
+ unsigned char t1;
+ unsigned char n2;
+ unsigned char t2;
+ unsigned char t3;
+ unsigned char k;
+
+} cmux_cmd_par_t;
+
+typedef enum ata_mode_e
+{
+ /*
+ ** AT command mode
+ */
+ ATA_OFFLINE_CMD = 0, /* Single line mode */
+ ATA_OFFLINE_SMS_TEXT = 3, /* Multi line mode */
+ ATA_OFFLINE_SMS_PDU = 7, /* Multi line mode */
+ ATA_OFFLINE_CHAR = 1, /* AT break-off mode */
+
+ ATA_ONLINE = 2, /* No AT line mode, DS data transfer mode */
+ ATA_ONLINE_CMD = 4, /* Interrupted DS mode, AT line mode */
+
+ ATA_OFFLINE_BUSY = 5, /* AT command in progress */
+ ATA_ONLINE_BUSY = 6, /* AT command in progress */
+
+ ATA_ONLINE_PTP = 10, /* Point to Point Protocol mode. */
+
+ ATA_OFFLINE_PTEST = 12, /* AT is ready to process productions
+ * test commands.
+ */
+ ATA_OFFLINE_END_PTEST = 13, /* AT processing a production test command.
+ */
+ ATA_ONLINE_PTEST, /* AT is in production test transfer mode.
+ */
+ ATA_MUX, /* multiplexing mode */
+ ATA_ONLINE_AP_AT, /* application over AT/serial mode */
+ ATA_ONLINE_AP_DS, /* application over DS mode */
+ ATA_ONLINE_TRACE, /* FD is connected to the trace device. */
+ ATA_ONLINE_TRACE_CHANGE, /* The trace device change is ongoing. */
+
+#if SIO_USE_SOCKET_CONCEPT > 0
+ ATA_ONLINE_SOCKET, /* Give the port control to another
+ * application. */
+#endif
+ ATA_ONLINE_DS_SYNC, /* DS data transfer mode - waiting for sync. */
+ ATA_ONLINE_DS, /* DS data transfer mode */
+
+ ATA_SMS_CHAR_MODE, /* SMS char mode - SMS PDU or SMS Text mode.
+ * SMS is sent as ascii coded text PDU or hex coded binary PDU.
+ */
+#if SIO_FBUS_AVAILABLE == 1
+ ATA_ONLINE_FBUS_BUSY, /* An FBUS frame is processed. */
+ ATA_ONLINE_FBUS_IDLE, /* Enter the idle mode of the FBUS protocol. */
+ ATA_ONLINE_FBUS_INIT, /* Start the FBUS protocol. */
+#endif
+
+ ATA_NO_MODE
+
+} ata_mode_t;
+
+/****************************************************************************
+* Type: cmux_test_par_t
+*----------------------------------------------------------------------------
+* Purpose: the parameters of the at test command AT+CMUX=?.
+*
+* Parameters: None.
+*
+* Returns: None - on error the function exits.
+****************************************************************************/
+
+typedef struct {
+ char buf[64];
+} cmux_test_par_t;
+
+/**B**************************************************************************
+* Function: ata_mux_test
+*-----------------------------------------------------------------------------
+* Usage: None
+*
+* Remarks: None
+***E*************************************************************************/
+int ata_mux_test (int tid, cmux_test_par_t *cmux_test_rsp_p);
+
+/**B**************************************************************************
+* Function: ata_mux_read
+*-----------------------------------------------------------------------------
+* Usage: None
+*
+* Remarks: None
+***E*************************************************************************/
+int ata_mux_read (int tid, cmux_cmd_par_t *cmux_cmd_par_p);
+
+/**B**************************************************************************
+* Function: ata_mux_cmd
+*-----------------------------------------------------------------------------
+* Usage: cmux_cmd_par_t ÖеÄn1×î´óÖ§³Ö2047
+*
+* Remarks: None
+***E*************************************************************************/
+int ata_mux_cmd (int tid, cmux_cmd_par_t *cmux_cmd_par);
+
+/**B**************************************************************************
+* Function: ata_mux_release
+*-----------------------------------------------------------------------------
+* Usage: None
+*
+* Remarks: None
+***E*************************************************************************/
+int ata_mux_release (int tid);
+
+#if 0 /* ͳһʹÓÃDD_SIOµÄCTRLÃüÁî */
+typedef enum
+{
+ IOCTL_SIO_MUX_SET_DATA, /*set data config command,set baudrate.param:T_ZDrvSio_DataConfig*/
+ IOCTL_SIO_MUX_SET_BUFFER, /*set data buffer command,param:T_ZDrvSio_SetConfig */
+ IOCTL_SIO_MUX_SET_BLOCKTIME, /*set sio block read*/
+ IOCTL_SIO_MUX_SET_BLOCK,
+ IOCTL_SIO_MUX_CLEAN_BLOCK, /*clean the sio block read*/
+ IOCTL_SIO_MUX_CALLBACK, /*set sio non block callback function.param:T_ZDrvSio_Read_CallBack*/
+ #if 0 /* 617001655333 MUXÓÅ»¯ºó²»ÐèÒªÒÔÏÂIOCTLÖ¸Áî */
+ IOCTL_SIO_MUX_ACTIVE_MUX, /*active mux mode add by zqs*/
+ IOCTL_SIO_MUX_DEACTIVE_MUX, /*deactive mux mode,back to normal add by zqs*/
+ IOCTL_SIO_MUX_GET_TX_FINISH, /*get tx state for check send over zqs*/
+ #endif
+ IOCTL_SIO_MUX_CMD_MAX
+} T_ZDrvSio_MUX_IOCTL; /*sio mux ioctl command*/
+#endif
+
+#endif /* SIO_MUX_ATA_H */
+
+/* drvs_sio_mux_ata.h ends here. */
diff --git a/cp/ps/driver/inc/misc/drvs_pcu.h b/cp/ps/driver/inc/misc/drvs_pcu.h
new file mode 100644
index 0000000..0144172
--- /dev/null
+++ b/cp/ps/driver/inc/misc/drvs_pcu.h
@@ -0,0 +1,120 @@
+/***********************************************************************
+* Copyright (C) 2014, ZTE Corporation.
+*
+* File Name: drvs_pcu.h
+* File Mark:
+* Description: pcu control interface declaration.
+* Others:
+* Version: v1.0
+* Author: limeifeng
+* Date: 2014-01-22
+*
+* History 1:
+* Date:
+* Version:
+* Author:
+* Modification:
+
+**********************************************************************/
+#ifndef DRVS_PCU_H
+#define DRVS_PCU_H
+
+/*************************************************************************
+ * Include files *
+ *************************************************************************/
+#include "drvs_general.h"
+/****************************************************************************
+* macro
+****************************************************************************/
+
+/****************************************************************************
+* Type
+****************************************************************************/
+/**************************************************************************
+ * Global Variable *
+ **************************************************************************/
+
+/**************************************************************************
+ * Function Prototypes *
+ **************************************************************************/
+/*******************************************************************************
+ * Function: zDrvPcu_InitIntType
+ * Description:ÉèÖþ¹ýPCUµÄÖжÏÔ´Í·ÀàÐͲ¢ÇåÖжϣ¬GPIOĬÈÏΪµçƽ´¥·¢¡£
+ * Parameters:
+ * Input:
+ *
+ * Output:
+ *
+ * Returns:
+ *
+ * Others:´Ëº¯ÊýÖ»¹©ÖжÏÄ£¿éµ÷Óã¬ÆäËüÄ£¿éÇ벻ҪʹÓÃ!
+ ********************************************************************************/
+VOID zDrvPcu_InitIntType(VOID);
+
+/*******************************************************************************
+ * Function: zDrvPcu_SetWakeInt
+ * Description:
+ * ÉèÖÃij¸öÖжÏÊÇ·ñΪ»½ÐÑÖжÏ
+ * Parameters:
+ * Input:
+ * intLine: ÖжϺÅ
+ * isWakeInt: ÊÇ·ñΪ»½ÐÑÖжϣ¬0 »½ÐÑÖÐ¶Ï 1 ·Ç»½ÐÑÖжÏ
+ * Output:
+ *
+ * Returns: ³É¹¦·µ»ØDRV_SUCCESS£¬Ê§°Ü·µ»ØDRV_ERROR¡£
+ *
+ * Others:
+ ********************************************************************************/
+SINT32 zDrvPcu_SetWakeInt(UINT32 intLine, BOOL isWakeInt);
+
+/*******************************************************************************
+ * Function: zDrvPcu_ClrInt
+ * Description:Çå³ýÖжÏÔÚPCUµÄÖжÏ״̬¡£
+ * Èç¹û¶ÔÓ¦ÖжϾ¹ýPCUÇÒÖжÏÔ´Í·ÀàÐÍΪ±ßÑØ´¥·¢£¬
+ * ÔòÐèÒªÔÚÖжϻص÷º¯ÊýISRÀïµ÷Óô˺¯ÊýÇå³ýÖжÏ״̬¡£
+ * Parameters:
+ * Input:
+ * intSel: T_PCUINT_SELö¾ÙÀàÐÍ,ÒªÇå³ýµÄÖжϡ£
+ * Output:
+ *
+ * Returns: ³É¹¦·µ»ØDRV_SUCCESS£¬Ê§°Ü·µ»ØDRV_ERROR¡£
+ *
+ * Others:
+ ********************************************************************************/
+//SINT32 zDrvPcu_ClearInt(UINT32 intLine);
+
+
+/*******************************************************************************
+ * Function: zDrvPcu_SetIntLevel
+ * Description:
+ * 1.¶ÔÓÚPCU²à¹Ì¶¨´¥·¢·½Ê½µÄÖжϲ»ÐèÒªµ÷Óô˺¯Êý
+ * ÒÑÔÚÖжÏÄ£¿é³õʼ»¯Ê±ÅäÖá£
+ * 2.´Ëº¯ÊýÖ÷Òª¸øÍⲿÖжÏÀàÐÍ¿ÉÉèÖõÄGPIO_EX_INTºÍEX_INT¸ù¾Ý
+ * ʵ¼Ê´¥·¢·½Ê½½øÐÐÅäÖá£
+ * Parameters:
+ * Input:
+ * intSel: T_IntPCURegö¾ÙÀàÐÍ
+ * level: PCU²àµÄÖжϴ¥·¢·½Ê½
+ * Output:
+ *
+ * Returns: ³É¹¦·µ»ØDRV_SUCCESS£¬Ê§°Ü·µ»ØDRV_ERROR¡£
+ *
+ * Others:
+ ********************************************************************************/
+//SINT32 zDrvPcu_SetIntLevel(UINT32 intLine,T_zDrvIntLineLevel level);
+
+/*******************************************************************************
+ * Function: zDrvPcu_Clear8in1Int
+ * Description:EX8IN1_INT0_PCU~EX8IN1_INT7_PCUÐèÒª¶îÍâµ÷Óô˺¯ÊýÇå³ýÖжÏ
+ * Parameters:
+ * Input:
+ * intSel: T_PCUINT_SELö¾ÙÀàÐÍ,ÒªÇå³ýµÄÖжϡ£
+ * Output:
+ *
+ * Returns: ³É¹¦·µ»ØDRV_SUCCESS£¬Ê§°Ü·µ»ØDRV_ERR_INVALID_PARAM¡£
+ *
+ * Others:
+ ********************************************************************************/
+//SINT32 zDrvPcu_Clear8in1Int(VOID);
+
+#endif /* DRVS_PCU_H */
diff --git a/cp/ps/driver/inc/misc/drvs_pmic.h b/cp/ps/driver/inc/misc/drvs_pmic.h
new file mode 100644
index 0000000..608cee8
--- /dev/null
+++ b/cp/ps/driver/inc/misc/drvs_pmic.h
@@ -0,0 +1,34 @@
+/*******************************************************************************
+ * Copyright (C) 2007, ZTE Corporation.
+ *
+ * File Name: drvs_pmic.h
+ * File Mark:
+ * Description: Provide pmic interface for other module' use.(mc13783 and lp3917)
+ * Others:
+ * Version: V0.5
+ * Author: zhangyingjun
+ * Date: 2009-06-17
+ * History 1:
+ * Date:
+ * Version:
+ * Author:
+ * Modification:
+ * History 2:
+ ********************************************************************************/
+
+#ifndef _DRVS_PMIC_H
+#define _DRVS_PMIC_H
+
+#include "drvs_pm.h"
+#include "drvs_pmic_bus.h"
+#include "drvs_pmic_int.h"
+#include "drvs_pmic_adc.h"
+#include "drvs_pmic_addr.h"
+#include "drvs_pmic_rtc.h"
+#include "drvs_pmic_regulator.h"
+#include "drvs_pmic_wrapper.h"
+#endif
+
+
+
+
diff --git a/cp/ps/driver/inc/misc/drvs_pmic_adc.h b/cp/ps/driver/inc/misc/drvs_pmic_adc.h
new file mode 100644
index 0000000..4cfe089
--- /dev/null
+++ b/cp/ps/driver/inc/misc/drvs_pmic_adc.h
@@ -0,0 +1,52 @@
+/*******************************************************************************
+ * Copyright (C) 2016, ZTE Corporation.
+ *
+ * File Name: hal_pmic_adc.h
+ * File Mark:
+ * Description: pmic adc interface.
+ * Others:
+ * Version: V1.0
+ * Author: yuxiang
+ * Date: 2016-01-27
+ * History 1:
+ * Date:
+ * Version:
+ * Author:
+ * Modification:
+ * History 2:
+ ********************************************************************************/
+#ifndef __DRVS_PMIC_ADC_H_
+#define __DRVS_PMIC_ADC_H_
+
+#if defined(_USE_PMIC_ZX234290)
+typedef enum _T_ZDrvPmic_AdcChannel
+{
+ ADC_CHANNEL_VBAT_ADC = 0,
+ ADC_CHANNEL_VADC2 = 1, /* 01 */
+ ADC_CHANNEL_VADC1 = 2, /* 10 */
+
+ MAX_ADC_CHANNEL
+}T_ZDrvPmic_AdcChannel;
+
+/* ADC */
+#define ZX234290_ADC_ADC_START_LSH (5)
+#define ZX234290_ADC_ADC1_EN_LSH (4)
+#define ZX234290_ADC_ADC2_EN_LSH (3)
+
+#define ZX234290_ADC_ADC_START_WID (1)
+#define ZX234290_ADC_ADC1_EN_WID (1)
+#define ZX234290_ADC_ADC2_EN_WID (1)
+
+/* CODE 12BIT */
+#define ZX234290_ADC_DATAMSB_LSH (0) /* DATA0 - DATA11 */
+#define ZX234290_ADC_DATALSB_LSH (4) /* */
+#define ZX234290_ADC_DATAMSB_WID (8) /* DATA0 - DATA11 */
+#define ZX234290_ADC_DATALSB_WID (4) /* */
+
+SINT32 zDrvPmic_AdcInit(VOID);
+SINT32 zDrvPmic_AdcExit(VOID);
+SINT32 zDrvPmic_AdcSingleAdcRead(T_ZDrvPmic_AdcChannel channel, SINT32 *value);
+SINT32 zDrvPmic_AdcAvgAdcRead(T_ZDrvPmic_AdcChannel channel, SINT32 *avgValue);
+#endif
+#endif
+
diff --git a/cp/ps/driver/inc/misc/drvs_pmic_addr.h b/cp/ps/driver/inc/misc/drvs_pmic_addr.h
new file mode 100644
index 0000000..9b96da7
--- /dev/null
+++ b/cp/ps/driver/inc/misc/drvs_pmic_addr.h
@@ -0,0 +1,132 @@
+/*******************************************************************************
+ * Copyright (C) 2016, ZTE Corporation.
+ *
+ * File Name: drvs_pmic_addr.h
+ * File Mark: register addresses of pmic
+ * Description:
+ * Others:
+ * Version: V1.0
+ * Author: yuxiang
+ * Date: 2016-01-27
+ * History 1:
+ * Date:
+ * Version:
+ * Author:
+ * Modification:
+ * History 2:
+ ********************************************************************************/
+#ifndef _DRVS_PMIC_ADDR_H
+#define _DRVS_PMIC_ADDR_H
+
+#if defined(_USE_PMIC_ZX234290)
+
+/////////////////////////////////////////////////
+/*slave address 0x12*/
+/////////////////////////////////////////////////
+#define ZX234290_I2C_SLAVE_ADDR0 (0x12)
+
+/* interrupt and mask */
+#define ZX234290_REG_ADDR_INTA 0x00 /* INTERRUPT */
+#define ZX234290_REG_ADDR_INTB 0x01
+#define ZX234290_REG_ADDR_INTA_MASK 0x02
+#define ZX234290_REG_ADDR_INTB_MASK 0x03
+
+/* interrupt status */
+#define ZX234290_REG_ADDR_STSA 0x04
+#define ZX234290_REG_ADDR_STSB 0x05
+#define ZX234290_REG_ADDR_STS_STARTUP 0x06
+
+/* adc & softon select */
+#define ZX234290_REG_ADDR_SYS_CTRL 0x07 /*0x8 0x9Ìø¹ý*/
+
+/* bucks normal voltage and sleep voltage */
+#define ZX234290_REG_ADDR_BUCK1_VOL 0x0A /*[00xx xxxx]0xB 0xC Ìø¹ý*/
+#define ZX234290_REG_ADDR_BUCK1_SLPVOL 0x0D
+
+/* bucks mode */
+#define ZX234290_REG_ADDR_BUCK1_MODE 0x0E /* [xx] NRM [xx] SLP [00 00]*/
+#define ZX234290_REG_ADDR_BUCK23_MODE 0x0F /*[xx]BUCK3 NRM [xx]BUCK3 SLP [xx]BUCK2 NRM [xx]BUCK2 SLP*/
+#define ZX234290_REG_ADDR_BUCK4_MODE 0x11 /* [00 00] [xx] NRM [xx] SLP 0X10Ìø¹ý */
+
+/* ldo normal voltage */
+#define ZX234290_REG_ADDR_LDO12_VOL 0x12 /* [xxxx xxxx] */
+#define ZX234290_REG_ADDR_LDO34_VOL 0x13
+#define ZX234290_REG_ADDR_LDO56_VOL 0x14
+#define ZX234290_REG_ADDR_LDO78_VOL 0x15
+#define ZX234290_REG_ADDR_LDO9_VOL 0x16 /* [xxxx 0000] */
+#define ZX234290_REG_ADDR_LDO10_RTCLDO_VOL 0x17 /* [00 xx]VORTC [xx xx]LDO10*/
+
+
+#define ZX234290_REG_ADDR_BUCK2_VOL 0x1A /* BUCK2 VLOT */
+
+/* ldo sleep voltage */
+#define ZX234290_REG_ADDR_LDO12_SLPVOL 0x18 /* [xx xx]ldo2 [xx xx]ldo1*/
+#define ZX234290_REG_ADDR_LDO3_SLPVOL 0x19 /* [00 00] [xx xx] */
+#define ZX234290_REG_ADDR_LDO78_SLPVOL 0x1B /* [xx xx]ldo8 [xx xx]ldo7*/
+#define ZX234290_REG_ADDR_LDO9_SLPVOL 0x1C /* [xx xx] [00 00] */
+#define ZX234290_REG_ADDR_LDO10_SLPVOL 0x1D /* [00 00] [xx xx] */
+
+/* ldo mode */
+#define ZX234290_REG_ADDR_LDO1234_MODE 0x1E /* [xx][xx][xx][xx]*/
+#define ZX234290_REG_ADDR_LDO5678_MODE 0x1F
+#define ZX234290_REG_ADDR_LDO910_MODE 0x20 /* [00] [xx] [xx] [00] */
+
+/* ldo enable */
+#define ZX234290_REG_ADDR_LDO_EN1 0x21 /* LDO8-1 */
+#define ZX234290_REG_ADDR_LDO_EN2 0x22 /* [xx xx]BUCK4-1, [0xx0]LDO10-9*/
+
+/* adc code */
+#define ZX234290_REG_ADDR_VBATADC_MSB 0x23 /*[xxxx xxxx]*/
+#define ZX234290_REG_ADDR_VBATADC_LSB 0x24 /*[xxxx 0000]*/
+#define ZX234290_REG_ADDR_ADC1_MSB 0x25
+#define ZX234290_REG_ADDR_ADC1_LSB 0x26
+#define ZX234290_REG_ADDR_ADC2_MSB 0x27
+#define ZX234290_REG_ADDR_ADC2_LSB 0x28
+
+/* rtc */
+#define ZX234290_REG_ADDR_RTC_CTRL1 0x30
+#define ZX234290_REG_ADDR_RTC_CTRL2 0x31
+
+/* date and time */
+#define ZX234290_REG_ADDR_SECONDS 0x32
+#define ZX234290_REG_ADDR_MINUTES 0x33
+#define ZX234290_REG_ADDR_HOURS 0x34
+#define ZX234290_REG_ADDR_DAY 0x35
+#define ZX234290_REG_ADDR_WEEK 0x36
+#define ZX234290_REG_ADDR_MONTH 0x37
+#define ZX234290_REG_ADDR_YEAR 0x38
+
+/* alarm */
+#define ZX234290_REG_ADDR_ALARM_MINUTE 0x39
+#define ZX234290_REG_ADDR_ALARM_HOUR 0x3A
+#define ZX234290_REG_ADDR_ALARM_DAY 0x3B
+#define ZX234290_REG_ADDR_ALARM_WEEK 0x3C
+#define ZX234290_REG_ADDR_ALARM_SECOND 0x3D
+
+#define ZX234290_REG_ADDR_TIMER_CTRL 0x3E
+#define ZX234290_REG_ADDR_TIMER_CNT 0x3F
+
+/* enable ldo output discharge resistance */
+#define ZX234290_REG_ADDR_EN_DISCH1 0x40
+#define ZX234290_REG_ADDR_EN_DISCH2 0x41
+
+/* power key control */
+#define ZX234290_REG_ADDR_PWRKEY_CONTROL1 0x42
+#define ZX234290_REG_ADDR_PWRKEY_CONTROL2 0x43
+
+#define ZX234290_REG_ADDR_VERSION 0x44
+
+/*fault status*/
+#define ZX234290_REG_ADDR_BUCK_FAULT_STATUS 0x45
+#define ZX234290_REG_ADDR_LDO_FAULT_STATUS 0x46
+
+#define ZX234290_REG_ADDR_BUCK_INT_MASK 0x47
+#define ZX234290_REG_ADDR_LDO_INT_MASK 0x48
+
+#define ZX234290_REG_ADDR_USER_RESERVED 0x50
+
+#define ZX234290_REG_ADDR_GMT_TESTING 0xf1
+
+#endif
+
+#endif
diff --git a/cp/ps/driver/inc/misc/drvs_pmic_bus.h b/cp/ps/driver/inc/misc/drvs_pmic_bus.h
new file mode 100644
index 0000000..f93ed2b
--- /dev/null
+++ b/cp/ps/driver/inc/misc/drvs_pmic_bus.h
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * Copyright (C) 2016, ZTE Corporation.
+ *
+ * File Name: drvs_pmic_bus.h
+ * File Mark:
+ * Description: pmic i2c interface
+ * Others:
+ * Version: V1.0
+ * Author: yuxiang
+ * Date: 2016-01-27
+ * History 1:
+ * Date:
+ * Version:
+ * Author:
+ * Modification:
+ * History 2:
+ ********************************************************************************/
+#ifndef __DRVS_PMIC_BUS_H_
+#define __DRVS_PMIC_BUS_H_
+
+extern SINT32 zDrvPmic_I2cRead(UINT8 slv_addr, UINT8 reg_addr, UINT8 *reg_val);
+extern SINT32 zDrvPmic_I2cWrite(UINT8 slv_addr, UINT8 reg_addr, UINT8 *reg_val);
+
+extern SINT32 zDrvPmic_I2cInit(VOID);
+extern SINT32 zDrvPmic_GetRegister(UINT8 slv_addr, UINT8 addr, UINT8* data);
+extern SINT32 zDrvPmic_SetRegister(UINT8 slv_addr, UINT8 addr, UINT8 data, UINT8 mask);
+
+extern SINT32 zDrvPmic_I2cInit_PSM(VOID);
+extern SINT32 zDrvPmic_I2cRead_PSM(UINT8 slv_addr, UINT8 reg_addr, UINT8 *reg_val);
+extern SINT32 zDrvPmic_I2cWrite_PSM(UINT8 slv_addr, UINT8 reg_addr, UINT8 *reg_val);
+extern SINT32 zDrvPmic_SetRegister_PSM(UINT8 slv_addr, UINT8 addr, UINT8 data, UINT8 mask);
+
+#endif
diff --git a/cp/ps/driver/inc/misc/drvs_pmic_int.h b/cp/ps/driver/inc/misc/drvs_pmic_int.h
new file mode 100644
index 0000000..8e8eb16
--- /dev/null
+++ b/cp/ps/driver/inc/misc/drvs_pmic_int.h
@@ -0,0 +1,56 @@
+/*******************************************************************************
+ * Copyright (C) 2007, ZTE Corporation.
+ *
+ * File Name: drvs_pmic_int.h
+ * File Mark:
+ * Description: pmic int interface
+ * Others:
+ * Version: V1.0
+ * Author: yuxiang
+ * Date: 2016-01-27
+ * History 1:
+ * Date:
+ * Version:
+ * Author:
+ * Modification:
+ * History 2:
+ ********************************************************************************/
+#ifndef _DRVS_PMIC_INT_H
+#define _DRVS_PMIC_INT_H
+
+/* pmic */
+typedef enum _T_ZDrvPmic_IntId {
+ /* 0x00 */
+ ZX234290_INT_INVALID0 = 0,
+ ZX234290_INT_INVALID1,
+ ZX234290_INT_EOADC, /* xxxx x100 */
+ ZX234290_INT_PWRON_SHORT,
+ ZX234290_INT_PWRON_LONG,
+ ZX234290_INT_PWRON,
+ ZX234290_INT_INVALID2,
+ ZX234290_INT_INVALID3,
+ /* 0x01 */
+ ZX234290_INT_RTC_ALRM = 8,
+ ZX234290_INT_INVALID4,
+ ZX234290_INT_INVALID8,
+ ZX234290_INT_RTC_MIN,
+ ZX234290_INT_RTC_HOUR,
+ ZX234290_INT_INVALID5,
+ ZX234290_INT_INVALID6,
+ ZX234290_INT_INVALID7,
+
+ PMIC_INT_MAX_ID
+} T_ZDrvPmic_IntId;
+
+typedef VOID(*T_PMIC_CALLBACK)(UINT8 reg_val);
+
+SINT32 zDrvPmic_IsrMask(UINT8 nInt);
+SINT32 zDrvPmic_IsrUnMask(UINT8 nInt);
+SINT32 zDrvPmic_IntInit(VOID);
+SINT32 zDrvPmic_RegisterCallback(T_ZDrvPmic_IntId nIntId, T_PMIC_CALLBACK callback);
+SINT32 zDrvPmic_UnRegisterCallback(T_ZDrvPmic_IntId nIntId);
+SINT32 zDrvPmic_CleanIrq(UINT8 slv_addr, UINT8 reg_addr);
+SINT32 zDrvPmic_UnMaskIrq(T_ZDrvPmic_IntId nIntId);
+SINT32 zDrvPmic_MaskIrq(T_ZDrvPmic_IntId nIntId);
+
+#endif
diff --git a/cp/ps/driver/inc/misc/drvs_pmic_regulator.h b/cp/ps/driver/inc/misc/drvs_pmic_regulator.h
new file mode 100644
index 0000000..ce7f009
--- /dev/null
+++ b/cp/ps/driver/inc/misc/drvs_pmic_regulator.h
@@ -0,0 +1,630 @@
+/*******************************************************************************
+ * Copyright (C) 2016, ZTE Corporation.
+ *
+ * File Name:
+ * File Mark:
+ * Description:
+ * Others:
+ * Version: V1.0
+ * Author: yuxiang
+ * Date: 2016-01-27
+ * History 1:
+ * Date:
+ * Version:
+ * Author:
+ * Modification:
+ * History 2:
+ ********************************************************************************/
+
+#ifndef _DRVS_PMIC_REGULATOR_H
+#define _DRVS_PMIC_REGULATOR_H
+
+#if defined(_USE_PMIC_ZX234290)
+/* ========================== ¼Ä´æÆ÷ÒÆÎ»²¿·Ö ======================== */
+#if 1
+/* 0x06 STATUS REG -- STARTUP */
+#define ZX234290_SYSPOR_STATUS_PWRON_STARTUP (0x1 << 0) /* PWR ON button */
+#define ZX234290_SYSPOR_STATUS_RTC_ALARM_STARTUP (0x1 << 1)
+#define ZX234290_SYSPOR_STATUS_PSHOLD_STARTUP (0x1 << 2)
+#define ZX234290_SYSPOR_STATUS_PWRONLLP_STARTUP (0x1 << 3)
+
+
+/* discharger */
+#define ZX234290_DISCHG1_LSB_LSH (0)
+#define ZX234290_DISCHG1_LSB_WID (4)
+
+#define ZX234290_DISCHG1_MSB_LSH (5)
+#define ZX234290_DISCHG1_MSB_WID (2)
+
+#define ZX234290_DISCHG2_LSH (0)
+#define ZX234290_DISCHG2_WID (8)
+
+
+/* BUCK VOLTAGE */
+#define ZX234290_BUCK01_VSEL_LSH (0)
+#define ZX234290_BUCK01_VSEL_WID (6)
+
+/* BUCK SLEEP VOLTAGE */
+#define ZX234290_BUCK01_SLEEP_VSEL_LSH (0)
+#define ZX234290_BUCK01_SLEEP_VSEL_WID (6)
+
+/* BUCKS MODE CTROL */
+#define ZX234290_REGULATOR_MODE_WID (2)
+
+#define ZX234290_BUCK0_SLPMODE_LSH (0)
+#define ZX234290_BUCK0_NRMMODE_LSH (2)
+#define ZX234290_BUCK1_SLPMODE_LSH (4)
+#define ZX234290_BUCK1_NRMMODE_LSH (6) /*[7:6]*/
+#define ZX234290_BUCK2_SLPMODE_LSH (0)
+#define ZX234290_BUCK2_NRMMODE_LSH (2)
+#define ZX234290_BUCK3_SLPMODE_LSH (4)
+#define ZX234290_BUCK3_NRMMODE_LSH (6)
+#define ZX234290_BUCK4_SLPMODE_LSH (0)
+#define ZX234290_BUCK4_NRMMODE_LSH (2)
+
+/* LDO MODE, ONLY SLEEP MODE */
+#define ZX234290_LDO1_SLPMODE_LSH (0)
+#define ZX234290_LDO2_SLPMODE_LSH (2)
+#define ZX234290_LDO3_SLPMODE_LSH (4)
+#define ZX234290_LDO4_SLPMODE_LSH (6)
+#define ZX234290_LDO5_SLPMODE_LSH (0)
+#define ZX234290_LDO6_SLPMODE_LSH (2)
+#define ZX234290_LDO7_SLPMODE_LSH (4)
+#define ZX234290_LDO8_SLPMODE_LSH (6)
+#define ZX234290_LDO9_SLPMODE_LSH (2)
+#define ZX234290_LDO10_SLPMODE_LSH (4)
+//#define ZX234290_LDO11_SLPMODE_LSH (6)
+
+/* LDO VOLTAGE SELECT */
+#define ZX234290_LDO_VSEL_WID (4)
+
+#define ZX234290_LDO1_VSEL_LSH (0) /* [3:0] */
+#define ZX234290_LDO2_VSEL_LSH (4) /* [7:4] */
+#define ZX234290_LDO3_VSEL_LSH (0)
+#define ZX234290_LDO4_VSEL_LSH (4)
+#define ZX234290_LDO5_VSEL_LSH (0)
+#define ZX234290_LDO6_VSEL_LSH (4)
+#define ZX234290_LDO7_VSEL_LSH (0)
+#define ZX234290_LDO8_VSEL_LSH (4)
+#define ZX234290_LDO9_VSEL_LSH (4)
+#define ZX234290_LDO10_VSEL_LSH (0)
+#define ZX234290_LDO11_VSEL_LSH (0) /* [3:0] */
+
+#define ZX234290_VORTC_VSEL_WID (2)
+#define ZX234290_VORTC_VSEL_LSH (4) /* [5][4] */
+#define ZX234290_LDO5_VSEL_WID (2) /* [1][0]*/
+
+
+/* LDO SLEEP VOLTAGE */
+#define ZX234290_BUCK2_VSEL_WID (5)
+
+#define ZX234290_BUCK2_VSEL_LSH (0)
+
+#define ZX234290_LDO1_SLP_VSEL_LSH (0) /* [3:0] */
+#define ZX234290_LDO2_SLP_VSEL_LSH (4) /* [7:4] */
+#define ZX234290_LDO3_SLP_VSEL_LSH (0)
+#define ZX234290_LDO7_SLP_VSEL_LSH (0)
+#define ZX234290_LDO8_SLP_VSEL_LSH (0)
+#define ZX234290_LDO11_SLP_VSEL_LSH (0) /* [3:0] */
+
+/* ENABLE 0x21-0x22 */
+#define ZX234290_LDOS_ON_WID (1)
+
+#define ZX234290_LDO1_ON_LSH (0)
+#define ZX234290_LDO2_ON_LSH (1)
+#define ZX234290_LDO3_ON_LSH (2)
+#define ZX234290_LDO4_ON_LSH (3)
+#define ZX234290_LDO5_ON_LSH (4)
+#define ZX234290_LDO6_ON_LSH (5)
+#define ZX234290_LDO7_ON_LSH (6)
+#define ZX234290_LDO8_ON_LSH (7)
+
+#define ZX234290_LDO9_ON_LSH (1)
+#define ZX234290_LDO10_ON_LSH (2)
+#define ZX234290_BUCK1_ON_LSH (4)
+#define ZX234290_BUCK2_ON_LSH (5)
+#define ZX234290_BUCK3_ON_LSH (6)
+#define ZX234290_BUCK4_ON_LSH (7)
+
+/* LONG PRESSED TIME */
+#define ZX234290_PWRON_TIME_LSH (0)
+#define ZX234290_PWRON_TIME_WID (2)
+#define ZX234290_PWRON_LONGPRESS_EN_LSH (2)
+#define ZX234290_PWRON_LONGPRESS_EN_WID (1)
+#define ZX234290_PWRON_LLP_TODO_LSH (3) /* LLP long long pressed */
+#define ZX234290_PWRON_LLP_TODO_WID (1)
+
+/* sys ctrol 0x07 */
+#define ZX234290_SINK1_EN_LSH (0)
+#define ZX234290_SINK1_EN_WID (1)
+#define ZX234290_SINK2_EN_LSH (1)
+#define ZX234290_SINK2_EN_WID (1)
+#define ZX234290_ADC1_EN_LSH (4)
+#define ZX234290_ADC1_EN_WID (1)
+#define ZX234290_ADC2_EN_LSH (3)
+#define ZX234290_ADC2_EN_WID (1)
+#define ZX234290_ADC_START_LSH (5)
+#define ZX234290_ADC_START_WID (1)
+
+/* 0x08 */
+#define ZX234290_SINK2_CURSEL_LSH (0)
+#define ZX234290_SINK2_CURSEL_WID (4)
+/* 0x09 */
+#define ZX234290_SINK1_CURSEL_LSH (0)
+#define ZX234290_SINK1_CURSEL_WID (4)
+
+#define ZX234290_LDO_RSTERR_LSH (0)
+#define ZX234290_LDO_RSTERR_WID (1)
+
+#endif /* end of ZX234290 */
+
+#define ZX234290_BITFVAL(var, lsh) ( (var) << (lsh) )
+#define ZX234290_BITFMASK(wid, lsh) ( ((1U << (wid)) - 1) << (lsh) )
+#define ZX234290_BITFEXT(var, wid, lsh) ((var & ZX234290_BITFMASK(wid, lsh)) >> (lsh))
+
+/* =========================== ¸÷½á¹¹ÌåµÄ¶¨Òå ========================== */
+
+/* VBA - BUCK1 6bit */
+typedef enum _T_ZDrvZx234290_VbuckA
+{
+ VBUCKA_0_675 = 0x00,
+ VBUCKA_0_700 = 0x02,
+ VBUCKA_0_750 = 0x06,
+ VBUCKA_0_800 = 0x0a,
+ VBUCKA_0_850 = 0x0e,
+ VBUCKA_0_900 = 0x12,/*default*/
+ VBUCKA_0_950 = 0x16,
+ VBUCKA_1_000 = 0x1a,
+ VBUCKA_1_050 = 0x1e,
+ VBUCKA_1_100 = 0x22,
+ VBUCKA_1_150 = 0x26,
+ VBUCKA_1_200 = 0x2a,
+ VBUCKA_1_250 = 0x2e,
+
+ VBUCKA_MAX
+
+}T_ZDrvZx234290_VbuckA;
+
+/* VBC - BUCK2 */
+typedef enum _T_ZDrvZx234290_VbuckC
+{
+ VBUCKC_0_850 = 0x00,
+ VBUCKC_0_900 = 0x02,
+ VBUCKC_0_950 = 0x04,
+ VBUCKC_1_000 = 0x06,
+ VBUCKC_1_050 = 0x08,
+ VBUCKC_1_100 = 0x0a,
+ VBUCKC_1_150 = 0x0c,
+ VBUCKC_1_200 = 0x0e,/*default*/
+ VBUCKC_1_250 = 0x10,
+ VBUCKC_1_300 = 0x12,
+ VBUCKC_1_350 = 0x14,
+ VBUCKC_1_400 = 0x16,
+ VBUCKC_1_450 = 0x18,
+ VBUCKC_1_500 = 0x1a,
+ VBUCKC_1_550 = 0x1c,
+ VBUCKC_1_600 = 0x1e,
+
+ VBUCKC_MAX
+
+}T_ZDrvZx234290_VbuckC;
+
+/* VLA - ldo1/9/10 */
+typedef enum _T_ZDrvZx234290_VldoA
+{
+ VLDOA_0_725 = 0,
+ VLDOA_0_750 = 1,
+ VLDOA_0_775 = 2,
+ VLDOA_0_800 = 3,
+ VLDOA_0_825 = 4,
+ VLDOA_0_850 = 5,
+ VLDOA_0_875 = 6,
+ VLDOA_0_900 = 7,
+ VLDOA_0_925 = 8,
+ VLDOA_0_950 = 9,
+ VLDOA_0_975 = 10,
+ VLDOA_1_000 = 11,
+ VLDOA_1_025 = 12,
+ VLDOA_1_050 = 13,
+ VLDOA_1_075 = 14,
+ VLDOA_1_100 = 15,
+
+ VLDOA_MAX
+
+}T_ZDrvZx234290_VldoA;
+
+/* VLB - ldo5 2bit */
+typedef enum _T_ZDrvZx234290_VldoB
+{
+ VLDOB_3_300 = 0,
+ VLDOB_3_150 = 1,
+ VLDOB_3_000 = 2,
+ VLDOB_1_800 = 3, /* 11 */
+
+ VLDOB_MAX
+
+}T_ZDrvZx234290_VldoB;
+
+/* VLC - ldo2/ldo3 */
+typedef enum _T_ZDrvZx234290_VldoC
+{
+ VLDOC_0_750 = 0,
+ VLDOC_0_800 = 1,
+ VLDOC_0_850 = 2,
+ VLDOC_0_900 = 3,
+ VLDOC_0_950 = 4,
+ VLDOC_1_000 = 5,
+ VLDOC_1_050 = 6,
+ VLDOC_1_100 = 7,
+ VLDOC_1_200 = 8,
+ VLDOC_1_500 = 9,
+ VLDOC_1_800 = 10,
+ VLDOC_2_000 = 11,
+ VLDOC_2_500 = 12,
+ VLDOC_2_800 = 13,
+ VLDOC_3_000 = 14,
+ VLDOC_3_300 = 15,
+
+ VLDOC_MAX
+
+}T_ZDrvZx234290_VldoC;
+
+/* VLD - ldo4/6/7/8 */
+typedef enum _T_ZDrvZx234290_VldoD
+{
+ VLDOD_1_400 = 0,
+ VLDOD_1_500 = 1,
+ VLDOD_1_600 = 2,
+ VLDOD_1_800 = 3,
+ VLDOD_1_850 = 4,
+ VLDOD_2_000 = 5,
+ VLDOD_2_050 = 6,
+ VLDOD_2_500 = 7,
+ VLDOD_2_550 = 8,
+ VLDOD_2_700 = 9,
+ VLDOD_2_750 = 10,
+ VLDOD_2_800 = 11,
+ VLDOD_2_850 = 12,
+ VLDOD_2_900 = 13,
+ VLDOD_2_950 = 14,
+ VLDOD_3_000 = 15,
+
+ VLDOD_MAX
+
+}T_ZDrvZx234290_VldoD;
+
+/* VORTC 2bit */
+typedef enum _T_ZDrvZx234290_VldoE
+{
+ VLDOE_1_800 = 0,
+ VLDOE_2_500 = 1,
+ VLDOE_3_000 = 2,
+ VLDOE_3_300 = 3, /* 11 */
+
+ VLDOE_MAX
+
+}T_ZDrvZx234290_VldoE;
+
+
+/* BUCK3/4 EXTERNAL ADJUSTABLE */
+
+typedef enum _T_ZDrvZx234290_LDO_ENABLE
+{
+ LDO_ENABLE_OFF = 0, /* 00 */
+ LDO_ENABLE_ON = 1, /* 10 */
+
+ LDO_AVTICE_MAX
+}T_ZDrvZx234290_LDO_ENABLE;
+
+typedef enum _T_ZDrvZx234290_LLP_ENABLE
+{
+ LLP_DISBALE = 0, /* 00 */
+ LLP_ENABLE = 1, /* 10 */
+
+ LLP_ENABLE_MAX
+}T_ZDrvZx234290_LLP_ENABLE;
+
+typedef enum _T_ZDrvZx234290_LLP_TODO
+{
+ LLP_SHUTDOWN = 0, /* 00 */
+ LLP_RESTART = 1, /* 10 */
+
+ LLP_TODO_MAX
+}T_ZDrvZx234290_LLP_TODO;
+
+typedef enum _T_ZDrvZx234290_LP_TIME
+{
+ LP_TIME_1S = 0,
+ LP_TIME_2S ,
+ LP_TIME_3S ,
+ LP_TIME_4S ,
+
+ LP_TIME_MAX
+}T_ZDrvZx234290_LP_TIME;
+typedef enum _T_ZDrvZx234290_TIME_IT
+{
+ LLP_DLY_128MS = 0,
+ LLP_DLY_500MS ,
+ LLP_DLY_1000MS ,
+ LLP_DLY_1500MS ,
+
+ LLP_DLY_MAX
+}T_ZDrvZx234290_TIME_IT;
+
+typedef enum _T_ZDrvZx234290_LLP_TIME
+{
+ LLP_TIME_6S = 0,
+ LLP_TIME_7S ,
+ LLP_TIME_8S ,
+ LLP_TIME_10S ,
+
+ LLP_TIME_MAX
+}T_ZDrvZx234290_LLP_TIME;
+
+
+/*
+ ¹ØÓÚ BUCKSµÄģʽ£¬·ÖΪÕý³£Ä£Ê½Óë˯Ãßģʽ£¬ Õý³£Ä£Ê½Ö»¹Ø×¢PFM/PWM£¬²»¹Ø×¢¿ª¹Ø¡£
+ ˯Ãßģʽ¹Ø×¢PFM/PWM/ECO/OFF/NRM£¬Ó¦¸Ã½âÊÍΪ ˯ÃßģʽµÄ״̬²»½ö¹Ø×¢PWM/PFM£¬
+ ¶øÇÒ¹Ø×¢´ò¿ª¹Ø±Õ£¬³ýÁËOFF£¬ÆäËû¶¼ÊÇÔÚ¿ª×ŵÄÇé¿öϵÄģʽ£»¶øÄ¬ÈÏ¿ªµÄÇé¿öÔòÊÇ
+ NRMMODE£¬µçѹÓÃ˯Ãßµçѹ£»
+ ¶øLDOSµÄ˯Ãßģʽ£¬Ò»ÑùÓëÕý³£Ä£Ê½²»Ïà¸É¡£ÆäÒ²ÓÐNRM/ECO/OFFÕ⼸ÖÖ״̬
+*/
+
+/* BUCK1/2/3/4 NORMAL MODE */
+typedef enum _T_ZDrvZx234290_BUCK_NRMMODE
+{
+ BUCK_NRM_AUTO_WITH_ECO = 0, /* 00/01 AUTO PWM/PSM ECO */
+ BUCK_NRM_FORCE_PWM = 2, /* 10 FORCE PWM */
+ BUCK_NRM_AUTO_WITHOUT_ECO = 3, /* 00/01 AUTO PWM/PSM ECO */
+ BUCK_NRMMODE_MAX
+}T_ZDrvZx234290_BUCK_NRMMODE;
+
+/* BUCK1 SLPMODE */
+typedef enum _T_ZDrvZx234290_BUCK1_SLPMODE
+{
+ BUCK1_SLP_AUTO_WITHOUT_ECO = 0, /* 00/11 AUTO PWM/PFM */
+ BUCK1_SLP_AUTO_ECO = 1, /*BUCK1_SLP_AUTO_ECO_VOLT output voltage configred by FBDC1[5:0]*/
+ BUCK1_SLP_AUTO_ECO_SLP = 2, /* output voltage configred by FBDC1_SLP[5:0]*/
+ BUCK1_SLP_SHUTDOWN = 3, /* 11 OFF */
+ BUCK1_SLPMODE_MAX
+}T_ZDrvZx234290_BUCK1_SLPMODE;
+
+/* BUCK2/3/4 SLPMODE */
+typedef enum _T_ZDrvZx234290_BUCK234_SLPMODE
+{
+ BUCK234_SLP_AUTO_WITHOUT_ECO = 0, /* 00 AUTO PWM/PFM without eco*/
+ BUCK234_SLP_ECO_WITH_ECO = 1, /* 01Óë10¾ùÊÇ ECO */
+ BUCK234_SLP_SHUTDOWN = 3, /* 11 OFF */
+
+ BUCK234_SLPMODE_MAX
+}T_ZDrvZx234290_BUCK234_SLPMODE;
+
+/* LDO1/2/3/7/8/9/10 SLPMODE */
+typedef enum _T_ZDrvZx234290_LDOA_SLPMODE
+{
+ LDOA_SLP_NRM_MODE = 0, /* VOLDOx[3:0] */
+ LDOA_SLP_ECO_VOLT = 1, /* VOLDOx[3:0] */
+ LDOA_SLP_ECO_VOLT_SLP = 2, /* VOLDOx_SLP[3:0] */
+ LDOA_SLP_SHUTDOWN = 3, /* 11 OFF */
+ LDOA_SLPMODE_MAX
+}T_ZDrvZx234290_LDOA_SLPMODE;
+
+/* LDO4/5/6/ SLPMODE */
+typedef enum _T_ZDrvZx234290_LDOB_SLPMODE
+{
+ LDOB_SLP_NRM_MODE = 0, /* VOLDOx[3:0] */
+ LDOB_SLP_ECO_VOLT = 1, /* VOLDOx[3:0] */
+ LDOB_SLP_NRM_MODE_VOLT = 2, /* VOLDOx[3:0] */
+ LDOB_SLP_SHUTDOWN = 3, /* 11 OFF */
+ LDOB_SLPMODE_MAX
+}T_ZDrvZx234290_LDOB_SLPMODE;
+
+#endif
+
+typedef enum _T_ZDrvZx234290_LdoDischarger
+{
+ DISCHARGER_LDO_9 = 0,
+ DISCHARGER_LDO_10,
+ DISCHARGER_LDO_X, /*not support*/
+ DISCHARGER_BUCK_4,
+ DISCHARGER_BUCK_3,
+ DISCHARGER_BUCK_2,
+ DISCHARGER_BUCK_1,
+ DISCHARGER_BUCK_X, /*not support*/
+
+ DISCHARGER_LDO_1,
+ DISCHARGER_LDO_2,
+ DISCHARGER_LDO_3,
+ DISCHARGER_LDO_4,
+ DISCHARGER_LDO_5,
+ DISCHARGER_LDO_6,
+ DISCHARGER_LDO_7,
+ DISCHARGER_LDO_8,
+
+ DISCHARGER_MAX
+}T_ZDrvZx234290_LdoDischarger;
+
+typedef enum _T_ZDrvZx234290_DISCHARGER_ENABLE
+{
+ DISCHARGER_DISBALE = 0, /* 00 */
+ DISCHARGER_ENABLE = 1, /* 10 */
+
+ DISCHARGER_ENABLE_MAX
+}T_ZDrvZx234290_DISCHARGER_ENABLE;
+
+typedef enum _T_ZDrvZx234290_LdoList
+{
+ LDOLIST_BUCK_1 = 0,
+ LDOLIST_BUCK_2,
+ LDOLIST_BUCK_3,
+ LDOLIST_BUCK_4,
+ LDOLIST_LDO_1,
+ LDOLIST_LDO_2,
+ LDOLIST_LDO_3,
+
+ LDOLIST_LDO_4,
+ LDOLIST_LDO_5,
+ LDOLIST_LDO_6,//default off
+ LDOLIST_LDO_7,
+ LDOLIST_LDO_8,
+ LDOLIST_LDO_9,//default off
+ LDOLIST_LDO_10,
+ LDOLIST_LDO_RTC,
+
+ LDOLIST_MAX
+}T_ZDrvZx234290_LdoList;
+
+
+typedef enum _T_ZDrvZx234290_ResetType
+{
+#if 0
+ ZX234290_USER_RST_UNDEFINE = 0,
+ ZX234290_USER_RST_TO_NORMAL = 1,
+ ZX234290_USER_RST_TO_CHARGER = 2,
+ ZX234290_USER_RST_TO_ALARM = 3,
+ ZX234290_USER_RST_TO_EXCEPT = 4,
+#else
+ ZX234290_USER_RST_TO_NORMAL = 0,
+ ZX234290_USER_RST_TO_CHARGER = 1,
+ ZX234290_USER_RST_TO_ALARM = 2,
+ ZX234290_USER_RST_UNDEFINE = 3,
+ /* ZX234290_USER_RST_TO_EXCEPT = 4, */
+#endif
+
+ ZX234290_USER_RST_MAX
+}T_ZDrvZx234290_ResetType;
+
+
+/* ----------------------- º¯Êý¶¨Òå -------------------------------- */
+#if defined(_USE_PMIC_ZX234290)
+SINT32 Zx234290_SetTllpToDo(T_ZDrvZx234290_LLP_TODO enable);
+SINT32 Zx234290_SetLlpEnable(T_ZDrvZx234290_LLP_ENABLE enable);
+SINT32 Zx234290_SetLpTime(T_ZDrvZx234290_LP_TIME time);
+SINT32 Zx234290_SetRestartDly(T_ZDrvZx234290_TIME_IT time);
+SINT32 Zx234290_SetLlpTime(T_ZDrvZx234290_LLP_TIME time);
+int Zx234290_SetUserReg_PSM(UINT8 data);
+
+
+SINT32 Zx234290_SetDischarger(T_ZDrvZx234290_LdoDischarger ldo, T_ZDrvZx234290_DISCHARGER_ENABLE enable);
+SINT32 Zx234290_PrintLdoOnoff(T_ZDrvZx234290_LdoList LdoId, UINT8 status);
+SINT32 Zx234290_PrintLdoVol(T_ZDrvZx234290_LdoList LdoId, UINT8 vol);
+SINT32 Zx234290_PrintLdoSleep(T_ZDrvZx234290_LdoList LdoId, UINT8 status);
+
+
+/* regulator */
+SINT32 Zx234290_SetVbuck1Onoff(T_ZDrvZx234290_LDO_ENABLE status);
+T_ZDrvZx234290_LDO_ENABLE Zx234290_GetVbuck1Onoff(VOID);
+SINT32 Zx234290_SetVbuck1(T_ZDrvZx234290_VbuckA vol);
+T_ZDrvZx234290_VbuckA Zx234290_GetVbuck1(VOID);
+SINT32 Zx234290_SetBUCK1SleepMode(T_ZDrvZx234290_BUCK1_SLPMODE status);
+T_ZDrvZx234290_BUCK1_SLPMODE Zx234290_GetBUCK1SleepMode(VOID);
+SINT32 Zx234290_SetVbuck1SLPV(T_ZDrvZx234290_VbuckA vol);
+
+SINT32 Zx234290_SetVbuck2Onoff(T_ZDrvZx234290_LDO_ENABLE status);
+T_ZDrvZx234290_LDO_ENABLE Zx234290_GetVbuck2Onoff(VOID);
+SINT32 Zx234290_SetVbuck2(T_ZDrvZx234290_VbuckC vol);
+T_ZDrvZx234290_VbuckC Zx234290_GetVbuck2(VOID);
+SINT32 Zx234290_SetBUCK2SleepMode(T_ZDrvZx234290_BUCK234_SLPMODE status);
+T_ZDrvZx234290_BUCK234_SLPMODE Zx234290_GetBUCK2SleepMode(VOID);
+
+SINT32 Zx234290_SetVbuck3Onoff(T_ZDrvZx234290_LDO_ENABLE status);
+T_ZDrvZx234290_LDO_ENABLE Zx234290_GetVbuck3Onoff(VOID);
+SINT32 Zx234290_SetVbuck3ActiveMode(T_ZDrvZx234290_BUCK_NRMMODE status);
+SINT32 Zx234290_SetBUCK3SleepMode(T_ZDrvZx234290_BUCK234_SLPMODE status);
+T_ZDrvZx234290_BUCK234_SLPMODE Zx234290_GetBUCK3SleepMode(VOID);
+
+SINT32 Zx234290_SetVbuck4Onoff(T_ZDrvZx234290_LDO_ENABLE status);
+T_ZDrvZx234290_LDO_ENABLE Zx234290_GetVbuck4Onoff(VOID);
+SINT32 Zx234290_SetVbuck4ActiveMode(T_ZDrvZx234290_BUCK_NRMMODE status);
+SINT32 Zx234290_SetBUCK4SleepMode(T_ZDrvZx234290_BUCK234_SLPMODE status);
+T_ZDrvZx234290_BUCK234_SLPMODE Zx234290_GetBUCK4SleepMode(VOID);
+
+SINT32 Zx234290_SetVldo1Onoff(T_ZDrvZx234290_LDO_ENABLE status);
+T_ZDrvZx234290_LDO_ENABLE Zx234290_GetVldo1Onoff(VOID);
+SINT32 Zx234290_SetVldo1(T_ZDrvZx234290_VldoA vol);
+T_ZDrvZx234290_VldoA Zx234290_GetVldo1(VOID);
+SINT32 Zx234290_SetLDO1SleepMode(T_ZDrvZx234290_LDOA_SLPMODE status);
+T_ZDrvZx234290_LDOA_SLPMODE Zx234290_GetLDO1SleepMode(VOID);
+
+SINT32 Zx234290_SetVldo2Onoff(T_ZDrvZx234290_LDO_ENABLE status);
+T_ZDrvZx234290_LDO_ENABLE Zx234290_GetVldo2Onoff(VOID);
+SINT32 Zx234290_SetVldo2(T_ZDrvZx234290_VldoC vol);
+T_ZDrvZx234290_VldoC Zx234290_GetVldo2(VOID);
+SINT32 Zx234290_SetLDO2SleepMode(T_ZDrvZx234290_LDOA_SLPMODE status);
+T_ZDrvZx234290_LDOA_SLPMODE Zx234290_GetLDO2SleepMode(VOID);
+
+SINT32 Zx234290_SetVldo3Onoff(T_ZDrvZx234290_LDO_ENABLE status);
+T_ZDrvZx234290_LDO_ENABLE Zx234290_GetVldo3Onoff(VOID);
+SINT32 Zx234290_SetVldo3(T_ZDrvZx234290_VldoC vol);
+T_ZDrvZx234290_VldoC Zx234290_GetVldo3(VOID);
+SINT32 Zx234290_SetLDO3SleepMode(T_ZDrvZx234290_LDOA_SLPMODE status);
+T_ZDrvZx234290_LDOA_SLPMODE Zx234290_GetLDO3SleepMode(VOID);
+
+SINT32 Zx234290_SetVldo4Onoff(T_ZDrvZx234290_LDO_ENABLE status);
+T_ZDrvZx234290_LDO_ENABLE Zx234290_GetVldo4Onoff(VOID);
+SINT32 Zx234290_SetVldo4(T_ZDrvZx234290_VldoD vol);
+T_ZDrvZx234290_VldoD Zx234290_GetVldo4(VOID);
+SINT32 Zx234290_SetLDO4SleepMode(T_ZDrvZx234290_LDOB_SLPMODE status);
+T_ZDrvZx234290_LDOB_SLPMODE Zx234290_GetLDO4SleepMode(VOID);
+SINT32 Zx234290_SetLDO4SleepMode_PSM(T_ZDrvZx234290_LDOB_SLPMODE status);
+
+SINT32 Zx234290_SetVldo5Onoff(T_ZDrvZx234290_LDO_ENABLE status);
+T_ZDrvZx234290_LDO_ENABLE Zx234290_GetVldo5Onoff(VOID);
+SINT32 Zx234290_SetVldo5(T_ZDrvZx234290_VldoB vol);
+T_ZDrvZx234290_VldoB Zx234290_GetVldo5(VOID);
+extern SINT32 Zx234290_SetLDO5SleepMode(T_ZDrvZx234290_LDOB_SLPMODE status);
+extern T_ZDrvZx234290_LDOB_SLPMODE Zx234290_GetLDO5SleepMode(VOID);
+
+SINT32 Zx234290_SetVldo6Onoff(T_ZDrvZx234290_LDO_ENABLE status);
+T_ZDrvZx234290_LDO_ENABLE Zx234290_GetVldo6Onoff(VOID);
+SINT32 Zx234290_SetVldo6(T_ZDrvZx234290_VldoD vol);
+T_ZDrvZx234290_VldoD Zx234290_GetVldo6(VOID);
+SINT32 Zx234290_SetLDO6SleepMode(T_ZDrvZx234290_LDOB_SLPMODE status);
+T_ZDrvZx234290_LDOB_SLPMODE Zx234290_GetLDO6SleepMode(VOID);
+
+SINT32 Zx234290_SetVldo7Onoff(T_ZDrvZx234290_LDO_ENABLE status);
+T_ZDrvZx234290_LDO_ENABLE Zx234290_GetVldo7Onoff(VOID);
+SINT32 Zx234290_SetVldo7(T_ZDrvZx234290_VldoD vol);
+T_ZDrvZx234290_VldoD Zx234290_GetVldo7(VOID);
+SINT32 Zx234290_SetLDO7SleepMode(T_ZDrvZx234290_LDOA_SLPMODE status);
+T_ZDrvZx234290_LDOA_SLPMODE Zx234290_GetLDO7SleepMode(VOID);
+
+SINT32 Zx234290_SetVldo8Onoff(T_ZDrvZx234290_LDO_ENABLE status);
+T_ZDrvZx234290_LDO_ENABLE Zx234290_GetVldo8Onoff(VOID);
+SINT32 Zx234290_SetVldo8(T_ZDrvZx234290_VldoD vol);
+T_ZDrvZx234290_VldoD Zx234290_GetVldo8(VOID);
+SINT32 Zx234290_SetLDO8SleepMode(T_ZDrvZx234290_LDOA_SLPMODE status);
+T_ZDrvZx234290_LDOA_SLPMODE Zx234290_GetLDO8SleepMode(VOID);
+
+SINT32 Zx234290_SetVldo9Onoff(T_ZDrvZx234290_LDO_ENABLE status);
+T_ZDrvZx234290_LDO_ENABLE Zx234290_GetVldo9Onoff(VOID);
+SINT32 Zx234290_SetVldo9(T_ZDrvZx234290_VldoA vol);
+T_ZDrvZx234290_VldoA Zx234290_GetVldo9(VOID);
+SINT32 Zx234290_SetLDO9SleepMode(T_ZDrvZx234290_LDOA_SLPMODE status);
+T_ZDrvZx234290_LDOA_SLPMODE Zx234290_GetLDO9SleepMode(VOID);
+
+SINT32 Zx234290_SetVldo10Onoff(T_ZDrvZx234290_LDO_ENABLE status);
+T_ZDrvZx234290_LDO_ENABLE Zx234290_GetVldo10Onoff(VOID);
+SINT32 Zx234290_SetVldo10(T_ZDrvZx234290_VldoA vol);
+T_ZDrvZx234290_VldoA Zx234290_GetVldo10(VOID);
+extern SINT32 Zx234290_SetLDO10SleepMode(T_ZDrvZx234290_LDOA_SLPMODE status);
+extern T_ZDrvZx234290_LDOA_SLPMODE Zx234290_GetLDO10SleepMode(VOID);
+
+SINT32 Zx234290_SetVortc(T_ZDrvZx234290_VldoE vol);
+T_ZDrvZx234290_VldoE Zx234290_GetVortc(VOID);
+
+SINT32 Zx234290_SetVldo1Onoff_Psm(T_ZDrvZx234290_LDO_ENABLE status);
+SINT32 Zx234290_SetVldo5Onoff_Psm(T_ZDrvZx234290_LDO_ENABLE status);
+SINT32 Zx234290_SetLDO1SleepMode_Psm(T_ZDrvZx234290_LDOA_SLPMODE status);
+SINT32 Zx234290_SetLDO5SleepMode_Psm(T_ZDrvZx234290_LDOB_SLPMODE status);
+int Zx234290_SetResetFalg(T_ZDrvZx234290_ResetType rsttype);
+int Zx234290_SetResetFlag_Psm(T_ZDrvZx234290_ResetType rsttype);
+SINT32 zDrvZx234290_LdoRstErr(VOID);
+SINT32 Zx234290_getPoweronStatus(void);
+SINT32 Zx234290_getPoweronStatus_PSM(void);
+SINT32 Zx234290_setSoftOn(bool SoftOn);
+SINT32 Zx234290_setSoftOn_PSM(bool SoftOn);
+#endif
+
+#endif /*_DRVS_PMIC_REGULATOR_H*/
+
diff --git a/cp/ps/driver/inc/misc/drvs_pmic_rtc.h b/cp/ps/driver/inc/misc/drvs_pmic_rtc.h
new file mode 100644
index 0000000..65f620b
--- /dev/null
+++ b/cp/ps/driver/inc/misc/drvs_pmic_rtc.h
@@ -0,0 +1,203 @@
+/*******************************************************************************
+ * Copyright (C) 2010, ZTE Corporation.
+ *
+ * File Name: drvs_pmic_rtc.h
+ * File Mark:
+ * Description:
+ * Others:
+ * Version: V1.0
+ * Author: yuxiang
+ * Date: 2016-01-27
+ * History 1:
+ * Date:
+ * Version:
+ * Author:
+ * Modification:
+ * History 2:
+ ********************************************************************************/
+
+#ifndef _DRVS_PMIC_RTC_H
+#define _DRVS_PMIC_RTC_H
+
+/****************************************************************************
+* Include files
+****************************************************************************/
+#include "drvs_io_rtc.h"
+
+/****************************************************************************
+* Macros
+****************************************************************************/
+#if defined(_USE_PMIC_ZX234290)
+
+#define ZX234290_RTC_ALARM_INT_EN_LSH (1)
+#define ZX234290_RTC_ALARM_INT_EN_WID (1)
+
+#define ZX234290_RTC_TIMER_INT_EN_LSH (0)
+#define ZX234290_RTC_TIMER_INT_EN_WID (1)
+
+
+ /*RTC TIME SECONDS MIN HOU DAY MON YEAR WEEKDAY*/
+#define ZX234290_RTC_TIME_SECONDS_LSH (0)
+#define ZX234290_RTC_TIME_SECONDS_WID (7)
+
+#define ZX234290_RTC_TIME_MINUTES_LSH (0)
+#define ZX234290_RTC_TIME_MINUTES_WID (7)
+
+#define ZX234290_RTC_TIME_HOURS_LSH (0)
+#define ZX234290_RTC_TIME_HOURS_WID (6)
+
+#define ZX234290_RTC_TIME_DAYS_LSH (0)
+#define ZX234290_RTC_TIME_DAYS_WID (6)
+
+#define ZX234290_RTC_TIME_MONTHS_LSH (0)
+#define ZX234290_RTC_TIME_MONTHS_WID (5)
+#define ZX234290_RTC_TIME_CENTURY_LSH (7)
+#define ZX234290_RTC_TIME_CENTURY_WID (1)
+
+#define ZX234290_RTC_TIME_YEAR_LSH (0)
+#define ZX234290_RTC_TIME_YEAR_WID (7)
+
+#define ZX234290_RTC_TIME_WEEKDAY_LSH (0)
+#define ZX234290_RTC_TIME_WEEKDAY_WID (3)
+
+ /*RTC ALARM MIN HOU DAY WEEKDAY*/
+#define ZX234290_RTC_AlARM_MINUTES_LSH (0)
+#define ZX234290_RTC_AlARM_MINUTES_WID (7)
+
+#define ZX234290_RTC_AlARM_HOURS_LSH (0)
+#define ZX234290_RTC_AlARM_HOURS_WID (6)
+
+#define ZX234290_RTC_AlARM_DAYS_LSH (0)
+#define ZX234290_RTC_AlARM_DAYS_WID (6)
+
+#define ZX234290_RTC_AlARM_WEEKDAY_LSH (0)
+#define ZX234290_RTC_AlARM_WEEKDAY_WID (3)
+
+#define ZX234290_RTC_AlARM_SECOND_LSH (0)
+#define ZX234290_RTC_AlARM_SECOND_WID (7)
+ /*RTC ALARM Enable*/
+#define ZX234290_RTC_AlARM_ACTIVATED_LSH (7)
+#define ZX234290_RTC_AlARM_ACTIVATED_WID (1)
+
+ /* RTC TIMER ENABLE */
+#define ZX234290_RTC_TIMER_EN_LSH (7)
+#define ZX234290_RTC_TIMER_EN_WID (1)
+
+#define ZX234290_RTC_TIMER_TD_LSH (0)
+#define ZX234290_RTC_TIMER_TD_WID (2)
+
+#define ZX234290_RTC_TIMER_CNT_LSH (0)
+#define ZX234290_RTC_TIMER_CNT_WID (8)
+
+ /*RTC MASK IRQ */
+#define ZX234290_RTC_MASK_ALARM_LSH (0)
+#define ZX234290_RTC_MASK_ALARM_WID (1)
+
+#define ZX234290_RTC_MASK_HOUR_LSH (4)
+#define ZX234290_RTC_MASK_HOUR_WID (1)
+
+#define ZX234290_RTC_MASK_MIN_LSH (3)
+#define ZX234290_RTC_MASK_MIN_WID (1)
+ /*AF/TF alarm flag/timer flag*/
+#define ZX234290_RTC_AF_LSH (3)
+#define ZX234290_RTC_AF_WID (1)
+
+#define ZX234290_RTC_TF_LSH (2)
+#define ZX234290_RTC_TF_WID (1)
+
+#define ZX234290_BCD2DEC(var) ((((var&0xF0)>>4)*10)+(var&0x0F))
+#define ZX234290_DEC2BCD(var) (((var/10)<<4)+(var%10))
+
+
+typedef enum _T_ZDrvZx234290_TimerCount
+{
+ TIMER_COUNT_4096 = 0,
+ TIMER_COUNT_64 = 1, /* 64 DEFAULT */
+ TIMER_COUNT_1 = 2, /* 1 */
+ TIMER_COUNT_1_60 = 3, /* 1/60 */
+
+ TIMER_COUNT_MAX
+}T_ZDrvZx234290_TimerCount;
+
+
+/**************************************************************************
+ * Types *
+ **************************************************************************/
+
+typedef struct
+{
+ UINT8 mday; /* day of the month - [1,31] */
+ UINT8 mon; /* months - [01,12] */
+ UINT8 wday; /*days in a week - [1,7] NULL when input*/
+ UINT16 year; /* years - [0000,9999] */
+}T_ZDrvRtc_Date;
+
+typedef struct
+{
+ BOOL PM_flag; /* if 12 hour flag = TRUE TRUE->PM ; FALSE->AM */
+ BOOL mode_12_hour; /* TRUE->12 hour mode ; FALSE-> 24 hour mode */ /*20080227*/
+ UINT8 sec; /* seconds after the minute - [0,59] */
+ UINT8 min; /* minutes after the hour - [0,59] */
+ UINT8 hour; /* hours after the midnight - [0,23] */
+}T_ZDrvRtc_Time;
+
+typedef enum
+{
+ MON = 1,
+ TUES,
+ WED,
+ THURS,
+ FRI,
+ SAT,
+ SUN,
+
+ MAX_RTC_WEEKDAY
+} T_ZDrvRtc_WeekDay;
+
+typedef enum _T_ZDrvRtc_TimerUnit
+{
+ RTC_TIMER_COUNT_4096 = 0, /* 1/4096 s*/
+ RTC_TIMER_COUNT_64 = 1, /* 64 DEFAULT ,1/64 s*/
+ RTC_TIMER_COUNT_1 = 2, /* 1 ,s*/
+ RTC_TIMER_COUNT_1_60 = 3, /* 1/60 ,min*/
+
+ RTC_TIMER_COUNT_MAX
+}T_ZDrvRtc_TimerUnit;
+
+typedef struct _T_ZDrvRtc_Timer
+{
+ UINT8 iCount;
+ T_ZDrvRtc_TimerUnit unit;
+}T_ZDrvRtc_Timer;
+
+
+/*for appstart.c*/
+
+typedef enum
+{
+ RTC_12_HOUR_MODE,
+ RTC_24_HOUR_MODE,
+
+ MAX_RTC_HOUR_MODE
+} T_ZDrvRtc_HourMode;
+
+#endif
+
+/****************************************************************************
+* Types
+****************************************************************************/
+
+/****************************************************************************
+* Constants
+****************************************************************************/
+
+/****************************************************************************
+* Global Variables
+****************************************************************************/
+
+/****************************************************************************
+* Function Prototypes
+****************************************************************************/
+
+#endif/*_DRVS_PMIC_RTC_H*/
+
diff --git a/cp/ps/driver/inc/misc/drvs_pmmanager.h b/cp/ps/driver/inc/misc/drvs_pmmanager.h
new file mode 100644
index 0000000..9b7e410
--- /dev/null
+++ b/cp/ps/driver/inc/misc/drvs_pmmanager.h
@@ -0,0 +1,71 @@
+/*********************************************************************
+ Copyright 2007 by ZTE Corporation.
+ *
+ * FileName:: hal_pmmanager.c
+ * File Mark:
+* Description: This file contains the hardware interface for rtc driver
+* Others:
+* Version: v0.5
+* Author: zhangyingjun
+* Date: 2009-02-23
+
+* History 1:
+* Date:
+* Version:
+* Author:
+* Modification:
+* History 2:
+**********************************************************************/
+
+/**************************************************************************
+ * Include files *
+ **************************************************************************/
+
+#ifndef _HAL_POWERON_DEF_H
+#define _HAL_POWERON_DEF_H
+
+#define OS_FLASH_KPD_POWERON_FLAG 0x163FFFFC
+#define OS_FLASH_ALARM_POWERON_FLAG 0x163FFFFD
+#define OS_FLASH_CHARGER_POWERON_FLAG 0x163FFFFE
+#define OS_FLASH_SOFTRESET_FLAG 0x163FFFFF /*use check softreset power on */
+
+#define DPRAM_TRACE_LOADING_FLAG 0x40000000 + 0x1400
+#define TRACE_LOADING_FLAG_VALUE 0xAABB
+
+#define SOFTRESET_POWRON_FLAG_VALUE 0xAA
+#define KPD_POWER_FLAG_VALUE 0xBB
+#define ALARM_POWER_FLAG_VALUE 0xCC
+#define CHARGER_POWER_FLAG_VALUE 0xDD
+typedef enum
+{
+ POWER_ON_STATE_NORMAL = 0,
+ POWER_ON_STATE_CLOCK = 1,
+ POWER_ON_STATE_CHARGING = 2,
+ POWER_ON_STATE_SOFTRESET = 3,
+ POWER_ON_STATE_INVALID = 4,
+ POWER_ON_STATE_INIT = 5
+}T_POWER_ON_State;
+
+typedef enum
+{
+ POWER_ON_EVENT_NORMAL = 0,
+ POWER_ON_EVENT_CLOCK = 1,
+ POWER_ON_EVENT_CHARGING = 2,
+ POWER_ON_EVENT_SOFTRESET =3,
+ POWER_ON_EVENT_INVALID = 4,
+ POWER_ON_EVENT_INIT = 5
+}T_POWER_ON_EVENT;
+
+typedef struct
+{
+ T_POWER_ON_State normal_Power_on_CurrentState;
+ T_POWER_ON_State rtc_Power_on_CurrentState;
+ T_POWER_ON_State charger_Power_on_CurrentState;
+ T_POWER_ON_State softreset_Power_on_CurrentState;
+}
+T_POWER_ON_CURRENT_STATE;
+
+SINT32 zDrvPmmanager_Initiate(VOID);
+//T_POWER_ON_CURRENT_STATE hal_sysm_power_on_state_get(VOID);
+
+#endif
diff --git a/cp/ps/driver/inc/misc/drvs_pow.h b/cp/ps/driver/inc/misc/drvs_pow.h
new file mode 100644
index 0000000..0263efd
--- /dev/null
+++ b/cp/ps/driver/inc/misc/drvs_pow.h
@@ -0,0 +1,458 @@
+/*******************************************************************************
+ * Copyright (C) 2007, ZTE Corporation.
+ *
+ * File Name: drvs_pow.h
+ * File Mark:
+ * Description:
+ * Others:
+ * Version: 1.3.0
+ * Author: wangxia
+ * Date: 2009-6-10
+ * History 1:
+ * Date:
+ * Version:
+ * Author:
+ * Modification:
+ * History 2:
+ ********************************************************************************/
+
+#ifndef _DRVS_POW_H
+#define _DRVS_POW_H
+
+/****************************************************************************
+* Include files
+****************************************************************************/
+
+/****************************************************************************
+* macro define
+****************************************************************************/
+//#define _USE_PSM
+//#define _USE_PSM_DEBUG
+
+#ifdef _OS_LINUX
+#define PSM_CPU_CP 0
+#else
+#define PSM_CPU_CP 1
+#endif
+
+#ifdef _CPU_DFS_ON
+#define PSM_CPU_DFS 1
+#else
+#define PSM_CPU_DFS 0
+#endif
+
+#ifdef _AXI_DFS_ON
+#define PSM_AXI_DFS 1
+#else
+#define PSM_AXI_DFS 0
+#endif
+
+#ifdef _AXI_DFS_ON_HW
+#define PSM_AXI_DFS_HW 1 //axi change by hw
+#else
+#define PSM_AXI_DFS_HW 0
+#endif
+
+#ifdef _DDR_DFS_ON
+#define PSM_DDR_DFS 1
+ #if PSM_DDR_DFS
+ #define PSM_DDR_DFS_HW 1 //ddr change by hw
+ #endif
+#else
+#define PSM_DDR_DFS 0
+#define PSM_DDR_DFS_HW 0
+#endif
+
+#ifdef _VCORE_DVS_ON
+#define PSM_VCORE_DVS 1
+#else
+#define PSM_VCORE_DVS 0
+#endif
+
+
+#define POW_IDLE_TIMEOUT_MS (1)
+#define POW_IDLE_TIMEOUT_TCPIP (5*1000*POW_IDLE_TIMEOUT_MS)
+
+#define ICP2M0_PSM_AT_CMD_VALID 0x49435001
+#define ICP2M0_PSM_AXI_DFS 0x49435002
+
+/****************************************************************************
+* Global Variables
+****************************************************************************/
+
+
+/****************************************************************************
+* Types
+****************************************************************************/
+typedef enum
+{
+/*PS wake int dis reg1 begin*/
+ PS_RM_INT_DIS=1,
+ UART0_RXD_INT_DIS=2,
+ SD0_DATA1_INT_DIS=3,
+ PS_TIMER1_INT_DIS,
+ PS_TIMER2_INT_DIS,
+ ICP_AP2PS_INT_DIS,
+ USB2_POWERDWN_UP_INT_DIS,
+ USB2_POWERDWN_DOWN_INT_DIS,
+ HSIC_POWERDWN_UP_INT_DIS,
+ HSIC_POWERDWN_DOWN_INT_DIS,
+ ICP_PHY2PS_INT_DIS,
+ ICP_M02PS_INT_DIS,
+ RM_RTC_ALARM_INT_DIS,
+ RM_RTC_TIMER_INT_DIS,
+ RM_KEYPAD_INT_DIS,
+ SD1_DATA1_INT_DIS,
+ UART0_CTS_INT_DIS,
+ SPCU_PW_INT_DIS,
+ GSM_LPM_INT_DIS,
+ TD_LPM_TIMER_IND3_DIS=24,
+ TD_LPM_TIMER_IND4_DIS,
+ LTE_LPM_TIMER_IND2_DIS,
+ LTE_LPM_TIMER_IND4_DIS,
+ LTE_LPM_TIMER_IND5_DIS,
+ WD_LPM_TIMER_IND3_DIS,
+ WD_LPM_TIMER_IND4_DIS,
+ FRM_INT_ARM_32K_DIS=31,
+/*PS wake int dis reg1 end*/
+/*PS wake int dis reg2 begin*/
+ EXTERNAL_INT0_DIS=34,
+ EXTERNAL_INT1_DIS,
+ EXTERNAL_INT2_DIS,
+ EXTERNAL_INT3_DIS,
+ EXTERNAL_INT4_DIS,
+ EXTERNAL_INT5_DIS,
+ EXTERNAL_INT6_DIS,
+ EXTERNAL_INT7_DIS,
+ EXTERNAL_8IN1_INT0_DIS,
+ EXTERNAL_8IN1_INT1_DIS,
+ EXTERNAL_8IN1_INT2_DIS,
+ EXTERNAL_8IN1_INT3_DIS,
+ EXTERNAL_8IN1_INT4_DIS,
+ EXTERNAL_8IN1_INT5_DIS,
+ EXTERNAL_8IN1_INT6_DIS,
+ EXTERNAL_8IN1_INT7_DIS=49,
+
+ INVALID_WAKE_DIS_BIT
+/*PS wake int dis reg2 end*/
+}T_ZDrvPow_PsIntWakeDis;
+
+typedef enum
+{
+ PS_WAKE_INT,
+ PS_DIS_WAKE_INT,
+
+ INVALID_PS_WAKE_EN
+}T_ZDrvPow_PsWakeIntDis;
+
+
+typedef enum
+{
+ IDLE_FLAG_UICC =0,
+ IDLE_FLAG_USBENUM =1,
+ IDLE_FLAG_VOICE =2,
+ IDLE_FLAG_I2S=3,
+ IDLE_FLAG_AP2CP=4,
+ IDLE_FLAG_SLEEP=5,
+ IDLE_FLAG_WIFI=6,
+ IDLE_FLAG_KPD=7,
+ IDLE_FLAG_TCPIP=8,
+ IDLE_FLAG_NAND=9,
+ IDLE_FLAG_CHARGER=10,
+ IDLE_FLAG_LCD=11,
+ IDLE_FLAG_LED=12,
+ IDLE_FLAG_WIFI_IOCTRL=13,
+ IDLE_FLAG_WIFI_XMIT=14,
+ IDLE_FLAG_LAN=15,
+ IDLE_FLAG_HOSTENUM=16,
+ IDLE_FLAG_BLG=17,
+ IDLE_FLAG_UART=18,
+ IDLE_FLAG_TD_ICP=19,/*·ÀֹʹÄÜ×ÓÖ¡ÖжÏÓë×ÓÖ¡Öжϵ½À´ÆÚ¼ä½øÈëÐÝÃß*/
+ IDLE_FLAG_W_ICP=20,
+ IDLE_FLAG_LTE_ICP=21,
+ IDLE_FLAG_CAMERA=22,
+ IDLE_FLAG_SD=23,
+ IDLE_FLAG_PMIC=24,
+ IDLE_FLAG_I2C=25,
+ IDLE_FLAG_VSIM = 26,
+ IDLE_FLAG_EDCP=27,
+ IDLE_FLAG_TDM,
+ IDLE_FLAG_MAX
+
+}T_ZDrvPow_IdleFlag;
+
+/*plat begin*/
+typedef enum
+{
+ TD_PHY =0,
+ WD_PHY =1,
+ LTE_PHY =2,
+ PHY_ID_MAX
+
+}T_ZDrvPow_PhyId;
+
+typedef enum
+{
+ POW_BOOT_DEFAULT, /* Æô¶¯³õʼֵ */
+ POW_SYSINIT_FINISH, /* ϵͳ³õʼ»¯Íê³É,ÈçÐͺŻúÍê³ÉSysEntry */
+ POW_BOOT_FINISH /* ¿ª»úÍê³É£¬ÈçÐͺŻú³öÏÖ´ý»ú½çÃæ */
+}T_ZDrvPow_BootStage; /* Æô¶¯½×¶Î */
+/*plat begin*/
+
+/*sleep begin*/
+typedef struct _T_ZDrvPow_Opt
+{
+ VOID (*pow_RefBeforeSleep)(VOID);
+ VOID (*pow_RefAfterSleep)(VOID);
+}T_ZDrvPow_Opt;
+
+typedef enum
+{
+ KERNEL_SLEEP_MODE,
+ BOOT_SLEEP_MODE,
+ LOSSCOVERAGE_SLEEP_MODE,
+ AIRPLANE_SLEEP_MODE,
+ DEEP_SLEEP_MODE,
+ MAX_SLEEP_MODE
+}T_ZDrvPow_SleepMode;
+
+typedef enum
+{
+ FPI_CLK_32K = 0,
+ FPI_CLK_52M = 1,
+ FPI_INVALID_CLK
+}T_ZDrvPow_FpiClk;
+
+typedef enum
+{
+ ARM_PS_WAKE = 0,
+ ARM_PS_SLEEP = 1,
+ ARM_PS_INVALID_FLAG
+}T_ZDrvPow_PsSleepFlag;
+
+ /*sleep end*/
+
+ /*freq begin*/
+typedef enum
+{
+#if defined (_CHIP_ZX297520V2)
+ MAIN_CLK=0,
+ AON_MPLL_624M,
+ AON_DPLL_491M52,
+ MATRIX_MPLL_312M,
+ AON_MPLL_208M,
+ MATRIX_MPLL_104M,
+ MATRIX_MPLL_78M,
+ MATRIX_MPLL_52M=7,
+#else
+ MAIN_CLK=0,
+ AON_MPLL_624M,
+ MATRIX_MPLL_312M,
+ MATRIX_MPLL_156M,
+#endif
+ CORE_INVALID_FREQ
+}T_ZDrvPow_CoreFreq;
+
+typedef enum
+{
+#if defined (_CHIP_ZX297520V2)
+ AXI_26M,
+ AXI_39M,
+ AXI_52M,
+ AXI_78M,
+ AXI_104M,
+ AXI_122M88,
+ AXI_156M,
+#else
+ AXI_6M5=0,
+ AXI_26M,
+ AXI_39M,
+ AXI_52M,
+ AXI_78M,
+ AXI_104M,
+ AXI_124M8,
+ AXI_156M=7,
+#endif
+
+ AXI_INVALID_FREQ
+}T_ZDrvPow_AxiFreq;
+typedef enum
+{
+ VCORE_0V800,
+ VCORE_0V825,
+ VCORE_0V850,
+ VCORE_0V875,
+ VCORE_0V900,
+ VCORE_INVALID_VOL
+}T_ZDrvPow_Vcore;
+
+typedef enum
+{
+ CLK26M=26000000,
+ CLK624M=624000000,
+#if defined (_CHIP_ZX297520V2)
+#else
+ CLK156M=156000000,
+#endif
+ CLK312M=312000000,
+ CLK208M=208000000,
+ CLK78M=78000000,
+
+ CLK_INVALID_FREQ
+}T_ZDrvPow_PsFreqConst;
+
+#define DOWN_CPUFREQ CLK156M
+#define UP_CPUFREQ CLK312M
+#define PULL_CPUFREQ CLK624M
+#if PSM_DDR_DFS_HW
+ typedef enum
+ {
+ DDR_156M = 0, //ÐèÒªÖØÐ¿¼ÂÇÆµÂʵµ£¬×îÖÕÆµÂÊÇëÇóΪ¸÷ºËÇëÇóµþ¼ÓºÍ
+ DDR_208M = 0x4f,
+ DDR_312M = 0x9d,
+ DDR_400M = 0xc8,
+ DDR_CLKEND
+ }T_zDrvPow_DDRCLK;
+#else
+typedef enum
+{
+#if defined (_CHIP_ZX297520V2)
+ DDR_13M = 0,
+ DDR_52M = 1,
+ DDR_100M = 2,
+ DDR_104M = 3,
+ DDR_156M = 4,
+ DDR_208M = 5,
+ DDR_312M = 6,
+ DDR_400M = 7,
+ DDR_416M = 8,
+
+#else
+ DDR_156M ,
+ DDR_208M ,
+ DDR_312M ,
+ DDR_400M ,
+#endif
+ DDR_CLKEND
+}T_zDrvPow_DDRCLK;
+#endif
+
+ /*freq end*/
+
+/*gate begin*/
+typedef enum
+{
+ /*ps power domain*/
+ GSM_RAM_PWR = 0,
+ GSM_DSP_PWR = 1,
+ EDCP_PWR = 4,
+ /*3/4bits reserved*/
+ USB_CTRL_PWR = 8,
+ USB_HSIC_PWR = 9,
+
+ PS_ALL_PWR = 10,
+
+ MAX_PWR = 11
+
+}T_ZDrvPow_PwrId;
+
+typedef enum
+{
+ POW_ENABLE = 0,
+ POW_DISABLE = 1,
+
+ POW_ENABLE_ALL
+}T_ZDrvPow_PwrEn;
+/*gate end*/
+
+#ifdef _USE_WAKELOCK
+/*wakelock begin*/
+typedef struct _T_ZDrvWakeLock_Entry
+{
+ struct list_head node; /* node*/
+ char name[32];
+ BOOL active:1;
+ UINT32 active_count;
+ UINT32 relax_count;
+}T_ZDrvWakeLock_Entry;
+
+typedef struct _T_zDrvWakeLock_TAB
+{
+ struct list_head devList;
+ ZOSS_SEMAPHORE_ID opMutex;
+ UINT32 devListCount;
+}T_zDrvWakeLock_TAB;
+
+typedef void * T_ZDrvWakeLock_Handle;
+/*wakelock end*/
+#endif
+
+/****************************************************************************
+* function
+****************************************************************************/
+#ifdef _USE_WAKELOCK
+/*wakelock begin*/
+T_ZDrvWakeLock_Handle zDrvWakeLock_Register(const char *name);
+VOID zDrvWakeLock_Lock(T_ZDrvWakeLock_Handle handle);
+VOID zDrvWakeLock_Unlock(T_ZDrvWakeLock_Handle handle);
+BOOL zDrvWakeLock_DevStatue(VOID);
+/*wakelock end*/
+#endif
+
+typedef VOID (*psm_uartWakeExtApHook)(VOID); /*uart wake ext ap hook */
+typedef VOID (*psm_usbWakeExtApHook)(VOID); /*usb wake ext ap hook */
+
+typedef SINT32 (*pm_callback_fn)(void);
+
+extern SINT32 zx_pm_register_callback(pm_callback_fn enter_cb, pm_callback_fn exit_cb);
+
+VOID zDrvPow_SetWakeExtApHookOpt(psm_uartWakeExtApHook uartWakeExtApHook, psm_usbWakeExtApHook usbWakeExtApHook);
+
+
+/*plat begin*/
+SINT32 zDrvPow_GetLteSleepFlag(VOID);/*ÐÒéÕ»ÐèÇó£¬Óë7510±£³ÖÒ»ÖÂ*/
+VOID zDrvPow_ClearPhySleepFlag(VOID);
+SINT32 zDrvPow_GetPhySleepFlag(T_ZDrvPow_PhyId phyId);
+BOOL zDrvPow_PsmGetCampon(VOID);
+VOID zDrvPow_SetBootStage(T_ZDrvPow_BootStage stage);
+BOOL zDrvPow_PsmIdleFlag(VOID);
+VOID zDrvPow_DpramSendCmdWakePhy(T_ZDrvPow_PhyId phyId);
+VOID zDrvPow_Icp2ZspDebugInfo(T_ZDrvPow_PhyId phyId,SINT32 dwIcp);
+BOOL zDrvPow_UmtsSleep(VOID);
+VOID zDrvPow_ChangeRRCFreForGSM(VOID);
+UINT32 zDrvPow_Sleep_Func(T_ZDrvPow_SleepMode sleep_mode, UINT32 sleep_time);
+SINT32 zDrvPow_SetDevActive(T_ZDrvPow_IdleFlag devId);
+SINT32 zDrvPow_SetDevIdle(T_ZDrvPow_IdleFlag devId);
+UINT32 zDrvPow_PsmIdleFlagGet(VOID);
+UINT32 zDrvPow_PsmDeepSleepCnt(VOID);
+
+/*plat end*/
+
+ /*sleep begin*/
+SINT32 zDrvPow_SetOpt(T_ZDrvPow_Opt* pPowOpt);
+UINT32 zDrvPow_PsmDeepSleep(UINT32 ps_sleep_time);
+UINT32 zDrvPow_ChargerSleep(UINT32 sleep_time);
+VOID zDrvPow_KernelSleep(VOID);
+UINT32 zDrvPow_BootSleep(UINT32 sleep_time);
+VOID zDrvPow_ActiveSleep(UINT32 ms);
+SINT32 zDrvPow_SetPcuWakeInt(T_ZDrvPow_PsIntWakeDis intId,T_ZDrvPow_PsWakeIntDis intDis);
+SINT32 zDrvPow_PSM_Init(VOID);
+VOID zDrvPow_ChargerOnSleepInit(VOID);
+VOID zDrvPow_ChargerOnSleepOperation(VOID);
+ /*sleep end*/
+
+/*freq begin*/
+UINT32 zDrvPow_GetPsCoreFreq(VOID);
+
+SINT32 zDrvPow_SetArmPsCoreFreq(T_ZDrvPow_PsFreqConst workFreq);
+SINT32 zDrvPow_SetPsDdrFreq(T_zDrvPow_DDRCLK freq);
+/*freq end*/
+
+SINT32 zDrvPow_GetTdSfnFlag(VOID);
+VOID zDrvPow_PcuSetWakeSource(UINT32 *wake_source);
+VOID zDrvPow_PsmLed(BOOL onOff);
+/*power partition control*/
+SINT32 zDrvpow_SetPwrGate(T_ZDrvPow_PwrId partId, T_ZDrvPow_PwrEn ena);
+
+#endif/*_DRVS_POW_H*/
+
diff --git a/cp/ps/driver/inc/misc/drvs_pwr.h b/cp/ps/driver/inc/misc/drvs_pwr.h
new file mode 100644
index 0000000..a86e87a
--- /dev/null
+++ b/cp/ps/driver/inc/misc/drvs_pwr.h
@@ -0,0 +1,25 @@
+/*******************************************************************************
+ * Copyright (C) 2007, ZTE Corporation.
+ *
+ * File Name:
+ * File Mark:
+ * Description:
+ * Others:
+ * Version: vx.x.
+ * Author: ZhengHong
+ * Date: 2009-6-29
+ * History 1:
+ * Date:
+ * Version:
+ * Author:
+ * Modification:
+ * History 2:
+ ******************************************************************************/
+
+#ifndef _DRVS_PWR_H_
+#define _DRVS_PWR_H_
+
+#include "drvs_pow.h"
+
+#endif
+
diff --git a/cp/ps/driver/inc/misc/drvs_rf.h b/cp/ps/driver/inc/misc/drvs_rf.h
new file mode 100644
index 0000000..bcfe48b
--- /dev/null
+++ b/cp/ps/driver/inc/misc/drvs_rf.h
@@ -0,0 +1,171 @@
+/*******************************************************************************
+ * Copyright (C) 2007, ZTE Corporation.
+ *
+ * File Name: drvs_rf.h
+ * File Mark:
+ * Description:
+ * Others:
+ * Version: v1.2.1
+ * Author: wangxia
+ * Date: 2009-4-17
+ * History 1:
+ * Date:
+ * Version:
+ * Author:
+ * Modification:
+ * History 2:
+ ********************************************************************************/
+
+#ifndef _DRVS_RF_H
+#define _DRVS_RF_H
+
+
+/****************************************************************************
+* Include files
+****************************************************************************/
+
+
+/****************************************************************************
+* Macros
+****************************************************************************/
+
+
+/****************************************************************************
+* Types
+****************************************************************************/
+typedef struct
+{
+ UINT32 i2s2_wa_sel:1;
+ UINT32 i2s2_clk_sel:1;
+ UINT32 i2s1_wa_sel:1;
+ UINT32 i2s1_clk_sel:1;
+ UINT32 gpio_clkout3_sel:1;
+ UINT32 gpio_clkout2_sel:1;
+ UINT32 gpio_clkout1_sel:1;
+ UINT32 gpio_clkout0_sel:1;
+ UINT32 td_spi_sel:1;
+ UINT32 reserved9_15:7;
+ UINT32 td_time2_ind_en:1;
+ UINT32 td_time1_ind_en:1;
+ UINT32 rc_out1_en:1;
+ UINT32 rc_out0_en:1;
+ UINT32 clkout3_en:1;
+ UINT32 clkout2_en:1;
+ UINT32 clkout0_en:1;
+ UINT32 clkout1_en:1;
+ UINT32 reserved24_31:8;
+}T_ZDrvRf_I2s_ClkOut;
+
+
+typedef struct
+{
+ UINT32 spi_gpio_oen:14;
+ UINT32 reserved14_15:2;
+ UINT32 spi_gpio_in:14;
+ UINT32 reserved30_31:2;
+}T_ZDrvRf_SpiEn;
+
+
+typedef struct
+{
+ UINT32 spi_gpio_out:14;
+ UINT32 reserved14_15:2;
+ UINT32 spi_gpio_sel:14;
+ UINT32 reserved30_31:2;
+}T_ZDrvRf_SpiSel;
+
+
+
+/****************************************************************************
+* Constants
+****************************************************************************/
+
+/****************************************************************************
+* Global Variables
+****************************************************************************/
+
+/****************************************************************************
+* Function Prototypes
+****************************************************************************/
+
+/*******************************************************************************
+ * Function: zDrvRf_GsmSelect
+ * Description: select GSM rf through GPIO
+ * Parameters:
+ * Input:gsmgpio 0~7
+ *
+ * Output:
+ *
+ * Returns:
+ *
+ *
+ * Others:
+ ********************************************************************************/
+SINT32 zDrvRf_GsmSelect(UINT32 gsmgpio);
+
+
+/*******************************************************************************
+ * Function: zDrvRf_TdSelect
+ * Description: select TD rf through GPIO
+ * Parameters:
+ * Input:tdgpio 0~8
+ *
+ * Output:
+ *
+ * Returns:
+ *
+ *
+ * Others:
+ ********************************************************************************/
+SINT32 zDrvRf_TdSelect(UINT32 tdgpio);
+
+/*******************************************************************************
+ * Function: zDrvRf_I2sClkOutSel
+ * Description: select I2S & Clk Out
+ * Parameters:
+ * Input:
+ *
+ * Output:
+ *
+ * Returns:
+ *
+ *
+ * Others:
+ ********************************************************************************/
+VOID zDrvRf_I2sClkOutSel(T_ZDrvRf_I2s_ClkOut i2s_clkout);
+
+/*******************************************************************************
+ * Function: zDrvRf_SpiGpioOen
+ * Description:
+ * Parameters:
+ * Input:
+ *
+ * Output:
+ *
+ * Returns:
+ *
+ *
+ * Others:
+ ********************************************************************************/
+VOID zDrvRf_SpiGpioOen(T_ZDrvRf_SpiEn spioen);
+
+/*******************************************************************************
+ * Function: zDrvRf_SpiGpioSel
+ * Description:
+ * Parameters:
+ * Input:
+ *
+ * Output:
+ *
+ * Returns:
+ *
+ *
+ * Others:
+ ********************************************************************************/
+VOID zDrvRf_SpiGpioSel(T_ZDrvRf_SpiSel spisel);
+
+
+
+
+#endif/*_DRVS_RF_H*/
+
diff --git a/cp/ps/driver/inc/misc/drvs_rpmsg.h b/cp/ps/driver/inc/misc/drvs_rpmsg.h
new file mode 100755
index 0000000..7690bf8
--- /dev/null
+++ b/cp/ps/driver/inc/misc/drvs_rpmsg.h
@@ -0,0 +1,538 @@
+/*******************************************************************************
+ * Copyright by ZTE Corporation.
+ *
+ * File Name:
+ * File Mark:
+ * Description:
+ * Others:
+ * Version: 0.1
+ * Author: zhangdongdong
+ * Date: 2015-10-21
+ * History 1:
+ * Date:
+ * Version:
+ * Author:
+ * Modification:
+ * History 2:
+ ********************************************************************************/
+
+#ifndef _DRVS_RPMSG_H
+#define _DRVS_RPMSG_H
+
+/*******************************************************************************
+* Include files *
+*******************************************************************************/
+#include "ram_config.h"
+
+/*******************************************************************************
+* Macro *
+*******************************************************************************/
+#define RPMSG_WRITE_INT (0x1)
+#define RPMSG_READ_POLL (0x1<<1)
+
+#define CHANNEL_FLAG 0x1
+
+#define M0AP_CHANNEL_MAXID 10
+/*******************************************************************************
+* Types *
+*******************************************************************************/
+
+/*-----------------------[Begin] [used by normal]-----------------------------*/
+/*channels definition*/
+#define DRIVER channel_0
+#define PSM channel_1
+#define USB_ADB channel_2
+
+
+#define WAN1 channel_3
+#define WAN2 channel_4
+#define WAN3 channel_5
+#define WAN4 channel_6
+
+#define DTMF channel_7
+#define DEV_BUFFREE channel_8
+
+#define AMT channel_9
+#define RAMDUMP channel_10
+
+#define VSIM channel_11
+#define ISMS channel_12
+
+#define IPSEC1 channel_13
+#define IPSEC2 channel_14
+#define IPSEC3 channel_15
+#define IPSEC4 channel_16
+
+
+typedef enum _T_ZDrvRpMsg_MsgActor
+{
+#ifdef _OS_TOS
+ ICP_MSG_ACTOR_A9,
+#endif
+ ICP_MSG_ACTOR_ZSP,
+ ICP_RPMSG_ACTOR_M0,
+ MAX_RPMSG_ACTOR
+} T_ZDrvRpMsg_MsgActor;
+
+typedef enum _T_ZDrvRpMsg_ChID
+{
+ CHANNEL_BASEID,
+
+ channel_0 = CHANNEL_BASEID, //driver just for AP<->PS
+ channel_1, //PSM
+ channel_2, //USB_DETCT
+ channel_3, //USB_ADB
+ channel_4, //WAN
+ channel_5, //LAN1
+ channel_6, //LAN2
+ channel_7, //DEV_BUFMALLOC
+ channel_8, //DEV_BUFFREE
+ channel_9, //AT
+ CHANNEL_PS2M0_MAXID,
+
+ channel_10 = CHANNEL_PS2M0_MAXID, //AMT
+ channel_11, //LOG
+ channel_12, //FOTA
+
+ channel_13,
+ channel_14,
+ channel_15,
+ channel_16,
+ channel_17,
+ channel_18,
+ channel_19,
+ channel_20,
+ channel_21,
+ channel_22,
+ channel_23,
+ channel_24,
+ channel_25,
+ channel_26,
+ channel_27,
+ channel_28,
+ channel_29,
+ channel_30,
+ channel_31,
+ channel_32,
+ channel_33,
+ channel_34,
+ channel_35,
+ channel_36,
+ channel_37,
+ channel_38,
+ channel_39,
+ channel_40,
+ channel_41,
+ channel_42,
+ channel_43,
+ channel_44,
+ channel_45,
+ channel_46,
+ channel_47,
+ channel_48,
+ channel_49,
+ channel_50,
+ channel_51,
+ channel_52,
+ channel_53,
+ channel_54,
+ channel_55,
+ channel_56,
+ channel_57,
+ channel_58,
+ channel_59,
+ channel_60,
+ channel_61,
+ channel_62,
+ channel_63,
+
+ PSAP_CHANNEL_MAXID
+}T_ZDrvRpMsg_ChID;
+
+typedef struct _T_ZDrvRpMsg_Msg
+{
+ T_ZDrvRpMsg_MsgActor actorID;
+ T_ZDrvRpMsg_ChID chID;
+ UINT32 flag; /*bit0:is need send icp int 1:y; 0:n*/
+ /*bit1: read mode 1:poll; 0:semaphore*/
+ VOID *buf;
+ UINT32 len;
+} T_ZDrvRpMsg_Msg;
+
+typedef enum _T_ZDrvRpMsg_ErrCode
+{
+ RPMSG_INVALID_PARAMETER = -101, //²ÎÊý²»ÕýÈ·
+ RPMSG_SPACE_NOT_ENOUGH = -102, //¿Õ¼ä²»×ã¹»
+ RPMSG_CHANNEL_ALREADY_EXIST = -103, //ͨµÀÒѾ´æÔÚ
+ RPMSG_CHANNEL_INEXISTANCE = -104, //ͨµÀ²»´æÔÚ
+ RPMSG_CHANNEL_MSG_ERR = -105, //ͨµÀÖÐÏûÏ¢´íÎó
+ RPMSG_CHANNEL_NOMSG = -107, //ͨµÀÖÐûÓÐÏûÏ¢
+}
+T_ZDrvRpMsg_ErrCode;
+
+typedef VOID (*T_ZDrvRpMsg_CallbackFunction)(VOID *buf, UINT32 len);/*for normal*/
+
+/*******************************************************************************
+* Function Prototypes *
+*******************************************************************************/
+
+/*******************************************************************************
+* Function: zDrvRpMsg_CreateChannel
+* Description: This function is used for create channel to send message;
+* Parameters:
+* Input:
+* actorID:remote cpu
+* chID: ID of channel
+* size: size of channel
+* Output:None
+*
+* Returns:
+* DRV_SUCCESS: successfully .
+* DRV_ERROR: fail .
+*
+* Others:
+********************************************************************************/
+SINT32 zDrvRpMsg_CreateChannel (T_ZDrvRpMsg_MsgActor actorID, T_ZDrvRpMsg_ChID chID, UINT32 size);
+
+/*******************************************************************************
+* Function: zDrvRpMsg_RegCallBack
+* Description: This function is used for registing callback functions;
+* Parameters:
+* Input:
+* actor: core id.
+* chID : channel id
+* callback: callback function
+* Output:None
+*
+* Returns:
+* DRV_SUCCESS: successfully .
+* other: fail .
+*
+*
+* Others:
+********************************************************************************/
+SINT32 zDrvRpMsg_RegCallBack(T_ZDrvRpMsg_MsgActor actorID, T_ZDrvRpMsg_ChID chID, T_ZDrvRpMsg_CallbackFunction callback);
+
+/*******************************************************************************
+* Function: zDrvRpMsg_MaskInt
+* Description: This function is used for mask ICP interrupt from another core;
+* Parameters:
+* Input:
+* actor: which core.
+* bit_map: which interrupts will be masked.
+* Output:None
+*
+* Returns:
+* None
+*
+*
+* Others:
+********************************************************************************/
+SINT32 zDrvRpMsg_MaskInt(T_ZDrvRpMsg_MsgActor actorID, T_ZDrvRpMsg_ChID chID);
+
+/*******************************************************************************
+* Function: zDrvRpMsg_UnmaskInt
+* Description: This function is used for unmask ICP interrupt from another core;
+* Parameters:
+* Input:
+* actor: which core.
+* bit_map: which interrupts will be unmasked.
+* Output:None
+*
+* Returns:
+* None
+*
+*
+* Others:
+********************************************************************************/
+SINT32 zDrvRpMsg_UnmaskInt(T_ZDrvRpMsg_MsgActor actorID, T_ZDrvRpMsg_ChID chID);
+
+/*******************************************************************************
+* Function: zDrvRpMsg_Write
+* Description: This function is used for sending message to remote cpu, mutex;
+* Parameters:
+* Input:
+* pMsg: the msg which will be sent
+* Output:None
+*
+* Returns:
+* DRV_SUCCESS: successfully send msg.
+* other: fail to send msg.
+*
+*
+* Others:
+********************************************************************************/
+SINT32 zDrvRpMsg_Write(const T_ZDrvRpMsg_Msg *pMsg);
+
+/*******************************************************************************
+* Function: zDrvRpMsg_WriteWithId
+* Description: This function is used for ps&phy to send msg to remote cpu.
+* Parameters:
+* Input:
+* msgId:msg id that ps will put into the ring buffer
+* pMsg: the msg which will be sent
+* Output:None
+*
+* Returns:
+* DRV_SUCCESS: successfully send msg.
+* other: fail to send msg.
+*
+*
+* Others:
+********************************************************************************/
+SINT32 zDrvRpMsg_WriteWithId(UINT32 msgId, const T_ZDrvRpMsg_Msg *pMsg);
+
+/*******************************************************************************
+* Function: zDrvRpMsg_WriteLockIrq
+* Description: This function is used for sending message to remote cpu, no mutex;
+* Parameters:
+* Input:
+* pMsg: the msg which will be sent
+* Output:None
+*
+* Returns:
+* DRV_SUCCESS: successfully send msg.
+* other: fail to send msg.
+*
+*
+* Others:
+********************************************************************************/
+SINT32 zDrvRpMsg_WriteLockIrq(const T_ZDrvRpMsg_Msg *pMsg);
+
+/*******************************************************************************
+* Function: zDrvRpMsg_Read
+* Description: This function is used for reading message;
+* Parameters:
+* Input:
+* pMsg:message which will be read
+* Output:
+* pMsg
+*
+* Returns:
+* DRV_SUCCESS: successfully .
+* other: fail .
+*
+* Others:
+********************************************************************************/
+SINT32 zDrvRpMsg_Read(const T_ZDrvRpMsg_Msg *pMsg);
+
+/*******************************************************************************
+* Function: zDrvRpMsg_ReadWithId
+* Description: This function is used for ps&phy to read message from remote cpu;
+* Parameters:
+* Input:
+* pMsgId:msg id that ps will get from the ring buffer
+* pMsg:message which will be read
+* Output:
+* pMsg
+*
+* Returns:
+* DRV_SUCCESS: successfully .
+* other: fail .
+*
+* Others:
+********************************************************************************/
+SINT32 zDrvRpMsg_ReadWithId(UINT32 *pMsgId, const T_ZDrvRpMsg_Msg *pMsg);
+
+/*******************************************************************************
+* Function: zDrvRpMsg_ReadWithIdLockIrq
+* Description: This function is used for reading message;
+* Parameters:
+* Input:
+* pMsgId:msg id that ps will get from the ring buffer
+* pMsg:message which will be read
+* Output:
+* pMsg
+*
+* Returns:
+* DRV_SUCCESS: successfully .
+* other: fail .
+*
+* Others:
+********************************************************************************/
+SINT32 zDrvRpMsg_ReadWithIdLockIrq(UINT32 *pMsgId, const T_ZDrvRpMsg_Msg *pMsg);
+
+/*******************************************************************************
+* Function: zDrvRpMsg_ReadLockIrq
+* Description: This function is used for reading message;
+* Parameters:
+* Input:
+* pMsg:message which will be read
+* Output:
+* pMsg
+*
+* Returns:
+* DRV_SUCCESS: successfully .
+* other: fail .
+*
+* Others:
+********************************************************************************/
+SINT32 zDrvRpMsg_ReadLockIrq(const T_ZDrvRpMsg_Msg *pMsg);
+
+/*******************************************************************************
+* Function: zDrvRpMsg_ChIsEmpty
+* Description: This function is used for checking the channel used to receive message is empty or not;
+* Parameters:
+* Input:
+* actorID:remote cpu
+* chID:channel id
+* Output:None
+*
+* Returns:
+* TRUE: channel is empty .
+* FALSE: channel is not empty .
+*
+* Others:
+********************************************************************************/
+BOOL zDrvRpMsg_ChIsEmpty(T_ZDrvRpMsg_MsgActor actorID, T_ZDrvRpMsg_ChID chID);
+
+/*******************************************************************************
+* Function: zDrvRpMsg_WriteChIsEmpty
+* Description: This function is used for checking the channel used to send message is empty or not;
+* Parameters:
+* Input:
+* actorID:remote cpu
+* chID:channel id
+* Output:None
+*
+* Returns:
+* TRUE: channel is empty .
+* FALSE: channel is not empty .
+*
+* Others:
+********************************************************************************/
+BOOL zDrvRpMsg_WriteChIsEmpty(T_ZDrvRpMsg_MsgActor actorID, T_ZDrvRpMsg_ChID chID);
+
+/*******************************************************************************
+* Function: zDrvRpMsg_CreateBlock
+* Description: This function is used for create block channel to send message;
+* Parameters:
+* Input:
+* actorID:remote cpu
+* chID: ID of channel
+* blkSize: size of block, 4 bytes reserve at leaset
+* blkNums: numbers of block
+* memtype: 0:iram 1:ddr
+* Output:None
+*
+* Returns:
+* DRV_SUCCESS: successfully .
+* DRV_ERROR: fail .
+*
+* Others:
+********************************************************************************/
+SINT32 zDrvRpMsg_CreateBlock(T_ZDrvRpMsg_MsgActor actorID, T_ZDrvRpMsg_ChID chID, UINT32 blkSize, UINT32 blkNums, UINT32 memType);
+
+/*******************************************************************************
+* Function: zDrvRpMsg_GetWriteAddr
+* Description: This function is used for getting write addr;
+* Parameters:
+* Input:
+* actorID:remote processor id
+* chID:channel id
+* Output:
+* wrAddr:addr for write
+*
+* Returns:
+* positive: success
+* negative: fail .
+*
+* Others:
+********************************************************************************/
+SINT32 zDrvRpMsg_GetWriteAddr(T_ZDrvRpMsg_MsgActor actorID, T_ZDrvRpMsg_ChID chID, VOID **wrAddr);
+
+/*******************************************************************************
+* Function: zDrvRpMsg_WriteUpdate
+* Description: This function is used for reading message;
+* Parameters:
+* Input:
+* actorID:remote processor id
+* chID:channel id
+* addr:addr for update
+* len:update len
+* intFlag: 0:without icp int 1:with icp int
+* Output:
+* NULL
+*
+* Returns:
+* positive: len
+* negative: fail .
+*
+* Others:
+********************************************************************************/
+SINT32 zDrvRpMsg_WriteUpdate(T_ZDrvRpMsg_MsgActor actorID, T_ZDrvRpMsg_ChID chID, UINT32 addr, UINT32 len, BOOL intFlag);
+
+/*******************************************************************************
+* Function: zDrvRpMsg_GetReadAddr
+* Description: This function is used for getting read addr;
+* Parameters:
+* Input:
+* actorID:remote processor id
+* chID:channel id
+* Output:
+* rdAddr:addr for read
+*
+* Returns:
+* positive: len
+* negative: fail .
+*
+* Others:
+********************************************************************************/
+SINT32 zDrvRpMsg_GetReadAddr(T_ZDrvRpMsg_MsgActor actorID, T_ZDrvRpMsg_ChID chID, VOID **rdAddr);
+
+/*******************************************************************************
+* Function: zDrvRpMsg_ReadUpdate
+* Description: This function is used for reading message;
+* Parameters:
+* Input:
+* actorID:remote processor id
+* chID:channel id
+* addr:update addr
+* Output:
+* NULL
+*
+* Returns:
+* positive: len
+* negative: fail .
+*
+* Others:
+********************************************************************************/
+SINT32 zDrvRpMsg_ReadUpdate(T_ZDrvRpMsg_MsgActor actorID, T_ZDrvRpMsg_ChID chID, UINT32 addr);
+
+/*******************************************************************************
+* Function: zDrvRpMsg_Initiate
+* Description: This function is used to init rpmsg module;
+* Parameters:
+* Input:
+* null
+*
+* Output:None
+*
+* Returns:
+* DRV_SUCCESS: successfully .
+* other: fail .
+*
+*
+* Others:
+********************************************************************************/
+SINT32 zDrvRpMsg_Initiate (VOID);
+
+/*******************************************************************************
+* Function: zDrvRpMsg_ReadExit
+* Description: This function is used to exit from the block read func,for ctrm;
+* Parameters:
+* Input:
+* null
+*
+* Output:None
+*
+* Returns:
+* null .
+*
+*
+*
+* Others:
+********************************************************************************/
+VOID zDrvRpMsg_ReadExit(T_ZDrvRpMsg_MsgActor actor, T_ZDrvRpMsg_ChID chID);
+
+#endif
diff --git a/cp/ps/driver/inc/misc/drvs_rtt.h b/cp/ps/driver/inc/misc/drvs_rtt.h
new file mode 100644
index 0000000..f9d53b1
--- /dev/null
+++ b/cp/ps/driver/inc/misc/drvs_rtt.h
@@ -0,0 +1,179 @@
+/*******************************************************************************
+ * Copyright (C) 2007, ZTE Corporation.
+ *
+ * File Name: drvs_rtt.h
+ * File Mark:
+ * Description:
+ * Others:
+ * Version: 1.0
+ * Author: wangxia
+ * Date: 2010-4-29
+ * History 1:
+ * Date:
+ * Version:
+ * Author:
+ * Modification:
+ * History 2:
+ ********************************************************************************/
+
+#ifndef _DRVS_RTT_H
+#define _DRVS_RTT_H
+
+
+/****************************************************************************
+* Include files
+****************************************************************************/
+#include "os_ose.h"
+
+/****************************************************************************
+* Macros
+****************************************************************************/
+#define RTT_INT_LEVEL_USER_0 0x5
+#define RTT_INT_LEVEL_USER_1 0x5
+#define RTT_INT_LEVEL_USER_2 0x5
+#define RTT_INT_LEVEL_USER_3 0x5
+#define RTT_INT_LEVEL_USER_4 0x5
+#define RTT_INT_LEVEL_USER_COMMON 0x7
+
+/*The RTT Clock resolution on creation. RTT Clock is available only for predefined users.
+ The resolution can be modified at runtime using RTT_set_clock_resolution
+ */
+#define RTT_DEFAULT_CLOCK_RESOLUTION rtt_clock_100_microseconds
+
+/****************************************************************************
+* Types
+****************************************************************************/
+ typedef enum
+ {
+ rtt_uicc, /* Reserved timer : GPT0T1 */
+ rtt_free1, /* Reserved timer : GPT0T0 */
+ rtt_meas, /* Reserved timer : GPT1T0 */
+ rtt_mmci, /* Reserved timer : GPT1T1 */
+ rtt_free2, /* Reserved timer : GPT1T2 */
+ rtt_common = 5, /* Reserved timer : GPT0T2 */
+ rtt_with_clock = 15, /* !!! use MSB special exception for turning of powersave !!!*/
+ rtt_max_nof_timers = 40
+ } rtt_timer_user_id_enum;
+
+ typedef enum
+ {
+ rtt_one_shot,
+ rtt_repetitive,
+ rtt_one_shot_timer_with_clock,
+ rtt_repetitive_timer_with_clock
+ } rtt_timer_mode_enum;
+
+ typedef enum
+ {
+ rtt_clock_1_microsecond,
+ rtt_clock_10_microseconds,
+ rtt_clock_100_microseconds,
+ rtt_clock_5_milliseconds,
+ rtt_clock_10_milliseconds,
+ rtt_clock_100_milliseconds
+ }rtt_clock_resolution_type;
+
+ /*---------------------------------------------*/
+ /* Typedefinition . */
+ /*---------------------------------------------*/
+ typedef struct
+ {
+ VOID (*timeout_func)(VOID ); /* Callback function on timeout */
+ VOID *arg; /* Argument list to the above callback function */
+ rtt_timer_user_id_enum user_id;
+ rtt_timer_mode_enum timer_mode;
+ UINT32 created;
+ UINT32 started;
+ UINT32 duration;
+ UINT32 restart_duration;
+ UINT32 hw_timer_id;
+ UINT32 process_id;
+ } rtt_timer_list_type;
+ /* end of UICC_Driver_2007_11_2_dcm */
+
+ typedef struct
+ {
+ unsigned int creation_time[2]; //64 bit creation timestamp
+ unsigned int scaled_creation_time; //scaled to current resolution
+ unsigned long resolution;
+ }rtt_clock_data_type;
+
+
+/****************************************************************************
+* Constants
+****************************************************************************/
+
+/****************************************************************************
+* Global Variables
+****************************************************************************/
+
+/****************************************************************************
+* Function Prototypes
+****************************************************************************/
+
+/*******************************************************************************
+ * Function: RTT_create_timer
+ * Description:
+ * Parameters:
+ * Input:
+ *
+ * Output:
+ *
+ * Returns:
+ *
+ *
+ * Others:
+ ********************************************************************************/
+extern rtt_timer_list_type *RTT_create_timer(VOID (*timeout_func)(VOID ),
+ VOID *arg,
+ rtt_timer_user_id_enum user_id,
+ rtt_timer_mode_enum timer_mode);
+
+/*******************************************************************************
+ * Function: RTT_remove_timer
+ * Description:
+ * Parameters:
+ * Input:
+ *
+ * Output:
+ *
+ * Returns:
+ *
+ *
+ * Others:
+ ********************************************************************************/
+extern SINT32 RTT_remove_timer(rtt_timer_list_type *timer);
+
+
+/*******************************************************************************
+ * Function: RTT_start_timer
+ * Description:
+ * Parameters:
+ * Input:
+ *
+ * Output:
+ *
+ * Returns:
+ *
+ *
+ * Others:
+ ********************************************************************************/
+extern SINT32 RTT_start_timer(rtt_timer_list_type *timer, UINT32 duration);
+
+
+/*******************************************************************************
+ * Function: RTT_stop_timer
+ * Description:
+ * Parameters:
+ * Input:
+ *
+ * Output:
+ *
+ * Returns:
+ *
+ *
+ * Others:
+ ********************************************************************************/
+extern SINT32 RTT_stop_timer(volatile rtt_timer_list_type * volatile timer);
+#endif/*_DRVS_RTT_H*/
+
diff --git a/cp/ps/driver/inc/misc/drvs_spcu.h b/cp/ps/driver/inc/misc/drvs_spcu.h
new file mode 100644
index 0000000..27dbfaf
--- /dev/null
+++ b/cp/ps/driver/inc/misc/drvs_spcu.h
@@ -0,0 +1,68 @@
+/***********************************************************************
+* Copyright (C) 2001, ZTE Corporation.
+*
+* File Name: drvs_spcu.h
+* File Mark:
+* Description: spcu hal interface declaration.
+* Others:
+* Version: v1.0
+* Author: wangxia
+* Date: 2010-01-26
+*
+* History 1:
+* Date:
+* Version:
+* Author:
+* Modification:
+
+* History 2:
+**********************************************************************/
+
+#ifndef DRVS_SPCU_H
+#define DRVS_SPCU_H
+
+
+/*************************************************************************
+ * Include files *
+ *************************************************************************/
+
+
+/*************************************************************************
+ * Macro *
+ *************************************************************************/
+
+
+/**************************************************************************
+ * Types *
+ **************************************************************************/
+typedef VOID (*T_ZDRVSPCU_CALLBACK)(VOID);
+
+/**************************************************************************
+ * Global Variable *
+ **************************************************************************/
+
+/**************************************************************************
+ * Function Prototypes *
+ **************************************************************************/
+/**************************************************************************
+* Functin: zDrvSpcu_IntRegister
+* Description: This function is used to regist isr callback for l1g.
+* Parameters:
+* (IN)
+* fCallback: isr callback.
+* (OUT)
+* None.
+* Returns:
+* DRV_SUCCESS: successed.
+* DRV_ERR_NOT_SUPPORTED: this device don't support ioctrl operation.
+* DRV_ERR_INVALID_PARAM: the input parameters are invalid
+* DRV_ERROR: error
+* others: others programmer defined error code. for detailed information, please contact with the programmer
+* Others:
+* others error code should be a negative number, and not equal to the value that already be defined in T_ZDrv_ErrCode in drv_pub.h.
+**************************************************************************/
+extern SINT32 zDrvSpcu_IntRegister(T_ZDRVSPCU_CALLBACK fCallback,UINT32 intPrio);
+
+#endif/*DRVS_SPCU_H */
+
+
diff --git a/cp/ps/driver/inc/misc/drvs_spinlock.h b/cp/ps/driver/inc/misc/drvs_spinlock.h
new file mode 100644
index 0000000..13066d1
--- /dev/null
+++ b/cp/ps/driver/inc/misc/drvs_spinlock.h
@@ -0,0 +1,231 @@
+/*******************************************************************************
+ * Copyright (C) 2007, ZTE Corporation.
+ *
+ * File Name:
+ * File Mark:
+ * Description: all function defines provided by sys module
+ * Others:
+ * Version: 1.0
+ * Author: chenjianguo
+ * Date: 2013-5-31
+ * History 1:
+ * Date:
+ * Version:
+ * Author:
+ * Modification:
+ * History 2:
+ ********************************************************************************/
+
+#ifndef _DRVS_SPINLOCK_H
+#define _DRVS_SPINLOCK_H
+
+#include "drvs_general.h"
+/****************************************************************************
+* Include files
+****************************************************************************/
+
+/****************************************************************************
+* Macros
+****************************************************************************/
+
+/****************************************************************************
+* Types
+****************************************************************************/
+typedef enum
+{
+ CORE_ID_PS=210,
+ CORE_ID_PHY=211,
+ CORE_ID_ZSP=212,
+ CORE_ID_M0=213,
+ CORE_ID_AP=214,
+ CORE_ID_NUM = 215
+} T_ZDrvSpinlock_CpuId;
+/* ±êʶӲ¼þËø*/
+typedef enum
+{
+ PCU_HWLOCK = 0,/*PCU*/
+ CLK_HWLOCK = 1,/*Clock*/
+ REGLOCK_HWLOCK = 2,/*Reg*/
+ SOFTLOCK_HWLOCK = 3,/*Software*/
+ HWLOCK_NUM
+} T_ZDrvSpinlock_HwLockId;
+
+/* ±êʶÈí¼þËø*/
+typedef enum
+{
+ I2C0_SFLOCK = 0,/*i2c0*/
+ I2C1_SFLOCK = 1,/*i2c1*/
+ I2C2_SFLOCK = 2,/*pmic-i2c*/
+ NAND_SFLOCK = 3,/*NAND*/
+ SD0_SFLOCK,
+ SD1_SFLOCK,
+ ADC_SFLOCK, /*pmic adc*/
+ UART_SFLOCK,
+ SFLOCK_ID8,
+ SFLOCK_ID9,
+ SFLOCK_ID10,
+ SFLOCK_ID11,
+ SFLOCK_ID12,
+ SFLOCK_ID13,
+ SFLOCK_ID14,
+ SFLOCK_ID15,
+ SFLOCK_ID16,
+ SFLOCK_ID17,
+ SFLOCK_ID18,
+ SFLOCK_ID19,
+ SFLOCK_ID20,
+ SFLOCK_ID21,
+ SFLOCK_ID22,
+ SFLOCK_ID23,
+ SFLOCK_ID24,
+ SFLOCK_ID25,
+ SFLOCK_ID26,
+ SFLOCK_ID27,
+ SFLOCK_ID28,
+ SFLOCK_ID29,
+ SFLOCK_ID30,
+ REG_SFLOCK = 31,/*reg*/
+ SFLOCK_NUM
+} T_ZDrvSpinlock_SfLockId;
+/****************************************************************************
+* Constants
+****************************************************************************/
+
+/****************************************************************************
+* Global Variables
+****************************************************************************/
+
+/****************************************************************************
+* Function Prototypes
+****************************************************************************/
+/*******************************************************************************
+ * Function: zDrvSysSpinlock_HwLock
+ * Description:»ñȡӲ¼þËø£¬id 0~1£¬
+ * id 4±£Áô¸øÈí¼þËøÊ¹Óã¬ÍⲿÇý¶¯²»¿ÉÓá£
+ * Parameters:
+ * Input:
+ *
+ * Output:
+ *
+ * Returns:
+ *
+ *
+ * Others:
+ ********************************************************************************/
+ VOID zDrvSysSpinlock_HwLock(T_ZDrvSpinlock_HwLockId hwid);
+/*******************************************************************************
+ * Function: zDrvSysSpinlock_HwUnlock
+ * Description:Çý¶¯ÊÍ·ÅÓ²¼þËø£¬id 0~1
+ * Parameters:
+ * Input:
+ *
+ * Output:
+ *
+ * Returns:
+ *
+ *
+ * Others:
+ ********************************************************************************/
+ VOID zDrvSysSpinlock_HwUnlock(T_ZDrvSpinlock_HwLockId hwid);
+/*******************************************************************************
+ * Function: zDrvSysSpinlock_SoftLock
+ * Description:Çý¶¯»ñµÃÈí¼þËø½Ó¿Ú
+ * Parameters:
+ * Input: sfid: Èí¼þËøid¡£
+ *
+ * Output:
+ *
+ * Returns:
+ *
+ *
+ * Others:
+ ********************************************************************************/
+ VOID zDrvSysSpinlock_SoftLock(T_ZDrvSpinlock_SfLockId sfid);
+/*******************************************************************************
+ * Function: zDrvSysSpinlock_soft_unlock
+ * Description:ÓëzDrvSysSpinlock_SoftLock¶ÔÓ¦µÄÊÍ·ÅÈí¼þËø½Ó¿Ú¡£
+ * Parameters:
+ * Input:
+ *
+ * Output:
+ *
+ * Returns:
+ *
+ *
+ * Others:
+ ********************************************************************************/
+ VOID zDrvSysSpinlock_SoftUnlock(T_ZDrvSpinlock_SfLockId sfid);
+/*******************************************************************************
+ * Function: zDrvSysSpinlock_SoftLockPsm
+ * Description:Çý¶¯»ñµÃÈí¼þËø½Ó¿Ú(Ê¡µçרÓÃ)
+ * Parameters:
+ * Input: sfid: Èí¼þËøid¡£
+ * coreid: ±£³ÖidºÅΪsfidÈí¼þËøµÄcpuid¡£
+ * Output:
+ *
+ * Returns:
+ *
+ *
+ * Others:
+ ********************************************************************************/
+ VOID zDrvSysSpinlock_SoftLockPsm(T_ZDrvSpinlock_SfLockId sfid);
+
+/*******************************************************************************
+ * Function: zDrvSysSpinlock_SoftUnlockPsm
+ * Description:ÓëzDrvSysSpinlock_SoftLockPsm¶ÔÓ¦µÄÊÍ·ÅÈí¼þËø½Ó¿Ú¡£
+ * Parameters:
+ * Input:
+ *
+ * Output:
+ *
+ * Returns:
+ *
+ *
+ * Others:
+ ********************************************************************************/
+ VOID zDrvSysSpinlock_SoftUnlockPsm(T_ZDrvSpinlock_SfLockId sfid);
+
+/*******************************************************************************
+ * Function: zDrvSysSpinlock_RegLock
+ * Description:Çý¶¯»ñµÃÈí¼þËø½Ó¿Ú
+ * Parameters:
+ * Input:
+ *
+ * Output:
+ *
+ * Returns:
+ *
+ *
+ * Others:
+ ********************************************************************************/
+ VOID zDrvSysSpinlock_RegLock(VOID);
+/*******************************************************************************
+ * Function: zDrvSysSpinlock_reg_unlock
+ * Description:ÓëzDrvSysSpinlock_RegLock¶ÔÓ¦µÄÊÍ·ÅÈí¼þËø½Ó¿Ú¡£
+ * Parameters:
+ * Input:
+ *
+ * Output:
+ *
+ * Returns:
+ *
+ *
+ * Others:
+ ********************************************************************************/
+ VOID zDrvSysSpinlock_RegUnlock(VOID);
+/*******************************************************************************
+ * Function: zDrvSysSpinlock_Initiate
+ * Description:Èí¼þËø³õʼ»¯¡£
+ * Parameters:
+ * Input:
+ *
+ * Output:
+ *
+ * Returns:
+ *
+ *
+ * Others:
+ ********************************************************************************/
+SINT32 zDrvSysSpinlock_Initiate(VOID);
+#endif/*_DRVS_SYS_H*/
+
diff --git a/cp/ps/driver/inc/misc/drvs_ssp.h b/cp/ps/driver/inc/misc/drvs_ssp.h
new file mode 100644
index 0000000..1b64c00
--- /dev/null
+++ b/cp/ps/driver/inc/misc/drvs_ssp.h
@@ -0,0 +1,255 @@
+/*******************************************************************************
+ * Copyright (C) 2007, ZTE Corporation.
+ *
+ * File Name:
+ * File Mark:
+ * Description:
+ * Others:
+ * Version: 1.0
+ * Author: weizhigang
+ * Date: 2010-8-6
+ * History 1:
+ * Date:
+ * Version:
+ * Author:
+ * Modification:
+ * History 2:
+ ********************************************************************************/
+
+#ifndef _DRVS_SSP_H
+#define _DRVS_SSP_H
+
+
+/****************************************************************************
+* Include files
+****************************************************************************/
+#include "drvs_dma.h"
+
+/****************************************************************************
+* Macros
+****************************************************************************/
+//#define SSP_INT_ENABLE 0
+//#define SSP_DMA_ENABLE 1
+
+#define SSP_ASSERT() zOss_ASSERT(0)
+
+#define SSP_ERROR(format,args...) do {SSP_ASSERT();zOss_Printf(1,1,format,##args);} while(0)
+
+#define SSP_DEBUG_RAMLOG
+
+#ifdef SSP_DEBUG_RAMLOG
+#define zDrvSsp_RamLog(s...) zDrvRamlog_PRINTF(RAMLOG_MOD_SPI,s)
+#else
+#define zDrvSsp_RamLog(s...)
+#endif
+
+#define SPI_PRINTF(cond, format, args...) do { if(cond) zOss_Printf(SUBMDL_TEST, PRINT_LEVEL_NORMAL, format, ##args);}while(0)
+/****************************************************************************
+* Types
+****************************************************************************/
+
+
+//define ssp num --zhangpei add
+typedef enum _T_SspDevNum
+{
+ SSP_DEV_0 = 0,
+ SSP_DEV_1 = 1,
+ SSP_DEV_NUM
+}
+T_SspDevNum;
+typedef enum _T_SspMSMode
+{
+ SSP_MS_MASTER = 0x0,
+ SSP_MS_SLAVE = 0x1,
+}
+T_SspMSMode;
+//define ssp mode
+typedef enum _T_SspMode
+{
+ SSP_AS_SPI = 0x0,
+ SSP_AS_TISS = 0x1,
+}
+T_SspMode;
+
+//define ssp mode
+typedef enum _T_SspXferWidth
+{
+ SSP_8_BIT = 7,
+ SSP_9_BIT = 8,
+ SSP_16_BIT = 15,
+ SSP_32_BIT = 31
+}
+T_SspXferWidth;
+
+//define ssp mode
+typedef enum _T_SspPolarity
+{
+ SPH_SPO_00 = 0x0,
+ SPH_SPO_01 = 0x1,
+ SPH_SPO_10 = 0x2,
+ SPH_SPO_11 = 0x3
+}
+T_SspPolarity;
+
+
+//defined for ssp frequency changing
+typedef enum _T_SspFrequency
+{
+ SSP_FREQ_52M,
+ SSP_FREQ_39M,
+ SSP_FREQ_26M,
+ SSP_FREQ_13M,
+ SSP_FREQ_6M5,
+ SSP_FREQ_3M2,
+ SSP_FREQ_1M6,
+ SSP_FREQ_812K5,
+ SSP_FREQ_NUM,
+}
+T_SspFrequency;
+
+typedef enum _T_SspCamMode
+{
+ SSP_NORMAL_MODE = 0x0,
+ SSP_CAMERA_MODE = 0x1,
+}
+T_SspCamMode;
+
+
+//define ssp cs level
+typedef enum _T_SspCsLevel
+{
+ SSP_CS_LOW = 0,
+ SSP_CS_HIGH = 1
+}
+T_SspCsLevel;
+
+
+//define the status
+#define RXFIFOFULL 1
+#define RXFIFONOTFULL 0
+#define RXFIFOEMPT 0
+#define RXFIFONOTEMPT 1
+#define TXFIFOFULL 0
+#define TXFIFONOTFULL 1
+#define TXFIFOEMPTY 1
+#define TXFIFONOTEMPTY 0
+
+//define register bit field segment
+typedef volatile struct
+{
+ /*0x00*/
+ UINT32 SSP_VER_REG;
+ /*0x04*/
+ UINT32 SSP_COM_CTRL;
+ /*0x08*/
+ UINT32 SSP_FMT_CTRL;
+ /*0x0c*/
+ UINT32 SSP_DR;
+ /*0x10*/
+ UINT32 SSP_FIFO_CTRL;
+ /*0x14*/
+ UINT32 SSP_FIFO_SR;
+ /*0x18*/
+ UINT32 SSP_INTR_EN;
+ //0x1c
+ UINT32 SSP_ISR_OR_ICR;
+ //0x20
+ UINT32 SSP_TIMING;
+
+}
+T_SspReg;
+
+
+typedef enum _T_SspStatus
+{
+ SSP_STA_INIT = 0,
+ SSP_STA_OPENED,
+ SSP_STA_XFER,
+ SSP_STA_DMA_ERR,
+ SSP_STA_DONE,
+}
+T_SspStatus;
+
+typedef struct _T_SspDmaInfo
+{
+ UINT32 rxDmaChl; // ssp rx Dma channel number
+ UINT32 txDmaChl;
+ T_ZDrvDma_ChannelDef rxDmaChlDef;
+ T_ZDrvDma_ChannelDef txDmaChlDef;
+ zDrvDma_CallbackFunc rxDmaCbFunc; // ssp rx callback function
+ zDrvDma_CallbackFunc txDmaCbFunc;
+ ZOSS_SEMAPHORE_ID TxDmaSema;
+ ZOSS_SEMAPHORE_ID RxDmaSema;
+} T_SspDmaInfo;
+
+
+typedef union _T_SspData
+{
+ UINT8 *Buf_8;
+ UINT16 *Buf_16;
+ UINT32 *Buf_32;
+ VOID *Buf;
+} T_SspData;
+
+
+typedef struct
+{
+ T_SspDevNum devNum; //indicate the ssp device num
+ T_SspReg* regPtr;
+ T_SspDmaInfo SspDmaInfo;
+ T_SspStatus status;
+ T_SspMSMode msMode;
+ T_SspMode mode;
+ T_SspPolarity polarity;
+ T_SspXferWidth xferWidth;
+
+ //NT32 SspWorkClock; //the wanted freq
+ //NT32 RealSspWorkClock; //the actral freq
+ UINT32 SspWorkClock; //the wanted freq
+
+ UINT32 tx_thres;
+ UINT32 rx_thres;
+
+ UINT32 Len_tx_remin;
+ VOID* txBuf;
+ UINT32 Len_rx_remin;
+ VOID* rxBuf;
+
+ UINT32 bPrint;
+
+ //ZOSS_SEMAPHORE_ID txSem;
+ // ZOSS_SEMAPHORE_ID rxSem;
+
+}
+T_SspDevHnd;
+
+
+/****************************************************************************
+* Constants
+****************************************************************************/
+
+/****************************************************************************
+* Global Variables
+****************************************************************************/
+
+/****************************************************************************
+* Function Prototypes
+****************************************************************************/
+SINT32 zDrvSsp_Transfer(VOID* hnd, VOID* txBuf ,VOID* rxBuf,UINT32 Len);
+//VOID* zDrvSsp_Open(T_SspDevNum devNum, T_SspMSMode msMode);
+VOID* zDrvSsp_Open(T_SspDevNum devNum);
+//VOID zDrvSsp_Reset(T_SspDevNum devNum);
+SINT32 zDrvSsp_Set_XferWidth(VOID* hnd,T_SspXferWidth length);
+
+SINT32 zDrvSsp_Xfer(VOID* hnd, VOID* txBuf ,VOID* rxBuf,UINT32 Len);
+
+SINT32 zDrvSsp_DmaXfer(VOID* hnd, VOID* txBuf ,VOID* rxBuf,UINT32 Len);
+//SINT32 zDrvSsp_DmaEnable(T_SspDevNum devNum);
+//SINT32 zDrvSsp_DmaDisable(T_SspDevNum devNum);
+//NT32 zDrvSsp_ChangeFreq(VOID *hnd, T_SspFrequency Freq);
+SINT32 zDrvSsp_SetMSMode(VOID *hnd, T_SspMSMode msMode);
+SINT32 zDrvSsp_Initiate(VOID);
+SINT32 zDrvSsp_Ioctl(VOID *hnd, T_DRVIO_CTRL_KEY function, VOID *arg);
+
+#endif/*_FILENAME_H*/
+
diff --git a/cp/ps/driver/inc/misc/drvs_sys.h b/cp/ps/driver/inc/misc/drvs_sys.h
new file mode 100644
index 0000000..3f7dcbf
--- /dev/null
+++ b/cp/ps/driver/inc/misc/drvs_sys.h
@@ -0,0 +1,868 @@
+/*******************************************************************************
+ * Copyright (C) 2014, ZTE Corporation.
+ *
+ * File Name:
+ * File Mark:
+ * Description: definition of clock name and frequency for zx297520
+ * Others:
+ * Version: v1.0
+ * Author: xuzhiguo
+ * Date: 2014-07-01
+ * History 1:
+ * Date:
+ * Version:
+ * Author:
+ * Modification:
+ * History 2:
+ ********************************************************************************/
+
+#ifndef _DRVS_SYS_H
+#define _DRVS_SYS_H
+
+/****************************************************************************
+* Macros
+****************************************************************************/
+
+/****************************************************************************
+* Types
+****************************************************************************/
+#if 0//modify by xxx def _OS_LINUX
+
+#define DRV_USE_MODEM_TYPE
+
+#include <mach/clk.h> /*use linux define*/
+
+#else
+
+#if defined (_CHIP_ZX297520V3)
+/*
+* ACLK: AXI BUS CLOCK
+* HCLK: AHB BUS CLOCK
+* PCLK: APB BUS CLOCK
+*/
+typedef enum
+{
+ /*
+ * PS mg input clock
+ */
+ CLK_PS_CORE,
+ CLK_PS_CORE_IDLE,
+ CLK_TODDR_ACLK,
+ CLK_TOMATIRX_ACLK,
+ CLK_FROMMATIRX_PCLK,
+ CLK_PSMATIRX_AXI,
+
+
+ #if 0
+ CLK_R7INT,
+ CLK_R7CRM_PCLK,
+ CLK_AXI2AXI_APB_AS_FOR_TCM,
+ CLK_AXI2AXI_AS_M1,
+ CLK_AXI2AXI_APB_AS,
+ CLK_R7CFG_APBMUX_PCLK,
+ #endif
+ /*
+ * lsp mg input clock
+ */
+ CLK_LSP32K,
+ CLK_LSP26M,
+ CLK_LSP52M,
+ CLK_LSP78M,
+ CLK_LSP124M8,
+ CLK_LSP156M,
+ CLK_LSP104M,
+ CLK_LSP122M88,
+ CLK_LSPTDM,
+ CLK_LSPAPB,
+
+ /*
+ * USB
+ */
+ /*CLK_USB_HCLK,
+ CLK_USB_CTRL_WCLK,
+ CLK_USB_12M_PHY_WCLK,
+
+ CLK_HSIC_HCLK,
+ CLK_HSIC_12M_PHY_WCLK,
+ CLK_HSIC_480M_PHY_WCLK,
+ CLK_HSIC_CTRL_WCLK,*/
+
+ /*
+ *dma
+ */
+ CLK_DMA0_PCLK,
+ CLK_DMA0_ACLK,
+
+ /*
+ * M2_AXI2AHB
+ */
+ //CLK_M2_ACLK,
+ //CLK_M2_HCLK,
+
+ /*
+ * edcp in matrix blcok
+ */
+ CLK_EDCP_HCLK,
+ CLK_EDCPASYNC_ACLK,
+ CLK_EDCPSYNC_ACLK,
+
+ /*
+ * nand
+ */
+ /*CLK_4M1SNAND_HCLK,*/
+ CLK_NAND_HCLK ,
+ CLK_NAND_WCLK,
+
+ /*
+ * sd
+ */
+ CLK_SD0_HCLK,
+ CLK_SD1_HCLK,
+
+ CLK_SD0_32K,
+ CLK_SD1_32K,
+
+ CLK_SD0_WCLK,
+ CLK_SD1_WCLK,
+
+ /*i2s in lsp*/
+ CLK_I2S0_PCLK,
+ CLK_I2S1_PCLK,
+
+ CLK_I2S0_WCLK,
+ CLK_I2S1_WCLK,
+
+ /*spifc in lsp*/
+ CLK_SPIFC_PCLK,
+ CLK_SPIFC_WCLK,
+
+ /* ssp in lsp*/
+ CLK_SSP0_PCLK,
+ CLK_SSP1_PCLK,
+
+ CLK_SSP0_WCLK,
+ CLK_SSP1_WCLK,
+
+ /*uart0 in rm,uart1&2 in lsp*/
+ CLK_UART0_PCLK,
+ CLK_UART1_PCLK,
+ CLK_UART2_PCLK,
+
+ CLK_UART0_WCLK,
+ CLK_UART1_WCLK,
+ CLK_UART2_WCLK,
+
+ /*i2c0 in rm, i2c1 in lsp*/
+ CLK_RMI2C_PCLK,
+ CLK_I2C1_PCLK,
+
+ CLK_RMI2C_WCLK,
+ CLK_I2C1_WCLK,
+
+ /*gpio0&1 in rm*/
+ CLK_GPIO0_PCLK,
+ CLK_GPIO1_PCLK,
+
+ /*gsm in rm*/
+ CLK_GSM_156M,
+ CLK_GSM_104M,
+ CLK_GSM_48M,
+ CLK_GSM_32K,
+ CLK_GSM_MAIN,
+
+ /*tdm in lsp*/
+ CLK_TDM_PCLK,
+ CLK_TDM_WCLK,
+
+ /*ps timer1&2&rm timer1 in rm, ps timer0&ps-rm timer in lsp*/
+ CLK_TIMER0_PCLK,/*ps timer0*/
+ CLK_TIMER4_PCLK,/*ps rm timer*/
+ CLK_TIMER1_PCLK,/*ps timer1*/
+ CLK_TIMER2_PCLK,/*ps timer2*/
+ CLK_TIMER3_PCLK,/*rm timer1*/
+
+ CLK_TIMER0_WCLK,/*ps timer0*/
+ CLK_TIMER4_WCLK,/*ps rm timer*/
+ CLK_TIMER1_WCLK,/*ps timer1*/
+ CLK_TIMER2_WCLK,/*ps timer2*/
+ CLK_TIMER3_WCLK,/*rm timer1*/
+
+ /*
+ * usim
+ */
+ CLK_USIM_PCLK,
+ CLK_USIM_WCLK,
+
+ /*
+ * mpll
+ */
+ CLK_MPLL_156M_CLK,
+ CLK_MPLL_48M_CLK,
+ CLK_AON_DPLL_491M52_CLK,
+
+ /*
+ * rtc
+ */
+ //CLK_RTC_PCLK,
+ //CLK_RTC_WCLK,
+
+ /*wdt in lsp*/
+ CLK_WDT_PCLK,
+ CLK_WDT_WCLK,
+
+ /*key in rm*/
+ CLK_KEY_PCLK,
+ CLK_KEY_WCLK,
+ /*VOU */
+ CLK_OSD_PCLK,
+ CLK_OSD_ACLK,
+ CLK_OSD_VEDIO_CLK,
+ CLK_OSD_GRAPHIC_CLK,
+ CLK_OSD_MAINMIX_CLK,
+ CLK_OSD_PPU_CLK,
+ CLK_CSC_WCLK,
+ CLK_CSC_PCLK,
+ CLK_VOU_ACLK,
+ CLK_VOU_PCLK,
+ CLK_VOU_WCLK,
+ CLK_MCU_WCLK,
+ CLK_MCU_PCLK,
+ /*
+ * gsmlpm
+ */
+ CLK_GSMLPM_PCLK,
+ CLK_GSMLPM_WCLK,
+
+ /*matrix ps block*/
+ CLK_PS2MATRIX_ACLK,
+ CLK_PS2DDR_ACLK,
+
+ /*matrix block*/
+ CLK_DPLL_122M88,
+
+ /*matrix ssc block*/
+ CLK_SSC_WCLK,
+ CLK_SSC_PCLK,
+ CLK_RFFE_WCLK,
+
+} T_ZDrvSysClk_Name;
+
+
+
+
+/*
+* bits domain definition for clock frequency
+* base clock name same clock number reserved clock selection frequency division
+* 31...28 27...24 23...20 19...16 15...12 11...8 7...4 3...0
+* invalid value:
+* 0xff 0xf or 0x0 0x0 or ignore 0xff 0xff
+*/
+
+typedef enum
+{
+ /*fixed frequency*/
+ FIXED_FREQ =0xffffffff,
+
+ /*ps core & ps core idle*/
+ PS_CORE_26M = (CLK_PS_CORE << 24) | 0x00200000,
+ PS_CORE_624M = (CLK_PS_CORE << 24) | 0x00200100,
+ PS_CORE_312M = (CLK_PS_CORE << 24) | 0x00200200,
+ PS_CORE_156M = (CLK_PS_CORE << 24) | 0x00200300,
+
+ /*ps matrix axi*/
+ PS_MATRIX_AXI_26M = (CLK_PSMATIRX_AXI << 24) | 0x00100000,
+ PS_MATRIX_AXI_156M = (CLK_PSMATIRX_AXI << 24) | 0x00100100,
+ PS_MATRIX_AXI_124M8 = (CLK_PSMATIRX_AXI << 24) | 0x00100200,
+ PS_MATRIX_AXI_104M = (CLK_PSMATIRX_AXI << 24) | 0x00100300,
+ PS_MATRIX_AXI_78M = (CLK_PSMATIRX_AXI << 24) | 0x00100400,
+ PS_MATRIX_AXI_52M = (CLK_PSMATIRX_AXI << 24) | 0x00100500,
+ PS_MATRIX_AXI_39M = (CLK_PSMATIRX_AXI << 24) | 0x00100600,
+ PS_MATRIX_AXI_6M5 = (CLK_PSMATIRX_AXI << 24) | 0x00100700,
+
+ /*TDM WCLK*/
+ WCLK_TDM_26M = (CLK_LSPTDM << 24) | 0x00100000,
+ WCLK_TDM_122M88 = (CLK_LSPTDM << 24) | 0x00100100,
+ WCLK_TDM_104M = (CLK_LSPTDM << 24) | 0x00100200,
+
+ /* EDCP WCLK*/
+ WCLK_EDCP_26M = (CLK_EDCPASYNC_ACLK << 24) | 0x00100000,
+ WCLK_EDCP_208M = (CLK_EDCPASYNC_ACLK << 24) | 0x00100100,
+ WCLK_EDCP_156M = (CLK_EDCPASYNC_ACLK << 24) | 0x00100200,
+ WCLK_EDCP_104M = (CLK_EDCPASYNC_ACLK << 24) | 0x00100300,
+
+ /*NAND WCLK*/
+ WCLK_NAND_26M = (CLK_NAND_WCLK << 24) | 0x00100000,
+ WCLK_NAND_104M = (CLK_NAND_WCLK << 24) | 0x00100100,
+ WCLK_NAND_78M = (CLK_NAND_WCLK << 24) | 0x00100200,
+
+ /* SD0 WCLK*/
+ WCLK_SD0_26M = (CLK_SD0_WCLK << 24) | 0x00100000,
+ WCLK_SD0_156M = (CLK_SD0_WCLK << 24) | 0x00100100,
+ WCLK_SD0_100M = (CLK_SD0_WCLK << 24) | 0x00100200,
+ WCLK_SD0_78M = (CLK_SD0_WCLK << 24) | 0x00100300,
+ WCLK_SD0_50M = (CLK_SD0_WCLK << 24) | 0x00100400,
+ WCLK_SD0_25M = (CLK_SD0_WCLK << 24) | 0x00100500,
+
+ /* SD1 WCLK*/
+ WCLK_SD1_26M = (CLK_SD1_WCLK << 24) | 0x00100000,
+ WCLK_SD1_100M = (CLK_SD1_WCLK << 24) | 0x00100100,
+ WCLK_SD1_78M = (CLK_SD1_WCLK << 24) | 0x00100200,
+ WCLK_SD1_50M = (CLK_SD1_WCLK << 24) | 0x00100300,
+ WCLK_SD1_39M = (CLK_SD1_WCLK << 24) | 0x00100400,
+ WCLK_SD1_25M = (CLK_SD1_WCLK << 24) | 0x00100500,
+
+ /* I2S0&1 WCLK*/
+ WCLK_I2S_26M = (CLK_I2S0_WCLK << 24) | 0x00200000,
+ WCLK_I2S_122M88 = (CLK_I2S0_WCLK << 24) | 0x00200100,
+ WCLK_I2S_104M = (CLK_I2S0_WCLK << 24) | 0x00200200,
+
+ /*SPIFC WCLK*/
+ WCLK_SPIFC_26M = (CLK_SPIFC_WCLK << 24) | 0x00100000,
+ WCLK_SPIFC_156M = (CLK_SPIFC_WCLK << 24) | 0x00100100,
+ WCLK_SPIFC_124M8 = (CLK_SPIFC_WCLK << 24) | 0x00100200,
+ WCLK_SPIFC_104M = (CLK_SPIFC_WCLK << 24) | 0x00100300,
+ WCLK_SPIFC_78M = (CLK_SPIFC_WCLK << 24) | 0x00100400,
+ WCLK_SPIFC_52M = (CLK_SPIFC_WCLK << 24) | 0x00100500,
+
+ /* SSP0&1 WCLK*/
+ WCLK_SSP_26M = (CLK_SSP0_WCLK << 24) | 0x00200000,
+ WCLK_SSP_13M = (CLK_SSP0_WCLK << 24) | 0x00200001,
+ WCLK_SSP_6M5 = (CLK_SSP0_WCLK << 24) | 0x00200003,
+ WCLK_SSP_156M = (CLK_SSP0_WCLK << 24) | 0x00200100,
+ WCLK_SSP_78M = (CLK_SSP0_WCLK << 24) | 0x00200101,
+ WCLK_SSP_19M5 = (CLK_SSP0_WCLK << 24) | 0x00200107,
+ WCLK_SSP_104M = (CLK_SSP0_WCLK << 24) | 0x00200200,
+ WCLK_SSP_52M = (CLK_SSP0_WCLK << 24) | 0x00200201,
+
+ /*ps timer1& ps timer2& rm timer1*/
+ WCLK_AON_TIMER_32K = (CLK_TIMER1_WCLK << 24) | 0x00300000,
+ WCLK_AON_TIMER_26M = (CLK_TIMER1_WCLK << 24) | 0x00300100, /* 1 div*/
+ WCLK_AON_TIMER_13M = (CLK_TIMER1_WCLK << 24) | 0x00300101, /* 2 div*/
+
+ /*ps timer0&ps rm timer*/
+ WCLK_LSP_TIMER_32K = (CLK_TIMER0_WCLK << 24) | 0x00200000,
+ WCLK_LSP_TIMER_26M = (CLK_TIMER0_WCLK << 24) | 0x00200100, /* 1 div*/
+ WCLK_LSP_TIMER_13M = (CLK_TIMER0_WCLK << 24) | 0x00200101, /* 2 div*/
+
+ /* I2C0&1 WCLK*/
+ WCLK_I2C_26M = (CLK_RMI2C_WCLK << 24) | 0x00200000,
+ WCLK_I2C_104M = (CLK_RMI2C_WCLK << 24) | 0x00200100,
+
+ /* UART0&1&2 WCLK*/
+ WCLK_UART_26M = (CLK_UART0_WCLK << 24) | 0x00300000,
+ WCLK_UART_104M = (CLK_UART0_WCLK << 24) | 0x00300100,
+
+ /*PS WDT WCLK*/
+ WCLK_WDT_32K = (CLK_WDT_WCLK << 24) | 0x00100000,
+ WCLK_WDT_26M = (CLK_WDT_WCLK << 24) | 0x00100100,
+ WCLK_WDT_13M = (CLK_WDT_WCLK << 24) | 0x00100101,
+
+ /* USIM WCLK */
+ /* usim work clock is fixed 13MHz*/
+ /*WCLK_USIM_13M = (CLK_USIM_WCLK << 24) | 0x0010ffff,*/
+
+ /* RTC WCLK */
+ /* rtc work clock is fixed 32KHz*/
+ /*WCLK_RTC_32K = (CLK_RTC_WCLK << 24) | 0x0010ffff,*/
+
+ /* KEY WCLK */
+ /* KEY work clock is fixed 32KHz*/
+ /*WCLK_KEY_32K = (CLK_RTC_WCLK << 24) | 0x0010ffff,*/
+
+
+} T_ZDrvSysClk_Freq;
+#elif defined (_CHIP_ZX297520V2)
+/*
+* ACLK: AXI BUS CLOCK
+* HCLK: AHB BUS CLOCK
+* ACLK: APB BUS CLOCK
+*/
+typedef enum
+{
+ /*
+ * PS
+ */
+ CLK_PS_CORE,
+ CLK_PS_CORE_IDLE,
+ CLK_R7INT,
+ CLK_R7CRM_PCLK,
+ CLK_AXI2AXI_APB_AS_FOR_TCM,
+ CLK_AXI2AXI_AS_M1,
+ CLK_AXI2AXI_APB_AS,
+ CLK_R7CFG_APBMUX_PCLK,
+ CLK_FROMMATIRX_ACLK,
+ CLK_TOMATIRX_ACLK,
+ CLK_TODDR3_ACLK,
+
+ /*
+ * lsp mg input clock
+ */
+ CLK_LSP124M8,
+ CLK_LSP156M,
+ CLK_LSP104M,
+ CLK_LSP78M,
+ CLK_LSP52M,
+ CLK_LSP26M,
+ CLK_LSP32K,
+ CLK_LSPAPB,
+ CLK_LSPTDM,
+
+ /*
+ * USB
+ */
+ /*CLK_USB_HCLK,
+ CLK_USB_CTRL_WCLK,
+ CLK_USB_12M_PHY_WCLK,
+
+ CLK_HSIC_HCLK,
+ CLK_HSIC_12M_PHY_WCLK,
+ CLK_HSIC_480M_PHY_WCLK,
+ CLK_HSIC_CTRL_WCLK,*/
+
+ /*
+ *dma
+ */
+ CLK_DMA0_PCLK,
+ CLK_DMA0_ACLK,
+
+ /*
+ * M2_AXI2AHB
+ */
+ //CLK_M2_ACLK,
+ //CLK_M2_HCLK,
+
+ /*
+ * edcp
+ */
+ CLK_EDCP_HCLK,
+ CLK_EDCPASYNC_ACLK,
+ CLK_EDCPSYNC_ACLK,
+
+ /*
+ * nand
+ */
+ /*CLK_4M1SNAND_HCLK,*/
+ CLK_NAND_HCLK ,
+ CLK_NAND_WCLK,
+
+ /*
+ * sd
+ */
+ CLK_SD0_HCLK,
+ CLK_SD1_HCLK,
+
+ CLK_SD0_32K,
+ CLK_SD1_32K,
+
+ CLK_SD0_WCLK,
+ CLK_SD1_WCLK,
+
+ /*
+ * i2s
+ */
+ CLK_I2S0_PCLK,
+ CLK_I2S1_PCLK,
+
+ CLK_I2S0_WCLK,
+ CLK_I2S1_WCLK,
+
+ /*
+ * spifc
+ */
+ CLK_SPIFC_PCLK,
+ CLK_SPIFC_WCLK,
+
+ /*
+ * ssp
+ */
+ CLK_SSP0_PCLK,
+ CLK_SSP1_PCLK,
+
+ CLK_SSP0_WCLK,
+ CLK_SSP1_WCLK,
+
+ /*
+ * uart0
+ */
+ CLK_UART0_PCLK,
+ CLK_UART1_PCLK,
+ CLK_UART2_PCLK,
+
+ CLK_UART0_WCLK,
+ CLK_UART1_WCLK,
+ CLK_UART2_WCLK,
+
+ /*
+ * i2c
+ */
+ CLK_RMI2C_PCLK,
+ CLK_I2C1_PCLK,
+
+ CLK_RMI2C_WCLK,
+ CLK_I2C1_WCLK,
+
+ /*
+ * gpio
+ */
+ CLK_GPIO0_PCLK,
+ CLK_GPIO1_PCLK,
+
+ /*
+ * gsm
+ */
+ CLK_GSM_PCLK,
+ CLK_GSM_32K,
+ CLK_GSM_MAIN,
+ CLK_GSM_48M,
+ CLK_GSM_104M,
+ CLK_GSM_156M,
+ CLK_GSM_SYS_26M,
+
+ /*
+ * tdm
+ */
+ CLK_TDM_PCLK,
+ CLK_TDM_WCLK,
+
+ /*
+ * timer
+ */
+ CLK_TIMER1_PCLK,
+ CLK_TIMER2_PCLK,
+ CLK_TIMER3_PCLK,/*m0 rm timer1*/
+
+ CLK_TIMER0_PCLK,
+ CLK_TIMER4_PCLK,/*ps rm timer*/
+
+ CLK_TIMER1_WCLK,
+ CLK_TIMER2_WCLK,
+ CLK_TIMER3_WCLK,/*m0 rm timer1*/
+
+ CLK_TIMER0_WCLK,
+ CLK_TIMER4_WCLK,/*ps rm timer*/
+
+ /*
+ * usim
+ */
+ //CLK_USIM_PCLK,
+ //CLK_USIM_WCLK,
+
+ /*
+ * rtc
+ */
+ //CLK_RTC_PCLK,
+ //CLK_RTC_WCLK,
+
+ /*
+ * wdt
+ */
+ CLK_WDT_PCLK,
+ CLK_WDT_WCLK,
+
+ /*
+ * key
+ */
+ CLK_KEY_PCLK,
+ CLK_KEY_WCLK,
+
+ /*
+ * gsmlpm
+ */
+ //CLK_GSMLPM_PCLK,
+ //CLK_GSMLPM_WCLK,
+ //CLK_WIFI_BT
+} T_ZDrvSysClk_Name;
+
+
+
+
+/*
+* bits domain definition for clock frequency
+* base clock name same clock number reserved clock selection frequency division
+* 31...28 27...24 23...20 19...16 15...12 11...8 7...4 3...0
+* invalid value:
+* 0xff 0xf or 0x0 0x0 or ignore 0xff 0xff
+*/
+
+typedef enum
+{
+ /*fixed frequency*/
+ FIXED_FREQ =0xffffffff,
+ /*
+ *ps core
+ */
+ PS_CORE_624M = (CLK_PS_CORE << 24) | 0x00100000,
+ PS_CORE_26M = (CLK_PS_CORE << 24) | 0x00100100,
+ PS_CORE_491M52 = (CLK_PS_CORE << 24) | 0x00100200,
+ PS_CORE_312M = (CLK_PS_CORE << 24) | 0x00100300,
+ PS_CORE_208M = (CLK_PS_CORE << 24) | 0x00100400,
+ PS_CORE_104M = (CLK_PS_CORE << 24) | 0x00100500,
+ PS_CORE_78M = (CLK_PS_CORE << 24) | 0x00100600,
+ PS_CORE_52M = (CLK_PS_CORE << 24) | 0x00100700,
+
+ /*
+ *ps core idle
+ */
+ PS_CORE_IDLE_624 = (CLK_PS_CORE << 24) | 0x00100000,
+ PS_CORE_IDLE_26M = (CLK_PS_CORE << 24) | 0x00100100,
+ PS_CORE_IDLE_491M52 = (CLK_PS_CORE << 24) | 0x00100200,
+ PS_CORE_IDLE_312M = (CLK_PS_CORE << 24) | 0x00100300,
+ PS_CORE_IDLE_208M = (CLK_PS_CORE << 24) | 0x00100400,
+ PS_CORE_IDLE_104M = (CLK_PS_CORE << 24) | 0x00100500,
+ PS_CORE_IDLE_78M = (CLK_PS_CORE << 24) | 0x00100600,
+ PS_CORE_IDLE_52M = (CLK_PS_CORE << 24) | 0x00100700,
+
+ /* EDCP WCLK*/
+ WCLK_EDCP_208M = (CLK_EDCPASYNC_ACLK << 24) | 0x00100000,
+ WCLK_EDCP_26M = (CLK_EDCPASYNC_ACLK << 24) | 0x00100100,
+ WCLK_EDCP_156M = (CLK_EDCPASYNC_ACLK << 24) | 0x00100200,
+ WCLK_EDCP_104M = (CLK_EDCPASYNC_ACLK << 24) | 0x00100300,
+
+ /*NAND WCLK*/
+ WCLK_NAND_104M = (CLK_NAND_WCLK << 24) | 0x00100000,
+ WCLK_NAND_26M = (CLK_NAND_WCLK << 24) | 0x00100100,
+ WCLK_NAND_78M = (CLK_NAND_WCLK << 24) | 0x00100200,
+ WCLK_NAND_52M = (CLK_NAND_WCLK << 24) | 0x00100300,
+
+ /* SD0 WCLK*/
+ WCLK_SD0_200M = (CLK_SD0_WCLK << 24) | 0x00100000,
+ WCLK_SD0_26M = (CLK_SD0_WCLK << 24) | 0x00100100,
+ WCLK_SD0_156M = (CLK_SD0_WCLK << 24) | 0x00100200,
+ WCLK_SD0_100M = (CLK_SD0_WCLK << 24) | 0x00100300,
+ WCLK_SD0_78M = (CLK_SD0_WCLK << 24) | 0x00100400,
+ WCLK_SD0_50M = (CLK_SD0_WCLK << 24) | 0x00100500,
+ WCLK_SD0_178M = (CLK_SD0_WCLK << 24) | 0x00100600,
+ WCLK_SD0_25M = (CLK_SD0_WCLK << 24) | 0x00100700,
+
+ /* SD1 WCLK*/
+ WCLK_SD1_100M = (CLK_SD1_WCLK << 24) | 0x00100000,
+ WCLK_SD1_26M = (CLK_SD1_WCLK << 24) | 0x00100100,
+ WCLK_SD1_78M = (CLK_SD1_WCLK << 24) | 0x00100200,
+ WCLK_SD1_50M = (CLK_SD1_WCLK << 24) | 0x00100300,
+ WCLK_SD1_39M = (CLK_SD1_WCLK << 24) | 0x00100400,
+ WCLK_SD1_25M = (CLK_SD1_WCLK << 24) | 0x00100500,
+
+
+ /* I2S WCLK*/
+ /*I2S not be used in zx297520, so ignore it's clock*/
+ WCLK_I2S_26M = (CLK_I2S0_WCLK << 24) | 0x00200000,
+ WCLK_I2S_104M = (CLK_I2S0_WCLK << 24) | 0x00200100,
+
+ /* BLG WCLK*/
+ /* blg work clock used default 32KHz*/
+
+ /*SPIFC WCLK*/
+ WCLK_SPIFC_156M = (CLK_SPIFC_WCLK << 24) | 0x00100000,
+ WCLK_SPIFC_26M = (CLK_SPIFC_WCLK << 24) | 0x00100100,
+ WCLK_SPIFC_124M8 = (CLK_SPIFC_WCLK << 24) | 0x00100200,
+ WCLK_SPIFC_104M = (CLK_SPIFC_WCLK << 24) | 0x00100300,
+ WCLK_SPIFC_78M = (CLK_SPIFC_WCLK << 24) | 0x00100400,
+ WCLK_SPIFC_52M = (CLK_SPIFC_WCLK << 24) | 0x00100500,
+
+ /*AON TIMER WCLK timer1&timer2&timer3*/
+ WCLK_AON_TIMER_32K = (CLK_TIMER1_WCLK << 24) | 0x00300100,
+ WCLK_AON_TIMER_26M = (CLK_TIMER1_WCLK << 24) | 0x00300000, /* 1 div*/
+ WCLK_AON_TIMER_13M = (CLK_TIMER1_WCLK << 24) | 0x00300001, /* 2 div*/
+
+ /*LSP TIMER0 WCLK timer0&timer4*/
+ WCLK_LSP_TIMER_32K = (CLK_TIMER0_WCLK << 24) | 0x00200000,
+ WCLK_LSP_TIMER_26M = (CLK_TIMER0_WCLK << 24) | 0x00200100, /* 1 div*/
+ WCLK_LSP_TIMER_13M = (CLK_TIMER0_WCLK << 24) | 0x00200101, /* 2 div*/
+
+ /* RM I2C WCLK*/
+ WCLK_RMI2C_26M = (CLK_RMI2C_WCLK << 24) | 0x00100100,
+ WCLK_RMI2C_104M = (CLK_RMI2C_WCLK << 24) | 0x00100000,
+
+ /* I2C1 WCLK*/
+ WCLK_I2C1_26M = (CLK_I2C1_WCLK << 24) | 0x00100000,
+ WCLK_I2C1_104M = (CLK_I2C1_WCLK << 24) | 0x00100100,
+
+
+ /* UART WCLK*/
+ WCLK_UART0_26M = (CLK_UART0_WCLK << 24) | 0x00100100,
+ WCLK_UART0_104M = (CLK_UART0_WCLK << 24) | 0x00100000,
+
+ WCLK_UART12_26M = (CLK_UART1_WCLK << 24) | 0x00200000,
+ WCLK_UART12_104M = (CLK_UART1_WCLK << 24) | 0x00200100,
+
+ /* SSP WCLK*/
+ WCLK_SSP_0M = (CLK_SSP0_WCLK << 24) | 0x00200301,
+ WCLK_SSP_6M5 = (CLK_SSP0_WCLK << 24) | 0x00200203,
+ WCLK_SSP_13M = (CLK_SSP0_WCLK << 24) | 0x00200201,
+ WCLK_SSP_26M = (CLK_SSP0_WCLK << 24) | 0x00200200,
+ WCLK_SSP_52M = (CLK_SSP0_WCLK << 24) | 0x00200101,
+ WCLK_SSP_78M = (CLK_SSP0_WCLK << 24) | 0x00200001,
+ WCLK_SSP_156M = (CLK_SSP0_WCLK << 24) | 0x00200000,
+
+ /* WDT WCLK*/
+ WCLK_WDT_32K = (CLK_WDT_WCLK << 24) | 0x00100000,
+ WCLK_WDT_26M = (CLK_WDT_WCLK << 24) | 0x00100100,
+
+ /* USIM WCLK */
+ /* usim work clock is fixed 13MHz*/
+ /*WCLK_USIM_13M = (CLK_USIM_WCLK << 24) | 0x0010ffff,*/
+
+ /* RTC WCLK */
+ /* rtc work clock is fixed 32KHz*/
+ /*WCLK_RTC_32K = (CLK_RTC_WCLK << 24) | 0x0010ffff,*/
+
+ /* KEY WCLK */
+ /* KEY work clock is fixed 32KHz*/
+ /*WCLK_KEY_32K = (CLK_RTC_WCLK << 24) | 0x0010ffff,*/
+
+ /*AON_CLK_OUT1*/
+ /*
+ CLK_OUT1_40M = (CLK_WIFI_BT << 24) | 0x00100300,
+ CLK_OUT1_20M = (CLK_WIFI_BT << 24) | 0x00100200,
+ CLK_OUT1_26M = (CLK_WIFI_BT << 24) | 0x00100100,
+ CLK_OUT1_13M = (CLK_WIFI_BT << 24) | 0x00100000,
+ */
+
+} T_ZDrvSysClk_Freq;
+
+#endif
+
+
+typedef enum
+{
+ SYSCLK_DISABLE = 0x100, /*disable software gate */
+ SYSCLK_ENABLE, /*enable software gate */
+ SYSCLK_DISAUTO, /*disable hardware gate */
+ SYSCLK_AUTO, /*enable hardware gate */
+} T_ZDrvSysClk_Gate;
+
+
+/****************************************************************************
+* function
+****************************************************************************/
+/*******************************************************************************
+* Function: zDrvSys_PreInit
+* Description: system previous initialization
+* Parameters:
+* Input:
+*
+* Output:
+*
+* Returns:
+*
+* Others:
+********************************************************************************/
+SINT32 zDrvSys_PreInit(void);
+
+/*******************************************************************************
+* Function: zDrvSys_Initiate
+* Description: system initialization
+* Parameters:
+* Input:
+*
+* Output:
+*
+* Returns:
+*
+* Others:
+********************************************************************************/
+SINT32 zDrvSys_Initiate(void);
+
+/*******************************************************************************
+* Function: zDrvSysClk_IsEnable
+* Description: get clock software gate status
+* Parameters:
+* Input:
+* name: clock number
+*
+* Output: NULL
+*
+* Returns: 0: software gate disable
+* 1: software gate enable
+* DRV_ERR_INVALID_PARAM: invalid parameter
+*
+* Others:
+********************************************************************************/
+SINT32 zDrvSysClk_IsEnable(T_ZDrvSysClk_Name name);
+
+
+/*******************************************************************************
+* Function: zDrvSysClk_IsAutoGate
+* Description: get clock hardware gate status
+* Parameters:
+* Input:
+* name: clock number
+*
+* Output: NULL
+*
+* Returns: 0: hardware gate disable
+* 1: hardware gate enable
+* DRV_ERR_INVALID_PARAM:invalid parameter
+*
+* Others:
+********************************************************************************/
+SINT32 zDrvSysClk_IsAutoGate(T_ZDrvSysClk_Name name);
+
+
+/*******************************************************************************
+ * Function: zDrvSysClk_Reset
+ * Description: set logic to reset status
+ * Parameters:
+ * Input:
+ * name: clock number
+ *
+ * Output: NULL
+ *
+ * Returns: DRV_SUCCESS
+ * DRV_ERR_INVALID_PARAM
+ *
+ * Others:
+ ********************************************************************************/
+SINT32 zDrvSysClk_Reset(T_ZDrvSysClk_Name name);
+
+/*******************************************************************************
+ * Function: zDrvSysClk_Release
+ * Description: set logic out of reset status
+ * Parameters:
+ * Input:
+ * name: clock number
+ *
+ * Output: NULL
+ *
+ * Returns: DRV_SUCCESS
+ * DRV_ERR_INVALID_PARAM
+ *
+ * Others:
+ ********************************************************************************/
+SINT32 zDrvSysClk_Release(T_ZDrvSysClk_Name name);
+
+/*******************************************************************************
+* Function: zDrvSysClk_SetGate
+* Description: set clock gate status
+* Parameters:
+* Input:
+* name: clock number
+* gate: gate status
+* Output: NULL
+*
+* Returns: DRV_SUCCESS
+* DRV_ERR_INVALID_PARAM
+*
+* Others:
+********************************************************************************/
+SINT32 zDrvSysClk_SetGate(T_ZDrvSysClk_Name name, T_ZDrvSysClk_Gate gate);
+
+/*******************************************************************************
+* Function: zDrvSysClk_SetFreq
+* Description: set clock frequency which defined in drvs_sys.h by T_ZDrvSysClk_Freq
+* Parameters:
+ * Input:
+ * name: clock number
+* freq: clock frequency
+* Output: NULL
+*
+* Returns: DRV_SUCCESS
+* DRV_ERR_INVALID_PARAM
+* Others:
+********************************************************************************/
+SINT32 zDrvSysClk_SetFreq(T_ZDrvSysClk_Name name, T_ZDrvSysClk_Freq freq);
+
+#endif
+
+#endif
+
diff --git a/cp/ps/driver/inc/misc/drvs_tdm.h b/cp/ps/driver/inc/misc/drvs_tdm.h
new file mode 100644
index 0000000..8e3d9e2
--- /dev/null
+++ b/cp/ps/driver/inc/misc/drvs_tdm.h
@@ -0,0 +1,342 @@
+/***********************************************************************
+* Copyright (C) 2016, ZTE Corporation.
+*
+* File Name: drvs_tdm.h
+* File Mark:
+* Description: TDM hal interface declaration.
+* Others:
+* Version: v1.0
+* Author: daixunkang
+* Date: 2018-02-26
+*
+* History 1:
+* Date:
+* Version:
+* Author:
+* Modification:
+**********************************************************************/
+#ifndef _HAL_TDM_H
+#define _HAL_TDM_H
+/*************************************************************************
+ * Include files *
+ *************************************************************************/
+#include "drvs_general.h"
+#include "drvs_io_voice.h"
+#include "drvs_i2s.h"
+/*************************************************************************
+ * Macro *
+ *************************************************************************/
+
+
+/**************************************************************************
+* Types *
+ **************************************************************************/
+#define TDM_MOD_CLK_SEL *((volatile UINT32 *)(SOC_CRM_REG_BASE+0x50))
+#define DMA_SEL_CFG *((volatile UINT32 *)(SOC_SYS_REG_BASE+0x120))
+
+typedef enum
+{
+ TDM_NORMAL_MODE,
+ TDM_LOOPBACK_MODE,
+
+ MAX_TDM_TEST_MODE
+} T_ZDrvTdm_TestMode;
+
+typedef enum
+{
+ TDM_MSB_FIRST,
+ TDM_LSB_FIRST,
+
+ MAX_FIRSTBIT
+} T_ZDrvTdm_FstBitSel;
+
+typedef enum {
+ TDM_CLK_8000 = 0x00,
+ TDM_CLK_16000 = 0x01,
+
+ TDM_MAX_CLK
+} T_ZDrvTdm_Clk;
+
+typedef enum
+{
+ TDM_1_SLOT = 0x00,
+ TDM_2_SLOT = 0x01,
+ TDM_3_SLOT = 0x02,
+ TDM_4_SLOT = 0x03,
+ TDM_5_SLOT = 0x04,
+ TDM_6_SLOT = 0x05,
+ TDM_7_SLOT = 0x06,
+ TDM_8_SLOT = 0x07,
+ TDM_9_SLOT = 0x08,
+ TDM_10_SLOT = 0x09,
+ TDM_16_SLOT = 0xa,
+ TDM_32_SLOT = 0xb,
+ TDM_64_SLOT = 0xc,
+ //TDM_128_SLOT = 0x7f,
+
+ MAX_TDM_SLOTNUM
+} T_ZDrvTdm_SlotNum;
+
+typedef enum
+{
+ TDM_TS_8CYCLE = 0x0,
+ TDM_TS_16CYCLE = 0x1,
+ TDM_TS_32CYCLE = 0x2,
+ MAX_TDM_TS_WIDTH
+} T_ZDrvTdm_TsWidth;
+
+/*TDM track select*/
+
+typedef enum
+{
+ TDM_1TS_ENABLE = 0x00,
+ TDM_2TS_ENABLE = 0x01,
+
+ MAX_TDM_TS_ENABLE
+} T_ZDrvTdm_TsEnable;
+
+typedef enum
+{
+ TDM_TX_1BIT_OFFSET = 0x01,
+ TDM_TX_2BIT_OFFSET = 0x02,
+ TDM_TX_3BIT_OFFSET = 0x03,
+ TDM_TX_4BIT_OFFSET = 0x04,
+
+ MAX_TDM_TX_OFFSET
+} T_ZDrvTdm_TxOffset;
+
+typedef enum
+{
+ TDM_RX_1BIT_OFFSET = 0x01,
+ TDM_RX_2BIT_OFFSET = 0x02,
+ TDM_RX_3BIT_OFFSET = 0x03,
+ TDM_RX_4BIT_OFFSET = 0x04,
+
+ MAX_TDM_RX_OFFSET
+} T_ZDrvTdm_RxOffset;
+
+typedef VOID(*T_ZDrvTdm_AUD_PLAY_CB)(VOID);
+/* TDM configuration */
+
+typedef enum
+{
+ TDM_FS_CLK_NEG = 0,
+ TDM_FS_CLK_POS,
+
+ MAX_FS_CLK_SELECT
+} T_ZDrvTdm_FsClkSel;
+
+typedef enum
+{
+ TDM_TX_CLK_NEG = 0,
+ TDM_TX_CLK_POS,
+
+ MAX_TX_CLK_SELECT
+} T_ZDrvTdm_TxClkSel;
+
+typedef enum
+{
+ TDM_RX_CLK_NEG = 0,
+ TDM_RX_CLK_POS,
+
+ MAX_RX_CLK_SELECT
+} T_ZDrvTdm_RxClkSel;
+
+typedef enum
+{
+ TIMING_TDM_FS_1CLK = 0,
+ TIMING_TDM_FS_2CLK,
+ TIMING_TDM_FS_3CLK,
+ TIMING_TDM_FS_4CLK,
+ TIMING_TDM_FS_32CLK = 31,
+
+ MAX_FS_WIDTH
+} T_ZDrvTdm_FsWidth;
+
+typedef enum
+{
+ TIMING_TDM_FS_HIGH = 0,
+ TIMING_TDM_FS_LOW = 1,
+
+ MAX_FS_ACTIVE
+} T_ZDrvTdm_FsActive;
+
+typedef struct
+{
+ BOOL bMaster; /* TRUE: master mode; FALSE: slave mode */
+ UINT32 sample_rate;
+ T_ZDrvTdm_FsClkSel fsClkSel;
+ T_ZDrvTdm_TxClkSel txClkSel;
+ T_ZDrvTdm_RxClkSel rxClkSel;
+ T_ZDrvTdm_TsWidth tTsWidth; /*T_ZDrvTDM_TsWidth*/
+ T_ZDrvTdm_SlotNum tSlotNum;
+ T_ZDrvTdm_FsWidth tFsWidth;
+ T_ZDrvTdm_FsActive tFsActive;
+ T_ZDrvTdm_FstBitSel tTdmFstBit;
+ T_ZDrvTdm_TestMode tTestMode;
+ T_ZDrvTdm_TsEnable tTsEnable;
+ T_ZDrvTdm_TxOffset tTxOffset;
+ T_ZDrvTdm_RxOffset tRxOffset;
+ //T_Tdm_RefClkForTdm refclk;
+
+} T_ZDrvTdm_Cfg;
+
+typedef struct
+{
+ T_ZDrvAudio_Channel channel;
+ UINT32 buffersize;
+ T_ZDrvTdm_AUD_PLAY_CB p_cb;
+} T_ZDrvTdm_Params;
+
+/**************************************************************************
+ * Global Variable *
+ **************************************************************************/
+
+
+/**************************************************************************
+ * Function Prototypes *
+ **************************************************************************/
+/**************************************************************************
+* Function: zDrvTDM_Open
+* Description: This function is used to open a specified TDM device.
+* Parameters:
+* (IN)
+* tId: TDM index
+* (OUT)
+* None.
+* Returns:
+* DRV_SUCCESS: successed.
+* DRV_ERR_NOT_SUPPORTED: this device don't support ioctrl operation.
+* DRV_ERR_INVALID_PARAM: the input parameters are invalid
+* DRV_ERR_OPEN_TIMES: has already been opened
+* DRV_ERROR: error
+* others: others programmer defined error code. for detailed information, please contact with the programmer
+* Others:
+* others error code should be a negative number, and not equal to the value that already be defined in T_ZDrv_ErrCode in drv_pub.h.
+**************************************************************************/
+SINT32 zDrvTdm_Open(T_ZDrvI2s_TransMode tdmTransMode);
+
+SINT32 zDrvTdm_Reset();
+
+/**************************************************************************
+* Function: zDrvTDM_Close
+* Description: This function is used to close a specified TDM device.
+* Parameters:
+* (IN)
+* tId: TDM index
+* (OUT)
+* None.
+* Returns:
+* DRV_SUCCESS: successed.
+* DRV_ERR_NOT_SUPPORTED: this device don't support ioctrl operation.
+* DRV_ERR_NOT_OPENED: has not been opend yet.
+* DRV_ERR_INVALID_PARAM: the input parameters are invalid
+* DRV_ERROR: error
+* others: others programmer defined error code. for detailed information, please contact with the programmer
+* Others:
+* others error code should be a negative number, and not equal to the value that already be defined in T_ZDrv_ErrCode in drv_pub.h.
+* must match the use of zDrvTDM_Open.
+**************************************************************************/
+SINT32 zDrvTdm_Close();
+
+/**************************************************************************
+* Function: zDrvTDM_Start
+* Description: This function is used to start TDM.
+* Parameters:
+* (IN)
+* tId: TDM index
+* (OUT)
+* None.
+* Returns:
+* DRV_SUCCESS: successed.
+* DRV_ERR_NOT_SUPPORTED: this device don't support ioctrl operation.
+* DRV_ERR_NOT_OPENED: has not been opend yet.
+* DRV_ERR_START_TIMES: has been started already.
+* DRV_ERR_INVALID_PARAM: the input parameters are invalid
+* DRV_ERROR: error
+* others: others programmer defined error code. for detailed information, please contact with the programmer
+* Others:
+* others error code should be a negative number, and not equal to the value that already be defined in T_ZDrv_ErrCode in drv_pub.h.
+**************************************************************************/
+SINT32 zDrvTdm_Start(UINT32 buf_size);
+
+/**************************************************************************
+* Function: zDrvTDM_Stop
+* Description: This function is used to stop TDM.
+* Parameters:
+* (IN)
+* tId: TDM index
+* (OUT)
+* None.
+* Returns:
+* DRV_SUCCESS: successed.
+* DRV_ERR_NOT_SUPPORTED: this device don't support ioctrl operation.
+* DRV_ERR_NOT_STARTED: has not been started yet.
+* DRV_ERR_INVALID_PARAM: the input parameters are invalid
+* DRV_ERROR: error
+* others: others programmer defined error code. for detailed information, please contact with the programmer
+* Others:
+* others error code should be a negative number, and not equal to the value that already be defined in T_ZDrv_ErrCode in drv_pub.h.
+* must match the use of zDrvTDM_Start.
+**************************************************************************/
+SINT32 zDrvTdm_Write_Stop();
+SINT32 zDrvTdm_Read_Stop();
+
+/**************************************************************************
+* Function: zDrvTDM_Read
+* Description: This function is used to read data by TDM.
+* Parameters:
+* (IN)
+* tId: TDM index
+* uiLen: buffer length
+* (OUT)
+* pBuf: pointer to the read data buffer
+* Returns:
+* the real byte number of read data if successed
+* DRV_ERR_NOT_SUPPORTED: this device don't support ioctrl operation.
+* DRV_ERR_NOT_STARTED: has not been started yet.
+* DRV_ERR_INVALID_PARAM: the input parameters are invalid
+* DRV_ERROR: error
+* others: others programmer defined error code. for detailed information, please contact with the programmer
+* Others:
+* others error code should be a negative number, and not equal to the value that already be defined in T_ZDrv_ErrCode in drv_pub.h.
+**************************************************************************/
+SINT32 zDrvTdm_Read(UINT8 **pBuf, UINT32 *uiLen);
+
+/**************************************************************************
+* Function: zDrvTDM_Write
+* Description: This function is used to write data by TDM.
+* Parameters:
+* (IN)
+* tId: TDM index
+* pBuf: pointer to the read data buffer
+* uiLen: buffer length
+* (OUT)
+* None.
+* Returns:
+* the real byte number of write data if successed
+* DRV_ERR_NOT_SUPPORTED: this device don't support ioctrl operation.
+* DRV_ERR_NOT_STARTED: has not been started yet.
+* DRV_ERR_INVALID_PARAM: the input parameters are invalid
+* DRV_ERR_BUSY: now is transfering data
+* DRV_ERROR: error
+* others: others programmer defined error code. for detailed information, please contact with the programmer
+* Others:
+* others error code should be a negative number, and not equal to the value that already be defined in T_ZDrv_ErrCode in drv_pub.h.
+**************************************************************************/
+SINT32 zDrvTdm_Write(const UINT8 *pBuf, UINT32 uiLen);
+
+SINT32 zDrvTdm_Write_Start(T_ZDrvTdm_Params *params, T_ZDrvTdm_Cfg *ptCfg);
+SINT32 zDrvTdm_Read_Start(T_ZDrvTdm_Params *params, T_ZDrvTdm_Cfg *ptCfg);
+SINT32 zDrvTdm_Vousb_Start(T_ZDrvTdm_Params *params, T_ZDrvTdm_Cfg *ptCfg);
+
+SINT32 zDrvTdm_GetBuf(UINT8 **pBuf, UINT32 *uiLen);
+SINT32 zDrvTdm_GetRemained(UINT32 *len);
+SINT32 zDrvTdm_FreeBuf(UINT8 *pBuf);
+VOID zDrvTdm_Pause();
+VOID zDrvTdm_Resume();
+
+VOID zDrvTdm_RxRlsSemaBeforeStop();
+VOID zDrvTdm_TxRlsSemaBeforeStop();
+
+#endif /* _HAL_TDM_H */
diff --git a/cp/ps/driver/inc/misc/drvs_timer.h b/cp/ps/driver/inc/misc/drvs_timer.h
new file mode 100644
index 0000000..0738e06
--- /dev/null
+++ b/cp/ps/driver/inc/misc/drvs_timer.h
@@ -0,0 +1,300 @@
+/*******************************************************************************
+ * Copyright (C) 2014, ZTE Corporation.
+ *
+ * File Name:
+ * File Mark:
+ * Description: all function defines provided by sys module
+ * Others:
+ * Version: 1.0
+ * Author: limeifeng
+ * Date: 2014-01-17
+ * History 1:
+ * Date:
+ * Version:
+ * Author:
+ * Modification:
+ * History 2:
+ ********************************************************************************/
+
+#ifndef _DRVS_TIMER_H
+#define _DRVS_TIMER_H
+
+/****************************************************************************
+* Include files
+****************************************************************************/
+#ifdef _OS_LINUX
+#include <linux/delay.h>
+#endif
+
+/****************************************************************************
+* Macros
+****************************************************************************/
+
+#define SYSTIMER_INT TIMER0_INT
+
+/****************************************************************************
+* Types
+****************************************************************************/
+
+
+typedef enum _T_ZDrv_TimerId
+{
+ TIMER0 = 0,/*ps timer0--sysTick */
+ TIMER1 = 1,/*ps timer1--psm wake timer,must AON tiner**/
+ TIMER2 = 2,/*ps timer2--psm compensate timer,must AON tiner*/
+ TIMER3 = 3,/* rm timer1*/
+ TIMER4 = 4,/*ps rm timer--uicc timer*/
+ NUM_TIMERS
+}T_ZDrv_TimerId;
+
+typedef enum _T_ZDrv_TIMER_SRC_CLK
+{
+ CLK_32K = 0,
+ CLK_26M,
+}T_ZDrv_TIMER_SRC_CLK;
+
+typedef enum _T_ZDrv_TIMER_SRC_DIV
+{
+ CLK_DIV0 = 0,
+ CLK_DIV2 = 1,
+ CLK_DIV4 = 3,
+ CLK_DIV6 = 5,
+ CLK_DIV8 = 7,
+ CLK_DIV10 = 9,
+ CLK_DIV12 = 11,
+ CLK_DIV14 = 13,
+ CLK_DIV16 = 15,
+ CLK_DIV_NUM,
+}T_ZDrv_TIMER_SRC_DIV;
+
+typedef enum _T_ZDrv_CLK_PTV
+{
+ CLK_PTV0 =0, /*not divide the work clock*/
+ CLK_PTV1 , /*divide the work clock 2 times*/
+ CLK_PTV2, /*divide the work clock 4 times*/
+ CLK_PTV3, /*divide the work clock 8 times*/
+ CLK_PTV4,
+ CLK_PTV5,
+ CLK_PTV6,
+ CLK_PTV7,
+ CLK_PTV8,
+ CLK_PTV9,
+ CLK_PTV10,
+ CLK_PTV11,
+ CLK_PTV12,
+ CLK_PTV13,
+ CLK_PTV14,
+ CLK_PTV15,
+ CLK_PTV16,
+ CLK_PTV17,
+ CLK_PTV18,
+ CLK_PTV19,
+ CLK_PTV20,
+ CLK_PTV21,
+ CLK_PTV22,
+ CLK_PTV23,
+ CLK_PTV24,
+ CLK_PTV25,
+ CLK_PTV26,
+ CLK_PTV27,
+ CLK_PTV28,
+ CLK_PTV29,
+ CLK_PTV30,
+ CLK_PTV31, /*divide the work clock 2**31 times*/
+ CLK_PTV_NUM,
+}T_ZDrv_CLK_PTV;
+
+/*CLK_1MHz: src_clk=26MHz CLK_1KHz: src_clk=32KHz.*/
+typedef enum _T_ZDrv_TIMER_CLK
+{
+ CLK_1MHz = 0,
+ CLK_1KHz,
+ TIMER_CLK_NUM,
+}T_ZDrv_TIMER_CLK;
+
+typedef VOID (*ZDRV_TIMER_CALLBACK)(VOID);
+typedef VOID (*ZDRV_TIMER_ISR_CALLBACK)( UINT32 uiTimerId );
+
+/****************************************************************************
+* Constants
+****************************************************************************/
+
+/****************************************************************************
+* Global Variables
+****************************************************************************/
+
+/****************************************************************************
+* Function Prototypes
+****************************************************************************/
+
+
+/*******************************************************************************
+ * Function: zDrvTimer_Stamp
+ * Description:¸Ãº¯ÊýÓÃÓÚ»ñȡϵͳtimerÆô¶¯ºóµÄϵͳÕý³£ÔËÐеľø¶Ôʱ¼ä£¬²»°üº¬ÏµÍ³¹ØÖжÏ
+ * ³¬¹ý1ms£¬ÒÔ¼°ÏµÍ³Ë¯ÃßµÄʱ¼ä²¹³¥¡£
+ * Parameters:
+ * Input:
+ *
+ * Output: ϵͳÔËÐÐʱ¼ä£¬26M(µ¥Î»:us) 32K(µ¥Î»:ms)
+ *
+ * Returns:
+ *
+ * Others:
+ ********************************************************************************/
+UINT32 zDrvTimer_Stamp( VOID );
+
+/**************************************************************************
+* Functin: zDrvTimer_Create
+* Description: This function is used to create a timer.
+* Parameters:
+* (IN)
+* pCallback: callback function pointer.
+* bPeriod: if auto-restart after the interval val reached zero
+* (OUT)
+* None.
+* Returns:
+* timer id if successed. [1, timers number )
+* DRV_ERROR if failed.
+* Others:
+* None.
+**************************************************************************/
+SINT32 zDrvTimer_Create( ZDRV_TIMER_CALLBACK pCallback, BOOL bPeriod );
+
+
+/**************************************************************************
+* Functin: zDrvTimer_Release
+* Description: This function is used to release a timer.
+* Parameters:
+* (IN)
+* uiTimerId: the id of created timer.
+* (OUT)
+* None.
+* Returns:
+* DRV_SUCCESS: successed.
+* DRV_ERROR if failed.
+* Others:
+* None.
+**************************************************************************/
+SINT32 zDrvTimer_Release( UINT32 uiTimerId );
+
+/**************************************************************************
+* Functin: zDrvTimer_Start
+* Description: This function is used to start a timer.
+* Parameters:
+* (IN)
+* uiTimerId: the id of created timer.
+* uiDuration: time length. Unit: us
+* (OUT)
+* None.
+* Returns:
+* DRV_SUCCESS: successed.
+* DRV_ERROR if failed.
+* Others:
+* None.
+**************************************************************************/
+SINT32 zDrvTimer_Start( UINT32 uiTimerId, UINT32 uiDuration );
+
+/*******************************************************************************
+ * Function:zDrvTimer_SetWorkClk
+ * Description:ÉèÖÃTIMER_ID µÄʱÖÓԴƵÂÊÊ¡µçרÓã¬ÆäËüÄ£¿é²»ÔÊÐíµ÷ÓÃ
+ * Parameters:
+ * Input:TIMER_ID : Timer ID , zDrvTimer_Open µÄÈë²Î¡£
+ * tick: CLK_1MHz£¬Ê±ÖÓÔ´Ñ¡Ôñ26M¡£
+ CLK_1KHz£¬ ʱÖÓÔ´Ñ¡Ôñ32K¡£
+ * Output:³É¹¦·µ»ØDRV_SUCCESS£¬ÆäËûÖµ±íʾʧ°ÜÔÒò¡£
+ *
+ * Returns:
+ *
+ *
+ * Others:Ê¡µçרÓã¬ÆäËüÄ£¿é²»ÔÊÐíµ÷ÓÃ!!!
+ ********************************************************************************/
+SINT32 zDrvTimer_SetWorkClk(T_ZDrv_TimerId TIMER_ID, T_ZDrv_TIMER_CLK tick);
+/*******************************************************************************
+* Function: zDrvTimer_SetCallBack
+* Description: ¿ÉÒÔÔÚzDrvTimer_StartTimerº¯ÊýÖÐÉ趨»Øµ÷º¯Êý¶ø²»Óô˺¯Êý
+* ´Ëº¯ÊýÌṩһÖÖÔÚzDrvTimer_StartTimerÖ®Íâ×¢²á»Øµ÷µÄ·½·¨¡£
+* Parameters:
+* Input:uiTimerId : Timer ID , zDrvTimer_Open µÄ·µ»ØÖµ
+* fIsrCb: Ï£ÍûÔÚ¶¨Ê±µ½0ʱµÄtimerÖжÏISRÖÐÖ´ÐеĻص÷º¯Êý¡£
+* Output:
+*
+* Returns:
+*
+* Others:Ê¡µçרÓã¬ÆäËüÄ£¿é²»ÔÊÐíµ÷ÓÃ!!!
+********************************************************************************/
+SINT32 zDrvTimer_SetCallBack(T_ZDrv_TimerId uiTimerId, ZDRV_TIMER_ISR_CALLBACK fIsrCb);
+
+/*******************************************************************************
+ * Function:zDrvTimer_Open
+ * Description:µ÷ÓÃÁ÷³Ì:zDrvTimer_Open->zDrvTimer_SetWorkClk->zDrvTimer_StartTimer->zDrvTimer_Close
+ * Parameters:
+ * Input:
+ *
+ * Output:
+ *
+ * Returns:
+ *
+ *
+ * Others:Ê¡µçרÓã¬ÆäËüÄ£¿é²»ÔÊÐíµ÷ÓÃ
+ ********************************************************************************/
+SINT32 zDrvTimer_Open( T_ZDrv_TimerId TIMER_ID);
+/*******************************************************************************
+ * Function:zDrvTimer_Close
+ * Description:¹Ø±Õ¶ÔÓ¦¶¨Ê±Æ÷²¢Ð¶ÔØÖжÏ
+ * Parameters:
+ * Input:
+ *
+ * Output:
+ *
+ * Returns:³É¹¦·µ»ØDRV_SUCCESS£¬ÆäËûÖµ±íʾʧ°ÜÔÒò¡£
+ *
+ *
+ * Others:Ê¡µçרÓã¬ÆäËüÄ£¿é²»ÔÊÐíµ÷ÓÃ!!!
+ ********************************************************************************/
+SINT32 zDrvTimer_Close( T_ZDrv_TimerId uiTimerId );
+/*******************************************************************************
+ * Function:zDrvTimer_StartTimer
+ * Description:
+ * Parameters:
+ * Input:
+ *
+ * Output:
+ *
+ * Returns:³É¹¦·µ»ØDRV_SUCCESS£¬ÆäËûÖµ±íʾʧ°ÜÔÒò¡£
+ *
+ *
+ * Others:Ê¡µçרÓã¬ÆäËüÄ£¿é²»ÔÊÐíµ÷ÓÃ!!!
+ ********************************************************************************/
+SINT32 zDrvTimer_StartTimer( T_ZDrv_TimerId uiTimerId, UINT32 uiDuration, BOOL bPeriod , ZDRV_TIMER_ISR_CALLBACK fIsrCb );
+
+/*******************************************************************************
+ * Function:zDrvTimer_Remain
+ * Description:²éѯµ±Ç°¶¨Ê±Æ÷Ê£Óඨʱʱ¼ä¡£
+ * Parameters:
+ * Input:
+ *
+ * Output:
+ *
+ * Returns:Ê£Óඨʱʱ¼ä£¬µ¥Î»¸ù¾ÝzDrvTimer_SetWorkClkº¯ÊýÉèÖõÄʱÖÓԴƵÂÊÈ·¶¨
+ * ʱÖÓԴΪ1M_HZʱµ¥Î»Îªus£¬1K_HZʱµ¥Î»Îªms¡£
+ *
+ *
+ * Others:Ê¡µçרÓã¬ÆäËüÄ£¿é²»ÔÊÐíµ÷ÓÃ!!!
+ ********************************************************************************/
+UINT32 zDrvTimer_Remain( T_ZDrv_TimerId uiTimerId );
+/*******************************************************************************
+ * Function:zDrvTimer_StopTimer
+ * Description:Í£Ö¹¶¨Ê±Æ÷¼ÆÊ±¡£
+ * Parameters:
+ * Input:
+ *
+ * Output:
+ *
+ * Returns:³É¹¦·µ»ØDRV_SUCCESS£¬ÆäËûÖµ±íʾʧ°ÜÔÒò¡£
+ *
+ *
+ * Others:Ê¡µçרÓã¬ÆäËüÄ£¿é²»ÔÊÐíµ÷ÓÃ!!!
+ ********************************************************************************/
+SINT32 zDrvTimer_StopTimer( T_ZDrv_TimerId uiTimerId );
+#endif/*_DRVS_TIMER_H*/
+
diff --git a/cp/ps/driver/inc/misc/drvs_tsc.h b/cp/ps/driver/inc/misc/drvs_tsc.h
new file mode 100644
index 0000000..634be99
--- /dev/null
+++ b/cp/ps/driver/inc/misc/drvs_tsc.h
@@ -0,0 +1,235 @@
+/*******************************************************************************
+ * Copyright (C) 2014, ZTE Corporation.
+ *
+ * File Name:
+ * File Mark:
+ * Description:
+ * Others:
+ * Version: v1.0
+ * Author:
+ * Date: 2015-09-11
+ * History 1:
+ * Date:
+ * Version:
+ * Author:
+ * Modification:
+ * History 2:
+ ********************************************************************************/
+
+#ifndef _DRVS_TSC_H
+#define _DRVS_TSC_H
+
+/****************************************************************************
+* Include files
+****************************************************************************/
+#include "ram_config.h"
+
+/****************************************************************************
+* Types
+****************************************************************************/
+ typedef enum _T_TsCtrl_Probe
+{
+ PROBE_ADC1 = 0,
+ PROBE_ADC2,
+ PROBE_RESEV1,
+ PROBE_RESEV2,
+ PROBE_RESEV3,
+ PROBE_RESEV4,
+ PROBE_MAX,
+} Ts_TsCtrl_Probe;
+
+ typedef enum _T_Ts_Temp_interregional
+ {
+ TS_TEMP_INTERVAL_T0 = 0,
+ TS_TEMP_INTERVAL_T1,
+ TS_TEMP_INTERVAL_T2,
+ TS_TEMP_INTERVAL_T3,
+ TS_TEMP_INTERVAL_T4,
+ TS_TEMP_INTERVAL_T5,
+ TS_TEMP_INTERVAL_T6,
+ TS_TEMP_INTERVAL_T7,
+ TS_TEMP_INTERVAL_MAX
+ }Ts_Temp_interregional;
+ typedef enum
+ {
+ TS_TEMP_VALUE_TABLE_NUMBER = 0,
+ TS_TEMP_VOLTAGE_TABLE_NUMBER = 1,
+ TS_TEMP_TABLE_NUMBER_MAX
+ }TS_TEMP_TABLE_NUMBER;
+
+ typedef enum _T_Ts_Member
+ {
+ TS_MEMBER_PROBE = 0,
+ TS_MEMBER_TEMP,
+
+ TS_MEMBER_MAX,
+ } Ts_Member;
+
+
+ typedef enum _T_TsCtrl_Strategy_Id
+{
+ PS_STRATEGY_RATE = 0,
+ PS_STRATEGY_ANYRESIDENT,
+ WIFI_STRATEGY,
+ CHARGER_STRATEGY,
+ AP_RATE,
+ MAX_TSCTRL_STRATEGY_ID
+} T_TsCtrl_Strategy_ModuleId;
+
+/**************************************************
+ 0--STRTEGY_STOP: ֹͣ
+ 1--STRTEGY_START: ¿ªÊ¼
+ 2--STRTEGY_HOLD: HOLD֮ǰ²ßÂÔ
+**************************************************/
+ typedef enum _T_TsCtrl_Strategy
+ {
+ STRTEGY_STOP = 0,
+ STRTEGY_START=1,
+ STRTEGY_HOLD=2,
+
+ STRTEGY_MAX,
+ } Ts_TsCtrlStrategy;
+ /****************************************************************************
+ * Global Function Prototypes
+ ****************************************************************************/
+typedef struct _T_ZDrvTsc_Opt
+{
+ VOID (*tsc_RefGetAdcvalue)(SINT32 adcValue, UINT32 *temp);
+ VOID (*tsc_RefSetProbeStr)(UINT32 probe_num,UINT32 temperature );
+ VOID (*tsc_RefStrategyDispatch)(VOID);
+
+}T_ZDrvTsc_Opt;
+/****************************************************************************
+* macro define
+****************************************************************************/
+#define tsc_SetRegBit(regName, bitAddr, bitValue) \
+ do{ \
+ if(bitValue == TRUE) \
+ reg32(regName) |= (0x1<<bitAddr); \
+ else \
+ reg32(regName) &= ~(0x1<<bitAddr); \
+ }while(0)
+
+#define tsc_SetRegBits(regName, bitsAddr, bitsLen, bitsValue) \
+ do{ \
+ reg32(regName) = (reg32(regName)&(~(((0x1<<bitsLen)-0x1)<<bitsAddr)))|(bitsValue<<bitsAddr);\
+ }while(0)
+
+
+/**/
+#define STRATEGY_PHY_NUM 8
+#define BITS_FOR_PHYIRAM 1
+/*TSCTRL_PHY iram ÿһbit±íʾPHYµÄÒ»¸ö²ßÂÔÊÇ·ñÖ´ÐÐ*/
+#define BIT_LIMIT_LTE_DOWNRATE1 0
+#define BIT_LIMIT_LTE_DOWNRATE2 1
+#define BIT_LIMIT_W_DOWNRATE1 2
+#define BIT_LIMIT_W_DOWNRATE2 3
+#define BIT_LIMIT_LTE_UPTRANSIMITPOWER1 4
+#define BIT_LIMIT_LTE_UPTRANSIMITPOWER2 5
+#define BIT_LIMIT_W_UPTRANSIMITPOWER1 6
+#define BIT_LIMIT_W_UPTRANSIMITPOWER2 7
+/**/
+//#define STRATEGY_PS_NUM 2
+#define BITS_FOR_PSIRAM 4
+/*TSCTRL_PS iram ÿËÄbit±íʾPSµÄÒ»¸ö²ßÂÔÊÇ·ñÖ´ÐÐ*/
+#define BIT_PS_RATE 0
+#define BIT_PS_ANYRESIDENT 4
+#define BIT_SHUTDOWN 8
+/**/
+//#define STRATEGY_PERIP_NUM 2
+#define BITS_FOR_PEPIPIRAM 4
+/*TSCTRL_PERIP iram ÿËÄbit±íʾTSCTRL_PERIPµÄÒ»¸ö²ßÂÔÊÇ·ñÖ´ÐÐ*/
+#define BIT_WIFI 0
+#define BIT_CHHRGER 4
+#define BIT_APRATE 8
+
+/**/
+//#define STRATEGY_AP_NUM 2
+#define BITS_FOR_APPIRAM 4
+/*TSCTRL_AP iram ÿËÄbit±íʾAPµÄÒ»¸ö²ßÂÔÊÇ·ñÖ´ÐÐ*/
+
+
+/*TSCTRL_PHY iramInfo:ÿһbit±íʾPHYµÄÒ»¸ö²ßÂÔÊÇ·ñÖ´ÐÐ
+bit0:limit_ltedownrate1 1:ÏÞÖÆlteÏÂÐÐËÙÂÊ1£»0:Í£Ö¹ÏÞÖÆlteÏÂÐÐËÙÂÊ1
+bit1:limit_ltedownrate2 1:ÏÞÖÆlteÏÂÐÐËÙÂÊ2£»0:Í£Ö¹ÏÞÖÆlteÏÂÐÐËÙÂÊ2
+bit2:limit_wdownrate1 1:ÏÞÖÆwÏÂÐÐËÙÂÊ1£»0:Í£Ö¹ÏÞÖÆwÏÂÐÐËÙÂÊ1
+bit3:limit_wdownrate2 1:ÏÞÖÆwÏÂÐÐËÙÂÊ2£»0:Í£Ö¹ÏÞÖÆwÏÂÐÐËÙÂÊ2
+bit4:limit_lteuptransmitrate1 1:ÏÞÖÆlteÉÏÐз¢É书ÂÊ1£»0:Í£Ö¹ÏÞÖÆlteÉÏÐз¢É书ÂÊ1
+bit5:limit_lteuptransmitrate2 1:ÏÞÖÆlteÉÏÐз¢É书ÂÊ2£»0:Í£Ö¹ÏÞÖÆlteÉÏÐз¢É书ÂÊ2
+bit6:limit_wuptransmitrate1 1:ÏÞÖÆwÉÏÐз¢É书ÂÊ1£»0:Í£Ö¹ÏÞÖÆwÉÏÐз¢É书ÂÊ1
+bit7:limit_wuptransmitrate2 1:ÏÞÖÆwÉÏÐз¢É书ÂÊ2£»0:Í£Ö¹ÏÞÖÆwÉÏÐз¢É书ÂÊ2
+*/
+#define TSCTRL_PHY (IRAM_BASE_ADDR_TPC+0x00)/* 1K£IRAM_BASE_ADDR_TPC++0x400--¬Â¿ØÊý¾Ý´æ·Å */
+
+/*TSCTRL_PHY+0x04--TSCTRL_PHY+0x44
+ÿ4 bit±íʾÿ¸ö̽²âµãÊÇ·ñÐèÒªÖ´ÐвßÂÔ1:Ö´ÐÐ0:²»Ö´ÐÐ;2 HOLD*/
+#define TSCTRL_PS (TSCTRL_PHY+0x04)
+#define TSCTRL_AP (TSCTRL_PHY+0x08)
+#define TSCTRL_PERIP (TSCTRL_PHY+0x0C)
+
+/*ÿ4 bit±íʾÿ¸ö̽²âµãÊÇ·ñÐèÒªÖ´ÐвßÂÔ1:Ö´ÐÐ0:²»Ö´ÐÐ;2 HOLD*/
+#define TSCTRL_LIMIT_LTE_DOWNRATE1 (TSCTRL_PHY+0x10) /*²ßÂÔA*/
+#define TSCTRL_LIMIT_LTE_DOWNRATE2 (TSCTRL_PHY+0x14) /*²ßÂÔB*/
+#define TSCTRL_LIMIT_W_DOWNRATE1 (TSCTRL_PHY+0x18) /*²ßÂÔA*/
+#define TSCTRL_LIMIT_W_DOWNRATE2 (TSCTRL_PHY+0x1c) /*²ßÂÔB*/
+#define TSCTRL_LIMIT_LTE_UPTRANSIMITPOWER1 (TSCTRL_PHY+0x20) /*²ßÂÔC*/
+#define TSCTRL_LIMIT_LTE_UPTRANSIMITPOWER2 (TSCTRL_PHY+0x24) /*²ßÂÔD*/
+#define TSCTRL_LIMIT_W_UPTRANSIMITPOWER1 (TSCTRL_PHY+0x28) /*²ßÂÔC*/
+#define TSCTRL_LIMIT_W_UPTRANSIMITPOWER2 (TSCTRL_PHY+0x2c) /*²ßÂÔD*/
+#define TSCTRL_PS_RATE (TSCTRL_PHY+0x30) /*²ßÂÔE*/
+#define TSCTRL_PS_ANYRESIDENT (TSCTRL_PHY+0x34) /*²ßÂÔF*/
+#define TSCTRL_SHUTDOWN (TSCTRL_PHY+0x38) /*²ßÂÔG*/
+#define TSCTRL_WIFI (TSCTRL_PHY+0x3c) /*²ßÂÔF*/
+#define TSCTRL_CHARGER (TSCTRL_PHY+0x40) /*²ßÂÔF*/
+#define TSCTRL_APRATE (TSCTRL_PHY+0x44) /*²ßÂÔF*/
+#define TSCTRL_DFS (TSCTRL_PHY+0x48) /*²ßÂÔDFS*/
+
+/*ÿ¸ö̽Õë¶Ô²ßÂԵĿª¹ØÐÅÏ¢ÔÚ´æ´¢²ßÂÔIRAMµÄÆðʼbitλ*/
+#define BITS_FOR_PROBES 4
+#define BIT_PROBE_ADC1 (PROBE_ADC1*BITS_FOR_PROBES)
+#define BIT_PROBE_ADC2 (PROBE_ADC2*BITS_FOR_PROBES)
+#define BIT_PROBE_RESEV1 (PROBE_RESEV1*BITS_FOR_PROBES)
+#define BIT_PROBE_RESEV2 (PROBE_RESEV2*BITS_FOR_PROBES)
+#define BIT_PROBE_RESEV3 (PROBE_RESEV3*BITS_FOR_PROBES)
+#define BIT_PROBE_RESEV (PROBE_RESEV4*BITS_FOR_PROBES)
+
+
+/*Ô¤Áô²¿·Ö¿Õ¼äÓÃÀ´´æ´¢ÐèÒªR7´«µÝµ½A9µÄÐÅÏ¢,TSCTRL_PHY+0x100--TSCTRL_PHY+0x400*/
+#define TSCTRL_TEMPADC1 (TSCTRL_PHY+0x100) /*temp adc1*/
+#define TSCTRL_TEMPADC2 (TSCTRL_PHY+0x104) /*temp adc2*/
+#define TSCTRL_TEMPREV1 (TSCTRL_PHY+0x108) /*temp rev1*/
+#define TSCTRL_TEMPREV2 (TSCTRL_PHY+0x10c) /*temp rev2*/
+#define TSCTRL_TEMPREV3 (TSCTRL_PHY+0x110) /*temp rev3*/
+#define TSCTRL_TEMPREV4 (TSCTRL_PHY+0x114) /*temp rev3*/
+#define TSCTRL_DETECT_EN (TSCTRL_PHY+0x118) /*TsNvData.DetectEn*/
+#define TSCTRL_TEMP_PERCENT (TSCTRL_PHY+0x11c) /*APrate ,g_tempPercent*/
+
+/**/
+#define PROBE_NUM PROBE_MAX
+#define PROBE_INFO 2 //fixed value, probe num and temp
+#define TS_ADC_TEMP_NUMBER 2
+#define TS_ADC_TEMP_VOLTAGE_NUMBER 110
+#define TS_TEMP_NUMBER_SMALLEST 0
+#define TS_TEMP_NUMBER_BIGGEST 96
+
+#define TSC_DEBUG_DEF
+
+#ifdef TSC_DEBUG_DEF
+#define TSC_DEBUG(s...) zOss_Printf(1,1, ##s) /*ramlog_Printf(RAMLOG_MOD_CHARGER, ##s)*/
+#else
+#define TSC_DEBUG(s...)
+#endif
+ /****************************************************************************
+* fuction extern
+****************************************************************************/
+
+typedef VOID (* T_TsCtrl_CallbackFunction)( UINT8 en ); /*en: 1,Æô¶¯²ßÂÔ£¬0,Í£Ö¹²ßÂÔ; 2: hold ²ßÂÔ*/
+SINT32 zDrvTsc_SetOpt(T_ZDrvTsc_Opt* pTscOpt);
+
+extern SINT32 zDrvTsCtrl_RegCallback(T_TsCtrl_Strategy_ModuleId module,T_TsCtrl_CallbackFunction callback);
+extern SINT32 zDrvTsc_SetTscEn(UINT8 val); //val:0xB2,οشò¿ª£» ÆäËûֵοعرÕ
+extern SINT32 zDrvTsc_GetTscEn(VOID);
+VOID zDrvTsc_GetTscTempPercent(UINT32 *percent);
+//UINT32 *zDrvTsc_GetTscDbbProbTemp(void);
+#endif
+
diff --git a/cp/ps/driver/inc/misc/drvs_tu.h b/cp/ps/driver/inc/misc/drvs_tu.h
new file mode 100644
index 0000000..7c0e782
--- /dev/null
+++ b/cp/ps/driver/inc/misc/drvs_tu.h
@@ -0,0 +1,83 @@
+/***********************************************************************
+* Copyright (C) 2001, ZTE Corporation.
+*
+* File Name: hal_kpd.h
+* File Mark:
+* Description: tu hal interface declaration.
+* Others:
+* Version: v1.0
+* Author: yan junhua
+* Date: 2007-10-19
+*
+* History 1:
+* Date:
+* Version:
+* Author:
+* Modification:
+
+* History 2:
+**********************************************************************/
+
+#ifndef _DRVS_TU_H
+#define _DRVS_TU_H
+
+
+/*************************************************************************
+ * Include files *
+ *************************************************************************/
+
+
+/*************************************************************************
+ * Macro *
+ *************************************************************************/
+
+
+/**************************************************************************
+ * Types *
+ **************************************************************************/
+typedef enum
+{
+ TU_GP0_INT,
+ TU_GP1_INT,
+ TU_GP2_INT,
+ TU_GP3_INT,
+ TU_GP4_INT,
+ TU_T_INT1,
+ TU_T_INT2,
+
+ MAX_TU_INT
+} T_ZDrvTu_IntId;
+
+typedef VOID (*T_ZDRVTU_CALLBACK)(VOID);
+
+
+/**************************************************************************
+ * Global Variable *
+ **************************************************************************/
+
+
+/**************************************************************************
+ * Function Prototypes *
+ **************************************************************************/
+/**************************************************************************
+* Functin: zDrvTu_IntRegister
+* Description: This function is used to regist isr callback for l1g.
+* Parameters:
+* (IN)
+* tId: T_ZDrvTu_IntId.
+* fCallback: isr callback.
+* (OUT)
+* None.
+* Returns:
+* DRV_SUCCESS: successed.
+* DRV_ERR_NOT_SUPPORTED: this device don't support ioctrl operation.
+* DRV_ERR_INVALID_PARAM: the input parameters are invalid
+* DRV_ERROR: error
+* others: others programmer defined error code. for detailed information, please contact with the programmer
+* Others:
+* others error code should be a negative number, and not equal to the value that already be defined in T_ZDrv_ErrCode in drv_pub.h.
+**************************************************************************/
+SINT32
+zDrvTu_IntRegister( T_ZDrvTu_IntId tId, T_ZDRVTU_CALLBACK fCallback,UINT32 intPrio);
+
+#endif /* _DRVS_TU_H */
diff --git a/cp/ps/driver/inc/misc/drvs_uicc.h b/cp/ps/driver/inc/misc/drvs_uicc.h
new file mode 100644
index 0000000..34c5c37
--- /dev/null
+++ b/cp/ps/driver/inc/misc/drvs_uicc.h
@@ -0,0 +1,462 @@
+/*******************************************************************************
+ * Copyright (C) 2007, ZTE Corporation.
+ *
+ * File Name: uicc_api.h
+ * File Mark:
+ * Description: Provide UICC module Function prototype declaration
+* and type declaration.
+ * Others:
+ * Version: 1.0
+ * Author: wangxia
+ * Date: 2008-4-18
+ * History 1:
+ * Date:
+ * Version:
+ * Author:
+ * Modification:
+ * History 2:
+ ********************************************************************************/
+
+#ifndef _DRVS_UICC_H
+#define _DRVS_UICC_H
+
+/****************************************************************************
+* Include files
+****************************************************************************/
+#include "pub.h"
+
+/****************************************************************************
+* Macros
+****************************************************************************/
+//#define SOC_USIM
+
+#define DRV_UICC_NOF_CLASSES 5 /*!< The number of specified card classes (A,B,C,D & E) */
+/****************************************************************************
+* Types
+****************************************************************************/
+typedef enum
+{
+ DRV_UICC_TRANSFER_SUCCEEDED,
+ DRV_UICC_TRANSFER_FAILED
+} T_ZDrvUicc_ApduReselt;
+
+/**
+ * \enum T_ZDrvUicc_ResetResult
+ * Response cause for function \ref UICC_reset.
+ */
+typedef enum
+{
+ DRV_UICC_ACTIVATION_SUCCEEDED,
+ DRV_UICC_ACTIVATION_FAILED,
+ DRV_UICC_REJECT_CARD
+} T_ZDrvUicc_ResetResult;
+
+/**
+ * \enum T_ZDrvUicc_CloseResult
+ * Response cause for function \ref UICC_close.
+ */
+typedef enum
+{
+ DRV_UICC_DEACTIVATION_SUCCEEDED,
+ DRV_UICC_DEACTIVATION_FAILED,
+ DRV_UICC_ALREADY_DEACTIVATED
+} T_ZDrvUicc_CloseResult;
+
+/**
+ * \enum T_ZDrvUicc_SetInOutCallBack
+ * Response cause for callback function \ref UICC_set_inout_callback.
+ */
+typedef enum
+{
+ DRV_CALLBACK_FUNCTION_SET, /*!< Callback function registered. */
+ DRV_CALLBACK_NOT_AVAILABLE /*!< Callback function NOT registered (or not supported). */
+} T_ZDrvUicc_SetInOutCallBack;
+
+/**
+ * \enum T_ZDrvUicc_CardSelector
+ * Card selector.
+ */
+typedef enum
+{
+ DRV_UICC_PRIMARY_CARD,
+ DRV_UICC_SECONDARY_CARD_1,
+ DRV_UICC_SECONDARY_CARD_2
+} T_ZDrvUicc_CardSelector;
+
+/**
+ * \enum T_ZDrvUicc_CommandCase
+ * Command case indicator.
+ */
+typedef enum
+{
+ DRV_UICC_CMD_CASE_1, /*!< No Tx nor Tx command. */
+ DRV_UICC_CMD_CASE_2, /*!< Rx command. */
+ DRV_UICC_CMD_CASE_3, /*!< Tx command. */
+ DRV_UICC_CMD_CASE_4 /*!< Tx and Rx command. */
+} T_ZDrvUicc_CommandCase;
+
+/**
+ * \enum T_ZDrvUicc_ResetMode
+ * Reset indicator.
+ */
+typedef enum
+{
+ DRV_UICC_COLD_RESET, /*!< Cold Reset. */
+ DRV_UICC_WARM_RESET /*!< Warm Reset (reset with RST line only). */
+} T_ZDrvUicc_ResetMode;
+
+/**
+ * \enum T_ZDrvUicc_VoltageClass
+ * Voltage CLASS selector.
+ */
+typedef enum
+{
+ DRV_UICC_CLASS_A, /*!< 5v */
+ DRV_UICC_CLASS_B, /*!< 3v */
+ DRV_UICC_CLASS_C, /*!< 1.8v */
+ DRV_UICC_CLASS_D, /*!< RFU */
+ DRV_UICC_CLASS_E /*!< RFU */
+}T_ZDrvUicc_VoltageClass;
+
+/**
+ * \enum T_ZDrvUicc_ClockStopMode
+ * Clock stop level indicator.
+ */
+typedef enum
+{
+ DRV_UICC_CLOCK_STOP_ALLOWED, /*!< Clock Stop NOT allowed. */
+ DRV_UICC_NO_PREFERRED_LEVEL, /*!< Clock allowed, no preferred level requiered. */
+ DRV_UICC_HIGH_LEVEL_PREFERRED, /*!< Clock allowed, High level preferred. */
+ DRV_UICC_LOW_LEVEL_PREFERRED, /*!< Clock allowed, Low level preferred. */
+ DRV_UICC_CLOCK_STOP_NOT_ALLOWED,/*!< Clock Stop NOT allowed. */
+ DRV_UICC_CLOCK_STOP_ONLY_HIGH, /*!< Clock Stop NOT allowed, unless at High level. */
+ DRV_UICC_CLOCK_STOP_ONLY_LOW /*!< Clock Stop NOT allowed, unless at Low level. */
+}T_ZDrvUicc_ClockStopMode;
+
+/**
+ * \enum T_ZDrvUicc_Protocol
+ * Protocol selector.
+ */
+typedef enum
+{
+ DRV_UICC_T_0, /*!< T=0 Protocol. */
+ DRV_UICC_T_1 /*!< T=1 Protocol. */
+}T_ZDrvUicc_Protocol;
+
+/**
+ * \enum T_ZDrvUicc_ComConvention
+ * Communication convention indicator.
+ */
+typedef enum
+{
+ DRV_UICC_DIRECT, /*!< Direct communication convention. */
+ DRV_UICC_INVERSE /*!< Inverse communication convention. */
+}T_ZDrvUicc_ComConvention;
+
+/**
+ * \enum T_ZDrvUicc_CardAction
+ * Card In/Out indicator.
+ */
+typedef enum
+{
+ DRV_CARD_INSERTED,
+ DRV_CARD_REMOVED
+} T_ZDrvUicc_CardAction;
+/**
+ * \}
+ */
+
+
+ /**
+ * \struct T_ZDrvUicc_ApduHeader
+ * Structure holding the APDU command header.
+ */
+typedef struct
+{
+ UINT8 cla; /*!< Command CLAss. */
+ UINT8 ins; /*!< Command INStruction. */
+ UINT8 p1; /*!< Command Parameter. */
+ UINT8 p2; /*!< Command Parameter. */
+ UINT16 lc; /*!< Tx-size. */
+ UINT16 le; /*!< Rx-Size. */
+} T_ZDrvUicc_ApduHeader;
+
+
+/**
+ * \struct T_ZDrvUicc_ApduFooter
+ * Structure holding the APDU command response 'header'.
+ */
+typedef struct
+{
+ UINT16 luicc; /*!< Actual Rx-size recived. */
+ UINT8 sw1; /*!< Received Status Word SW1. */
+ UINT8 sw2; /*!< Received Status Word SW2. */
+} T_ZDrvUicc_ApduFooter;
+
+
+/**
+ * \enum T_ZDrvUicc_CardType
+ * card type.
+ */
+typedef enum
+{
+ DRV_UICC_CARD_TYPE_2G,
+ DRV_UICC_CARD_TYPE_3G,
+
+ UICC_MAX
+ }T_ZDrvUicc_CardType;
+
+
+
+/**
+ * \struct T_ZDrvUicc_VoltageControl
+ * Voltage control structure.
+ */
+typedef struct
+{
+ T_ZDrvUicc_VoltageClass used_voltage; /*!< Actual used voltage class/level. */
+ BOOL voltage_settled; /*!< Indicates if the voltages level has
+ been settled. This can only happen
+ if the card did indicate the voltage
+ capabilities in the ATR string. */
+} T_ZDrvUicc_VoltageControl;
+
+/**
+ * \struct T_ZDrvUicc_Characteristics
+ * Protocol characteristics structure.
+ */
+typedef struct
+{
+ T_ZDrvUicc_Protocol protocol; /*!< Protocol supported and used. */
+ UINT8 f_used; /*!< The used clock rate convention factor (F). */
+ UINT8 f_offered; /*!< The offered clock rate convention factor (F). */
+ UINT8 d_used; /*!< The used baud rate adjustment factor (D). */
+ UINT8 d_offered; /*!< The offered baud rate adjustment factor (D). */
+ T_ZDrvUicc_ComConvention com_convention; /*!< The supported and used communication convention. */
+} T_ZDrvUicc_Characteristics;
+
+/**
+ * \struct T_ZDrvUicc_ElectricalProfile
+ * Electrical Baseband characteristics structure.
+ */
+typedef struct
+{
+ BOOL class_supported; /*!< Indicates if the class is supported or not. */
+ UINT16 voltage_level; /*!< Holds the voltage level given in millivolts [mV]. E.g. 1800 is
+ equivalent to 1.8v). */
+ UINT16 max_current; /*!< The maximum allowed current consumption at this voltage_level
+ given in micro Ampere (uA). E.g. 15500 is equivalent to 15.5mA. */
+} T_ZDrvUicc_ElectricalProfile;
+
+/**
+ * \struct T_ZDrvUicc_ClockProfile
+ * Baseband Clock characteristics.
+ */
+typedef struct
+{
+ UINT8 min_clock_freq; /*!< The minimum clock frequency supported by the HW. */
+ UINT8 max_clock_freq; /*!< The maximum clock frequency supported by the HW. If only
+ one frequency is supported, the min. and max. values will
+ be identical. The frequency resolution is 0.1 MHz i.e. 21h
+ is equivalent to 3.3MHz. */
+}T_ZDrvUicc_ClockProfile;
+
+/**
+ * \struct T_ZDrvUicc_HwProfile
+ * Baseband Clock characteristics.
+ */
+typedef struct
+{
+ UINT8 nof_card_slots_supported;
+ /*!< Number of card reader slots supported by HW.\n
+ * 1: Only primary slot (uicc_primary_card)\n
+ * 2: Primary and ONE additional slot (uicc_secondary_card_1)\n
+ * 3: Primary and TWO additional slots (uicc_secondary_card_1 & uicc_secondary_card_2) */
+
+ UINT8 protocol_supported;
+ /*!< Protocols supported by the DRV_UICC Handler.\n
+ * b1: T=0 supported\n
+ * b2: T=1 supported\n
+ * b3: T=x supported\n
+ * E.g. 0x03 means that both T=0 and T=1 are supported */
+
+ T_ZDrvUicc_ElectricalProfile electrical_profile[DRV_UICC_NOF_CLASSES];
+ /*!< Holds the electrical profile of the specified classes - where
+ * the max. allowed current consumption is indicated for each class. */
+
+ T_ZDrvUicc_ClockProfile clock_profile;
+ /*!< Holds the minimum and maximum clock frequencies supported by the
+ * hardware. */
+
+ BOOL extended_length;
+ /*!< Indicates the driver support of the use of extended Lc/Le.\n
+ * TRUE: extended Lc/Le is supported by the driver. The max. Tx and
+ * Rx data sizes are 65,535 and 65,536 bytes respectively.\n
+ * FALSE: extended Lc/Le is NOT supported by the driver. The max. Tx
+ * and Rx data sizes are 255 and 256 bytes respectively.\n
+ * NOTE: this feature is currently NOT supported! */
+} T_ZDrvUicc_HwProfile;
+
+typedef enum {
+ CARD_INSERTED,
+ CARD_REMOVED
+} T_UICC_CARD_ACTION;
+
+typedef enum {
+ UICC_PRIMARY_CARD,
+ UICC_SECONDARY_CARD_1,
+ // UICC_SECONDARY_CARD_2
+} T_UICC_CARD_SELECTOR;
+
+typedef enum {
+ UICC_CARD, //0
+ VSIM_CARD, //3
+ UICC_VSIM_AUTO,
+ UICC_ESIM_CARD,
+ CLOUD_CARD, //1//1
+ SOFTSIM_CARD, //2//2
+ UICC_VSIM_MAX
+} T_UICC_CARD_TYPE;
+/****************************************************************************
+* Constants
+****************************************************************************/
+
+/****************************************************************************
+* Global Variables
+****************************************************************************/
+
+/****************************************************************************
+* Function Prototypes
+****************************************************************************/
+
+/*!
+ * Function used to exchange APDU with a card. The function will not return
+ * before the response APDU has beed received from the card or until the
+ * appropriate Working Timer has expired.
+ *
+ * \param card_selector (I) Indicates which card the requested command is meant for.
+ * \param command_case (I) Indicates which of the four command cases the current
+ * command belongs to.
+ * \param extended_length (I) Indicates the card support of the use of extended Lc/Le.
+ * The caller of this function has the responsibility of
+ * allocating the apdu_data store correcesponding to the
+ * larger of Lc and Le.\n
+ * TRUE: extended Lc/Le is supported. The max. Tx and Rx
+ * data sizes are 65,535 and 65,536 bytes respectively.\n
+ * FALSE: extended Lc/Le is NOT supported. The max. Tx and Rx
+ * data sizes are 255 and 256 bytes respectively.
+ * \param c_apdu (I) The Command APDU containing: CLA, INS, P1, P2, Lc & Le.
+ * \param r_apdu (O) The Response APDU containing: Luicc, SW1 & SW2.
+ * \param apdu_data (I/O) I: Holds Lc Tx-data to be sent to the card.
+ * O: Holds Luicc Rx-data received from the card.
+ * \return The result of the APDU command execution.
+ */
+
+extern T_ZDrvUicc_ApduReselt zDrvUicc_TransportApdu(T_ZDrvUicc_CardSelector card_selector,
+ T_ZDrvUicc_CommandCase command_case,
+ BOOL extended_length,
+ T_ZDrvUicc_ApduHeader c_apdu,
+ T_ZDrvUicc_ApduFooter *r_apdu_ptr,
+ UINT8 *apdu_data_ptr);
+
+
+/*!
+ * Function used to reset the card. The function will not return until the reset
+ * has been successfully carried out i.e. ATR string has been received or if no
+ * response to the reset is received i.e. IWT times out.
+ * \param card_selector (I) Indicates which card needs to be activated/reset.
+ * \return The outcome of the activation handling.
+ */
+ extern T_ZDrvUicc_ResetResult zDrvUicc_ResetCard(T_ZDrvUicc_CardSelector card_selector);
+
+
+/*!
+ * Function used to deactivat a given card.
+ * \param card_selector (I) Indicates which card needs to be deactivated.
+ * \return The deactivation result.
+ */
+ extern T_ZDrvUicc_CloseResult zDrvUicc_Close(T_ZDrvUicc_CardSelector card_selector);
+
+/*!
+ * Function for Informing the DRV_UICC Handler of the card characteristics of the current used card.
+ * \param card_selector (I) Indicates which card the characteristics are valid for.
+ * \param clock_stop_mode (I) Holds the Clock Stop capabilities indicated by the card.
+ * \param min_clock_freq (I) Holds the minimum acceptable clock frequency for the
+ * card/application. The frequency resolution is 0.1 MHz
+ * i.e. 21h is equivalent to 3.3MHz.
+ * \return None.
+ */
+ extern VOID zDrvUicc_CardCharacteristics(T_ZDrvUicc_CardSelector card_selector,
+ T_ZDrvUicc_ClockStopMode clock_stop_mode,
+ UINT8 min_clock_freq);
+/*!
+ * Returns an overview of the static profile of the HW related interface.
+ * \return The static characteristics (e.g. number of card slots, voltage
+ * levels, max. current cunsumption, supported transmission protocols
+ * etc.
+ */
+ extern T_ZDrvUicc_HwProfile zDrvUicc_HwProfile(VOID);
+
+/*!
+ * Used for initializing the callback function used when the in/out state of the
+ * card changes.
+ * \param inout_call_back (I) Pointer to the function to be invoked when the
+ * in/out state changes. The parameter to the call
+ * back function shall indicated the related card
+ * reader and the IN or OUT action.
+ * \return The outcome of the requested action.
+ */
+ extern T_ZDrvUicc_SetInOutCallBack zDrvUicc_SetInOutCallBack( VOID (*inout_call_back)(T_ZDrvUicc_CardAction card_action, T_ZDrvUicc_CardSelector card_selector));
+ /*!
+ * Used for initializing the callback function used when the in/out state of the
+ * card changes.
+ * \param
+ * \return The outcome of the requested action.
+ */
+ extern T_ZDrvUicc_SetInOutCallBack zDrvUicc_UninstallInOutCallBack(VOID);
+
+/*!
+ * Function used to obtain the ATR string of the current operated card. If no card
+ * is active (or if data is not available) the number of characters returned will
+ * be set to zero.
+ * \param atr Pointer to the store in which the ATR string should be located.
+ * \return Number of ATR characters.
+ */
+ extern UINT8 zDrvUicc_GetAtr(T_ZDrvUicc_CardSelector card_selector, UINT8 *atr);
+
+
+extern VOID zDrvUicc_Highisr(VOID);
+
+extern void invoke_callback(T_UICC_CARD_ACTION card_action, T_UICC_CARD_SELECTOR card_selector);
+
+typedef void (*recoverCallback_func)(void);
+void uicc_setRecover_callback(recoverCallback_func func);
+
+typedef UINT8 (*simStatuCallback_func)(void);
+void uicc_getSimStatu_callback(simStatuCallback_func func);
+#define UICC_SIM_PLUGIN 0x11
+#define UICC_SIM_PLUGOUT 0x10
+
+typedef void (*hotplugCallback_func)(UINT32);
+
+void uicc_set_hotplugCallback(hotplugCallback_func func);
+
+typedef void (*simSwitchCallback_fun)(void);
+void uicc_setUsimSwitch_callback(simSwitchCallback_fun func);
+
+SINT32 uiccramlog_Printf(const VOID *pFormat, ...);
+
+extern SINT32 ramlog_Printf(UINT16 nModNo, const VOID *pFormat, ...);
+
+#ifdef UICC_ENABLE_REALTIME_PRINT
+#define zDrvUiccRamlog_PRINTF(nModNo, s...) uiccramlog_Printf(s)
+#else
+#ifdef _USE_RAMLOG
+#define zDrvUiccRamlog_PRINTF(nModNo, s...) ramlog_Printf(nModNo, s)
+#endif
+#endif
+
+#endif /* _DRVSUICC_H */
+/** \} */
+ /* End of file. */
+
diff --git a/cp/ps/driver/inc/misc/drvs_usbPoll.h b/cp/ps/driver/inc/misc/drvs_usbPoll.h
new file mode 100644
index 0000000..01e0847
--- /dev/null
+++ b/cp/ps/driver/inc/misc/drvs_usbPoll.h
@@ -0,0 +1,170 @@
+/*******************************************************************************
+ * Copyright (C) 2007, ZTE Corporation.
+ *
+ * File Name:
+ * File Mark:
+ * Description:
+ * Others:
+ * Version: 1.0
+ * Author: weizhgiang
+ * Date: 2010-5-18
+ * History 1:
+ * Date:
+ * Version:
+ * Author:
+ * Modification:
+ * History 2:
+ ********************************************************************************/
+
+#ifndef _DRVS_USBPOLL_H
+#define _DRVS_USBPOLL_H
+
+
+/****************************************************************************
+* Include files
+****************************************************************************/
+
+
+/****************************************************************************
+* Macros
+****************************************************************************/
+
+
+/****************************************************************************
+* Types
+****************************************************************************/
+
+/****************************************************************************
+* Constants
+****************************************************************************/
+
+/****************************************************************************
+* Global Variables
+****************************************************************************/
+
+/****************************************************************************
+* Function Prototypes
+****************************************************************************/
+
+/*******************************************************************************
+ * Function: zDrvUsbPoll_Init
+ * Description:
+ 1¡¢¶Ï¿ªÓëPC²àµÄµ±Ç°Á¬½Ó
+ 2¡¢³õʼ»¯USBÄÚ²¿µÄÊý¾Ý½á¹¹
+ 3¡¢ÖØÐÂÆô¶¯Á¬½Ó£¨Æô¶¯Á¬½Óºó£¬ÒªÇózDrvUsbPoll_IsrÁ¢¼´»ñµÃ²éѯ£©
+ * Parameters:
+ * Input:
+ *
+ * Output:
+ *
+ * Returns:
+ *
+ *
+ * Others:
+ ********************************************************************************/
+SINT32 zDrvUsbPoll_Init(VOID);
+
+
+
+/*******************************************************************************
+ * Function: zDrvUsbPoll_isConnect
+ * Description:
+ 1¡¢ÅжÏö¾ÙÊÇ·ñÍê³É
+ * Parameters:
+ * Input:
+ *
+ * Output:
+ *
+ * Returns:
+ *
+ *
+ * Others:
+ ********************************************************************************/
+BOOL zDrvUsbPoll_isConnect(VOID);
+
+
+
+/*******************************************************************************
+ * Function: zDrvUsbPoll_Isr
+ * Description:
+ 1¡¢USBÖжϴ¦Àíº¯Êý£¬ÐèÒª²»¶Ï²éѯ
+ * Parameters:
+ * Input:
+ *
+ * Output:
+ *
+ * Returns:
+ *
+ *
+ * Others:
+ ********************************************************************************/
+SINT32 zDrvUsbPoll_Isr(VOID);
+
+
+/*******************************************************************************
+ * Function: zDrvUsbPoll_Read
+ * Description:
+ USB¶Áº¯Êý£¬Òì²½·½Ê½¡£¼´Èç¹ûûÓжÁµ½Êý¾Ý£¬Á¢¿Ì·µ»Ø0
+ * Parameters:
+ * Input:
+ *
+ * Output:
+ *
+ * Returns:
+ *
+ *
+ * Others:
+ ********************************************************************************/
+SINT32 zDrvUsbPoll_Read(UINT8* pBuf,UINT32 length);
+
+
+/*******************************************************************************
+ * Function: zDrvUsbPoll_Write
+ * Description:
+ USBдº¯Êý£¬Òì²½·½Ê½¡£¼´Èç¹ûûÓжÁµ½Êý¾Ý£¬Á¢¿Ì·µ»Ø0
+ * Parameters:
+ * Input:
+ *
+ * Output:
+ *
+ * Returns:
+ *
+ *
+ * Others:
+ ********************************************************************************/
+SINT32 zDrvUsbPoll_Write(UINT8* pBuf,UINT32 length);
+
+/*******************************************************************************
+ * Function: usbPoll_Delay_us
+ * Description:
+ delay function
+ * Parameters:
+ * Input:
+ *
+ * Output:
+ *
+ * Returns:
+ *
+ *
+ * Others:
+ ********************************************************************************/
+VOID usbPoll_Delay_us(UINT32 us);
+
+/*******************************************************************************
+ * Function: usbPoll_Delay_us
+ * Description:
+ delay function
+ * Parameters:
+ * Input:
+ *
+ * Output:
+ *
+ * Returns:
+ *
+ *
+ * Others:
+ ********************************************************************************/
+VOID usbPoll_Delay_ms(UINT32 ms);
+
+#endif/*_DRVS_USBPOLL_H*/
+
diff --git a/cp/ps/driver/inc/misc/drvs_usb_config.h b/cp/ps/driver/inc/misc/drvs_usb_config.h
new file mode 100644
index 0000000..38ef65c
--- /dev/null
+++ b/cp/ps/driver/inc/misc/drvs_usb_config.h
@@ -0,0 +1,557 @@
+/*******************************************************************************
+ * Copyright (C) 2008, ZTE Corporation.
+ *
+ * File Name: drvs_usb_config.h
+ * File Mark:
+ * Description:
+ * Others:
+ * Version: V1.0
+ * Author: Weizhigang
+ * Date: 2009-6-18
+ * History 1:
+ * Date:
+ * Version:
+ * Author:
+ * Modification:
+ ********************************************************************************/
+#ifndef _DRVS_USB_CONFIG_H
+#define _DRVS_USB_CONFIG_H
+
+/****************************************************************************
+* macro
+****************************************************************************/
+#define MAX_ENDPOINT_NUM 13 //IN&OUT ENDPOINT INCLUDE EP0
+#define MAX_INTERFACE_NUM 12 //the usb hw only have 12 endpoint set, so the max ifac num is 12
+
+#define POWER_DOMAIN_ISO (0x0010d200+0x41*4)
+#define POWER_DOMAIN_POWERON (0x0010d200+0x42*4)
+#define POWER_DOMAIN_RST (0x0010d200+0x40*4)
+
+#define SOC_CRM_BASE (0x0010c000)
+#define BOOT_SEL (0x3c)
+#define NAND_CFG (0x34)
+#define SOC_MOD_CLKEN0 (0x0010c00c)
+#define SOC_MOD_CLKEN1 (0x0010c010)
+#define SOC_MOD_RSTEN (0x0010c018)
+#define SOC_MOD_USBSTATECTRL (0x0010c05c)
+#define SOC_MOD_RSTEN1 (0x0010c064)
+
+#ifdef _USE_PSM
+#define USE_USB_PSM 1
+#endif
+#define USE_USB_PSM 1//usb²»Çø·ÖÊ¡µçÓ벻ʡµç
+
+#define CHARGER_DETECT 0
+
+
+#define USB_GET_EP_ADDR(ep_num,dir) ((dir<<7)|(ep_num))
+
+
+typedef SINT32 (*interface_bind)(UINT8* config_buf, VOID* context, UINT8 interfaceNum, UINT32 speed);
+
+/****************************************************************************
+* type
+****************************************************************************/
+//define ep transfer mode
+typedef enum _T_ZDrvUsb_EpXferMode
+{
+ EP_XFER_MODE_CPU=0, //need to change hal define!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+ EP_XFER_MODE_DMA0=1,
+ EP_XFER_MODE_DMA1REQ0=2,
+ EP_XFER_MODE_DMA1REQ1=3
+}
+T_ZDrvUsb_EpXferMode;
+
+//define ep receive mode
+typedef enum _T_ZDrvUsb_EpXferEndCondition
+{
+ EP_UNKNOW_BASE =0,
+ EP_LENGTH_BASE = 5,
+ EP_PACKET_BASE = 6,
+}
+T_ZDrvUsb_EpXferEndCondition;
+
+//define ep context
+typedef struct _T_ZDrvUsb_EpContext
+{
+ BOOL bEpIsVaild;
+ UINT32 uiEpAddr;
+ T_ZDrvUsb_EpXferMode tEpXferMode;
+ T_ZDrvUsb_EpXferEndCondition tEpXferEndCondi;
+}
+T_ZDrvUsb_EpContext;
+
+//define ep context
+typedef struct _T_ZDrvUsb_InterfacecContext
+{
+ BOOL bIfacIsVaild;
+ UINT32 uiIfacFunction;
+ T_ZDrvUsb_EpContext tInEpContext;
+ T_ZDrvUsb_EpContext tOutEpContext;
+ T_ZDrvUsb_EpContext tExtendEpContext;
+ CHAR* pIfacName;
+ interface_bind f_intf_bind;
+}
+T_ZDrvUsb_InterfacecContext;
+
+typedef struct _T_ZDrvUsb_DeviceContext
+{
+ CHAR* pVendroName;
+ CHAR* pProductName;
+ CHAR* pSerialNum;
+ UINT32 uiVID;
+ UINT32 uiPID;
+ UINT8 DeviceClass;
+ UINT8 DeviceSubClas;
+ UINT8 DeviceProtocol;
+}
+T_ZDrvUsb_DeviceContext;
+
+/*qihongfang add for usb context show on PC*/
+
+typedef struct _T_ZDrvUsb_MSType
+{
+ CHAR* pCdromName;
+ CHAR* pNandName;
+ CHAR* pSdName;
+ CHAR* pRamdiskName;
+}
+T_ZDrvUsb_MSType;
+
+typedef struct _T_ZDrvUsb_MsContext
+{
+CHAR* pVendorName;
+T_ZDrvUsb_MSType pProductName;
+CHAR* pProductRevision;
+}
+T_ZDrvUsb_MsContext;
+
+typedef struct _T_ZDrvUsb_ConfigContext
+{
+ BOOL bContextIsVaild;
+ T_ZDrvUsb_DeviceContext tDeviceContext; //we respect one config as one device
+ T_ZDrvUsb_InterfacecContext tIfacContext[MAX_INTERFACE_NUM];
+}
+T_ZDrvUsb_ConfigContext;
+
+typedef struct _T_ZDrvUsb_EcmFunctionDescriptor
+{
+ CHAR * EcmMacAddr;
+ UINT32 bmEthernetStatistics;
+ UINT16 wMaxSegmentSize;
+ UINT16 wNumberMCFilters;
+}
+T_ZDrvUsb_EcmFunctionDescriptor;
+
+typedef struct _T_ZDrvUsb_EcmContext
+{
+ BOOL bIsVaild;
+ UINT8 ifacNum_CCI;
+ T_ZDrvUsb_EcmFunctionDescriptor tEcmFuncDes;
+}
+T_ZDrvUsb_EcmContext;
+
+
+//------------------------------------------------------------------------------------------------------------------
+
+typedef enum _T_ZDrvUsb_ConfigType
+{
+ USB_CONFIG0=0,
+ USB_CONFIG1=1,
+ USB_CONFIG2=2,
+ USB_CONFIG3=3,
+ USB_CONFIG4=4,
+ USB_CONFIG5=5,
+ USB_CONFIG6=6,
+ USB_CONFIG7=7,
+ USB_CONFIG8=8,
+ USB_CONFIG9=9,
+ USB_CONFIG10=10,
+ USB_CONFIG11=11,
+ USB_MAX_CONFIG_NUM,
+ USB_CONFIG_NONE,
+ USB_CONFIG_END=0xff /* all device uninstalled */
+}
+T_ZDrvUsb_ConfigType;
+
+typedef enum _T_ZDrvUsb_OSType
+{
+ OSType_Windows=0, //means xp,vista,win7
+ OSType_Linux=1,
+ OSType_Mac=2,
+ OSType_Win8=3,
+ OS_MAX_TYPE_NUM,
+ OS_TYPE_END=0xff /* all device uninstalled */
+}
+T_ZDrvUsb_OSType;
+
+//define usb dev type
+typedef enum _T_ZDrvUsb_DevType
+{
+ USB_AT =0,
+ USB_MODEM,
+ USB_LOG,
+ USB_MAX_TYPE_NUM
+}
+T_ZDrvUsb_DevType;
+
+
+//define usb phy mode
+typedef enum _T_ZDrvUsb_PhyType
+{
+ USB_NORMAL =0,
+ USB_HSIC = 1, //usb hsic
+ USB_DWC3=2 //usb 3.0
+}
+T_ZDrvUsb_PhyType;
+
+typedef enum _T_ZDrvUsb_DRMode
+{
+ USB_NONE =0,
+ USE_USB_DEVICE =1,
+ USE_USB_HOST =2
+}
+T_ZDrvUsb_DRMode;
+
+typedef struct _T_ZDrvUsb_IP
+{
+ T_ZDrvUsb_PhyType usb_Tpye;;
+ T_ZDrvUsb_DRMode usb_DRMode;
+}
+T_ZDrvUsb_IP;
+
+typedef enum _T_ZDrvUsb_NVTYPE
+{
+ NAND_TYPE =0,
+ GLOBAL_TYPE =1
+}
+T_ZDrvUsb_NVTYPE;
+
+/****************************************************************************
+* macro module define
+****************************************************************************/
+//Main Function Define (bit1~bit15)
+#define DEV_NULL 0
+#define DEV_CDC (1<<1)
+#define DEV_NDIS (1<<2)
+#define DEV_MASSSTORAGE (1<<3)
+#define DEV_MAIN_FUNC_MASK (0x00FF)
+#define DEV_ECM_CCI (1<<4)
+#define DEV_ECM_DCI (1<<5)
+#define DEV_RNDIS_CCI (1<<6)
+#define DEV_RNDIS_DCI (1<<7)
+#define DEV_ADB (1<<8)
+
+//Sub Function Define (bit16~bit32)
+#define DEV_MASSSTORAGE_CDROM ((1<<16)|DEV_MASSSTORAGE)
+#define DEV_MASSSTORAGE_SD ((1<<17)|DEV_MASSSTORAGE)
+#define DEV_MASSSTORAGE_NAND ((1<<18)|DEV_MASSSTORAGE)
+#define DEV_MASSSTORAGE_RAMDISK ((1<<19)|DEV_MASSSTORAGE)
+
+//basic endpoint class
+#define USB_IN_EP_CPU(epNum,RcvMode) {TRUE,USB_GET_EP_ADDR(epNum,1),EP_XFER_MODE_CPU,RcvMode}
+#define USB_OUT_EP_CPU(epNum,RcvMode) {TRUE,USB_GET_EP_ADDR(epNum,0),EP_XFER_MODE_CPU,RcvMode}
+#define USB_IN_EP_DMA1REQ1(epNum,RcvMode) {TRUE,USB_GET_EP_ADDR(epNum,1),EP_XFER_MODE_DMA1REQ1,RcvMode}
+#define USB_OUT_EP_DMA1REQ1(epNum,RcvMode) {TRUE,USB_GET_EP_ADDR(epNum,0),EP_XFER_MODE_DMA1REQ1,RcvMode}
+#define USB_OUT_EP_DMA1REQ0(epNum,RcvMode) {TRUE,USB_GET_EP_ADDR(epNum,0),EP_XFER_MODE_DMA1REQ0,RcvMode}
+#define USB_NULL_EP {FALSE,0,0,0}
+
+#define USB_EP_XFER_MODE 1
+#define USB_EP_XFEREND_CONDI 2
+
+#define USB_GET_EP_XFER_MODE(epNum) usbStack_GetEpInfo(epNum,USB_EP_XFER_MODE)
+#define USB_GET_EP_XFER_END_CONDI(epNum) usbStack_GetEpInfo(epNum,USB_EP_XFEREND_CONDI)
+
+//cdc interface class
+//#define USB_IFAC_CDC_CPU(funCode,epNum,name) {TRUE,funCode,USB_IN_EP_CPU(epNum,EP_PACKET_BASE),USB_OUT_EP_CPU(epNum,EP_PACKET_BASE),USB_NULL_EP,name}
+#define USB_IFAC_CDC_CPU(funCode,epNum,name,func) {TRUE,funCode,USB_IN_EP_CPU(epNum,EP_PACKET_BASE),USB_OUT_EP_CPU(epNum,EP_PACKET_BASE),USB_NULL_EP,name,func}
+
+#define USB_IFAC_CDC_DMA(funCode,epNum,name,func) {TRUE,funCode,USB_IN_EP_DMA1REQ1(epNum,EP_PACKET_BASE),USB_OUT_EP_DMA1REQ1(epNum,EP_PACKET_BASE),USB_NULL_EP,name,func}
+
+#define USB_CCIFAC_ECM_CPU(funCode,epNum,name,func) {TRUE,funCode,USB_NULL_EP,USB_NULL_EP,USB_IN_EP_CPU(epNum,EP_PACKET_BASE),name,func}
+#define USB_DCIFAC_ECM_DMA(funCode,epNum,name,func) {TRUE,funCode,USB_IN_EP_DMA1REQ1(epNum,EP_PACKET_BASE),USB_OUT_EP_DMA1REQ1(epNum,EP_PACKET_BASE),USB_NULL_EP,name,func}
+//mass storage interface class
+#define USB_IFAC_MASS_CPU(funCode,epNum,name,func) {TRUE,funCode,USB_IN_EP_CPU(epNum,EP_LENGTH_BASE),USB_OUT_EP_CPU(epNum,EP_LENGTH_BASE),USB_NULL_EP,name,func}
+#define USB_IFAC_MASS_DMA(funCode,epNum,name,func) {TRUE,funCode,USB_IN_EP_DMA1REQ1(epNum,EP_LENGTH_BASE),USB_OUT_EP_DMA1REQ0(epNum,EP_LENGTH_BASE),USB_NULL_EP,name,func}
+
+//ndis interface class
+#define USB_IFAC_NDIS_DMA(funCode,epNum1,epNum2,name,func) {TRUE,funCode,USB_IN_EP_DMA1REQ1(epNum1,EP_PACKET_BASE),USB_OUT_EP_DMA1REQ1(epNum1,EP_PACKET_BASE),USB_IN_EP_CPU(epNum2,EP_PACKET_BASE),name,func}
+#define USB_IFAC_NDIS_CPU(funCode,epNum1,epNum2,name,func) {TRUE,funCode,USB_IN_EP_CPU(epNum1,EP_PACKET_BASE),USB_OUT_EP_CPU(epNum1,EP_PACKET_BASE),USB_IN_EP_CPU(epNum2,EP_PACKET_BASE),name,func}
+
+//rndis interface class
+#define USB_CIFAC_RNDIS_CPU(funCode,epNum,name,func) {TRUE,funCode,USB_NULL_EP,USB_NULL_EP,USB_IN_EP_CPU(epNum,EP_PACKET_BASE),name,func}
+#define USB_DIFAC_RNDIS_DMA(funCode,epNum,name,func) {TRUE,funCode,USB_IN_EP_DMA1REQ1(epNum,EP_PACKET_BASE),USB_OUT_EP_DMA1REQ1(epNum,EP_PACKET_BASE),USB_NULL_EP,name,func}
+
+//ecm interface class
+#define USB_IFAC_ECM_DMA(funCode,epNum1,epNum2,name,func) {TRUE,funCode,USB_IN_EP_DMA1REQ1(epNum1,EP_PACKET_BASE),USB_OUT_EP_DMA1REQ1(epNum1,EP_PACKET_BASE),USB_IN_EP_CPU(epNum2,EP_PACKET_BASE),name,func}
+#define USB_IFAC_ECM_CPU(funCode,epNum1,epNum2,name,func) {TRUE,funCode,USB_IN_EP_CPU(epNum1,EP_PACKET_BASE),USB_OUT_EP_CPU(epNum1,EP_PACKET_BASE),USB_IN_EP_CPU(epNum2,EP_PACKET_BASE),name,func}
+
+#define USB_IFAC_ADB_CPU(funCode,epNum,name,func) {TRUE,funCode,USB_IN_EP_CPU(epNum,EP_PACKET_BASE),USB_OUT_EP_CPU(epNum,EP_PACKET_BASE),USB_NULL_EP,name,func}
+#define USB_IFAC_ADB_DMA(funCode,epNum,name,func) {TRUE,funCode,USB_IN_EP_DMA1REQ1(epNum,EP_PACKET_BASE),USB_OUT_EP_DMA1REQ1(epNum,EP_PACKET_BASE),USB_NULL_EP,name,func}
+
+
+/*
+#ifndef _USE_AMT
+*/
+#if 0
+#if !defined(_USE_AMT)&&!defined(_USE_SMALL_VERSION)
+//#define DEFAULT_SWITCH_CONFIG_ECM USB_CONFIG1 //ECM config
+//#define DEFAULT_INSERT_CONFIG USB_CONFIG0 //first config with cdrom
+//#define DEFAULT_INSERT_CONFIG_AMT USB_CONFIG3 //amt only
+//#define DEFAULT_SWITCH_CONFIG_NDIS USB_CONFIG2 //NDIS config
+//#define DEFAULT_SWITCH_CONFIG_RNDIS USB_CONFIG4 //RNDIS CONFIG
+#else/*AMT not config NDIS device*/
+#define DEFAULT_SWITCH_CONFIG_ECM USB_CONFIG3
+#define DEFAULT_INSERT_CONFIG USB_CONFIG3
+#define DEFAULT_INSERT_CONFIG_AMT USB_CONFIG3
+#define DEFAULT_SWITCH_CONFIG_NDIS USB_CONFIG3
+#define DEFAULT_SWITCH_CONFIG_RNDIS USB_CONFIG3
+#endif
+#endif
+/****************************************************************************
+* Function Prototypes
+****************************************************************************/
+/*******************************************************************************
+ * Function: zDrvUsbStack_SwitchConfiguration
+ * Description:usb to switch the usb configuration
+ * Parameters:
+ ConfigNum : the new cofig num, the value should less than macro: MAX_CONFIG_NUM
+ * Input:None
+ * Output:None
+ *
+ * Returns:
+ * Others:
+ ********************************************************************************/
+VOID zDrvUsbStack_SwitchConfiguration(T_ZDrvUsb_ConfigType ConfigNum);
+
+/*******************************************************************************
+ * Function: zDrvUsbStack_GetConfigInfo
+ * Description: user can use this function to inquire function code corresponding to the confignum
+ * Parameters:
+ * Input: config num
+ * Output:None
+ *
+ * Returns:function code, if configNum is vailed, return value is zero
+ * Others:
+ ********************************************************************************/
+UINT32 zDrvUsbStack_GetConfigInfo(UINT32 ConfigNum);
+
+/*******************************************************************************
+ * Function: zDrvUsbStack_SetMsContext
+ * Description: get Mass Storage VendorName;ProductName;and ProductRevision for diff project in ref
+ * Parameters:
+ * Input: config num
+ * Output:None
+ *
+ * Returns:function code, if configNum is vailed, return value is zero
+ * Others:
+ ********************************************************************************/
+
+VOID zDrvUsbStack_SetMsContext(T_ZDrvUsb_MsContext *MsPtr);
+
+/*******************************************************************************
+ * Function: zDrvUsbStack_GetIfacFunctionCode
+ * Description: user can use this function to inquire the specify interface function code corresponding
+ to the confignum
+ * Parameters:
+ * Input: config num
+ * Output:None
+ *
+ * Returns:function code, if configNum is vailed, return value is zero
+ * Others:
+ ********************************************************************************/
+UINT32 zDrvUsbStack_GetIfacFunctionCode(UINT32 ConfigNum, UINT32 ifacNum);
+
+/*******************************************************************************
+ * Function: usbHal_GetUsbConfigContext
+ * Description: get usb config context
+ * Parameters:
+ * Input: N/A
+ *
+ * Output: N/A
+ * Returns: N/A
+
+********************************************************************************/
+T_ZDrvUsb_ConfigContext *usbHal_GetUsbConfigContext(UINT32 ConfigNum);
+
+/*******************************************************************************
+ * Function: usbHal_GetEcmConfigContext
+ * Description: get ecm parameter
+ * Parameters:
+ * Input: N/A
+ *
+ * Output: N/A
+ * Returns: N/A
+
+ * Others: //not use
+
+ ********************************************************************************/
+T_ZDrvUsb_EcmContext * usbHal_GetEcmConfigContext(UINT8 ifacNum_CCI);
+
+/*******************************************************************************
+ * Function: usbHal_CleanEcmConfigContext
+ * Description: clean ecm parameter state
+ * Parameters:
+ * Input: N/A
+ *
+ * Output: N/A
+ * Returns: N/A
+
+ * Others: //not use
+
+ ********************************************************************************/
+VOID usbHal_CleanEcmConfigContext(VOID);
+
+/*******************************************************************************
+ * Function: usbHal_GetUsbMode
+ * Description: get usb mode hisc or normal
+ * Parameters:
+ * Input: N/A
+ *
+ * Output: N/A
+ * Returns: N/A
+
+ * Others: //not use
+
+ ********************************************************************************/
+T_ZDrvUsb_PhyType usbHal_GetUsbMode(VOID);
+
+/*******************************************************************************
+ * Function: usbStack_msSetNVflag
+ * Description: used in datecard set AT\Log\Modem flag in NV
+ * with singn whether enum it
+ * Parameters:
+ * Input: N/A
+ *
+ * Output: N/A
+ * Returns: N/A
+
+ * Others: //not use
+
+ ********************************************************************************/
+SINT32 usbStack_msSetNVflag(VOID);
+
+/*******************************************************************************
+ * Function: USBHSIC_ReConnect_Ind
+ * Description: for usb trap ind to host
+ * Parameters:
+ * Input: N/A
+ *
+ * Output: N/A
+ * Returns: N/A
+
+ * Others: //not use
+
+ ********************************************************************************/
+VOID usbHal_HSICReConnect_Ind(VOID);
+/*******************************************************************************
+* Function: zDrvUsb_GetCommDevName
+* Description:
+* Parameters:
+* Input:
+*
+* Output:
+*
+* Returns:
+*
+* Others:
+********************************************************************************/
+SINT32 zDrvUsb_GetUsbDevName(T_ZDrvUsb_DevType usbType,char * DevName,UINT8 StrSize);
+
+/*******************************************************************************
+ * Function: zDrvUsb_Work_Ahb_Phy_Reset
+ * Description:
+ *
+ * Parameters:
+ * Input:
+ *
+ * Output:
+ *
+ * Returns:
+ *
+ *
+ * Others:
+ ********************************************************************************/
+ VOID zDrvUsb_Work_Ahb_Phy_Reset(VOID);
+
+/*******************************************************************************
+ * Function: zDrvUsb_PowerUp
+ * Description:
+ *
+ * Parameters:
+ * Input:
+ *
+ * Output:
+ *
+ * Returns:
+ *
+ *
+ * Others:
+ ********************************************************************************/
+ SINT32 zDrvUsb_PowerUp(VOID);
+
+/*******************************************************************************
+ * Function: zDrvUsb_Powerdown
+ * Description:
+ *
+ * Parameters:
+ * Input:
+ *
+ * Output:
+ *
+ * Returns:
+ *
+ *
+ * Others:
+ ********************************************************************************/
+ SINT32 zDrvUsb_Powerdown(VOID);
+
+/*******************************************************************************
+ * Function: zDrvUsb3_PowerUp
+ * Description:
+ *
+ * Parameters:
+ * Input:
+ *
+ * Output:
+ *
+ * Returns:
+ *
+ *
+ * Others:
+ ********************************************************************************/
+ SINT32 zDrvUsb3_PowerUp(VOID);
+
+/*******************************************************************************
+ * Function: zDrvUsb3_Powerdown
+ * Description:
+ *
+ * Parameters:
+ * Input:
+ *
+ * Output:
+ *
+ * Returns:
+ *
+ *
+ * Others:
+ ********************************************************************************/
+ SINT32 zDrvUsb3_Powerdown(VOID);
+
+/*******************************************************************************
+ * Function: pow_GetUsbLowPowerFlag
+ * Description: get usb low power flag
+ * Parameters:
+ * Input: N/A
+ *
+ * Output: N/A
+ * Returns:
+ *
+ *
+ * Others: //not use
+ ********************************************************************************/
+
+UINT32 pow_GetUsbLowPowerFlag(VOID);
+
+#endif
+
diff --git a/cp/ps/driver/inc/misc/drvs_usb_detect.h b/cp/ps/driver/inc/misc/drvs_usb_detect.h
new file mode 100644
index 0000000..ade0c43
--- /dev/null
+++ b/cp/ps/driver/inc/misc/drvs_usb_detect.h
@@ -0,0 +1,81 @@
+/*******************************************************************************
+ * Copyright (C) 2007, ZTE Corporation.
+ *
+ * File Name: hal_spi.h
+ * File Mark:
+ * Description: Provide spi hal function prototype declaration and type declaration.
+ * Others:
+ * Version: V0.5
+ * Author: zhenghong
+ * Date: 2008-03-19
+ * History 1:
+ * Date:
+ * Version:
+ * Author:
+ * Modification:
+ * History 2:
+ ********************************************************************************/
+
+#ifndef _USB_DETECT_H
+#define _USB_DETECT_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/****************************************************************************
+* Include files
+****************************************************************************/
+#include "drvs_gpio.h"
+/****************************************************************************
+* Macros
+****************************************************************************/
+#define USB_ENUM_DEBUG_EN 1
+/**
+ * Messages sent from the Phy to the OTG driver.
+ *
+*/
+typedef enum _T_UsbHal_ConnectMessage
+{
+ CONNECTED_TO_HOST = 0x10, /**< Host connect detected */
+ DISCONNECTED_FROM_HOST, /**< Host disconnect detected */
+ CONNECTED_TO_DEVICE, /**< Function connect detected */
+ DISCONNECTED_FROM_DEVICE, /**< Function disconnect detected */
+ CHECK_CONNECT_MODE,
+ CHECK_CONNECT_QUICK_POWER_ON,
+ RECONNECT_TO_HOST
+}T_UsbHal_ConnectMessage;
+
+typedef enum _T_UsbHal_ConnectionState {
+ USB_DEVICE_UNPLUGGED=0,
+ USB_DEVICE_PLUGGED
+} T_UsbHal_ConnectionState;
+
+typedef enum _T_plug_in
+{
+ NOTHING,
+ COMPUTER,
+ CHARGER
+}plug_in;
+/****************************************************************************
+* Types
+****************************************************************************/
+typedef SINT32 (*T_ZDrvUSBRef_ChargerDetect_CallBack)(UINT32);
+/****************************************************************************
+* Constants
+****************************************************************************/
+
+/****************************************************************************
+* Global Variables
+****************************************************************************/
+extern T_ZDrvUSBRef_ChargerDetect_CallBack g_USBRef_ChargerDetect;
+/****************************************************************************
+* Function Prototypes
+****************************************************************************/
+SINT32 zDrvUsbRef_Detect_Initiate(VOID);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /*_HAL_SPI_H*/
diff --git a/cp/ps/driver/inc/misc/drvs_usb_switch.h b/cp/ps/driver/inc/misc/drvs_usb_switch.h
new file mode 100644
index 0000000..52f760d
--- /dev/null
+++ b/cp/ps/driver/inc/misc/drvs_usb_switch.h
@@ -0,0 +1,127 @@
+/*******************************************************************************
+ * Copyright (C) 2007, ZTE Corporation.
+ *
+ * File Name: hal_spi.h
+ * File Mark:
+ * Description: Provide spi hal function prototype declaration and type declaration.
+ * Others:
+ * Version: V0.5
+ * Author: zhenghong
+ * Date: 2008-03-19
+ * History 1:
+ * Date:
+ * Version:
+ * Author:
+ * Modification:
+ * History 2:
+ ********************************************************************************/
+
+#ifndef _HAL_SPI_H
+#define _HAL_SPI_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/****************************************************************************
+* Include files
+****************************************************************************/
+#include "drvs_gpio.h"
+/****************************************************************************
+* Macros
+****************************************************************************/
+#define USB_SWITCH_GPIO_OUT 0
+#define USB_SWITCH_GPIO_IN 1
+#define USB_SWITCH_PIN_MODE_FUNC 0
+#define USB_SWITCH_PIN_MODE_GPIO 1
+#define USB_SWTICH_SEL 46
+#define USB_SWTICH_OE_N 43
+#define DBB2AR9342_POWER_ON 39
+#define DBB2AR9342_RESET 48
+#define DBB2USB_DPOS_PULL_UP 7
+#define USB2DBB_DNEG_DETECT 8
+#define USB_CHAR_DET 8
+#define VTELECOM_18_ARM_UART2_RXD 33
+/****************************************************************************
+* Types
+****************************************************************************/
+/*
+OE* S HSD1+(HSD1-) HSD2+(HSD2-)
+1 X OFF OFF
+0 0 ON OFF
+0 1 OFF ON
+
+ps:HSD1+(HSD1-) connect PC;HSD2+(HSD2-) connect wifi
+OE* connect from GPIO43(ARM_I2S2_WS)
+S connect from GPIO42(ARM_I2S2_DOUT)
+*/
+typedef enum Usb_Switch_Select_Option
+{
+ USB_SWITCH_CONNECT_PC,
+ USB_SWITCH_CONNECT_WIFI,
+ USB_SWITCH_ALL_OFF,
+}T_Usb_Switch_Select_Option;
+
+typedef enum Ar9342_On_Off_Option
+{
+ Ar9342_ON,
+ Ar9342_OFF,
+}T_Ar9342_On_Off_Option;
+
+typedef enum Charger_Usbdevice
+{
+ USBCHARGER,//change to USBCHARGER because it`s the same to Charger_Usbdevice in Drvs_usb_switch.h
+ USBDEVICE,
+}Charger_Usbdevice;
+/****************************************************************************
+* Constants
+****************************************************************************/
+
+/****************************************************************************
+* Global Variables
+****************************************************************************/
+
+/****************************************************************************
+* Function Prototypes
+****************************************************************************/
+UINT32 zDrvUsb_Switch_Select(T_Usb_Switch_Select_Option select);
+
+UINT32 zDrvSetAR9342_ON_OFF(T_Ar9342_On_Off_Option select);
+
+VOID zDrvUSB_2V8_WriteGpio(UINT32 pinNum, UINT32 Value);
+/*******************************************************************************
+ * Function: zDrvCharger_UsbDevice_Detect
+ * Function: return charger or usb device connect
+ * Description:
+ * Parameters:
+ * Input:
+ *
+ * Output:
+ *
+ * Returns: success or fail
+ *
+ *
+ * Others:
+********************************************************************************/
+Charger_Usbdevice zDrvCharger_UsbDevice_Detect(VOID);
+/*******************************************************************************
+ * Function: zDrvCharger_UsbDevice_Prepare
+ * Function: prepare gpio zpm_2v8_gpio08
+ * Description:
+ * Parameters:
+ * Input:
+ *
+ * Output:
+ *
+ * Returns:
+ *
+ *
+ * Others:
+********************************************************************************/
+VOID zDrvCharger_UsbDevice_Prepare(VOID);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /*_HAL_SPI_H*/
diff --git a/cp/ps/driver/inc/misc/drvs_voice_config.h b/cp/ps/driver/inc/misc/drvs_voice_config.h
new file mode 100644
index 0000000..c89013f
--- /dev/null
+++ b/cp/ps/driver/inc/misc/drvs_voice_config.h
@@ -0,0 +1,87 @@
+/*******************************************************************************
+ * Copyright (C) 2007, ZTE Corporation.
+ *
+ * File Name: Drvs_voice_config.h
+ * File Mark:
+ * Description: Provide the interface for the voice config of refdrv
+ * Others:
+ * Version: V0.5
+ * Author: xuxinqiang
+ * Date: 2014-06-04
+ * History 1:
+ * Date:
+ * Version:
+ * Author:
+ * Modification:
+ * History 2:
+ ********************************************************************************/
+#ifndef _DRVS_VPCFG_H
+#define _DRVS_VPCFG_H
+
+/*************************************************************************
+ * Include files *
+ *************************************************************************/
+
+#include "drvs_voiceprocess.h"
+#include "drvs_i2s.h"
+#include "drvs_codec.h"
+#include "drvs_tdm.h"
+
+/**************************************************************************
+ * Types *
+ **************************************************************************/
+
+
+//the size of each buffer should >=0.5MB
+typedef struct _T_ZDrv_VpInOutBuffer
+{
+ UINT8* p_voiceRxInBuffer ;/*the pcm data in the s_voiceRxInBuffer,receive from far-end. */
+ UINT8* p_voiceTxInBuffer ;/* the pcm data in the s_voiceTxInBuffer, receiver from codec.*/
+ UINT8* p_voiceRxOutPutBuffer;/* the pcm data in the s_voiceRxOutPutBuffe, will send to codec.*/
+ UINT8* p_voiceTxOutPutBuffer;/* the pcm data in the s_voiceTxOutBuffer, will send to near end.*/
+
+}T_ZDrv_VpInOutBuffer;
+
+
+typedef struct
+{
+ SINT32 (*hal_VpCfg_OpenBegin_obsolete)(VOID);
+ SINT32 (*hal_VpCfg_OpenEnd_obsolete)(VOID);
+ SINT32 (*hal_VpCfg_Close_obsolete)(VOID);
+ SINT32 (*hal_VpCfg_Open)(T_ZDrvVp_SourceType srctype);
+ SINT32 (*hal_VpCfg_Close)(VOID);
+ SINT32 (*hal_VpCfg_Enable)(VOID);
+ SINT32 (*hal_VpCfg_Disable)(VOID);
+ SINT32 (*hal_VpCfg_SetFs)(T_ZDrv_VpFs fs);
+ SINT32 (*hal_VpCfg_SetInputPath)(T_ZDrv_VpPath path,BOOL enable);
+ SINT32 (*hal_VpCfg_SetOutputPath)(T_ZDrv_VpPath path,BOOL enable);
+ SINT32 (*hal_VpCfg_SetMute)(T_ZDrv_VpPath path,BOOL mute);
+ SINT32 (*hal_VpCfg_SetFmPath)(T_ZDrv_VpPath path,BOOL enable);
+ SINT32 (*hal_VpCfg_SetLoopback)(BOOL enable);
+ SINT32 (*hal_VpCfg_SetInputVol)(T_ZDrv_VpVol vol);
+ SINT32 (*hal_VpCfg_SetOutputVol)(T_ZDrv_VpVol vol);
+ SINT32 (*hal_VpCfg_SetUseProtocol)(T_ZDrvCodec_UseProtocol useProtocol);
+ SINT32 (*hal_VpCfg_GetMixerToneInfo)(T_ZDrvVp_ToneNum toneNum,T_HalMixerToneInfo *toneInfo);
+ SINT32 (*hal_VpCfg_GetAudioLoopInfo)(T_HalAudioLoopTestInfo *audioInfo);
+ SINT32 (*hal_VpCfg_GetAudioLoopResult)(T_HalAudioLoopTestPra *audioPra);
+ SINT32 (*hal_VpCfg_SetInputMute)(BOOL mute);
+ SINT32 (*hal_VpCfg_SetOutputMute)(BOOL mute);
+
+} T_HalVpCfg_Opt;
+extern SINT32 zDrvVp_SetExtAudioCfg(T_ZDrvI2S_Cfg *pI2sNbCfg,T_ZDrvI2S_Cfg *pI2sWbCfg,
+ T_ZDrvTdm_Cfg *pTdmNbCfg,T_ZDrvTdm_Cfg *pTdmWbCfg);
+//voice config
+extern SINT32 zDrvVp_SetI2sCfg(T_ZDrvI2S_Cfg *s_VpI2sCfg);//obsolete
+extern SINT32 zDrvVp_SetExtI2sCfg(T_ZDrvI2S_Cfg *pI2sNbCfg,T_ZDrvI2S_Cfg *pI2sWbCfg);
+
+extern SINT32 zDrvVp_SetInOutBuffer(T_ZDrv_VpInOutBuffer *pInOutBuffer); //obsolete
+extern SINT32 zDrvVp_SetInOutBufferAddSize(T_ZDrv_VpInOutBuffer *pInOutBuffer,UINT32 bufSize);
+extern VOID zDrvVpCfg_SetOperations(T_HalVpCfg_Opt* VpCfg_ObjPtr);
+extern SINT32 zDrvVp_Init(VOID);
+
+extern SINT32 zDrvVoice_Initiate(VOID);
+extern SINT32 Aud_TaskInt_Init(VOID);
+
+//is usd for xinke 20150709 lvwenhua value:0~100 step:1(0.25dB)
+extern SINT32 zDrvVp_SetInitGain(UINT8 value);
+#endif
diff --git a/cp/ps/driver/inc/misc/drvs_voiceprocess.h b/cp/ps/driver/inc/misc/drvs_voiceprocess.h
new file mode 100755
index 0000000..a006449
--- /dev/null
+++ b/cp/ps/driver/inc/misc/drvs_voiceprocess.h
@@ -0,0 +1,304 @@
+/*******************************************************************************
+ * Copyright (C) 2007, ZTE Corporation.
+ *
+ * File Name: Drvs_voiceprocess.h
+ * File Mark:
+ * Description: Provide the interface of using vp
+ * Others:
+ * Version: V0.5
+ * Author: lvwenhua
+ * Date: 2012-06-13
+ * History 1:
+ * Date:
+ * Version:
+ * Author:
+ * Modification:
+ * History 2:
+ ********************************************************************************/
+#ifndef _DRVS_VP_H
+#define _DRVS_VP_H
+
+#include "drvs_i2s.h"
+#include "drvs_tdm.h"
+#include "drvs_volte.h"
+#include "drvs_rpmsg.h"
+#include "NvParam_drv.h"
+
+#define VOICE_TONE_MIXER_FUNCTION
+//#define TEST_WHITE_NOISE
+typedef enum
+{
+ VP_I2S_IDLE = 0,
+ VP_I2S_OPEN,
+ VP_I2S_INUSE,
+ VP_LOOP_ON
+} T_Vp_I2sStatus;
+
+/* Voice process channel selection. */
+typedef enum
+{
+ VP_PATH_HANDSET = 0,
+ VP_PATH_SPEAKER,
+ VP_PATH_HEADSET,
+ VP_PATH_BLUETOOTH,
+ VP_PATH_BLUETOOTH_NO_NR,
+ VP_PATH_HSANDSPK,
+
+ VP_PATH_OFF = 255,
+
+ MAX_VP_PATH = VP_PATH_OFF
+} T_ZDrv_VpPath;
+
+typedef enum
+{
+ VP_VOL_0 = 0,
+ VP_VOL_1,
+ VP_VOL_2,
+ VP_VOL_3,
+ VP_VOL_4,
+ VP_VOL_5,
+ VP_VOL_6,
+ VP_VOL_7,
+ VP_VOL_8,
+ VP_VOL_9,
+ VP_VOL_10,
+ VP_VOL_11,
+
+ MAX_VP_VOL
+} T_ZDrv_VpVol;
+
+typedef enum
+{
+ VP_FS_8000 = 0, ///< 8k sampling rate
+ VP_FS_11025 = 1, ///< 11.025k sampling rate
+ VP_FS_12000 = 2, ///< 12k sampling rate
+ VP_FS_16000 = 3, ///< 16k sampling rate
+ VP_FS_22050 = 4, ///< 22.050k sampling rate
+ VP_FS_24000 = 5, ///< 24k sampling rate
+ VP_FS_32000 = 6, ///< 32k sampling rate
+ VP_FS_44100 = 7, ///< 44.1k sampling rate
+ VP_FS_48000 = 8, ///< 48k sampling rate
+ MAX_VP_FS = 9 ///< Max sampling rate count
+
+} T_ZDrv_VpFs;
+
+typedef enum
+{
+ VP_DTMF_KEY_0 = 0,
+ VP_DTMF_KEY_1,
+ VP_DTMF_KEY_2,
+ VP_DTMF_KEY_3,
+ VP_DTMF_KEY_4,
+ VP_DTMF_KEY_5,
+ VP_DTMF_KEY_6,
+ VP_DTMF_KEY_7,
+ VP_DTMF_KEY_8,
+ VP_DTMF_KEY_9,
+ VP_DTMF_KEY_10, /* * */
+ VP_DTMF_KEY_11, /* # */
+
+ MAX_VP_DTMF_KEY
+} T_ZDrv_VpDtmfKey;
+
+
+//typedef T_ZDrvVolte_Cfg T_ZDrvVp_Cfg
+typedef struct
+{
+ char* pPresetRx;
+ unsigned long PresetLengthRx;
+ char* pPresetTx;
+ unsigned long PresetLengthTx;
+} zDrvVp_NxpParamsTool;
+
+typedef struct
+{
+ char* pPresetRx;
+ unsigned long PresetLengthRx;
+ char* pPresetTx;
+ unsigned long PresetLengthTx;
+} zDrvVp_ParamsTool;
+
+typedef enum
+{
+ VP_VOICE_SOURCE ,
+ VP_AUDIO_SOURCE ,
+ VP_FM_SOURCE ,
+ VP_EXTERN_AUDIO,
+ VP_SOURCE_MAX
+} T_ZDrvVp_SourceType;
+
+/* 0 lowpower;1 sms;2 call standard;3 alarm beep;*/
+typedef enum
+{
+ VP_LOWPOWER_TONE ,
+ VP_SMS_TONE ,
+ VP_CALLSTD_TONE ,
+ VP_ALARM_TONE,
+ VP_CALL_TIME_TONE,
+ VP_0_KEY_TONE,
+ VP_1_KEY_TONE,
+ VP_2_KEY_TONE,
+ VP_3_KEY_TONE,
+ VP_4_KEY_TONE,
+ VP_5_KEY_TONE,
+ VP_6_KEY_TONE,
+ VP_7_KEY_TONE,
+ VP_8_KEY_TONE,
+ VP_9_KEY_TONE,
+ VP_HASH_KEY_TONE, //#
+ VP_ASTERRIX_KEY_TONE, //*
+ VP_RESERVED1_TONE,
+ VP_RESERVED2_TONE,
+ VP_RESERVED3_TONE,
+ VP_RESERVED4_TONE,
+ VP_RESERVED5_TONE,
+ VP_RESERVED6_TONE,
+ VP_TONE_MAX
+} T_ZDrvVp_ToneNum;
+typedef struct _T_HalMixerToneInfo
+{
+ BOOL StartMixer;/*mixer flag TRUE start, FALSE stop;*/
+ BOOL dataIsWb;/* TRUE wb, FALSE nb, for voice mixer;*/
+ UINT32 cur_tone_fcount;/*tone data already processed count*/
+ UINT32 tone_total_size;/*tone data total size,unit 2byte*/
+ UINT32 inter_mixer_fcount;/*inter ,tone_size/data_mixer_oncesize*/
+ UINT32 rem_mixer_count;/*remainder , tone_size%data_mixer_oncesize*/
+ UINT16 *ptdata_mixer;/* tone data array pointer */
+ UINT32 data_mixer_oncesize;/*the size of a data processing, unit 2byte*/
+} T_HalMixerToneInfo;
+
+typedef struct _T_HalAudioLoopTestInfo
+{
+ BOOL startLoopTest;/*audo loop test flag TRUE start, FALSE stop;*/
+ UINT32 fs;/*tone data real frequence*/
+ UINT32 sampFs;/*tone data sample frequence*/
+ UINT8 *ptdata;/* audo loop test data array pointer */
+ UINT32 totalSize;/*tone data total size,unit 2byte*/
+ T_ZDrv_VpVol outpathvol[4];
+
+} T_HalAudioLoopTestInfo;
+typedef struct _T_HalAudioLoopTestPra
+{
+ UINT8 *src;/*tone data frequence*/
+ UINT8 *dest;/*tone data sample frequence*/
+ UINT32 sampfs;
+
+} T_HalAudioLoopTestPra;
+typedef struct
+{
+ //use for vp data process
+ UINT8* pVpTempRxInBuffer; //pVpRxInBuffer
+ UINT8* pVpTempTxInBuffer; //pVpTxInBuffer
+ UINT8* pVpTempRxOutPutBuffer;//pVpRxOutPutBuffer
+ UINT8* pVpTempTxOutPutBuffer;//pVpTxOutPutBuffer
+
+ T_ZDrvI2S_Cfg *pVpI2sCfg; //i2s cfg
+
+ T_ZDrvVp_Cfg vpCfgParam; //s_cfgParam
+
+ T_ZDrvI2s_Params i2sWriteParam; //s_VpI2sWriteParam
+ T_ZDrvI2s_Params i2sReadParam; //s_vpI2sReadParam
+
+ UINT32 frameCount; //s_vpFrameCount
+ UINT32 totalFrameBufSize; //s_vpTotalFrameBufSize
+ UINT32 inOutBufUseSize; //s_inOutBufUseSize
+ UINT32 rxSaveLen; //s_rxSaveLen
+ UINT32 txSaveLen; //s_txSaveLen
+ UINT32 saveLen; //save_len
+
+ UINT8 pcmSlotNum; //s_vpPcmSlotNum
+ UINT8 pcmWbSecDataPosition; //s_vpPcmWbSecDataPosition
+
+ UINT8 volteVpWriteStopFlag;//s_volteVpWriteStopFlag
+ UINT8 volteVpReadStopFlag;//s_volteVpReadStopFlag
+ UINT8 volteVpCfgEnFlag; // s_volteVpCfgEnFlag
+ BOOL firstWriteDataFlag;//s_firstWriteDataFlag
+ BOOL firstReadDataFlag;//s_firstReadDataFlag
+ BOOL i2sIsRstFlag;//s_i2sIsRstFlag
+} T_zDrvVp_SpeechState; // T_zDrvVp_SpeechState
+
+typedef struct
+{
+ UINT8 volteIsWb; //g_volteIsWb
+ UINT8 isUseSlicCodec; //g_isUseSlicCodec
+ UINT8 g_isUseTdm;
+//for voice data process
+ UINT8 voiceInGsmTdMode; //g_voiceInGsmTdMode
+ UINT8 voiceInVolteMode; //g_voiceInVolteMode
+
+ BOOL innerI2sIsMaster;//arm i2s2 g_innerI2sIsMaster
+ BOOL innerI2sIsI2sMode; //g_innerI2sIsI2sMode
+ BOOL vpLoopRuning; //g_vpLoopRuning
+ BOOL muteEn; //g_vpMuteEn
+ //BOOL nxpIsNormal; //g_vpNxpIsNormal
+ BOOL vProcIsNormal; //voice processing is normal flag
+ T_Vp_I2sStatus vpI2sStatus; //VpI2sStatus
+
+ T_ZDrv_VpPath vpPath;// VP_PATH_HEADSET;//VP_PATH_SPEAKER; //VP_PATH_HANDSET; g_vpPath
+ T_ZDrv_VpPath vpLoopPath; //g_vpLoopPath
+ T_ZDrv_VpVol vpVol; //g_vpVol
+ T_ZDrvVoice_MODE voiceMode; //g_vpVoiceMode
+ SINT8 vpInitGain; //s_vpInitGain
+ T_Audio_NvFlag audio_ctrlFlag;//USE 32byte
+
+ UINT8 dtmfDirSel;
+ UINT32 sample_rate;
+ UINT8 useDtmfLoop;
+ SINT32 muteCount;//mute_count
+} T_zDrvVoice_GbVar; //T_zDrvVoice_GbVar
+
+typedef struct
+{
+ //use for store memory address
+ UINT8* pVpRxInBuffer; //s_pVpRxInBuffer
+ UINT8* pVpTxInBuffer; //s_pVpTxInBuffer
+ UINT8* pVpRxOutPutBuffer; //s_pVpRxOutPutBuffer
+ UINT8* pVpTxOutPutBuffer; //s_pVpTxOutPutBuffer
+
+ UINT32 inOutBufSize; //s_inOutBufSize
+
+ T_ZDrvI2S_Cfg *pVpInnerI2sCfg; //s_pVpInnerI2sCfg
+ T_ZDrvI2S_Cfg *pVpExtI2sCfg; //s_pVpExtI2sCfg
+ T_ZDrvI2S_Cfg *pVpExtI2sWbCfg; //s_pVpExtI2sWbCfg
+ T_ZDrvTdm_Cfg *s_pVpTdmCfg;
+ T_ZDrvTdm_Cfg *s_pVpTdmWbCfg;
+ T_ZDrvTdm_Cfg *pVpTdmCfg;
+
+ T_ZDrvRpMsg_Msg pMsg;
+ SINT32 pMsgBuf[2];
+ //SINT32 muteCount;//mute_count
+
+ ZOSS_THREAD_ID vpThread ; //s_VpThread
+ ZOSS_THREAD_ID rcvDtmfThread ; //s_rcvDtmfThread
+ ZOSS_SEMAPHORE_ID vpSemaphore; //s_VpSemaphore
+ ZOSS_SEMAPHORE_ID vpThreadQuitSema;
+
+ ZOSS_THREAD_ID vpLoopThread; //s_VpLoopThread
+ ZOSS_SEMAPHORE_ID vpLoopSemaphore; //s_VpLoopSemaphore
+
+ T_zDrvVp_SpeechState *vpState;
+// T_zDrvVoice_GbVar wrapVpGbVar;
+} T_zDrvVp_State; //T_zDrvVp_State
+
+SINT32 zDrvVp_SetPath(T_ZDrv_VpPath path);
+SINT32 zDrvVp_SetVol(T_ZDrv_VpVol volume);
+SINT32 zDrvVp_SetGain(SINT32 vgain, UINT32 channel);
+/* 0 lowpower;1 sms;2 call standard;3 alarm beep;*/
+SINT32 zDrvVp_ToneMixerStart(T_ZDrvVp_ToneNum toneNum);
+SINT32 zDrvVp_SetMute(UINT32 enable, UINT32 channel);
+SINT32 zDrvVp_RcdOnOff(UINT32 on);
+SINT32 zDrvVp_DtmfTone(UINT32 Num);
+SINT32 zDrvVp_Loop(T_ZDrv_VpPath path);
+SINT32 zDrvVp_RingStart(VOID);
+SINT32 zDrvVp_RingStop(VOID);
+VOID zDrvVp_SetUseSlicFlag(BOOL useSlic);
+SINT32 zDrvVp_NxpSetParam(zDrvVp_NxpParamsTool *NxpParamsTool);
+SINT32 zDrvVp_NxpGetParam(zDrvVp_NxpParamsTool *NxpParamsTool);
+SINT32 zDrvVp_SetFmPath(T_ZDrv_VpPath path, BOOL enable);
+SINT32 zDrvVp_SetParam(zDrvVp_ParamsTool *paramsTool);
+SINT32 zDrvVp_GetParam(zDrvVp_ParamsTool *paramsTool);
+SINT32 zDrvVp_SetNvParam(zDrvVp_ParamsTool *paramsTool);
+SINT32 zDrvVp_GetNvParam(zDrvVp_ParamsTool *paramsTool);
+
+
+#endif
diff --git a/cp/ps/driver/inc/misc/drvs_volte.h b/cp/ps/driver/inc/misc/drvs_volte.h
new file mode 100755
index 0000000..fd31c2d
--- /dev/null
+++ b/cp/ps/driver/inc/misc/drvs_volte.h
@@ -0,0 +1,86 @@
+/*******************************************************************************
+ * Copyright (C) 2007, ZTE Corporation.
+ *
+ * File Name: Drvs_volte.h
+ * File Mark:
+ * Description: Provide the interface of using volte
+ * Others:
+ * Version: V0.5
+ * Author: lvwenhua
+ * Date: 2014-08-4
+ * History 1:
+ * Date:
+ * Version:
+ * Author:
+ * Modification:
+ * History 2:
+ ********************************************************************************/
+#ifndef _DRVS_VOLTE_H
+#define _DRVS_VOLTE_H
+
+#include <linux/volte_drv.h>
+
+typedef enum
+{
+ VOLTE_IDLE = 0,
+ VOLTE_OPEN,
+ VOLTE_INUSE,
+ VOLTE_MAX
+} T_Volte_Status;
+#if 0
+typedef enum
+{
+ VOICE_GSM_MODE = 0,
+ VOICE_TD_MODE ,
+ VOICE_WCDMA_MODE,
+ VOICE_LTE_MODE,
+ VOICE_GSM_TD_MODE,//GSM TD share
+ VOICE_GSM_WCDMA_MODE, //GSM WCDMA share
+ MAX_VOICE_MODE
+} T_ZDrvVoice_MODE;
+typedef struct
+{
+ UINT32 clock_rate;
+ UINT32 channel_count;
+ UINT32 samples_per_frame;
+ UINT32 bits_per_sample;
+ UINT32 mode;
+} T_ZDrvVp_Cfg;
+
+#define T_ZDrvVoice_Cfg T_ZDrvVp_Cfg
+#endif
+
+typedef T_ZDrvVoice_Cfg T_ZDrvVp_Cfg;
+
+typedef struct
+{
+
+ SINT32 (*drv_voice_3G_Open)(VOID);
+ SINT32 (*drv_voice_3G_Close)(VOID);
+
+} T_DrvVoice_3G_Opt;
+
+ typedef struct
+ {
+ void (*drv_dtmfrx_report_cb)(char *dtmf_string, unsigned char string_len);
+ void (*drv_dtmftx_report_cb)(char *dtmf_string, unsigned char string_len);
+ } T_DrvDtmf_Detect_Opt;
+
+ SINT32 zDrvVoice_Open(T_ZDrvVoice_Cfg *cfgParam);
+ SINT32 zDrvVoice_Close(VOID);
+ SINT32 zDrvVoice_ReadStart(VOID);
+ SINT32 zDrvVoice_ReadStop(VOID);
+ SINT32 zDrvVoice_WriteStart(VOID);
+ SINT32 zDrvVoice_WriteStop(VOID);
+ SINT32 zDrvVoice_ReadOneFrame(UINT8 *pBuf);
+ SINT32 zDrvVoice_WriteOneFrame(UINT8 *pBuf);
+VOID zDrvVoice_3G_RegCallbacks(T_DrvVoice_3G_Opt voiceObj);
+
+SINT32 zDrvVolte_AmrEncoderInit(VOID);
+SINT32 zDrvVolte_AmrDecoderInit(VOID);
+SINT32 zDrvVolte_AmrEncoder(UINT8 *pInputBuf,UINT32 inSize,UINT8 *pOutputBuf,UINT32* pOutSize);
+SINT32 zDrvVolte_AmrDecoder(UINT8 *pInputBuf,UINT32 inSize,UINT8 *pOutputBuf,UINT32* pPutSize);
+VOID zDrvVolte_AmrEncoderDeinit(VOID);
+VOID zDrvVolte_AmrDecoderDeinit(VOID);
+#endif
+
diff --git a/cp/ps/driver/inc/misc/drvs_vou.h b/cp/ps/driver/inc/misc/drvs_vou.h
new file mode 100644
index 0000000..9f5467b
--- /dev/null
+++ b/cp/ps/driver/inc/misc/drvs_vou.h
@@ -0,0 +1,341 @@
+/*******************************************************************************
+ * Copyright by ZTE Corporation.
+ *
+ * File Name:
+ * File Mark:
+ * Description:
+ * Others:
+ * Version: v0.1
+ * Author: wuhui
+ * Date: 2016-12-17
+ * History 1:
+ * Date:
+ * Version:
+ * Author:
+ * Modification:
+ * History 2:
+ ********************************************************************************/
+
+#ifndef _DRVS_VOU_H
+#define _DRVS_VOU_H
+
+
+/****************************************************************************
+* Include files
+****************************************************************************/
+
+
+/****************************************************************************
+* Macros
+****************************************************************************/
+
+
+/****************************************************************************
+* Types
+****************************************************************************/
+typedef struct
+{
+ BOOL funcCSC; /*CSC for VL, color conversion from YUV to RGB or from RGB to YUV*/
+ UINT32 VLNum; /*how many Video layers*/
+ UINT32 GLNum; /*how many Video layers*/
+ BOOL VL_SrcYUYV; /*whether VL Source data support YUYV format */
+ BOOL VL_SrcUYVY; /*whether VL Source data support UYVY format */
+ BOOL VL_SrcYVYU; /*whether VL Source data support YVYU format */
+ BOOL VL_SrcVYUY; /*whether VL Source data support VYUY format */
+ BOOL VL_SrcPlanarYUV420; /*whether VL Source data support PlanarYUV420 format*/
+ BOOL VL_SrcSemiPlanarYUV420; /*whether VL Source data support SemiPlanarYUV420 format */
+ BOOL VL_GlobalAlpha; /*whether VL support global alpha */
+ BOOL GL_SrcARGB8888; /*whether GL Source data support ARGB8888 format */
+ BOOL GL_SrcRGB888; /*whether GL Source data support RGB888 format */
+ BOOL GL_SrcRGB565; /*whether GL Source data support RGB565 format */
+ BOOL GL_SrcARGB1555; /*whether GL Source data support ARGB1555 format */
+ BOOL GL_Src8BPP; /*whether GL Source data support 8BPP format */
+ BOOL GL_ColorkeyAlpha; /*whether GL support Color key Alpha */
+ BOOL GL_PixelAlpha; /*whether GL supportPixel Alpha */
+ BOOL GL_GlobalAlpha; /*whether GL support global alpha */
+ UINT32 MAX_WIDTH; /*the max pixel width */
+ UINT32 MAX_HEIGTH; /*the max pixel height */
+ BOOL funcOSD_WB; /*whether support OSD write back function */
+} T_ZDrv_OSDInfo;
+
+typedef enum
+{
+ VOU_OPEN = 0x0,
+ VOU_FINISH_ONEFRAME = 0x1,
+ VOU_ERROR = 0x2,
+ VOU_CLOSE = 0x3,
+ MAX_VOU_STATE = 0x4
+}T_ZDrv_VOUSTATE;
+
+typedef enum
+{
+ eDISABLE = 0,
+ eENABLE =1,
+ MAX_eENABLE_TYPE =2
+}T_ZDrv_ENABLE_TYPE;
+
+typedef enum
+ {
+ eLITTLEENDIAN = 0,
+ eBIGENDIAN = 1,
+ MAX_ENDIAN_TYPE = 2
+ }T_ZDrv_ENDIAN;
+
+typedef enum
+ {
+ eSEMI_PLANAR = 0,
+ ePLANAR = 1,
+ eYUV422_YUYV = 2,
+ eYUV422_YVYU = 3,
+ eYUV422_UYVY = 4,
+ eYUV422_VYUY = 5,
+ MAX_DATASRC_MODE = 6
+ }T_ZDrv_VL_DATASRC_MODE;
+
+typedef enum
+ {
+ eARGB8888 = 0,
+ eRGB888 = 1,
+ eRGB565 = 2,
+ eARGB1555 = 3,
+ e8BPP = 4,
+ MAX_DATAFORMAT = 5
+ }T_ZDrv_GL_DATAFORMAT;
+
+typedef enum
+ {
+ eCOLORKEYALPHA= 0 ,
+ eGLOBALALPHA = 1,
+ ePIXALPHA = 2,
+ MAX_ALPHA_SEL =3
+ }T_ZDrv_ALPHA_SEL;
+
+typedef enum
+{
+ eRANGE0To255 = 0,
+ eRANGE0To127 = 1,
+ MAX_PIXALPHA_RANGE = 2
+}T_ZDrv_PIXALPHA_RANGE;
+
+typedef enum
+{
+ eEXTLOWBITS = 0,
+ eEXTHIGHBITS = 1,
+ MAX_EXT_MODE = 2
+}T_ZDrv_EXT_MODE;
+
+typedef enum
+{
+ eEXTBYALL0 = 0,
+ eEXTBYALL1 = 1,
+ eEXTBYLSB = 2,
+ eEXTBYMSB = 3,
+ MAX_EXT_DATA_TYPE = 4
+}T_ZDrv_EXT_DATA_TYPE;
+
+typedef enum
+{
+ eRGB666_IN_18B = 0,
+ eRGB666_IN_24B = 1,
+ eRGB565_IN_32B = 2,
+ eRGB565_IN_16B = 3,
+ MAX_WB_DATA_MODE = 4
+}T_ZDrv_WB_DATA_MODE;
+
+typedef enum
+{
+ RGB_TO_YUV_FOR_SDTV = 0,
+ YUV_TO_RGB_FOR_SDTV = 1,
+ RGB_TO_YUV_FOR_SDTV_COMPUTER = 2,
+ YUV_TO_RGB_FOR_SDTV_COMPUTER = 3,
+ RGB_TO_YUV_FOR_HDTV = 4,
+ YUV_TO_RGB_FOR_HDTV = 5,
+ RGB_TO_YUV_FOR_HDTV_COMPUTER = 6,
+ YUV_TO_RGB_FOR_HDTV_COMPUTER = 7,
+ MAX_CSC_MODE = 8
+}T_ZDrv_CSC_MODE;
+
+typedef struct _T_VOU_POSXY
+{
+ UINT16 startX; /*dislplay start pos X,in pixels,from top left point of screen,range 0~1919 */
+ UINT16 startY; /*dislplay start pos Y,in pixels,from top left point of screen,range 0~1079 */
+ UINT16 endX; /*dislplay end pos X,in pixels,from top left point of screen,range 0~1919 */
+ UINT16 endY; /*dislplay end pos Y,in pixels,from top left point of screen,range 0~1079 */
+} T_ZDrv_VOU_POSXY;
+
+typedef struct _T_VOU_VL_SRCWH
+{
+ UINT16 VLSrcWidth; /*the source width in pixels, make sure picture boundary is inside screen*/
+ UINT16 VLSrcHeight; /*the source height in pixels, make sure picture boundary is inside screen*/
+} T_ZDrv_VOU_VL_SRCWH;
+
+typedef struct _T_VOU_VL_SRCSTR
+{
+ UINT16 VLLuStr; /*the luma stride in bytes, 8 bytes aligned*/
+ UINT16 VLChrStr; /*the chroma stride in bytes, 8 bytes aligned*/
+} T_ZDrv_VOU_VL_SRCSTR;
+
+typedef struct _T_VOU_VL_YUVADDR
+{
+ UINT8* VL_AddrY; /*address of Y for VL,8 bytes aligned*/
+ UINT8* VL_AddrU; /*address of U for VL,8 bytes aligned*/
+ UINT8* VL_AddrV; /*address of V for VL,8 bytes aligned*/
+} T_ZDrv_VOU_VL_YUVADDR;
+
+typedef struct _T_VOU_VL_GALP
+{
+ T_ZDrv_ENABLE_TYPE VL_GAlpEnable; /*enalble VL layer alpha or not*/
+ UINT8 VL_GAlpVal; /*the global alpha value ,range 0~255,0 is transparent*/
+} T_ZDrv_VOU_VL_GALP;
+
+typedef struct _T_VOU_GL_ALP
+{
+ UINT8 GL_AlpA0; /*the alpha for ARGB1555 When A=0 ,range 0~127 or range 0~255,0 is transparent*/
+ UINT8 GL_AlpA1; /*the alpha for ARGB1555 When A=1 ,range 0~127 or range 0~255,0 is transparent*/
+ UINT8 GL_AlpGlobal; /*the global alpha value ,range 0~255,0 is totally transparent*/
+ T_ZDrv_ALPHA_SEL GL_AlphaMode;
+ T_ZDrv_PIXALPHA_RANGE GL_PixelAlpRange;
+} T_ZDrv_VOU_GL_ALP;
+
+typedef struct _T_VOU_VLPara
+{
+ T_ZDrv_ENABLE_TYPE VLEnable; /*enalble VL layer or not*/
+ UINT8 VLPriority; /*VL layer priority ,value range 0~7,he value must diffrent,the smaller value,the higher priority */
+ T_ZDrv_VOU_POSXY VL_PosXY; /*just need the start X Y,end XY can be calculated based on width and height*/
+ T_ZDrv_VL_DATASRC_MODE VLSrcMode; /*the VL src data mode*/
+ T_ZDrv_VOU_VL_SRCSTR VL_SrcStr;
+ T_ZDrv_VOU_VL_SRCWH VL_SrcHW;
+ T_ZDrv_VOU_VL_YUVADDR VL_AddrYUV;
+ T_ZDrv_VOU_VL_GALP VL_GAlp;
+} T_ZDrv_VOU_VLPara;
+
+typedef struct _T_VOU_GL_EXT
+{
+ T_ZDrv_EXT_MODE GL_ExtDir; /*the extension direction , recommand eEXTLOWBITS ,only for ARGB1555 /RGB 565 */
+ T_ZDrv_EXT_DATA_TYPE GL_ExtDataMode; /*the extension date type, recommand eEXTBYALL0 */
+} T_ZDrv_VOU_GL_EXT;
+
+typedef struct _T_VOU_GL_CK0
+{
+ UINT8 GL_AlpColorIn; /*alpha inside color key region0 and region1 ,range 0~255*/
+ UINT8 GL_CK0_MinR; /*the color key region0,the min R value*/
+ UINT8 GL_CK0_MinG; /*the color key region0,the min G value*/
+ UINT8 GL_CK0_MinB; /*the color key region0,the min B value*/
+ UINT8 GL_AlpColorOut; /*alpha outside color key region0 and region1,range 0~255 */
+ UINT8 GL_CK0_MaxR; /*the color key region0,the max R value*/
+ UINT8 GL_CK0_MaxG; /*the color key region0,the max G value*/
+ UINT8 GL_CK0_MaxB; /*the color key region0,the max B value*/
+} T_ZDrv_VOU_GL_CK0;
+
+typedef struct _T_VOU_GL_CK1
+{
+ T_ZDrv_ENABLE_TYPE GL_CKRegion1Enable; /*enalble color key region1 or not*/
+ UINT8 GL_CK1_MinR; /*the color key region1,the min R value*/
+ UINT8 GL_CK1_MinG; /*the color key region1,the min G value*/
+ UINT8 GL_CK1_MinB; /*the color key region1,the min B value*/
+ UINT8 GL_CK1_MaxR; /*the color key region1,the max R value*/
+ UINT8 GL_CK1_MaxG; /*the color key region1,the max G value*/
+ UINT8 GL_CK1_MaxB; /*the color key region1,the max B value*/
+} T_ZDrv_VOU_GL_CK1;
+
+
+typedef struct _T_VOU_GLPara
+{
+ T_ZDrv_ENABLE_TYPE GLEnable; /*enalble GL layer or not*/
+ UINT8 GLPriority; /*GL layer priority ,value range 0~7;the value must diffrent ,the smaller value,the higher priority */
+ T_ZDrv_ENDIAN GL_endianType; /*the graphic data type ,recommand little endian*/
+ T_ZDrv_VOU_POSXY GL_PosXY;
+ T_ZDrv_GL_DATAFORMAT GLSrcMode; /*the GL src data mode*/
+ T_ZDrv_VOU_GL_ALP GL_Alp;
+ T_ZDrv_VOU_GL_EXT GL_Ext;
+ UINT16 GLStride; /*the stride in bytes, 8 bytes aligned*/
+ UINT8* GL_SrcAddr; /*address of Graphic data,8 bytes aligned*/
+ T_ZDrv_VOU_GL_CK0 GL_CK0;
+ T_ZDrv_VOU_GL_CK1 GL_CK1;
+} T_ZDrv_VOU_GLPara;
+
+typedef struct _T_VOU_MC_WH
+{
+ UINT16 MCScrWidth; /*the screen width, max to 1920, multiple of 2 */
+ UINT16 MCScrHeight; /*the screen height, max to 1088, multiple of 2 */
+}T_ZDrv_VOU_MC_WH;
+
+typedef struct _T_VOU_MC_BG
+{
+ UINT8 MC_BGValueR; /*the main back ground R value*/
+ UINT8 MC_BGValueG; /*the main back ground G value*/
+ UINT8 MC_BGValueB; /*the main back ground B value*/
+}T_ZDrv_VOU_MC_BG;
+
+
+typedef struct _T_VOU_MCPara
+{
+ T_ZDrv_ENABLE_TYPE MCEnable; /*enalble main channel or not*/
+ T_ZDrv_VOU_MC_WH MCSrcWH;
+ T_ZDrv_VOU_MC_BG MC_BG_RGB;
+} T_ZDrv_VOU_MCPara;
+
+typedef struct _T_VOU_WB_BUFADDR
+{
+ UINT8* WB_BufAddr0; /*address of write back frame buffer 0,8 bytes aligned*/
+ UINT8* WB_BufAddr1; /*address of write back frame buffer 1,8 bytes aligned*/
+ UINT8* WB_BufAddr2; /*address of write back frame buffer 2,8 bytes aligned*/
+ UINT8* WB_BufAddr3; /*address of write back frame buffer 3,8 bytes aligned*/
+}T_ZDrv_VOU_WB_BUFADDR;
+
+typedef struct _T_VOU_WBPara
+{
+ T_ZDrv_ENABLE_TYPE WBEnable; /*enalble write back or not*/
+ UINT16 WBStride; /*the write back stride, multiple of 8 */
+ UINT8 WBBufNum; /*indicate how many frame buffers will be used,range 1~4*/
+ UINT8 WBPeriod; /*skip n frames before write back one frame,range 0~7*/
+ T_ZDrv_WB_DATA_MODE WBDataMode;
+ T_ZDrv_VOU_WB_BUFADDR WBBufAddr;
+} T_ZDrv_VOU_WBPara;
+
+typedef struct _T_VOU_CSC_Coeff
+{
+ SINT16 CSC_CoeA; /* the coefficient of X in F(X.Y,Z) */
+ SINT16 CSC_CoeB; /* the coefficient of Y in F(X.Y,Z) */
+ SINT16 CSC_CoeC; /* the coefficient of Z in F(X.Y,Z) */
+ SINT16 CSC_CoeD; /* the coefficient of d in F(X.Y,Z) */
+}T_ZDrv_VOU_CSC_Coeff;
+
+typedef struct _T_VOU_CSC_SPACE
+{
+ UINT8 CSC_SPACE_FLOOR; /* the floor level of col */
+ UINT8 CSC_SPACE_TOP; /* the top level of col */
+}T_ZDrv_VOU_CSC_SPACE;
+
+typedef struct _T_VOU_CSCPara
+{
+ T_ZDrv_ENABLE_TYPE CSCEnable; /*enalble CSC or not*/
+ T_ZDrv_CSC_MODE CSC_ConMode; /* the conversion mode */
+ T_ZDrv_VOU_CSC_Coeff CSC_XYZ_F[3]; /* the coefficient of X in F1(X.Y,Z) ,F2(X.Y,Z) ,F3(X.Y,Z) */
+ T_ZDrv_VOU_CSC_SPACE CSC_SPACE_IN[3]; /* the floor&top level of col_in1, col_in2,col_in3*/
+ T_ZDrv_VOU_CSC_SPACE CSC_SPACE_OUT[3]; /* the floor&top level of col_out1, col_out2,col_out3*/
+} T_ZDrv_VOU_CSCPara;
+
+typedef struct _T_VOU_OSDPara
+{
+ T_ZDrv_VOU_VLPara OSD_VLPara; /*Video layer Parameters*/
+ T_ZDrv_VOU_GLPara OSD_GLPara; /*Graphic layer Parameters*/
+ T_ZDrv_VOU_MCPara OSD_MCPara; /*Main Chanle Parameters*/
+} T_ZDrv_VOU_OSDPara;
+
+/****************************************************************************
+* Constants
+****************************************************************************/
+
+/****************************************************************************
+* Global Variables
+****************************************************************************/
+
+/****************************************************************************
+* Function Prototypes
+****************************************************************************/
+
+
+
+#endif/*_FILENAME_H*/
+
diff --git a/cp/ps/driver/inc/misc/drvs_wdt.h b/cp/ps/driver/inc/misc/drvs_wdt.h
new file mode 100644
index 0000000..3510f60
--- /dev/null
+++ b/cp/ps/driver/inc/misc/drvs_wdt.h
@@ -0,0 +1,141 @@
+/*******************************************************************************
+ * Copyright (C) 2007, ZTE Corporation.
+ *
+ * File Name: hal_wdt.c
+ * File Mark:
+ * Description: watchdog hal interface header file
+ * Others:
+ * Version:
+ * Author: limeifeng
+ * Date: 2014.05.21
+ * History 1:
+ * Date:
+ * Version:
+ * Author:
+ * Modification:
+ * History 2:
+ ******************************************************************************/
+
+ #ifndef DRVS_WDT_H
+ #define DRVS_WDT_H
+/****************************************************************************
+* Include files
+****************************************************************************/
+
+/****************************************************************************
+* Local Macros
+****************************************************************************/
+
+/****************************************************************************
+* Local Types
+****************************************************************************/
+typedef VOID (*wdt_func)(VOID);
+
+/****************************************************************************
+* Local Constants
+****************************************************************************/
+
+/****************************************************************************
+* Local Function Prototypes
+****************************************************************************/
+
+/****************************************************************************
+* Global Constants
+****************************************************************************/
+
+/****************************************************************************
+* Global Variables
+****************************************************************************/
+/****************************************************************************
+* Global Function Prototypes
+****************************************************************************/
+
+/****************************************************************************
+* Function Definitions
+****************************************************************************/
+
+/*******************************************************************************
+ * Function: zDrvWdt_Start
+ * Description:Start watchdog
+ * Parameters:
+ * Input:
+ *
+ * Output:
+ *
+ * Returns:
+ *
+ *
+ * Others:
+ ********************************************************************************/
+ //VOID zDrvWdt_Start(VOID);
+
+
+/*******************************************************************************
+ * Function: zDrvWdt_Stop
+ * Description: stop watchdog
+ * Parameters:
+ * Input:
+ *
+ * Output:
+ *
+ * Returns:
+ *
+ *
+ * Others:
+ ********************************************************************************/
+ VOID zDrvWdt_Stop(VOID);
+
+ /*******************************************************************************
+ * Function: zDrvWdt_GetValue
+ * Description: get watchdog current counter value
+ * Parameters:
+ * Input:
+ *
+ * Output:
+ *
+ * Returns: watchdog current counter value
+ *
+ *
+ * Others:
+ ********************************************************************************/
+//UINT32 zDrvWdt_GetValue(void);
+
+ /*******************************************************************************
+ * Function: zDrvWdt_FeedDog
+ * Description:Feed watchdog
+ * Parameters:
+ * Input: value: 0x0--0xffff
+ *
+ * Output:
+ *
+ * Returns:
+ *
+ *
+ * Others:
+ ********************************************************************************/
+ //void zDrvWdt_FeedDog(UINT32 value);
+
+/*******************************************************************************
+ * Function: zDrvWdt_Initiate
+ * Description: watchdog initiate
+ * Parameters:
+ * Input:
+ *
+ * Output:
+ *
+ * Returns:
+ *
+ *
+ * Others:
+ ********************************************************************************/
+SINT32 zDrvWdt_Initiate(void);
+
+void zDrvWdt_Handle_After_Psm(void);
+
+void zDrvWdt_Handle_Before_Psm(void);
+
+SINT32 zDrvWdt_Register_Handle(wdt_func func, UINT32 interval, bool wakeup, char *handle_name);
+
+SINT32 zDrvWdt_Set_WdtNv(BOOL NvFlag);
+#endif
+
diff --git a/cp/ps/driver/inc/misc/drvs_zsp.h b/cp/ps/driver/inc/misc/drvs_zsp.h
new file mode 100644
index 0000000..3844e98
--- /dev/null
+++ b/cp/ps/driver/inc/misc/drvs_zsp.h
@@ -0,0 +1,90 @@
+/***********************************************************************
+* Copyright (C) 2001, ZTE Corporation.
+*
+* File Name: drvs_zsp.h
+* File Mark:
+* Description: zsp hal interface declaration.
+* Others:
+* Version: v1.0
+* Author: zhangyingjun
+* Date: 2009-03-23
+*
+* History 1:
+* Date:
+* Version:
+* Author:
+* Modification:
+* History 2:
+* Date: 2009.05.20
+* Version:v1.3.0
+* Author: wangxia
+* Modification: add ZSP_Reset function
+**********************************************************************/
+
+#ifndef HAL_ZSP_H
+#define HAL_ZSP_H
+
+
+/*************************************************************************
+ * Include files *
+ *************************************************************************/
+
+
+/*************************************************************************
+ * Macro *
+ *************************************************************************/
+
+
+/**************************************************************************
+ * Types *
+ **************************************************************************/
+ typedef enum
+{
+ ZSP_DC,
+ ZSP_CC,
+ MAX_ZSP_NUM
+} T_ZDrvZsp_Num;
+
+/**************************************************************************
+ * Global Variable *
+ **************************************************************************/
+
+
+/**************************************************************************
+ * Function Prototypes *
+ **************************************************************************/
+
+
+/*******************************************************************************
+ * Function: BOOT_ZSP_Init
+ * Description: ZSP initialization function,including powering on through Jtag Server & powering on through nandflash
+ * Parameters:
+ * Input:
+ *
+ * Output:
+ *
+ * Returns:
+ *
+ *
+ * Others:
+ ********************************************************************************/
+VOID BOOT_ZSP_Init(T_ZDrvZsp_Num num);
+
+
+/*******************************************************************************
+ * Function: ZSP_Reset
+ * Description: reset ZSP
+ * Parameters:
+ * Input:
+ *
+ * Output:
+ *
+ * Returns:
+ *
+ *
+ * Others:
+ ********************************************************************************/
+ VOID zsp_Reset(VOID);
+
+#endif /* HAL_ZSP_H */
+
diff --git a/cp/ps/driver/inc/misc/edcp_test.h b/cp/ps/driver/inc/misc/edcp_test.h
new file mode 100644
index 0000000..ae34bbc
--- /dev/null
+++ b/cp/ps/driver/inc/misc/edcp_test.h
@@ -0,0 +1,31 @@
+#ifndef EDCPTEST_H
+#define EDCPTEST_H
+void memcpy_edcp(U32* pCopyTo, U32* pSource, U32 num_index, U32 num_word);
+void data_pre(void);
+
+void ul_asyn_dat_cmp( void);
+void ul_syn_dat_cmp( void);
+void dl_asyn_dat_cmp( void);
+
+void EDCP_SW_ENCRYPT(void);
+
+
+//ddr data ram src addr
+#define DDR_SRC_DATA_UL 0x24010000//0x24200000//ddr data ram base ddr 2M byte if 1496 byte enough for 1000 pdcp pdu
+#define DDR_SRC_DATA_EMAC 0x24205000//0x24600000//ddr data ram base ddr
+#define DDR_SRC_DATA_DL 0x245F0000//0x24A00000//ddr data ram base ddr
+//#define DDR_SRC_DATA_CHECKSUM 0x250b0000//0x24E00000//ddr data ram base ddr
+
+//ddr data ram des addr
+#define DDR_DES_DATA_UL 0x25300000// allocate to UL SYN
+#define DDR_DES_DATA_EMAC 0x254F5000//0x25700000
+#define DDR_DES_DATA_DL 0x25BE0000//0x25B00000
+//#define DDR_DES_DATA_CHECKSUM 0x266A0000//0x25F00000
+
+#define DDR_ADDR_INTERVAL 0x2000//0x1f40//8000 //0x7D0 //2000
+
+
+#define DDR_SRC_UL_ENC_DL 0x26400000
+#define DDR_DES_UL_ENC_DL 0x27000000
+
+#endif /* #ifndef EDCPTEST_H */
diff --git a/cp/ps/driver/inc/misc/mmc_drvs_io.h b/cp/ps/driver/inc/misc/mmc_drvs_io.h
new file mode 100644
index 0000000..a11f6a8
--- /dev/null
+++ b/cp/ps/driver/inc/misc/mmc_drvs_io.h
@@ -0,0 +1,76 @@
+/*******************************************************************************
+ * Copyright (C) 2007, ZTE Corporation.
+ *
+ * File Name:
+ * File Mark:
+ * Description:
+ * Others:
+ * Version:
+ * Author: XUJINYOU
+ * Date: 2014-7-28
+ * History 1:
+ * Date:
+ * Version:
+ * Author:
+ * Modification:
+ * History 2:
+ ********************************************************************************/
+
+#ifndef _MMC_DRVS_IO_H
+#define _MMC_DRVS_IO_H
+
+typedef struct _T_MmcDrv_Ops T_MmcDrv_Ops;
+
+
+struct _T_MmcDrv_Ops
+{
+ SINT32 (*open)(VOID *devdata, UINT32 flags);
+ SINT32 (*read)(VOID *devdata, VOID*param1, VOID*param2);
+ SINT32 (*write)(VOID *devdata,VOID *param1, VOID*param2);
+ SINT32 (*ioctrl)(VOID *devdata, UINT32 event, VOID*param);
+ SINT32 (*close)(VOID *devdata);
+};
+
+
+
+#define MMC_DRVNAME_LEN 20
+#define MMC_APPNAME_LEN 20
+
+typedef struct _T_MmcDrv
+{
+ struct list_head node;
+ UINT8 drvName[MMC_DRVNAME_LEN];
+ T_MmcDrv_Ops* drv_op;
+ struct list_head devlist;
+ UINT32 devcount;
+}T_MmcDrv, *PTMmcDrv;
+
+#define MMC_DEVNAME_LEN 20
+
+typedef struct _T_MmcDev
+{
+ VOID* priv;
+ UINT8 devName[MMC_DEVNAME_LEN];
+ T_MmcDrv* driver;
+ VOID*param;
+ struct list_head devNode;
+}T_MmcDev,*PTMmcDev;
+
+
+typedef struct _T_MmcData_Collect
+{
+ UINT8 type;
+ UINT8 fun_num;
+ UINT16 blk_size;
+ UINT32 startaddr; /*startpos for blk, start addr for bytes*/
+ UINT32 count; /**/
+ UINT32 flag; /*b:0 fifo*/
+ VOID* pbuffer;
+ VOID (*Mmccallback)(struct _T_MmcData_Collect* param);
+ VOID*priv;
+}T_MmcData_Collect, *PMmcData_Collect;
+
+
+
+#endif
+
diff --git a/cp/ps/driver/inc/misc/mmc_export.h b/cp/ps/driver/inc/misc/mmc_export.h
new file mode 100644
index 0000000..b930095
--- /dev/null
+++ b/cp/ps/driver/inc/misc/mmc_export.h
@@ -0,0 +1,52 @@
+#ifndef _MMC_EXPORT_HEAD_H
+#define _MMC_EXPORT_HEAD_H
+#include "mmc_drvs_io.h"
+
+
+typedef enum _e_notify_event
+{
+ MMC_CARD_ARRIVAL = 0,
+ MMC_CARD_REMOVE,
+ MMC_CARD_SUSPEND,
+ MMC_CARD_RESUME,
+ MMC_NOTIFY_NUM
+}e_notify_event;
+
+typedef enum _e_mmc_DrpEvent
+{
+ MMC_CARD_GET_CAPACITY,
+ MMC_CARD_ERASE_BLK,
+ MMC_CARD_SET_BLKSIZE,
+ MMC_CARD_ENABLE_FUNC,
+ MMC_CARD_DISABLE_FUNC,
+ MMC_CARD_SET_FUNC_BLKSIZE,
+ MMC_CARD_GET_FUNC_INFO,
+ MMC_SDIO_CLAIM_IRQ,
+ MMC_SDIO_RELEASE_IRQ,
+ MMC_SDIO_CARD_RESET,
+ MMC_CARD_OPEN,
+ MMC_CARD_CLOSE,
+ MMC_CARD_WRITE ,
+ MMC_CARD_READ,
+ MMC_CARD_IOCTROL,
+ MMC_CARD_OP_NUM
+}e_mmc_DrpEvent;
+
+#define SD_DEFAULT_BLKSIZE 512
+
+
+#define MMC_CARD_TYPE_MMC 0 /* MMC card */
+#define MMC_CARD_TYPE_SD 1 /* SD card */
+#define MMC_CARD_TYPE_SDIO 2 /* SDIO card */
+#define MMC_CARD_TYPE_SD_COMBO 3 /* SD combo (IO+mem) card */
+
+SINT32 mmc_loadDrv(const char* drvName, VOID* param);
+
+SINT32 mmc_unloadDrv(VOID* param);
+
+typedef VOID (*mmcApp_notify)(e_notify_event, VOID*, VOID*);
+
+SINT32 mmcApp_notifyRegister(const char* appName,mmcApp_notify mmcNotify);
+
+
+#endif
diff --git a/cp/ps/driver/inc/pub/drv_stub.h b/cp/ps/driver/inc/pub/drv_stub.h
new file mode 100644
index 0000000..77c2110
--- /dev/null
+++ b/cp/ps/driver/inc/pub/drv_stub.h
@@ -0,0 +1,301 @@
+/*******************************************************************************
+ * Copyright (C) 2007, ZTE Corporation.
+ *
+ * File Name: drv_stub.h
+ * File Mark:
+ * Description:
+ * Others:
+ * Version: 1.0
+ * Author: wangxia
+ * Date: 2008-2-22
+ * History 1:
+ * Date:
+ * Version:
+ * Author:
+ * Modification:
+ * History 2:
+ ********************************************************************************/
+
+#ifndef _DRV_STUB_H
+#define _DRV_STUB_H
+
+
+/****************************************************************************
+* Include files
+****************************************************************************/
+
+
+/****************************************************************************
+* Macros
+****************************************************************************/
+
+
+/****************************************************************************
+* Types
+****************************************************************************/
+
+/****************************************************************************************
+ ****************************************************************************************
+ * PCL configuration
+ ****************************************************************************************
+ ****************************************************************************************/
+
+/* Table of symbolic names for the pcl registers
+ keep in sync with PAD_pcl_registers.
+ ONLY APPEND TO THIS LIST NEVER REMOVE OR PUT ENTRIES INBETWEEN*/
+enum PAD_symbolic_names
+{
+ /*0*/
+ PAD_HS_DET,
+ PAD_ACC_DET,
+ PAD_ACC_PWR_EN,
+ PAD_PERF_MON,
+ PAD_HS_SENDEND,
+
+ /*5*/
+ PAD_FLIP_SENSE,
+ PAD_AP_RESET,
+ PAD_AP_CLK_REQ,
+ PAD_VCXO_EN,
+ PAD_MAIN_SUB,
+
+ /*10*/
+ PAD_LCD_RESET,
+ PAD_LCD_COMPIC_RESET,
+ PCD_LCD_COMPIC,
+ PAD_SMC_VZ_N,
+ PAD_SMC_RST,
+
+ /*15*/
+ PAD_USB_ID,
+ PAD_VBOOST_SEL,
+ PAD_VBOOST_EN,
+ GPS_GPIO_ASIC_STDBY,
+ GPS_GPIO_ASIC_RESET,
+
+ /*20*/
+ GPS_GPIO_ASIC_RFON,
+ PAD_CHK_EXT_32KHZ,
+ PAD_HS_AMP_SD,
+ PAD_HS_AMP_UD,
+ PAD_HS_AMP_CLK,
+
+ /*25*/
+ PAD_GDC_INT,
+ PAD_LED_RED,
+ PAD_LED_GREEN,
+ PAD_LED_BLUE,
+ PAD_IRDA_SD,
+
+ /*30*/
+ PAD_MMC_CMD,
+ PAD_MMC_DAT,
+ PAD_MMC_ROD_EN,
+ PAD_MMC_VDD_EN, /* VDD for MMC Interface */
+ PAD_SD_MMC_DAT1, /* DAT1 for extended SD/MMC */
+
+ /*35*/
+ PAD_SD_MMC_DAT2, /* DAT2 for extended SD/MMC */
+ PAD_SD_MMC_DAT3, /* DAT3 for extended SD/MMC */
+ PAD_CS_SD_MMC, /* RDE: CS for SD/MMC when using SPI Interface */
+ PAD_MTSR_SD_MMC, /* RDE: CS for SD/MMC when using SPI Interface */
+ PAD_MRST_SD_MMC, /* RDE: CS for SD/MMC when using SPI Interface */
+
+ /*40*/
+ PAD_CLK_SD_MMC, /* RDE: CS for SD/MMC when using SPI Interface */
+ PAD_USART1_RTS,
+ PAD_DIF_CD,
+ PAD_DIF_CS,
+ PAD_HS_MONO_STEREO,
+
+ /*45*/
+ PAD_CIF_RESET, /*reset for camera on MPE*/
+ PAD_CIF_PD, /*PowerDown of camera on MPE*/
+ PAD_SIM_VCC,
+ PAD_LEDPWM2, /* SUB LCD Backlight enable for NBG_HW_MPE: name corresponds to schematic name but PWM is not supported by HW */
+ PAD_I2S1_CLK0,
+
+ /*50*/
+ PAD_I2S1_RX,
+ PAD_I2S1_TX,
+ PAD_I2S1_WA0,
+ PAD_MMC_DETECT, /*MMC/SD card detection on MPE*/
+ PAD_CHG_VAL,
+
+ /*55*/
+ PAD_I2C_SCL,
+ PAD_I2C_SDA,
+ PAD_RST_FM,
+ PAD_FLASH,
+ PAD_VIBRATOR,
+
+ /*60*/
+ PAD_FM_AMP_SHDN,
+ PAD_CIF_RESET2, /* Reset for the second camera */
+ PAD_DIF_VD, /* Intensity setting via boost converter for both Displays on MPEU Userboard */
+ PAD_I2S2_CLK0,
+ PAD_I2S2_RX,
+
+ /*65*/
+ PAD_I2S2_TX,
+ PAD_I2S2_WA0,
+ PAD_BT_RST,
+ PAD_IRDA_TX,
+ PAD_IRDA_RX,
+
+ /*70*/
+ PAD_BB_TEST, /* Setting bb into test mode */
+ PAD_RESET_DET, /* Set on traps */
+ PAD_PP_PMU_EXT_ON, /* Wakeup ap pmu */
+ PAD_IPC_ACK,
+ PAD_USIF1_RTS,
+
+ /*75*/
+ PAD_USIF1_CTS,
+ PAD_USIF2_RTS,
+ PAD_USIF2_CTS,
+ PAD_USIF3_RTS,
+ PAD_USIF3_CTS,
+
+ /*80*/
+ PAD_MIC_INT,
+ PAD_AUD_AMP,
+ PAD_SP_AMP_SD,
+ PAD_SPK_RCV_SEL,
+ PAD_FM_BBP_SEL,
+
+ /*85*/
+ PAD_BT_TX, /* serial (USIF) port pins used for BT communication */
+ PAD_BT_RX,
+ PAD_BT_RTS,
+ PAD_BT_CTS,
+ PAD_UART0_RTS,
+
+ /*90*/
+ PAD_UART0_CTS,
+ PAD_UART1_RTS,
+ PAD_UART1_CTS,
+ PAD_UART1_RX,
+ PAD_UART1_TX,
+
+ /*95*/
+ PAD_I2S1_CLK1,
+ PAD_I2S1_WA1,
+ PAD_I2S2_CLK1,
+ PAD_I2S2_WA1,
+ PAD_USIF1_TXD,
+
+ /*100*/
+ PAD_USIF1_RXD,
+ PAD_WLAN_1V8_EN,
+ PAD_MMC2_VDD_EN,
+ PAD_MMC2_ROD_EN,
+ PAD_MMC2_CLK,
+
+ /*105*/
+ PAD_MMC2_CMD,
+ PAD_MMC2_DAT0,
+ PAD_MMC2_DAT1,
+ PAD_MMC2_DAT2,
+ PAD_MMC2_DAT3,
+
+ /*110*/
+ PAD_MMCI_IO_RESET,
+ PAD_AUD_SPK_AMP, /*Used for SPK_AMP for NX1*/
+ PAD_AUDIO_SELECT, /*Used for AUDIO_SELECT for NX1*/
+ PAD_EE_WP,
+ PAD_USIF1_CLK,
+
+ /*115*/
+ PAD_USIF1_HWAKE,
+ PAD_USIF1_MWAKE,
+ PAD_USIF1_RX,
+ PAD_USIF1_TX,
+ PAD_USIF2_CLK,
+
+ /*120*/
+ PAD_USIF2_HWAKE,
+ PAD_USIF2_MWAKE,
+ PAD_USIF2_RX,
+ PAD_USIF2_TX,
+ PAD_USIF3_CLK,
+
+ /*125*/
+ PAD_USIF3_HWAKE,
+ PAD_USIF3_MWAKE,
+ PAD_USIF3_RX,
+ PAD_USIF3_TX,
+ PAD_CAM_STBY_2,
+
+ /*130*/
+ PAD_CAM_RESET_2,
+ PAD_CAM_STBY_1,
+ PAD_CAM_RESET_1,
+ PAD_CHG_DET,
+ PAD_BAT_DET,
+
+ /*135*/
+ PAD_CHG_ON,
+ PAD_USB_ON,
+ BL_LED_DIM,
+ PAD_USB_DET,
+ PAD_USB_CHR_EN,
+
+ /*140*/
+ PAD_CIF_DATA0,
+ PAD_CIF_DATA1,
+ PAD_CIF_DATA2,
+ PAD_CIF_DATA3,
+ PAD_CIF_DATA4,
+
+ /*145*/
+ PAD_CIF_DATA5,
+ PAD_CIF_DATA6,
+ PAD_CIF_DATA7,
+ PAD_CIF_PCLK,
+ PAD_CIF_HSYNC,
+
+ /*150*/
+ PAD_CIF_VSYNC,
+ PAD_MODEM_READY,
+
+ PAD_LAST_ELEMENT /* always last element, used to verify PCL setup */
+ };
+
+/*IFX BB version*/
+typedef enum
+{
+ SYS_BB_VER_INVALID,
+ SYS_BB_VER_SGOLD,
+ SYS_BB_VER_SGOLDLITE,
+ SYS_BB_VER_SGOLD2,
+ SYS_BB_VER_SGOLD3,
+ SYS_BB_VER_SGOLDRADIO
+} bb_ver_enum;
+
+typedef enum
+{
+ SYS_BB_REV_INVALID,
+ SYS_BB_REV_10,
+ SYS_BB_REV_11,
+ SYS_BB_REV_11A,
+ SYS_BB_REV_11B,
+ SYS_BB_REV_12,
+ SYS_BB_REV_20
+} bb_rev_enum;
+/****************************************************************************
+* Constants
+****************************************************************************/
+
+/****************************************************************************
+* Global Variables
+****************************************************************************/
+
+/****************************************************************************
+* Function Prototypes
+****************************************************************************/
+
+
+
+#endif/*_DRV_STUB_H*/
+
diff --git a/cp/ps/driver/inc/pub/drvs_assert.h b/cp/ps/driver/inc/pub/drvs_assert.h
new file mode 100644
index 0000000..f19e464
--- /dev/null
+++ b/cp/ps/driver/inc/pub/drvs_assert.h
@@ -0,0 +1,61 @@
+/*******************************************************************************
+ * Copyright (C) 2007, ZTE Corporation.
+ *
+ * File Name: drvs_assert.h
+ * File Mark:
+ * Description:
+ * Others:
+ * Version: v0.1
+ * Author: weizhigang
+ * Date: 2009-7-3
+ * History 1:
+ * Date:
+ * Version:
+ * Author:
+ * Modification:
+ * History 2:
+ ********************************************************************************/
+
+#ifndef _DRVS_ASSERT_H
+#define _DRVS_ASSERT_H
+
+
+/****************************************************************************
+* Include files
+****************************************************************************/
+
+
+
+/****************************************************************************
+* Function Prototypes
+****************************************************************************/
+#if 0
+VOID zDrvExcep_Handler(CHAR *pExp,
+ const CHAR * pcFileName,
+ const CHAR * pcFuncName,
+ UINT32 dwLineNum);
+
+
+
+/****************************************************************************
+* Macros
+****************************************************************************/
+#ifdef _DEBUG
+#ifdef _OS_WIN
+#define zDrv_ASSERT(_EXP)
+#else
+#define zDrv_ASSERT(_EXP) do{if(!(_EXP)) zDrvExcep_Handler(#_EXP,(CHAR *)__FILE__,(CHAR *)__FUNCTION__,__LINE__);}while(0)
+#endif
+#else
+#define zDrv_ASSERT(_EXP)
+#endif
+#endif
+
+#define zDrv_ASSERT(_EXP) zOss_ASSERT(_EXP)
+#define zDrv_AssertEx(FalseCondition, code) {if (FalseCondition) { zDrv_ASSERT(0); return code; }}
+
+
+
+
+#endif/*_DRVS_ASSERT_H*/
+
diff --git a/cp/ps/driver/inc/pub/drvs_bitops.h b/cp/ps/driver/inc/pub/drvs_bitops.h
new file mode 100644
index 0000000..b277274
--- /dev/null
+++ b/cp/ps/driver/inc/pub/drvs_bitops.h
@@ -0,0 +1,299 @@
+/*******************************************************************************
+ * Copyright (C) 2007, ZTE Corporation.
+ *
+ * File Name:
+ * File Mark:
+ * Description:
+ * Others:
+ * Version: 1.0
+ * Author: geanfeng
+ * Date: 2013-09-25
+ * History 1:
+ * Date:
+ * Version:
+ * Author:
+ * Modification:
+ * History 2:
+ ********************************************************************************/
+
+#ifndef _DRVS_BITOPS_H_
+#define _DRVS_BITOPS_H_
+
+#ifdef __cplusplus
+extern "C"
+ {
+#endif
+
+/****************************************************************************
+* Include files
+****************************************************************************/
+
+/****************************************************************************
+* Macros
+****************************************************************************/
+
+
+/****************************************************************************
+* Types
+****************************************************************************/
+
+/****************************************************************************
+* Constants
+****************************************************************************/
+
+/****************************************************************************
+* Global Variables
+****************************************************************************/
+
+/****************************************************************************
+* Function Prototypes
+****************************************************************************/
+#ifndef set_bit
+/*
+ * These functions are the basis of our bit ops.
+ *
+ * First, the atomic bitops. These use native endian.
+ */
+static inline void ____atomic_set_bit(unsigned int bitnum, volatile unsigned long *p)
+{
+ unsigned long flags;
+ unsigned long mask = 1UL << (bitnum & 31);
+
+ p += bitnum >> 5;
+
+ LOCK_SAVE(flags);
+ *p |= mask;
+ LOCK_RESTORE(flags);
+}
+
+static inline void ____atomic_clear_bit(unsigned int bitnum, volatile unsigned long *p)
+{
+ unsigned long flags;
+ unsigned long mask = 1UL << (bitnum & 31);
+
+ p += bitnum >> 5;
+
+ LOCK_SAVE(flags);
+ *p &= ~mask;
+ LOCK_RESTORE(flags);
+}
+
+static inline void ____atomic_change_bit(unsigned int bitnum, volatile unsigned long *p)
+{
+ unsigned long flags;
+ unsigned long mask = 1UL << (bitnum & 31);
+
+ p += bitnum >> 5;
+
+ LOCK_SAVE(flags);
+ *p ^= mask;
+ LOCK_RESTORE(flags);
+}
+
+static inline int
+____atomic_test_and_set_bit(unsigned int bitnum, volatile unsigned long *p)
+{
+ unsigned long flags;
+ unsigned int res;
+ unsigned long mask = 1UL << (bitnum & 31);
+
+ p += bitnum >> 5;
+
+ LOCK_SAVE(flags);
+ res = *p;
+ *p = res | mask;
+ LOCK_RESTORE(flags);
+
+ return (res & mask) != 0;
+}
+
+static inline int
+____atomic_test_and_clear_bit(unsigned int bitnum, volatile unsigned long *p)
+{
+ unsigned long flags;
+ unsigned int res;
+ unsigned long mask = 1UL << (bitnum & 31);
+
+ p += bitnum >> 5;
+
+ LOCK_SAVE(flags);
+ res = *p;
+ *p = res & ~mask;
+ LOCK_RESTORE(flags);
+
+ return (res & mask) != 0;
+}
+
+static inline int
+____atomic_test_and_change_bit(unsigned int bitnum, volatile unsigned long *p)
+{
+ unsigned long flags;
+ unsigned int res;
+ unsigned long mask = 1UL << (bitnum & 31);
+
+ p += bitnum >> 5;
+
+ LOCK_SAVE(flags);
+ res = *p;
+ *p = res ^ mask;
+ LOCK_RESTORE(flags);
+
+ return (res & mask) != 0;
+}
+
+
+#define ATOMIC_BITOP(name,nr,p) ____atomic_##name(nr, p)
+
+/*
+ * Native endian atomic definitions.
+ */
+#define set_bit(nr,p) ATOMIC_BITOP(set_bit,nr,p)
+#define clear_bit(nr,p) ATOMIC_BITOP(clear_bit,nr,p)
+#define change_bit(nr,p) ATOMIC_BITOP(change_bit,nr,p)
+#define test_and_set_bit(nr,p) ATOMIC_BITOP(test_and_set_bit,nr,p)
+#define test_and_clear_bit(nr,p) ATOMIC_BITOP(test_and_clear_bit,nr,p)
+#define test_and_change_bit(nr,p) ATOMIC_BITOP(test_and_change_bit,nr,p)
+
+static inline void ____relax_set_bit(unsigned int bitnum, volatile unsigned long *p)
+{
+ unsigned long mask = 1UL << (bitnum & 31);
+
+ p += bitnum >> 5;
+ *p |= mask;
+}
+
+static inline void ____relax_clear_bit(unsigned int bitnum, volatile unsigned long *p)
+{
+ unsigned long mask = 1UL << (bitnum & 31);
+
+ p += bitnum >> 5;
+ *p &= ~mask;
+}
+
+static inline void ____relax_change_bit(unsigned int bitnum, volatile unsigned long *p)
+{
+ unsigned long mask = 1UL << (bitnum & 31);
+
+ p += bitnum >> 5;
+ *p ^= mask;
+}
+
+static inline int
+____relax_test_and_set_bit(unsigned int bitnum, volatile unsigned long *p)
+{
+ unsigned int res;
+ unsigned long mask = 1UL << (bitnum & 31);
+
+ p += bitnum >> 5;
+
+ res = *p;
+ *p = res | mask;
+
+ return (res & mask) != 0;
+}
+
+static inline int
+____relax_test_and_clear_bit(unsigned int bitnum, volatile unsigned long *p)
+{
+ unsigned int res;
+ unsigned long mask = 1UL << (bitnum & 31);
+
+ p += bitnum >> 5;
+
+ res = *p;
+ *p = res & ~mask;
+
+ return (res & mask) != 0;
+}
+
+static inline int
+____relax_test_and_change_bit(unsigned int bitnum, volatile unsigned long *p)
+{
+ unsigned int res;
+ unsigned long mask = 1UL << (bitnum & 31);
+
+ p += bitnum >> 5;
+
+ res = *p;
+ *p = res ^ mask;
+
+ return (res & mask) != 0;
+}
+
+#define RELAX_BITOP(name,nr,p) ____relax_##name(nr, p)
+
+/*
+ * Native endian relax definitions.
+ */
+#define __set_bit(nr,p) RELAX_BITOP(set_bit,nr,p)
+#define __clear_bit(nr,p) RELAX_BITOP(clear_bit,nr,p)
+#define __change_bit(nr,p) RELAX_BITOP(change_bit,nr,p)
+#define __test_and_set_bit(nr,p) RELAX_BITOP(test_and_set_bit,nr,p)
+#define __test_and_clear_bit(nr,p) RELAX_BITOP(test_and_clear_bit,nr,p)
+#define __test_and_change_bit(nr,p) RELAX_BITOP(test_and_change_bit,nr,p)
+
+
+/*
+ * This routine doesn't need to be atomic.
+ */
+static inline int test_bit(int nr, const void * addr)
+{
+ return ((unsigned char *) addr)[nr >> 3] & (1U << (nr & 7));
+}
+
+#endif
+
+static inline void ____atomic_set_bits_u32(unsigned int start, unsigned int nr,
+ unsigned int val, volatile unsigned long *p)
+{
+ unsigned long flags;
+ unsigned long start_u32;
+ unsigned long nr_u32;
+ unsigned long val_u32;
+ unsigned long mask;
+ unsigned long tmp;
+
+ start_u32 = start & 31;
+ nr_u32 = nr & 31;
+ mask = ~(((1<<nr_u32) - 1) << start_u32);
+ val_u32 = (val & ((1<<nr_u32) - 1)) << start_u32;
+
+ LOCK_SAVE(flags);
+ tmp = *p;
+ tmp &= mask;
+ tmp |= val_u32;
+ *p = tmp;
+ LOCK_RESTORE(flags);
+}
+
+static inline void ____relax_set_bits_u32(unsigned int start, unsigned int nr,
+ unsigned int val, volatile unsigned long *p)
+{
+ unsigned long start_u32;
+ unsigned long nr_u32;
+ unsigned long val_u32;
+ unsigned long mask;
+ unsigned long tmp;
+
+ start_u32 = start & 31;
+ nr_u32 = nr & 31;
+ mask = ~(((1<<nr_u32) - 1) << start_u32);
+ val_u32 = (val & ((1<<nr_u32) - 1)) << start_u32;
+
+ tmp = *p;
+ tmp &= mask;
+ tmp |= val_u32;
+ *p = tmp;
+}
+#define ATOMIC_BITSOP(name,start,nr,val,p) ____atomic_##name(start,nr,val,p)
+#define RELAX_BITSOP(name,start,nr,val,p) ____atomic_##name(start,nr,val,p)
+
+#define set_bits_u32(start,nr,val,p) ATOMIC_BITSOP(set_bits_u32,start,nr,val,p)
+#define __set_bits_u32(start,nr,val,p) RELAX_BITSOP(set_bits_u32,start,nr,val,p)
+
+
+#ifdef __cplusplus
+ }
+#endif
+
+#endif
diff --git a/cp/ps/driver/inc/pub/drvs_bits.h b/cp/ps/driver/inc/pub/drvs_bits.h
new file mode 100644
index 0000000..4fb269e
--- /dev/null
+++ b/cp/ps/driver/inc/pub/drvs_bits.h
@@ -0,0 +1,65 @@
+/*********************************************************************
+* °æÈ¨ËùÓÐ (C)2003, ÉîÛÚÊÐÖÐÐËͨѶ¹É·ÝÓÐÏÞ¹«Ë¾¡£
+*
+* ÎļþÃû³Æ£º drvs_bits.h
+* ÄÚÈÝÕªÒª£º ΪÑÚÂ붨Òå
+* ×÷ Õߣº ÖÐÐËͨѶ £º¹Ù»ª²®
+* Íê³ÉÈÕÆÚ£º 2006Äê04ÔÂ18ÈÕ
+**********************************************************************/
+
+/*ÐÞ¸ÄÀúÊ·£º
+2006-04-18: hbguan,´´½¨
+*/
+
+#ifndef _BITS_H
+#define _BITS_H
+
+#ifdef __cplusplus
+extern "C"
+ {
+#endif
+
+typedef unsigned long WORD32;
+
+/* ¶¨ÒåλÑÚÂë*/
+#define bit01 ((WORD32)0x00000001)
+#define bit02 ((WORD32)0x00000003)
+#define bit03 ((WORD32)0x00000007)
+#define bit04 ((WORD32)0x0000000f)
+#define bit05 ((WORD32)0x0000001f)
+#define bit06 ((WORD32)0x0000003f)
+#define bit07 ((WORD32)0x0000007f)
+#define bit08 ((WORD32)0x000000ff)
+#define bit09 ((WORD32)0x000001ff)
+#define bit10 ((WORD32)0x000003ff)
+#define bit11 ((WORD32)0x000007ff)
+#define bit12 ((WORD32)0x00000fff)
+#define bit13 ((WORD32)0x00001fff)
+#define bit14 ((WORD32)0x00003fff)
+#define bit15 ((WORD32)0x00007fff)
+#define bit16 ((WORD32)0x0000ffff)
+#define bit17 ((WORD32)0x0001ffff)
+#define bit18 ((WORD32)0x0003ffff)
+#define bit19 ((WORD32)0x0007ffff)
+#define bit20 ((WORD32)0x000fffff)
+#define bit21 ((WORD32)0x001fffff)
+#define bit22 ((WORD32)0x003fffff)
+#define bit23 ((WORD32)0x007fffff)
+#define bit24 ((WORD32)0x00ffffff)
+#define bit25 ((WORD32)0x01ffffff)
+#define bit26 ((WORD32)0x03ffffff)
+#define bit27 ((WORD32)0x07ffffff)
+#define bit28 ((WORD32)0x0fffffff)
+#define bit29 ((WORD32)0x1fffffff)
+#define bit30 ((WORD32)0x3fffffff)
+#define bit31 ((WORD32)0x7fffffff)
+#define bit32 ((WORD32)0xffffffff)
+
+
+#ifdef __cplusplus
+ }
+#endif
+
+#endif /* _BITS_H */
+
+
diff --git a/cp/ps/driver/inc/pub/drvs_config.h b/cp/ps/driver/inc/pub/drvs_config.h
new file mode 100644
index 0000000..46645f5
--- /dev/null
+++ b/cp/ps/driver/inc/pub/drvs_config.h
@@ -0,0 +1,95 @@
+/***********************************************************************
+* Copyright (C) 2013, ZTE Corporation.
+*
+* File Name: drvs_config.h
+* File Mark:
+* Description: drv configurate declaration.
+* Others:
+* Version: v1.0
+* Author: geanfeng
+* Date: 2013-04-03
+
+**********************************************************************/
+#ifndef _DRVS_CONFIG_H_
+#define _DRVS_CONFIG_H_
+
+
+/*************************************************************************
+* Include files *
+*************************************************************************/
+
+/****************************************************************************
+* Base Type
+****************************************************************************/
+#define DRV_CONFIG(x) DRV_CONFIG_##x
+
+#ifdef DRV_CONFIG_C_DEFINE
+#define DRV_CONFIG_DEFINE(x) int DRV_CONFIG_##x;
+#else
+#ifdef DRV_CONFIG_WRITE_ENABLE
+#define DRV_CONFIG_DEFINE(x) extern int DRV_CONFIG_##x;
+#else
+#define DRV_CONFIG_DEFINE(x) extern const int DRV_CONFIG_##x;
+#endif
+#endif
+/**************************************************************************
+* Types *
+**************************************************************************/
+/*
+* INT
+*/
+
+
+/*
+* TIMER
+*/
+
+/*
+* USB
+*/
+DRV_CONFIG_DEFINE(USB_HIGHSPEED)
+DRV_CONFIG_DEFINE(USB_VNIC_HALF_DL_BUFF_CNT)
+DRV_CONFIG_DEFINE(USB_IP_4BYTE_ALIGNMENT)
+DRV_CONFIG_DEFINE(USB_VNIC_ADJUST_MAXPKTNUM)
+
+/*
+* I2C
+*/
+DRV_CONFIG_DEFINE(USE_PMIC_I2C)
+DRV_CONFIG_DEFINE(USE_I2C0)
+DRV_CONFIG_DEFINE(USE_I2C1)
+
+/*
+* FLASH TYPE
+*/
+DRV_CONFIG_DEFINE(USE_NAND)
+DRV_CONFIG_DEFINE(USE_SPI_NAND)
+DRV_CONFIG_DEFINE(USE_MMC)
+DRV_CONFIG_DEFINE(USE_PART)
+
+/*
+* UART
+*/
+DRV_CONFIG_DEFINE(USE_UART_AUTOBAUD)
+/**************************************************************************
+* Global Variable *
+**************************************************************************/
+
+/**************************************************************************
+ * Function Prototypes *
+ **************************************************************************/
+ /****************************************************************************
+ * Function: zDrvConfig_Initiate
+ * Description: initialize drv configuration;
+ * Parameters:
+ * Input:
+ * Output:
+ *
+ * Returns:
+ * SINT32
+ *
+ * Others:
+ ***************************************************************************/
+SINT32 zDrvConfig_Initiate(VOID);
+
+#endif /*_DRVS_CONFIG_H_*/
diff --git a/cp/ps/driver/inc/pub/drvs_debug.h b/cp/ps/driver/inc/pub/drvs_debug.h
new file mode 100644
index 0000000..63d2d38
--- /dev/null
+++ b/cp/ps/driver/inc/pub/drvs_debug.h
@@ -0,0 +1,81 @@
+/*******************************************************************************
+ * Copyright (C) 2007, ZTE Corporation.
+ *
+ * File Name:
+ * File Mark:
+ * Description:
+ * Others:
+ * Version: 1.0
+ * Author: geanfeng
+ * Date: 2013-09-25
+ * History 1:
+ * Date:
+ * Version:
+ * Author:
+ * Modification:
+ * History 2:
+ ********************************************************************************/
+
+#ifndef _DRVS_DEBUG_H_
+#define _DRVS_DEBUG_H_
+
+/****************************************************************************
+* Include files
+****************************************************************************/
+#include "drvs_general.h"
+
+/****************************************************************************
+* Macros
+****************************************************************************/
+
+/****************************************************************************
+* Types
+****************************************************************************/
+typedef enum _T_DRV_DEBUG_PRINT_CHANNEL
+{
+ DRV_DEBUG_PRINT_ZOSS,
+ DRV_DEBUG_PRINT_DCC
+}T_DRV_DEBUG_PRINT_CHANNEL;
+
+/****************************************************************************
+* Constants
+****************************************************************************/
+
+/****************************************************************************
+* Global Variables
+****************************************************************************/
+extern volatile T_DRV_DEBUG_PRINT_CHANNEL g_debugPrintChnSel;
+/****************************************************************************
+* Function Prototypes
+****************************************************************************/
+SINT32 debug_Print(const VOID *pFormat, ... );
+/*******************************************************************************
+* Function:zDrvDebug_Printf
+* Description: log´òÓ¡
+* Parameters:
+* pFormat:¸ñʽ»¯×Ö·û´®
+* Output:
+*
+* Returns:
+*
+*
+* Others:
+********************************************************************************/
+#ifdef _OS_WIN
+#define zDrvDebug_Printf
+#else
+#define zDrvDebug_Printf(s...) \
+{ \
+ if (g_debugPrintChnSel == DRV_DEBUG_PRINT_ZOSS)\
+ {\
+ zOss_Printf(SUBMDL_HAL, PRINT_LEVEL_NORMAL, s);\
+ }\
+ else \
+ {\
+ debug_Print(s);\
+ }\
+}
+#endif
+
+#endif/*_DRVS_IO_H_*/
+
diff --git a/cp/ps/driver/inc/pub/drvs_hisr.h b/cp/ps/driver/inc/pub/drvs_hisr.h
new file mode 100644
index 0000000..b8d8909
--- /dev/null
+++ b/cp/ps/driver/inc/pub/drvs_hisr.h
@@ -0,0 +1,57 @@
+/*******************************************************************************
+ * Copyright (C) 2007, ZTE Corporation.
+ *
+ * File Name: drvs_hisr.h
+ * File Mark:
+ * Description: Provide the declaration of return types for HAL
+ * Others:
+ * Version: V0.5
+ * Author: xiongquan
+ * Date: 2008-12-01
+ * History 1:
+ * Date:
+ * Version:
+ * Author:
+ * Modification:
+ * History 2:
+ ********************************************************************************/
+#ifndef _DRVS_HISR_H
+#define _DRVS_HISR_H
+
+/****************************************************************************
+* Types
+****************************************************************************/
+typedef struct _T_Drv_Hisr
+{
+ UINT8 active;
+ UINT32 event;
+ ZOSS_THREAD_ID pid;
+ ZOSS_SEMAPHORE_ID semid;
+ VOID * devPtr;
+}
+T_Drv_Hisr;
+
+typedef VOID(*FUNC_HISRENTRY)(SINT32 arg);
+
+/****************************************************************************
+* Constants
+****************************************************************************/
+
+/****************************************************************************
+* Global Variables
+****************************************************************************/
+
+/****************************************************************************
+* Function Prototypes
+****************************************************************************/
+SINT32 zDrv_HisrCreate(T_Drv_Hisr * hisr, CHAR *name, SINT32 size, SINT32 priority, FUNC_HISRENTRY hisr_entry, VOID *hisr_device);
+VOID zDrv_HisrFree(T_Drv_Hisr * hisr);
+VOID zDrv_HisrStart(T_Drv_Hisr * hisr, UINT32 event);
+VOID zDrv_HisrActivate(T_Drv_Hisr * hisr);
+VOID zDrv_HisrWaitSem(T_Drv_Hisr * hisr);
+VOID zDrv_HisrResetEvent (T_Drv_Hisr *hisr, UINT32 event);
+SINT32 zDrv_HisrInitSem(T_Drv_Hisr * hisr);
+
+
+#endif
+
diff --git a/cp/ps/driver/inc/pub/drvs_list.h b/cp/ps/driver/inc/pub/drvs_list.h
new file mode 100644
index 0000000..d0cf02b
--- /dev/null
+++ b/cp/ps/driver/inc/pub/drvs_list.h
@@ -0,0 +1,701 @@
+#ifndef _DRVS_LIST_H
+#define _DRVS_LIST_H
+
+#ifndef _OS_LINUX
+
+#ifdef __ARMCC_VERSION
+#define __INLINE __inline
+#else
+#define __INLINE inline
+#endif
+
+
+typedef unsigned int size_t;
+
+/**
+ * container_of - cast a member of a structure out to the containing structure
+ * @ptr: the pointer to the member.
+ * @type: the type of the container struct this is embedded in.
+ * @member: the name of the member within the struct.
+ *
+ */
+#if defined(__ARMCC_VERSION) || defined(_OS_WIN)
+#define container_of(ptr, type, member) ( \
+ (type *)( (char *)ptr - offsetof(type,member) ))
+#else
+#define container_of(ptr, type, member) ({ \
+ const typeof( ((type *)0)->member ) *__mptr = (ptr); \
+ (type *)( (char *)__mptr - offsetof(type,member) );})
+#endif
+/*
+ * used to verify that nobody uses non-initialized list entries.
+ */
+#define LIST_POISON1 ((void *) 0x0)
+#define LIST_POISON2 ((void *) 0x0)
+
+
+/*
+ * Simple doubly linked list implementation.
+ *
+ * Some of the internal functions ("__xxx") are useful when
+ * manipulating whole lists rather than single entries, as
+ * sometimes we already know the next/prev entries and we can
+ * generate better code by using them directly rather than
+ * using the generic single-entry routines.
+ */
+
+struct list_head {
+ struct list_head *next, *prev;
+};
+
+#define LIST_HEAD_INIT(name) { &(name), &(name) }
+
+#define LIST_HEAD(name) \
+ struct list_head name = LIST_HEAD_INIT(name)
+
+static __INLINE void INIT_LIST_HEAD(struct list_head *list_ptr)
+{
+ list_ptr->next = list_ptr;
+ list_ptr->prev = list_ptr;
+}
+
+/*
+ * Insert a new entry between two known consecutive entries.
+ *
+ * This is only for internal list manipulation where we know
+ * the prev/next entries already!
+ */
+static __INLINE void __list_add(struct list_head *new_ptr,
+ struct list_head *prev,
+ struct list_head *next)
+{
+ next->prev = new_ptr;
+ new_ptr->next = next;
+ new_ptr->prev = prev;
+ prev->next = new_ptr;
+}
+
+/**
+ * list_add - add a new entry
+ * @new_ptr: new entry to be added
+ * @head: list head to add it after
+ *
+ * Insert a new entry after the specified head.
+ * This is good for implementing stacks.
+ */
+static __INLINE void list_add(struct list_head *new_ptr, struct list_head *head)
+{
+ __list_add(new_ptr, head, head->next);
+}
+
+/**
+ * list_add_tail - add a new entry
+ * @new_ptr: new entry to be added
+ * @head: list head to add it before
+ *
+ * Insert a new entry before the specified head.
+ * This is useful for implementing queues.
+ */
+static __INLINE void list_add_tail(struct list_head *new_ptr, struct list_head *head)
+{
+ __list_add(new_ptr, head->prev, head);
+}
+
+/*
+ * Delete a list entry by making the prev/next entries
+ * point to each other.
+ *
+ * This is only for internal list manipulation where we know
+ * the prev/next entries already!
+ */
+static __INLINE void __list_del(struct list_head *prev, struct list_head *next)
+{
+ next->prev = prev;
+ prev->next = next;
+}
+
+/**
+ * list_del - deletes entry from list.
+ * @entry: the element to delete from the list.
+ * Note: list_empty() on entry does not return true after this, the entry is
+ * in an undefined state.
+ */
+static __INLINE void list_del(struct list_head *entry)
+{
+ __list_del(entry->prev, entry->next);
+ entry->next = (struct list_head *)LIST_POISON1;
+ entry->prev = (struct list_head *)LIST_POISON2;
+}
+
+/**
+ * list_replace - replace old entry by new one
+ * @old : the element to be replaced
+ * @new_ptr : the new element to insert
+ *
+ * If @old was empty, it will be overwritten.
+ */
+static __INLINE void list_replace(struct list_head *old,
+ struct list_head *new_ptr)
+{
+ new_ptr->next = old->next;
+ new_ptr->next->prev = new_ptr;
+ new_ptr->prev = old->prev;
+ new_ptr->prev->next = new_ptr;
+}
+
+static __INLINE void list_replace_init(struct list_head *old,
+ struct list_head *new_ptr)
+{
+ list_replace(old, new_ptr);
+ INIT_LIST_HEAD(old);
+}
+
+/**
+ * list_del_init - deletes entry from list and reinitialize it.
+ * @entry: the element to delete from the list.
+ */
+static __INLINE void list_del_init(struct list_head *entry)
+{
+ __list_del(entry->prev, entry->next);
+ INIT_LIST_HEAD(entry);
+}
+
+/**
+ * list_move - delete from one list and add as another's head
+ * @list: the entry to move
+ * @head: the head that will precede our entry
+ */
+static __INLINE void list_move(struct list_head *list_ptr, struct list_head *head)
+{
+ __list_del(list_ptr->prev, list_ptr->next);
+ list_add(list_ptr, head);
+}
+
+/**
+ * list_move_tail - delete from one list and add as another's tail
+ * @list: the entry to move
+ * @head: the head that will follow our entry
+ */
+static __INLINE void list_move_tail(struct list_head *list_ptr,
+ struct list_head *head)
+{
+ __list_del(list_ptr->prev, list_ptr->next);
+ list_add_tail(list_ptr, head);
+}
+
+/**
+ * list_is_last - tests whether @list_ptr is the last entry in list @head
+ * @list_ptr: the entry to test
+ * @head: the head of the list
+ */
+static __INLINE int list_is_last(const struct list_head *list_ptr,
+ const struct list_head *head)
+{
+ return list_ptr->next == head;
+}
+
+/**
+ * list_empty - tests whether a list is empty
+ * @head: the list to test.
+ */
+static __INLINE int list_empty(const struct list_head *head)
+{
+ return head->next == head;
+}
+
+/**
+ * list_empty_careful - tests whether a list is empty and not being modified
+ * @head: the list to test
+ *
+ * Description:
+ * tests whether a list is empty _and_ checks that no other CPU might be
+ * in the process of modifying either member (next or prev)
+ *
+ * NOTE: using list_empty_careful() without synchronization
+ * can only be safe if the only activity that can happen
+ * to the list entry is list_del_init(). Eg. it cannot be used
+ * if another CPU could re-list_add() it.
+ */
+static __INLINE int list_empty_careful(const struct list_head *head)
+{
+ struct list_head *next = head->next;
+ return (next == head) && (next == head->prev);
+}
+
+/**
+ * list_is_singular - tests whether a list has just one entry.
+ * @head: the list to test.
+ */
+static __INLINE int list_is_singular(const struct list_head *head)
+{
+ return !list_empty(head) && (head->next == head->prev);
+}
+
+static __INLINE void __list_cut_position(struct list_head *list_ptr,
+ struct list_head *head, struct list_head *entry)
+{
+ struct list_head *new_first = entry->next;
+ list_ptr->next = head->next;
+ list_ptr->next->prev = list_ptr;
+ list_ptr->prev = entry;
+ entry->next = list_ptr;
+ head->next = new_first;
+ new_first->prev = head;
+}
+
+/**
+ * list_cut_position - cut a list into two
+ * @list_ptr: a new list to add all removed entries
+ * @head: a list with entries
+ * @entry: an entry within head, could be the head itself
+ * and if so we won't cut the list
+ *
+ * This helper moves the initial part of @head, up to and
+ * including @entry, from @head to @list. You should
+ * pass on @entry an element you know is on @head. @list
+ * should be an empty list or a list you do not care about
+ * losing its data.
+ *
+ */
+static __INLINE void list_cut_position(struct list_head *list_ptr,
+ struct list_head *head, struct list_head *entry)
+{
+ if (list_empty(head))
+ return;
+ if (list_is_singular(head) &&
+ (head->next != entry && head != entry))
+ return;
+ if (entry == head)
+ INIT_LIST_HEAD(list_ptr);
+ else
+ __list_cut_position(list_ptr, head, entry);
+}
+
+static __INLINE void __list_splice(const struct list_head *list_ptr,
+ struct list_head *prev,
+ struct list_head *next)
+{
+ struct list_head *first = list_ptr->next;
+ struct list_head *last = list_ptr->prev;
+
+ first->prev = prev;
+ prev->next = first;
+
+ last->next = next;
+ next->prev = last;
+}
+
+/**
+ * list_splice - join two lists, this is designed for stacks
+ * @list_ptr: the new list to add.
+ * @head: the place to add it in the first list.
+ */
+static __INLINE void list_splice(const struct list_head *list_ptr,
+ struct list_head *head)
+{
+ if (!list_empty(list_ptr))
+ __list_splice(list_ptr, head, head->next);
+}
+
+/**
+ * list_splice_tail - join two lists, each list being a queue
+ * @list_ptr: the new list to add.
+ * @head: the place to add it in the first list.
+ */
+static __INLINE void list_splice_tail(struct list_head *list_ptr,
+ struct list_head *head)
+{
+ if (!list_empty(list_ptr))
+ __list_splice(list_ptr, head->prev, head);
+}
+
+/**
+ * list_splice_init - join two lists and reinitialise the emptied list.
+ * @list_ptr: the new list to add.
+ * @head: the place to add it in the first list.
+ *
+ * The list at @list is reinitialised
+ */
+static __INLINE void list_splice_init(struct list_head *list_ptr,
+ struct list_head *head)
+{
+ if (!list_empty(list_ptr)) {
+ __list_splice(list_ptr, head, head->next);
+ INIT_LIST_HEAD(list_ptr);
+ }
+}
+
+/**
+ * list_splice_tail_init - join two lists and reinitialise the emptied list
+ * @list_ptr: the new list to add.
+ * @head: the place to add it in the first list.
+ *
+ * Each of the lists is a queue.
+ * The list at @list is reinitialised
+ */
+static __INLINE void list_splice_tail_init(struct list_head *list_ptr,
+ struct list_head *head)
+{
+ if (!list_empty(list_ptr)) {
+ __list_splice(list_ptr, head->prev, head);
+ INIT_LIST_HEAD(list_ptr);
+ }
+}
+
+/**
+ * list_entry - get the struct for this entry
+ * @ptr: the &struct list_head pointer.
+ * @type: the type of the struct this is embedded in.
+ * @member: the name of the list_struct within the struct.
+ */
+#define list_entry(ptr, type, member) \
+ container_of(ptr, type, member)
+
+/**
+ * list_first_entry - get the first element from a list
+ * @ptr: the list head to take the element from.
+ * @type: the type of the struct this is embedded in.
+ * @member: the name of the list_struct within the struct.
+ *
+ * Note, that list is expected to be not empty.
+ */
+#define list_first_entry(ptr, type, member) \
+ list_entry((ptr)->next, type, member)
+
+/**
+ * list_for_each - iterate over a list
+ * @pos: the &struct list_head to use as a loop cursor.
+ * @head: the head for your list.
+ */
+#define list_for_each(pos, head) \
+ for (pos = (head)->next; prefetch(pos->next), pos != (head); \
+ pos = pos->next)
+
+/**
+ * __list_for_each - iterate over a list
+ * @pos: the &struct list_head to use as a loop cursor.
+ * @head: the head for your list.
+ *
+ * This variant differs from list_for_each() in that it's the
+ * simplest possible list iteration code, no prefetching is done.
+ * Use this for code that knows the list to be very short (empty
+ * or 1 entry) most of the time.
+ */
+#define __list_for_each(pos, head) \
+ for (pos = (head)->next; pos != (head); pos = pos->next)
+
+/**
+ * list_for_each_prev - iterate over a list backwards
+ * @pos: the &struct list_head to use as a loop cursor.
+ * @head: the head for your list.
+ */
+#define list_for_each_prev(pos, head) \
+ for (pos = (head)->prev; prefetch(pos->prev), pos != (head); \
+ pos = pos->prev)
+
+/**
+ * list_for_each_safe - iterate over a list safe against removal of list entry
+ * @pos: the &struct list_head to use as a loop cursor.
+ * @n: another &struct list_head to use as temporary storage
+ * @head: the head for your list.
+ */
+#define list_for_each_safe(pos, n, head) \
+ for (pos = (head)->next, n = pos->next; pos != (head); \
+ pos = n, n = pos->next)
+
+/**
+ * list_for_each_prev_safe - iterate over a list backwards safe against removal of list entry
+ * @pos: the &struct list_head to use as a loop cursor.
+ * @n: another &struct list_head to use as temporary storage
+ * @head: the head for your list.
+ */
+#define list_for_each_prev_safe(pos, n, head) \
+ for (pos = (head)->prev, n = pos->prev; \
+ prefetch(pos->prev), pos != (head); \
+ pos = n, n = pos->prev)
+
+/**
+ * list_for_each_entry - iterate over list of given type
+ * @pos: the type * to use as a loop cursor.
+ * @head: the head for your list.
+ * @member: the name of the list_struct within the struct.
+ */
+#define list_for_each_entry(pos, head, member) \
+ for (pos = list_entry((head)->next, typeof(*pos), member); \
+ prefetch(pos->member.next), &pos->member != (head); \
+ pos = list_entry(pos->member.next, typeof(*pos), member))
+
+/**
+ * list_for_each_entry_reverse - iterate backwards over list of given type.
+ * @pos: the type * to use as a loop cursor.
+ * @head: the head for your list.
+ * @member: the name of the list_struct within the struct.
+ */
+#define list_for_each_entry_reverse(pos, head, member) \
+ for (pos = list_entry((head)->prev, typeof(*pos), member); \
+ prefetch(pos->member.prev), &pos->member != (head); \
+ pos = list_entry(pos->member.prev, typeof(*pos), member))
+
+/**
+ * list_prepare_entry - prepare a pos entry for use in list_for_each_entry_continue()
+ * @pos: the type * to use as a start point
+ * @head: the head of the list
+ * @member: the name of the list_struct within the struct.
+ *
+ * Prepares a pos entry for use as a start point in list_for_each_entry_continue().
+ */
+#define list_prepare_entry(pos, head, member) \
+ ((pos) ? : list_entry(head, typeof(*pos), member))
+
+/**
+ * list_for_each_entry_continue - continue iteration over list of given type
+ * @pos: the type * to use as a loop cursor.
+ * @head: the head for your list.
+ * @member: the name of the list_struct within the struct.
+ *
+ * Continue to iterate over list of given type, continuing after
+ * the current position.
+ */
+#define list_for_each_entry_continue(pos, head, member) \
+ for (pos = list_entry(pos->member.next, typeof(*pos), member); \
+ prefetch(pos->member.next), &pos->member != (head); \
+ pos = list_entry(pos->member.next, typeof(*pos), member))
+
+/**
+ * list_for_each_entry_continue_reverse - iterate backwards from the given point
+ * @pos: the type * to use as a loop cursor.
+ * @head: the head for your list.
+ * @member: the name of the list_struct within the struct.
+ *
+ * Start to iterate over list of given type backwards, continuing after
+ * the current position.
+ */
+#define list_for_each_entry_continue_reverse(pos, head, member) \
+ for (pos = list_entry(pos->member.prev, typeof(*pos), member); \
+ prefetch(pos->member.prev), &pos->member != (head); \
+ pos = list_entry(pos->member.prev, typeof(*pos), member))
+
+/**
+ * list_for_each_entry_from - iterate over list of given type from the current point
+ * @pos: the type * to use as a loop cursor.
+ * @head: the head for your list.
+ * @member: the name of the list_struct within the struct.
+ *
+ * Iterate over list of given type, continuing from current position.
+ */
+#define list_for_each_entry_from(pos, head, member) \
+ for (; prefetch(pos->member.next), &pos->member != (head); \
+ pos = list_entry(pos->member.next, typeof(*pos), member))
+
+/**
+ * list_for_each_entry_safe - iterate over list of given type safe against removal of list entry
+ * @pos: the type * to use as a loop cursor.
+ * @n: another type * to use as temporary storage
+ * @head: the head for your list.
+ * @member: the name of the list_struct within the struct.
+ */
+#define list_for_each_entry_safe(pos, n, head, member) \
+ for (pos = list_entry((head)->next, typeof(*pos), member), \
+ n = list_entry(pos->member.next, typeof(*pos), member); \
+ &pos->member != (head); \
+ pos = n, n = list_entry(n->member.next, typeof(*n), member))
+
+/**
+ * list_for_each_entry_safe_continue
+ * @pos: the type * to use as a loop cursor.
+ * @n: another type * to use as temporary storage
+ * @head: the head for your list.
+ * @member: the name of the list_struct within the struct.
+ *
+ * Iterate over list of given type, continuing after current point,
+ * safe against removal of list entry.
+ */
+#define list_for_each_entry_safe_continue(pos, n, head, member) \
+ for (pos = list_entry(pos->member.next, typeof(*pos), member), \
+ n = list_entry(pos->member.next, typeof(*pos), member); \
+ &pos->member != (head); \
+ pos = n, n = list_entry(n->member.next, typeof(*n), member))
+
+/**
+ * list_for_each_entry_safe_from
+ * @pos: the type * to use as a loop cursor.
+ * @n: another type * to use as temporary storage
+ * @head: the head for your list.
+ * @member: the name of the list_struct within the struct.
+ *
+ * Iterate over list of given type from current point, safe against
+ * removal of list entry.
+ */
+#define list_for_each_entry_safe_from(pos, n, head, member) \
+ for (n = list_entry(pos->member.next, typeof(*pos), member); \
+ &pos->member != (head); \
+ pos = n, n = list_entry(n->member.next, typeof(*n), member))
+
+/**
+ * list_for_each_entry_safe_reverse
+ * @pos: the type * to use as a loop cursor.
+ * @n: another type * to use as temporary storage
+ * @head: the head for your list.
+ * @member: the name of the list_struct within the struct.
+ *
+ * Iterate backwards over list of given type, safe against removal
+ * of list entry.
+ */
+#define list_for_each_entry_safe_reverse(pos, n, head, member) \
+ for (pos = list_entry((head)->prev, typeof(*pos), member), \
+ n = list_entry(pos->member.prev, typeof(*pos), member); \
+ &pos->member != (head); \
+ pos = n, n = list_entry(n->member.prev, typeof(*n), member))
+
+/*
+ * Double linked lists with a single pointer list head.
+ * Mostly useful for hash tables where the two pointer list head is
+ * too wasteful.
+ * You lose the ability to access the tail in O(1).
+ */
+
+struct hlist_head {
+ struct hlist_node *first;
+};
+
+struct hlist_node {
+ struct hlist_node *next, **pprev;
+};
+
+#define HLIST_HEAD_INIT { .first = NULL }
+#define HLIST_HEAD(name) struct hlist_head name = { .first = NULL }
+#define INIT_HLIST_HEAD(ptr) ((ptr)->first = NULL)
+static __INLINE void INIT_HLIST_NODE(struct hlist_node *h)
+{
+ h->next = NULL;
+ h->pprev = NULL;
+}
+
+static __INLINE int hlist_unhashed(const struct hlist_node *h)
+{
+ return !h->pprev;
+}
+
+static __INLINE int hlist_empty(const struct hlist_head *h)
+{
+ return !h->first;
+}
+
+static __INLINE void __hlist_del(struct hlist_node *n)
+{
+ struct hlist_node *next = n->next;
+ struct hlist_node **pprev = n->pprev;
+ *pprev = next;
+ if (next)
+ next->pprev = pprev;
+}
+
+static __INLINE void hlist_del(struct hlist_node *n)
+{
+ __hlist_del(n);
+ n->next = (struct hlist_node *)LIST_POISON1;
+ n->pprev = (struct hlist_node **)LIST_POISON2;
+}
+
+static __INLINE void hlist_del_init(struct hlist_node *n)
+{
+ if (!hlist_unhashed(n)) {
+ __hlist_del(n);
+ INIT_HLIST_NODE(n);
+ }
+}
+
+static __INLINE void hlist_add_head(struct hlist_node *n, struct hlist_head *h)
+{
+ struct hlist_node *first = h->first;
+ n->next = first;
+ if (first)
+ first->pprev = &n->next;
+ h->first = n;
+ n->pprev = &h->first;
+}
+
+/* next must be != NULL */
+static __INLINE void hlist_add_before(struct hlist_node *n,
+ struct hlist_node *next)
+{
+ n->pprev = next->pprev;
+ n->next = next;
+ next->pprev = &n->next;
+ *(n->pprev) = n;
+}
+
+static __INLINE void hlist_add_after(struct hlist_node *n,
+ struct hlist_node *next)
+{
+ next->next = n->next;
+ n->next = next;
+ next->pprev = &n->next;
+
+ if(next->next)
+ next->next->pprev = &next->next;
+}
+
+#define hlist_entry(ptr, type, member) container_of(ptr,type,member)
+
+#define hlist_for_each(pos, head) \
+ for (pos = (head)->first; pos && ({ prefetch(pos->next); 1; }); \
+ pos = pos->next)
+
+#define hlist_for_each_safe(pos, n, head) \
+ for (pos = (head)->first; pos && ({ n = pos->next; 1; }); \
+ pos = n)
+
+/**
+ * hlist_for_each_entry - iterate over list of given type
+ * @tpos: the type * to use as a loop cursor.
+ * @pos: the &struct hlist_node to use as a loop cursor.
+ * @head: the head for your list.
+ * @member: the name of the hlist_node within the struct.
+ */
+#define hlist_for_each_entry(tpos, pos, head, member) \
+ for (pos = (head)->first; \
+ pos && ({ prefetch(pos->next); 1;}) && \
+ ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1;}); \
+ pos = pos->next)
+
+/**
+ * hlist_for_each_entry_continue - iterate over a hlist continuing after current point
+ * @tpos: the type * to use as a loop cursor.
+ * @pos: the &struct hlist_node to use as a loop cursor.
+ * @member: the name of the hlist_node within the struct.
+ */
+#define hlist_for_each_entry_continue(tpos, pos, member) \
+ for (pos = (pos)->next; \
+ pos && ({ prefetch(pos->next); 1;}) && \
+ ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1;}); \
+ pos = pos->next)
+
+/**
+ * hlist_for_each_entry_from - iterate over a hlist continuing from current point
+ * @tpos: the type * to use as a loop cursor.
+ * @pos: the &struct hlist_node to use as a loop cursor.
+ * @member: the name of the hlist_node within the struct.
+ */
+#define hlist_for_each_entry_from(tpos, pos, member) \
+ for (; pos && ({ prefetch(pos->next); 1;}) && \
+ ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1;}); \
+ pos = pos->next)
+
+/**
+ * hlist_for_each_entry_safe - iterate over list of given type safe against removal of list entry
+ * @tpos: the type * to use as a loop cursor.
+ * @pos: the &struct hlist_node to use as a loop cursor.
+ * @n: another &struct hlist_node to use as temporary storage
+ * @head: the head for your list.
+ * @member: the name of the hlist_node within the struct.
+ */
+#define hlist_for_each_entry_safe(tpos, pos, n, head, member) \
+ for (pos = (head)->first; \
+ pos && ({ n = pos->next; 1; }) && \
+ ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1;}); \
+ pos = n)
+
+#endif
+
+#endif
diff --git a/cp/ps/driver/inc/pub/drvs_ramlog.h b/cp/ps/driver/inc/pub/drvs_ramlog.h
new file mode 100755
index 0000000..a6ba79c
--- /dev/null
+++ b/cp/ps/driver/inc/pub/drvs_ramlog.h
@@ -0,0 +1,236 @@
+/*******************************************************************************
+ * Copyright (C) 2009, ZTE Corporation.
+ *
+ * File Name: drvs_ramlog.h
+ * File Mark:
+ * Description:
+ * Others:
+ * Version: V1.0
+ * Author: yuxiang
+ * Date: 2009-11-06
+ * History 1:
+ * Date:
+ * Version:
+ * Author:
+ * Modification:
+ ********************************************************************************/
+#ifndef DRVS_RAMLOG_H
+#define DRVS_RAMLOG_H
+
+#ifdef __cplusplus
+ extern "C"
+ {
+#endif
+
+/****************************************************************************
+* Include files
+****************************************************************************/
+
+/****************************************************************************
+* Macros
+****************************************************************************/
+/*LOG»º³åÇø´óС¶¨Òå,ÒÔ×Ö½ÚΪµ¥Î»,Çë¸ù¾ÝÄ£¿éÒª´òÓ¡µÄLOGÊýÉèÖÃ*/
+#define RAMLOG_BUF_SIZE_8K (8*1024)
+#define RAMLOG_BUF_SIZE_16K (16*1024)
+#define RAMLOG_BUF_SIZE_32K (32*1024)
+#define RAMLOG_BUF_SIZE_64K (64*1024)
+#define RAMLOG_BUF_SIZE_128K (128*1024)
+#define RAMLOG_BUF_SIZE_256K (256*1024)
+
+
+/*´òÓ¡Ä£¿éºÅ*/
+#define RAMLOG_MOD_CHIP_BASE 1
+
+#define RAMLOG_MOD_AUDIO (RAMLOG_MOD_CHIP_BASE + 0)
+#define RAMLOG_MOD_BACKLIGHT (RAMLOG_MOD_CHIP_BASE + 1)
+#define RAMLOG_MOD_BSP (RAMLOG_MOD_CHIP_BASE + 2)
+#define RAMLOG_MOD_CAM (RAMLOG_MOD_CHIP_BASE + 3)
+#define RAMLOG_MOD_CIPHER (RAMLOG_MOD_CHIP_BASE + 4)
+#define RAMLOG_MOD_DMA (RAMLOG_MOD_CHIP_BASE + 5)
+#define RAMLOG_MOD_DPRAM (RAMLOG_MOD_CHIP_BASE + 6)
+#define RAMLOG_MOD_DSP (RAMLOG_MOD_CHIP_BASE + 7)
+#define RAMLOG_MOD_EARPIECE (RAMLOG_MOD_CHIP_BASE + 8)
+#define RAMLOG_MOD_GPIO (RAMLOG_MOD_CHIP_BASE + 9)
+#define RAMLOG_MOD_I2C (RAMLOG_MOD_CHIP_BASE + 10)
+#define RAMLOG_MOD_I2S (RAMLOG_MOD_CHIP_BASE + 11)
+#define RAMLOG_MOD_INT (RAMLOG_MOD_CHIP_BASE + 12)
+#define RAMLOG_MOD_ICP (RAMLOG_MOD_CHIP_BASE + 13)
+#define RAMLOG_MOD_KPDBL (RAMLOG_MOD_CHIP_BASE + 14)
+#define RAMLOG_MOD_MIDI (RAMLOG_MOD_CHIP_BASE + 15)
+#define RAMLOG_MOD_POW (RAMLOG_MOD_CHIP_BASE + 16)
+#define RAMLOG_MOD_RF (RAMLOG_MOD_CHIP_BASE + 17)
+#define RAMLOG_MOD_RTC (RAMLOG_MOD_CHIP_BASE + 18)
+#define RAMLOG_MOD_RTT (RAMLOG_MOD_CHIP_BASE + 19)
+#define RAMLOG_MOD_SD (RAMLOG_MOD_CHIP_BASE + 20)
+#define RAMLOG_MOD_SPI (RAMLOG_MOD_CHIP_BASE + 21)
+#define RAMLOG_MOD_TIMER (RAMLOG_MOD_CHIP_BASE + 22)
+#define RAMLOG_MOD_TONE (RAMLOG_MOD_CHIP_BASE + 23)
+#define RAMLOG_MOD_UART (RAMLOG_MOD_CHIP_BASE + 24)
+#define RAMLOG_MOD_UICC (RAMLOG_MOD_CHIP_BASE + 25)
+#define RAMLOG_MOD_USB (RAMLOG_MOD_CHIP_BASE + 26)
+#define RAMLOG_MOD_VIDEO (RAMLOG_MOD_CHIP_BASE + 27)
+#define RAMLOG_MOD_VOICE (RAMLOG_MOD_CHIP_BASE + 28)
+#define RAMLOG_MOD_VOU (RAMLOG_MOD_CHIP_BASE + 29)
+#define RAMLOG_MOD_SPIFC (RAMLOG_MOD_CHIP_BASE + 30)
+
+#define RAMLOG_MOD_ASSERT (RAMLOG_MOD_CHIP_BASE + 126)
+
+#define RAMLOG_MOD_PERI_BASE 128
+
+#define RAMLOG_MOD_BATTERY (RAMLOG_MOD_PERI_BASE + 0)
+#define RAMLOG_MOD_CHARGER (RAMLOG_MOD_PERI_BASE + 1)
+#define RAMLOG_MOD_FLASH (RAMLOG_MOD_PERI_BASE + 2)
+#define RAMLOG_MOD_FM (RAMLOG_MOD_PERI_BASE + 3)
+#define RAMLOG_MOD_LCD (RAMLOG_MOD_PERI_BASE + 4)
+#define RAMLOG_MOD_NAND (RAMLOG_MOD_PERI_BASE + 5)
+#define RAMLOG_MOD_PMIC (RAMLOG_MOD_PERI_BASE + 6)
+#define RAMLOG_MOD_PMMANAGER (RAMLOG_MOD_PERI_BASE + 7)
+#define RAMLOG_MOD_RTCPERI (RAMLOG_MOD_PERI_BASE + 8)
+#define RAMLOG_MOD_SENSOR (RAMLOG_MOD_PERI_BASE + 9)
+#define RAMLOG_MOD_TOUCH (RAMLOG_MOD_PERI_BASE + 10)
+#define RAMLOG_MOD_VIBRATOR (RAMLOG_MOD_PERI_BASE + 11)
+#define RAMLOG_MOD_LED (RAMLOG_MOD_PERI_BASE + 12)
+
+#define RAMLOG_MOD_MAX 255
+
+
+#define RAMLOG_MOD_NO1 RAMLOG_MOD_AUDIO /*Ä£¿éºÅ*/
+#define RAMLOG_MOD_NO1_SHELL "audio" /*shellÃüÁî²ÎÊý,ÎÞ¿Õ¸ñ,×32Byte*/
+#define RAMLOG_MOD_NO1_BUF_SIZE RAMLOG_BUF_SIZE_32K /*LOG»º³åÇø´óС*/
+#define RAMLOG_MOD_NO1_LOOP_ON TRUE /*ÊÇ·ñÑ»·´òÓ¡*/
+#define RAMLOG_MOD_NO1_REG TRUE /*ÊÇ·ñ×¢²á,FALSEʱ´ËÄ£¿é²»»á±»×¢²á*/
+
+#define RAMLOG_MOD_NO2 RAMLOG_MOD_KPDBL
+#define RAMLOG_MOD_NO2_SHELL "kpd"
+#define RAMLOG_MOD_NO2_BUF_SIZE RAMLOG_BUF_SIZE_32K
+#define RAMLOG_MOD_NO2_LOOP_ON TRUE
+#define RAMLOG_MOD_NO2_REG FALSE
+
+#define RAMLOG_MOD_NO3 RAMLOG_MOD_LCD /* YinWenguan 2015-2-4 */
+#define RAMLOG_MOD_NO3_SHELL "lcd"
+#define RAMLOG_MOD_NO3_BUF_SIZE RAMLOG_BUF_SIZE_32K
+#define RAMLOG_MOD_NO3_LOOP_ON TRUE
+#define RAMLOG_MOD_NO3_REG FALSE
+
+#define RAMLOG_MOD_NO4 RAMLOG_MOD_POW//RAMLOG_MOD_TOUCH
+#define RAMLOG_MOD_NO4_SHELL "pow"//"touch"
+#define RAMLOG_MOD_NO4_BUF_SIZE RAMLOG_BUF_SIZE_32K
+#define RAMLOG_MOD_NO4_LOOP_ON TRUE
+#define RAMLOG_MOD_NO4_REG FALSE
+
+#define RAMLOG_MOD_NO5 RAMLOG_MOD_CHARGER
+#define RAMLOG_MOD_NO5_SHELL "charger"
+#define RAMLOG_MOD_NO5_BUF_SIZE RAMLOG_BUF_SIZE_32K
+#define RAMLOG_MOD_NO5_LOOP_ON TRUE
+#define RAMLOG_MOD_NO5_REG FALSE
+
+#define RAMLOG_MOD_NO6 RAMLOG_MOD_DMA
+#define RAMLOG_MOD_NO6_SHELL "dma"
+#define RAMLOG_MOD_NO6_BUF_SIZE RAMLOG_BUF_SIZE_32K
+#define RAMLOG_MOD_NO6_LOOP_ON TRUE
+#define RAMLOG_MOD_NO6_REG FALSE
+
+#define RAMLOG_MOD_NO7 RAMLOG_MOD_ICP
+#define RAMLOG_MOD_NO7_SHELL "icp"
+#define RAMLOG_MOD_NO7_BUF_SIZE RAMLOG_BUF_SIZE_8K
+#define RAMLOG_MOD_NO7_LOOP_ON TRUE
+#define RAMLOG_MOD_NO7_REG TRUE
+
+#define RAMLOG_MOD_NO8 RAMLOG_MOD_UICC
+#define RAMLOG_MOD_NO8_SHELL "UICC"
+#define RAMLOG_MOD_NO8_BUF_SIZE RAMLOG_BUF_SIZE_8K
+#define RAMLOG_MOD_NO8_LOOP_ON TRUE
+#define RAMLOG_MOD_NO8_REG TRUE
+
+#define RAMLOG_MOD_NO9 RAMLOG_MOD_LED
+#define RAMLOG_MOD_NO9_SHELL "led"
+#define RAMLOG_MOD_NO9_BUF_SIZE RAMLOG_BUF_SIZE_32K
+#define RAMLOG_MOD_NO9_LOOP_ON TRUE
+#define RAMLOG_MOD_NO9_REG FALSE
+
+#define RAMLOG_MOD_NO10 RAMLOG_MOD_ASSERT
+#define RAMLOG_MOD_NO10_SHELL "assert"
+#define RAMLOG_MOD_NO10_BUF_SIZE RAMLOG_BUF_SIZE_32K
+#define RAMLOG_MOD_NO10_LOOP_ON TRUE
+#define RAMLOG_MOD_NO10_REG FALSE
+
+#define RAMLOG_MOD_NO11 RAMLOG_MOD_SD
+#define RAMLOG_MOD_NO11_SHELL "sd"
+#define RAMLOG_MOD_NO11_BUF_SIZE RAMLOG_BUF_SIZE_256K
+#define RAMLOG_MOD_NO11_LOOP_ON TRUE
+#define RAMLOG_MOD_NO11_REG FALSE
+
+#define RAMLOG_MOD_NO12 RAMLOG_MOD_CAM
+#define RAMLOG_MOD_NO12_SHELL "camera"
+#define RAMLOG_MOD_NO12_BUF_SIZE RAMLOG_BUF_SIZE_32K
+#define RAMLOG_MOD_NO12_LOOP_ON TRUE
+#define RAMLOG_MOD_NO12_REG FALSE
+
+#define RAMLOG_MOD_NO13 RAMLOG_MOD_VOU
+#define RAMLOG_MOD_NO13_SHELL "vou"
+#define RAMLOG_MOD_NO13_BUF_SIZE RAMLOG_BUF_SIZE_32K
+#define RAMLOG_MOD_NO13_LOOP_ON TRUE
+#define RAMLOG_MOD_NO13_REG FALSE
+
+#define RAMLOG_MOD_NO14 RAMLOG_MOD_PMIC
+#define RAMLOG_MOD_NO14_SHELL "pmic"
+#define RAMLOG_MOD_NO14_BUF_SIZE RAMLOG_BUF_SIZE_32K
+#define RAMLOG_MOD_NO14_LOOP_ON TRUE
+#define RAMLOG_MOD_NO14_REG FALSE
+
+
+#define RAMLOG_MOD_NO15 RAMLOG_MOD_I2C
+#define RAMLOG_MOD_NO15_SHELL "i2c"
+#define RAMLOG_MOD_NO15_BUF_SIZE RAMLOG_BUF_SIZE_32K
+#define RAMLOG_MOD_NO15_LOOP_ON TRUE
+#define RAMLOG_MOD_NO15_REG FALSE
+
+#define RAMLOG_MOD_NO16 RAMLOG_MOD_SPI
+#define RAMLOG_MOD_NO16_SHELL "spi"
+#define RAMLOG_MOD_NO16_BUF_SIZE RAMLOG_BUF_SIZE_32K
+#define RAMLOG_MOD_NO16_LOOP_ON TRUE
+#define RAMLOG_MOD_NO16_REG FALSE
+
+#define RAMLOG_MOD_NO17 RAMLOG_MOD_SPIFC
+#define RAMLOG_MOD_NO17_SHELL "spifc"
+#define RAMLOG_MOD_NO17_BUF_SIZE RAMLOG_BUF_SIZE_32K
+#define RAMLOG_MOD_NO17_LOOP_ON TRUE
+#define RAMLOG_MOD_NO17_REG FALSE
+/****************************************************************************
+* Types
+****************************************************************************/
+
+
+/****************************************************************************
+* Constants
+****************************************************************************/
+
+/****************************************************************************
+* Global Variables
+****************************************************************************/
+
+/****************************************************************************
+* Function Prototypes
+****************************************************************************/
+
+SINT32 zDrvRamLog_Initiate(VOID);
+SINT32 ramlog_Printf(UINT16 nModNo, const VOID *pFormat, ...);
+
+#ifdef _OS_WIN
+#define zDrvRamlog_PRINTF(nModNo, s)
+#else
+
+#ifdef _USE_RAMLOG
+#define zDrvRamlog_PRINTF(nModNo, s...) ramlog_Printf(nModNo, s)
+#else
+#define zDrvRamlog_PRINTF(nModNo, s...)
+#endif
+
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
diff --git a/cp/ps/driver/inc/pub/drvs_regio.h b/cp/ps/driver/inc/pub/drvs_regio.h
new file mode 100644
index 0000000..4f3f9b9
--- /dev/null
+++ b/cp/ps/driver/inc/pub/drvs_regio.h
@@ -0,0 +1,86 @@
+/*******************************************************************************
+ * Copyright (C) 2007, ZTE Corporation.
+ *
+ * File Name:
+ * File Mark:
+ * Description:
+ * Others:
+ * Version: 1.0
+ * Author: geanfeng
+ * Date: 2013-09-25
+ * History 1:
+ * Date:
+ * Version:
+ * Author:
+ * Modification:
+ * History 2:
+ ********************************************************************************/
+
+#ifndef _DRVS_REGIO_H_
+#define _DRVS_REGIO_H_
+
+/****************************************************************************
+* Include files
+****************************************************************************/
+
+/****************************************************************************
+* Macros
+****************************************************************************/
+
+
+/****************************************************************************
+* Types
+****************************************************************************/
+
+/****************************************************************************
+* Constants
+****************************************************************************/
+
+/****************************************************************************
+* Global Variables
+****************************************************************************/
+
+/****************************************************************************
+* Function Prototypes
+****************************************************************************/
+#ifdef _OS_TOS
+#define wfi() __asm__ __volatile__ ("wfi" : : : "memory")
+
+/*
+* memory barriers
+*/
+#define isb() __asm__ __volatile__ ("isb" : : : "memory")
+#define dsb() __asm__ __volatile__ ("dsb" : : : "memory")
+#define dmb() __asm__ __volatile__ ("dmb" : : : "memory")
+
+#define wmb() do { dsb(); zDrvL2x0_Sync(); } while (0)
+#define rmb() dsb()
+#endif
+
+/****************************************************************************
+* io operation definition
+****************************************************************************/
+/*
+* io operation without memory barriers
+*/
+#define reg(addr) (*(volatile unsigned *)(addr))
+#define reg8(addr) (*(volatile unsigned char *)(addr))
+#define reg16(addr) (*(volatile unsigned short *)(addr))
+#define reg32(addr) (*(volatile unsigned long *)(addr))
+
+/*
+* io operation with memory barriers
+* cortex-R7 has out-of-order instruction execution
+* these macro functions below maybe used in some special case
+*/
+#define ioread8(p) ({ unsigned char __v = reg8(p); rmb(); __v; })
+#define ioread16(p) ({ unsigned short __v = reg16(p)); rmb(); __v; })
+#define ioread32(p) ({ unsigned long __v = reg32(p)); rmb(); __v; })
+
+#define iowrite8(v,p) ({ wmb(); reg8(p) = v; })
+#define iowrite16(v,p) ({ wmb(); reg16(p) = v; })
+#define iowrite32(v,p) ({ wmb(); reg32(p) = v; })
+
+VOID zDrv_MemcpyToIo32(VOID *dst, VOID *src, UINT32 byteCount);
+
+#endif
diff --git a/cp/ps/driver/inc/pub/drvs_ret.h b/cp/ps/driver/inc/pub/drvs_ret.h
new file mode 100644
index 0000000..3792cf7
--- /dev/null
+++ b/cp/ps/driver/inc/pub/drvs_ret.h
@@ -0,0 +1,160 @@
+/*******************************************************************************
+ * Copyright (C) 2007, ZTE Corporation.
+ *
+ * File Name: Drvs_ret.h
+ * File Mark:
+ * Description: Provide the declaration of return types for HAL
+ * Others:
+ * Version: V0.5
+ * Author: xiongquan
+ * Date: 2008-12-01
+ * History 1:
+ * Date:
+ * Version:
+ * Author:
+ * Modification:
+ * History 2:
+ ********************************************************************************/
+#ifndef _DRVS_RET_H
+#define _DRVS_RET_H
+
+// the type numbers should be between -100 ~ -254
+typedef enum
+{
+ /* 0 ~ -29: commom */
+ DRV_SUCCESS = 0, /* successed */
+ DRV_ERROR = -1, /* failed */
+ DRV_ERR_INVALID_IOCTL_CMD = -2, /* no this control command branch */
+ DRV_ERR_NOT_SUPPORTED = -3, /* this function hasn't been supported */
+ DRV_ERR_INVALID_PARAM = -4, /* the input parameter is invalid */
+ DRV_ERR_MEM_ALLOC = -5, /* failed to malloc memory */
+ DRV_ERR_HISR_CREATE_FAIL = -6, /* failed to create hisr */
+ DRV_ERR_TIMEOUT = -7, /* timeout for a block waitting operation */
+ DRV_ERR_BUSY = -8, /* busy now to do the request operation */
+ DRV_ERR_NOT_OPENED = -9, /* the device to operate hasn't been opened yet */
+ DRV_ERR_OPEN_TIMES = -10, /* try to open a device which has been opened already */
+ DRV_ERR_NOT_STARTED = -11, /* the device to operate hasn't been started yet */
+ DRV_ERR_START_TIMES = -12, /* try to open a device which has been opened already */
+ /* reserved */
+
+ /* -30 ~ -39: for dal */
+ DRV_ERR_DEV_OVERFLOW = -30, /* no free entry to install this device. please change ZDRV_MAX_DEV_NUM in dal_api.h */
+ DRV_ERR_DEV_TABLE = -31, /* the device table has been destroyed */
+ DRV_ERR_FD_OVERFLOW = -32, /* no free entry to open this device. pleas change ZDRV_MAX_DEV_FILE_NUM in dal_api.h */
+ DRV_ERR_FD_TABLE = -33, /* the file descriptor table has been destroyed */
+ DRV_ERR_INSTALLED_TIMES = -34, /* try to install a device which hasn been installed yet */
+ DRV_ERR_NO_THIS_DEVICE = -35, /* try to open a device which hasn't been installed yet */
+ /* reserved */
+
+ /*-40 ~ -59: for sio */
+ DRV_ERR_NO_CHANNEL = -40, /*the used sio no channel*/
+ DRV_ERR_CHAN_CREATE_FAIL = -41, /*the sio creat channel fail*/
+ DRV_ERR_DEV_STATE_WRONG = -42, /*the sio state error*/
+ DRV_ERR_CHAN_DELETE_FAIL = -43, /*the sio delete channel fail*/
+ DRV_ERR_DEV_READ = -44, /*the sio read data error*/
+ DRV_ERR_CHAN_SEM_USED = -45, /*the sio semp has been used r*/
+ DRV_ERR_CHAN_DELETED = -46, /*the sio channel has been deleted */
+ DRV_ERR_DEV_CLOSED = -47, /*the sio has been closed */
+ DRV_ERR_DEV_OPT_NULL = -48, /*the sio device ptr is null*/
+ DRV_ERR_INSTALL_DRIVER_FAIL = -49, /*the sio install faill*/
+ DRV_ERR_BUFFER_NOT_ENOUGH = -50, /*the sio data buffer not enough*/
+ /* reserved */
+
+
+ /* -60 ~ 69: for mux */
+ DRV_ERR_MUX_INVALID_DLCI = -60, /* the dlci is invalid */
+ DRV_ERR_MUX_BUSY = -61, /* busy now, so the required operation has been rejected */
+ DRV_ERR_MUX_NOT_READY = -62, /* the mux or dlci is not ready to do this required operation */
+ DRV_ERR_MUX_FLOW_CONTROLED = -63, /* this dlc is flow-controled by the opposite station, so can't sent data any more */
+ DRV_ERR_MUX_PN_REJECTED = -64, /* the parameter for this dlc establishment is rejected by the opposite station */
+ DRV_ERR_MUX_BUF_IS_FULL = -65, /* the data buffer of this dlc is full, so can't write any more */
+ DRV_ERR_MUX_BUF_IS_EMPTY = -66, /* the data buffer of this dlc is empty, so no data to transfer */
+ DRV_ERR_MUX_FRAME_INVALID = -67, /* the frame data is invalid */
+ DRV_ERR_MUX_FRAME_UNCOMPLETE = -68, /* the frame data is uncomplete */
+
+ DRV_ERROR_EMPTY = -90,
+ DRV_ERROR_FULL = -91,
+ DRV_ERROR_NODEV = -92,
+ DRV_ERROR_SUSPEND = -93,
+ DRV_ERROR_AGAIN = -94,
+ DRV_ERROR_ABORT = -95,
+ DRV_ERROR_NOCONNECT = -96,
+
+ /*-100~-104 for spi*/
+ DRV_ERR_NOCOMPLETE = -100,
+
+ /*-105~-109 for gpio*/
+ DRV_ERR_NOT_WRITE = -105,
+
+ /*-110~-119 for pmic */
+ DRV_ERR_CLIENT_NBOVERFLOW = -110, /*!< The requested operation could not becompleted because there are too many PMIC client requests */
+ DRV_ERR_SPI_READ = -111,
+ DRV_ERR_SPI_WRITE = -112,
+ DRV_ERR_EVENT_NOT_SUBSCRIBED = -113, /*!< Event occur and not subscribed */
+ DRV_ERR_EVENT_CALL_BACK = -114, /*!< Error - bad call back */
+ DRV_ERR_UNSUBSCRIBE = -115, /*!< Error in un-subscribe event */
+
+ /*-120~-129 for sd */
+ DRV_ERR_INTR_TIMEOUT = -120,
+ DRV_ERR_INTR_ERROR = -121,
+ DRV_ERR_CARDSTATE_ERROR = -122,
+ DRV_ERR_CARD_DISCONNECT = -123,
+ DRV_ERR_WRITE_PROTECT = -124,
+ DRV_ERR_PWD_ERR = -125,
+ DRV_ERR_LOCKCARD_ERR = -126,
+ DRV_ERR_FORCEERASE_ERR = -127,
+ DRV_ERR_RESPONSE_ERR = -128,
+ DRV_ERR_HLE_ERROR = -129,
+ DRV_ERR_EIO = -130, /*IO Error*/
+ DRV_ERR_ERANGE = -131, /* Math result not representable */
+ DRV_ERR_EINPROGRESS = -132, /* Operation now in progress */
+ DRV_ERR_ENODEV = -133, /*no such device*/
+ DRV_ERR_BADMSG = -134, /*not a date message*/
+ DRV_ERR_ENOENT = -135, /* No such file or directory */
+ DRV_ERR_ILSEQ = -136, /* Illegal byte sequence */
+
+ /*-137~-140 for i2c */
+ DRV_ERR_ADDR_TRANSFER = -137,
+ DRV_ERR_DATA_TRANSFER = -138,
+ DRV_ERR_AGAIN = -139,
+ DRV_ERR_NOACK = -140,
+
+
+
+ /*-141~-156 for usb */
+ DRV_ERR_NOT_READY = -141,
+ DRV_ERR_STATUS_BUSY = -142,
+ DRV_ERR_STALL = -143,
+ DRV_ERR_END = -144,
+ DRV_ERR_USB_BUF_STATE = -145,
+ DRV_ERR_USB_BUF_FULL = -146,
+ DRV_ERR_USB_BUF_EMPTY = -147,
+ DRV_ERR_USB_QMI_UNDERRUN = -148,
+ DRV_ERR_USB_QMI_OVERRUN = -149,
+ DRV_ERR_USB_QMI_READ0 = -150,
+ DRV_ERR_USB_UNCONNECTED = -151,
+ DRV_ERR_QMI_HEADER_ERR = -152,
+ DRV_ERR_QMI_CTL_ERR = -153,
+ DRV_ERR_QMI_WDS_ERR = -154,
+ DRV_ERR_QMI_DMS_ERR = -155,
+ DRV_ERR_QMI_NAS_ERR = -156,
+
+ /*-160~-180 for nand */
+ DRV_ERR_LEN_ADDRESS = -160, /* ²Ù×÷µØÖ·´íÎó */
+ DRV_ERR_COMMAND = -161, /* ÃüÁîÂë´íÎó */
+ DRV_ERR_PE_ERROR = -162, /* ÉÕд´íÎó */
+ DRV_ERR_NAND_BUSY = -163, /* оƬæ */
+ DRV_ERR_PROTECTED = -164, /* ±£»¤ÇøÓò */
+ DRV_ERR_BANK_ERROR = -165, /* BANK´íÎó */
+ DRV_ERR_UNKNOWN = -166, /* UNKNOWN´íÎó */
+ DRV_ERR_LENGTH = -167,
+
+ /*-150~-154 for backlight */
+ DRV_ERR_INTERNAL_PERIOD = -180,
+ DRV_ERR_INTERNAL_FREQ = -181
+
+
+}T_DRVS_RETURN_TYPE;
+
+#endif
+
diff --git a/cp/ps/driver/inc/pub/drvs_ring.h b/cp/ps/driver/inc/pub/drvs_ring.h
new file mode 100644
index 0000000..4ac0d24
--- /dev/null
+++ b/cp/ps/driver/inc/pub/drvs_ring.h
@@ -0,0 +1,251 @@
+/*******************************************************************************
+ * Copyright (C) 2008, ZTE Corporation.
+ *
+ * File Name: drvs_ring.h
+ * File Mark:
+ * Description:
+ * Others:
+ * Version: V1.0
+ * Author: qinxiao
+ * Date: 2009-09-03
+ * History 1: created
+ * Date:
+ * Version:
+ * Author:
+ * Modification:
+ ********************************************************************************/
+#ifndef DRVS_RING_H
+#define DRVS_RING_H
+
+#ifdef __cplusplus
+ extern "C"
+ {
+#endif
+
+/****************************************************************************
+* Include files
+****************************************************************************/
+
+/****************************************************************************
+* Macros
+****************************************************************************/
+
+/****************************************************************************
+* Types
+****************************************************************************/
+typedef struct _T_Hal_Ring
+{
+ UINT32 writePos; /* offset from start of buffer where to write next */
+ UINT32 readPos; /* offset from start of buffer where to read next */
+ UINT32 bufSize; /* size of ring in bytes */
+ UINT8 *pBuf; /* pointer to start of buffer */
+}T_Hal_Ring;
+
+/****************************************************************************
+* Constants
+****************************************************************************/
+
+/****************************************************************************
+* Global Variables
+****************************************************************************/
+
+/****************************************************************************
+* Function Prototypes
+****************************************************************************/
+/******************************************************************************
+ * Function: hal_RingIsEmpty
+ * Description: Åжϻ·Ðλº³åÊÇ·ñΪ¿Õ
+ * Parameters:
+ * Input:
+ * pRing - :»·Ðλº³åÖ¸Õë
+ * Output:
+ * None
+ * Returns:
+ * ¿Õ:TRUE; ·Ç¿Õ:FALSE
+ *
+ * Others:
+ ******************************************************************************/
+BOOL hal_RingIsEmpty( T_Hal_Ring *pRing);
+
+/******************************************************************************
+ * Function: hal_RingIsFull
+ * Description: Åжϻ·Ðλº³åÊÇ·ñÒÑÂú
+ * Parameters:
+ * Input:
+ * pRing -- »·Ðλº³åÖ¸Õë
+ * Output:
+ * None
+ * Returns:
+ * Âú:TRUE; ·ÇÂú:FALSE
+ *
+ * Others:
+ ******************************************************************************/
+BOOL hal_RingIsFull(T_Hal_Ring *pRing);
+
+/******************************************************************************
+ * Function: hal_RingCreate
+ * Description: ´´½¨»·Ðλº³å
+ * Parameters:
+ * Input:
+ * nbytes -- »·Ðλº³åµÄ´óС£¬µ¥Î»£º×Ö½Ú
+ * Output:
+ * None
+ * Returns:
+ * ³É¹¦£º»·Ðλº³åID; ʧ°Ü:hal_NULL
+ *
+ * Others:
+ ******************************************************************************/
+T_Hal_Ring *hal_RingCreate(UINT32 nBytes);
+
+/******************************************************************************
+ * Function: hal_RingDelete
+ * Description: ɾ³ý»·Ðλº³å
+ * Parameters:
+ * Input:
+ * pRing -- »·Ðλº³åÖ¸Õë
+ * Output:
+ * None
+ * Returns:
+ * None
+ *
+ * Others:
+ ******************************************************************************/
+VOID hal_RingDelete(T_Hal_Ring * pRing);
+
+/******************************************************************************
+ * Function: hal_RingRead
+ * Description: ¶ÁÈ¡»·Ðλº³å¶ÓÁеÄÊý¾Ý
+ * Parameters:
+ * Input:
+ * pRing -- »·Ðλº³åÖ¸Õë
+ * pBuffer -- Êä³ö»º³åÖ¸Õë
+ * maxbytes -- ÐèÒª¶ÁÈ¡µÄ×î´ó×Ö½ÚÊý
+ * Output:
+ * buffer -- Êä³ö»º³åÖ¸Õë
+ * Returns:
+ * ʵ¼Ê¶ÁÈ¡µÄ×Ö½ÚÊý
+ *
+ * Others: ·µ»ØÖµ¿ÉÄÜÓëÐèÒª¶ÁÈ¡µÄ×Ö½ÚÊý²»Ò»Ö¡£Èç¹û»º³åΪ¿Õ£¬Ôò·µ»Ø0.
+ ******************************************************************************/
+UINT32 hal_RingRead(T_Hal_Ring *pRing, UINT8 *pBuffer, UINT32 maxBytes);
+
+/******************************************************************************
+ * Function: hal_RingWrite
+ * Description: Ïò»·Ðλº³åдÈëÊý¾Ý
+ * Parameters:
+ * Input:
+ * pRing -- »·Ðλº³åÖ¸Õë
+ * pBuffer -- Êä³ö»º³åÖ¸Õë
+ * nBytes -- ´ýдÈëÊý¾ÝµÄ´óС
+ * Output:
+ * None
+ * Returns:
+ * ʵ¼ÊдÈëµÄ×Ö½ÚÊý
+ *
+ * Others: ·µ»ØÖµ¿ÉÄÜÓëÐèҪдÈëµÄ×Ö½ÚÊý²»Ò»Ö¡£Èç¹û»º³åΪÂú£¬Ôò·µ»Ø0.
+ ******************************************************************************/
+UINT32 hal_RingWrite(T_Hal_Ring * pRing, UINT8 *pBuffer, UINT32 nBytes);
+
+/******************************************************************************
+ * Function: hal_RingFreeBytes
+ * Description: »ñÈ¡»·Ðλº³åÊ£Óà¿ÉÀûÓÃ×Ö½ÚÊý
+ * Parameters:
+ * Input:
+ * pRing -- »·Ðλº³åÖ¸Õë
+ * Output:
+ * None
+ * Returns:
+ * Ê£Óà¿ÉÀûÓÿռä×Ö½ÚÊý
+ *
+ * Others:
+ ******************************************************************************/
+UINT32 hal_RingFreeBytes(T_Hal_Ring *pRing);
+
+/******************************************************************************
+ * Function: hal_RingUsedBytes
+ * Description: »ñÈ¡»·Ðλº³åÒÑʹÓõÄ×Ö½ÚÊý
+ * Parameters:
+ * Input:
+ * pRing -- »·Ðλº³åÖ¸Õë
+ * Output:
+ * None
+ * Returns:
+ * ÒÑʹÓõÄ×Ö½ÚÊý
+ *
+ * Others:
+ ******************************************************************************/
+UINT32 hal_RingUsedBytes(T_Hal_Ring *pRing);
+
+/******************************************************************************
+ * Function: hal_RingFlush
+ * Description: Çå³ý»·Ðλº³åµÄËùÓÐÊý¾Ý
+ * Parameters:
+ * Input:
+ * pRing -- »·Ðλº³åÖ¸Õë
+ * Output:
+ * None
+ * Returns:
+ * None
+ * Others:
+ ******************************************************************************/
+VOID hal_RingFlush(T_Hal_Ring * pRing);
+#if 0
+/******************************************************************************
+ * Function: hal_RingMoveAhead
+ * Description: ½«»·Ðλº³åµÄдָÕëÒÆ¶¯¼¸¸ö×Ö½Ú
+ * Parameters:
+ * Input:
+ * pRing -- »·Ðλº³åÖ¸Õë
+ * nBytes -- ÐèÒªÒÆ¶¯µÄ×Ö½ÚÊý,ÕýÊýÏòÇ°ÒÆ¶¯£¬¸ºÊýÏòºóÒÆ¶¯£»
+ * ·¶Î§:-»·Ðλº³å×î´ó×Ö½ÚÊý-- +»·Ðλº³å×î´ó×Ö½ÚÊý
+ * Output:
+ * None
+ * Returns:
+ * None
+ * Others: µ±Ð´Ö¸Õ볬³ö¶ÓÁÐ×î´ó³¤¶Èʱ£¬»á×Ô¶¯»·ÐÎ.
+ ******************************************************************************/
+VOID hal_RingMoveWritePos(T_Hal_Ring * pRing, SINT32 nBytes);
+
+/******************************************************************************
+ * Function: hal_RingMoveAhead
+ * Description: Ïò»·Ðλº³åµ±Ç°Ð´Ö¸ÕëµÄÆ«ÒÆ´¦£¬Ð´ÈëÒ»¸öÊý¾Ý
+ * ²»Òƶ¯Ð´Ö¸Õë
+ * Parameters:
+ * Input:
+ * pRing -- »·Ðλº³åÖ¸Õë
+ * byte:´ýдÈëµÄÊý¾Ý
+ * offset -- Æ«ÒÆÁ¿, ÕýÊýÏòÇ°ÒÆ¶¯, ¸ºÊýÏòºóÒÆ¶¯;
+ * ·¶Î§:-»·Ðλº³å×î´ó×Ö½ÚÊý-- +»·Ðλº³å×î´ó×Ö½ÚÊý,
+ * Output:
+ * None
+ * Returns:
+ * None
+ * Others: µ±Ð´Ö¸Õ볬³ö¶ÓÁÐ×î´ó³¤¶Èʱ£¬»á×Ô¶¯»·ÐÎ.
+ ******************************************************************************/
+VOID hal_RingPutAhead(T_Hal_Ring * pRing, UINT8 byte, SINT32 offset);
+
+/******************************************************************************
+ * Function: hal_RingGetPossibleReadBlock
+ * Description: »ñÈ¡»·Ðλº³å¿É¶ÁÈ¡µÄ×Ö½ÚÊýºÍÖ¸Õë
+ * Parameters:
+ * Input:
+ * pRing -- »·Ðλº³åÖ¸Õë
+ * Output:
+ * nBytes -- ¿É¶ÁÈ¡×Ö½ÚÊý
+ * UINT8 * -- bufferÖ¸Õë
+ * Returns:
+ * ÒÑʹÓõÄ×Ö½ÚÊý
+ *
+ * Others:
+ ******************************************************************************/
+UINT8 *hal_RingGetPossibleReadBlock(T_Hal_Ring * pRing, UINT32 *nBytes);
+
+VOID hal_RingMoveReadPos(T_Hal_Ring * pRing, SINT32 nBytes);
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
diff --git a/cp/ps/driver/inc/ref/drvs_aw9523b_blg.h b/cp/ps/driver/inc/ref/drvs_aw9523b_blg.h
new file mode 100644
index 0000000..ed220a5
--- /dev/null
+++ b/cp/ps/driver/inc/ref/drvs_aw9523b_blg.h
@@ -0,0 +1,53 @@
+/*******************************************************************************
+ * Copyright (C) 2016, ZTE Corporation.
+ *
+ * File Name: drvs_aw9523b.h
+ * File Mark:
+ * Description: Provide backlight control interface for lcd module.
+ * Others:
+ * Version: V1.0
+ * Author: Zhou Tianbao
+ * Date: 2016-9-26
+ * History 1:
+ * Date:
+ * Version:
+ * Author:
+ * Modification:
+ * History 2:
+ ********************************************************************************/
+
+#ifndef _DRVS_AW9523B_BLG_H
+#define _DRVS_AW9523B_BLG_H
+
+#include "drvs_general.h"
+
+/*******************************************************************************
+* Function: kpd_SetLcdBlg
+* Description: Set lcd backlight.
+* Parameters:
+* Input:
+* brightness:
+* Output:
+* None
+* Returns:
+* DRV_SUCCESS or error code
+* Others:
+*******************************************************************************/
+SINT32 kpd_SetLcdBlg(UINT8 brightness);
+
+/*******************************************************************************
+* Function: kpd_GetLcdBlgBrightness
+* Description: Get lcd backlight.
+* Parameters:
+* Input:
+* None:
+* Output:
+* pBrightness: where brightness value is stored.
+* Returns:
+* DRV_SUCCESS or error code
+* Others:
+*******************************************************************************/
+SINT32 kpd_GetLcdBlgBrightness(UINT8 *pBrightness);
+
+
+#endif
diff --git a/cp/ps/driver/inc/ref/drvs_fm_rda5802.h b/cp/ps/driver/inc/ref/drvs_fm_rda5802.h
new file mode 100644
index 0000000..6fe9384
--- /dev/null
+++ b/cp/ps/driver/inc/ref/drvs_fm_rda5802.h
@@ -0,0 +1,184 @@
+/***********************************************************************
+* Copyright (C) 2016, ZTE Corporation.
+*
+* File Name: hal_fm_rda5802.h
+* File Mark:
+* Description: fm RDA5802 chiper hal interface declaration.
+* Others:
+* Version: v1.0
+* Author: taochao
+* Date: 2016-03-09
+*
+* History 1:
+* Date:
+* Version:
+* Author:
+* Modification:
+
+* History 2:
+**********************************************************************/
+#ifndef _HAL_FM_RDA5802_H
+#define _HAL_FM_RDA5802_H
+
+//#include "drv_pub.h"
+#include "oss_api.h"
+#include "oss_pub.h"
+
+#define FM_BAND_LOWER 8700 /*87MHz*/
+#define FM_BAND_UPPER 10800 /*108MHz*/
+#define FM_CHAN_SPACING 10 /*100KHz */
+
+/*fm volume level limits*/
+typedef enum
+{
+ FM_VOLUME_MIN = 0, //mute
+ FM_VOLUME_MAX = 15
+}T_HalFm_Volume_Level;
+
+//stc --- Seek/Tune complete
+//rssi--- Receive signal strength indicator
+typedef union
+{
+ UINT16 value;
+ struct
+ {
+ UINT16 enable:1; // 0
+ UINT16 softReset:1; // 1
+ UINT16 :2; // 2-3
+ UINT16 clkMode:3; // 4-6
+ UINT16 seekMode:1; // 7
+ UINT16 seek:1; // 8
+ UINT16 seekUp:1; // 9
+ UINT16 clkDirectMode:1; // 10
+ UINT16 :1;
+ UINT16 bassBoost:1; // 12
+ UINT16 monoSel:1; // 13
+ UINT16 disMute:1; //14
+ UINT16 disHighZ:1; // 15
+ }bitSet;
+}T_Rda5802_Reg02H;
+
+typedef union
+{
+ UINT16 value;
+ struct
+ {
+ UINT16 channelSpace:2; // 0-1
+ UINT16 bandSel:2; // 2-3
+ UINT16 tune:1; // 4
+ UINT16 :1; //5
+ UINT16 channelSel:10; //6-15
+ }bitSet;
+}T_Rda5802_Reg03H;
+
+typedef union
+{
+ UINT16 value;
+ struct
+ {
+ UINT16 gpio1:2; // 0-1
+ UINT16 gpio2:2; // 2-3
+ UINT16 gpio3:2; // 4-5
+ UINT16 i2sEnable:1; // 6
+ UINT16 :1; // 7
+ UINT16 afcDisable:1; // 8
+ UINT16 softMuteEnable:1; // 9
+ UINT16 :1; // 10
+ UINT16 de:1; // 11
+ UINT16 :2; // 12-13
+ UINT16 stcIntrEnable:1; // 14
+ }bitSet;
+}T_Rda5802_Reg04H;
+#if 0
+typedef union
+{
+ UINT16 value;
+ struct
+ {
+ UINT16 volume:4; // 0-3
+ UINT16 lnaIcSel:2; // 4-5
+ UINT16 lnaPortSel:2; // 6-7
+ UINT16 seekThreshold:7; // 8-14
+ UINT16 intrMode:1; //15
+ }bitSet;
+}T_Rda5802_Reg05H;
+#else
+typedef union
+{
+ UINT16 value;
+ struct
+ {
+ UINT16 volume:4; // 0-3
+ UINT16 :2; // 4-5
+ UINT16 lnaPortSel:2; // 6-7
+ UINT16 seekThreshold:4; // 8-11
+ UINT16 :1; // 12
+ UINT16 seekMode:2; // 13-14
+ UINT16 intrMode:1; //15
+ }bitSet;
+}T_Rda5802_Reg05H;
+#endif
+typedef union
+{
+ UINT16 value;
+ struct
+ {
+ UINT16 noSet:4; // 0-3
+ UINT16 i2sWsCnt:4; // 4-7
+ UINT16 :4; // 8-11
+ UINT16 i2sModeSel:1; // 12
+ UINT16 openmode:2; // 13-14
+ }bitSet;
+}T_Rda5802_Reg06H;
+
+typedef union
+{
+ UINT16 value;
+ struct
+ {
+ UINT16 readChannel:10; // 0-9
+ UINT16 stereo:1; // 10
+ UINT16 :2; // 11-12
+ UINT16 seekFail:1; // 13
+ UINT16 stc:1; //14
+ }bitSet;
+}T_Rda5802_Reg0AH;
+
+typedef union
+{
+ UINT16 value;
+ struct
+ {
+ UINT16 :7; // 0-6
+ UINT16 fmReady:1; // 7
+ UINT16 fmTrue:1; // 8
+ UINT16 rssi:7; // 9-15
+ }bitSet;
+}T_Rda5802_Reg0BH;
+
+typedef enum
+{
+ FM_RESET = 1,
+ FM_TUNE = 2,
+ FM_WORK = 3,
+ FM_SEEK = 4,
+ FM_SLEEP = 5
+}T_Rda5802_State;
+
+typedef struct _T_Rda5802_DevInfo
+{
+ T_Rda5802_Reg02H reg02h;
+ T_Rda5802_Reg03H reg03h;
+ T_Rda5802_Reg04H reg04h;
+ T_Rda5802_Reg05H reg05h;
+ T_Rda5802_Reg06H reg06h;
+ T_Rda5802_Reg0AH reg0Ah;
+ T_Rda5802_Reg0BH reg0Bh;
+
+ T_Rda5802_State devState;
+ BOOL canWaitSTC;
+ ZOSS_SEMAPHORE_ID stcSema;
+}T_Rda5802_DevInfo;
+
+
+#endif
diff --git a/cp/ps/driver/inc/ref/drvs_gpio_ref.h b/cp/ps/driver/inc/ref/drvs_gpio_ref.h
new file mode 100644
index 0000000..fa2e4d4
--- /dev/null
+++ b/cp/ps/driver/inc/ref/drvs_gpio_ref.h
@@ -0,0 +1,92 @@
+/*******************************************************************************
+* Copyright (C) 2014, ZTE Corporation.
+*
+* File Name:
+* File Mark:
+* Description:
+* Others:
+* Version: V1.0
+* Author: shideyou
+* Date: 2014-04-01
+* History 1:
+* Date:
+* Version:
+* Author:
+* Modification:
+* History 2:
+********************************************************************************/
+#ifndef __DRVS_GPIO_REF_H_
+#define __DRVS_GPIO_REF_H_
+
+/*************************************************************************
+* Include files *
+*************************************************************************/
+#include "drvs_gpio.h"
+/*************************************************************************
+* Macro *
+*************************************************************************/
+
+
+/**************************************************************************
+* Types *
+**************************************************************************/
+typedef struct _T_ZDrvGpio_Config{
+ UINT32 number; //GPIO number
+ const char *name;
+}T_ZDrvGpio_Config;
+
+typedef struct _T_Gpio_ConfigData{
+ T_ZDrvGpio_Config *config_table;
+ UINT32 ngpios;
+}T_Gpio_ConfigData;
+
+typedef struct _T_Gpio_Init{
+ UINT32 number; //gpio number
+ UINT32 topFuncSel; //top func
+ UINT32 pdFuncSel; //pd func
+ UINT32 aonFuncSel; //aon func
+ UINT32 pullUpDownSel; //up down sel
+ T_ZDrvGpio_IoDirection inout;
+ T_ZDrvGpio_IoVal highlow;
+}T_Gpio_Init;
+
+typedef struct _T_Gpio_InitData{
+ T_Gpio_Init *init_table;
+ UINT32 ngpios;
+}T_Gpio_InitData;
+
+
+/**************************************************************************
+* Global Variable *
+**************************************************************************/
+
+
+/**************************************************************************
+* Function Prototypes *
+**************************************************************************/
+
+
+/**************************************************************************
+* Function Defines *
+**************************************************************************/
+
+/**************************************************************************
+* Functin: Gpio_GetConfig
+* Description: This function is used to get the table of gpio config.
+* Parameters:
+* Input:
+* NONE
+*
+* Output:
+* pointer of config table
+*
+* Returns:
+* NONE
+*
+* Others:
+* None.
+**************************************************************************/
+VOID Gpio_GetConfigTable(T_Gpio_ConfigData *gpio_conf, T_Gpio_InitData *gpio_init);
+
+
+#endif
diff --git a/cp/ps/driver/inc/ref/drvs_he43106.h b/cp/ps/driver/inc/ref/drvs_he43106.h
new file mode 100644
index 0000000..35d1e92
--- /dev/null
+++ b/cp/ps/driver/inc/ref/drvs_he43106.h
@@ -0,0 +1,122 @@
+
+/**************************************************************************
+ *
+ *Copyright (c) 2013 ZTE Corporation.
+ *
+ * Ä£ ¿é Ãû :
+ * ÎÄ ¼þ Ãû : drvs_he43106.h
+ * Ïà¹ØÎļþ :
+ * ʵÏÖ¹¦ÄÜ : HE43106оƬÏà¹ØÐÅÏ¢
+ * ×÷ Õß : qihongfang
+ * °æ ±¾ : V1.0
+ * Íê³ÉÈÕÆÚ : 2014-12-23
+ *
+ * ÆäËü˵Ã÷ :
+ *
+ * Ð޸ļǼºÅ ÈÕÆÚ ÐÞ¸ÄÈË ÐÞ¸ÄÄÚÈÝ
+* ---------------------------------------------------------------------
+* 1 2014.12.23 Æëºì·¼ н¨
+ **************************************************************************/
+
+#ifndef _DRVS_HE43106_H
+#define _DRVS_HE43106_H
+
+#include "drvs_general.h"
+
+#define HE43106_I2C_SLAVE_ADDR0 0x3A
+#define I2C_BUS_FREQ (2*1000*1000)
+#define HE43106_ALL_BITS 0xFF
+
+
+#define HE43106_BITFVAL(var, lsh) ( (var) << (lsh) )
+#define HE43106_BITFMASK(wid, lsh) ( ((1U << (wid)) - 1) << (lsh) )
+
+//#define BIT(n) (UINT8)(1<<(n))
+//#define CHARGER "zte_charger"
+#define GPIOFUNC_FUNC 1
+
+#define BOOST_REG 0x00
+#define BLED_REG 0x01
+#define FLASHLIGHT_REG 0x02
+#define INTERRRUPT_MASK_REG 0x03
+#define INTERRRUPT_REG 0x04
+#define CHARGE_REG 0x05
+#define CP_REG 0x06
+#define TTC_TIMEOUT_REG 0x07
+#define MCU_OPTION_0_REG 0x10
+#define MCU_OPTION_1_REG 0x11
+
+
+/*define for 0x00 BOOST_REG*/
+#define OV_TEMP (1<<7)
+#define BOOST_OVERLOAD_LATCH (1<<6)
+#define LOWBAT_DETECT (1<<5)
+#define NOLOAD_DETECT (1<<4)
+#define BOOST_EN (1<<3)
+#define DISCHARGE_ON 2
+#define MCU_DISCHARGE_ON 1
+#define MCU_DISCHARGE_EN 0
+
+/*define for 0x01 BLED_REG*/
+#define MCU_BLED_EN 4
+#define MCU_BLED4_ON 3
+#define MCU_BLED3_ON 2
+#define MCU_BLED2_ON 1
+#define MCU_BLED1_ON 0
+
+
+/*define for 0x03 INTERRRUPT_MASK_REG*/
+#define MCU_INT_PIN_EN 7
+#define MASK_ABNORMAL_INT 4
+#define MASK_CP_INT 3
+#define MASK_CHARGE_INT 2
+#define MASK_NOLOAD_DET_INT 1
+#define MASK_LOWBAT_INT 0
+#define MASK_ALL_INT 0x9f
+
+/*define for 0x04 INTERRRUPT_REG*/
+#define ABNORMAL_INT (1<<4)
+#define CP_INT (1<<3)
+#define CHARGE_INT (1<<2)
+#define NOLOAD_DET_INT (1<<1)
+#define LOWBAT_INT (1<<0)
+#define CHG_INT_ALL 0x1f
+
+/*define for 0x05 CHARGE_REG*/
+#define CHARGE_DISABLE 6//(1<<6)
+#define CHARGE_TIMEOUT (1<<3)
+#define CHARGE_DONE (1<<2)
+#define CHARGE_IN_PROGRESS (1<<1)
+#define CHARGE_VIN_GOOD (1<<0)
+
+/*define for 0x06 CP_REG*/
+#define FORCE_CP_ENABLE 6
+#define CP3_HIGH 3
+#define CP2_HIGH 2
+#define CP1_HIGH 1
+#define CP0_HIGH 0
+
+/*define for 0x07 TTC_TIMEOUT_REG*/
+#define SW_RESET_CTRL1 7
+#define CHARGE_TIMOUT_SEL 0/*bit 0~2*/
+
+/*define for 0x10 MCU_OPTION_0_REG*/
+#define MCU_OL_LED_BLANK_DIS 7
+#define CP_OPTION 5
+#define MCU_CABLE_CPS_EN 4
+#define MCU_BES_OUT_SEL 3
+#define MCU_VBAT_REGULATION 0
+
+/*define for 0x11 MCU_OPTION_0_REG*/
+#define SW_RESET_CTRL2 7
+#define CHARGE_1A 5
+#define MCU_SEL_0P1S 4
+#define MCU_CHARGE_TIMEOUT_EN 3
+#define CP_PROCESS_BYPASS 2
+#define MCU_MODE 0
+
+SINT32 led_Reset(VOID);
+SINT32 chg_ChargerReset(VOID);
+
+#endif/*END of _DRVS_HE43106_H*/
+
diff --git a/cp/ps/driver/inc/ref/drvs_pm.h b/cp/ps/driver/inc/ref/drvs_pm.h
new file mode 100644
index 0000000..98c0170
--- /dev/null
+++ b/cp/ps/driver/inc/ref/drvs_pm.h
@@ -0,0 +1,146 @@
+/*******************************************************************************
+ * Copyright (C) 2010, ZTE Corporation.
+ *
+ * File Name:
+ * File Mark:
+ * Description:
+ * Others:
+ * Version: V1.0
+ * Author: yuxiang
+ * Date: 2013-9-4
+ * History 1:
+ * Date:
+ * Version:
+ * Author:
+ * Modification:
+ * History 2:
+ ********************************************************************************/
+
+#ifndef _DRVS_PM_H
+#define _DRVS_PM_H
+
+/****************************************************************************
+* Include files
+****************************************************************************/
+
+
+/****************************************************************************
+* Macros
+****************************************************************************/
+
+
+/****************************************************************************
+* Types
+****************************************************************************/
+typedef enum _T_ZDrvPmic_Enable{
+ PM_DISABLE = 0,
+ PM_ENABLE,
+ PM_ENABLE_NOT_SUPPORT = -100,
+ PM_ENABLE_MAX_STATUS = -255
+} T_ZDrvPmic_Enable;
+
+typedef enum _T_ZDrvPmic_NrmMode{
+ PM_NRMMODE_AUTO = 0,
+ PM_NRMMODE_PFM,
+ PM_NRMMODE_PWM,
+ PM_NRMMODE_NOT_SUPPORT = -100,
+ PM_NRMMODE_MAX_STATUS = -255
+}T_ZDrvPmic_NrmMode;
+
+typedef enum _T_ZDrvPmic_SlpMode{
+ PM_SLPMODE_AUTO_NORMAL = 0, //auto in dcdc, normal in ldo
+ PM_SLPMODE_ECO_NRMV, //normal voltage
+ PM_SLPMODE_ECO_SLPV, //sleep voltage
+ PM_SLPMODE_OFF, //OFF
+ PM_SLPMODE_NOT_SUPPORT = -100,
+ PM_SLPMODE_MAX_STATUS = -255
+}T_ZDrvPmic_SlpMode;
+
+//consumer
+typedef enum _T_ZDrvPmic_Regulator{
+ VCORE0 = 0,
+ VCORE1,
+ VDDR,
+ VMMC,
+ VSD0,
+ VSD1,
+ VIO_LO,
+ VIO_HI,
+ VUSB_0V9,
+ VUSB_3v3,
+ VPLL_LO,
+ VPLL_HI,
+ VSIM1,
+ VSIM2,
+ VRF_LO,
+ VRF_HI,
+ VRF_SW,
+ VPA,
+ VCTCXO1,
+ VCTCXO2,
+ VSSBUF,
+ VRTC,
+} T_ZDrvPmic_Regulator;
+
+typedef enum _T_ZDrvPmic_Vcore{
+ PM_VOLT_0_800 = 0,
+ PM_VOLT_0_850 , //output V,
+ PM_VOLT_0_875 , //output V,
+ PM_VOLT_0_900 , //output V,
+ PM_VOLT_0_925 , //output V,
+ PM_VOLT_0_950 , //output V,
+ PM_VOLT_1_100 , //output V,
+ PM_VOLT_1_150 , //output V,
+ PM_VOLT_1_200 , //output V,
+ PM_VOLT_1_250 , //output V,
+ PM_VOLT_1_600 , //output V,
+ PM_VOLT_1_800 , //output V,
+ PM_VOLT_2_750 , //output V,
+ PM_VOLT_2_800 , //output V,
+ PM_VOLT_2_850 , //output V,
+ PM_VOLT_3_000 , //output V,
+ PM_VOLT_3_300 , //output V,
+ PM_VOLT_3_600 , //output V,
+ PM_VOLT_NOT_SUPPORT = -100,
+ PM_VOLT_MAX_STATUS = -255,
+ } T_ZDrvPmic_Voltage;
+
+
+typedef struct _T_ZDrvPmic_Opt
+{
+ SINT32 (*zDrvPmic_LdoInit)(VOID);
+}T_ZDrvPmic_Opt;
+
+/****************************************************************************
+* Constants
+****************************************************************************/
+
+/****************************************************************************
+* Global Variables
+****************************************************************************/
+
+/****************************************************************************
+* Function Prototypes
+****************************************************************************/
+SINT32 zDrvPmic_Initiate(VOID);
+
+SINT32 zDrvPmic_SetNormalOnOff(T_ZDrvPmic_Regulator regulator, T_ZDrvPmic_Enable enable);
+SINT32 zDrvPmic_SetNormalVoltage(T_ZDrvPmic_Regulator regulator, T_ZDrvPmic_Voltage voltage);
+SINT32 zDrvPmic_SetNormalMode(T_ZDrvPmic_Regulator regulator, T_ZDrvPmic_NrmMode nrmMode);
+
+SINT32 zDrvPmic_GetNormalOnOff(T_ZDrvPmic_Regulator regulator, T_ZDrvPmic_Enable* enable);
+SINT32 zDrvPmic_GetNormalVoltage(T_ZDrvPmic_Regulator regulator, T_ZDrvPmic_Voltage* voltage);
+SINT32 zDrvPmic_GetNormalMode(T_ZDrvPmic_Regulator regulator, T_ZDrvPmic_NrmMode* nrmMode);
+
+SINT32 zDrvPmic_SetSleepOnOff(T_ZDrvPmic_Regulator regulator, T_ZDrvPmic_Enable enable);
+SINT32 zDrvPmic_SetSleepVoltage(T_ZDrvPmic_Regulator regulator, T_ZDrvPmic_Voltage voltage);
+SINT32 zDrvPmic_SetSleepMode(T_ZDrvPmic_Regulator regulator, T_ZDrvPmic_SlpMode slpMode);
+
+SINT32 zDrvPmic_GetSleepOnOff(T_ZDrvPmic_Regulator regulator, T_ZDrvPmic_Enable* enable);
+SINT32 zDrvPmic_GetSleepVoltage(T_ZDrvPmic_Regulator regulator, T_ZDrvPmic_Voltage* voltage);
+SINT32 zDrvPmic_GetSleepMode(T_ZDrvPmic_Regulator regulator, T_ZDrvPmic_SlpMode* slpMode);
+
+SINT32 zDrvPmic_SetOpt(T_ZDrvPmic_Opt* pPmicOpt);
+
+#endif
+
diff --git a/cp/ps/driver/inc/ref/drvs_pmic_wrapper.h b/cp/ps/driver/inc/ref/drvs_pmic_wrapper.h
new file mode 100644
index 0000000..1fa10ec
--- /dev/null
+++ b/cp/ps/driver/inc/ref/drvs_pmic_wrapper.h
@@ -0,0 +1,68 @@
+/*******************************************************************************
+ * Copyright (C) 2014, ZTE Corporation.
+ *
+ * File Name:
+ * File Mark:
+ * Description:
+ * Others:
+ * Version: V1.0
+ * Author: yuxiang
+ * Date: 2014-4-23
+ * History 1:
+ * Date:
+ * Version:
+ * Author:
+ * Modification:
+ * History 2:
+ ********************************************************************************/
+
+#ifndef _DRVS_PMIC_WRAPPER_H
+#define _DRVS_PMIC_WRAPPER_H
+
+/****************************************************************************
+* Include files
+****************************************************************************/
+
+
+/****************************************************************************
+* Macros
+****************************************************************************/
+
+/****************************************************************************
+* Types
+****************************************************************************/
+
+/****************************************************************************
+* Constants
+****************************************************************************/
+
+/****************************************************************************
+* Global Variables
+****************************************************************************/
+
+/****************************************************************************
+* Function Prototypes
+****************************************************************************/
+SINT32 zDrvZx234290_Config(VOID);
+SINT32 zDrvZx234290_LdoInit(VOID);
+
+SINT32 zDrvZx234290_DischargerConfig(VOID);
+SINT32 zDrvZx234290_SleepConfig(VOID);
+SINT32 zDrvZx234290_DebugConfig(VOID);
+
+SINT32 zDrvZx234290_SetVcore(T_ZDrvPmic_Voltage vol);
+SINT32 zDrvZx234290_SetVcoreSlpV(T_ZDrvPmic_Voltage vol);
+
+SINT32 zDrvZx234290_SetVsimOnoff(T_ZDrvPmic_Enable status);
+T_ZDrvPmic_Enable zDrvZx234290_GetVsimOnoff(VOID);
+SINT32 zDrvZx234290_SetVsim(T_ZDrvPmic_Voltage vol);
+T_ZDrvPmic_Voltage zDrvZx234290_GetVsim(VOID);
+
+SINT32 zDrvZx234290_SetVsdOnoff(T_ZDrvPmic_Enable status);
+T_ZDrvPmic_Enable zDrvZx234290_GetVsdOnoff(VOID);
+SINT32 zDrvZx234290_SetVsd(T_ZDrvPmic_Voltage vol);
+T_ZDrvPmic_Voltage zDrvZx234290_GetVsd(VOID);
+
+
+#endif
+
diff --git a/cp/ps/driver/inc/ref/drvs_sensor_ref.h b/cp/ps/driver/inc/ref/drvs_sensor_ref.h
new file mode 100644
index 0000000..f07f0f2
--- /dev/null
+++ b/cp/ps/driver/inc/ref/drvs_sensor_ref.h
@@ -0,0 +1,734 @@
+/*******************************************************************************
+ * Copyright by ZTE Corporation.
+ *
+ * File Name:
+ * File Mark:
+ * Description:
+ * Others:
+ * Version: v2.0
+ * Author: wuhui
+ * Date: 2016-9-13
+ * History 1:
+ * Date:
+ * Version:
+ * Author:
+ * Modification:
+ * History 2:
+ ********************************************************************************/
+
+#ifndef _DRVS_SENSOR_REF_H
+#define _DRVS_SENSOR_REF_H
+
+
+/****************************************************************************
+* Include files
+****************************************************************************/
+#include "drvs_cam.h"
+
+
+/****************************************************************************
+* Macros
+****************************************************************************/
+
+
+/****************************************************************************
+* Types
+****************************************************************************/
+#if defined(_USE_SPICC)
+
+typedef enum
+{
+ BUF_WRITING= 0, /* the Buffer storing the newest frame*/
+ BUF_FULL= 1,
+ BUF_READING= 2,
+ BUF_FREE= 3,
+ MAX_BUF_FLAG =4
+}T_Halsensor_BufFlag;
+
+#endif
+typedef enum
+{
+ SENSOR_OPEN= 0x0,
+ SENSOR_START = 0x1,
+ SENSOR_STANDBY = 0x2,
+ SENSOR_CLOSE = 0x3,
+ MAX_SENSOR_STATE
+}T_SensorState;
+
+#if defined (_CHIP_ZX297520V3)
+
+typedef enum
+{
+ CLK_OUT1_20M,
+ CLK_OUT1_40M,
+ CLK_OUT1_13M,
+ CLK_OUT1_26M
+} T_ZDrv_WifiBtFreq;
+
+#endif
+
+#if defined (_CHIP_ZX297520V2)
+
+typedef enum
+{
+ CLK_OUT1_13M,
+ CLK_OUT1_26M,
+ CLK_OUT1_20M,
+ CLK_OUT1_40M
+} T_ZDrv_WifiBtFreq;
+
+#endif
+
+#if defined(_USE_RAW_BUFFER)
+
+typedef enum
+{
+ HAL_CAM_RAWBUF_PAST= 0,
+ HAL_CAM_RAWBUF_CURRENT= 1, /* the Buffer store the newest frame*/
+ MAX_HAL_CAM_RAWBUF_FLAG =2
+}T_HalCam_RawBufFlag;
+
+typedef struct
+{
+ T_HalCam_Buff_Addr rawBufAddr;
+ UINT32 rawBufLen;
+ T_HalCam_RawBufFlag rawBufFlag;
+} T_HalSensor_RawBuff;
+
+#endif
+
+typedef struct
+{
+ UINT8 uiReg;
+ UINT8 uiVal;
+} T_HalSensor_RegVal;
+
+typedef enum
+{
+ SENSOR_POWER_OFF,
+ SENSOR_POWER_ON,
+
+ MAX_SENSOR_POWER_CTRL
+}T_HalSensor_PowerCtrl, *T_HalSensor_PowerCtrlPtr;
+
+typedef enum
+{
+ SENSOR_RESET_OFF,
+ SENSOR_RESET_ON,
+
+ MAX_SENSOR_RESET_CTRL
+}T_HalSensor_ResetCtrl, *T_HalSensor_ResetCtlPtr;
+typedef enum
+{
+ SPI_OUT_ENABLE,
+ SPI_OUT_DISABLE,
+
+ MAX_SPI_OUT_CTRL
+}T_HalSensor_SpiCtrl, *T_HalSensor_SpiCtrlPtr;
+
+
+typedef struct _T_HalSensor_Operations
+{
+ SINT32 (*halSensor_Open)( VOID );
+ SINT32 (*halSensor_Close)( VOID );
+ SINT32 (*halSensor_Start)( VOID );
+ SINT32 (*halSensor_Stop)( VOID );
+ SINT32 (*halSensor_PowerCtrl)(const T_HalSensor_PowerCtrl tPowerCtrl);
+ SINT32 (*halSensor_ResetCtrl)(const T_HalSensor_ResetCtrl tResetCtrl);
+ SINT32 (*halSensor_GetDevInfo)( T_ZDrv_SensorInfo *ptDevInfo );
+ SINT32 (*halSensor_SetPixelFmt)( T_ZDrv_PixelFmt tFmt );
+ SINT32 (*halSensor_SetImgSize)( T_ZDrv_CamOutputSize tImgSize );
+ SINT32 (*halSensor_SetFrameRate)( T_ZDrv_CamFps tFrmRate );
+ SINT32 (*halSensor_SetZoom)( T_ZDrv_CamZoom tZoom );
+ SINT32 (*halSensor_SetBrightness)( T_ZDrv_CamBrightness tBrn );
+ SINT32 (*halSensor_SetContrast)( T_ZDrv_CamContrast tCon );
+ SINT32 (*halSensor_SetEffect)( T_ZDrv_CamEffect tEffect );
+ SINT32 (*halSensor_SetWhiteBalance)( T_ZDrv_CamWhiteBalance tWB );
+ /* SINT32 (*halSensor_SetSceneMode)( T_ZDrv_SceneMode tScreen ); */
+ SINT32 (*halSensor_SetNightMode)(T_ZDrv_CamNightMode tNightMode);
+ SINT32 (*halSensor_SetLightMode)(T_ZDrv_CamLightMode tLightMode);
+ SINT32 (*halSensor_SetSaturation)(T_ZDrv_CamSaturation tSat);
+ SINT32 (*halSensor_SetMirrorFlip)(T_ZDrv_MirrorType tMirrorFlip);
+ SINT32 (*halSensor_SetAntiFlicker)(T_ZDrv_AntiFlicker tAntiFlicker);
+ SINT32 (*halSensor_SetEV)(T_ZDrv_CamExpCom tEV);
+ SINT32 (*halSensor_GetRegister)(UINT8 uiReg, UINT8 *puiVal);
+ SINT32 (*halSensor_SetRegister)(UINT8 uiReg, UINT8 uiVal);
+ #if defined(_USE_SPICC)
+ SINT32 (*halSensor_GetOneFrame)(T_HalCam_Buff_Addr* ptBuff);
+ SINT32 (*halSensor_FreeBuff)(T_HalCam_Buff_Addr readingBuff);
+ #endif
+ #if defined(_USE_RAW_BUFFER)
+ SINT32 (*halSensor_GetOneFrame)(T_HalCam_Buff_Addr ptBuff);
+ #endif
+ /* for updating of version */
+ UINT32 uiVersion;
+ VOID *pAdditionalOps;
+} T_HalSensor_Operations, *T_HalSensor_OperationsPtr;
+#if defined(_USE_TYPE_GC6133)
+SINT32 zDrvGc6133_Initiate(VOID);
+#endif
+#if defined(_USE_TYPE_BF3A01CS)
+SINT32 zDrvBf3a01cs_Initiate(VOID);
+#endif
+
+/****************************************************************************
+* Constants
+****************************************************************************/
+
+/****************************************************************************
+* Global Variables
+****************************************************************************/
+
+/****************************************************************************
+* Function Prototypes
+****************************************************************************/
+/*******************************************************************************
+* Functin: halSensor_Open
+* Description: This function is used to open the sensor.
+* Parameters:
+* (IN)
+* tSensorId: which sensor to be opened.
+* (OUT)
+* None.
+* Returns:
+* DRV_SUCCESS: successed.
+* DRV_ERR_NOT_SUPPORTED: this device don't support ioctrl operation.
+* DRV_ERR_INVALID_PARAM: the input parameters are invalid
+* DRV_ERROR: error
+* others: others programmer defined error code. for detailed information, please contact with the programmer
+* Others:
+* others error code should be a negative number, and not equal to the value that already be defined in T_ZDrv_ErrCode in drv_pub.h.
+*******************************************************************************/
+SINT32 halSensor_Open( T_ZDrv_SensorId tSensorId );
+
+
+/*******************************************************************************
+* Functin: halSensor_Close
+* Description: This function is used to close the sensor.
+* Parameters:
+* (IN)
+* tSensorId: which sensor to be closed.
+* (OUT)
+* None.
+* Returns:
+* DRV_SUCCESS: successed.
+* DRV_ERR_NOT_SUPPORTED: this device don't support ioctrl operation.
+* DRV_ERR_NOT_OPENED: has not been opend yet.
+* DRV_ERR_INVALID_PARAM: the input parameters are invalid
+* DRV_ERROR: error
+* others: others programmer defined error code. for detailed information, please contact with the programmer
+* Others:
+* others error code should be a negative number, and not equal to the value that already be defined in T_ZDrv_ErrCode in drv_pub.h.
+*******************************************************************************/
+SINT32 halSensor_Close( T_ZDrv_SensorId tSensorId );
+
+/*******************************************************************************
+* Functin: halSensor_Start
+* Description: This function is used to Start the sensor.
+* Parameters:
+* (IN)
+* tSensorId: which sensor to be started.
+* (OUT)
+* None.
+* Returns:
+* DRV_SUCCESS: successed.
+* DRV_ERR_NOT_SUPPORTED: this device don't support ioctrl operation.
+* DRV_ERR_INVALID_PARAM: the input parameters are invalid
+* DRV_ERROR: error
+* others: others programmer defined error code. for detailed information, please contact with the programmer
+* Others:
+* others error code should be a negative number, and not equal to the value that already be defined in T_ZDrv_ErrCode in drv_pub.h.
+*******************************************************************************/
+SINT32 halSensor_Start( T_ZDrv_SensorId tSensorId );
+
+/*******************************************************************************
+* Functin: halSensor_Stop
+* Description: This function is used to stop the sensor.
+* Parameters:
+* (IN)
+* tSensorId: which sensor to be stoped.
+* (OUT)
+* None.
+* Returns:
+* DRV_SUCCESS: successed.
+* DRV_ERR_NOT_SUPPORTED: this device don't support ioctrl operation.
+* DRV_ERR_NOT_OPENED: has not been opend yet.
+* DRV_ERR_INVALID_PARAM: the input parameters are invalid
+* DRV_ERROR: error
+* others: others programmer defined error code. for detailed information, please contact with the programmer
+* Others:
+* others error code should be a negative number, and not equal to the value that already be defined in T_ZDrv_ErrCode in drv_pub.h.
+*******************************************************************************/
+SINT32 halSensor_Stop( T_ZDrv_SensorId tSensorId );
+
+/*******************************************************************************
+* Functin: halSensor_PowerCtrl
+* Description: This function is used for controlling sensor power on/off via a GPIO.
+* Parameters:
+* (IN)
+* tSensorId: which sensor to be set.
+* tPowerCtrl: the logic of power on or off.
+* (OUT)
+* None.
+* Returns:
+* DRV_SUCCESS: successed.
+* DRV_ERR_NOT_SUPPORTED: this device don't support ioctrl operation.
+* DRV_ERR_NOT_OPENED: has not been opend yet.
+* DRV_ERR_INVALID_PARAM: the input parameters are invalid
+* DRV_ERROR: error
+* others: others programmer defined error code. for detailed information, please contact with the programmer
+* Others:
+* others error code should be a negative number, and not equal to the value that already be defined in T_ZDrv_ErrCode in drv_pub.h.
+*******************************************************************************/
+SINT32 halSensor_PowerCtrl(const T_ZDrv_SensorId tSensorId, const T_HalSensor_PowerCtrl tPowerCtrl);
+
+
+/*******************************************************************************
+* Functin: halSensor_ResetCtrl
+* Description: This function is used for resetting the sensor.
+* Parameters:
+* (IN)
+* tSensorId: which sensor to be closed.
+* tResetCtrl: the logic of reset on or off.
+* (OUT)
+* None.
+* Returns:
+* DRV_SUCCESS: successed.
+* DRV_ERR_NOT_SUPPORTED: this device don't support ioctrl operation.
+* DRV_ERR_NOT_OPENED: has not been opend yet.
+* DRV_ERR_INVALID_PARAM: the input parameters are invalid
+* DRV_ERROR: error
+* others: others programmer defined error code. for detailed information, please contact with the programmer
+* Others:
+* others error code should be a negative number, and not equal to the value that already be defined in T_ZDrv_ErrCode in drv_pub.h.
+*******************************************************************************/
+SINT32 halSensor_ResetCtrl(const T_ZDrv_SensorId tSensorId, const T_HalSensor_ResetCtrl tResetCtrl);
+
+
+/*******************************************************************************
+* Functin: halSensor_GetDevInfo
+* Description: This function is used to get the sensor information.
+* Parameters:
+* (IN)
+* tSensorId: which sensor to be set.
+* (OUT)
+* ptDevInfo: sensor information pointer.
+* Returns:
+* DRV_SUCCESS: successed.
+* DRV_ERR_NOT_SUPPORTED: this device don't support ioctrl operation.
+* DRV_ERR_NOT_OPENED: has not been opend yet.
+* DRV_ERR_INVALID_PARAM: the input parameters are invalid
+* DRV_ERROR: error
+* others: others programmer defined error code. for detailed information, please contact with the programmer
+* Others:
+* others error code should be a negative number, and not equal to the value that already be defined in T_ZDrv_ErrCode in drv_pub.h.
+*******************************************************************************/
+SINT32 halSensor_GetDevInfo( T_ZDrv_SensorId tSensorId, T_ZDrv_SensorInfo *ptDevInfo );
+
+
+/*******************************************************************************
+* Functin: halSensor_SetPixelFmt
+* Description: This function is used to set the pixel format.
+* Parameters:
+* (IN)
+* tSensorId: which sensor to be set.
+* tFmt: pixel format.
+* (OUT)
+* None.
+* Returns:
+* DRV_SUCCESS: successed.
+* DRV_ERR_NOT_SUPPORTED: this device don't support ioctrl operation.
+* DRV_ERR_NOT_OPENED: has not been opend yet.
+* DRV_ERR_INVALID_PARAM: the input parameters are invalid
+* DRV_ERROR: error
+* others: others programmer defined error code. for detailed information, please contact with the programmer
+* Others:
+* others error code should be a negative number, and not equal to the value that already be defined in T_ZDrv_ErrCode in drv_pub.h.
+*******************************************************************************/
+SINT32 halSensor_SetPixelFmt( T_ZDrv_SensorId tSensorId, T_ZDrv_PixelFmt tFmt );
+
+
+/*******************************************************************************
+* Functin: halSensor_SetImgSize
+* Description: This function is used to set the image size .
+* Parameters:
+* (IN)
+* tSensorId: which sensor to be set.
+* tImgSize: image size.
+* (OUT)
+* None.
+* Returns:
+* DRV_SUCCESS: successed.
+* DRV_ERR_NOT_SUPPORTED: this device don't support ioctrl operation.
+* DRV_ERR_NOT_OPENED: has not been opend yet.
+* DRV_ERR_INVALID_PARAM: the input parameters are invalid
+* DRV_ERROR: error
+* others: others programmer defined error code. for detailed information, please contact with the programmer
+* Others:
+* others error code should be a negative number, and not equal to the value that already be defined in T_ZDrv_ErrCode in drv_pub.h.
+*******************************************************************************/
+SINT32 halSensor_SetImgSize( T_ZDrv_SensorId tSensorId, T_ZDrv_CamOutputSize tImgSize );
+
+
+/*******************************************************************************
+* Functin: halSensor_SetFrameRate
+* Description: This function is used to set the frame rate.
+* Parameters:
+* (IN)
+* tSensorId: which sensor to be closed.
+* tFrmRate: frame rate.
+* (OUT)
+* None.
+* Returns:
+* DRV_SUCCESS: successed.
+* DRV_ERR_NOT_SUPPORTED: this device don't support ioctrl operation.
+* DRV_ERR_NOT_OPENED: has not been opend yet.
+* DRV_ERR_INVALID_PARAM: the input parameters are invalid
+* DRV_ERROR: error
+* others: others programmer defined error code. for detailed information, please contact with the programmer
+* Others:
+* others error code should be a negative number, and not equal to the value that already be defined in T_ZDrv_ErrCode in drv_pub.h.
+*******************************************************************************/
+SINT32 halSensor_SetFrameRate( T_ZDrv_SensorId tSensorId, T_ZDrv_CamFps tFrmRate );
+
+
+/*******************************************************************************
+* Functin: halSensor_SetZoom
+* Description: This function is used to set the zoom level.
+* Parameters:
+* (IN)
+* tSensorId: which sensor to be closed.
+* tZoom: zoom level.
+* (OUT)
+* None.
+* Returns:
+* DRV_SUCCESS: successed.
+* DRV_ERR_NOT_SUPPORTED: this device don't support ioctrl operation.
+* DRV_ERR_NOT_OPENED: has not been opend yet.
+* DRV_ERR_INVALID_PARAM: the input parameters are invalid
+* DRV_ERROR: error
+* others: others programmer defined error code. for detailed information, please contact with the programmer
+* Others:
+* others error code should be a negative number, and not equal to the value that already be defined in T_ZDrv_ErrCode in drv_pub.h.
+*******************************************************************************/
+SINT32 halSensor_SetZoom( T_ZDrv_SensorId tSensorId, T_ZDrv_CamZoom tZoom );
+
+
+/*******************************************************************************
+* Functin: halSensor_SetBrightness
+* Description: This function is used to set the brightness.
+* Parameters:
+* (IN)
+* tSensorId: which sensor to be closed.
+* tBri: brightness.
+* (OUT)
+* None.
+* Returns:
+* DRV_SUCCESS: successed.
+* DRV_ERR_NOT_SUPPORTED: this device don't support ioctrl operation.
+* DRV_ERR_NOT_OPENED: has not been opend yet.
+* DRV_ERR_INVALID_PARAM: the input parameters are invalid
+* DRV_ERROR: error
+* others: others programmer defined error code. for detailed information, please contact with the programmer
+* Others:
+* others error code should be a negative number, and not equal to the value that already be defined in T_ZDrv_ErrCode in drv_pub.h.
+*******************************************************************************/
+SINT32 halSensor_SetBrightness( T_ZDrv_SensorId tSensorId, T_ZDrv_CamBrightness tBrn );
+
+
+/*******************************************************************************
+* Functin: halSensor_SetContrast
+* Description: This function is used to set the constrast.
+* Parameters:
+* (IN)
+* tSensorId: which sensor to be closed.
+* tCon: constrast.
+* (OUT)
+* None.
+* Returns:
+* DRV_SUCCESS: successed.
+* DRV_ERR_NOT_SUPPORTED: this device don't support ioctrl operation.
+* DRV_ERR_NOT_OPENED: has not been opend yet.
+* DRV_ERR_INVALID_PARAM: the input parameters are invalid
+* DRV_ERROR: error
+* others: others programmer defined error code. for detailed information, please contact with the programmer
+* Others:
+* others error code should be a negative number, and not equal to the value that already be defined in T_ZDrv_ErrCode in drv_pub.h.
+*******************************************************************************/
+SINT32 halSensor_SetContrast( T_ZDrv_SensorId tSensorId, T_ZDrv_CamContrast tCon );
+
+
+/*******************************************************************************
+* Functin: halSensor_SetEffect
+* Description: This function is used to set the effect.
+* Parameters:
+* (IN)
+* tSensorId: which sensor to be closed.
+* tEffect: effect.
+* (OUT)
+* None.
+* Returns:
+* DRV_SUCCESS: successed.
+* DRV_ERR_NOT_SUPPORTED: this device don't support ioctrl operation.
+* DRV_ERR_NOT_OPENED: has not been opend yet.
+* DRV_ERR_INVALID_PARAM: the input parameters are invalid
+* DRV_ERROR: error
+* others: others programmer defined error code. for detailed information, please contact with the programmer
+* Others:
+* others error code should be a negative number, and not equal to the value that already be defined in T_ZDrv_ErrCode in drv_pub.h.
+*******************************************************************************/
+SINT32 halSensor_SetEffect( T_ZDrv_SensorId tSensorId, T_ZDrv_CamEffect tEffect );
+
+
+/*******************************************************************************
+* Functin: halSensor_SetWhiteBalance
+* Description: This function is used to set the white balance.
+* Parameters:
+* (IN)
+* tSensorId: which sensor to be set.
+* tWB: white balance.
+* (OUT)
+* None.
+* Returns:
+* DRV_SUCCESS: successed.
+* DRV_ERR_NOT_SUPPORTED: this device don't support ioctrl operation.
+* DRV_ERR_NOT_OPENED: has not been opend yet.
+* DRV_ERR_INVALID_PARAM: the input parameters are invalid
+* DRV_ERROR: error
+* others: others programmer defined error code. for detailed information, please contact with the programmer
+* Others:
+* others error code should be a negative number, and not equal to the value that already be defined in T_ZDrv_ErrCode in drv_pub.h.
+*******************************************************************************/
+SINT32 halSensor_SetWhiteBalance( T_ZDrv_SensorId tSensorId, T_ZDrv_CamWhiteBalance tWB );
+
+
+/*******************************************************************************
+* Functin: halSensor_SetSceneMode
+* Description: This function is used to set the scene mode.
+* Parameters:
+* (IN)
+* tSensorId: which sensor to be set.
+* tScreen: scene mode.
+* (OUT)
+* None.
+* Returns:
+* DRV_SUCCESS: successed.
+* DRV_ERR_NOT_SUPPORTED: this device don't support ioctrl operation.
+* DRV_ERR_NOT_OPENED: has not been opend yet.
+* DRV_ERR_INVALID_PARAM: the input parameters are invalid
+* DRV_ERROR: error
+* others: others programmer defined error code. for detailed information, please contact with the programmer
+* Others:
+* others error code should be a negative number, and not equal to the value that already be defined in T_ZDrv_ErrCode in drv_pub.h.
+*******************************************************************************/
+/* SINT32 halSensor_SetSceneMode( T_ZDrv_SensorId tSensorId, T_ZDrv_SceneMode tScreen ); */
+
+
+/*******************************************************************************
+* Functin: halSensor_SetNightMode
+* Description: This function is used to set the night mode.
+* Parameters:
+* (IN)
+* tSensorId: which sensor to be set.
+* tNightMode: night mode.
+* (OUT)
+* None.
+* Returns:
+* DRV_SUCCESS: successed.
+* DRV_ERR_NOT_SUPPORTED: this device don't support ioctrl operation.
+* DRV_ERR_NOT_OPENED: has not been opend yet.
+* DRV_ERR_INVALID_PARAM: the input parameters are invalid
+* DRV_ERROR: error
+* others: others programmer defined error code. for detailed information, please contact with the programmer
+* Others:
+* others error code should be a negative number, and not equal to the value that already be defined in T_ZDrv_ErrCode in drv_pub.h.
+*******************************************************************************/
+SINT32 halSensor_SetNightMode(T_ZDrv_SensorId tSensorId, T_ZDrv_CamNightMode tNightMode);
+
+
+/*******************************************************************************
+* Functin: halSensor_SetMirrorFlip
+* Description: This function is used to set the mirror and(or) flip.
+* Parameters:
+* (IN)
+* tSensorId: which sensor to be set.
+* tMirrorFlip: mirror and(or) flip.
+* (OUT)
+* None.
+* Returns:
+* DRV_SUCCESS: successed.
+* DRV_ERR_NOT_SUPPORTED: this device don't support ioctrl operation.
+* DRV_ERR_NOT_OPENED: has not been opend yet.
+* DRV_ERR_INVALID_PARAM: the input parameters are invalid
+* DRV_ERROR: error
+* others: others programmer defined error code. for detailed information, please contact with the programmer
+* Others:
+* others error code should be a negative number, and not equal to the value that already be defined in T_ZDrv_ErrCode in drv_pub.h.
+*******************************************************************************/
+SINT32 halSensor_SetMirrorFlip(T_ZDrv_SensorId tSensorId, T_ZDrv_MirrorType tMirrorFlip);
+
+
+/*******************************************************************************
+* Functin: halSensor_GetRegister
+* Description: This function is used to get the value of sensor register.
+* Parameters:
+* (IN)
+*
+* (OUT)
+* None.
+* Returns:
+*
+* Others:
+*
+*******************************************************************************/
+SINT32 halSensor_GetRegister(T_ZDrv_SensorId tSensorId, UINT8 uiReg, UINT8 *pValue);
+
+/*******************************************************************************
+* Functin: halSensor_SetRegister
+* Description: This function is used to set the value of sensor register.
+* Parameters:
+* (IN)
+*
+* (OUT)
+* None.
+* Returns:
+*
+* Others:
+*
+*******************************************************************************/
+SINT32 halSensor_SetRegister(T_ZDrv_SensorId tSensorId, UINT8 uiReg, UINT8 uiVal);
+
+/*******************************************************************************
+* Functin: halSeneor_SetLightMode
+* Description: This function is used to set the light mode.
+* Parameters:
+* (IN)
+* tSensorId: which sensor to be set.
+* tLightMode: light mode.
+* (OUT)
+* None.
+* Returns:
+* DRV_SUCCESS: successed.
+* DRV_ERR_NOT_SUPPORTED: this device don't support ioctrl operation.
+* DRV_ERR_NOT_OPENED: has not been opend yet.
+* DRV_ERR_INVALID_PARAM: the input parameters are invalid
+* DRV_ERROR: error
+* others: others programmer defined error code. for detailed information, please contact with the programmer
+* Others:
+* others error code should be a negative number, and not equal to the value that already be defined in T_ZDrv_ErrCode in drv_pub.h.
+*******************************************************************************/
+SINT32 halSensor_SetLightMode(T_ZDrv_SensorId tSensorId, T_ZDrv_CamLightMode tLightMode);
+
+
+/*******************************************************************************
+* Functin: halSensor_SetSaturation
+* Description: This function is used to set the saturation.
+* Parameters:
+* (IN)
+* tSensorId: which sensor to be set.
+* tLightMode: light mode.
+* (OUT)
+* None.
+* Returns:
+* DRV_SUCCESS: successed.
+* DRV_ERR_NOT_SUPPORTED: this device don't support ioctrl operation.
+* DRV_ERR_NOT_OPENED: has not been opend yet.
+* DRV_ERR_INVALID_PARAM: the input parameters are invalid
+* DRV_ERROR: error
+* others: others programmer defined error code. for detailed information, please contact with the programmer
+* Others:
+* others error code should be a negative number, and not equal to the value that already be defined in T_ZDrv_ErrCode in drv_pub.h.
+*******************************************************************************/
+SINT32 halSensor_SetSaturation(T_ZDrv_SensorId tSensorId, T_ZDrv_CamSaturation tSat);
+
+/*******************************************************************************
+ * Function: halSensor_SetAntiFlicker
+ * Description: This function is used to anti 50/60HZ banding flicker
+ * Parameters:
+ * Input:tSat:the banding frequency mode
+ * Output:None
+ *
+ * Returns:
+ * DRV_SUCCESS: successfully set the sensor.
+ * DRV_ERR_NOT_SUPPORTED: unsupported type of setting.
+ * DRV_ERROR: fail to set the sensor.
+ *
+ * Others:
+ ********************************************************************************/
+SINT32 halSensor_SetAntiFlicker(T_ZDrv_SensorId tSensorId, T_ZDrv_AntiFlicker tAntiFlicker);
+
+/*******************************************************************************
+ * Function: halSensor_SetEV
+ * Description: This function is used to set the exposure compensation
+ * Parameters:
+ * Input:tSat:the level of EV
+ * Output:None
+ *
+ * Returns:
+ * DRV_SUCCESS: successfully set the sensor.
+ * DRV_ERR_NOT_SUPPORTED: unsupported type of setting.
+ * DRV_ERROR: fail to set the sensor.
+ *
+ * Others:
+ ********************************************************************************/
+SINT32 halSensor_SetEV(T_ZDrv_SensorId tSensorId,T_ZDrv_CamExpCom tEV);
+/*******************************************************************************
+ * Function: halSensor_GetOneFrame
+ * Description: This function is used to get one frame
+ * Parameters:
+ * Input:tSat:T_ZDrv_SensorId T_HalCam_Buff_Addr*
+ * Output:None
+ *
+ * Returns:
+ * DRV_SUCCESS: successfully set the sensor.
+ * DRV_ERR_NOT_SUPPORTED: unsupported type of setting.
+ * DRV_ERROR: fail to set the sensor.
+ *
+ * Others:
+ ********************************************************************************/
+#if defined(_USE_SPICC)
+SINT32 halSensor_GetOneFrame(T_ZDrv_SensorId tSensorId,T_HalCam_Buff_Addr* ptBuff);
+#endif
+
+#if defined(_USE_RAW_BUFFER)
+SINT32 halSensor_GetOneFrame(T_ZDrv_SensorId tSensorId,T_HalCam_Buff_Addr ptBuff);
+#endif
+
+/*******************************************************************************
+ * Function: halSensor_FreeBuff
+ * Description: This function is used to free one frame
+ * Parameters:
+ * Input:tSat:T_Halsensor_Buff_Addr
+ * Output:None
+ *
+ * Returns:
+ * DRV_SUCCESS: successfully set the sensor.
+ * DRV_ERR_NOT_SUPPORTED: unsupported type of setting.
+ * DRV_ERROR: fail to set the sensor.
+ *
+ * Others:
+ ********************************************************************************/
+#if defined(_USE_SPICC)
+SINT32 halSensor_FreeBuff(T_ZDrv_SensorId tSensorId,T_HalCam_Buff_Addr readingBuff);
+#endif
+/*******************************************************************************
+* Functin: zDrvSensor_SetOperations
+* Description: This function is used to register operations of hal layer.
+* Parameters:
+* (IN)
+* tSensorId: operations of which sensor.
+* ptOperations: operations for the specfied device.
+* (OUT)
+* None.
+* Returns:
+* None
+* Others:
+* None.
+*******************************************************************************/
+VOID zDrvSensor_SetOperations( T_ZDrv_SensorId tSensorId, T_HalSensor_OperationsPtr ptOperations );
+
+
+
+#endif/*_DRVS_SENSOR_REF_H*/
+
+
diff --git a/cp/ps/driver/inc/ref/drvs_spicc.h b/cp/ps/driver/inc/ref/drvs_spicc.h
new file mode 100644
index 0000000..4d410b7
--- /dev/null
+++ b/cp/ps/driver/inc/ref/drvs_spicc.h
@@ -0,0 +1,198 @@
+/*******************************************************************************
+ * Copyright by ZTE Corporation.
+ *
+ * File Name:
+ * File Mark:
+ * Description:
+ * Others:
+ * Version: v0.1
+ * Author: wuhui
+ * Date: 2017-1-13
+ * History 1:
+ * Date:
+ * Version:
+ * Author:
+ * Modification:
+ * History 2:
+ ********************************************************************************/
+
+#ifndef _DRVS_SPICC_H
+#define _DRVS_SPICC_H
+
+/****************************************************************************
+* Include files
+****************************************************************************/
+#include "drvs_chip_cfg.h"
+#include "drvs_dma.h"
+#include "drvs_sys.h"
+
+/****************************************************************************
+* Macros
+****************************************************************************/
+ //BASE ADDRESSS
+#define SSP1_FORCAM_BASE (SPI1_REG_BASE+0x0000)
+
+#define SSP1_COMCTRL_MS_OFFSET (2)
+#define SSP1_COMCTRL_SSPE_OFFSET (1)
+#define SSP1_FMTCTRL_LaneNum_OFFSET (13)
+#define SSP1_FMTCTRL_LaneNum_SIZE (2)
+#define SSP1_FMTCTRL_CAMMode_OFFSET (12)
+#define SSP1_FIFOCTRL_RXFIFOTHRED_OFFSET (4)
+#define SSP1_FIFOCTRL_RXFIFOTHRED_SIZE (4)
+#define SSP1_FIFOCTRL_RXFIFOCNTR_OFFSET (5)
+#define SSP1_FIFOCTRL_RXFIFOCNTR_SIZE (7)
+#define SSP1_FIFOCTRL_RXDMAEN_OFFSET (2)
+#define SSP1_SYNC_CODE_OFFSET (0)
+#define SSP1_CAMFIFO_RST_OFFSET (1)
+#define SSP1_SAMPLE_MODE_OFFSET (2)
+#define SSP1_ID_SOL_OFFSET (24)
+#define SSP1_ID_EOF_OFFSET (16)
+#define SSP1_ID_SOF_OFFSET (8)
+#define SSP1_ID_SYNC_SIZE (8)
+#define SSP1_PACKETSIZE_OFFSET (0)
+#define SSP1_PACKETSIZE_SIZE (16)
+
+//²»Í¬´«Êä¸ñʽʱµÄID ¶¨Òå
+#define MTK_START (0x01)
+#define MTK_DATA_PACKET (0x40)
+#define MTK_END (0x00)
+#define BT656_START (0xab)
+#define BT656_LINE_START (0x80)
+#define BT656_END (0xb6)
+
+
+#define set_reg_bit(regName, bitAddr, bitValue) \
+do{ \
+ if(bitValue == TRUE) \
+ reg32(regName) |= (0x1<<bitAddr); \
+ else \
+ reg32(regName) &= ~(0x1<<bitAddr); \
+}while(0)
+
+#define set_reg_bits(regName, bitsAddr, bitsLen, bitsValue) \
+do{ \
+ reg32(regName) = (reg32(regName)&(~(((0x1<<bitsLen)-0x1)<<bitsAddr)))|(bitsValue<<bitsAddr);\
+}while(0)
+
+#define read_reg_bits(regName, bitsAddr, bitsLen) ((reg32(regName)>>bitsAddr)&((0x1<<bitsLen)-0x1))
+#define read_reg_bit(regName, bitsAddr) ((reg32(regName)>>bitsAddr)&0x1)
+
+
+/****************************************************************************
+* Types
+****************************************************************************/
+typedef volatile struct _T_SPICC_Regs
+{
+ UINT32 SSP1_VER; //0x00
+ UINT32 SSP1_COM_CTRL; //0x04
+ UINT32 SSP1_FMT_CTRL; //0x08
+ UINT32 SSP1_DATA_REG; //0x0C
+ UINT32 SSP1_FIFO_CTRL; //0x10
+ UINT32 SSP1_FIFO_STA; //0x14
+ UINT32 SSP1_INT_EN; //0x18
+ UINT32 SSP1_INT_STACLR; //0x1C
+ UINT32 SSP1_TIMING; //0x20
+ UINT32 Reserved[3]; //0x24~0x2C
+ UINT32 SSP1_SYNC_CODE; //0x30
+ UINT32 SSP1_DEBUG; //0x34
+ UINT32 SSP1_PACKET_SIZE; //0x38
+}T_SPICC_Regs;
+
+typedef enum _T_SSP1_MSMode
+{
+ SSP1_AS_MASTER = 0x0,
+ SSP1_AS_SLAVE = 0x1,
+ MAX_MS_MODE = 0X02
+}T_SPICC_MSMode;
+
+typedef enum
+{
+ DISABLE = 0,
+ ENABLE =1,
+ MAX_ENABLE_TYPE =2
+}T_SPICC_ENABLE_TYPE;
+
+typedef enum _T_SPICC_LaneNum
+{
+ LANE_1_CAM = 0,
+ LANE_2_CAM = 1,
+ LANE_4_CAM = 2,
+ LANE_MAX_CAM = 3
+}T_SPICC_LaneNum;
+
+typedef enum _T_SPICC_CamMode
+{
+ SSP1_AS_NORMAL = 0,
+ SSP1_AS_CAMERA = 1,
+ MAX_SSP1_CAMMODE = 2
+}T_SPICC_CamMode;
+
+typedef enum
+{
+ RAW_DATA =0,
+ PURE_DATA = 1,
+ MAX_SAMPLE_MODE =2
+}T_SPICC_ImageSampleMode;
+
+typedef enum
+{
+ BT656_MODE = 0,
+ MTK_MODE = 1,
+ MAX_TRANSFER_MODE =2
+}T_SPICC_ImageTransferMode;
+
+typedef enum
+{
+ RX_OVERRUN_IE = 0,
+ RX_FULL_IE = 2,
+ RX_THRED_IE = 4,
+ CAM_SOF_IE = 7,
+ CAM_EOF_IE = 8,
+ MAX_SSP1_INT_EN = 9
+}T_SPICC_IntEn;
+
+typedef enum
+{
+ eRESET =0,
+ eRELEASE = 1,
+ MAX_FIFOCtrl_TYPE =2
+}T_SPICC_CamFIFORst;
+
+typedef struct _T_zDrvSPICC_Device
+{
+ T_SPICC_ImageTransferMode transMode;
+ T_SPICC_ImageSampleMode samMode;
+ T_SPICC_LaneNum laneNum;
+ UINT32 packetSize;
+}T_zDrvSPICC_Device;
+
+typedef struct _T_SPICC_DevCtrl
+{
+ T_SPICC_Regs* regPtr;
+ UINT32 rxDmaChl; // ssp rx Dma channel number
+
+}T_SPICC_DevCtrl;
+
+/****************************************************************************
+* Constants
+****************************************************************************/
+
+/****************************************************************************
+* Global Variables
+****************************************************************************/
+
+/****************************************************************************
+* Function Prototypes
+****************************************************************************/
+SINT32 zDrvSPICC_Initiate(VOID);
+SINT32 zDrvSPICC_Open(T_zDrvSPICC_Device *spicc_Dev);
+SINT32 zDrvSPICC_Close(void);
+SINT32 zDrvSPICC_DmaRxloop(zDrvDma_CallbackFunc CallBack,T_ZDrvDma_ChannelDef *rxRegDmaChl,UINT32 transferListNum);
+SINT32 zDrvSPICC_DisableDmaRxloop(VOID);
+SINT32 zDrvSPICC_DeAllocDmaRxCh(VOID);
+VOID zDrvSPICC_ClkGateCtrl(T_ZDrvSysClk_Gate ClkCtrl);
+
+
+
+#endif/*_FILENAME_H*/
+
diff --git a/cp/ps/driver/inc/ref/drvs_uart_ref.h b/cp/ps/driver/inc/ref/drvs_uart_ref.h
new file mode 100644
index 0000000..f497362
--- /dev/null
+++ b/cp/ps/driver/inc/ref/drvs_uart_ref.h
@@ -0,0 +1,80 @@
+/*******************************************************************************
+ * Copyright (C) 2007, ZTE Corporation.
+ *
+ * File Name: drvs_uart_ref.h
+ * File Mark:
+ * Description:
+ * Others:
+ * Version: V0.1
+ * Author: yangjupei
+ * Date: 2013-08-26
+ * History 1:
+ * Date:
+ * Version:
+ * Author:
+ * Modification:
+ * History 2:
+ ********************************************************************************/
+
+
+#ifndef __DRVS_UART_REF_H_
+#define __DRVS_UART_REF_H_
+
+#define _UART3_SUPPORT
+/****************************************************************************
+* Include files
+****************************************************************************/
+
+#include "drvs_general.h"
+
+/****************************************************************************
+* Types
+****************************************************************************/
+//define uart ifac type
+typedef enum _T_zDrvUart_Port
+{
+ UART_PORT1 =0,
+ UART_PORT2,
+#ifdef _UART3_SUPPORT
+ UART_PORT3,
+#endif
+ UART_MAX_PORT_NUM
+}
+T_zDrvUart_Port;
+
+/*******************************************************************************
+ * Function: zDrvUart_SetInstance
+ * Description: set uartConfig,and regist uart oprations to dd level
+ * Parameters:
+ * Input: N/A
+ *
+ * Output: N/A
+ * Returns: N/A
+
+********************************************************************************/
+
+VOID zDrvUart_SetInstance(VOID);
+/*******************************************************************************
+ * Function: zDrvUart_SetGPIOforUart
+ * Description: set pins
+ * Parameters:
+ * Input: N/A
+ *
+ * Output: N/A
+ * Returns: N/A
+
+********************************************************************************/
+VOID zDrvUart_SetGPIOforUart(T_zDrvUart_Port UartNum);
+/*******************************************************************************
+ * Function: zDrvUart_SetGPIOforGPIO
+ * Description: set pins
+ * Parameters:
+ * Input: N/A
+ *
+ * Output: N/A
+ * Returns: N/A
+
+********************************************************************************/
+VOID zDrvUart_SetGPIOforGPIO(T_zDrvUart_Port UartNum);
+
+#endif
diff --git a/cp/ps/driver/inc/ref/drvs_uicc_ref.h b/cp/ps/driver/inc/ref/drvs_uicc_ref.h
new file mode 100644
index 0000000..e3e0990
--- /dev/null
+++ b/cp/ps/driver/inc/ref/drvs_uicc_ref.h
@@ -0,0 +1,83 @@
+/*******************************************************************************
+ * Copyright (C) 2007, ZTE Corporation.
+ *
+ * File Name: drvs_uicc_ref.h
+ * File Mark:
+ * Description:
+ * Others:
+ * Version: V0.5
+ * Author: wujinlei
+ * Date: 2013-07-12
+ * History 1:
+ * Date:
+ * Version:
+ * Author:
+ * Modification:
+ * History 2:
+ ********************************************************************************/
+
+
+#ifndef __DRVS_UICC_REF_H_
+#define __DRVS_UICC_REF_H_
+
+#include "drvs_general.h"
+//#include "drvs_pm_typedefine.h"
+#include "drvs_uicc.h"
+//#include "drvs_gpio.h"
+#include "drvs_pm.h"
+/*******************************************************************************
+ * Function: zDrvUICC_setVsim
+ * Description: set soc_USIM voltage
+ * Parameters:
+ * Input: N/A
+ *
+ * Output: N/A
+ * Returns: N/A
+
+********************************************************************************/
+SINT32 zDrvUICC_setVsim(T_ZDrvPmic_Voltage vsim);
+
+/*******************************************************************************
+ * Function: zDrvUICC_disableVsim
+ * Description: disable soc_usim power
+ * Parameters:
+ * Input: N/A
+ *
+ * Output: N/A
+ * Returns: N/A
+
+ * Others: //not use
+
+ ********************************************************************************/
+SINT32 zDrvUICC_disableVsim(VOID); /* pow uicc uart */
+
+#ifndef SOC_USIM
+/*******************************************************************************
+ * Function: zDrvUICC_disableVsim
+ * Description: disable soc_usim power
+ * Parameters:
+ * Input: N/A
+ *
+ * Output: N/A
+ * Returns: N/A
+
+ * Others: //not use
+
+ ********************************************************************************/
+ VOID zDrvUICC_ConfigForDetectSIM(VOID);
+#else
+/*******************************************************************************
+ * Function: zDrvUICC_disableVsim
+ * Description: disable soc_usim power
+ * Parameters:
+ * Input: N/A
+ *
+ * Output: N/A
+ * Returns: N/A
+
+ * Others: //not use
+
+ ********************************************************************************/
+VOID zDrvUICC_ConfigForDetectSocSIM(VOID);
+#endif
+#endif
diff --git a/cp/ps/driver/inc/ref/drvs_vou_ref.h b/cp/ps/driver/inc/ref/drvs_vou_ref.h
new file mode 100644
index 0000000..1d85e0e
--- /dev/null
+++ b/cp/ps/driver/inc/ref/drvs_vou_ref.h
@@ -0,0 +1,281 @@
+/*******************************************************************************
+ * Copyright by ZTE Corporation.
+ *
+ * File Name:
+ * File Mark:
+ * Description:
+ * Others:
+ * Version: v0.1
+ * Author: wuhui
+ * Date: 2016-12-17
+ * History 1:
+ * Date:
+ * Version:
+ * Author:
+ * Modification:
+ * History 2:
+ ********************************************************************************/
+
+#ifndef _DRVS_VOU_REF_H
+#define _DRVS_VOU_REF_H
+
+
+
+/****************************************************************************
+* Include files
+****************************************************************************/
+#include "drvs_chip_cfg.h"
+#include "drvs_sys.h"
+#include "drvs_vou.h"
+
+
+/****************************************************************************
+* Macros
+****************************************************************************/
+#define MAIN_CHANNEL 0
+#define MCU_LCD 1
+
+//BASE ADDRESSS
+#define OSD_CSC_BASE (VOU_CTRL_BASE+0x0000)
+#define OSD_GLOBAL_BASE (VOU_CTRL_BASE+0x2000)
+
+#define OSD_VL_CFG_BASE (OSD_GLOBAL_BASE+0x024)
+#define OSD_GL_CFG_BASE (OSD_GLOBAL_BASE+0x090)
+#define OSD_MAIN_CHANL_BASE (OSD_GLOBAL_BASE+0x114)
+#define OSD_WB_CFG_BASE (OSD_GLOBAL_BASE+0x14C)
+
+/*VOU CLK CFG ADDRESS*/
+#define VOU_DIF_CFG_BASE (SOC_CRM_REG_BASE+0x164)
+#define VOU_DIF_CTRL_OFFSET 16
+
+#define MAX_OSD_OUTSTAND_DEPTH 15
+#define OSD_VALID_FMARK_OFFSET 18
+#define OSDCTRL1_H_BLANK_OFFSET 2
+#define OSDCTRL1_V_BLANK_OFFSET 10
+#define OSDCTRL1_BLANK_SIZE 8
+#define OSDCTRL1_MCU_OFFSET 0
+
+#define OSDCTRL0_OUTSTAND_DEPTH_OFFSET 16
+#define OSDCTRL0_OUTSTAND_DEPTH_SIZE 4
+#define OSDCTRL0_VL_ENABLE_OFFSET 11
+#define OSDCTRL0_VL_CHANNEL_OFFSET 10
+#define OSDVL0CTRL0_VL_PRIO_OFFSET 24
+#define OSDVL0CTRL0_VL_PRIO_SIZE 3
+#define OSDVL0CTRL0_VL_STARTX_OFFSET 12
+#define OSDVL0CTRL0_VL_STARTXY_SIZE 12
+#define OSDVL0CTRL0_VL_STARTY_OFFSET 0
+#define OSDVL0CTRL0_VL_YUV420PLA_OFFSET 24
+#define OSDVL0CTRL0_VL_YUV422ENABLE_OFFSET 25
+#define OSDVL0CTRL0_VL_YUV422SEQ_OFFSET 26
+#define OSDVL0CTRL0_VL_YUV422SEQ_SIZE 2
+#define OSDVL0STRI_VL_LUMASTR_OFFSET 16
+#define OSDVL0STRI_VL_STR_SIZE 16
+#define OSDVL0STRI_VL_CHROMSTR_OFFSET 0
+#define OSDVL0SRCHW_VL_SRCW_OFFSET 16
+#define OSDVL0SRCHW_VL_SRCHW_SIZE 14
+#define OSDVL0SRCHW_VL_SRCH_OFFSET 0
+#define OSDVL0ALP_VL_GALPENABLE_OFFSET 0
+#define OSDVL0ALP_VL_GALPVAL_OFFSET 8
+#define OSDVL0ALP_VL_GALPVAL_SIZE 8
+
+#define OSDCTRL0_GL_ENABLE_OFFSET 5
+#define OSDCTRL0_GL_CHANNEL_OFFSET 4
+#define OSDGL0CTRL0_GL_PRIO_OFFSET 24
+#define OSDGL0CTRL0_GL_PRIO_SIZE 3
+#define OSDCTRL0_GL_ENDIANSEL_OFFSET 27
+#define OSDGL0CTRL0_GL_POSX_OFFSET 12
+#define OSDGL0CTRL0_GL_POSXY_SIZE 12
+#define OSDGL0CTRL0_GL_POSY_OFFSET 0
+#define OSDGL0CTRL1_GL_FORMAT_OFFSET 24
+#define OSDGL0CTRL1_GL_FORMAT_SIZE 4
+#define OSDGL0CTRL2_GL_ALP_A0RGB1555_OFFSET 24
+#define OSDGL0CTRL2_GL_ALP_VAL_SIZE 8
+#define OSDGL0CTRL2_GL_ALP_A1RGB1555_OFFSET 16
+#define OSDGL0CTRL2_GL_GALP_OFFSET 8
+#define OSDGL0CTRL2_GL_ALPRANG_OFFSET 3
+#define OSDGL0CTRL2_GL_ALPMODE_OFFSET 4
+#define OSDGL0CTRL2_GL_ALPMODE_SIZE 2
+#define OSDGL0CTRL2_GL_EXTDIR_OFFSET 2
+#define OSDGL0CTRL2_GL_EXTTYPE_OFFSET 0
+#define OSDGL0CTRL2_GL_EXTTYPE_SIZE 2
+#define OSDGL0STRI_GL_STRI_OFFSET 0
+#define OSDGL0STRI_GL_STRI_SIZE 14
+#define OSDGL0KEY_GL_CKALP_OFFSET 24
+#define OSDGL0KEY_GL_CKALP_SIZE 8
+#define OSDGL0KEY_GL_CKRGB_SIZE 8
+#define OSDGL0KEY_GL_CKR_OFFSET 16
+#define OSDGL0KEY_GL_CKG_OFFSET 8
+#define OSDGL0KEY_GL_CKB_OFFSET 0
+#define OSDGL0KEYMIN1_GL_CKREG1_ENABLE_OFFSET 31
+#define OSDMCTRL1_MC_SCRW_OFFSET 20
+#define OSDMCTRL1_MC_SCRWH_SIZE 12
+#define OSDMCTRL1_MC_SCRH_OFFSET 8
+#define OSDMBGCTRL_MC_R_OFFSET 16
+#define OSDMBGCTRL_MC_G_OFFSET 8
+#define OSDMBGCTRL_MC_B_OFFSET 0
+#define OSDMBGCTRL_MC_RGB_SIZE 8
+#define OSDMCTRL0_MC_ENABLE_OFFSET 0
+#define OSDMUPT_ENABLE_OFFSET 0
+
+
+#define OSDWBCTRL0_WB_STRIDE_OFFSET 12
+#define OSDWBCTRL0_WB_STRIDE_SIZE 16
+#define OSDWBCTRL0_WB_ENABLE_OFFSET 0
+#define OSDWBCTRL0_WB_BUFNUM_OFFSET 10
+#define OSDWBCTRL0_WB_BUFNUM_SIZE 2
+#define OSDWBCTRL0_WB_PERIOD_OFFSET 7
+#define OSDWBCTRL0_WB_PERIOD_SIZE 3
+#define OSDWBCTRL0_WB_FORMAT_OFFSET1 3
+#define OSDWBCTRL0_WB_FORMAT_OFFSET2 4
+
+#define CSC_ENABLE_OFFSET 16
+#define CSC_MODE_OFFSET 0
+#define CSC_MODE_SIZE 16
+#define CSC_AC_OFFSET 16
+#define CSC_BD_OFFSET 0
+#define CSC_ACBD_SIZE 16
+#define CSC_SPACE_FLOOR_OFFSET 16
+#define CSC_SPACE_TOP_OFFSET 0
+#define CSC_SPACE_LEVEL_SIZE 8
+
+/*OSD interrupt status bit offset*/
+#define OSD_MC_FINISH_OFFSET 0
+#define OSD_CFG_ERROR_OFFSET 2
+#define OSD_BUS_ERROR_OFFSET 3
+#define OSD_VL_BWLOW_OFFSET 7
+#define OSD_GL_BWLOW_OFFSET 10
+#define OSD_MC_REGUPT_OFFSET 13
+#define OSD_WR_FINISH_OFFSET 24
+#define OSD_WR_OVERFLOW_OFFSET 25
+
+#define set_reg_bit(regName, bitAddr, bitValue) \
+do{ \
+ if(bitValue == TRUE) \
+ reg32(regName) |= (0x1<<bitAddr); \
+ else \
+ reg32(regName) &= ~(0x1<<bitAddr); \
+}while(0)
+
+#define set_reg_bits(regName, bitsAddr, bitsLen, bitsValue) \
+do{ \
+ reg32(regName) = (reg32(regName)&(~(((0x1<<bitsLen)-0x1)<<bitsAddr)))|(bitsValue<<bitsAddr);\
+}while(0)
+
+
+/****************************************************************************
+* Types
+****************************************************************************/
+typedef enum
+{
+ EPOSEDGE_VALID = 0,
+ eNEGEDGE_VALID = 1,
+ MAX_POLARITY_TYPE =2
+}E_MCU_FMARK_POLARITY;
+
+typedef volatile struct _T_OSDGlobal_Regs
+{
+ UINT32 OSD_VER; //0x00
+ UINT32 OSD_INT_STA; //0x04
+ UINT32 OSD_CLRINT_STA; //0x08
+ UINT32 OSD_INT_MSK; //0x0C
+ UINT32 OSD_CTRL0; //0x10
+}T_OSDGlobal_Regs;
+
+typedef volatile struct _T_OSD_VL_Regs
+{
+ UINT32 OSD_VL0_CTRL0; //0x024
+ UINT32 OSD_VL0_CTRL1; //0x028
+ UINT32 RESERVED0;
+ UINT32 OSD_VL0_STRI; //0x30
+ UINT32 OSD_VL0_SRC_HW; //0x34
+ UINT32 OSD_VL0_Y; //0x38
+ UINT32 OSD_VL0_U; //0x3C
+ UINT32 OSD_VL0_V; //0x40
+ UINT32 OSD_VL0_ALP; //0x44
+}T_OSD_VL_Regs;
+
+typedef volatile struct _T_OSD_GL_Regs
+{
+ UINT32 OSD_GL0_CTRL0; //0x090
+ UINT32 OSD_GL0_CTRL1; //0x094
+ UINT32 OSD_GL0_CTRL2; //0x098
+ UINT32 RESERVED0; //0x09C
+ UINT32 OSD_GL0_STRI; //0x0A0
+ UINT32 OSD_GL0_ADDR; //0x0A4
+ UINT32 RESERVED1; //0x0A8
+ UINT32 OSD_GL0_KEY_MIN0; //0x0AC
+ UINT32 OSD_GL0_KEY_MAX0; //0x0B0
+ UINT32 OSD_GL0_KEY_MIN1; //0x0B4
+ UINT32 OSD_GL0_KEY_MAX1; //0x0B8
+}T_OSD_GL_Regs;
+
+typedef volatile struct _T_OSD_MainChanel_Regs
+{
+ UINT32 OSD_MAIN_CHANL_CTRL0; //0x114
+ UINT32 OSD_MAIN_CHANL_CTRL1; //0x118
+ UINT32 OSD_MAIN_CHANL_UPT; //0x11C
+ UINT32 RESERVED0; //0x120
+ UINT32 OSD_MAIN_BG_CTRL; //0x124
+ UINT32 RESERVED[5]; //0x128~0x138
+ UINT32 OSD_CTRL1; //0x13C
+}T_OSD_MainChanel_Regs;
+
+typedef volatile struct _T_OSD_WB_Regs
+{
+ UINT32 OSD_WB_CTRL0; //0x14C
+ UINT32 OSD_WB_CTRL1; //0x150
+ UINT32 OSD_WB_ADDR0; //0x154
+ UINT32 OSD_WB_ADDR1; //0x158
+ UINT32 OSD_WB_ADDR2; //0x15C
+ UINT32 OSD_WB_ADDR3; //0x160
+}T_OSD_WB_Regs;
+
+typedef volatile struct _T_OSD_CSC_Regs
+{
+ UINT32 OSD_CSC_MODE; //0x00
+ UINT32 OSD_A1_B1; //0x04
+ UINT32 OSD_C1_D1; //0x08
+ UINT32 OSD_A2_B2; //0x0C
+ UINT32 OSD_C2_D2; //0x10
+ UINT32 OSD_A3_B3; //0x14
+ UINT32 OSD_C3_D3; //0x18
+ UINT32 OSD_SPACE_IN1; //0x1C
+ UINT32 OSD_SPACE_IN2; //0x20
+ UINT32 OSD_SPACE_IN3; //0x24
+ UINT32 OSD_SPACE_OUT1; //0x28
+ UINT32 OSD_SPACE_OUT2; //0x2C
+ UINT32 OSD_SPACE_OUT3; //0x30
+}T_CSC_Regs;
+
+typedef volatile struct _T_VOU_Regs
+{
+ T_OSDGlobal_Regs *ptOSDGlobal;
+ T_OSD_VL_Regs *ptOSDVL;
+ T_OSD_GL_Regs *ptOSDGL;
+ T_OSD_MainChanel_Regs *ptOSDMC;
+ T_OSD_WB_Regs *ptOSDWB;
+ T_CSC_Regs *ptOSDCSC;
+}T_VOU_Regs;
+
+/****************************************************************************
+* Constants
+****************************************************************************/
+
+/****************************************************************************
+* Global Variables
+****************************************************************************/
+
+/****************************************************************************
+* Function Prototypes
+****************************************************************************/
+SINT32 zDrvVOU_Open(void);
+void zDrvVOU_GetDevInfo(T_ZDrv_OSDInfo *ptDevInfo);
+SINT32 zDrvVOU_Close(VOID);
+SINT32 zDrvVOU_OneFrame(T_ZDrv_VOU_OSDPara *ptOSDPara);
+SINT32 zDrvVOU_WBParaUpdate(T_ZDrv_VOU_WBPara *ptWBPara);
+void zDrvVOU_ClkCtrl(T_ZDrvSysClk_Gate ClkCtrl);
+
+
+
+#endif/*_FILENAME_H*/
+
diff --git a/cp/ps/driver/inc/usbhost/ch11.h b/cp/ps/driver/inc/usbhost/ch11.h
new file mode 100644
index 0000000..a06eb41
--- /dev/null
+++ b/cp/ps/driver/inc/usbhost/ch11.h
@@ -0,0 +1,264 @@
+/*
+ * This file holds Hub protocol constants and data structures that are
+ * defined in chapter 11 (Hub Specification) of the USB 2.0 specification.
+ *
+ * It is used/shared between the USB core, the HCDs and couple of other USB
+ * drivers.
+ */
+
+#ifndef __LINUX_CH11_H
+#define __LINUX_CH11_H
+
+#include "types.h" /* __u8 etc */
+
+/*
+ * Hub request types
+ */
+
+#define USB_RT_HUB (USB_TYPE_CLASS | USB_RECIP_DEVICE)
+#define USB_RT_PORT (USB_TYPE_CLASS | USB_RECIP_OTHER)
+
+/*
+ * Hub class requests
+ * See USB 2.0 spec Table 11-16
+ */
+#define HUB_CLEAR_TT_BUFFER 8
+#define HUB_RESET_TT 9
+#define HUB_GET_TT_STATE 10
+#define HUB_STOP_TT 11
+
+/*
+ * Hub class additional requests defined by USB 3.0 spec
+ * See USB 3.0 spec Table 10-6
+ */
+#define HUB_SET_DEPTH 12
+#define HUB_GET_PORT_ERR_COUNT 13
+
+/*
+ * Hub Class feature numbers
+ * See USB 2.0 spec Table 11-17
+ */
+#define C_HUB_LOCAL_POWER 0
+#define C_HUB_OVER_CURRENT 1
+
+/*
+ * Port feature numbers
+ * See USB 2.0 spec Table 11-17
+ */
+#define USB_PORT_FEAT_CONNECTION 0
+#define USB_PORT_FEAT_ENABLE 1
+#define USB_PORT_FEAT_SUSPEND 2 /* L2 suspend */
+#define USB_PORT_FEAT_OVER_CURRENT 3
+#define USB_PORT_FEAT_RESET 4
+#define USB_PORT_FEAT_L1 5 /* L1 suspend */
+#define USB_PORT_FEAT_POWER 8
+#define USB_PORT_FEAT_LOWSPEED 9 /* Should never be used */
+#define USB_PORT_FEAT_C_CONNECTION 16
+#define USB_PORT_FEAT_C_ENABLE 17
+#define USB_PORT_FEAT_C_SUSPEND 18
+#define USB_PORT_FEAT_C_OVER_CURRENT 19
+#define USB_PORT_FEAT_C_RESET 20
+#define USB_PORT_FEAT_TEST 21
+#define USB_PORT_FEAT_INDICATOR 22
+#define USB_PORT_FEAT_C_PORT_L1 23
+
+/*
+ * Port feature selectors added by USB 3.0 spec.
+ * See USB 3.0 spec Table 10-7
+ */
+#define USB_PORT_FEAT_LINK_STATE 5
+#define USB_PORT_FEAT_U1_TIMEOUT 23
+#define USB_PORT_FEAT_U2_TIMEOUT 24
+#define USB_PORT_FEAT_C_PORT_LINK_STATE 25
+#define USB_PORT_FEAT_C_PORT_CONFIG_ERROR 26
+#define USB_PORT_FEAT_REMOTE_WAKE_MASK 27
+#define USB_PORT_FEAT_BH_PORT_RESET 28
+#define USB_PORT_FEAT_C_BH_PORT_RESET 29
+#define USB_PORT_FEAT_FORCE_LINKPM_ACCEPT 30
+
+/* USB 3.0 hub remote wake mask bits, see table 10-14 */
+#define USB_PORT_FEAT_REMOTE_WAKE_CONNECT (1 << 8)
+#define USB_PORT_FEAT_REMOTE_WAKE_DISCONNECT (1 << 9)
+#define USB_PORT_FEAT_REMOTE_WAKE_OVER_CURRENT (1 << 10)
+
+/*
+ * Hub Status and Hub Change results
+ * See USB 2.0 spec Table 11-19 and Table 11-20
+ */
+struct usb_port_status {
+ __le16 wPortStatus;
+ __le16 wPortChange;
+} __attribute__ ((packed));
+
+/*
+ * wPortStatus bit field
+ * See USB 2.0 spec Table 11-21
+ */
+#define USB_PORT_STAT_CONNECTION 0x0001
+#define USB_PORT_STAT_ENABLE 0x0002
+#define USB_PORT_STAT_SUSPEND 0x0004
+#define USB_PORT_STAT_OVERCURRENT 0x0008
+#define USB_PORT_STAT_RESET 0x0010
+#define USB_PORT_STAT_L1 0x0020
+/* bits 6 to 7 are reserved */
+#define USB_PORT_STAT_POWER 0x0100
+#define USB_PORT_STAT_LOW_SPEED 0x0200
+#define USB_PORT_STAT_HIGH_SPEED 0x0400
+#define USB_PORT_STAT_TEST 0x0800
+#define USB_PORT_STAT_INDICATOR 0x1000
+/* bits 13 to 15 are reserved */
+
+/*
+ * Additions to wPortStatus bit field from USB 3.0
+ * See USB 3.0 spec Table 10-10
+ */
+#define USB_PORT_STAT_LINK_STATE 0x01e0
+#define USB_SS_PORT_STAT_POWER 0x0200
+#define USB_SS_PORT_STAT_SPEED 0x1c00
+#define USB_PORT_STAT_SPEED_5GBPS 0x0000
+/* Valid only if port is enabled */
+/* Bits that are the same from USB 2.0 */
+#define USB_SS_PORT_STAT_MASK (USB_PORT_STAT_CONNECTION | \
+ USB_PORT_STAT_ENABLE | \
+ USB_PORT_STAT_OVERCURRENT | \
+ USB_PORT_STAT_RESET)
+
+/*
+ * Definitions for PORT_LINK_STATE values
+ * (bits 5-8) in wPortStatus
+ */
+#define USB_SS_PORT_LS_U0 0x0000
+#define USB_SS_PORT_LS_U1 0x0020
+#define USB_SS_PORT_LS_U2 0x0040
+#define USB_SS_PORT_LS_U3 0x0060
+#define USB_SS_PORT_LS_SS_DISABLED 0x0080
+#define USB_SS_PORT_LS_RX_DETECT 0x00a0
+#define USB_SS_PORT_LS_SS_INACTIVE 0x00c0
+#define USB_SS_PORT_LS_POLLING 0x00e0
+#define USB_SS_PORT_LS_RECOVERY 0x0100
+#define USB_SS_PORT_LS_HOT_RESET 0x0120
+#define USB_SS_PORT_LS_COMP_MOD 0x0140
+#define USB_SS_PORT_LS_LOOPBACK 0x0160
+
+/*
+ * wPortChange bit field
+ * See USB 2.0 spec Table 11-22 and USB 2.0 LPM ECN Table-4.10
+ * Bits 0 to 5 shown, bits 6 to 15 are reserved
+ */
+#define USB_PORT_STAT_C_CONNECTION 0x0001
+#define USB_PORT_STAT_C_ENABLE 0x0002
+#define USB_PORT_STAT_C_SUSPEND 0x0004
+#define USB_PORT_STAT_C_OVERCURRENT 0x0008
+#define USB_PORT_STAT_C_RESET 0x0010
+#define USB_PORT_STAT_C_L1 0x0020
+/*
+ * USB 3.0 wPortChange bit fields
+ * See USB 3.0 spec Table 10-11
+ */
+#define USB_PORT_STAT_C_BH_RESET 0x0020
+#define USB_PORT_STAT_C_LINK_STATE 0x0040
+#define USB_PORT_STAT_C_CONFIG_ERROR 0x0080
+
+/*
+ * wHubCharacteristics (masks)
+ * See USB 2.0 spec Table 11-13, offset 3
+ */
+#define HUB_CHAR_LPSM 0x0003 /* Logical Power Switching Mode mask */
+#define HUB_CHAR_COMMON_LPSM 0x0000 /* All ports power control at once */
+#define HUB_CHAR_INDV_PORT_LPSM 0x0001 /* per-port power control */
+#define HUB_CHAR_NO_LPSM 0x0002 /* no power switching */
+
+#define HUB_CHAR_COMPOUND 0x0004 /* hub is part of a compound device */
+
+#define HUB_CHAR_OCPM 0x0018 /* Over-Current Protection Mode mask */
+#define HUB_CHAR_COMMON_OCPM 0x0000 /* All ports Over-Current reporting */
+#define HUB_CHAR_INDV_PORT_OCPM 0x0008 /* per-port Over-current reporting */
+#define HUB_CHAR_NO_OCPM 0x0010 /* No Over-current Protection support */
+
+#define HUB_CHAR_TTTT 0x0060 /* TT Think Time mask */
+#define HUB_CHAR_PORTIND 0x0080 /* per-port indicators (LEDs) */
+
+struct usb_hub_status {
+ __le16 wHubStatus;
+ __le16 wHubChange;
+} __attribute__ ((packed));
+
+/*
+ * Hub Status & Hub Change bit masks
+ * See USB 2.0 spec Table 11-19 and Table 11-20
+ * Bits 0 and 1 for wHubStatus and wHubChange
+ * Bits 2 to 15 are reserved for both
+ */
+#define HUB_STATUS_LOCAL_POWER 0x0001
+#define HUB_STATUS_OVERCURRENT 0x0002
+#define HUB_CHANGE_LOCAL_POWER 0x0001
+#define HUB_CHANGE_OVERCURRENT 0x0002
+
+
+/*
+ * Hub descriptor
+ * See USB 2.0 spec Table 11-13
+ */
+
+#define USB_DT_HUB (USB_TYPE_CLASS | 0x09)
+#define USB_DT_SS_HUB (USB_TYPE_CLASS | 0x0a)
+#define USB_DT_HUB_NONVAR_SIZE 7
+#define USB_DT_SS_HUB_SIZE 12
+
+/*
+ * Hub Device descriptor
+ * USB Hub class device protocols
+ */
+
+#define USB_HUB_PR_FS 0 /* Full speed hub */
+#define USB_HUB_PR_HS_NO_TT 0 /* Hi-speed hub without TT */
+#define USB_HUB_PR_HS_SINGLE_TT 1 /* Hi-speed hub with single TT */
+#define USB_HUB_PR_HS_MULTI_TT 2 /* Hi-speed hub with multiple TT */
+#define USB_HUB_PR_SS 3 /* Super speed hub */
+
+struct usb_hub_descriptor {
+ __u8 bDescLength;
+ __u8 bDescriptorType;
+ __u8 bNbrPorts;
+ __le16 wHubCharacteristics;
+ __u8 bPwrOn2PwrGood;
+ __u8 bHubContrCurrent;
+
+ /* 2.0 and 3.0 hubs differ here */
+ union {
+ struct {
+ /* add 1 bit for hub status change; round to bytes */
+ __u8 DeviceRemovable[(USB_MAXCHILDREN + 1 + 7) / 8];
+ __u8 PortPwrCtrlMask[(USB_MAXCHILDREN + 1 + 7) / 8];
+ } __attribute__ ((packed)) hs;
+
+ struct {
+ __u8 bHubHdrDecLat;
+ __u16 wHubDelay;
+ __u16 DeviceRemovable;
+ } __attribute__ ((packed)) ss;
+ } u;
+} __attribute__ ((packed));
+
+/* port indicator status selectors, tables 11-7 and 11-25 */
+#define HUB_LED_AUTO 0
+#define HUB_LED_AMBER 1
+#define HUB_LED_GREEN 2
+#define HUB_LED_OFF 3
+
+enum hub_led_mode {
+ INDICATOR_AUTO = 0,
+ INDICATOR_CYCLE,
+ /* software blinks for attention: software, hardware, reserved */
+ INDICATOR_GREEN_BLINK, INDICATOR_GREEN_BLINK_OFF,
+ INDICATOR_AMBER_BLINK, INDICATOR_AMBER_BLINK_OFF,
+ INDICATOR_ALT_BLINK, INDICATOR_ALT_BLINK_OFF
+} __attribute__ ((packed));
+
+/* Transaction Translator Think Times, in bits */
+#define HUB_TTTT_8_BITS 0x00
+#define HUB_TTTT_16_BITS 0x20
+#define HUB_TTTT_24_BITS 0x40
+#define HUB_TTTT_32_BITS 0x60
+
+#endif /* __LINUX_CH11_H */
diff --git a/cp/ps/driver/inc/usbhost/ch9.h b/cp/ps/driver/inc/usbhost/ch9.h
new file mode 100644
index 0000000..ce4ae88
--- /dev/null
+++ b/cp/ps/driver/inc/usbhost/ch9.h
@@ -0,0 +1,949 @@
+/*
+ * This file holds USB constants and structures that are needed for
+ * USB device APIs. These are used by the USB device model, which is
+ * defined in chapter 9 of the USB 2.0 specification and in the
+ * Wireless USB 1.0 (spread around). Linux has several APIs in C that
+ * need these:
+ *
+ * - the master/host side Linux-USB kernel driver API;
+ * - the "usbfs" user space API; and
+ * - the Linux "gadget" slave/device/peripheral side driver API.
+ *
+ * USB 2.0 adds an additional "On The Go" (OTG) mode, which lets systems
+ * act either as a USB master/host or as a USB slave/device. That means
+ * the master and slave side APIs benefit from working well together.
+ *
+ * There's also "Wireless USB", using low power short range radios for
+ * peripheral interconnection but otherwise building on the USB framework.
+ *
+ * Note all descriptors are declared '__attribute__((packed))' so that:
+ *
+ * [a] they never get padded, either internally (USB spec writers
+ * probably handled that) or externally;
+ *
+ * [b] so that accessing bigger-than-a-bytes fields will never
+ * generate bus errors on any platform, even when the location of
+ * its descriptor inside a bundle isn't "naturally aligned", and
+ *
+ * [c] for consistency, removing all doubt even when it appears to
+ * someone that the two other points are non-issues for that
+ * particular descriptor type.
+ */
+
+#ifndef __LINUX_USB_CH9_H
+#define __LINUX_USB_CH9_H
+
+#if 0
+#include <linux/types.h> /* __u8 etc */
+#include <asm/byteorder.h> /* le16_to_cpu */
+#endif
+#include "types.h"
+#include "usbhost_swab.h"
+/*-------------------------------------------------------------------------*/
+
+/* CONTROL REQUEST SUPPORT */
+
+/*
+ * USB directions
+ *
+ * This bit flag is used in endpoint descriptors' bEndpointAddress field.
+ * It's also one of three fields in control requests bRequestType.
+ */
+#define USB_DIR_OUT 0 /* to device */
+#define USB_DIR_IN 0x80 /* to host */
+
+/*
+ * USB types, the second of three bRequestType fields
+ */
+#define USB_TYPE_MASK (0x03 << 5)
+#define USB_TYPE_STANDARD (0x00 << 5)
+#define USB_TYPE_CLASS (0x01 << 5)
+#define USB_TYPE_VENDOR (0x02 << 5)
+#define USB_TYPE_RESERVED (0x03 << 5)
+
+/*
+ * USB recipients, the third of three bRequestType fields
+ */
+#define USB_RECIP_MASK 0x1f
+#define USB_RECIP_DEVICE 0x00
+#define USB_RECIP_INTERFACE 0x01
+#define USB_RECIP_ENDPOINT 0x02
+#define USB_RECIP_OTHER 0x03
+/* From Wireless USB 1.0 */
+#define USB_RECIP_PORT 0x04
+#define USB_RECIP_RPIPE 0x05
+
+/*
+ * Standard requests, for the bRequest field of a SETUP packet.
+ *
+ * These are qualified by the bRequestType field, so that for example
+ * TYPE_CLASS or TYPE_VENDOR specific feature flags could be retrieved
+ * by a GET_STATUS request.
+ */
+#define USB_REQ_GET_STATUS 0x00
+#define USB_REQ_CLEAR_FEATURE 0x01
+#define USB_REQ_SET_FEATURE 0x03
+#define USB_REQ_SET_ADDRESS 0x05
+#define USB_REQ_GET_DESCRIPTOR 0x06
+#define USB_REQ_SET_DESCRIPTOR 0x07
+#define USB_REQ_GET_CONFIGURATION 0x08
+#define USB_REQ_SET_CONFIGURATION 0x09
+#define USB_REQ_GET_INTERFACE 0x0A
+#define USB_REQ_SET_INTERFACE 0x0B
+#define USB_REQ_SYNCH_FRAME 0x0C
+
+#define USB_REQ_SET_ENCRYPTION 0x0D /* Wireless USB */
+#define USB_REQ_GET_ENCRYPTION 0x0E
+#define USB_REQ_RPIPE_ABORT 0x0E
+#define USB_REQ_SET_HANDSHAKE 0x0F
+#define USB_REQ_RPIPE_RESET 0x0F
+#define USB_REQ_GET_HANDSHAKE 0x10
+#define USB_REQ_SET_CONNECTION 0x11
+#define USB_REQ_SET_SECURITY_DATA 0x12
+#define USB_REQ_GET_SECURITY_DATA 0x13
+#define USB_REQ_SET_WUSB_DATA 0x14
+#define USB_REQ_LOOPBACK_DATA_WRITE 0x15
+#define USB_REQ_LOOPBACK_DATA_READ 0x16
+#define USB_REQ_SET_INTERFACE_DS 0x17
+
+/* The Link Power Management (LPM) ECN defines USB_REQ_TEST_AND_SET command,
+ * used by hubs to put ports into a new L1 suspend state, except that it
+ * forgot to define its number ...
+ */
+
+/*
+ * USB feature flags are written using USB_REQ_{CLEAR,SET}_FEATURE, and
+ * are read as a bit array returned by USB_REQ_GET_STATUS. (So there
+ * are at most sixteen features of each type.) Hubs may also support a
+ * new USB_REQ_TEST_AND_SET_FEATURE to put ports into L1 suspend.
+ */
+#define USB_DEVICE_SELF_POWERED 0 /* (read only) */
+#define USB_DEVICE_REMOTE_WAKEUP 1 /* dev may initiate wakeup */
+#define USB_DEVICE_TEST_MODE 2 /* (wired high speed only) */
+#define USB_DEVICE_BATTERY 2 /* (wireless) */
+#define USB_DEVICE_B_HNP_ENABLE 3 /* (otg) dev may initiate HNP */
+#define USB_DEVICE_WUSB_DEVICE 3 /* (wireless)*/
+#define USB_DEVICE_A_HNP_SUPPORT 4 /* (otg) RH port supports HNP */
+#define USB_DEVICE_A_ALT_HNP_SUPPORT 5 /* (otg) other RH port does */
+#define USB_DEVICE_DEBUG_MODE 6 /* (special devices only) */
+
+/*
+ * Test Mode Selectors
+ * See USB 2.0 spec Table 9-7
+ */
+#define TEST_J 1
+#define TEST_K 2
+#define TEST_SE0_NAK 3
+#define TEST_PACKET 4
+#define TEST_FORCE_EN 5
+
+/*
+ * New Feature Selectors as added by USB 3.0
+ * See USB 3.0 spec Table 9-6
+ */
+#define USB_DEVICE_U1_ENABLE 48 /* dev may initiate U1 transition */
+#define USB_DEVICE_U2_ENABLE 49 /* dev may initiate U2 transition */
+#define USB_DEVICE_LTM_ENABLE 50 /* dev may send LTM */
+#define USB_INTRF_FUNC_SUSPEND 0 /* function suspend */
+
+#define USB_INTR_FUNC_SUSPEND_OPT_MASK 0xFF00
+/*
+ * Suspend Options, Table 9-7 USB 3.0 spec
+ */
+#define USB_INTRF_FUNC_SUSPEND_LP (1 << (8 + 0))
+#define USB_INTRF_FUNC_SUSPEND_RW (1 << (8 + 1))
+
+#define USB_ENDPOINT_HALT 0 /* IN/OUT will STALL */
+
+/* Bit array elements as returned by the USB_REQ_GET_STATUS request. */
+#define USB_DEV_STAT_U1_ENABLED 2 /* transition into U1 state */
+#define USB_DEV_STAT_U2_ENABLED 3 /* transition into U2 state */
+#define USB_DEV_STAT_LTM_ENABLED 4 /* Latency tolerance messages */
+
+/**
+ * struct usb_ctrlrequest - SETUP data for a USB device control request
+ * @bRequestType: matches the USB bmRequestType field
+ * @bRequest: matches the USB bRequest field
+ * @wValue: matches the USB wValue field (le16 byte order)
+ * @wIndex: matches the USB wIndex field (le16 byte order)
+ * @wLength: matches the USB wLength field (le16 byte order)
+ *
+ * This structure is used to send control requests to a USB device. It matches
+ * the different fields of the USB 2.0 Spec section 9.3, table 9-2. See the
+ * USB spec for a fuller description of the different fields, and what they are
+ * used for.
+ *
+ * Note that the driver for any interface can issue control requests.
+ * For most devices, interfaces don't coordinate with each other, so
+ * such requests may be made at any time.
+ */
+struct usb_ctrlrequest {
+ __u8 bRequestType;
+ __u8 bRequest;
+ __le16 wValue;
+ __le16 wIndex;
+ __le16 wLength;
+} __attribute__ ((packed));
+
+/*-------------------------------------------------------------------------*/
+
+/*
+ * STANDARD DESCRIPTORS ... as returned by GET_DESCRIPTOR, or
+ * (rarely) accepted by SET_DESCRIPTOR.
+ *
+ * Note that all multi-byte values here are encoded in little endian
+ * byte order "on the wire". Within the kernel and when exposed
+ * through the Linux-USB APIs, they are not converted to cpu byte
+ * order; it is the responsibility of the client code to do this.
+ * The single exception is when device and configuration descriptors (but
+ * not other descriptors) are read from usbfs (i.e. /proc/bus/usb/BBB/DDD);
+ * in this case the fields are converted to host endianness by the kernel.
+ */
+
+/*
+ * Descriptor types ... USB 2.0 spec table 9.5
+ */
+#define USB_DT_DEVICE 0x01
+#define USB_DT_CONFIG 0x02
+#define USB_DT_STRING 0x03
+#define USB_DT_INTERFACE 0x04
+#define USB_DT_ENDPOINT 0x05
+#define USB_DT_DEVICE_QUALIFIER 0x06
+#define USB_DT_OTHER_SPEED_CONFIG 0x07
+#define USB_DT_INTERFACE_POWER 0x08
+/* these are from a minor usb 2.0 revision (ECN) */
+#define USB_DT_OTG 0x09
+#define USB_DT_DEBUG 0x0a
+#define USB_DT_INTERFACE_ASSOCIATION 0x0b
+/* these are from the Wireless USB spec */
+#define USB_DT_SECURITY 0x0c
+#define USB_DT_KEY 0x0d
+#define USB_DT_ENCRYPTION_TYPE 0x0e
+#define USB_DT_BOS 0x0f
+#define USB_DT_DEVICE_CAPABILITY 0x10
+#define USB_DT_WIRELESS_ENDPOINT_COMP 0x11
+#define USB_DT_WIRE_ADAPTER 0x21
+#define USB_DT_RPIPE 0x22
+#define USB_DT_CS_RADIO_CONTROL 0x23
+/* From the T10 UAS specification */
+#define USB_DT_PIPE_USAGE 0x24
+/* From the USB 3.0 spec */
+#define USB_DT_SS_ENDPOINT_COMP 0x30
+
+/* Conventional codes for class-specific descriptors. The convention is
+ * defined in the USB "Common Class" Spec (3.11). Individual class specs
+ * are authoritative for their usage, not the "common class" writeup.
+ */
+#define USB_DT_CS_DEVICE (USB_TYPE_CLASS | USB_DT_DEVICE)
+#define USB_DT_CS_CONFIG (USB_TYPE_CLASS | USB_DT_CONFIG)
+#define USB_DT_CS_STRING (USB_TYPE_CLASS | USB_DT_STRING)
+#define USB_DT_CS_INTERFACE (USB_TYPE_CLASS | USB_DT_INTERFACE)
+#define USB_DT_CS_ENDPOINT (USB_TYPE_CLASS | USB_DT_ENDPOINT)
+
+/* All standard descriptors have these 2 fields at the beginning */
+struct usb_descriptor_header {
+ __u8 bLength;
+ __u8 bDescriptorType;
+} __attribute__ ((packed));
+
+
+/*-------------------------------------------------------------------------*/
+
+/* USB_DT_DEVICE: Device descriptor */
+struct usb_device_descriptor {
+ __u8 bLength;
+ __u8 bDescriptorType;
+
+ __le16 bcdUSB;
+ __u8 bDeviceClass;
+ __u8 bDeviceSubClass;
+ __u8 bDeviceProtocol;
+ __u8 bMaxPacketSize0;
+ __le16 idVendor;
+ __le16 idProduct;
+ __le16 bcdDevice;
+ __u8 iManufacturer;
+ __u8 iProduct;
+ __u8 iSerialNumber;
+ __u8 bNumConfigurations;
+} __attribute__ ((packed));
+
+#define USB_DT_DEVICE_SIZE 18
+
+
+/*
+ * Device and/or Interface Class codes
+ * as found in bDeviceClass or bInterfaceClass
+ * and defined by www.usb.org documents
+ */
+#define USB_CLASS_PER_INTERFACE 0 /* for DeviceClass */
+#define USB_CLASS_AUDIO 1
+#define USB_CLASS_COMM 2
+#define USB_CLASS_HID 3
+#define USB_CLASS_PHYSICAL 5
+#define USB_CLASS_STILL_IMAGE 6
+#define USB_CLASS_PRINTER 7
+#define USB_CLASS_MASS_STORAGE 8
+#define USB_CLASS_HUB 9
+#define USB_CLASS_CDC_DATA 0x0a
+#define USB_CLASS_CSCID 0x0b /* chip+ smart card */
+#define USB_CLASS_CONTENT_SEC 0x0d /* content security */
+#define USB_CLASS_VIDEO 0x0e
+#define USB_CLASS_WIRELESS_CONTROLLER 0xe0
+#define USB_CLASS_MISC 0xef
+#define USB_CLASS_APP_SPEC 0xfe
+#define USB_CLASS_VENDOR_SPEC 0xff
+
+#define USB_SUBCLASS_VENDOR_SPEC 0xff
+
+/*-------------------------------------------------------------------------*/
+
+/* USB_DT_CONFIG: Configuration descriptor information.
+ *
+ * USB_DT_OTHER_SPEED_CONFIG is the same descriptor, except that the
+ * descriptor type is different. Highspeed-capable devices can look
+ * different depending on what speed they're currently running. Only
+ * devices with a USB_DT_DEVICE_QUALIFIER have any OTHER_SPEED_CONFIG
+ * descriptors.
+ */
+struct usb_config_descriptor {
+ __u8 bLength;
+ __u8 bDescriptorType;
+
+ __le16 wTotalLength;
+ __u8 bNumInterfaces;
+ __u8 bConfigurationValue;
+ __u8 iConfiguration;
+ __u8 bmAttributes;
+ __u8 bMaxPower;
+} __attribute__ ((packed));
+
+#define USB_DT_CONFIG_SIZE 9
+
+/* from config descriptor bmAttributes */
+#define USB_CONFIG_ATT_ONE (1 << 7) /* must be set */
+#define USB_CONFIG_ATT_SELFPOWER (1 << 6) /* self powered */
+#define USB_CONFIG_ATT_WAKEUP (1 << 5) /* can wakeup */
+#define USB_CONFIG_ATT_BATTERY (1 << 4) /* battery powered */
+
+/*-------------------------------------------------------------------------*/
+
+/* USB_DT_STRING: String descriptor */
+struct usb_string_descriptor {
+ __u8 bLength;
+ __u8 bDescriptorType;
+
+ __le16 wData[1]; /* UTF-16LE encoded */
+} __attribute__ ((packed));
+
+/* note that "string" zero is special, it holds language codes that
+ * the device supports, not Unicode characters.
+ */
+
+/*-------------------------------------------------------------------------*/
+
+/* USB_DT_INTERFACE: Interface descriptor */
+struct usb_interface_descriptor {
+ __u8 bLength;
+ __u8 bDescriptorType;
+
+ __u8 bInterfaceNumber;
+ __u8 bAlternateSetting;
+ __u8 bNumEndpoints;
+ __u8 bInterfaceClass;
+ __u8 bInterfaceSubClass;
+ __u8 bInterfaceProtocol;
+ __u8 iInterface;
+} __attribute__ ((packed));
+
+#define USB_DT_INTERFACE_SIZE 9
+
+/*-------------------------------------------------------------------------*/
+
+/* USB_DT_ENDPOINT: Endpoint descriptor */
+struct usb_endpoint_descriptor {
+ __u8 bLength;
+ __u8 bDescriptorType;
+
+ __u8 bEndpointAddress;
+ __u8 bmAttributes;
+ __le16 wMaxPacketSize;
+ __u8 bInterval;
+
+ /* NOTE: these two are _only_ in audio endpoints. */
+ /* use USB_DT_ENDPOINT*_SIZE in bLength, not sizeof. */
+ __u8 bRefresh;
+ __u8 bSynchAddress;
+} __attribute__ ((packed));
+
+#define USB_DT_ENDPOINT_SIZE 7
+#define USB_DT_ENDPOINT_AUDIO_SIZE 9 /* Audio extension */
+
+
+/*
+ * Endpoints
+ */
+#define USB_ENDPOINT_NUMBER_MASK 0x0f /* in bEndpointAddress */
+#define USB_ENDPOINT_DIR_MASK 0x80
+
+#define USB_ENDPOINT_XFERTYPE_MASK 0x03 /* in bmAttributes */
+#define USB_ENDPOINT_XFER_CONTROL 0
+#define USB_ENDPOINT_XFER_ISOC 1
+#define USB_ENDPOINT_XFER_BULK 2
+#define USB_ENDPOINT_XFER_INT 3
+#define USB_ENDPOINT_MAX_ADJUSTABLE 0x80
+
+#define USB_ENDPOINT_SYNCTYPE 0x0c
+#define USB_ENDPOINT_SYNC_NONE (0 << 2)
+#define USB_ENDPOINT_SYNC_ASYNC (1 << 2)
+#define USB_ENDPOINT_SYNC_ADAPTIVE (2 << 2)
+#define USB_ENDPOINT_SYNC_SYNC (3 << 2)
+
+#define USB_ENDPOINT_USAGE_MASK 0x30
+#define USB_ENDPOINT_USAGE_DATA 0x00
+#define USB_ENDPOINT_USAGE_FEEDBACK 0x10
+#define USB_ENDPOINT_USAGE_IMPLICIT_FB 0x20 /* Implicit feedback Data endpoint */
+
+/*-------------------------------------------------------------------------*/
+
+/**
+ * usb_endpoint_num - get the endpoint's number
+ * @epd: endpoint to be checked
+ *
+ * Returns @epd's number: 0 to 15.
+ */
+static inline int usb_endpoint_num(const struct usb_endpoint_descriptor *epd)
+{
+ return epd->bEndpointAddress & USB_ENDPOINT_NUMBER_MASK;
+}
+
+/**
+ * usb_endpoint_type - get the endpoint's transfer type
+ * @epd: endpoint to be checked
+ *
+ * Returns one of USB_ENDPOINT_XFER_{CONTROL, ISOC, BULK, INT} according
+ * to @epd's transfer type.
+ */
+static inline int usb_endpoint_type(const struct usb_endpoint_descriptor *epd)
+{
+ return epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK;
+}
+
+/**
+ * usb_endpoint_dir_in - check if the endpoint has IN direction
+ * @epd: endpoint to be checked
+ *
+ * Returns true if the endpoint is of type IN, otherwise it returns false.
+ */
+static inline int usb_endpoint_dir_in(const struct usb_endpoint_descriptor *epd)
+{
+ return ((epd->bEndpointAddress & USB_ENDPOINT_DIR_MASK) == USB_DIR_IN);
+}
+
+/**
+ * usb_endpoint_dir_out - check if the endpoint has OUT direction
+ * @epd: endpoint to be checked
+ *
+ * Returns true if the endpoint is of type OUT, otherwise it returns false.
+ */
+static inline int usb_endpoint_dir_out(
+ const struct usb_endpoint_descriptor *epd)
+{
+ return ((epd->bEndpointAddress & USB_ENDPOINT_DIR_MASK) == USB_DIR_OUT);
+}
+
+/**
+ * usb_endpoint_xfer_bulk - check if the endpoint has bulk transfer type
+ * @epd: endpoint to be checked
+ *
+ * Returns true if the endpoint is of type bulk, otherwise it returns false.
+ */
+static inline int usb_endpoint_xfer_bulk(
+ const struct usb_endpoint_descriptor *epd)
+{
+ return ((epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) ==
+ USB_ENDPOINT_XFER_BULK);
+}
+
+/**
+ * usb_endpoint_xfer_control - check if the endpoint has control transfer type
+ * @epd: endpoint to be checked
+ *
+ * Returns true if the endpoint is of type control, otherwise it returns false.
+ */
+static inline int usb_endpoint_xfer_control(
+ const struct usb_endpoint_descriptor *epd)
+{
+ return ((epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) ==
+ USB_ENDPOINT_XFER_CONTROL);
+}
+
+/**
+ * usb_endpoint_xfer_int - check if the endpoint has interrupt transfer type
+ * @epd: endpoint to be checked
+ *
+ * Returns true if the endpoint is of type interrupt, otherwise it returns
+ * false.
+ */
+static inline int usb_endpoint_xfer_int(
+ const struct usb_endpoint_descriptor *epd)
+{
+ return ((epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) ==
+ USB_ENDPOINT_XFER_INT);
+}
+
+/**
+ * usb_endpoint_xfer_isoc - check if the endpoint has isochronous transfer type
+ * @epd: endpoint to be checked
+ *
+ * Returns true if the endpoint is of type isochronous, otherwise it returns
+ * false.
+ */
+static inline int usb_endpoint_xfer_isoc(
+ const struct usb_endpoint_descriptor *epd)
+{
+ return ((epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) ==
+ USB_ENDPOINT_XFER_ISOC);
+}
+
+/**
+ * usb_endpoint_is_bulk_in - check if the endpoint is bulk IN
+ * @epd: endpoint to be checked
+ *
+ * Returns true if the endpoint has bulk transfer type and IN direction,
+ * otherwise it returns false.
+ */
+static inline int usb_endpoint_is_bulk_in(
+ const struct usb_endpoint_descriptor *epd)
+{
+ return usb_endpoint_xfer_bulk(epd) && usb_endpoint_dir_in(epd);
+}
+
+/**
+ * usb_endpoint_is_bulk_out - check if the endpoint is bulk OUT
+ * @epd: endpoint to be checked
+ *
+ * Returns true if the endpoint has bulk transfer type and OUT direction,
+ * otherwise it returns false.
+ */
+static inline int usb_endpoint_is_bulk_out(
+ const struct usb_endpoint_descriptor *epd)
+{
+ return usb_endpoint_xfer_bulk(epd) && usb_endpoint_dir_out(epd);
+}
+
+/**
+ * usb_endpoint_is_int_in - check if the endpoint is interrupt IN
+ * @epd: endpoint to be checked
+ *
+ * Returns true if the endpoint has interrupt transfer type and IN direction,
+ * otherwise it returns false.
+ */
+static inline int usb_endpoint_is_int_in(
+ const struct usb_endpoint_descriptor *epd)
+{
+ return usb_endpoint_xfer_int(epd) && usb_endpoint_dir_in(epd);
+}
+
+/**
+ * usb_endpoint_is_int_out - check if the endpoint is interrupt OUT
+ * @epd: endpoint to be checked
+ *
+ * Returns true if the endpoint has interrupt transfer type and OUT direction,
+ * otherwise it returns false.
+ */
+static inline int usb_endpoint_is_int_out(
+ const struct usb_endpoint_descriptor *epd)
+{
+ return usb_endpoint_xfer_int(epd) && usb_endpoint_dir_out(epd);
+}
+
+/**
+ * usb_endpoint_is_isoc_in - check if the endpoint is isochronous IN
+ * @epd: endpoint to be checked
+ *
+ * Returns true if the endpoint has isochronous transfer type and IN direction,
+ * otherwise it returns false.
+ */
+static inline int usb_endpoint_is_isoc_in(
+ const struct usb_endpoint_descriptor *epd)
+{
+ return usb_endpoint_xfer_isoc(epd) && usb_endpoint_dir_in(epd);
+}
+
+/**
+ * usb_endpoint_is_isoc_out - check if the endpoint is isochronous OUT
+ * @epd: endpoint to be checked
+ *
+ * Returns true if the endpoint has isochronous transfer type and OUT direction,
+ * otherwise it returns false.
+ */
+static inline int usb_endpoint_is_isoc_out(
+ const struct usb_endpoint_descriptor *epd)
+{
+ return usb_endpoint_xfer_isoc(epd) && usb_endpoint_dir_out(epd);
+}
+
+/**
+ * usb_endpoint_maxp - get endpoint's max packet size
+ * @epd: endpoint to be checked
+ *
+ * Returns @epd's max packet
+ */
+static inline int usb_endpoint_maxp(const struct usb_endpoint_descriptor *epd)
+{
+ return __le16_to_cpu(epd->wMaxPacketSize);
+}
+
+/*-------------------------------------------------------------------------*/
+
+/* USB_DT_SS_ENDPOINT_COMP: SuperSpeed Endpoint Companion descriptor */
+struct usb_ss_ep_comp_descriptor {
+ __u8 bLength;
+ __u8 bDescriptorType;
+
+ __u8 bMaxBurst;
+ __u8 bmAttributes;
+ __le16 wBytesPerInterval;
+} __attribute__ ((packed));
+
+#define USB_DT_SS_EP_COMP_SIZE 6
+
+/* Bits 4:0 of bmAttributes if this is a bulk endpoint */
+static inline int
+usb_ss_max_streams(const struct usb_ss_ep_comp_descriptor *comp)
+{
+ int max_streams;
+
+ if (!comp)
+ return 0;
+
+ max_streams = comp->bmAttributes & 0x1f;
+
+ if (!max_streams)
+ return 0;
+
+ max_streams = 1 << max_streams;
+
+ return max_streams;
+}
+
+/* Bits 1:0 of bmAttributes if this is an isoc endpoint */
+#define USB_SS_MULT(p) (1 + ((p) & 0x3))
+
+/*-------------------------------------------------------------------------*/
+
+/* USB_DT_DEVICE_QUALIFIER: Device Qualifier descriptor */
+struct usb_qualifier_descriptor {
+ __u8 bLength;
+ __u8 bDescriptorType;
+
+ __le16 bcdUSB;
+ __u8 bDeviceClass;
+ __u8 bDeviceSubClass;
+ __u8 bDeviceProtocol;
+ __u8 bMaxPacketSize0;
+ __u8 bNumConfigurations;
+ __u8 bRESERVED;
+} __attribute__ ((packed));
+
+
+/*-------------------------------------------------------------------------*/
+
+/* USB_DT_OTG (from OTG 1.0a supplement) */
+struct usb_otg_descriptor {
+ __u8 bLength;
+ __u8 bDescriptorType;
+
+ __u8 bmAttributes; /* support for HNP, SRP, etc */
+} __attribute__ ((packed));
+
+/* from usb_otg_descriptor.bmAttributes */
+#define USB_OTG_SRP (1 << 0)
+#define USB_OTG_HNP (1 << 1) /* swap host/device roles */
+
+/*-------------------------------------------------------------------------*/
+
+/* USB_DT_DEBUG: for special highspeed devices, replacing serial console */
+struct usb_debug_descriptor {
+ __u8 bLength;
+ __u8 bDescriptorType;
+
+ /* bulk endpoints with 8 byte maxpacket */
+ __u8 bDebugInEndpoint;
+ __u8 bDebugOutEndpoint;
+} __attribute__((packed));
+
+/*-------------------------------------------------------------------------*/
+
+/* USB_DT_INTERFACE_ASSOCIATION: groups interfaces */
+struct usb_interface_assoc_descriptor {
+ __u8 bLength;
+ __u8 bDescriptorType;
+
+ __u8 bFirstInterface;
+ __u8 bInterfaceCount;
+ __u8 bFunctionClass;
+ __u8 bFunctionSubClass;
+ __u8 bFunctionProtocol;
+ __u8 iFunction;
+} __attribute__ ((packed));
+
+
+/*-------------------------------------------------------------------------*/
+
+/* USB_DT_SECURITY: group of wireless security descriptors, including
+ * encryption types available for setting up a CC/association.
+ */
+struct usb_security_descriptor {
+ __u8 bLength;
+ __u8 bDescriptorType;
+
+ __le16 wTotalLength;
+ __u8 bNumEncryptionTypes;
+} __attribute__((packed));
+
+/*-------------------------------------------------------------------------*/
+
+/* USB_DT_KEY: used with {GET,SET}_SECURITY_DATA; only public keys
+ * may be retrieved.
+ */
+struct usb_key_descriptor {
+ __u8 bLength;
+ __u8 bDescriptorType;
+
+ __u8 tTKID[3];
+ __u8 bReserved;
+ __u8 bKeyData[0];
+} __attribute__((packed));
+
+/*-------------------------------------------------------------------------*/
+
+/* USB_DT_ENCRYPTION_TYPE: bundled in DT_SECURITY groups */
+struct usb_encryption_descriptor {
+ __u8 bLength;
+ __u8 bDescriptorType;
+
+ __u8 bEncryptionType;
+#define USB_ENC_TYPE_UNSECURE 0
+#define USB_ENC_TYPE_WIRED 1 /* non-wireless mode */
+#define USB_ENC_TYPE_CCM_1 2 /* aes128/cbc session */
+#define USB_ENC_TYPE_RSA_1 3 /* rsa3072/sha1 auth */
+ __u8 bEncryptionValue; /* use in SET_ENCRYPTION */
+ __u8 bAuthKeyIndex;
+} __attribute__((packed));
+
+
+/*-------------------------------------------------------------------------*/
+
+/* USB_DT_BOS: group of device-level capabilities */
+struct usb_bos_descriptor {
+ __u8 bLength;
+ __u8 bDescriptorType;
+
+ __le16 wTotalLength;
+ __u8 bNumDeviceCaps;
+} __attribute__((packed));
+
+#define USB_DT_BOS_SIZE 5
+/*-------------------------------------------------------------------------*/
+
+/* USB_DT_DEVICE_CAPABILITY: grouped with BOS */
+struct usb_dev_cap_header {
+ __u8 bLength;
+ __u8 bDescriptorType;
+ __u8 bDevCapabilityType;
+} __attribute__((packed));
+
+#define USB_CAP_TYPE_WIRELESS_USB 1
+
+struct usb_wireless_cap_descriptor { /* Ultra Wide Band */
+ __u8 bLength;
+ __u8 bDescriptorType;
+ __u8 bDevCapabilityType;
+
+ __u8 bmAttributes;
+#define USB_WIRELESS_P2P_DRD (1 << 1)
+#define USB_WIRELESS_BEACON_MASK (3 << 2)
+#define USB_WIRELESS_BEACON_SELF (1 << 2)
+#define USB_WIRELESS_BEACON_DIRECTED (2 << 2)
+#define USB_WIRELESS_BEACON_NONE (3 << 2)
+ __le16 wPHYRates; /* bit rates, Mbps */
+#define USB_WIRELESS_PHY_53 (1 << 0) /* always set */
+#define USB_WIRELESS_PHY_80 (1 << 1)
+#define USB_WIRELESS_PHY_107 (1 << 2) /* always set */
+#define USB_WIRELESS_PHY_160 (1 << 3)
+#define USB_WIRELESS_PHY_200 (1 << 4) /* always set */
+#define USB_WIRELESS_PHY_320 (1 << 5)
+#define USB_WIRELESS_PHY_400 (1 << 6)
+#define USB_WIRELESS_PHY_480 (1 << 7)
+ __u8 bmTFITXPowerInfo; /* TFI power levels */
+ __u8 bmFFITXPowerInfo; /* FFI power levels */
+ __le16 bmBandGroup;
+ __u8 bReserved;
+} __attribute__((packed));
+
+/* USB 2.0 Extension descriptor */
+#define USB_CAP_TYPE_EXT 2
+
+struct usb_ext_cap_descriptor { /* Link Power Management */
+ __u8 bLength;
+ __u8 bDescriptorType;
+ __u8 bDevCapabilityType;
+ __le32 bmAttributes;
+#define USB_LPM_SUPPORT (1 << 1) /* supports LPM */
+#define USB_BESL_SUPPORT (1 << 2) /* supports BESL */
+#define USB_BESL_BASELINE_VALID (1 << 3) /* Baseline BESL valid*/
+#define USB_BESL_DEEP_VALID (1 << 4) /* Deep BESL valid */
+#define USB_GET_BESL_BASELINE(p) (((p) & (0xf << 8)) >> 8)
+#define USB_GET_BESL_DEEP(p) (((p) & (0xf << 12)) >> 12)
+} __attribute__((packed));
+
+#define USB_DT_USB_EXT_CAP_SIZE 7
+
+/*
+ * SuperSpeed USB Capability descriptor: Defines the set of SuperSpeed USB
+ * specific device level capabilities
+ */
+#define USB_SS_CAP_TYPE 3
+struct usb_ss_cap_descriptor { /* Link Power Management */
+ __u8 bLength;
+ __u8 bDescriptorType;
+ __u8 bDevCapabilityType;
+ __u8 bmAttributes;
+#define USB_LTM_SUPPORT (1 << 1) /* supports LTM */
+ __le16 wSpeedSupported;
+#define USB_LOW_SPEED_OPERATION (1) /* Low speed operation */
+#define USB_FULL_SPEED_OPERATION (1 << 1) /* Full speed operation */
+#define USB_HIGH_SPEED_OPERATION (1 << 2) /* High speed operation */
+#define USB_5GBPS_OPERATION (1 << 3) /* Operation at 5Gbps */
+ __u8 bFunctionalitySupport;
+ __u8 bU1devExitLat;
+ __le16 bU2DevExitLat;
+} __attribute__((packed));
+
+#define USB_DT_USB_SS_CAP_SIZE 10
+
+/*
+ * Container ID Capability descriptor: Defines the instance unique ID used to
+ * identify the instance across all operating modes
+ */
+#define CONTAINER_ID_TYPE 4
+struct usb_ss_container_id_descriptor {
+ __u8 bLength;
+ __u8 bDescriptorType;
+ __u8 bDevCapabilityType;
+ __u8 bReserved;
+ __u8 ContainerID[16]; /* 128-bit number */
+} __attribute__((packed));
+
+#define USB_DT_USB_SS_CONTN_ID_SIZE 20
+/*-------------------------------------------------------------------------*/
+
+/* USB_DT_WIRELESS_ENDPOINT_COMP: companion descriptor associated with
+ * each endpoint descriptor for a wireless device
+ */
+struct usb_wireless_ep_comp_descriptor {
+ __u8 bLength;
+ __u8 bDescriptorType;
+
+ __u8 bMaxBurst;
+ __u8 bMaxSequence;
+ __le16 wMaxStreamDelay;
+ __le16 wOverTheAirPacketSize;
+ __u8 bOverTheAirInterval;
+ __u8 bmCompAttributes;
+#define USB_ENDPOINT_SWITCH_MASK 0x03 /* in bmCompAttributes */
+#define USB_ENDPOINT_SWITCH_NO 0
+#define USB_ENDPOINT_SWITCH_SWITCH 1
+#define USB_ENDPOINT_SWITCH_SCALE 2
+} __attribute__((packed));
+
+/*-------------------------------------------------------------------------*/
+
+/* USB_REQ_SET_HANDSHAKE is a four-way handshake used between a wireless
+ * host and a device for connection set up, mutual authentication, and
+ * exchanging short lived session keys. The handshake depends on a CC.
+ */
+struct usb_handshake {
+ __u8 bMessageNumber;
+ __u8 bStatus;
+ __u8 tTKID[3];
+ __u8 bReserved;
+ __u8 CDID[16];
+ __u8 nonce[16];
+ __u8 MIC[8];
+} __attribute__((packed));
+
+/*-------------------------------------------------------------------------*/
+
+/* USB_REQ_SET_CONNECTION modifies or revokes a connection context (CC).
+ * A CC may also be set up using non-wireless secure channels (including
+ * wired USB!), and some devices may support CCs with multiple hosts.
+ */
+struct usb_connection_context {
+ __u8 CHID[16]; /* persistent host id */
+ __u8 CDID[16]; /* device id (unique w/in host context) */
+ __u8 CK[16]; /* connection key */
+} __attribute__((packed));
+
+/*-------------------------------------------------------------------------*/
+
+/* USB 2.0 defines three speeds, here's how Linux identifies them */
+
+enum usb_device_speed {
+ USB_SPEED_UNKNOWN = 0, /* enumerating */
+ USB_SPEED_LOW, USB_SPEED_FULL, /* usb 1.1 */
+ USB_SPEED_HIGH, /* usb 2.0 */
+ USB_SPEED_WIRELESS, /* wireless (usb 2.5) */
+ USB_SPEED_SUPER, /* usb 3.0 */
+};
+
+#ifdef __KERNEL__
+
+/**
+ * usb_speed_string() - Returns human readable-name of the speed.
+ * @speed: The speed to return human-readable name for. If it's not
+ * any of the speeds defined in usb_device_speed enum, string for
+ * USB_SPEED_UNKNOWN will be returned.
+ */
+extern const char *usb_speed_string(enum usb_device_speed speed);
+
+#endif
+
+enum usb_device_state {
+ /* NOTATTACHED isn't in the USB spec, and this state acts
+ * the same as ATTACHED ... but it's clearer this way.
+ */
+ USB_STATE_NOTATTACHED = 0,
+
+ /* chapter 9 and authentication (wireless) device states */
+ USB_STATE_ATTACHED,
+ USB_STATE_POWERED, /* wired */
+ USB_STATE_RECONNECTING, /* auth */
+ USB_STATE_UNAUTHENTICATED, /* auth */
+ USB_STATE_DEFAULT, /* limited function */
+ USB_STATE_ADDRESS,
+ USB_STATE_CONFIGURED, /* most functions */
+
+ USB_STATE_SUSPENDED
+
+ /* NOTE: there are actually four different SUSPENDED
+ * states, returning to POWERED, DEFAULT, ADDRESS, or
+ * CONFIGURED respectively when SOF tokens flow again.
+ * At this level there's no difference between L1 and L2
+ * suspend states. (L2 being original USB 1.1 suspend.)
+ */
+};
+
+/*-------------------------------------------------------------------------*/
+
+/*
+ * As per USB compliance update, a device that is actively drawing
+ * more than 100mA from USB must report itself as bus-powered in
+ * the GetStatus(DEVICE) call.
+ * http://compliance.usb.org/index.asp?UpdateFile=Electrical&Format=Standard#34
+ */
+#define USB_SELF_POWER_VBUS_MAX_DRAW 100
+
+#endif /* __LINUX_USB_CH9_H */
diff --git a/cp/ps/driver/inc/usbhost/drvs_usbHost.h b/cp/ps/driver/inc/usbhost/drvs_usbHost.h
new file mode 100644
index 0000000..a6d7423
--- /dev/null
+++ b/cp/ps/driver/inc/usbhost/drvs_usbHost.h
@@ -0,0 +1,52 @@
+/*******************************************************************************
+ * Copyright (C) 2014, ZTE Corporation.
+ *
+ * File Name: drvs_usbHost.h
+ * File Mark:
+ * Description:
+ * Others:
+ * Version: 1.0
+ * Author:
+ * Date: 2014-06-09
+ * History 1:
+ * Date:
+ * Version:
+ * Author:
+ * Modification:
+ * History 2:
+ ********************************************************************************/
+
+#ifndef DRVS_USBHOST
+#define DRVS_USBHOST
+#include "drvs_general.h"
+#include "usb.h"
+#include "hcd.h"
+
+typedef enum
+{
+ USBDEV_PLUGIN, /*usb on msg*/
+ USBDEV_PLUGOUT /*usb out msg*/
+} T_USBDEV_PLUGEVENT;
+
+typedef VOID (* UsbHostSetParam_cbk) (struct usb_device *dev, T_USBDEV_PLUGEVENT PlugIn);
+
+typedef struct _T_USBHOST_PARAM
+{
+ UINT16 VendorID;
+ UINT16 ProductID;
+ UsbHostSetParam_cbk UsbHostSetParam_CallBack;
+}
+T_USBHOST_PARAM;
+
+SINT32 zDrv_UsbHostSetParam(UINT16 vid, UINT16 pid, VOID *pParam);
+struct urb *usb_alloc_urb(int iso_packets, gfp_t mem_flags);
+int usb_submit_urb(struct urb *urb, gfp_t mem_flags);
+void usb_kill_urb(struct urb *urb);
+void usb_free_urb(struct urb *urb);
+int usb_control_msg(struct usb_device *dev, unsigned int pipe, UINT8 request,
+ UINT8 requesttype, UINT16 value, UINT16 index, void *data,
+ UINT16 size, int timeout);
+
+
+#endif
+
diff --git a/cp/ps/driver/inc/usbhost/errno.h b/cp/ps/driver/inc/usbhost/errno.h
new file mode 100644
index 0000000..eef615e
--- /dev/null
+++ b/cp/ps/driver/inc/usbhost/errno.h
@@ -0,0 +1,162 @@
+/*
+ * U-boot - errno.h Error number defines
+ *
+ * Copyright (c) 2005-2007 Analog Devices Inc.
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
+ * MA 02110-1301 USA
+ */
+
+#ifndef _GENERIC_ERRNO_H
+#define _GENERIC_ERRNO_H
+
+#define EPERM 1 /* Operation not permitted */
+#define ENOENT 2 /* No such file or directory */
+#define ESRCH 3 /* No such process */
+#define EINTR 4 /* Interrupted system call */
+#define EIO 5 /* I/O error */
+#define ENXIO 6 /* No such device or address */
+#define E2BIG 7 /* Argument list too long */
+#define ENOEXEC 8 /* Exec format error */
+#define EBADF 9 /* Bad file number */
+#define ECHILD 10 /* No child processes */
+#define EAGAIN 11 /* Try again */
+#define ENOMEM 12 /* Out of memory */
+#define EACCES 13 /* Permission denied */
+#define EFAULT 14 /* Bad address */
+#define ENOTBLK 15 /* Block device required */
+#define EBUSY 16 /* Device or resource busy */
+#define EEXIST 17 /* File exists */
+#define EXDEV 18 /* Cross-device link */
+#define ENODEV 19 /* No such device */
+#define ENOTDIR 20 /* Not a directory */
+#define EISDIR 21 /* Is a directory */
+#define EINVAL 22 /* Invalid argument */
+#define ENFILE 23 /* File table overflow */
+#define EMFILE 24 /* Too many open files */
+#define ENOTTY 25 /* Not a typewriter */
+#define ETXTBSY 26 /* Text file busy */
+#define EFBIG 27 /* File too large */
+#define ENOSPC 28 /* No space left on device */
+#define ESPIPE 29 /* Illegal seek */
+#define EROFS 30 /* Read-only file system */
+#define EMLINK 31 /* Too many links */
+#define EPIPE 32 /* Broken pipe */
+#define EDOM 33 /* Math argument out of domain of func */
+#define ERANGE 34 /* Math result not representable */
+#define EDEADLK 35 /* Resource deadlock would occur */
+#define ENAMETOOLONG 36 /* File name too long */
+#define ENOLCK 37 /* No record locks available */
+#define ENOSYS 38 /* Function not implemented */
+#define ENOTEMPTY 39 /* Directory not empty */
+#define ELOOP 40 /* Too many symbolic links encountered */
+#define EWOULDBLOCK EAGAIN /* Operation would block */
+#define ENOMSG 42 /* No message of desired type */
+#define EIDRM 43 /* Identifier removed */
+#define ECHRNG 44 /* Channel number out of range */
+#define EL2NSYNC 45 /* Level 2 not synchronized */
+#define EL3HLT 46 /* Level 3 halted */
+#define EL3RST 47 /* Level 3 reset */
+#define ELNRNG 48 /* Link number out of range */
+#define EUNATCH 49 /* Protocol driver not attached */
+#define ENOCSI 50 /* No CSI structure available */
+#define EL2HLT 51 /* Level 2 halted */
+#define EBADE 52 /* Invalid exchange */
+#define EBADR 53 /* Invalid request descriptor */
+#define EXFULL 54 /* Exchange full */
+#define ENOANO 55 /* No anode */
+#define EBADRQC 56 /* Invalid request code */
+#define EBADSLT 57 /* Invalid slot */
+
+#define EDEADLOCK EDEADLK
+
+#define EBFONT 59 /* Bad font file format */
+#define ENOSTR 60 /* Device not a stream */
+#define ENODATA 61 /* No data available */
+#define ETIME 62 /* Timer expired */
+#define ENOSR 63 /* Out of streams resources */
+#define ENONET 64 /* Machine is not on the network */
+#define ENOPKG 65 /* Package not installed */
+#define EREMOTE 66 /* Object is remote */
+#define ENOLINK 67 /* Link has been severed */
+#define EADV 68 /* Advertise error */
+#define ESRMNT 69 /* Srmount error */
+#define ECOMM 70 /* Communication error on send */
+#define EPROTO 71 /* Protocol error */
+#define EMULTIHOP 72 /* Multihop attempted */
+#define EDOTDOT 73 /* RFS specific error */
+#define EBADMSG 74 /* Not a data message */
+#define EOVERFLOW 75 /* Value too large for defined data type */
+#define ENOTUNIQ 76 /* Name not unique on network */
+#define EBADFD 77 /* File descriptor in bad state */
+#define EREMCHG 78 /* Remote address changed */
+#define ELIBACC 79 /* Can not access a needed shared library */
+#define ELIBBAD 80 /* Accessing a corrupted shared library */
+#define ELIBSCN 81 /* .lib section in a.out corrupted */
+#define ELIBMAX 82 /* Attempting to link in too many shared libraries */
+#define ELIBEXEC 83 /* Cannot exec a shared library directly */
+#define EILSEQ 84 /* Illegal byte sequence */
+#define ERESTART 85 /* Interrupted system call should be restarted */
+#define ESTRPIPE 86 /* Streams pipe error */
+#define EUSERS 87 /* Too many users */
+#define ENOTSOCK 88 /* Socket operation on non-socket */
+#define EDESTADDRREQ 89 /* Destination address required */
+#define EMSGSIZE 90 /* Message too long */
+#define EPROTOTYPE 91 /* Protocol wrong type for socket */
+#define ENOPROTOOPT 92 /* Protocol not available */
+#define EPROTONOSUPPORT 93 /* Protocol not supported */
+#define ESOCKTNOSUPPORT 94 /* Socket type not supported */
+#define EOPNOTSUPP 95 /* Operation not supported on transport endpoint */
+#define EPFNOSUPPORT 96 /* Protocol family not supported */
+#define EAFNOSUPPORT 97 /* Address family not supported by protocol */
+#define EADDRINUSE 98 /* Address already in use */
+#define EADDRNOTAVAIL 99 /* Cannot assign requested address */
+#define ENETDOWN 100 /* Network is down */
+#define ENETUNREACH 101 /* Network is unreachable */
+#define ENETRESET 102 /* Network dropped connection because of reset */
+#define ECONNABORTED 103 /* Software caused connection abort */
+#define ECONNRESET 104 /* Connection reset by peer */
+#define ENOBUFS 105 /* No buffer space available */
+#define EISCONN 106 /* Transport endpoint is already connected */
+#define ENOTCONN 107 /* Transport endpoint is not connected */
+#define ESHUTDOWN 108 /* Cannot send after transport endpoint shutdown */
+#define ETOOMANYREFS 109 /* Too many references: cannot splice */
+#define ETIMEDOUT 110 /* Connection timed out */
+#define ECONNREFUSED 111 /* Connection refused */
+#define EHOSTDOWN 112 /* Host is down */
+#define EHOSTUNREACH 113 /* No route to host */
+#define EALREADY 114 /* Operation already in progress */
+#define EINPROGRESS 115 /* Operation now in progress */
+#define ESTALE 116 /* Stale NFS file handle */
+#define EUCLEAN 117 /* Structure needs cleaning */
+#define ENOTNAM 118 /* Not a XENIX named type file */
+#define ENAVAIL 119 /* No XENIX semaphores available */
+#define EISNAM 120 /* Is a named type file */
+#define EREMOTEIO 121 /* Remote I/O error */
+#define EDQUOT 122 /* Quota exceeded */
+#define ENOMEDIUM 123 /* No medium found */
+#define EMEDIUMTYPE 124 /* Wrong medium type */
+
+#define ERESTARTSYS 512
+#define ERESTARTNOINTR 513
+#define ERESTARTNOHAND 514 /* restart if no handler.. */
+#define ENOIOCTLCMD 515 /* No ioctl command */
+
+#define ENOTSUPP 524
+
+#endif
diff --git a/cp/ps/driver/inc/usbhost/hcd.h b/cp/ps/driver/inc/usbhost/hcd.h
new file mode 100644
index 0000000..484006f
--- /dev/null
+++ b/cp/ps/driver/inc/usbhost/hcd.h
@@ -0,0 +1,716 @@
+/*
+ * Copyright (c) 2001-2002 by David Brownell
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#ifndef __USB_CORE_HCD_H
+#define __USB_CORE_HCD_H
+
+#define __KERNEL__
+
+#ifdef __KERNEL__
+
+//#include <linux/rwsem.h>
+
+#define MAX_TOPO_LEVEL 6
+#define HISR_USBHOST_PRI 3
+#define USBHOST_HISR_THREAD_STACK_SIZE 4096
+
+
+/* This file contains declarations of usbcore internals that are mostly
+ * used or exposed by Host Controller Drivers.
+ */
+
+/*
+ * USB Packet IDs (PIDs)
+ */
+#define USB_PID_EXT 0xf0 /* USB 2.0 LPM ECN */
+#define USB_PID_OUT 0xe1
+#define USB_PID_ACK 0xd2
+#define USB_PID_DATA0 0xc3
+#define USB_PID_PING 0xb4 /* USB 2.0 */
+#define USB_PID_SOF 0xa5
+#define USB_PID_NYET 0x96 /* USB 2.0 */
+#define USB_PID_DATA2 0x87 /* USB 2.0 */
+#define USB_PID_SPLIT 0x78 /* USB 2.0 */
+#define USB_PID_IN 0x69
+#define USB_PID_NAK 0x5a
+#define USB_PID_DATA1 0x4b
+#define USB_PID_PREAMBLE 0x3c /* Token mode */
+#define USB_PID_ERR 0x3c /* USB 2.0: handshake mode */
+#define USB_PID_SETUP 0x2d
+#define USB_PID_STALL 0x1e
+#define USB_PID_MDATA 0x0f /* USB 2.0 */
+
+
+#define __ACTIVE 0x01
+#define __SUSPEND 0x04
+#define __TRANSIENT 0x80
+
+#define HC_STATE_HALT 0
+#define HC_STATE_RUNNING (__ACTIVE)
+#define HC_STATE_QUIESCING (__SUSPEND|__TRANSIENT|__ACTIVE)
+#define HC_STATE_RESUMING (__SUSPEND|__TRANSIENT)
+#define HC_STATE_SUSPENDED (__SUSPEND)
+
+#define HC_IS_RUNNING(state) ((state) & __ACTIVE)
+#define HC_IS_SUSPENDED(state) ((state) & __SUSPEND)
+
+
+#define HCD_FLAG_HW_ACCESSIBLE 0 /* at full power */
+#define HCD_FLAG_POLL_RH 2 /* poll for rh status? */
+#define HCD_FLAG_POLL_PENDING 3 /* status has changed? */
+#define HCD_FLAG_WAKEUP_PENDING 4 /* root hub is resuming? */
+#define HCD_FLAG_RH_RUNNING 5 /* root hub is running? */
+#define HCD_FLAG_DEAD 6 /* controller has died? */
+
+ /* The flags can be tested using these macros; they are likely to
+ * be slightly faster than test_bit().
+ */
+#define HCD_HW_ACCESSIBLE(hcd) ((hcd)->flags & (1U << HCD_FLAG_HW_ACCESSIBLE))
+#define HCD_POLL_RH(hcd) ((hcd)->flags & (1U << HCD_FLAG_POLL_RH))
+#define HCD_POLL_PENDING(hcd) ((hcd)->flags & (1U << HCD_FLAG_POLL_PENDING))
+#define HCD_WAKEUP_PENDING(hcd) ((hcd)->flags & (1U << HCD_FLAG_WAKEUP_PENDING))
+#define HCD_RH_RUNNING(hcd) ((hcd)->flags & (1U << HCD_FLAG_RH_RUNNING))
+#define HCD_DEAD(hcd) ((hcd)->flags & (1U << HCD_FLAG_DEAD))
+#ifndef _OS_LINUX
+#define likely(x) (x)
+#define unlikely(x) (x)
+#endif
+
+//#define usbHostTos_atomic_t int
+#define usbHostTos_atomic_inc(atom) (*atom)++
+#define usbHostTos_atomic_dec(atom) (*atom)--
+#define usbHostTos_atomic_read(atom) (*atom)
+#if 0
+#define usbHostTos_atomic_set(v,i) (((v)->counter) = (i))
+#else
+#define usbHostTos_atomic_set(v,i) ((v) = (i))
+#endif
+
+#define HCD_BUFFER_POOLS 4
+
+/*-------------------------------------------------------------------------*/
+
+/*
+ * USB Host Controller Driver (usb_hcd) framework
+ *
+ * Since "struct usb_bus" is so thin, you can't share much code in it.
+ * This framework is a layer over that, and should be more sharable.
+ *
+ * @authorized_default: Specifies if new devices are authorized to
+ * connect by default or they require explicit
+ * user space authorization; this bit is settable
+ * through /sys/class/usb_host/X/authorized_default.
+ * For the rest is RO, so we don't lock to r/w it.
+ */
+
+/*-------------------------------------------------------------------------*/
+
+struct usb_hcd {
+
+ /*
+ * housekeeping
+ */
+ struct usb_bus self; /* hcd is-a bus */
+ struct kref kref; /* reference counter */
+
+ const char *product_desc; /* product/vendor string */
+ int speed; /* Speed for this roothub.
+ * May be different from
+ * hcd->driver->flags & HCD_MASK
+ */
+ char irq_descr[24]; /* driver + bus # */
+
+// struct timer_list rh_timer; /* drives root-hub polling */
+ struct urb *status_urb; /* the current status urb */
+#ifdef CONFIG_USB_SUSPEND
+ struct work_struct wakeup_work; /* for remote wakeup */
+#endif
+
+ /*
+ * hardware info/state
+ */
+ const struct hc_driver *driver; /* hw-specific hooks */
+
+ /* Flags that need to be manipulated atomically because they can
+ * change while the host controller is running. Always use
+ * set_bit() or clear_bit() to change their values.
+ */
+ unsigned long flags;
+
+ /* Flags that get set only during HCD registration or removal. */
+ unsigned rh_registered:1;/* is root hub registered? */
+ unsigned rh_pollable:1; /* may we poll the root hub? */
+ unsigned msix_enabled:1; /* driver has MSI-X enabled? */
+
+ /* The next flag is a stopgap, to be removed when all the HCDs
+ * support the new root-hub polling mechanism. */
+ unsigned uses_new_polling:1;
+ unsigned wireless:1; /* Wireless USB HCD */
+ unsigned authorized_default:1;
+ unsigned has_tt:1; /* Integrated TT in root hub */
+
+ unsigned int irq; /* irq allocated */
+ void __iomem *regs; /* device memory/io */
+ u64 rsrc_start; /* memory/io resource start */
+ u64 rsrc_len; /* memory/io resource length */
+ unsigned power_budget; /* in mA, 0 = no limit */
+
+ /* bandwidth_mutex should be taken before adding or removing
+ * any new bus bandwidth constraints:
+ * 1. Before adding a configuration for a new device.
+ * 2. Before removing the configuration to put the device into
+ * the addressed state.
+ * 3. Before selecting a different configuration.
+ * 4. Before selecting an alternate interface setting.
+ *
+ * bandwidth_mutex should be dropped after a successful control message
+ * to the device, or resetting the bandwidth after a failed attempt.
+ */
+ struct ZOSS_MUTEX_ID *bandwidth_mutex;
+ struct usb_hcd *shared_hcd;
+ struct usb_hcd *primary_hcd;
+#if 0
+ struct dma_pool *pool[HCD_BUFFER_POOLS];
+#endif
+ int state;
+ T_Drv_Hisr *hisr;
+ /* more shared queuing code would be good; it should support
+ * smarter scheduling, handle transaction translators, etc;
+ * input size of periodic table to an interrupt scheduler.
+ * (ohci 32, uhci 1024, ehci 256/512/1024).
+ */
+
+ /* The HC driver's private data is stored at the end of
+ * this structure.
+ */
+ unsigned long hcd_priv[0]
+ __attribute__ ((aligned(sizeof(s64))));
+};
+
+/* 2.4 does this a bit differently ... */
+static inline struct usb_bus *hcd_to_bus(struct usb_hcd *hcd)
+{
+ return &hcd->self;
+}
+
+static inline struct usb_hcd *bus_to_hcd(struct usb_bus *bus)
+{
+ return container_of(bus, struct usb_hcd, self);
+}
+#if 0
+struct hcd_timeout { /* timeouts we allocate */
+ struct list_head timeout_list;
+ struct timer_list timer;
+};
+#endif
+
+/*-------------------------------------------------------------------------*/
+#define HCD_MEMORY 0x0001 /* HC regs use memory (else I/O) */
+#define HCD_LOCAL_MEM 0x0002 /* HC needs local memory */
+#define HCD_SHARED 0x0004 /* Two (or more) usb_hcds share HW */
+#define HCD_USB11 0x0010 /* USB 1.1 */
+#define HCD_USB2 0x0020 /* USB 2.0 */
+#define HCD_USB3 0x0040 /* USB 3.0 */
+#define HCD_MASK 0x0070
+
+#ifndef _OS_LINUX
+enum irqreturn {
+ IRQ_NONE = (0 << 0),
+ IRQ_HANDLED = (1 << 0),
+ IRQ_WAKE_THREAD = (1 << 1),
+};
+typedef enum irqreturn irqreturn_t;
+
+#define IRQ_RETVAL(x) ((x) != IRQ_NONE)
+#endif
+
+
+struct hc_driver {
+ const char *description; /* "ehci-hcd" etc */
+ const char *product_desc; /* product/vendor string */
+ size_t hcd_priv_size; /* size of private data */
+
+ /* irq handler */
+ irqreturn_t (*irq) (struct usb_hcd *hcd);
+
+ int flags;
+
+ /* called to init HCD and root hub */
+ int (*reset) (struct usb_hcd *hcd);
+ int (*start) (struct usb_hcd *hcd);
+
+ /* NOTE: these suspend/resume calls relate to the HC as
+ * a whole, not just the root hub; they're for PCI bus glue.
+ */
+ /* called after suspending the hub, before entering D3 etc */
+ int (*pci_suspend)(struct usb_hcd *hcd, bool do_wakeup);
+
+ /* called after entering D0 (etc), before resuming the hub */
+ int (*pci_resume)(struct usb_hcd *hcd, bool hibernated);
+
+ /* cleanly make HCD stop writing memory and doing I/O */
+ void (*stop) (struct usb_hcd *hcd);
+
+ /* shutdown HCD */
+ void (*shutdown) (struct usb_hcd *hcd);
+
+ /* return current frame number */
+ int (*get_frame_number) (struct usb_hcd *hcd);
+
+ /* manage i/o requests, device state */
+ int (*urb_enqueue)(struct usb_hcd *hcd,
+ struct urb *urb, gfp_t mem_flags);
+ int (*urb_dequeue)(struct usb_hcd *hcd,
+ struct urb *urb, int status);
+
+ /*
+ * (optional) these hooks allow an HCD to override the default DMA
+ * mapping and unmapping routines. In general, they shouldn't be
+ * necessary unless the host controller has special DMA requirements,
+ * such as alignment contraints. If these are not specified, the
+ * general usb_hcd_(un)?map_urb_for_dma functions will be used instead
+ * (and it may be a good idea to call these functions in your HCD
+ * implementation)
+ */
+ int (*map_urb_for_dma)(struct usb_hcd *hcd, struct urb *urb,
+ gfp_t mem_flags);
+ void (*unmap_urb_for_dma)(struct usb_hcd *hcd, struct urb *urb);
+
+ /* hw synch, freeing endpoint resources that urb_dequeue can't */
+ void (*endpoint_disable)(struct usb_hcd *hcd,
+ struct usb_host_endpoint *ep);
+
+ /* (optional) reset any endpoint state such as sequence number
+ and current window */
+ void (*endpoint_reset)(struct usb_hcd *hcd,
+ struct usb_host_endpoint *ep);
+
+ /* root hub support */
+ int (*hub_status_data) (struct usb_hcd *hcd, char *buf);
+ int (*hub_control) (struct usb_hcd *hcd,
+ u16 typeReq, u16 wValue, u16 wIndex,
+ char *buf, u16 wLength);
+ int (*bus_suspend)(struct usb_hcd *);
+ int (*bus_resume)(struct usb_hcd *);
+ int (*start_port_reset)(struct usb_hcd *, unsigned port_num);
+
+ /* force handover of high-speed port to full-speed companion */
+ void (*relinquish_port)(struct usb_hcd *, int);
+ /* has a port been handed over to a companion? */
+ int (*port_handed_over)(struct usb_hcd *, int);
+
+ /* CLEAR_TT_BUFFER completion callback */
+ void (*clear_tt_buffer_complete)(struct usb_hcd *,
+ struct usb_host_endpoint *);
+
+ /* xHCI specific functions */
+ /* Called by usb_alloc_dev to alloc HC device structures */
+ int (*alloc_dev)(struct usb_hcd *, struct usb_device *);
+ /* Called by usb_disconnect to free HC device structures */
+ void (*free_dev)(struct usb_hcd *, struct usb_device *);
+ /* Change a group of bulk endpoints to support multiple stream IDs */
+ int (*alloc_streams)(struct usb_hcd *hcd, struct usb_device *udev,
+ struct usb_host_endpoint **eps, unsigned int num_eps,
+ unsigned int num_streams, gfp_t mem_flags);
+ /* Reverts a group of bulk endpoints back to not using stream IDs.
+ * Can fail if we run out of memory.
+ */
+ int (*free_streams)(struct usb_hcd *hcd, struct usb_device *udev,
+ struct usb_host_endpoint **eps, unsigned int num_eps,
+ gfp_t mem_flags);
+
+ /* Bandwidth computation functions */
+ /* Note that add_endpoint() can only be called once per endpoint before
+ * check_bandwidth() or reset_bandwidth() must be called.
+ * drop_endpoint() can only be called once per endpoint also.
+ * A call to xhci_drop_endpoint() followed by a call to
+ * xhci_add_endpoint() will add the endpoint to the schedule with
+ * possibly new parameters denoted by a different endpoint descriptor
+ * in usb_host_endpoint. A call to xhci_add_endpoint() followed by a
+ * call to xhci_drop_endpoint() is not allowed.
+ */
+ /* Allocate endpoint resources and add them to a new schedule */
+ int (*add_endpoint)(struct usb_hcd *, struct usb_device *,
+ struct usb_host_endpoint *);
+ /* Drop an endpoint from a new schedule */
+ int (*drop_endpoint)(struct usb_hcd *, struct usb_device *,
+ struct usb_host_endpoint *);
+ /* Check that a new hardware configuration, set using
+ * endpoint_enable and endpoint_disable, does not exceed bus
+ * bandwidth. This must be called before any set configuration
+ * or set interface requests are sent to the device.
+ */
+ int (*check_bandwidth)(struct usb_hcd *, struct usb_device *);
+ /* Reset the device schedule to the last known good schedule,
+ * which was set from a previous successful call to
+ * check_bandwidth(). This reverts any add_endpoint() and
+ * drop_endpoint() calls since that last successful call.
+ * Used for when a check_bandwidth() call fails due to resource
+ * or bandwidth constraints.
+ */
+ void (*reset_bandwidth)(struct usb_hcd *, struct usb_device *);
+ /* Returns the hardware-chosen device address */
+ int (*address_device)(struct usb_hcd *, struct usb_device *udev);
+ /* Notifies the HCD after a hub descriptor is fetched.
+ * Will block.
+ */
+ int (*update_hub_device)(struct usb_hcd *, struct usb_device *hdev,
+ struct usb_tt *tt, gfp_t mem_flags);
+ int (*reset_device)(struct usb_hcd *, struct usb_device *);
+ /* Notifies the HCD after a device is connected and its
+ * address is set
+ */
+ int (*update_device)(struct usb_hcd *, struct usb_device *);
+ int (*set_usb2_hw_lpm)(struct usb_hcd *, struct usb_device *, int);
+};
+
+extern int usb_hcd_link_urb_to_ep(struct usb_hcd *hcd, struct urb *urb);
+extern int usb_hcd_check_unlink_urb(struct usb_hcd *hcd, struct urb *urb,
+ int status);
+extern void usb_hcd_unlink_urb_from_ep(struct usb_hcd *hcd, struct urb *urb);
+
+extern int usb_hcd_submit_urb(struct urb *urb, gfp_t mem_flags);
+extern int usb_hcd_unlink_urb(struct urb *urb, int status);
+extern void usb_hcd_giveback_urb(struct usb_hcd *hcd, struct urb *urb,
+ int status);
+extern int usb_hcd_map_urb_for_dma(struct usb_hcd *hcd, struct urb *urb,
+ gfp_t mem_flags);
+extern void usb_hcd_unmap_urb_setup_for_dma(struct usb_hcd *, struct urb *);
+extern void usb_hcd_unmap_urb_for_dma(struct usb_hcd *, struct urb *);
+extern void usb_hcd_flush_endpoint(struct usb_device *udev,
+ struct usb_host_endpoint *ep);
+extern void usb_hcd_disable_endpoint(struct usb_device *udev,
+ struct usb_host_endpoint *ep);
+extern void usb_hcd_reset_endpoint(struct usb_device *udev,
+ struct usb_host_endpoint *ep);
+extern void usb_hcd_synchronize_unlinks(struct usb_device *udev);
+extern int usb_hcd_alloc_bandwidth(struct usb_device *udev,
+ struct usb_host_config *new_config,
+ struct usb_host_interface *old_alt,
+ struct usb_host_interface *new_alt);
+extern int usb_hcd_get_frame_number(struct usb_device *udev);
+
+extern struct usb_hcd *usb_create_hcd(const struct hc_driver *driver);
+extern struct usb_hcd *usb_create_shared_hcd(const struct hc_driver *driver,
+ struct usb_hcd *shared_hcd);
+extern struct usb_hcd *usb_get_hcd(struct usb_hcd *hcd);
+extern void usb_put_hcd(struct usb_hcd *hcd);
+extern int usb_hcd_is_primary_hcd(struct usb_hcd *hcd);
+extern int usb_add_hcd(struct usb_hcd *hcd,
+ unsigned int irqnum, unsigned long irqflags);
+extern void usb_remove_hcd(struct usb_hcd *hcd);
+
+struct platform_device;
+extern void usb_hcd_platform_shutdown(struct platform_device *dev);
+
+#ifdef CONFIG_PCI
+struct pci_dev;
+struct pci_device_id;
+extern int usb_hcd_pci_probe(struct pci_dev *dev,
+ const struct pci_device_id *id);
+extern void usb_hcd_pci_remove(struct pci_dev *dev);
+extern void usb_hcd_pci_shutdown(struct pci_dev *dev);
+
+#ifdef CONFIG_PM_SLEEP
+extern const struct dev_pm_ops usb_hcd_pci_pm_ops;
+#endif
+#endif /* CONFIG_PCI */
+
+/* pci-ish (pdev null is ok) buffer alloc/mapping support */
+#if 0
+int hcd_buffer_create(struct usb_hcd *hcd);
+#endif
+
+void hcd_buffer_destroy(struct usb_hcd *hcd);
+
+void *hcd_buffer_alloc(struct usb_bus *bus, size_t size,
+ gfp_t mem_flags, dma_addr_t *dma);
+void hcd_buffer_free(struct usb_bus *bus, size_t size,
+ void *addr, dma_addr_t dma);
+
+/* generic bus glue, needed for host controllers that don't use PCI */
+#if 1
+extern irqreturn_t usb_hcd_irq();
+#else
+irqreturn_t usb_hcd_irq (int irq, void *__hcd)
+#endif
+
+extern void usb_hc_died(struct usb_hcd *hcd);
+extern void usb_hcd_poll_rh_status(struct usb_hcd *hcd);
+extern void usb_wakeup_notification(struct usb_device *hdev,
+ unsigned int portnum);
+
+/* The D0/D1 toggle bits ... USE WITH CAUTION (they're almost hcd-internal) */
+#define usb_gettoggle(dev, ep, out) (((dev)->toggle[out] >> (ep)) & 1)
+#define usb_dotoggle(dev, ep, out) ((dev)->toggle[out] ^= (1 << (ep)))
+#define usb_settoggle(dev, ep, out, bit) \
+ ((dev)->toggle[out] = ((dev)->toggle[out] & ~(1 << (ep))) | \
+ ((bit) << (ep)))
+
+/* -------------------------------------------------------------------------- */
+
+/* Enumeration is only for the hub driver, or HCD virtual root hubs */
+extern struct usb_device *usb_alloc_dev(struct usb_device *parent,
+ struct usb_bus *, unsigned port);
+extern int usb_new_device(struct usb_device *dev);
+extern void usb_disconnect(struct usb_device **);
+
+extern int usb_get_configuration(struct usb_device *dev);
+extern void usb_destroy_configuration(struct usb_device *dev);
+
+/*-------------------------------------------------------------------------*/
+
+/*
+ * HCD Root Hub support
+ */
+
+//#include <linux/usb/ch11.h>
+
+/*
+ * As of USB 2.0, full/low speed devices are segregated into trees.
+ * One type grows from USB 1.1 host controllers (OHCI, UHCI etc).
+ * The other type grows from high speed hubs when they connect to
+ * full/low speed devices using "Transaction Translators" (TTs).
+ *
+ * TTs should only be known to the hub driver, and high speed bus
+ * drivers (only EHCI for now). They affect periodic scheduling and
+ * sometimes control/bulk error recovery.
+ */
+
+struct usb_device;
+
+struct usb_tt {
+ struct usb_device *hub; /* upstream highspeed hub */
+ int multi; /* true means one TT per port */
+ unsigned think_time; /* think time in ns */
+
+ /* for control/bulk error recovery (CLEAR_TT_BUFFER) */
+ spinlock_t lock;
+ struct list_head clear_list; /* of usb_tt_clear */
+ struct work_struct clear_work;
+};
+
+struct usb_tt_clear {
+ struct list_head clear_list;
+ unsigned tt;
+ u16 devinfo;
+ struct usb_hcd *hcd;
+ struct usb_host_endpoint *ep;
+};
+
+extern int usb_hub_clear_tt_buffer(struct urb *urb);
+extern void usb_ep0_reinit(struct usb_device *);
+
+/* (shifted) direction/type/recipient from the USB 2.0 spec, table 9.2 */
+#define DeviceRequest \
+ ((USB_DIR_IN|USB_TYPE_STANDARD|USB_RECIP_DEVICE)<<8)
+#define DeviceOutRequest \
+ ((USB_DIR_OUT|USB_TYPE_STANDARD|USB_RECIP_DEVICE)<<8)
+
+#define InterfaceRequest \
+ ((USB_DIR_IN|USB_TYPE_STANDARD|USB_RECIP_INTERFACE)<<8)
+
+#define EndpointRequest \
+ ((USB_DIR_IN|USB_TYPE_STANDARD|USB_RECIP_INTERFACE)<<8)
+#define EndpointOutRequest \
+ ((USB_DIR_OUT|USB_TYPE_STANDARD|USB_RECIP_INTERFACE)<<8)
+
+/* class requests from the USB 2.0 hub spec, table 11-15 */
+/* GetBusState and SetHubDescriptor are optional, omitted */
+#define ClearHubFeature (0x2000 | USB_REQ_CLEAR_FEATURE)
+#define ClearPortFeature (0x2300 | USB_REQ_CLEAR_FEATURE)
+#define GetHubDescriptor (0xa000 | USB_REQ_GET_DESCRIPTOR)
+#define GetHubStatus (0xa000 | USB_REQ_GET_STATUS)
+#define GetPortStatus (0xa300 | USB_REQ_GET_STATUS)
+#define SetHubFeature (0x2000 | USB_REQ_SET_FEATURE)
+#define SetPortFeature (0x2300 | USB_REQ_SET_FEATURE)
+
+
+/*-------------------------------------------------------------------------*/
+
+/* class requests from USB 3.0 hub spec, table 10-5 */
+#define SetHubDepth (0x3000 | HUB_SET_DEPTH)
+#define GetPortErrorCount (0x8000 | HUB_GET_PORT_ERR_COUNT)
+
+/*
+ * Generic bandwidth allocation constants/support
+ */
+#define FRAME_TIME_USECS 1000L
+#define BitTime(bytecount) (7 * 8 * bytecount / 6) /* with integer truncation */
+ /* Trying not to use worst-case bit-stuffing
+ * of (7/6 * 8 * bytecount) = 9.33 * bytecount */
+ /* bytecount = data payload byte count */
+
+#define NS_TO_US(ns) ((ns + 500L) / 1000L)
+ /* convert & round nanoseconds to microseconds */
+
+
+/*
+ * Full/low speed bandwidth allocation constants/support.
+ */
+#define BW_HOST_DELAY 1000L /* nanoseconds */
+#define BW_HUB_LS_SETUP 333L /* nanoseconds */
+ /* 4 full-speed bit times (est.) */
+
+#define FRAME_TIME_BITS 12000L /* frame = 1 millisecond */
+#define FRAME_TIME_MAX_BITS_ALLOC (90L * FRAME_TIME_BITS / 100L)
+#define FRAME_TIME_MAX_USECS_ALLOC (90L * FRAME_TIME_USECS / 100L)
+
+/*
+ * Ceiling [nano/micro]seconds (typical) for that many bytes at high speed
+ * ISO is a bit less, no ACK ... from USB 2.0 spec, 5.11.3 (and needed
+ * to preallocate bandwidth)
+ */
+#define USB2_HOST_DELAY 5 /* nsec, guess */
+#define HS_NSECS(bytes) (((55 * 8 * 2083) \
+ + (2083UL * (3 + BitTime(bytes))))/1000 \
+ + USB2_HOST_DELAY)
+#define HS_NSECS_ISO(bytes) (((38 * 8 * 2083) \
+ + (2083UL * (3 + BitTime(bytes))))/1000 \
+ + USB2_HOST_DELAY)
+#define HS_USECS(bytes) NS_TO_US(HS_NSECS(bytes))
+#define HS_USECS_ISO(bytes) NS_TO_US(HS_NSECS_ISO(bytes))
+
+extern long usb_calc_bus_time(int speed, int is_input,
+ int isoc, int bytecount);
+
+/*-------------------------------------------------------------------------*/
+
+extern void usb_set_device_state(struct usb_device *udev,
+ enum usb_device_state new_state);
+
+/*-------------------------------------------------------------------------*/
+
+/* exported only within usbcore */
+
+extern struct list_head usb_bus_list;
+//extern struct mutex usb_bus_list_lock;
+extern ZOSS_MUTEX_ID usb_bus_list_lock;
+extern wait_queue_head_t usbHostTos_kill_urb_queue;
+
+extern int usb_find_interface_driver(struct usb_device *dev,
+ struct usb_interface *interface);
+
+#define usb_endpoint_out(ep_dir) (!((ep_dir) & USB_DIR_IN))
+
+#ifdef USBHOSTTOS_CONFIG_PM
+extern void usb_root_hub_lost_power(struct usb_device *rhdev);
+extern int hcd_bus_suspend(struct usb_device *rhdev, pm_message_t msg);
+extern int hcd_bus_resume(struct usb_device *rhdev, pm_message_t msg);
+#endif /* USBHOSTTOS_CONFIG_PM */
+
+#ifdef CONFIG_USB_SUSPEND
+extern void usb_hcd_resume_root_hub(struct usb_hcd *hcd);
+#else
+static inline void usb_hcd_resume_root_hub(struct usb_hcd *hcd)
+{
+ return;
+}
+#endif /* CONFIG_USB_SUSPEND */
+
+
+/*
+ * USB device fs stuff
+ */
+
+#ifdef CONFIG_USB_DEVICEFS
+
+/*
+ * these are expected to be called from the USB core/hub thread
+ * with the kernel lock held
+ */
+extern void usbfs_update_special(void);
+extern int usbfs_init(void);
+extern void usbfs_cleanup(void);
+
+#else /* CONFIG_USB_DEVICEFS */
+
+static inline void usbfs_update_special(void) {}
+static inline int usbfs_init(void) { return 0; }
+static inline void usbfs_cleanup(void) { }
+
+#endif /* CONFIG_USB_DEVICEFS */
+
+/*-------------------------------------------------------------------------*/
+
+#if defined(CONFIG_USB_MON) || defined(CONFIG_USB_MON_MODULE)
+
+struct usb_mon_operations {
+ void (*urb_submit)(struct usb_bus *bus, struct urb *urb);
+ void (*urb_submit_error)(struct usb_bus *bus, struct urb *urb, int err);
+ void (*urb_complete)(struct usb_bus *bus, struct urb *urb, int status);
+ /* void (*urb_unlink)(struct usb_bus *bus, struct urb *urb); */
+};
+
+extern struct usb_mon_operations *mon_ops;
+
+static inline void usbmon_urb_submit(struct usb_bus *bus, struct urb *urb)
+{
+ if (bus->monitored)
+ (*mon_ops->urb_submit)(bus, urb);
+}
+
+static inline void usbmon_urb_submit_error(struct usb_bus *bus, struct urb *urb,
+ int error)
+{
+ if (bus->monitored)
+ (*mon_ops->urb_submit_error)(bus, urb, error);
+}
+
+static inline void usbmon_urb_complete(struct usb_bus *bus, struct urb *urb,
+ int status)
+{
+ if (bus->monitored)
+ (*mon_ops->urb_complete)(bus, urb, status);
+}
+
+int usb_mon_register(struct usb_mon_operations *ops);
+void usb_mon_deregister(void);
+
+#else
+
+static inline void usbmon_urb_submit(struct usb_bus *bus, struct urb *urb) {}
+static inline void usbmon_urb_submit_error(struct usb_bus *bus, struct urb *urb,
+ int error) {}
+static inline void usbmon_urb_complete(struct usb_bus *bus, struct urb *urb,
+ int status) {}
+
+#endif /* CONFIG_USB_MON || CONFIG_USB_MON_MODULE */
+
+/*-------------------------------------------------------------------------*/
+
+/* random stuff */
+
+#define RUN_CONTEXT (in_irq() ? "in_irq" \
+ : (in_interrupt() ? "in_interrupt" : "can sleep"))
+
+
+/* This rwsem is for use only by the hub driver and ehci-hcd.
+ * Nobody else should touch it.
+ */
+extern ZOSS_MUTEX_ID ehci_cf_port_reset_rwsem;
+
+/* Keep track of which host controller drivers are loaded */
+#define USB_UHCI_LOADED 0
+#define USB_OHCI_LOADED 1
+#define USB_EHCI_LOADED 2
+extern unsigned long usb_hcds_loaded;
+
+#endif /* __KERNEL__ */
+
+#endif /* __USB_CORE_HCD_H */
diff --git a/cp/ps/driver/inc/usbhost/list.h b/cp/ps/driver/inc/usbhost/list.h
new file mode 100644
index 0000000..519be36
--- /dev/null
+++ b/cp/ps/driver/inc/usbhost/list.h
@@ -0,0 +1,707 @@
+#ifndef _LINUX_LIST_H
+#define _LINUX_LIST_H
+
+#if 0
+#include <mtd_linux/stddef.h>
+#include <mtd_linux/poison.h>
+#endif
+#include "poison.h"
+#include "Types.h"
+
+#ifndef ARCH_HAS_PREFETCH
+#define ARCH_HAS_PREFETCH
+static inline void prefetch(const void *x) {;}
+#endif
+
+/*
+ * Simple doubly linked list implementation.
+ *
+ * Some of the internal functions ("__xxx") are useful when
+ * manipulating whole lists rather than single entries, as
+ * sometimes we already know the next/prev entries and we can
+ * generate better code by using them directly rather than
+ * using the generic single-entry routines.
+ */
+#if 0
+struct list_head {
+ struct list_head *next, *prev;
+};
+#endif
+#ifndef _OS_LINUX
+struct work_struct { } ;
+struct timer_list { } ;
+
+#define LIST_HEAD_INIT(name) { &(name), &(name) }
+
+#define LIST_HEAD(name) \
+ struct list_head name = LIST_HEAD_INIT(name)
+
+#endif
+
+#if 0
+static inline void INIT_LIST_HEAD(struct list_head *list)
+{
+ list->next = list;
+ list->prev = list;
+}
+#endif
+
+/*
+ * Insert a new entry between two known consecutive entries.
+ *
+ * This is only for internal list manipulation where we know
+ * the prev/next entries already!
+ */
+ #if 0
+static inline void __list_add(struct list_head *new,
+ struct list_head *prev,
+ struct list_head *next)
+{
+ next->prev = new;
+ new->next = next;
+ new->prev = prev;
+ prev->next = new;
+}
+#endif
+
+/**
+ * list_add - add a new entry
+ * @new: new entry to be added
+ * @head: list head to add it after
+ *
+ * Insert a new entry after the specified head.
+ * This is good for implementing stacks.
+ */
+ #if 0
+static inline void list_add(struct list_head *new, struct list_head *head)
+{
+ __list_add(new, head, head->next);
+}
+#endif
+
+/**
+ * list_add_tail - add a new entry
+ * @new: new entry to be added
+ * @head: list head to add it before
+ *
+ * Insert a new entry before the specified head.
+ * This is useful for implementing queues.
+ */
+ #if 0
+static inline void list_add_tail(struct list_head *new, struct list_head *head)
+{
+ __list_add(new, head->prev, head);
+}
+#endif
+
+/*
+ * Delete a list entry by making the prev/next entries
+ * point to each other.
+ *
+ * This is only for internal list manipulation where we know
+ * the prev/next entries already!
+ */
+
+#if 0
+static inline void __list_del(struct list_head *prev, struct list_head *next)
+{
+ next->prev = prev;
+ prev->next = next;
+}
+#endif
+/**
+ * list_del - deletes entry from list.
+ * @entry: the element to delete from the list.
+ * Note: list_empty() on entry does not return true after this, the entry is
+ * in an undefined state.
+ */
+ #if 0
+static inline void list_del(struct list_head *entry)
+{
+ __list_del(entry->prev, entry->next);
+ entry->next = LIST_POISON1;
+ entry->prev = LIST_POISON2;
+}
+#endif
+/**
+ * list_replace - replace old entry by new one
+ * @old : the element to be replaced
+ * @new : the new element to insert
+ *
+ * If @old was empty, it will be overwritten.
+ */
+ #if 0
+static inline void list_replace(struct list_head *old,
+ struct list_head *new)
+{
+ new->next = old->next;
+ new->next->prev = new;
+ new->prev = old->prev;
+ new->prev->next = new;
+}
+#endif
+
+#if 0
+static inline void list_replace_init(struct list_head *old,
+ struct list_head *new)
+{
+ list_replace(old, new);
+ INIT_LIST_HEAD(old);
+}
+#endif
+
+/**
+ * list_del_init - deletes entry from list and reinitialize it.
+ * @entry: the element to delete from the list.
+ */
+ #if 0
+static inline void list_del_init(struct list_head *entry)
+{
+ __list_del(entry->prev, entry->next);
+ INIT_LIST_HEAD(entry);
+}
+#endif
+
+/**
+ * list_move - delete from one list and add as another's head
+ * @list: the entry to move
+ * @head: the head that will precede our entry
+ */
+ #if 0
+static inline void list_move(struct list_head *list, struct list_head *head)
+{
+ __list_del(list->prev, list->next);
+ list_add(list, head);
+}
+#endif
+/**
+ * list_move_tail - delete from one list and add as another's tail
+ * @list: the entry to move
+ * @head: the head that will follow our entry
+ */
+ #if 0
+static inline void list_move_tail(struct list_head *list,
+ struct list_head *head)
+{
+ __list_del(list->prev, list->next);
+ list_add_tail(list, head);
+}
+#endif
+/**
+ * list_is_last - tests whether @list is the last entry in list @head
+ * @list: the entry to test
+ * @head: the head of the list
+ */
+ #if 0
+static inline int list_is_last(const struct list_head *list,
+ const struct list_head *head)
+{
+ return list->next == head;
+}
+#endif
+/**
+ * list_empty - tests whether a list is empty
+ * @head: the list to test.
+ */
+ #if 0
+static inline int list_empty(const struct list_head *head)
+{
+ return head->next == head;
+}
+#endif
+/**
+ * list_empty_careful - tests whether a list is empty and not being modified
+ * @head: the list to test
+ *
+ * Description:
+ * tests whether a list is empty _and_ checks that no other CPU might be
+ * in the process of modifying either member (next or prev)
+ *
+ * NOTE: using list_empty_careful() without synchronization
+ * can only be safe if the only activity that can happen
+ * to the list entry is list_del_init(). Eg. it cannot be used
+ * if another CPU could re-list_add() it.
+ */
+ #if 0
+static inline int list_empty_careful(const struct list_head *head)
+{
+ struct list_head *next = head->next;
+ return (next == head) && (next == head->prev);
+}
+#endif
+/**
+ * list_is_singular - tests whether a list has just one entry.
+ * @head: the list to test.
+ */
+ #if 0
+static inline int list_is_singular(const struct list_head *head)
+{
+ return !list_empty(head) && (head->next == head->prev);
+}
+
+static inline void __list_cut_position(struct list_head *list,
+ struct list_head *head, struct list_head *entry)
+{
+ struct list_head *new_first = entry->next;
+ list->next = head->next;
+ list->next->prev = list;
+ list->prev = entry;
+ entry->next = list;
+ head->next = new_first;
+ new_first->prev = head;
+}
+
+/**
+ * list_cut_position - cut a list into two
+ * @list: a new list to add all removed entries
+ * @head: a list with entries
+ * @entry: an entry within head, could be the head itself
+ * and if so we won't cut the list
+ *
+ * This helper moves the initial part of @head, up to and
+ * including @entry, from @head to @list. You should
+ * pass on @entry an element you know is on @head. @list
+ * should be an empty list or a list you do not care about
+ * losing its data.
+ *
+ */
+static inline void list_cut_position(struct list_head *list,
+ struct list_head *head, struct list_head *entry)
+{
+ if (list_empty(head))
+ return;
+ if (list_is_singular(head) &&
+ (head->next != entry && head != entry))
+ return;
+ if (entry == head)
+ INIT_LIST_HEAD(list);
+ else
+ __list_cut_position(list, head, entry);
+}
+
+static inline void __list_splice(const struct list_head *list,
+ struct list_head *prev,
+ struct list_head *next)
+{
+ struct list_head *first = list->next;
+ struct list_head *last = list->prev;
+
+ first->prev = prev;
+ prev->next = first;
+
+ last->next = next;
+ next->prev = last;
+}
+
+/**
+ * list_splice - join two lists, this is designed for stacks
+ * @list: the new list to add.
+ * @head: the place to add it in the first list.
+ */
+static inline void list_splice(const struct list_head *list,
+ struct list_head *head)
+{
+ if (!list_empty(list))
+ __list_splice(list, head, head->next);
+}
+
+/**
+ * list_splice_tail - join two lists, each list being a queue
+ * @list: the new list to add.
+ * @head: the place to add it in the first list.
+ */
+static inline void list_splice_tail(struct list_head *list,
+ struct list_head *head)
+{
+ if (!list_empty(list))
+ __list_splice(list, head->prev, head);
+}
+
+/**
+ * list_splice_init - join two lists and reinitialise the emptied list.
+ * @list: the new list to add.
+ * @head: the place to add it in the first list.
+ *
+ * The list at @list is reinitialised
+ */
+static inline void list_splice_init(struct list_head *list,
+ struct list_head *head)
+{
+ if (!list_empty(list)) {
+ __list_splice(list, head, head->next);
+ INIT_LIST_HEAD(list);
+ }
+}
+
+/**
+ * list_splice_tail_init - join two lists and reinitialise the emptied list
+ * @list: the new list to add.
+ * @head: the place to add it in the first list.
+ *
+ * Each of the lists is a queue.
+ * The list at @list is reinitialised
+ */
+static inline void list_splice_tail_init(struct list_head *list,
+ struct list_head *head)
+{
+ if (!list_empty(list)) {
+ __list_splice(list, head->prev, head);
+ INIT_LIST_HEAD(list);
+ }
+}
+
+/**
+ * list_entry - get the struct for this entry
+ * @ptr: the &struct list_head pointer.
+ * @type: the type of the struct this is embedded in.
+ * @member: the name of the list_struct within the struct.
+ */
+#define list_entry(ptr, type, member) \
+ container_of(ptr, type, member)
+
+/**
+ * list_first_entry - get the first element from a list
+ * @ptr: the list head to take the element from.
+ * @type: the type of the struct this is embedded in.
+ * @member: the name of the list_struct within the struct.
+ *
+ * Note, that list is expected to be not empty.
+ */
+#define list_first_entry(ptr, type, member) \
+ list_entry((ptr)->next, type, member)
+
+/**
+ * list_for_each - iterate over a list
+ * @pos: the &struct list_head to use as a loop cursor.
+ * @head: the head for your list.
+ */
+#define list_for_each(pos, head) \
+ for (pos = (head)->next; prefetch(pos->next), pos != (head); \
+ pos = pos->next)
+
+/**
+ * __list_for_each - iterate over a list
+ * @pos: the &struct list_head to use as a loop cursor.
+ * @head: the head for your list.
+ *
+ * This variant differs from list_for_each() in that it's the
+ * simplest possible list iteration code, no prefetching is done.
+ * Use this for code that knows the list to be very short (empty
+ * or 1 entry) most of the time.
+ */
+#define __list_for_each(pos, head) \
+ for (pos = (head)->next; pos != (head); pos = pos->next)
+
+/**
+ * list_for_each_prev - iterate over a list backwards
+ * @pos: the &struct list_head to use as a loop cursor.
+ * @head: the head for your list.
+ */
+#define list_for_each_prev(pos, head) \
+ for (pos = (head)->prev; prefetch(pos->prev), pos != (head); \
+ pos = pos->prev)
+
+/**
+ * list_for_each_safe - iterate over a list safe against removal of list entry
+ * @pos: the &struct list_head to use as a loop cursor.
+ * @n: another &struct list_head to use as temporary storage
+ * @head: the head for your list.
+ */
+#define list_for_each_safe(pos, n, head) \
+ for (pos = (head)->next, n = pos->next; pos != (head); \
+ pos = n, n = pos->next)
+
+/**
+ * list_for_each_prev_safe - iterate over a list backwards safe against removal of list entry
+ * @pos: the &struct list_head to use as a loop cursor.
+ * @n: another &struct list_head to use as temporary storage
+ * @head: the head for your list.
+ */
+#define list_for_each_prev_safe(pos, n, head) \
+ for (pos = (head)->prev, n = pos->prev; \
+ prefetch(pos->prev), pos != (head); \
+ pos = n, n = pos->prev)
+
+/**
+ * list_for_each_entry - iterate over list of given type
+ * @pos: the type * to use as a loop cursor.
+ * @head: the head for your list.
+ * @member: the name of the list_struct within the struct.
+ */
+#define list_for_each_entry(pos, head, member) \
+ for (pos = list_entry((head)->next, typeof(*pos), member); \
+ prefetch(pos->member.next), &pos->member != (head); \
+ pos = list_entry(pos->member.next, typeof(*pos), member))
+
+/**
+ * list_for_each_entry_reverse - iterate backwards over list of given type.
+ * @pos: the type * to use as a loop cursor.
+ * @head: the head for your list.
+ * @member: the name of the list_struct within the struct.
+ */
+#define list_for_each_entry_reverse(pos, head, member) \
+ for (pos = list_entry((head)->prev, typeof(*pos), member); \
+ prefetch(pos->member.prev), &pos->member != (head); \
+ pos = list_entry(pos->member.prev, typeof(*pos), member))
+
+/**
+ * list_prepare_entry - prepare a pos entry for use in list_for_each_entry_continue()
+ * @pos: the type * to use as a start point
+ * @head: the head of the list
+ * @member: the name of the list_struct within the struct.
+ *
+ * Prepares a pos entry for use as a start point in list_for_each_entry_continue().
+ */
+#define list_prepare_entry(pos, head, member) \
+ ((pos) ? : list_entry(head, typeof(*pos), member))
+
+/**
+ * list_for_each_entry_continue - continue iteration over list of given type
+ * @pos: the type * to use as a loop cursor.
+ * @head: the head for your list.
+ * @member: the name of the list_struct within the struct.
+ *
+ * Continue to iterate over list of given type, continuing after
+ * the current position.
+ */
+#define list_for_each_entry_continue(pos, head, member) \
+ for (pos = list_entry(pos->member.next, typeof(*pos), member); \
+ prefetch(pos->member.next), &pos->member != (head); \
+ pos = list_entry(pos->member.next, typeof(*pos), member))
+
+/**
+ * list_for_each_entry_continue_reverse - iterate backwards from the given point
+ * @pos: the type * to use as a loop cursor.
+ * @head: the head for your list.
+ * @member: the name of the list_struct within the struct.
+ *
+ * Start to iterate over list of given type backwards, continuing after
+ * the current position.
+ */
+#define list_for_each_entry_continue_reverse(pos, head, member) \
+ for (pos = list_entry(pos->member.prev, typeof(*pos), member); \
+ prefetch(pos->member.prev), &pos->member != (head); \
+ pos = list_entry(pos->member.prev, typeof(*pos), member))
+
+/**
+ * list_for_each_entry_from - iterate over list of given type from the current point
+ * @pos: the type * to use as a loop cursor.
+ * @head: the head for your list.
+ * @member: the name of the list_struct within the struct.
+ *
+ * Iterate over list of given type, continuing from current position.
+ */
+#define list_for_each_entry_from(pos, head, member) \
+ for (; prefetch(pos->member.next), &pos->member != (head); \
+ pos = list_entry(pos->member.next, typeof(*pos), member))
+
+/**
+ * list_for_each_entry_safe - iterate over list of given type safe against removal of list entry
+ * @pos: the type * to use as a loop cursor.
+ * @n: another type * to use as temporary storage
+ * @head: the head for your list.
+ * @member: the name of the list_struct within the struct.
+ */
+#define list_for_each_entry_safe(pos, n, head, member) \
+ for (pos = list_entry((head)->next, typeof(*pos), member), \
+ n = list_entry(pos->member.next, typeof(*pos), member); \
+ &pos->member != (head); \
+ pos = n, n = list_entry(n->member.next, typeof(*n), member))
+
+/**
+ * list_for_each_entry_safe_continue
+ * @pos: the type * to use as a loop cursor.
+ * @n: another type * to use as temporary storage
+ * @head: the head for your list.
+ * @member: the name of the list_struct within the struct.
+ *
+ * Iterate over list of given type, continuing after current point,
+ * safe against removal of list entry.
+ */
+#define list_for_each_entry_safe_continue(pos, n, head, member) \
+ for (pos = list_entry(pos->member.next, typeof(*pos), member), \
+ n = list_entry(pos->member.next, typeof(*pos), member); \
+ &pos->member != (head); \
+ pos = n, n = list_entry(n->member.next, typeof(*n), member))
+
+/**
+ * list_for_each_entry_safe_from
+ * @pos: the type * to use as a loop cursor.
+ * @n: another type * to use as temporary storage
+ * @head: the head for your list.
+ * @member: the name of the list_struct within the struct.
+ *
+ * Iterate over list of given type from current point, safe against
+ * removal of list entry.
+ */
+#define list_for_each_entry_safe_from(pos, n, head, member) \
+ for (n = list_entry(pos->member.next, typeof(*pos), member); \
+ &pos->member != (head); \
+ pos = n, n = list_entry(n->member.next, typeof(*n), member))
+
+/**
+ * list_for_each_entry_safe_reverse
+ * @pos: the type * to use as a loop cursor.
+ * @n: another type * to use as temporary storage
+ * @head: the head for your list.
+ * @member: the name of the list_struct within the struct.
+ *
+ * Iterate backwards over list of given type, safe against removal
+ * of list entry.
+ */
+#define list_for_each_entry_safe_reverse(pos, n, head, member) \
+ for (pos = list_entry((head)->prev, typeof(*pos), member), \
+ n = list_entry(pos->member.prev, typeof(*pos), member); \
+ &pos->member != (head); \
+ pos = n, n = list_entry(n->member.prev, typeof(*n), member))
+
+/*
+ * Double linked lists with a single pointer list head.
+ * Mostly useful for hash tables where the two pointer list head is
+ * too wasteful.
+ * You lose the ability to access the tail in O(1).
+ */
+
+struct hlist_head {
+ struct hlist_node *first;
+};
+
+struct hlist_node {
+ struct hlist_node *next, **pprev;
+};
+
+#define HLIST_HEAD_INIT { .first = NULL }
+#define HLIST_HEAD(name) struct hlist_head name = { .first = NULL }
+#define INIT_HLIST_HEAD(ptr) ((ptr)->first = NULL)
+static inline void INIT_HLIST_NODE(struct hlist_node *h)
+{
+ h->next = NULL;
+ h->pprev = NULL;
+}
+
+static inline int hlist_unhashed(const struct hlist_node *h)
+{
+ return !h->pprev;
+}
+
+static inline int hlist_empty(const struct hlist_head *h)
+{
+ return !h->first;
+}
+
+static inline void __hlist_del(struct hlist_node *n)
+{
+ struct hlist_node *next = n->next;
+ struct hlist_node **pprev = n->pprev;
+ *pprev = next;
+ if (next)
+ next->pprev = pprev;
+}
+
+static inline void hlist_del(struct hlist_node *n)
+{
+ __hlist_del(n);
+ n->next = LIST_POISON1;
+ n->pprev = LIST_POISON2;
+}
+
+static inline void hlist_del_init(struct hlist_node *n)
+{
+ if (!hlist_unhashed(n)) {
+ __hlist_del(n);
+ INIT_HLIST_NODE(n);
+ }
+}
+
+static inline void hlist_add_head(struct hlist_node *n, struct hlist_head *h)
+{
+ struct hlist_node *first = h->first;
+ n->next = first;
+ if (first)
+ first->pprev = &n->next;
+ h->first = n;
+ n->pprev = &h->first;
+}
+
+/* next must be != NULL */
+static inline void hlist_add_before(struct hlist_node *n,
+ struct hlist_node *next)
+{
+ n->pprev = next->pprev;
+ n->next = next;
+ next->pprev = &n->next;
+ *(n->pprev) = n;
+}
+
+static inline void hlist_add_after(struct hlist_node *n,
+ struct hlist_node *next)
+{
+ next->next = n->next;
+ n->next = next;
+ next->pprev = &n->next;
+
+ if(next->next)
+ next->next->pprev = &next->next;
+}
+
+#define hlist_entry(ptr, type, member) container_of(ptr,type,member)
+
+#define hlist_for_each(pos, head) \
+ for (pos = (head)->first; pos && ({ prefetch(pos->next); 1; }); \
+ pos = pos->next)
+
+#define hlist_for_each_safe(pos, n, head) \
+ for (pos = (head)->first; pos && ({ n = pos->next; 1; }); \
+ pos = n)
+
+/**
+ * hlist_for_each_entry - iterate over list of given type
+ * @tpos: the type * to use as a loop cursor.
+ * @pos: the &struct hlist_node to use as a loop cursor.
+ * @head: the head for your list.
+ * @member: the name of the hlist_node within the struct.
+ */
+#define hlist_for_each_entry(tpos, pos, head, member) \
+ for (pos = (head)->first; \
+ pos && ({ prefetch(pos->next); 1;}) && \
+ ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1;}); \
+ pos = pos->next)
+
+/**
+ * hlist_for_each_entry_continue - iterate over a hlist continuing after current point
+ * @tpos: the type * to use as a loop cursor.
+ * @pos: the &struct hlist_node to use as a loop cursor.
+ * @member: the name of the hlist_node within the struct.
+ */
+#define hlist_for_each_entry_continue(tpos, pos, member) \
+ for (pos = (pos)->next; \
+ pos && ({ prefetch(pos->next); 1;}) && \
+ ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1;}); \
+ pos = pos->next)
+
+/**
+ * hlist_for_each_entry_from - iterate over a hlist continuing from current point
+ * @tpos: the type * to use as a loop cursor.
+ * @pos: the &struct hlist_node to use as a loop cursor.
+ * @member: the name of the hlist_node within the struct.
+ */
+#define hlist_for_each_entry_from(tpos, pos, member) \
+ for (; pos && ({ prefetch(pos->next); 1;}) && \
+ ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1;}); \
+ pos = pos->next)
+
+/**
+ * hlist_for_each_entry_safe - iterate over list of given type safe against removal of list entry
+ * @tpos: the type * to use as a loop cursor.
+ * @pos: the &struct hlist_node to use as a loop cursor.
+ * @n: another &struct hlist_node to use as temporary storage
+ * @head: the head for your list.
+ * @member: the name of the hlist_node within the struct.
+ */
+#define hlist_for_each_entry_safe(tpos, pos, n, head, member) \
+ for (pos = (head)->first; \
+ pos && ({ n = pos->next; 1; }) && \
+ ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1;}); \
+ pos = n)
+#endif
+#endif
diff --git a/cp/ps/driver/inc/usbhost/mod_devicetable.h b/cp/ps/driver/inc/usbhost/mod_devicetable.h
new file mode 100644
index 0000000..c5429b5
--- /dev/null
+++ b/cp/ps/driver/inc/usbhost/mod_devicetable.h
@@ -0,0 +1,595 @@
+/*
+ * Device tables which are exported to userspace via
+ * scripts/mod/file2alias.c. You must keep that file in sync with this
+ * header.
+ */
+
+#ifndef LINUX_MOD_DEVICETABLE_H
+#define LINUX_MOD_DEVICETABLE_H
+
+#if 1//def __KERNEL__
+#include "types.h"
+typedef unsigned long kernel_ulong_t;
+#endif
+
+#define PCI_ANY_ID (~0)
+
+struct pci_device_id {
+ __u32 vendor, device; /* Vendor and device ID or PCI_ANY_ID*/
+ __u32 subvendor, subdevice; /* Subsystem ID's or PCI_ANY_ID */
+ __u32 class, class_mask; /* (class,subclass,prog-if) triplet */
+ kernel_ulong_t driver_data; /* Data private to the driver */
+};
+
+
+#define IEEE1394_MATCH_VENDOR_ID 0x0001
+#define IEEE1394_MATCH_MODEL_ID 0x0002
+#define IEEE1394_MATCH_SPECIFIER_ID 0x0004
+#define IEEE1394_MATCH_VERSION 0x0008
+
+struct ieee1394_device_id {
+ __u32 match_flags;
+ __u32 vendor_id;
+ __u32 model_id;
+ __u32 specifier_id;
+ __u32 version;
+ kernel_ulong_t driver_data
+ __attribute__((aligned(sizeof(kernel_ulong_t))));
+};
+
+
+/*
+ * Device table entry for "new style" table-driven USB drivers.
+ * User mode code can read these tables to choose which modules to load.
+ * Declare the table as a MODULE_DEVICE_TABLE.
+ *
+ * A probe() parameter will point to a matching entry from this table.
+ * Use the driver_info field for each match to hold information tied
+ * to that match: device quirks, etc.
+ *
+ * Terminate the driver's table with an all-zeroes entry.
+ * Use the flag values to control which fields are compared.
+ */
+
+/**
+ * struct usb_device_id - identifies USB devices for probing and hotplugging
+ * @match_flags: Bit mask controlling of the other fields are used to match
+ * against new devices. Any field except for driver_info may be used,
+ * although some only make sense in conjunction with other fields.
+ * This is usually set by a USB_DEVICE_*() macro, which sets all
+ * other fields in this structure except for driver_info.
+ * @idVendor: USB vendor ID for a device; numbers are assigned
+ * by the USB forum to its members.
+ * @idProduct: Vendor-assigned product ID.
+ * @bcdDevice_lo: Low end of range of vendor-assigned product version numbers.
+ * This is also used to identify individual product versions, for
+ * a range consisting of a single device.
+ * @bcdDevice_hi: High end of version number range. The range of product
+ * versions is inclusive.
+ * @bDeviceClass: Class of device; numbers are assigned
+ * by the USB forum. Products may choose to implement classes,
+ * or be vendor-specific. Device classes specify behavior of all
+ * the interfaces on a devices.
+ * @bDeviceSubClass: Subclass of device; associated with bDeviceClass.
+ * @bDeviceProtocol: Protocol of device; associated with bDeviceClass.
+ * @bInterfaceClass: Class of interface; numbers are assigned
+ * by the USB forum. Products may choose to implement classes,
+ * or be vendor-specific. Interface classes specify behavior only
+ * of a given interface; other interfaces may support other classes.
+ * @bInterfaceSubClass: Subclass of interface; associated with bInterfaceClass.
+ * @bInterfaceProtocol: Protocol of interface; associated with bInterfaceClass.
+ * @driver_info: Holds information used by the driver. Usually it holds
+ * a pointer to a descriptor understood by the driver, or perhaps
+ * device flags.
+ *
+ * In most cases, drivers will create a table of device IDs by using
+ * USB_DEVICE(), or similar macros designed for that purpose.
+ * They will then export it to userspace using MODULE_DEVICE_TABLE(),
+ * and provide it to the USB core through their usb_driver structure.
+ *
+ * See the usb_match_id() function for information about how matches are
+ * performed. Briefly, you will normally use one of several macros to help
+ * construct these entries. Each entry you provide will either identify
+ * one or more specific products, or will identify a class of products
+ * which have agreed to behave the same. You should put the more specific
+ * matches towards the beginning of your table, so that driver_info can
+ * record quirks of specific products.
+ */
+struct usb_device_id {
+ /* which fields to match against? */
+ __u16 match_flags;
+
+ /* Used for product specific matches; range is inclusive */
+ __u16 idVendor;
+ __u16 idProduct;
+ __u16 bcdDevice_lo;
+ __u16 bcdDevice_hi;
+
+ /* Used for device class matches */
+ __u8 bDeviceClass;
+ __u8 bDeviceSubClass;
+ __u8 bDeviceProtocol;
+
+ /* Used for interface class matches */
+ __u8 bInterfaceClass;
+ __u8 bInterfaceSubClass;
+ __u8 bInterfaceProtocol;
+
+ /* not matched against */
+ kernel_ulong_t driver_info;
+};
+
+/* Some useful macros to use to create struct usb_device_id */
+#define USB_DEVICE_ID_MATCH_VENDOR 0x0001
+#define USB_DEVICE_ID_MATCH_PRODUCT 0x0002
+#define USB_DEVICE_ID_MATCH_DEV_LO 0x0004
+#define USB_DEVICE_ID_MATCH_DEV_HI 0x0008
+#define USB_DEVICE_ID_MATCH_DEV_CLASS 0x0010
+#define USB_DEVICE_ID_MATCH_DEV_SUBCLASS 0x0020
+#define USB_DEVICE_ID_MATCH_DEV_PROTOCOL 0x0040
+#define USB_DEVICE_ID_MATCH_INT_CLASS 0x0080
+#define USB_DEVICE_ID_MATCH_INT_SUBCLASS 0x0100
+#define USB_DEVICE_ID_MATCH_INT_PROTOCOL 0x0200
+
+#define HID_ANY_ID (~0)
+
+struct hid_device_id {
+ __u16 bus;
+ __u16 pad1;
+ __u32 vendor;
+ __u32 product;
+ kernel_ulong_t driver_data
+ __attribute__((aligned(sizeof(kernel_ulong_t))));
+};
+
+/* s390 CCW devices */
+struct ccw_device_id {
+ __u16 match_flags; /* which fields to match against */
+
+ __u16 cu_type; /* control unit type */
+ __u16 dev_type; /* device type */
+ __u8 cu_model; /* control unit model */
+ __u8 dev_model; /* device model */
+
+ kernel_ulong_t driver_info;
+};
+
+#define CCW_DEVICE_ID_MATCH_CU_TYPE 0x01
+#define CCW_DEVICE_ID_MATCH_CU_MODEL 0x02
+#define CCW_DEVICE_ID_MATCH_DEVICE_TYPE 0x04
+#define CCW_DEVICE_ID_MATCH_DEVICE_MODEL 0x08
+
+/* s390 AP bus devices */
+struct ap_device_id {
+ __u16 match_flags; /* which fields to match against */
+ __u8 dev_type; /* device type */
+ __u8 pad1;
+ __u32 pad2;
+ kernel_ulong_t driver_info;
+};
+
+#define AP_DEVICE_ID_MATCH_DEVICE_TYPE 0x01
+
+/* s390 css bus devices (subchannels) */
+struct css_device_id {
+ __u8 match_flags;
+ __u8 type; /* subchannel type */
+ __u16 pad2;
+ __u32 pad3;
+ kernel_ulong_t driver_data;
+};
+
+#define ACPI_ID_LEN 16 /* only 9 bytes needed here, 16 bytes are used */
+ /* to workaround crosscompile issues */
+
+struct acpi_device_id {
+ __u8 id[ACPI_ID_LEN];
+ kernel_ulong_t driver_data;
+};
+
+#define PNP_ID_LEN 8
+#define PNP_MAX_DEVICES 8
+
+struct pnp_device_id {
+ __u8 id[PNP_ID_LEN];
+ kernel_ulong_t driver_data;
+};
+
+struct pnp_card_device_id {
+ __u8 id[PNP_ID_LEN];
+ kernel_ulong_t driver_data;
+ struct {
+ __u8 id[PNP_ID_LEN];
+ } devs[PNP_MAX_DEVICES];
+};
+
+
+#define SERIO_ANY 0xff
+
+struct serio_device_id {
+ __u8 type;
+ __u8 extra;
+ __u8 id;
+ __u8 proto;
+};
+
+/*
+ * Struct used for matching a device
+ */
+struct of_device_id
+{
+ char name[32];
+ char type[32];
+ char compatible[128];
+#ifdef __KERNEL__
+ void *data;
+#else
+ kernel_ulong_t data;
+#endif
+};
+
+/* VIO */
+struct vio_device_id {
+ char type[32];
+ char compat[32];
+};
+
+/* PCMCIA */
+
+struct pcmcia_device_id {
+ __u16 match_flags;
+
+ __u16 manf_id;
+ __u16 card_id;
+
+ __u8 func_id;
+
+ /* for real multi-function devices */
+ __u8 function;
+
+ /* for pseudo multi-function devices */
+ __u8 device_no;
+
+ __u32 prod_id_hash[4]
+ __attribute__((aligned(sizeof(__u32))));
+
+ /* not matched against in kernelspace*/
+#ifdef __KERNEL__
+ const char * prod_id[4];
+#else
+ kernel_ulong_t prod_id[4]
+ __attribute__((aligned(sizeof(kernel_ulong_t))));
+#endif
+
+ /* not matched against */
+ kernel_ulong_t driver_info;
+#ifdef __KERNEL__
+ char * cisfile;
+#else
+ kernel_ulong_t cisfile;
+#endif
+};
+
+#define PCMCIA_DEV_ID_MATCH_MANF_ID 0x0001
+#define PCMCIA_DEV_ID_MATCH_CARD_ID 0x0002
+#define PCMCIA_DEV_ID_MATCH_FUNC_ID 0x0004
+#define PCMCIA_DEV_ID_MATCH_FUNCTION 0x0008
+#define PCMCIA_DEV_ID_MATCH_PROD_ID1 0x0010
+#define PCMCIA_DEV_ID_MATCH_PROD_ID2 0x0020
+#define PCMCIA_DEV_ID_MATCH_PROD_ID3 0x0040
+#define PCMCIA_DEV_ID_MATCH_PROD_ID4 0x0080
+#define PCMCIA_DEV_ID_MATCH_DEVICE_NO 0x0100
+#define PCMCIA_DEV_ID_MATCH_FAKE_CIS 0x0200
+#define PCMCIA_DEV_ID_MATCH_ANONYMOUS 0x0400
+
+/* Input */
+#define INPUT_DEVICE_ID_EV_MAX 0x1f
+#define INPUT_DEVICE_ID_KEY_MIN_INTERESTING 0x71
+#define INPUT_DEVICE_ID_KEY_MAX 0x2ff
+#define INPUT_DEVICE_ID_REL_MAX 0x0f
+#define INPUT_DEVICE_ID_ABS_MAX 0x3f
+#define INPUT_DEVICE_ID_MSC_MAX 0x07
+#define INPUT_DEVICE_ID_LED_MAX 0x0f
+#define INPUT_DEVICE_ID_SND_MAX 0x07
+#define INPUT_DEVICE_ID_FF_MAX 0x7f
+#define INPUT_DEVICE_ID_SW_MAX 0x0f
+
+#define INPUT_DEVICE_ID_MATCH_BUS 1
+#define INPUT_DEVICE_ID_MATCH_VENDOR 2
+#define INPUT_DEVICE_ID_MATCH_PRODUCT 4
+#define INPUT_DEVICE_ID_MATCH_VERSION 8
+
+#define INPUT_DEVICE_ID_MATCH_EVBIT 0x0010
+#define INPUT_DEVICE_ID_MATCH_KEYBIT 0x0020
+#define INPUT_DEVICE_ID_MATCH_RELBIT 0x0040
+#define INPUT_DEVICE_ID_MATCH_ABSBIT 0x0080
+#define INPUT_DEVICE_ID_MATCH_MSCIT 0x0100
+#define INPUT_DEVICE_ID_MATCH_LEDBIT 0x0200
+#define INPUT_DEVICE_ID_MATCH_SNDBIT 0x0400
+#define INPUT_DEVICE_ID_MATCH_FFBIT 0x0800
+#define INPUT_DEVICE_ID_MATCH_SWBIT 0x1000
+
+#if 0
+struct input_device_id {
+
+ kernel_ulong_t flags;
+
+ __u16 bustype;
+ __u16 vendor;
+ __u16 product;
+ __u16 version;
+
+ kernel_ulong_t evbit[INPUT_DEVICE_ID_EV_MAX / BITS_PER_LONG + 1];
+ kernel_ulong_t keybit[INPUT_DEVICE_ID_KEY_MAX / BITS_PER_LONG + 1];
+ kernel_ulong_t relbit[INPUT_DEVICE_ID_REL_MAX / BITS_PER_LONG + 1];
+ kernel_ulong_t absbit[INPUT_DEVICE_ID_ABS_MAX / BITS_PER_LONG + 1];
+ kernel_ulong_t mscbit[INPUT_DEVICE_ID_MSC_MAX / BITS_PER_LONG + 1];
+ kernel_ulong_t ledbit[INPUT_DEVICE_ID_LED_MAX / BITS_PER_LONG + 1];
+ kernel_ulong_t sndbit[INPUT_DEVICE_ID_SND_MAX / BITS_PER_LONG + 1];
+ kernel_ulong_t ffbit[INPUT_DEVICE_ID_FF_MAX / BITS_PER_LONG + 1];
+ kernel_ulong_t swbit[INPUT_DEVICE_ID_SW_MAX / BITS_PER_LONG + 1];
+
+ kernel_ulong_t driver_info;
+};
+#endif
+
+/* EISA */
+
+#define EISA_SIG_LEN 8
+
+/* The EISA signature, in ASCII form, null terminated */
+struct eisa_device_id {
+ char sig[EISA_SIG_LEN];
+ kernel_ulong_t driver_data;
+};
+
+#define EISA_DEVICE_MODALIAS_FMT "eisa:s%s"
+
+struct parisc_device_id {
+ __u8 hw_type; /* 5 bits used */
+ __u8 hversion_rev; /* 4 bits */
+ __u16 hversion; /* 12 bits */
+ __u32 sversion; /* 20 bits */
+};
+
+#define PA_HWTYPE_ANY_ID 0xff
+#define PA_HVERSION_REV_ANY_ID 0xff
+#define PA_HVERSION_ANY_ID 0xffff
+#define PA_SVERSION_ANY_ID 0xffffffff
+
+/* SDIO */
+
+#define SDIO_ANY_ID (~0)
+
+struct sdio_device_id {
+ __u8 class; /* Standard interface or SDIO_ANY_ID */
+ __u16 vendor; /* Vendor or SDIO_ANY_ID */
+ __u16 device; /* Device ID or SDIO_ANY_ID */
+ kernel_ulong_t driver_data /* Data private to the driver */
+ __attribute__((aligned(sizeof(kernel_ulong_t))));
+};
+
+/* SSB core, see drivers/ssb/ */
+struct ssb_device_id {
+ __u16 vendor;
+ __u16 coreid;
+ __u8 revision;
+};
+#define SSB_DEVICE(_vendor, _coreid, _revision) \
+ { .vendor = _vendor, .coreid = _coreid, .revision = _revision, }
+#define SSB_DEVTABLE_END \
+ { 0, },
+
+#define SSB_ANY_VENDOR 0xFFFF
+#define SSB_ANY_ID 0xFFFF
+#define SSB_ANY_REV 0xFF
+
+/* Broadcom's specific AMBA core, see drivers/bcma/ */
+struct bcma_device_id {
+ __u16 manuf;
+ __u16 id;
+ __u8 rev;
+ __u8 class;
+};
+#define BCMA_CORE(_manuf, _id, _rev, _class) \
+ { .manuf = _manuf, .id = _id, .rev = _rev, .class = _class, }
+#define BCMA_CORETABLE_END \
+ { 0, },
+
+#define BCMA_ANY_MANUF 0xFFFF
+#define BCMA_ANY_ID 0xFFFF
+#define BCMA_ANY_REV 0xFF
+#define BCMA_ANY_CLASS 0xFF
+
+struct virtio_device_id {
+ __u32 device;
+ __u32 vendor;
+};
+#define VIRTIO_DEV_ANY_ID 0xffffffff
+
+/*
+ * For Hyper-V devices we use the device guid as the id.
+ */
+struct hv_vmbus_device_id {
+ __u8 guid[16];
+ kernel_ulong_t driver_data /* Data private to the driver */
+ __attribute__((aligned(sizeof(kernel_ulong_t))));
+};
+
+/* rpmsg */
+
+#define RPMSG_NAME_SIZE 32
+#define RPMSG_DEVICE_MODALIAS_FMT "rpmsg:%s"
+
+struct rpmsg_device_id {
+ char name[RPMSG_NAME_SIZE];
+};
+
+/* i2c */
+
+#define I2C_NAME_SIZE 20
+#define I2C_MODULE_PREFIX "i2c:"
+
+struct i2c_device_id {
+ char name[I2C_NAME_SIZE];
+ kernel_ulong_t driver_data /* Data private to the driver */
+ __attribute__((aligned(sizeof(kernel_ulong_t))));
+};
+
+/* spi */
+
+#define SPI_NAME_SIZE 32
+#define SPI_MODULE_PREFIX "spi:"
+
+struct spi_device_id {
+ char name[SPI_NAME_SIZE];
+ kernel_ulong_t driver_data /* Data private to the driver */
+ __attribute__((aligned(sizeof(kernel_ulong_t))));
+};
+
+/* dmi */
+enum dmi_field {
+ DMI_NONE,
+ DMI_BIOS_VENDOR,
+ DMI_BIOS_VERSION,
+ DMI_BIOS_DATE,
+ DMI_SYS_VENDOR,
+ DMI_PRODUCT_NAME,
+ DMI_PRODUCT_VERSION,
+ DMI_PRODUCT_SERIAL,
+ DMI_PRODUCT_UUID,
+ DMI_BOARD_VENDOR,
+ DMI_BOARD_NAME,
+ DMI_BOARD_VERSION,
+ DMI_BOARD_SERIAL,
+ DMI_BOARD_ASSET_TAG,
+ DMI_CHASSIS_VENDOR,
+ DMI_CHASSIS_TYPE,
+ DMI_CHASSIS_VERSION,
+ DMI_CHASSIS_SERIAL,
+ DMI_CHASSIS_ASSET_TAG,
+ DMI_STRING_MAX,
+};
+
+struct dmi_strmatch {
+ unsigned char slot;
+ char substr[79];
+};
+
+#ifndef __KERNEL__
+struct dmi_system_id {
+ kernel_ulong_t callback;
+ kernel_ulong_t ident;
+ struct dmi_strmatch matches[4];
+ kernel_ulong_t driver_data
+ __attribute__((aligned(sizeof(kernel_ulong_t))));
+};
+#else
+struct dmi_system_id {
+ int (*callback)(const struct dmi_system_id *);
+ const char *ident;
+ struct dmi_strmatch matches[4];
+ void *driver_data;
+};
+/*
+ * struct dmi_device_id appears during expansion of
+ * "MODULE_DEVICE_TABLE(dmi, x)". Compiler doesn't look inside it
+ * but this is enough for gcc 3.4.6 to error out:
+ * error: storage size of '__mod_dmi_device_table' isn't known
+ */
+#define dmi_device_id dmi_system_id
+#endif
+
+#define DMI_MATCH(a, b) { a, b }
+
+#define PLATFORM_NAME_SIZE 20
+#define PLATFORM_MODULE_PREFIX "platform:"
+
+struct platform_device_id {
+ char name[PLATFORM_NAME_SIZE];
+ kernel_ulong_t driver_data
+ __attribute__((aligned(sizeof(kernel_ulong_t))));
+};
+
+#define MDIO_MODULE_PREFIX "mdio:"
+
+#define MDIO_ID_FMT "%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d"
+#define MDIO_ID_ARGS(_id) \
+ (_id)>>31, ((_id)>>30) & 1, ((_id)>>29) & 1, ((_id)>>28) & 1, \
+ ((_id)>>27) & 1, ((_id)>>26) & 1, ((_id)>>25) & 1, ((_id)>>24) & 1, \
+ ((_id)>>23) & 1, ((_id)>>22) & 1, ((_id)>>21) & 1, ((_id)>>20) & 1, \
+ ((_id)>>19) & 1, ((_id)>>18) & 1, ((_id)>>17) & 1, ((_id)>>16) & 1, \
+ ((_id)>>15) & 1, ((_id)>>14) & 1, ((_id)>>13) & 1, ((_id)>>12) & 1, \
+ ((_id)>>11) & 1, ((_id)>>10) & 1, ((_id)>>9) & 1, ((_id)>>8) & 1, \
+ ((_id)>>7) & 1, ((_id)>>6) & 1, ((_id)>>5) & 1, ((_id)>>4) & 1, \
+ ((_id)>>3) & 1, ((_id)>>2) & 1, ((_id)>>1) & 1, (_id) & 1
+
+/**
+ * struct mdio_device_id - identifies PHY devices on an MDIO/MII bus
+ * @phy_id: The result of
+ * (mdio_read(&MII_PHYSID1) << 16 | mdio_read(&PHYSID2)) & @phy_id_mask
+ * for this PHY type
+ * @phy_id_mask: Defines the significant bits of @phy_id. A value of 0
+ * is used to terminate an array of struct mdio_device_id.
+ */
+struct mdio_device_id {
+ __u32 phy_id;
+ __u32 phy_id_mask;
+};
+
+struct zorro_device_id {
+ __u32 id; /* Device ID or ZORRO_WILDCARD */
+ kernel_ulong_t driver_data; /* Data private to the driver */
+};
+
+#define ZORRO_WILDCARD (0xffffffff) /* not official */
+
+#define ZORRO_DEVICE_MODALIAS_FMT "zorro:i%08X"
+
+#define ISAPNP_ANY_ID 0xffff
+struct isapnp_device_id {
+ unsigned short card_vendor, card_device;
+ unsigned short vendor, function;
+ kernel_ulong_t driver_data; /* data private to the driver */
+};
+
+/**
+ * struct amba_id - identifies a device on an AMBA bus
+ * @id: The significant bits if the hardware device ID
+ * @mask: Bitmask specifying which bits of the id field are significant when
+ * matching. A driver binds to a device when ((hardware device ID) & mask)
+ * == id.
+ * @data: Private data used by the driver.
+ */
+struct amba_id {
+ unsigned int id;
+ unsigned int mask;
+#ifndef __KERNEL__
+ kernel_ulong_t data;
+#else
+ void *data;
+#endif
+};
+
+/*
+ * Match x86 CPUs for CPU specific drivers.
+ * See documentation of "x86_match_cpu" for details.
+ */
+
+struct x86_cpu_id {
+ __u16 vendor;
+ __u16 family;
+ __u16 model;
+ __u16 feature; /* bit index */
+ kernel_ulong_t driver_data;
+};
+
+#define X86_FEATURE_MATCH(x) \
+ { X86_VENDOR_ANY, X86_FAMILY_ANY, X86_MODEL_ANY, x }
+
+#define X86_VENDOR_ANY 0xffff
+#define X86_FAMILY_ANY 0
+#define X86_MODEL_ANY 0
+#define X86_FEATURE_ANY 0 /* Same as FPU, you can't test for that */
+
+#endif /* LINUX_MOD_DEVICETABLE_H */
diff --git a/cp/ps/driver/inc/usbhost/poison.h b/cp/ps/driver/inc/usbhost/poison.h
new file mode 100644
index 0000000..b3d873b
--- /dev/null
+++ b/cp/ps/driver/inc/usbhost/poison.h
@@ -0,0 +1,11 @@
+#ifndef _LINUX_POISON_H
+#define _LINUX_POISON_H
+
+/********** include/linux/list.h **********/
+/*
+ * used to verify that nobody uses non-initialized list entries.
+ */
+#define LIST_POISON1 ((void *) 0x0)
+#define LIST_POISON2 ((void *) 0x0)
+
+#endif
diff --git a/cp/ps/driver/inc/usbhost/quirks.h b/cp/ps/driver/inc/usbhost/quirks.h
new file mode 100644
index 0000000..3e93de7
--- /dev/null
+++ b/cp/ps/driver/inc/usbhost/quirks.h
@@ -0,0 +1,33 @@
+/*
+ * This file holds the definitions of quirks found in USB devices.
+ * Only quirks that affect the whole device, not an interface,
+ * belong here.
+ */
+
+#ifndef __LINUX_USB_QUIRKS_H
+#define __LINUX_USB_QUIRKS_H
+
+/* string descriptors must not be fetched using a 255-byte read */
+#define USB_QUIRK_STRING_FETCH_255 0x00000001
+
+/* device can't resume correctly so reset it instead */
+#define USB_QUIRK_RESET_RESUME 0x00000002
+
+/* device can't handle Set-Interface requests */
+#define USB_QUIRK_NO_SET_INTF 0x00000004
+
+/* device can't handle its Configuration or Interface strings */
+#define USB_QUIRK_CONFIG_INTF_STRINGS 0x00000008
+
+/*device will morph if reset, don't use reset for handling errors */
+#define USB_QUIRK_RESET_MORPHS 0x00000010
+
+/* device has more interface descriptions than the bNumInterfaces count,
+ and can't handle talking to these interfaces */
+#define USB_QUIRK_HONOR_BNUMINTERFACES 0x00000020
+
+/* device needs a pause during initialization, after we read the device
+ descriptor */
+#define USB_QUIRK_DELAY_INIT 0x00000040
+
+#endif /* __LINUX_USB_QUIRKS_H */
diff --git a/cp/ps/driver/inc/usbhost/spinlock.h b/cp/ps/driver/inc/usbhost/spinlock.h
new file mode 100644
index 0000000..c2785c3
--- /dev/null
+++ b/cp/ps/driver/inc/usbhost/spinlock.h
@@ -0,0 +1,40 @@
+#ifndef __DRV_LINUX_SPINLOCK_H__
+#define __DRV_LINUX_SPINLOCK_H__
+
+#ifndef _OS_LINUX
+
+typedef int spinlock_t; //Howard Hu TempChanged
+#define SPIN_LOCK_UNLOCKED (spinlock_t) { }
+#define DEFINE_SPINLOCK(x) spinlock_t x = SPIN_LOCK_UNLOCKED
+
+#define spin_lock_irqsave(_lock, f) LOCK_SAVE(_lock) /*//Howard Hu TempChanged */
+#define spin_unlock_irqrestore(_lock, f) LOCK_RESTORE(_lock) /*//Howard Hu TempChanged */
+
+#define spin_lock_init(lock) \
+CYG_MACRO_START; \
+CYG_UNUSED_PARAM(spinlock_t *, lock); \
+CYG_MACRO_END
+
+#define spin_lock(lock) \
+CYG_MACRO_START; \
+CYG_UNUSED_PARAM(spinlock_t *, lock); \
+CYG_MACRO_END
+
+#define spin_unlock(lock) \
+CYG_MACRO_START; \
+CYG_UNUSED_PARAM(spinlock_t *, lock); \
+CYG_MACRO_END
+
+#define spin_lock_bh(lock) \
+CYG_MACRO_START; \
+CYG_UNUSED_PARAM(spinlock_t *, lock); \
+CYG_MACRO_END
+
+#define spin_unlock_bh(lock) \
+CYG_MACRO_START; \
+CYG_UNUSED_PARAM(spinlock_t *, lock); \
+CYG_MACRO_END
+
+#endif
+
+#endif /* __LINUX_SPINLOCK_H__ */
diff --git a/cp/ps/driver/inc/usbhost/types.h b/cp/ps/driver/inc/usbhost/types.h
new file mode 100644
index 0000000..f66b1ee
--- /dev/null
+++ b/cp/ps/driver/inc/usbhost/types.h
@@ -0,0 +1,250 @@
+#ifndef _USB_LINUX_TYPES_H
+#define _USB_LINUX_TYPES_H
+
+#ifndef _OS_LINUX
+
+#if 0
+#include <mtd_linux/posix_types.h>
+#include <mtd_asm/types.h>
+#endif
+
+#ifndef _SIZE_T
+#define _SIZE_T
+typedef unsigned int __kernel_size_t;
+typedef __kernel_size_t size_t;
+#endif
+
+#if 0
+typedef __kernel_loff_t loff_t;
+
+typedef __kernel_dev_t dev_t;
+#endif
+
+/* bsd */
+typedef unsigned char u_char;
+typedef unsigned short u_short;
+typedef unsigned int u_int;
+typedef unsigned long u_long;
+
+/* sysv */
+typedef unsigned char unchar;
+typedef unsigned short ushort;
+typedef unsigned int uint;
+typedef unsigned long ulong;
+
+#if 0
+#ifndef __BIT_TYPES_DEFINED__
+#define __BIT_TYPES_DEFINED__
+
+typedef __u8 u_int8_t;
+typedef __s8 int8_t;
+typedef __u16 u_int16_t;
+typedef __s16 int16_t;
+typedef __u32 u_int32_t;
+typedef __s32 int32_t;
+
+#endif /* !(__BIT_TYPES_DEFINED__) */
+
+
+typedef __u8 uint8_t;
+typedef __u16 uint16_t;
+typedef __u32 uint32_t;
+#else
+typedef signed char __s8;
+typedef signed char s8;
+typedef unsigned char __u8;
+typedef unsigned char u8;
+
+typedef signed short __s16;
+typedef signed short s16;
+typedef unsigned short __u16;
+typedef unsigned short u16;
+
+
+typedef signed int __s32;
+typedef signed int s32;
+typedef unsigned int __u32;
+typedef unsigned int u32;
+
+typedef signed long long __s64;
+typedef signed long long s64;
+typedef unsigned long long __u64;
+typedef unsigned long long u64;
+
+typedef __s8 int8_t;
+typedef __u8 uint8_t;
+typedef __u16 uint16_t;
+typedef __u32 uint32_t;
+typedef __u8 u_int8_t;
+typedef __u32 u_int32_t;
+#endif
+
+typedef __u64 uint64_t;
+typedef __u64 u_int64_t;
+typedef __s64 int64_t;
+
+typedef int int32_t;
+typedef u32 uint32_t;
+typedef u16 uint16_t;
+typedef u8 uint8_t;
+
+
+#define __cpu_to_le64(x) ((__u64)(x))
+#define __le64_to_cpu(x) ((__u64)(x))
+#define __cpu_to_le32(x) ((__u32)(x))
+#define __le32_to_cpu(x) ((__u32)(x))
+#define __cpu_to_le16(x) ((__u16)(x))
+#define __le16_to_cpu(x) ((__u16)(x))
+
+
+/*
+ * Below are truly Linux-specific types that should never collide with
+ * any application/library that wants linux/types.h.
+ */
+#ifdef __CHECKER__
+#define __bitwise__ __attribute__((bitwise))
+#else
+#define __bitwise__
+#endif
+#ifdef __CHECK_ENDIAN__
+#define __bitwise __bitwise__
+#else
+#define __bitwise
+#endif
+
+
+typedef __u16 __bitwise __le16;
+typedef __u16 __bitwise __be16;
+typedef __u32 __bitwise __le32;
+typedef __u32 __bitwise __be32;
+#if defined(__GNUC__)
+typedef __u64 __bitwise __le64;
+typedef __u64 __bitwise __be64;
+#endif
+typedef __u16 __bitwise __sum16;
+typedef __u32 __bitwise __wsum;
+
+typedef signed long long s64;
+
+
+typedef u32 compat_size_t;
+typedef s32 compat_ssize_t;
+typedef s32 compat_time_t;
+typedef s32 compat_clock_t;
+typedef s32 compat_pid_t;
+typedef u32 __compat_uid_t;
+typedef u32 __compat_gid_t;
+typedef u32 __compat_uid32_t;
+typedef u32 __compat_gid32_t;
+typedef u32 compat_mode_t;
+typedef u32 compat_ino_t;
+typedef u32 compat_dev_t;
+typedef s32 compat_off_t;
+typedef s64 compat_loff_t;
+typedef s16 compat_nlink_t;
+typedef u16 compat_ipc_pid_t;
+typedef s32 compat_daddr_t;
+typedef u32 compat_caddr_t;
+//typedef __kernel_fsid_t compat_fsid_t;
+typedef s32 compat_key_t;
+typedef s32 compat_timer_t;
+
+typedef s32 compat_int_t;
+typedef s32 compat_long_t;
+typedef s64 compat_s64;
+typedef u32 compat_uint_t;
+typedef u32 compat_ulong_t;
+typedef u64 compat_u64;
+
+typedef enum {
+ GFP_KERNEL,
+ GFP_ATOMIC,
+} gfp_t;
+
+//typedef int spinlock_t;
+
+#define ___GFP_WAIT 0x10u
+#define __force
+#define __GFP_WAIT ((__force gfp_t)___GFP_WAIT)
+#define GFP_NOIO (__GFP_WAIT)
+
+#if 0
+typedef struct { volatile int counter; } atomic_t;
+#endif
+
+#if 0
+typedef struct {
+ int counter;
+} usbHostTos_atomic_t;
+#else
+typedef int atomic_t;
+#endif
+
+typedef u32 dma_addr_t;
+
+#define __iomem
+
+//typedef unsigned char bool;
+
+#ifndef NULL
+#define NULL 0
+#endif
+#endif
+typedef int usbHostTos_atomic_t;
+
+#if 0
+#ifndef __BIT_TYPES_DEFINED__
+#define __BIT_TYPES_DEFINED__
+
+typedef __u8 u_int8_t;
+typedef __s8 int8_t;
+typedef __u16 u_int16_t;
+typedef __s16 int16_t;
+typedef __u32 u_int32_t;
+typedef __s32 int32_t;
+
+#endif /* !(__BIT_TYPES_DEFINED__) */
+
+
+typedef __u8 uint8_t;
+typedef __u16 uint16_t;
+typedef __u32 uint32_t;
+#else
+typedef signed char __s8;
+typedef signed char s8;
+typedef unsigned char __u8;
+typedef unsigned char u8;
+
+typedef signed short __s16;
+typedef signed short s16;
+typedef unsigned short __u16;
+typedef unsigned short u16;
+
+
+typedef signed int __s32;
+typedef signed int s32;
+typedef unsigned int __u32;
+typedef unsigned int u32;
+
+typedef signed long long __s64;
+typedef signed long long s64;
+typedef unsigned long long __u64;
+typedef unsigned long long u64;
+
+typedef __s8 int8_t;
+typedef __u8 uint8_t;
+typedef __u16 uint16_t;
+typedef __u8 u_int8_t;
+typedef __u32 u_int32_t;
+#endif
+
+typedef __u64 uint64_t;
+typedef __u64 u_int64_t;
+typedef __s64 int64_t;
+
+typedef int int32_t;
+typedef u32 uint32_t;
+typedef u16 uint16_t;
+typedef u8 uint8_t;
+
+#endif /* _LINUX_TYPES_H */
diff --git a/cp/ps/driver/inc/usbhost/usb.h b/cp/ps/driver/inc/usbhost/usb.h
new file mode 100644
index 0000000..292ee35
--- /dev/null
+++ b/cp/ps/driver/inc/usbhost/usb.h
@@ -0,0 +1,1809 @@
+#ifndef __LINUX_USB_H
+#define __LINUX_USB_H
+
+#if 1
+#include "mod_devicetable.h"
+#endif
+
+#include "ch9.h"
+#include "errno.h"
+#include "list.h"
+#include "spinlock.h"
+#include "oss_irq.h"
+
+#define USB_MAJOR 180
+#define USB_DEVICE_MAJOR 189
+
+#if 1//def __KERNEL__
+#if 1
+//#include <linux/errno.h> /* for -ENODEV */
+//#include <linux/delay.h> /* for mdelay() */
+//#include <linux/interrupt.h> /* for in_interrupt() */
+//#include <linux/list.h> /* for struct list_head */
+//#include <linux/kref.h> /* for struct kref */
+//#include <linux/device.h> /* for struct device */
+//#include <linux/fs.h> /* for struct file_operations */
+//#include <linux/completion.h> /* for struct completion */
+//#include <linux/sched.h> /* for current && schedule_timeout */
+//#include <linux/mutex.h> /* for struct mutex */
+//#include <linux/pm_runtime.h> /* for runtime PM */
+#endif
+#define USB_CORE_DEBUG
+#define USB_HOST_HISR_SUPPORT
+#define USB_HOST_ZERO_COPY
+struct usb_device;
+struct usb_driver;
+
+#if 0
+struct wusb_dev;
+#endif
+
+#ifndef _OS_LINUX
+#define spin_lock_irqsave(_lock, f) LOCK_SAVE(f)
+#define spin_unlock_irqrestore(_lock, f) LOCK_RESTORE(f)
+
+#define DWC_SPINLOCK_IRQSAVE(_lock, f) LOCK_SAVE(f)
+#define DWC_SPINUNLOCK_IRQRESTORE(_lock, f) LOCK_RESTORE(f)
+
+struct kref {
+ usbHostTos_atomic_t refcount;
+};
+#else
+#define DWC_SPINLOCK_IRQSAVE(_lock, f)
+#define DWC_SPINUNLOCK_IRQRESTORE(_lock, f)
+
+#endif
+
+#if 0
+struct list_head {
+ struct list_head *next;
+ struct list_head *prev;
+};
+#endif
+
+#ifndef _OS_LINUX
+#define WARN_ON(x)
+#endif
+
+// const typeof( ((type *)0)->member ) *__mptr = (ptr); \
+const char *__mptr = (char *)(ptr); \
+
+#undef offsetof
+#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
+
+#ifdef USB_CORE_DEBUG
+#define DBG_COREV (0x100)
+#define DBG_USBINF (0x400)
+#define DBG_ANY (0xFF)
+extern uint32_t g_dbg_lvl;
+extern VOID usbHostDebug_Printf(CHAR *fmt,...);
+#define __USBCORE_DEBUG(x...) usbHostDebug_Printf(x)
+#define USB_CORE "USB_Core: "
+#define USBCORE_DEBUGPL(lvl, x...) do{ if ((lvl)&g_dbg_lvl)__USBCORE_DEBUG(USB_CORE x ); }while(0)
+#define USBCORE_ERROR(x...) do{__USBCORE_DEBUG(USB_CORE x ); }while(0)
+#else
+#define USBCORE_DEBUGPL(lvl, x...)
+#define USBCORE_ERROR(x...)
+#endif
+
+#ifndef _OS_LINUX
+#define container_of(ptr, type, member) ({ \
+ const __typeof__( ((type *)0)->member ) *__mptr = (ptr); \
+ (type *)( (char *)__mptr - offsetof(type,member) );})
+#endif
+
+/*-------------------------------------------------------------------------*/
+
+/*
+ * Host-side wrappers for standard USB descriptors ... these are parsed
+ * from the data provided by devices. Parsing turns them from a flat
+ * sequence of descriptors into a hierarchy:
+ *
+ * - devices have one (usually) or more configs;
+ * - configs have one (often) or more interfaces;
+ * - interfaces have one (usually) or more settings;
+ * - each interface setting has zero or (usually) more endpoints.
+ * - a SuperSpeed endpoint has a companion descriptor
+ *
+ * And there might be other descriptors mixed in with those.
+ *
+ * Devices may also have class-specific or vendor-specific descriptors.
+ */
+
+struct ep_device;
+
+/**
+ * struct usb_host_endpoint - host-side endpoint descriptor and queue
+ * @desc: descriptor for this endpoint, wMaxPacketSize in native byteorder
+ * @ss_ep_comp: SuperSpeed companion descriptor for this endpoint
+ * @urb_list: urbs queued to this endpoint; maintained by usbcore
+ * @hcpriv: for use by HCD; typically holds hardware dma queue head (QH)
+ * with one or more transfer descriptors (TDs) per urb
+ * @ep_dev: ep_device for sysfs info
+ * @extra: descriptors following this endpoint in the configuration
+ * @extralen: how many bytes of "extra" are valid
+ * @enabled: URBs may be submitted to this endpoint
+ *
+ * USB requests are always queued to a given endpoint, identified by a
+ * descriptor within an active interface in a given USB configuration.
+ */
+struct usb_host_endpoint {
+ struct usb_endpoint_descriptor desc;
+ struct usb_ss_ep_comp_descriptor ss_ep_comp;
+ struct list_head urb_list;
+ void *hcpriv;
+ struct ep_device *ep_dev; /* For sysfs info */
+
+ unsigned char *extra; /* Extra descriptors */
+ int extralen;
+ int enabled;
+};
+
+/* host-side wrapper for one interface setting's parsed descriptors */
+struct usb_host_interface {
+ struct usb_interface_descriptor desc;
+
+ /* array of desc.bNumEndpoint endpoints associated with this
+ * interface setting. these will be in no particular order.
+ */
+ struct usb_host_endpoint *endpoint;
+
+ char *string; /* iInterface string, if present */
+ unsigned char *extra; /* Extra descriptors */
+ int extralen;
+};
+
+enum usb_interface_condition {
+ USB_INTERFACE_UNBOUND = 0,
+ USB_INTERFACE_BINDING,
+ USB_INTERFACE_BOUND,
+ USB_INTERFACE_UNBINDING,
+};
+
+/**
+ * struct usb_interface - what usb device drivers talk to
+ * @altsetting: array of interface structures, one for each alternate
+ * setting that may be selected. Each one includes a set of
+ * endpoint configurations. They will be in no particular order.
+ * @cur_altsetting: the current altsetting.
+ * @num_altsetting: number of altsettings defined.
+ * @intf_assoc: interface association descriptor
+ * @minor: the minor number assigned to this interface, if this
+ * interface is bound to a driver that uses the USB major number.
+ * If this interface does not use the USB major, this field should
+ * be unused. The driver should set this value in the probe()
+ * function of the driver, after it has been assigned a minor
+ * number from the USB core by calling usb_register_dev().
+ * @condition: binding state of the interface: not bound, binding
+ * (in probe()), bound to a driver, or unbinding (in disconnect())
+ * @sysfs_files_created: sysfs attributes exist
+ * @ep_devs_created: endpoint child pseudo-devices exist
+ * @unregistering: flag set when the interface is being unregistered
+ * @needs_remote_wakeup: flag set when the driver requires remote-wakeup
+ * capability during autosuspend.
+ * @needs_altsetting0: flag set when a set-interface request for altsetting 0
+ * has been deferred.
+ * @needs_binding: flag set when the driver should be re-probed or unbound
+ * following a reset or suspend operation it doesn't support.
+ * @dev: driver model's view of this device
+ * @usb_dev: if an interface is bound to the USB major, this will point
+ * to the sysfs representation for that device.
+ * @pm_usage_cnt: PM usage counter for this interface
+ * @reset_ws: Used for scheduling resets from atomic context.
+ * @reset_running: set to 1 if the interface is currently running a
+ * queued reset so that usb_cancel_queued_reset() doesn't try to
+ * remove from the workqueue when running inside the worker
+ * thread. See __usb_queue_reset_device().
+ * @resetting_device: USB core reset the device, so use alt setting 0 as
+ * current; needs bandwidth alloc after reset.
+ *
+ * USB device drivers attach to interfaces on a physical device. Each
+ * interface encapsulates a single high level function, such as feeding
+ * an audio stream to a speaker or reporting a change in a volume control.
+ * Many USB devices only have one interface. The protocol used to talk to
+ * an interface's endpoints can be defined in a usb "class" specification,
+ * or by a product's vendor. The (default) control endpoint is part of
+ * every interface, but is never listed among the interface's descriptors.
+ *
+ * The driver that is bound to the interface can use standard driver model
+ * calls such as dev_get_drvdata() on the dev member of this structure.
+ *
+ * Each interface may have alternate settings. The initial configuration
+ * of a device sets altsetting 0, but the device driver can change
+ * that setting using usb_set_interface(). Alternate settings are often
+ * used to control the use of periodic endpoints, such as by having
+ * different endpoints use different amounts of reserved USB bandwidth.
+ * All standards-conformant USB devices that use isochronous endpoints
+ * will use them in non-default settings.
+ *
+ * The USB specification says that alternate setting numbers must run from
+ * 0 to one less than the total number of alternate settings. But some
+ * devices manage to mess this up, and the structures aren't necessarily
+ * stored in numerical order anyhow. Use usb_altnum_to_altsetting() to
+ * look up an alternate setting in the altsetting array based on its number.
+ */
+struct usb_interface {
+ /* array of alternate settings for this interface,
+ * stored in no particular order */
+ struct usb_host_interface *altsetting;
+
+ struct usb_host_interface *cur_altsetting; /* the currently
+ * active alternate setting */
+ unsigned num_altsetting; /* number of alternate settings */
+
+ /* If there is an interface association descriptor then it will list
+ * the associated interfaces */
+ struct usb_interface_assoc_descriptor *intf_assoc;
+
+ int minor; /* minor number this interface is
+ * bound to */
+ enum usb_interface_condition condition; /* state of binding */
+ unsigned sysfs_files_created:1; /* the sysfs attributes exist */
+ unsigned ep_devs_created:1; /* endpoint "devices" exist */
+ unsigned unregistering:1; /* unregistration is in progress */
+ unsigned needs_remote_wakeup:1; /* driver requires remote wakeup */
+ unsigned needs_altsetting0:1; /* switch to altsetting 0 is pending */
+ unsigned needs_binding:1; /* needs delayed unbind/rebind */
+ unsigned reset_running:1;
+ unsigned resetting_device:1; /* true: bandwidth alloc after reset */
+#if 0
+ struct device dev; /* interface specific device info */
+ struct device *usb_dev;
+ usbHostTos_atomic_t pm_usage_cnt; /* usage counter for autosuspend */
+ struct work_struct reset_ws; /* for resets in atomic context */
+#endif
+};
+#define to_usb_interface(d) container_of(d, struct usb_interface, dev)
+
+static inline void *usb_get_intfdata(struct usb_interface *intf)
+{
+// return dev_get_drvdata(&intf->dev);
+ return NULL;
+}
+
+static inline void usb_set_intfdata(struct usb_interface *intf, void *data)
+{
+// dev_set_drvdata(&intf->dev, data);
+}
+
+struct usb_interface *usb_get_intf(struct usb_interface *intf);
+void usb_put_intf(struct usb_interface *intf);
+
+/* this maximum is arbitrary */
+#define USB_MAXINTERFACES 32
+#define USB_MAXIADS (USB_MAXINTERFACES/2)
+
+/**
+ * struct usb_interface_cache - long-term representation of a device interface
+ * @num_altsetting: number of altsettings defined.
+ * @ref: reference counter.
+ * @altsetting: variable-length array of interface structures, one for
+ * each alternate setting that may be selected. Each one includes a
+ * set of endpoint configurations. They will be in no particular order.
+ *
+ * These structures persist for the lifetime of a usb_device, unlike
+ * struct usb_interface (which persists only as long as its configuration
+ * is installed). The altsetting arrays can be accessed through these
+ * structures at any time, permitting comparison of configurations and
+ * providing support for the /proc/bus/usb/devices pseudo-file.
+ */
+struct usb_interface_cache {
+ unsigned num_altsetting; /* number of alternate settings */
+ int ref; /* reference counter */
+
+ /* variable-length array of alternate settings for this interface,
+ * stored in no particular order */
+ struct usb_host_interface altsetting[0];
+};
+#define ref_to_usb_interface_cache(r) \
+ container_of(r, struct usb_interface_cache, ref)
+#define altsetting_to_usb_interface_cache(a) \
+ container_of(a, struct usb_interface_cache, altsetting[0])
+
+/**
+ * struct usb_host_config - representation of a device's configuration
+ * @desc: the device's configuration descriptor.
+ * @string: pointer to the cached version of the iConfiguration string, if
+ * present for this configuration.
+ * @intf_assoc: list of any interface association descriptors in this config
+ * @interface: array of pointers to usb_interface structures, one for each
+ * interface in the configuration. The number of interfaces is stored
+ * in desc.bNumInterfaces. These pointers are valid only while the
+ * the configuration is active.
+ * @intf_cache: array of pointers to usb_interface_cache structures, one
+ * for each interface in the configuration. These structures exist
+ * for the entire life of the device.
+ * @extra: pointer to buffer containing all extra descriptors associated
+ * with this configuration (those preceding the first interface
+ * descriptor).
+ * @extralen: length of the extra descriptors buffer.
+ *
+ * USB devices may have multiple configurations, but only one can be active
+ * at any time. Each encapsulates a different operational environment;
+ * for example, a dual-speed device would have separate configurations for
+ * full-speed and high-speed operation. The number of configurations
+ * available is stored in the device descriptor as bNumConfigurations.
+ *
+ * A configuration can contain multiple interfaces. Each corresponds to
+ * a different function of the USB device, and all are available whenever
+ * the configuration is active. The USB standard says that interfaces
+ * are supposed to be numbered from 0 to desc.bNumInterfaces-1, but a lot
+ * of devices get this wrong. In addition, the interface array is not
+ * guaranteed to be sorted in numerical order. Use usb_ifnum_to_if() to
+ * look up an interface entry based on its number.
+ *
+ * Device drivers should not attempt to activate configurations. The choice
+ * of which configuration to install is a policy decision based on such
+ * considerations as available power, functionality provided, and the user's
+ * desires (expressed through userspace tools). However, drivers can call
+ * usb_reset_configuration() to reinitialize the current configuration and
+ * all its interfaces.
+ */
+struct usb_host_config {
+ struct usb_config_descriptor desc;
+
+ char *string; /* iConfiguration string, if present */
+
+ /* List of any Interface Association Descriptors in this
+ * configuration. */
+ struct usb_interface_assoc_descriptor *intf_assoc[USB_MAXIADS];
+
+ /* the interfaces associated with this configuration,
+ * stored in no particular order */
+ struct usb_interface *interface[USB_MAXINTERFACES];
+
+ /* Interface information available even when this is not the
+ * active configuration */
+ struct usb_interface_cache *intf_cache[USB_MAXINTERFACES];
+
+ unsigned char *extra; /* Extra descriptors */
+ int extralen;
+};
+
+/* USB2.0 and USB3.0 device BOS descriptor set */
+struct usb_host_bos {
+ struct usb_bos_descriptor *desc;
+
+ /* wireless cap descriptor is handled by wusb */
+ struct usb_ext_cap_descriptor *ext_cap;
+ struct usb_ss_cap_descriptor *ss_cap;
+ struct usb_ss_container_id_descriptor *ss_id;
+};
+
+int __usb_get_extra_descriptor(char *buffer, unsigned size,
+ unsigned char type, void **ptr);
+#define usb_get_extra_descriptor(ifpoint, type, ptr) \
+ __usb_get_extra_descriptor((ifpoint)->extra, \
+ (ifpoint)->extralen, \
+ type, (void **)ptr)
+
+/* ----------------------------------------------------------------------- */
+
+/* USB device number allocation bitmap */
+struct usb_devmap {
+ unsigned long devicemap[128 / (8*sizeof(unsigned long))];
+};
+
+/*
+ * Allocated per bus (tree of devices) we have:
+ */
+struct usb_bus {
+ struct device *controller; /* host/master side hardware */
+ int busnum; /* Bus number (in order of reg) */
+ const char *bus_name; /* stable id (PCI slot_name etc) */
+ u8 uses_dma; /* Does the host controller use DMA? */
+ u8 uses_pio_for_control; /*
+ * Does the host controller use PIO
+ * for control transfers?
+ */
+ u8 otg_port; /* 0, or number of OTG/HNP port */
+ unsigned is_b_host:1; /* true during some HNP roleswitches */
+ unsigned b_hnp_enable:1; /* OTG: did A-Host enable HNP? */
+ unsigned sg_tablesize; /* 0 or largest number of sg list entries */
+
+ int devnum_next; /* Next open device number in
+ * round-robin allocation */
+
+ struct usb_devmap devmap; /* device address allocation map */
+ struct usb_device *root_hub; /* Root hub */
+ struct usb_bus *hs_companion; /* Companion EHCI bus, if any */
+ struct list_head bus_list; /* list of busses */
+
+ int bandwidth_allocated; /* on this bus: how much of the time
+ * reserved for periodic (intr/iso)
+ * requests is used, on average?
+ * Units: microseconds/frame.
+ * Limits: Full/low speed reserve 90%,
+ * while high speed reserves 80%.
+ */
+ int bandwidth_int_reqs; /* number of Interrupt requests */
+ int bandwidth_isoc_reqs; /* number of Isoc. requests */
+
+#ifdef CONFIG_USB_DEVICEFS
+ struct dentry *usbfs_dentry; /* usbfs dentry entry for the bus */
+#endif
+
+#if defined(CONFIG_USB_MON) || defined(CONFIG_USB_MON_MODULE)
+ struct mon_bus *mon_bus; /* non-null when associated */
+ int monitored; /* non-zero when monitored */
+#endif
+};
+
+/* ----------------------------------------------------------------------- */
+
+/* This is arbitrary.
+ * From USB 2.0 spec Table 11-13, offset 7, a hub can
+ * have up to 255 ports. The most yet reported is 10.
+ *
+ * Current Wireless USB host hardware (Intel i1480 for example) allows
+ * up to 22 devices to connect. Upcoming hardware might raise that
+ * limit. Because the arrays need to add a bit for hub status data, we
+ * do 31, so plus one evens out to four bytes.
+ */
+#define USB_MAXCHILDREN (31)
+
+struct usb_tt;
+
+enum usb_device_removable {
+ USB_DEVICE_REMOVABLE_UNKNOWN = 0,
+ USB_DEVICE_REMOVABLE,
+ USB_DEVICE_FIXED,
+};
+
+/**
+ * struct usb_device - kernel's representation of a USB device
+ * @devnum: device number; address on a USB bus
+ * @devpath: device ID string for use in messages (e.g., /port/...)
+ * @route: tree topology hex string for use with xHCI
+ * @state: device state: configured, not attached, etc.
+ * @speed: device speed: high/full/low (or error)
+ * @tt: Transaction Translator info; used with low/full speed dev, highspeed hub
+ * @ttport: device port on that tt hub
+ * @toggle: one bit for each endpoint, with ([0] = IN, [1] = OUT) endpoints
+ * @parent: our hub, unless we're the root
+ * @bus: bus we're part of
+ * @ep0: endpoint 0 data (default control pipe)
+ * @dev: generic device interface
+ * @descriptor: USB device descriptor
+ * @bos: USB device BOS descriptor set
+ * @config: all of the device's configs
+ * @actconfig: the active configuration
+ * @ep_in: array of IN endpoints
+ * @ep_out: array of OUT endpoints
+ * @rawdescriptors: raw descriptors for each config
+ * @bus_mA: Current available from the bus
+ * @portnum: parent port number (origin 1)
+ * @level: number of USB hub ancestors
+ * @can_submit: URBs may be submitted
+ * @persist_enabled: USB_PERSIST enabled for this device
+ * @have_langid: whether string_langid is valid
+ * @authorized: policy has said we can use it;
+ * (user space) policy determines if we authorize this device to be
+ * used or not. By default, wired USB devices are authorized.
+ * WUSB devices are not, until we authorize them from user space.
+ * FIXME -- complete doc
+ * @authenticated: Crypto authentication passed
+ * @wusb: device is Wireless USB
+ * @lpm_capable: device supports LPM
+ * @usb2_hw_lpm_capable: device can perform USB2 hardware LPM
+ * @usb2_hw_lpm_enabled: USB2 hardware LPM enabled
+ * @string_langid: language ID for strings
+ * @product: iProduct string, if present (static)
+ * @manufacturer: iManufacturer string, if present (static)
+ * @serial: iSerialNumber string, if present (static)
+ * @filelist: usbfs files that are open to this device
+ * @usb_classdev: USB class device that was created for usbfs device
+ * access from userspace
+ * @usbfs_dentry: usbfs dentry entry for the device
+ * @maxchild: number of ports if hub
+ * @children: child devices - USB devices that are attached to this hub
+ * @quirks: quirks of the whole device
+ * @urbnum: number of URBs submitted for the whole device
+ * @active_duration: total time device is not suspended
+ * @connect_time: time device was first connected
+ * @do_remote_wakeup: remote wakeup should be enabled
+ * @reset_resume: needs reset instead of resume
+ * @wusb_dev: if this is a Wireless USB device, link to the WUSB
+ * specific data for the device.
+ * @slot_id: Slot ID assigned by xHCI
+ * @removable: Device can be physically removed from this port
+ *
+ * Notes:
+ * Usbcore drivers should not set usbdev->state directly. Instead use
+ * usb_set_device_state().
+ */
+struct usb_device {
+ int devnum;
+ char devpath[16];
+ u32 route;
+ enum usb_device_state state;
+ enum usb_device_speed speed;
+
+ struct usb_tt *tt;
+ int ttport;
+
+ unsigned int toggle[2];
+
+ struct usb_device *parent;
+ struct usb_bus *bus;
+ struct usb_host_endpoint ep0;
+
+// struct device dev;
+
+ struct usb_device_descriptor descriptor;
+ struct usb_host_bos *bos;
+ struct usb_host_config *config;
+
+ struct usb_host_config *actconfig;
+ struct usb_host_endpoint *ep_in[16];
+ struct usb_host_endpoint *ep_out[16];
+
+ char **rawdescriptors;
+
+ unsigned short bus_mA;
+ u8 portnum;
+ u8 level;
+
+ unsigned can_submit:1;
+ unsigned persist_enabled:1;
+ unsigned have_langid:1;
+ unsigned authorized:1;
+ unsigned authenticated:1;
+ unsigned wusb:1;
+ unsigned lpm_capable:1;
+ unsigned usb2_hw_lpm_capable:1;
+ unsigned usb2_hw_lpm_enabled:1;
+ int string_langid;
+
+ /* static strings from the device */
+ char *product;
+ char *manufacturer;
+ char *serial;
+
+ struct list_head filelist;
+#ifdef CONFIG_USB_DEVICE_CLASS
+// struct device *usb_classdev;
+#endif
+#ifdef CONFIG_USB_DEVICEFS
+ struct dentry *usbfs_dentry;
+#endif
+
+ int maxchild;
+ struct usb_device **children;
+
+ u32 quirks;
+ usbHostTos_atomic_t urbnum;
+
+ unsigned long active_duration;
+
+#ifdef USBHOSTTOS_CONFIG_PM
+ unsigned long connect_time;
+
+ unsigned do_remote_wakeup:1;
+ unsigned reset_resume:1;
+#endif
+ struct wusb_dev *wusb_dev;
+ int slot_id;
+ ZOSS_SEMAPHORE_ID urb_sem;
+ enum usb_device_removable removable;
+};
+#define to_usb_device(d) container_of(d, struct usb_device, dev)
+
+static inline struct usb_device *interface_to_usbdev(struct usb_interface *intf)
+{
+// return to_usb_device(intf->dev.parent);
+ return NULL;
+}
+
+extern struct usb_device *usb_get_dev(struct usb_device *dev);
+extern void usb_put_dev(struct usb_device *dev);
+
+/* USB device locking */
+#if 0
+#define usb_lock_device(udev) device_lock(&(udev)->dev)
+#define usb_unlock_device(udev) device_unlock(&(udev)->dev)
+#define usb_trylock_device(udev) device_trylock(&(udev)->dev)
+#else
+static inline void device_unlock()
+{
+// mutex_unlock(&dev->mutex);
+}
+static inline void device_lock()
+{
+// mutex_lock(&dev->mutex);
+}
+
+static inline int device_trylock()
+{
+ return 0;
+}
+
+#define usb_lock_device(udev) device_lock()
+#define usb_unlock_device(udev) device_unlock()
+#define usb_trylock_device(udev) device_trylock()
+#endif
+
+#if 0
+extern int usb_lock_device_for_reset(struct usb_device *udev,
+ const struct usb_interface *iface);
+#endif
+
+/* USB port reset for device reinitialization */
+extern int usb_reset_device(struct usb_device *dev);
+extern void usb_queue_reset_device(struct usb_interface *dev);
+
+
+/* USB autosuspend and autoresume */
+#ifdef CONFIG_USB_SUSPEND
+extern void usb_enable_autosuspend(struct usb_device *udev);
+extern void usb_disable_autosuspend(struct usb_device *udev);
+
+extern int usb_autopm_get_interface(struct usb_interface *intf);
+extern void usb_autopm_put_interface(struct usb_interface *intf);
+extern int usb_autopm_get_interface_async(struct usb_interface *intf);
+extern void usb_autopm_put_interface_async(struct usb_interface *intf);
+extern void usb_autopm_get_interface_no_resume(struct usb_interface *intf);
+extern void usb_autopm_put_interface_no_suspend(struct usb_interface *intf);
+
+static inline void usb_mark_last_busy(struct usb_device *udev)
+{
+ pm_runtime_mark_last_busy(&udev->dev);
+}
+
+#else
+
+static inline int usb_enable_autosuspend(struct usb_device *udev)
+{ return 0; }
+static inline int usb_disable_autosuspend(struct usb_device *udev)
+{ return 0; }
+
+static inline int usb_autopm_get_interface(struct usb_interface *intf)
+{ return 0; }
+static inline int usb_autopm_get_interface_async(struct usb_interface *intf)
+{ return 0; }
+
+static inline void usb_autopm_put_interface(struct usb_interface *intf)
+{ }
+static inline void usb_autopm_put_interface_async(struct usb_interface *intf)
+{ }
+static inline void usb_autopm_get_interface_no_resume(
+ struct usb_interface *intf)
+{ }
+static inline void usb_autopm_put_interface_no_suspend(
+ struct usb_interface *intf)
+{ }
+static inline void usb_mark_last_busy(struct usb_device *udev)
+{ }
+#endif
+
+/*-------------------------------------------------------------------------*/
+
+/* for drivers using iso endpoints */
+extern int usb_get_current_frame_number(struct usb_device *usb_dev);
+
+/* Sets up a group of bulk endpoints to support multiple stream IDs. */
+extern int usb_alloc_streams(struct usb_interface *interface,
+ struct usb_host_endpoint **eps, unsigned int num_eps,
+ unsigned int num_streams, gfp_t mem_flags);
+
+/* Reverts a group of bulk endpoints back to not using stream IDs. */
+extern void usb_free_streams(struct usb_interface *interface,
+ struct usb_host_endpoint **eps, unsigned int num_eps,
+ gfp_t mem_flags);
+
+/* used these for multi-interface device registration */
+extern int usb_driver_claim_interface(struct usb_driver *driver,
+ struct usb_interface *iface, void *priv);
+
+/**
+ * usb_interface_claimed - returns true iff an interface is claimed
+ * @iface: the interface being checked
+ *
+ * Returns true (nonzero) iff the interface is claimed, else false (zero).
+ * Callers must own the driver model's usb bus readlock. So driver
+ * probe() entries don't need extra locking, but other call contexts
+ * may need to explicitly claim that lock.
+ *
+ */
+static inline int usb_interface_claimed(struct usb_interface *iface)
+{
+// return (iface->dev.driver != NULL);
+ return 0;
+}
+
+extern void usb_driver_release_interface(struct usb_driver *driver,
+ struct usb_interface *iface);
+const struct usb_device_id *usb_match_id(struct usb_interface *interface,
+ const struct usb_device_id *id);
+extern int usb_match_one_id(struct usb_interface *interface,
+ const struct usb_device_id *id);
+
+extern struct usb_interface *usb_find_interface(struct usb_driver *drv,
+ int minor);
+extern struct usb_interface *usb_ifnum_to_if(const struct usb_device *dev,
+ unsigned ifnum);
+extern struct usb_host_interface *usb_altnum_to_altsetting(
+ const struct usb_interface *intf, unsigned int altnum);
+extern struct usb_host_interface *usb_find_alt_setting(
+ struct usb_host_config *config,
+ unsigned int iface_num,
+ unsigned int alt_num);
+
+
+/**
+ * usb_make_path - returns stable device path in the usb tree
+ * @dev: the device whose path is being constructed
+ * @buf: where to put the string
+ * @size: how big is "buf"?
+ *
+ * Returns length of the string (> 0) or negative if size was too small.
+ *
+ * This identifier is intended to be "stable", reflecting physical paths in
+ * hardware such as physical bus addresses for host controllers or ports on
+ * USB hubs. That makes it stay the same until systems are physically
+ * reconfigured, by re-cabling a tree of USB devices or by moving USB host
+ * controllers. Adding and removing devices, including virtual root hubs
+ * in host controller driver modules, does not change these path identifiers;
+ * neither does rebooting or re-enumerating. These are more useful identifiers
+ * than changeable ("unstable") ones like bus numbers or device addresses.
+ *
+ * With a partial exception for devices connected to USB 2.0 root hubs, these
+ * identifiers are also predictable. So long as the device tree isn't changed,
+ * plugging any USB device into a given hub port always gives it the same path.
+ * Because of the use of "companion" controllers, devices connected to ports on
+ * USB 2.0 root hubs (EHCI host controllers) will get one path ID if they are
+ * high speed, and a different one if they are full or low speed.
+ */
+static inline int usb_make_path(struct usb_device *dev, char *buf, size_t size)
+{
+ int actual;
+ actual = snprintf(buf, size, "usb-%s-%s", dev->bus->bus_name,
+ dev->devpath);
+ return (actual >= (int)size) ? -1 : actual;
+}
+
+/*-------------------------------------------------------------------------*/
+
+#define USB_DEVICE_ID_MATCH_DEVICE \
+ (USB_DEVICE_ID_MATCH_VENDOR | USB_DEVICE_ID_MATCH_PRODUCT)
+#define USB_DEVICE_ID_MATCH_DEV_RANGE \
+ (USB_DEVICE_ID_MATCH_DEV_LO | USB_DEVICE_ID_MATCH_DEV_HI)
+#define USB_DEVICE_ID_MATCH_DEVICE_AND_VERSION \
+ (USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_DEV_RANGE)
+#define USB_DEVICE_ID_MATCH_DEV_INFO \
+ (USB_DEVICE_ID_MATCH_DEV_CLASS | \
+ USB_DEVICE_ID_MATCH_DEV_SUBCLASS | \
+ USB_DEVICE_ID_MATCH_DEV_PROTOCOL)
+#define USB_DEVICE_ID_MATCH_INT_INFO \
+ (USB_DEVICE_ID_MATCH_INT_CLASS | \
+ USB_DEVICE_ID_MATCH_INT_SUBCLASS | \
+ USB_DEVICE_ID_MATCH_INT_PROTOCOL)
+
+/**
+ * USB_DEVICE - macro used to describe a specific usb device
+ * @vend: the 16 bit USB Vendor ID
+ * @prod: the 16 bit USB Product ID
+ *
+ * This macro is used to create a struct usb_device_id that matches a
+ * specific device.
+ */
+#define USB_DEVICE(vend, prod) \
+ .match_flags = USB_DEVICE_ID_MATCH_DEVICE, \
+ .idVendor = (vend), \
+ .idProduct = (prod)
+/**
+ * USB_DEVICE_VER - describe a specific usb device with a version range
+ * @vend: the 16 bit USB Vendor ID
+ * @prod: the 16 bit USB Product ID
+ * @lo: the bcdDevice_lo value
+ * @hi: the bcdDevice_hi value
+ *
+ * This macro is used to create a struct usb_device_id that matches a
+ * specific device, with a version range.
+ */
+#define USB_DEVICE_VER(vend, prod, lo, hi) \
+ .match_flags = USB_DEVICE_ID_MATCH_DEVICE_AND_VERSION, \
+ .idVendor = (vend), \
+ .idProduct = (prod), \
+ .bcdDevice_lo = (lo), \
+ .bcdDevice_hi = (hi)
+
+/**
+ * USB_DEVICE_INTERFACE_PROTOCOL - describe a usb device with a specific interface protocol
+ * @vend: the 16 bit USB Vendor ID
+ * @prod: the 16 bit USB Product ID
+ * @pr: bInterfaceProtocol value
+ *
+ * This macro is used to create a struct usb_device_id that matches a
+ * specific interface protocol of devices.
+ */
+#define USB_DEVICE_INTERFACE_PROTOCOL(vend, prod, pr) \
+ .match_flags = USB_DEVICE_ID_MATCH_DEVICE | \
+ USB_DEVICE_ID_MATCH_INT_PROTOCOL, \
+ .idVendor = (vend), \
+ .idProduct = (prod), \
+ .bInterfaceProtocol = (pr)
+
+/**
+ * USB_DEVICE_INFO - macro used to describe a class of usb devices
+ * @cl: bDeviceClass value
+ * @sc: bDeviceSubClass value
+ * @pr: bDeviceProtocol value
+ *
+ * This macro is used to create a struct usb_device_id that matches a
+ * specific class of devices.
+ */
+#define USB_DEVICE_INFO(cl, sc, pr) \
+ .match_flags = USB_DEVICE_ID_MATCH_DEV_INFO, \
+ .bDeviceClass = (cl), \
+ .bDeviceSubClass = (sc), \
+ .bDeviceProtocol = (pr)
+
+/**
+ * USB_INTERFACE_INFO - macro used to describe a class of usb interfaces
+ * @cl: bInterfaceClass value
+ * @sc: bInterfaceSubClass value
+ * @pr: bInterfaceProtocol value
+ *
+ * This macro is used to create a struct usb_device_id that matches a
+ * specific class of interfaces.
+ */
+#define USB_INTERFACE_INFO(cl, sc, pr) \
+ .match_flags = USB_DEVICE_ID_MATCH_INT_INFO, \
+ .bInterfaceClass = (cl), \
+ .bInterfaceSubClass = (sc), \
+ .bInterfaceProtocol = (pr)
+
+/**
+ * USB_DEVICE_AND_INTERFACE_INFO - describe a specific usb device with a class of usb interfaces
+ * @vend: the 16 bit USB Vendor ID
+ * @prod: the 16 bit USB Product ID
+ * @cl: bInterfaceClass value
+ * @sc: bInterfaceSubClass value
+ * @pr: bInterfaceProtocol value
+ *
+ * This macro is used to create a struct usb_device_id that matches a
+ * specific device with a specific class of interfaces.
+ *
+ * This is especially useful when explicitly matching devices that have
+ * vendor specific bDeviceClass values, but standards-compliant interfaces.
+ */
+#define USB_DEVICE_AND_INTERFACE_INFO(vend, prod, cl, sc, pr) \
+ .match_flags = USB_DEVICE_ID_MATCH_INT_INFO \
+ | USB_DEVICE_ID_MATCH_DEVICE, \
+ .idVendor = (vend), \
+ .idProduct = (prod), \
+ .bInterfaceClass = (cl), \
+ .bInterfaceSubClass = (sc), \
+ .bInterfaceProtocol = (pr)
+
+/* ----------------------------------------------------------------------- */
+
+/* Stuff for dynamic usb ids */
+struct usb_dynids {
+ spinlock_t lock;
+ struct list_head list;
+};
+
+struct usb_dynid {
+ struct list_head node;
+ struct usb_device_id id;
+};
+
+#if 0
+extern ssize_t usb_store_new_id(struct usb_dynids *dynids,
+ struct device_driver *driver,
+ const char *buf, size_t count);
+#endif
+/**
+ * struct usbdrv_wrap - wrapper for driver-model structure
+ * @driver: The driver-model core driver structure.
+ * @for_devices: Non-zero for device drivers, 0 for interface drivers.
+ */
+#if 0
+struct usbdrv_wrap {
+ struct device_driver driver;
+ int for_devices;
+};
+#endif
+
+/**
+ * struct usb_driver - identifies USB interface driver to usbcore
+ * @name: The driver name should be unique among USB drivers,
+ * and should normally be the same as the module name.
+ * @probe: Called to see if the driver is willing to manage a particular
+ * interface on a device. If it is, probe returns zero and uses
+ * usb_set_intfdata() to associate driver-specific data with the
+ * interface. It may also use usb_set_interface() to specify the
+ * appropriate altsetting. If unwilling to manage the interface,
+ * return -ENODEV, if genuine IO errors occurred, an appropriate
+ * negative errno value.
+ * @disconnect: Called when the interface is no longer accessible, usually
+ * because its device has been (or is being) disconnected or the
+ * driver module is being unloaded.
+ * @unlocked_ioctl: Used for drivers that want to talk to userspace through
+ * the "usbfs" filesystem. This lets devices provide ways to
+ * expose information to user space regardless of where they
+ * do (or don't) show up otherwise in the filesystem.
+ * @suspend: Called when the device is going to be suspended by the system.
+ * @resume: Called when the device is being resumed by the system.
+ * @reset_resume: Called when the suspended device has been reset instead
+ * of being resumed.
+ * @pre_reset: Called by usb_reset_device() when the device is about to be
+ * reset. This routine must not return until the driver has no active
+ * URBs for the device, and no more URBs may be submitted until the
+ * post_reset method is called.
+ * @post_reset: Called by usb_reset_device() after the device
+ * has been reset
+ * @id_table: USB drivers use ID table to support hotplugging.
+ * Export this with MODULE_DEVICE_TABLE(usb,...). This must be set
+ * or your driver's probe function will never get called.
+ * @dynids: used internally to hold the list of dynamically added device
+ * ids for this driver.
+ * @drvwrap: Driver-model core structure wrapper.
+ * @no_dynamic_id: if set to 1, the USB core will not allow dynamic ids to be
+ * added to this driver by preventing the sysfs file from being created.
+ * @supports_autosuspend: if set to 0, the USB core will not allow autosuspend
+ * for interfaces bound to this driver.
+ * @soft_unbind: if set to 1, the USB core will not kill URBs and disable
+ * endpoints before calling the driver's disconnect method.
+ *
+ * USB interface drivers must provide a name, probe() and disconnect()
+ * methods, and an id_table. Other driver fields are optional.
+ *
+ * The id_table is used in hotplugging. It holds a set of descriptors,
+ * and specialized data may be associated with each entry. That table
+ * is used by both user and kernel mode hotplugging support.
+ *
+ * The probe() and disconnect() methods are called in a context where
+ * they can sleep, but they should avoid abusing the privilege. Most
+ * work to connect to a device should be done when the device is opened,
+ * and undone at the last close. The disconnect code needs to address
+ * concurrency issues with respect to open() and close() methods, as
+ * well as forcing all pending I/O requests to complete (by unlinking
+ * them as necessary, and blocking until the unlinks complete).
+ */
+struct usb_driver {
+ const char *name;
+
+ int (*probe) (struct usb_interface *intf,
+ const struct usb_device_id *id);
+
+ void (*disconnect) (struct usb_interface *intf);
+
+ int (*unlocked_ioctl) (struct usb_interface *intf, unsigned int code,
+ void *buf);
+
+// int (*suspend) (struct usb_interface *intf, pm_message_t message);
+ int (*suspend) (struct usb_interface *intf);
+ int (*resume) (struct usb_interface *intf);
+ int (*reset_resume)(struct usb_interface *intf);
+
+ int (*pre_reset)(struct usb_interface *intf);
+ int (*post_reset)(struct usb_interface *intf);
+
+ const struct usb_device_id *id_table;
+
+ struct usb_dynids dynids;
+// struct usbdrv_wrap drvwrap;
+ unsigned int no_dynamic_id:1;
+ unsigned int supports_autosuspend:1;
+ unsigned int soft_unbind:1;
+};
+#define to_usb_driver(d) container_of(d, struct usb_driver, drvwrap.driver)
+
+/**
+ * struct usb_device_driver - identifies USB device driver to usbcore
+ * @name: The driver name should be unique among USB drivers,
+ * and should normally be the same as the module name.
+ * @probe: Called to see if the driver is willing to manage a particular
+ * device. If it is, probe returns zero and uses dev_set_drvdata()
+ * to associate driver-specific data with the device. If unwilling
+ * to manage the device, return a negative errno value.
+ * @disconnect: Called when the device is no longer accessible, usually
+ * because it has been (or is being) disconnected or the driver's
+ * module is being unloaded.
+ * @suspend: Called when the device is going to be suspended by the system.
+ * @resume: Called when the device is being resumed by the system.
+ * @drvwrap: Driver-model core structure wrapper.
+ * @supports_autosuspend: if set to 0, the USB core will not allow autosuspend
+ * for devices bound to this driver.
+ *
+ * USB drivers must provide all the fields listed above except drvwrap.
+ */
+struct usb_device_driver {
+ const char *name;
+
+ int (*probe) (struct usb_device *udev);
+ void (*disconnect) (struct usb_device *udev);
+#if 0
+ int (*suspend) (struct usb_device *udev, pm_message_t message);
+ int (*resume) (struct usb_device *udev, pm_message_t message);
+#else
+ int (*suspend) (struct usb_device *udev);
+ int (*resume) (struct usb_device *udev);
+#endif
+// struct usbdrv_wrap drvwrap;
+ unsigned int supports_autosuspend:1;
+};
+#define to_usb_device_driver(d) container_of(d, struct usb_device_driver, \
+ drvwrap.driver)
+
+extern struct bus_type usb_bus_type;
+
+/**
+ * struct usb_class_driver - identifies a USB driver that wants to use the USB major number
+ * @name: the usb class device name for this driver. Will show up in sysfs.
+ * @devnode: Callback to provide a naming hint for a possible
+ * device node to create.
+ * @fops: pointer to the struct file_operations of this driver.
+ * @minor_base: the start of the minor range for this driver.
+ *
+ * This structure is used for the usb_register_dev() and
+ * usb_unregister_dev() functions, to consolidate a number of the
+ * parameters used for them.
+ */
+#if 0
+struct usb_class_driver {
+ char *name;
+ char *(*devnode)(struct device *dev, umode_t *mode);
+ const struct file_operations *fops;
+ int minor_base;
+};
+#endif
+
+/*
+ * use these in module_init()/module_exit()
+ * and don't forget MODULE_DEVICE_TABLE(usb, ...)
+ */
+extern int usb_register_driver(struct usb_driver *, struct module *,
+ const char *);
+
+/* use a define to avoid include chaining to get THIS_MODULE & friends */
+#define usb_register(driver) \
+ usb_register_driver(driver, THIS_MODULE, KBUILD_MODNAME)
+
+extern void usb_deregister(struct usb_driver *);
+
+/**
+ * module_usb_driver() - Helper macro for registering a USB driver
+ * @__usb_driver: usb_driver struct
+ *
+ * Helper macro for USB drivers which do not do anything special in module
+ * init/exit. This eliminates a lot of boilerplate. Each module may only
+ * use this macro once, and calling it replaces module_init() and module_exit()
+ */
+#define module_usb_driver(__usb_driver) \
+ module_driver(__usb_driver, usb_register, \
+ usb_deregister)
+
+extern int usb_register_device_driver(struct usb_device_driver *,
+ struct module *);
+extern void usb_deregister_device_driver(struct usb_device_driver *);
+
+#if 0
+extern int usb_register_dev(struct usb_interface *intf,
+ struct usb_class_driver *class_driver);
+extern void usb_deregister_dev(struct usb_interface *intf,
+ struct usb_class_driver *class_driver);
+#endif
+
+extern int usb_disabled(void);
+
+/* ----------------------------------------------------------------------- */
+
+/*
+ * URB support, for asynchronous request completions
+ */
+
+/*
+ * urb->transfer_flags:
+ *
+ * Note: URB_DIR_IN/OUT is automatically set in usb_submit_urb().
+ */
+#define URB_SHORT_NOT_OK 0x0001 /* report short reads as errors */
+#define URB_ISO_ASAP 0x0002 /* iso-only, urb->start_frame
+ * ignored */
+#define URB_NO_TRANSFER_DMA_MAP 0x0004 /* urb->transfer_dma valid on submit */
+#define URB_NO_FSBR 0x0020 /* UHCI-specific */
+#define URB_ZERO_PACKET 0x0040 /* Finish bulk OUT with short packet */
+#define URB_NO_INTERRUPT 0x0080 /* HINT: no non-error interrupt
+ * needed */
+#define URB_FREE_BUFFER 0x0100 /* Free transfer buffer with the URB */
+
+/* The following flags are used internally by usbcore and HCDs */
+#define URB_DIR_IN 0x0200 /* Transfer from device to host */
+#define URB_DIR_OUT 0
+#define URB_DIR_MASK URB_DIR_IN
+
+#define URB_DMA_MAP_SINGLE 0x00010000 /* Non-scatter-gather mapping */
+#define URB_DMA_MAP_PAGE 0x00020000 /* HCD-unsupported S-G */
+#define URB_DMA_MAP_SG 0x00040000 /* HCD-supported S-G */
+#define URB_MAP_LOCAL 0x00080000 /* HCD-local-memory mapping */
+#define URB_SETUP_MAP_SINGLE 0x00100000 /* Setup packet DMA mapped */
+#define URB_SETUP_MAP_LOCAL 0x00200000 /* HCD-local setup packet */
+#define URB_DMA_SG_COMBINED 0x00400000 /* S-G entries were combined */
+#define URB_ALIGNED_TEMP_BUFFER 0x00800000 /* Temp buffer was alloc'd */
+
+struct usb_iso_packet_descriptor {
+ unsigned int offset;
+ unsigned int length; /* expected length */
+ unsigned int actual_length;
+ int status;
+};
+
+struct urb;
+
+#ifndef _OS_LINUX
+struct __wait_queue_head {
+ spinlock_t lock;
+ struct list_head task_list;
+};
+typedef struct __wait_queue_head wait_queue_head_t;
+#endif
+
+struct usb_anchor {
+ struct list_head urb_list;
+ wait_queue_head_t wait;
+ spinlock_t lock;
+ unsigned int poisoned:1;
+};
+
+static inline void init_usb_anchor(struct usb_anchor *anchor)
+{
+ INIT_LIST_HEAD(&anchor->urb_list);
+ usbHostTos_init_waitqueue_head(&anchor->wait);
+ spin_lock_init(&anchor->lock);
+}
+
+typedef void (*usb_complete_t)(struct urb *);
+
+/**
+ * struct urb - USB Request Block
+ * @urb_list: For use by current owner of the URB.
+ * @anchor_list: membership in the list of an anchor
+ * @anchor: to anchor URBs to a common mooring
+ * @ep: Points to the endpoint's data structure. Will eventually
+ * replace @pipe.
+ * @pipe: Holds endpoint number, direction, type, and more.
+ * Create these values with the eight macros available;
+ * usb_{snd,rcv}TYPEpipe(dev,endpoint), where the TYPE is "ctrl"
+ * (control), "bulk", "int" (interrupt), or "iso" (isochronous).
+ * For example usb_sndbulkpipe() or usb_rcvintpipe(). Endpoint
+ * numbers range from zero to fifteen. Note that "in" endpoint two
+ * is a different endpoint (and pipe) from "out" endpoint two.
+ * The current configuration controls the existence, type, and
+ * maximum packet size of any given endpoint.
+ * @stream_id: the endpoint's stream ID for bulk streams
+ * @dev: Identifies the USB device to perform the request.
+ * @status: This is read in non-iso completion functions to get the
+ * status of the particular request. ISO requests only use it
+ * to tell whether the URB was unlinked; detailed status for
+ * each frame is in the fields of the iso_frame-desc.
+ * @transfer_flags: A variety of flags may be used to affect how URB
+ * submission, unlinking, or operation are handled. Different
+ * kinds of URB can use different flags.
+ * @transfer_buffer: This identifies the buffer to (or from) which the I/O
+ * request will be performed unless URB_NO_TRANSFER_DMA_MAP is set
+ * (however, do not leave garbage in transfer_buffer even then).
+ * This buffer must be suitable for DMA; allocate it with
+ * zOss_Malloc() or equivalent. For transfers to "in" endpoints, contents
+ * of this buffer will be modified. This buffer is used for the data
+ * stage of control transfers.
+ * @transfer_dma: When transfer_flags includes URB_NO_TRANSFER_DMA_MAP,
+ * the device driver is saying that it provided this DMA address,
+ * which the host controller driver should use in preference to the
+ * transfer_buffer.
+ * @sg: scatter gather buffer list
+ * @num_mapped_sgs: (internal) number of mapped sg entries
+ * @num_sgs: number of entries in the sg list
+ * @transfer_buffer_length: How big is transfer_buffer. The transfer may
+ * be broken up into chunks according to the current maximum packet
+ * size for the endpoint, which is a function of the configuration
+ * and is encoded in the pipe. When the length is zero, neither
+ * transfer_buffer nor transfer_dma is used.
+ * @actual_length: This is read in non-iso completion functions, and
+ * it tells how many bytes (out of transfer_buffer_length) were
+ * transferred. It will normally be the same as requested, unless
+ * either an error was reported or a short read was performed.
+ * The URB_SHORT_NOT_OK transfer flag may be used to make such
+ * short reads be reported as errors.
+ * @setup_packet: Only used for control transfers, this points to eight bytes
+ * of setup data. Control transfers always start by sending this data
+ * to the device. Then transfer_buffer is read or written, if needed.
+ * @setup_dma: DMA pointer for the setup packet. The caller must not use
+ * this field; setup_packet must point to a valid buffer.
+ * @start_frame: Returns the initial frame for isochronous transfers.
+ * @number_of_packets: Lists the number of ISO transfer buffers.
+ * @interval: Specifies the polling interval for interrupt or isochronous
+ * transfers. The units are frames (milliseconds) for full and low
+ * speed devices, and microframes (1/8 millisecond) for highspeed
+ * and SuperSpeed devices.
+ * @error_count: Returns the number of ISO transfers that reported errors.
+ * @context: For use in completion functions. This normally points to
+ * request-specific driver context.
+ * @complete: Completion handler. This URB is passed as the parameter to the
+ * completion function. The completion function may then do what
+ * it likes with the URB, including resubmitting or freeing it.
+ * @iso_frame_desc: Used to provide arrays of ISO transfer buffers and to
+ * collect the transfer status for each buffer.
+ *
+ * This structure identifies USB transfer requests. URBs must be allocated by
+ * calling usb_alloc_urb() and freed with a call to usb_free_urb().
+ * Initialization may be done using various usb_fill_*_urb() functions. URBs
+ * are submitted using usb_submit_urb(), and pending requests may be canceled
+ * using usb_unlink_urb() or usb_kill_urb().
+ *
+ * Data Transfer Buffers:
+ *
+ * Normally drivers provide I/O buffers allocated with zOss_Malloc() or otherwise
+ * taken from the general page pool. That is provided by transfer_buffer
+ * (control requests also use setup_packet), and host controller drivers
+ * perform a dma mapping (and unmapping) for each buffer transferred. Those
+ * mapping operations can be expensive on some platforms (perhaps using a dma
+ * bounce buffer or talking to an IOMMU),
+ * although they're cheap on commodity x86 and ppc hardware.
+ *
+ * Alternatively, drivers may pass the URB_NO_TRANSFER_DMA_MAP transfer flag,
+ * which tells the host controller driver that no such mapping is needed for
+ * the transfer_buffer since
+ * the device driver is DMA-aware. For example, a device driver might
+ * allocate a DMA buffer with usb_alloc_coherent() or call usb_buffer_map().
+ * When this transfer flag is provided, host controller drivers will
+ * attempt to use the dma address found in the transfer_dma
+ * field rather than determining a dma address themselves.
+ *
+ * Note that transfer_buffer must still be set if the controller
+ * does not support DMA (as indicated by bus.uses_dma) and when talking
+ * to root hub. If you have to trasfer between highmem zone and the device
+ * on such controller, create a bounce buffer or bail out with an error.
+ * If transfer_buffer cannot be set (is in highmem) and the controller is DMA
+ * capable, assign NULL to it, so that usbmon knows not to use the value.
+ * The setup_packet must always be set, so it cannot be located in highmem.
+ *
+ * Initialization:
+ *
+ * All URBs submitted must initialize the dev, pipe, transfer_flags (may be
+ * zero), and complete fields. All URBs must also initialize
+ * transfer_buffer and transfer_buffer_length. They may provide the
+ * URB_SHORT_NOT_OK transfer flag, indicating that short reads are
+ * to be treated as errors; that flag is invalid for write requests.
+ *
+ * Bulk URBs may
+ * use the URB_ZERO_PACKET transfer flag, indicating that bulk OUT transfers
+ * should always terminate with a short packet, even if it means adding an
+ * extra zero length packet.
+ *
+ * Control URBs must provide a valid pointer in the setup_packet field.
+ * Unlike the transfer_buffer, the setup_packet may not be mapped for DMA
+ * beforehand.
+ *
+ * Interrupt URBs must provide an interval, saying how often (in milliseconds
+ * or, for highspeed devices, 125 microsecond units)
+ * to poll for transfers. After the URB has been submitted, the interval
+ * field reflects how the transfer was actually scheduled.
+ * The polling interval may be more frequent than requested.
+ * For example, some controllers have a maximum interval of 32 milliseconds,
+ * while others support intervals of up to 1024 milliseconds.
+ * Isochronous URBs also have transfer intervals. (Note that for isochronous
+ * endpoints, as well as high speed interrupt endpoints, the encoding of
+ * the transfer interval in the endpoint descriptor is logarithmic.
+ * Device drivers must convert that value to linear units themselves.)
+ *
+ * Isochronous URBs normally use the URB_ISO_ASAP transfer flag, telling
+ * the host controller to schedule the transfer as soon as bandwidth
+ * utilization allows, and then set start_frame to reflect the actual frame
+ * selected during submission. Otherwise drivers must specify the start_frame
+ * and handle the case where the transfer can't begin then. However, drivers
+ * won't know how bandwidth is currently allocated, and while they can
+ * find the current frame using usb_get_current_frame_number () they can't
+ * know the range for that frame number. (Ranges for frame counter values
+ * are HC-specific, and can go from 256 to 65536 frames from "now".)
+ *
+ * Isochronous URBs have a different data transfer model, in part because
+ * the quality of service is only "best effort". Callers provide specially
+ * allocated URBs, with number_of_packets worth of iso_frame_desc structures
+ * at the end. Each such packet is an individual ISO transfer. Isochronous
+ * URBs are normally queued, submitted by drivers to arrange that
+ * transfers are at least double buffered, and then explicitly resubmitted
+ * in completion handlers, so
+ * that data (such as audio or video) streams at as constant a rate as the
+ * host controller scheduler can support.
+ *
+ * Completion Callbacks:
+ *
+ * The completion callback is made in_interrupt(), and one of the first
+ * things that a completion handler should do is check the status field.
+ * The status field is provided for all URBs. It is used to report
+ * unlinked URBs, and status for all non-ISO transfers. It should not
+ * be examined before the URB is returned to the completion handler.
+ *
+ * The context field is normally used to link URBs back to the relevant
+ * driver or request state.
+ *
+ * When the completion callback is invoked for non-isochronous URBs, the
+ * actual_length field tells how many bytes were transferred. This field
+ * is updated even when the URB terminated with an error or was unlinked.
+ *
+ * ISO transfer status is reported in the status and actual_length fields
+ * of the iso_frame_desc array, and the number of errors is reported in
+ * error_count. Completion callbacks for ISO transfers will normally
+ * (re)submit URBs to ensure a constant transfer rate.
+ *
+ * Note that even fields marked "public" should not be touched by the driver
+ * when the urb is owned by the hcd, that is, since the call to
+ * usb_submit_urb() till the entry into the completion routine.
+ */
+struct urb {
+ /* private: usb core and host controller only fields in the urb */
+ int kref; /* reference count of the URB */
+ void *hcpriv; /* private data for host controller */
+ usbHostTos_atomic_t use_count; /* concurrent submissions counter */
+ usbHostTos_atomic_t reject; /* submissions will fail */
+ int unlinked; /* unlink error code */
+
+ /* public: documented fields in the urb that can be used by drivers */
+ struct list_head urb_list; /* list head for use by the urb's
+ * current owner */
+ struct list_head anchor_list; /* the URB may be anchored */
+ struct usb_anchor *anchor;
+ struct usb_device *dev; /* (in) pointer to associated device */
+ struct usb_host_endpoint *ep; /* (internal) pointer to endpoint */
+ unsigned int pipe; /* (in) pipe information */
+ unsigned int stream_id; /* (in) stream ID */
+ int status; /* (return) non-ISO status */
+ unsigned int transfer_flags; /* (in) URB_SHORT_NOT_OK | ...*/
+ void *transfer_buffer; /* (in) associated data buffer */
+ dma_addr_t transfer_dma; /* (in) dma addr for transfer_buffer */
+ struct scatterlist *sg; /* (in) scatter gather buffer list */
+ int num_mapped_sgs; /* (internal) mapped sg entries */
+ int num_sgs; /* (in) number of entries in the sg list */
+ u32 transfer_buffer_length; /* (in) data buffer length */
+ u32 actual_length; /* (return) actual transfer length */
+ unsigned char *setup_packet; /* (in) setup packet (control only) */
+ dma_addr_t setup_dma; /* (in) dma addr for setup_packet */
+ int start_frame; /* (modify) start frame (ISO) */
+ int number_of_packets; /* (in) number of ISO packets */
+ int interval; /* (modify) transfer interval
+ * (INT/ISO) */
+ int error_count; /* (return) number of ISO errors */
+ void *context; /* (in) context for completion */
+ usb_complete_t complete; /* (in) completion routine */
+ struct usb_iso_packet_descriptor iso_frame_desc[0];
+ /* (in) ISO ONLY */
+};
+
+/* ----------------------------------------------------------------------- */
+
+/**
+ * usb_fill_control_urb - initializes a control urb
+ * @urb: pointer to the urb to initialize.
+ * @dev: pointer to the struct usb_device for this urb.
+ * @pipe: the endpoint pipe
+ * @setup_packet: pointer to the setup_packet buffer
+ * @transfer_buffer: pointer to the transfer buffer
+ * @buffer_length: length of the transfer buffer
+ * @complete_fn: pointer to the usb_complete_t function
+ * @context: what to set the urb context to.
+ *
+ * Initializes a control urb with the proper information needed to submit
+ * it to a device.
+ */
+static inline void usb_fill_control_urb(struct urb *urb,
+ struct usb_device *dev,
+ unsigned int pipe,
+ unsigned char *setup_packet,
+ void *transfer_buffer,
+ int buffer_length,
+ usb_complete_t complete_fn,
+ void *context)
+{
+ urb->dev = dev;
+ urb->pipe = pipe;
+ urb->setup_packet = setup_packet;
+ urb->transfer_buffer = transfer_buffer;
+ urb->transfer_buffer_length = buffer_length;
+ urb->complete = complete_fn;
+ urb->context = context;
+}
+
+/**
+ * usb_fill_bulk_urb - macro to help initialize a bulk urb
+ * @urb: pointer to the urb to initialize.
+ * @dev: pointer to the struct usb_device for this urb.
+ * @pipe: the endpoint pipe
+ * @transfer_buffer: pointer to the transfer buffer
+ * @buffer_length: length of the transfer buffer
+ * @complete_fn: pointer to the usb_complete_t function
+ * @context: what to set the urb context to.
+ *
+ * Initializes a bulk urb with the proper information needed to submit it
+ * to a device.
+ */
+static inline void usb_fill_bulk_urb(struct urb *urb,
+ struct usb_device *dev,
+ unsigned int pipe,
+ void *transfer_buffer,
+ int buffer_length,
+ usb_complete_t complete_fn,
+ void *context)
+{
+ urb->dev = dev;
+ urb->pipe = pipe;
+ urb->transfer_buffer = transfer_buffer;
+ urb->transfer_buffer_length = buffer_length;
+ urb->complete = complete_fn;
+ urb->context = context;
+}
+
+/**
+ * usb_fill_int_urb - macro to help initialize a interrupt urb
+ * @urb: pointer to the urb to initialize.
+ * @dev: pointer to the struct usb_device for this urb.
+ * @pipe: the endpoint pipe
+ * @transfer_buffer: pointer to the transfer buffer
+ * @buffer_length: length of the transfer buffer
+ * @complete_fn: pointer to the usb_complete_t function
+ * @context: what to set the urb context to.
+ * @interval: what to set the urb interval to, encoded like
+ * the endpoint descriptor's bInterval value.
+ *
+ * Initializes a interrupt urb with the proper information needed to submit
+ * it to a device.
+ *
+ * Note that High Speed and SuperSpeed interrupt endpoints use a logarithmic
+ * encoding of the endpoint interval, and express polling intervals in
+ * microframes (eight per millisecond) rather than in frames (one per
+ * millisecond).
+ *
+ * Wireless USB also uses the logarithmic encoding, but specifies it in units of
+ * 128us instead of 125us. For Wireless USB devices, the interval is passed
+ * through to the host controller, rather than being translated into microframe
+ * units.
+ */
+static inline void usb_fill_int_urb(struct urb *urb,
+ struct usb_device *dev,
+ unsigned int pipe,
+ void *transfer_buffer,
+ int buffer_length,
+ usb_complete_t complete_fn,
+ void *context,
+ int interval)
+{
+ urb->dev = dev;
+ urb->pipe = pipe;
+ urb->transfer_buffer = transfer_buffer;
+ urb->transfer_buffer_length = buffer_length;
+ urb->complete = complete_fn;
+ urb->context = context;
+ if (dev->speed == USB_SPEED_HIGH || dev->speed == USB_SPEED_SUPER)
+ urb->interval = 1 << (interval - 1);
+ else
+ urb->interval = interval;
+ urb->start_frame = -1;
+}
+
+extern void usb_init_urb(struct urb *urb);
+extern struct urb *usb_alloc_urb(int iso_packets, gfp_t mem_flags);
+extern void usb_free_urb(struct urb *urb);
+#define usb_put_urb usb_free_urb
+extern struct urb *usb_get_urb(struct urb *urb);
+extern int usb_submit_urb(struct urb *urb, gfp_t mem_flags);
+extern int usb_unlink_urb(struct urb *urb);
+extern void usb_kill_urb(struct urb *urb);
+extern void usb_poison_urb(struct urb *urb);
+extern void usb_unpoison_urb(struct urb *urb);
+extern void usb_block_urb(struct urb *urb);
+extern void usb_kill_anchored_urbs(struct usb_anchor *anchor);
+extern void usb_poison_anchored_urbs(struct usb_anchor *anchor);
+extern void usb_unpoison_anchored_urbs(struct usb_anchor *anchor);
+extern void usb_unlink_anchored_urbs(struct usb_anchor *anchor);
+extern void usb_anchor_urb(struct urb *urb, struct usb_anchor *anchor);
+extern void usb_unanchor_urb(struct urb *urb);
+extern int usb_wait_anchor_empty_timeout(struct usb_anchor *anchor,
+ unsigned int timeout);
+extern struct urb *usb_get_from_anchor(struct usb_anchor *anchor);
+extern void usb_scuttle_anchored_urbs(struct usb_anchor *anchor);
+extern int usb_anchor_empty(struct usb_anchor *anchor);
+
+#define usb_unblock_urb usb_unpoison_urb
+
+/**
+ * usb_urb_dir_in - check if an URB describes an IN transfer
+ * @urb: URB to be checked
+ *
+ * Returns 1 if @urb describes an IN transfer (device-to-host),
+ * otherwise 0.
+ */
+static inline int usb_urb_dir_in(struct urb *urb)
+{
+ return (urb->transfer_flags & URB_DIR_MASK) == URB_DIR_IN;
+}
+
+/**
+ * usb_urb_dir_out - check if an URB describes an OUT transfer
+ * @urb: URB to be checked
+ *
+ * Returns 1 if @urb describes an OUT transfer (host-to-device),
+ * otherwise 0.
+ */
+static inline int usb_urb_dir_out(struct urb *urb)
+{
+ return (urb->transfer_flags & URB_DIR_MASK) == URB_DIR_OUT;
+}
+
+void *usb_alloc_coherent(struct usb_device *dev, size_t size,
+ gfp_t mem_flags, dma_addr_t *dma);
+void usb_free_coherent(struct usb_device *dev, size_t size,
+ void *addr, dma_addr_t dma);
+
+#if 0
+struct urb *usb_buffer_map(struct urb *urb);
+void usb_buffer_dmasync(struct urb *urb);
+void usb_buffer_unmap(struct urb *urb);
+#endif
+
+struct scatterlist;
+int usb_buffer_map_sg(const struct usb_device *dev, int is_in,
+ struct scatterlist *sg, int nents);
+#if 0
+void usb_buffer_dmasync_sg(const struct usb_device *dev, int is_in,
+ struct scatterlist *sg, int n_hw_ents);
+#endif
+void usb_buffer_unmap_sg(const struct usb_device *dev, int is_in,
+ struct scatterlist *sg, int n_hw_ents);
+
+/*-------------------------------------------------------------------*
+ * SYNCHRONOUS CALL SUPPORT *
+ *-------------------------------------------------------------------*/
+
+extern int usb_control_msg(struct usb_device *dev, unsigned int pipe,
+ __u8 request, __u8 requesttype, __u16 value, __u16 index,
+ void *data, __u16 size, int timeout);
+extern int usb_interrupt_msg(struct usb_device *usb_dev, unsigned int pipe,
+ void *data, int len, int *actual_length, int timeout);
+extern int usb_bulk_msg(struct usb_device *usb_dev, unsigned int pipe,
+ void *data, int len, int *actual_length,
+ int timeout);
+
+/* wrappers around usb_control_msg() for the most common standard requests */
+extern int usb_get_descriptor(struct usb_device *dev, unsigned char desctype,
+ unsigned char descindex, void *buf, int size);
+extern int usb_get_status(struct usb_device *dev,
+ int type, int target, void *data);
+extern int usb_string(struct usb_device *dev, int index,
+ char *buf, size_t size);
+
+/* wrappers that also update important state inside usbcore */
+extern int usb_clear_halt(struct usb_device *dev, int pipe);
+extern int usb_reset_configuration(struct usb_device *dev);
+extern int usb_set_interface(struct usb_device *dev, int ifnum, int alternate);
+extern void usb_reset_endpoint(struct usb_device *dev, unsigned int epaddr);
+
+/* this request isn't really synchronous, but it belongs with the others */
+extern int usb_driver_set_configuration(struct usb_device *udev, int config);
+
+/*
+ * timeouts, in milliseconds, used for sending/receiving control messages
+ * they typically complete within a few frames (msec) after they're issued
+ * USB identifies 5 second timeouts, maybe more in a few cases, and a few
+ * slow devices (like some MGE Ellipse UPSes) actually push that limit.
+ */
+#define USB_CTRL_GET_TIMEOUT 5000
+#define USB_CTRL_SET_TIMEOUT 5000
+
+
+#ifndef _OS_LINUX
+struct completion {
+ unsigned int done;
+ wait_queue_head_t wait;
+};
+#endif
+
+/**
+ * struct usb_sg_request - support for scatter/gather I/O
+ * @status: zero indicates success, else negative errno
+ * @bytes: counts bytes transferred.
+ *
+ * These requests are initialized using usb_sg_init(), and then are used
+ * as request handles passed to usb_sg_wait() or usb_sg_cancel(). Most
+ * members of the request object aren't for driver access.
+ *
+ * The status and bytecount values are valid only after usb_sg_wait()
+ * returns. If the status is zero, then the bytecount matches the total
+ * from the request.
+ *
+ * After an error completion, drivers may need to clear a halt condition
+ * on the endpoint.
+ */
+struct usb_sg_request {
+ int status;
+ size_t bytes;
+
+ /* private:
+ * members below are private to usbcore,
+ * and are not provided for driver access!
+ */
+ spinlock_t lock;
+
+ struct usb_device *dev;
+ int pipe;
+
+ int entries;
+ struct urb **urbs;
+
+ int count;
+ struct completion complete;
+};
+
+#if 0
+int usb_sg_init(
+ struct usb_sg_request *io,
+ struct usb_device *dev,
+ unsigned pipe,
+ unsigned period,
+ struct scatterlist *sg,
+ int nents,
+ size_t length,
+ gfp_t mem_flags
+);
+#endif
+
+void usb_sg_cancel(struct usb_sg_request *io);
+void usb_sg_wait(struct usb_sg_request *io);
+
+
+/* ----------------------------------------------------------------------- */
+
+/*
+ * For various legacy reasons, Linux has a small cookie that's paired with
+ * a struct usb_device to identify an endpoint queue. Queue characteristics
+ * are defined by the endpoint's descriptor. This cookie is called a "pipe",
+ * an unsigned int encoded as:
+ *
+ * - direction: bit 7 (0 = Host-to-Device [Out],
+ * 1 = Device-to-Host [In] ...
+ * like endpoint bEndpointAddress)
+ * - device address: bits 8-14 ... bit positions known to uhci-hcd
+ * - endpoint: bits 15-18 ... bit positions known to uhci-hcd
+ * - pipe type: bits 30-31 (00 = isochronous, 01 = interrupt,
+ * 10 = control, 11 = bulk)
+ *
+ * Given the device address and endpoint descriptor, pipes are redundant.
+ */
+
+/* NOTE: these are not the standard USB_ENDPOINT_XFER_* values!! */
+/* (yet ... they're the values used by usbfs) */
+#define PIPE_ISOCHRONOUS 0
+#define PIPE_INTERRUPT 1
+#define PIPE_CONTROL 2
+#define PIPE_BULK 3
+
+#define usb_pipein(pipe) ((pipe) & USB_DIR_IN)
+#define usb_pipeout(pipe) (!usb_pipein(pipe))
+
+#define usb_pipedevice(pipe) (((pipe) >> 8) & 0x7f)
+#define usb_pipeendpoint(pipe) (((pipe) >> 15) & 0xf)
+
+#define usb_pipetype(pipe) (((pipe) >> 30) & 3)
+#define usb_pipeisoc(pipe) (usb_pipetype((pipe)) == PIPE_ISOCHRONOUS)
+#define usb_pipeint(pipe) (usb_pipetype((pipe)) == PIPE_INTERRUPT)
+#define usb_pipecontrol(pipe) (usb_pipetype((pipe)) == PIPE_CONTROL)
+#define usb_pipebulk(pipe) (usb_pipetype((pipe)) == PIPE_BULK)
+
+static inline unsigned int __create_pipe(struct usb_device *dev,
+ unsigned int endpoint)
+{
+ return (dev->devnum << 8) | (endpoint << 15);
+}
+
+/* Create various pipes... */
+#define usb_sndctrlpipe(dev, endpoint) \
+ ((PIPE_CONTROL << 30) | __create_pipe(dev, endpoint))
+#define usb_rcvctrlpipe(dev, endpoint) \
+ ((PIPE_CONTROL << 30) | __create_pipe(dev, endpoint) | USB_DIR_IN)
+#define usb_sndisocpipe(dev, endpoint) \
+ ((PIPE_ISOCHRONOUS << 30) | __create_pipe(dev, endpoint))
+#define usb_rcvisocpipe(dev, endpoint) \
+ ((PIPE_ISOCHRONOUS << 30) | __create_pipe(dev, endpoint) | USB_DIR_IN)
+#define usb_sndbulkpipe(dev, endpoint) \
+ ((PIPE_BULK << 30) | __create_pipe(dev, endpoint))
+#define usb_rcvbulkpipe(dev, endpoint) \
+ ((PIPE_BULK << 30) | __create_pipe(dev, endpoint) | USB_DIR_IN)
+#define usb_sndintpipe(dev, endpoint) \
+ ((PIPE_INTERRUPT << 30) | __create_pipe(dev, endpoint))
+#define usb_rcvintpipe(dev, endpoint) \
+ ((PIPE_INTERRUPT << 30) | __create_pipe(dev, endpoint) | USB_DIR_IN)
+
+static inline struct usb_host_endpoint *
+usb_pipe_endpoint(struct usb_device *dev, unsigned int pipe)
+{
+ struct usb_host_endpoint **eps;
+ eps = usb_pipein(pipe) ? dev->ep_in : dev->ep_out;
+ return eps[usb_pipeendpoint(pipe)];
+}
+
+/*-------------------------------------------------------------------------*/
+
+static inline __u16
+usb_maxpacket(struct usb_device *udev, int pipe, int is_out)
+{
+ struct usb_host_endpoint *ep;
+ unsigned epnum = usb_pipeendpoint(pipe);
+
+ if (is_out) {
+ WARN_ON(usb_pipein(pipe));
+ ep = udev->ep_out[epnum];
+ } else {
+ WARN_ON(usb_pipeout(pipe));
+ ep = udev->ep_in[epnum];
+ }
+ if (!ep)
+ return 0;
+
+ /* NOTE: only 0x07ff bits are for packet size... */
+ return usb_endpoint_maxp(&ep->desc);
+}
+
+/* ----------------------------------------------------------------------- */
+
+/* translate USB error codes to codes user space understands */
+static inline int usb_translate_errors(int error_code)
+{
+ switch (error_code) {
+ case 0:
+ case -ENOMEM:
+ case -ENODEV:
+ return error_code;
+ default:
+ return -EIO;
+ }
+}
+
+/* Events from the usb core */
+#define USB_DEVICE_ADD 0x0001
+#define USB_DEVICE_REMOVE 0x0002
+#define USB_BUS_ADD 0x0003
+#define USB_BUS_REMOVE 0x0004
+extern void usb_register_notify(struct notifier_block *nb);
+extern void usb_unregister_notify(struct notifier_block *nb);
+
+#ifdef DEBUG
+#define dbg(format, arg...) \
+ printk(KERN_DEBUG "%s: " format "\n", __FILE__, ##arg)
+#else
+#define dbg(format, arg...) \
+do { \
+ if (0) \
+ printk(KERN_DEBUG "%s: " format "\n", __FILE__, ##arg); \
+} while (0)
+#endif
+
+#define err(format, arg...) \
+ printk(KERN_ERR KBUILD_MODNAME ": " format "\n", ##arg)
+
+/* debugfs stuff */
+extern struct dentry *usb_debug_root;
+
+#endif /* __KERNEL__ */
+
+#define usb_autosuspend_device(udev) do {} while (0)
+static inline int usb_autoresume_device(struct usb_device *udev)
+{
+ return 0;
+}
+
+static inline int usb_remote_wakeup(struct usb_device *udev)
+{
+ return 0;
+}
+
+static inline int usb_set_usb2_hardware_lpm(struct usb_device *udev, int enable)
+{
+ return 0;
+}
+
+//#define zOss_Malloc(x,y) zOss_Malloc(x)
+extern int usb_hub_init(void);
+
+#endif
diff --git a/cp/ps/driver/inc/usbhost/usbdevice_fs.h b/cp/ps/driver/inc/usbhost/usbdevice_fs.h
new file mode 100644
index 0000000..47af02a
--- /dev/null
+++ b/cp/ps/driver/inc/usbhost/usbdevice_fs.h
@@ -0,0 +1,207 @@
+/*****************************************************************************/
+
+/*
+ * usbdevice_fs.h -- USB device file system.
+ *
+ * Copyright (C) 2000
+ * Thomas Sailer (sailer@ife.ee.ethz.ch)
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ * History:
+ * 0.1 04.01.2000 Created
+ */
+
+/*****************************************************************************/
+
+#ifndef _LINUX_USBDEVICE_FS_H
+#define _LINUX_USBDEVICE_FS_H
+
+//#include <linux/types.h>
+//#include <linux/magic.h>
+
+/* --------------------------------------------------------------------- */
+
+/* usbdevfs ioctl codes */
+
+struct usbdevfs_ctrltransfer {
+ __u8 bRequestType;
+ __u8 bRequest;
+ __u16 wValue;
+ __u16 wIndex;
+ __u16 wLength;
+ __u32 timeout; /* in milliseconds */
+ void *data;
+};
+
+struct usbdevfs_bulktransfer {
+ unsigned int ep;
+ unsigned int len;
+ unsigned int timeout; /* in milliseconds */
+ void *data;
+};
+
+struct usbdevfs_setinterface {
+ unsigned int interface;
+ unsigned int altsetting;
+};
+
+struct usbdevfs_disconnectsignal {
+ unsigned int signr;
+ void *context;
+};
+
+#define USBDEVFS_MAXDRIVERNAME 255
+
+struct usbdevfs_getdriver {
+ unsigned int interface;
+ char driver[USBDEVFS_MAXDRIVERNAME + 1];
+};
+
+struct usbdevfs_connectinfo {
+ unsigned int devnum;
+ unsigned char slow;
+};
+
+#define USBDEVFS_URB_SHORT_NOT_OK 0x01
+#define USBDEVFS_URB_ISO_ASAP 0x02
+#define USBDEVFS_URB_BULK_CONTINUATION 0x04
+#define USBDEVFS_URB_NO_FSBR 0x20
+#define USBDEVFS_URB_ZERO_PACKET 0x40
+#define USBDEVFS_URB_NO_INTERRUPT 0x80
+
+#define USBDEVFS_URB_TYPE_ISO 0
+#define USBDEVFS_URB_TYPE_INTERRUPT 1
+#define USBDEVFS_URB_TYPE_CONTROL 2
+#define USBDEVFS_URB_TYPE_BULK 3
+
+struct usbdevfs_iso_packet_desc {
+ unsigned int length;
+ unsigned int actual_length;
+ unsigned int status;
+};
+
+struct usbdevfs_urb {
+ unsigned char type;
+ unsigned char endpoint;
+ int status;
+ unsigned int flags;
+ void *buffer;
+ int buffer_length;
+ int actual_length;
+ int start_frame;
+ int number_of_packets;
+ int error_count;
+ unsigned int signr; /* signal to be sent on completion,
+ or 0 if none should be sent. */
+ void *usercontext;
+ struct usbdevfs_iso_packet_desc iso_frame_desc[0];
+};
+
+/* ioctls for talking directly to drivers */
+struct usbdevfs_ioctl {
+ int ifno; /* interface 0..N ; negative numbers reserved */
+ int ioctl_code; /* MUST encode size + direction of data so the
+ * macros in <asm/ioctl.h> give correct values */
+ void *data; /* param buffer (in, or out) */
+};
+
+/* You can do most things with hubs just through control messages,
+ * except find out what device connects to what port. */
+struct usbdevfs_hub_portinfo {
+ char nports; /* number of downstream ports in this hub */
+ char port [127]; /* e.g. port 3 connects to device 27 */
+};
+
+#ifdef __KERNEL__
+#ifdef CONFIG_COMPAT
+#include <linux/compat.h>
+
+struct usbdevfs_ctrltransfer32 {
+ u8 bRequestType;
+ u8 bRequest;
+ u16 wValue;
+ u16 wIndex;
+ u16 wLength;
+ u32 timeout; /* in milliseconds */
+ compat_caddr_t data;
+};
+
+struct usbdevfs_bulktransfer32 {
+ compat_uint_t ep;
+ compat_uint_t len;
+ compat_uint_t timeout; /* in milliseconds */
+ compat_caddr_t data;
+};
+
+struct usbdevfs_disconnectsignal32 {
+ compat_int_t signr;
+ compat_caddr_t context;
+};
+
+struct usbdevfs_urb32 {
+ unsigned char type;
+ unsigned char endpoint;
+ compat_int_t status;
+ compat_uint_t flags;
+ compat_caddr_t buffer;
+ compat_int_t buffer_length;
+ compat_int_t actual_length;
+ compat_int_t start_frame;
+ compat_int_t number_of_packets;
+ compat_int_t error_count;
+ compat_uint_t signr;
+ compat_caddr_t usercontext; /* unused */
+ struct usbdevfs_iso_packet_desc iso_frame_desc[0];
+};
+
+struct usbdevfs_ioctl32 {
+ s32 ifno;
+ s32 ioctl_code;
+ compat_caddr_t data;
+};
+#endif
+#endif /* __KERNEL__ */
+
+#define USBDEVFS_CONTROL _IOWR('U', 0, struct usbdevfs_ctrltransfer)
+#define USBDEVFS_CONTROL32 _IOWR('U', 0, struct usbdevfs_ctrltransfer32)
+#define USBDEVFS_BULK _IOWR('U', 2, struct usbdevfs_bulktransfer)
+#define USBDEVFS_BULK32 _IOWR('U', 2, struct usbdevfs_bulktransfer32)
+#define USBDEVFS_RESETEP _IOR('U', 3, unsigned int)
+#define USBDEVFS_SETINTERFACE _IOR('U', 4, struct usbdevfs_setinterface)
+#define USBDEVFS_SETCONFIGURATION _IOR('U', 5, unsigned int)
+#define USBDEVFS_GETDRIVER _IOW('U', 8, struct usbdevfs_getdriver)
+#define USBDEVFS_SUBMITURB _IOR('U', 10, struct usbdevfs_urb)
+#define USBDEVFS_SUBMITURB32 _IOR('U', 10, struct usbdevfs_urb32)
+#define USBDEVFS_DISCARDURB _IO('U', 11)
+#define USBDEVFS_REAPURB _IOW('U', 12, void *)
+#define USBDEVFS_REAPURB32 _IOW('U', 12, __u32)
+#define USBDEVFS_REAPURBNDELAY _IOW('U', 13, void *)
+#define USBDEVFS_REAPURBNDELAY32 _IOW('U', 13, __u32)
+#define USBDEVFS_DISCSIGNAL _IOR('U', 14, struct usbdevfs_disconnectsignal)
+#define USBDEVFS_DISCSIGNAL32 _IOR('U', 14, struct usbdevfs_disconnectsignal32)
+#define USBDEVFS_CLAIMINTERFACE _IOR('U', 15, unsigned int)
+#define USBDEVFS_RELEASEINTERFACE _IOR('U', 16, unsigned int)
+#define USBDEVFS_CONNECTINFO _IOW('U', 17, struct usbdevfs_connectinfo)
+#define USBDEVFS_IOCTL _IOWR('U', 18, struct usbdevfs_ioctl)
+#define USBDEVFS_IOCTL32 _IOWR('U', 18, struct usbdevfs_ioctl32)
+#define USBDEVFS_HUB_PORTINFO _IOR('U', 19, struct usbdevfs_hub_portinfo)
+#define USBDEVFS_RESET _IO('U', 20)
+#define USBDEVFS_CLEAR_HALT _IOR('U', 21, unsigned int)
+#define USBDEVFS_DISCONNECT _IO('U', 22)
+#define USBDEVFS_CONNECT _IO('U', 23)
+#define USBDEVFS_CLAIM_PORT _IOR('U', 24, unsigned int)
+#define USBDEVFS_RELEASE_PORT _IOR('U', 25, unsigned int)
+#endif /* _LINUX_USBDEVICE_FS_H */
diff --git a/cp/ps/driver/inc/usbhost/usbhost_swab.h b/cp/ps/driver/inc/usbhost/usbhost_swab.h
new file mode 100644
index 0000000..251f38d
--- /dev/null
+++ b/cp/ps/driver/inc/usbhost/usbhost_swab.h
@@ -0,0 +1,53 @@
+#ifndef USBHOST_SWAB_H
+#define USBHOST_SWAB_H
+
+//#include <endian.h>
+#ifndef _OS_LINUX
+#define swab16(x) \
+ ((uint16_t)( \
+ (((uint16_t)(x) & (uint16_t)0x00ffU) << 8) | \
+ (((uint16_t)(x) & (uint16_t)0xff00U) >> 8) ))
+#define swab32(x) \
+ ((uint32_t)( \
+ (((uint32_t)(x) & (uint32_t)0x000000ffUL) << 24) | \
+ (((uint32_t)(x) & (uint32_t)0x0000ff00UL) << 8) | \
+ (((uint32_t)(x) & (uint32_t)0x00ff0000UL) >> 8) | \
+ (((uint32_t)(x) & (uint32_t)0xff000000UL) >> 24) ))
+
+#define swab64(x) \
+ ((uint64_t)( \
+ (((uint64_t)(x) & (uint64_t)0x00000000000000ffULL) << 56) | \
+ (((uint64_t)(x) & (uint64_t)0x000000000000ff00ULL) << 40) | \
+ (((uint64_t)(x) & (uint64_t)0x0000000000ff0000ULL) << 24) | \
+ (((uint64_t)(x) & (uint64_t)0x00000000ff000000ULL) << 8) | \
+ (((uint64_t)(x) & (uint64_t)0x000000ff00000000ULL) >> 8) | \
+ (((uint64_t)(x) & (uint64_t)0x0000ff0000000000ULL) >> 24) | \
+ (((uint64_t)(x) & (uint64_t)0x00ff000000000000ULL) >> 40) | \
+ (((uint64_t)(x) & (uint64_t)0xff00000000000000ULL) >> 56) ))
+
+
+#if 0//__BYTE_ORDER == __BIG_ENDIAN
+#define cpu_to_le16(x) ({ uint16_t _x = x; swab16(_x); })
+#define cpu_to_le32(x) ({ uint32_t _x = x; swab32(_x); })
+#define cpu_to_le64(x) ({ uint64_t _x = x; swab64(_x); })
+#define cpu_to_be16(x) (x)
+#define cpu_to_be32(x) (x)
+#define cpu_to_be64(x) (x)
+#else
+#define cpu_to_le16(x) (x)
+#define cpu_to_le32(x) (x)
+#define cpu_to_le64(x) (x)
+#define cpu_to_be16(x) ({ uint16_t _x = x; swab16(_x); })
+#define cpu_to_be32(x) ({ uint32_t _x = x; swab32(_x); })
+#define cpu_to_be64(x) ({ uint64_t _x = x; swab64(_x); })
+#endif
+#define le16_to_cpu(x) cpu_to_le16(x)
+#define be16_to_cpu(x) cpu_to_be16(x)
+#define le32_to_cpu(x) cpu_to_le32(x)
+#define be32_to_cpu(x) cpu_to_be32(x)
+#define le64_to_cpu(x) cpu_to_le64(x)
+#define be64_to_cpu(x) cpu_to_be64(x)
+
+#endif
+
+#endif