blob: d36c278b6a650afa7e162760eef4c671be33bfd9 [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).
*
*****************************************************************************/
/*****************************************************************************
*
* FILE NAME : cl1fr.h
*
* DESCRIPTION :
*
*****************************************************************************/
/*----------------------------------------------------------------------------
Include Files
----------------------------------------------------------------------------*/
#ifndef _CL1FR_H_
#define _CL1FR_H_
#include "cl1frevtid.h"
#include "kal_public_api.h"
#include "kal_hrt_api.h"
#include "intrCtrl.h"
#include "c2k_defs.h"
#ifndef MTK_PLT_ON_PC
#ifdef __MD93__
#define IRQ_C2K_FR_FH_SWI_CODE IRQ_SW_LISR15_CODE
#elif defined (__MD95__)
#define IRQ_C2K_FR_FH_SWI_CODE IRQ_SW_LISR8_CODE
#else
#define IRQ_C2K_FR_FH_SWI_CODE IRQ_SW_LISR8_CODE
#endif
#endif
/* Frame tick related */
typedef enum
{
NORMAL_DOMAIN,
FRAMETICK_REGULAR,
FRAMETICK_HSC = FRAMETICK_REGULAR,
FRAMETICK_L1D,
FRAMETICK_RMC,
FRAMEHANDLER_IN_SWI,
FRAMEHANDLER_IN_PCGSLOT,
PCG_IRQ,
SLOT_IRQ,
RCPRI_IRQ,
OTHER_IRQ,
FR_MOD_MAX_NUM
} FrModuleT;
#if (CUR_GEN>=MD_GEN95)
/*Running IRQ LISR location*/
typedef enum
{
LOC_HWD_WAKE_DO_LISR,
LOC_SYS_DO_SLOT_LISR,
LOC_SYS_DO_HALF_SLOT_LISR,
LOC_SYS_DO_HALF_SLOT_LISR_2,
LOC_FRAME_HANDLER_SWI_LISR,
LOC_SYS_FTIMER_DO_LISR,
LOC_LISR_RUN_MAX_NUM
} IrqLisrRunT;
#endif
typedef struct
{
kal_bool UseDm;
kal_bool Processed;
kal_uint16 EvtId;
kal_uint16 EvtLength; /* In byte */
kal_uint32 TimeStamp; /* In FRC */
kal_uint8* DataPtr;
} EvtDataT;
#define M_Fr2ByteAlign(x) ((((x) + 1) >> 1) << 1)
#define M_Fr4ByteAlign(x) ((((x) + 3) >> 2) << 2)
#define M_SetShOngoingFlag(Interface) {gShOngoing[Interface] = KAL_TRUE;}
#define M_ClrShOngoingFlag(Interface) {gShOngoing[Interface] = KAL_FALSE;}
#define M_IsShOngoing(Interface) (gShOngoing[Interface] == KAL_TRUE)
extern kal_uint32 gSwiBitmap;
extern kal_bool gShOngoing[SYS_MODE_MAX];
extern kal_uint32 gFhSwiOwnerBitmap;
extern void FrSendEvent(FrModuleT Src, FrModuleT Dest, FrEvtIdT EvtId, kal_bool UseDm, kal_uint8* DataPtr, kal_uint16 Length);
extern void __FrIrqSendMsg(FrModuleT Src, module_type DestMod, msg_type MsgId, kal_bool UseDm, kal_uint8* DataPtr, kal_uint16 Length);
extern void FrEventExecutor(FrModuleT Execution);
extern void FrFhSwiEventExecutor(void);
extern void FrFhSwiTrigger(SysAirInterfaceT Mode);
extern void FrSwiTriggerHisr(void);
extern void FrFhMsgDeliverHisr(void);
extern void FrShMsgDeliverHisr(void);
extern void FrRrMsgDeliverHisr(void);
extern kal_bool FrEvtQueueEmpty(FrModuleT Module);
extern kal_bool FrMsgQueueEmpty(FrModuleT Module);
extern kal_bool FrAllQueueEmpty(void);
#if (CUR_GEN>=MD_GEN95)
extern void FrSamePrioIRQProcess(kal_bool mask,IrqLisrRunT IrqLisrRunLoc);
#endif
/* 2Bytes alignment is to make sure sizeof(XXX_msg_struct)=sizeof(LOCAL_PARA_HDR)+sizeof(msg),
because LOCAL_PARA_HDR has a uint16 item, sizeof(XXX_msg_struct) must be even number.
if the sizeof(msg) is odd, the equation is not fullfilled.
*/
#define FrIrqSendMsg(Src, DestMod, MsgId, UseDm, DataPtr, Length) \
__FrIrqSendMsg(Src, DestMod, MsgId, UseDm, DataPtr, M_Fr2ByteAlign(Length))
#endif
/*****************************************************************************
* End of File
*****************************************************************************/