blob: aded35ecc9b5a45c0959dd8ce3680f00a43a5401 [file] [log] [blame]
/*****************************************************************************
* Copyright Statement:
* --------------------
* This software is protected by Copyright and the information contained
* herein is confidential. The software may not be copied and the information
* contained herein may not be used or disclosed except with the written
* permission of MediaTek Inc. (C) 2016
*
* BY OPENING THIS FILE, BUYER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
* THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
* RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO BUYER ON
* AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT.
* NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE
* SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR
* SUPPLIED WITH THE MEDIATEK SOFTWARE, AND BUYER AGREES TO LOOK ONLY TO SUCH
* THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. MEDIATEK SHALL ALSO
* NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE RELEASES MADE TO BUYER'S
* SPECIFICATION OR TO CONFORM TO A PARTICULAR STANDARD OR OPEN FORUM.
*
* BUYER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND CUMULATIVE
* LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE,
* AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE,
* OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY BUYER TO
* MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
*
* THE TRANSACTION CONTEMPLATED HEREUNDER SHALL BE CONSTRUED IN ACCORDANCE
* WITH THE LAWS OF THE STATE OF CALIFORNIA, USA, EXCLUDING ITS CONFLICT OF
* LAWS PRINCIPLES. ANY DISPUTES, CONTROVERSIES OR CLAIMS ARISING THEREOF AND
* RELATED THERETO SHALL BE SETTLED BY ARBITRATION IN SAN FRANCISCO, CA, UNDER
* THE RULES OF THE INTERNATIONAL CHAMBER OF COMMERCE (ICC).
*
*****************************************************************************/
#ifndef _CL1SLEEP_H_
#define _CL1SLEEP_H_
/*****************************************************************************
FILE NAME: hwdsleep.h
DESCRIPTION:
Interface to hwdsleep.c
*****************************************************************************/
#include "sysapi.h"
/*------------------------------------------------------------------------
* exported data
*------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
Global Defines and Macros
----------------------------------------------------------------------------*/
#define PAUSE_CMD_SW_MARGIN (1500) /* 5T 32K SW Margin */
#define PAUSE_CMD_MARGIN (1500 + PAUSE_CMD_SW_MARGIN) /* 3T 32K + 2T uncertanty + 5T SW Margin */
typedef struct
{
kal_bool SleepState; /* Indicate whether UE is in sleep state */
kal_uint32 WakeTime; /* record wake up time */
kal_uint64 WakeDuration; /* record total wake duration after UE boot up */
} Cl1WakeInfoT;
typedef struct
{
kal_uint8 CurrentIdx; /* Indicate current index */
Cl1WakeInfoT WakeInfo[2]; /* record wake info, 2 index for ping-pang buffer for corner case query in sleep or wake up boundary */
kal_uint32 WakeCnt; /* record total wake counts after UE boot up */
kal_uint32 SleepCnt; /* record total sleep counts after UE boot up */
} Cl1SleepEmInfoT;
extern Cl1SleepEmInfoT gCl1SleepEmInfo[SYS_MODE_MAX];
/* Clock Control Blocks */
typedef enum
{
HWD_BLK_CTRL_PPP_HA,
HWD_BLK_CTRL_1X_SYSTIME,
HWD_BLK_CTRL_DO_SYSTIME,
HWD_BLK_CTRL_FT_CTRL,
HWD_BLK_CTRL_RF_CTRL,
HWD_BLK_CTRL_NUM_BLOCKS
} HwdBlkControlBlocksT;
#ifndef MTK_PLT_ON_PC
#define IRQ_WAKE1X_IRQ_CODE IRQ_ST1x_WAKEUP_IRQ_CODE
#define IRQ_WAKEDO_IRQ_CODE IRQ_STDO_WAKEUP_IRQ_CODE
#else
#define IRQ_WAKE1X_IRQ_CODE OSC_ISR_SRC_CUSTOM10
#define IRQ_WAKEDO_IRQ_CODE OSC_ISR_SRC_CUSTOM11
#endif
/*------------------------------------------------------------------------
* exported functions
*------------------------------------------------------------------------*/
extern void HwdSleepInit(void);
extern kal_bool HwdEnterCbpDeepSleepCheck(SysAirInterfaceT Interface) ;
extern void HwdWakeupSlpCtrl( SysAirInterfaceT Interface ) ;
extern void HwdDeepSleepClearCancellingFlag(SysAirInterfaceT Interface);
extern kal_bool HwdIsBlockConfigValid( HwdBlkControlBlocksT Block );
extern kal_bool HwdCheckDeepSleepMode( SysAirInterfaceT Interface);
extern kal_bool HwdCheckDeepSleepHWMode(SysAirInterfaceT Interface);
extern void HwdSleepOverHisr1x(void);
extern void HwdSleepOverHisrDO(void);
extern void HwdSleepSetCalValue(SysAirInterfaceT Interface, kal_uint32 CalValue);
extern kal_uint32 HwdSleepCalcCalValue(SysAirInterfaceT Interface, kal_uint32 ScCnt, kal_uint32 FcFreq, kal_uint32 FcCnt);
extern void HwdSleepSetSlpOffset(SysAirInterfaceT Interface, kal_int16 Offset);
extern kal_uint32 HwdSleepTimesGet(SysAirInterfaceT Interface);
extern void Cl1SmTick(SysAirInterfaceT Interface);
extern void HwdDeepSleepRecover(void);
extern void Cl1_slp_info_calc(SysAirInterfaceT Interface, kal_uint64 *working_time, kal_uint32 *wakeup_cnt, kal_uint32 *sleep_cnt);
/*****************************************************************************
* End of file
*****************************************************************************/
#endif