blob: d36c278b6a650afa7e162760eef4c671be33bfd9 [file] [log] [blame]
yu.dongc33b3072024-08-21 23:14:49 -07001/*****************************************************************************
2* Copyright Statement:
3* --------------------
4* This software is protected by Copyright and the information contained
5* herein is confidential. The software may not be copied and the information
6* contained herein may not be used or disclosed except with the written
7* permission of MediaTek Inc. (C) 2016
8*
9* BY OPENING THIS FILE, BUYER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
10* THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
11* RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO BUYER ON
12* AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES,
13* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
14* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT.
15* NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE
16* SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR
17* SUPPLIED WITH THE MEDIATEK SOFTWARE, AND BUYER AGREES TO LOOK ONLY TO SUCH
18* THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. MEDIATEK SHALL ALSO
19* NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE RELEASES MADE TO BUYER'S
20* SPECIFICATION OR TO CONFORM TO A PARTICULAR STANDARD OR OPEN FORUM.
21*
22* BUYER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND CUMULATIVE
23* LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE,
24* AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE,
25* OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY BUYER TO
26* MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
27*
28* THE TRANSACTION CONTEMPLATED HEREUNDER SHALL BE CONSTRUED IN ACCORDANCE
29* WITH THE LAWS OF THE STATE OF CALIFORNIA, USA, EXCLUDING ITS CONFLICT OF
30* LAWS PRINCIPLES. ANY DISPUTES, CONTROVERSIES OR CLAIMS ARISING THEREOF AND
31* RELATED THERETO SHALL BE SETTLED BY ARBITRATION IN SAN FRANCISCO, CA, UNDER
32* THE RULES OF THE INTERNATIONAL CHAMBER OF COMMERCE (ICC).
33*
34*****************************************************************************/
35
36/*****************************************************************************
37*
38* FILE NAME : cl1fr.h
39*
40* DESCRIPTION :
41*
42*****************************************************************************/
43
44/*----------------------------------------------------------------------------
45 Include Files
46----------------------------------------------------------------------------*/
47
48#ifndef _CL1FR_H_
49#define _CL1FR_H_
50
51#include "cl1frevtid.h"
52#include "kal_public_api.h"
53#include "kal_hrt_api.h"
54#include "intrCtrl.h"
55#include "c2k_defs.h"
56#ifndef MTK_PLT_ON_PC
57#ifdef __MD93__
58#define IRQ_C2K_FR_FH_SWI_CODE IRQ_SW_LISR15_CODE
59#elif defined (__MD95__)
60#define IRQ_C2K_FR_FH_SWI_CODE IRQ_SW_LISR8_CODE
61#else
62#define IRQ_C2K_FR_FH_SWI_CODE IRQ_SW_LISR8_CODE
63#endif
64
65#endif
66
67/* Frame tick related */
68typedef enum
69{
70 NORMAL_DOMAIN,
71 FRAMETICK_REGULAR,
72 FRAMETICK_HSC = FRAMETICK_REGULAR,
73 FRAMETICK_L1D,
74 FRAMETICK_RMC,
75 FRAMEHANDLER_IN_SWI,
76 FRAMEHANDLER_IN_PCGSLOT,
77 PCG_IRQ,
78 SLOT_IRQ,
79 RCPRI_IRQ,
80 OTHER_IRQ,
81
82 FR_MOD_MAX_NUM
83} FrModuleT;
84
85#if (CUR_GEN>=MD_GEN95)
86/*Running IRQ LISR location*/
87typedef enum
88{
89 LOC_HWD_WAKE_DO_LISR,
90 LOC_SYS_DO_SLOT_LISR,
91 LOC_SYS_DO_HALF_SLOT_LISR,
92 LOC_SYS_DO_HALF_SLOT_LISR_2,
93 LOC_FRAME_HANDLER_SWI_LISR,
94 LOC_SYS_FTIMER_DO_LISR,
95 LOC_LISR_RUN_MAX_NUM
96} IrqLisrRunT;
97#endif
98
99
100typedef struct
101{
102 kal_bool UseDm;
103 kal_bool Processed;
104 kal_uint16 EvtId;
105 kal_uint16 EvtLength; /* In byte */
106 kal_uint32 TimeStamp; /* In FRC */
107 kal_uint8* DataPtr;
108} EvtDataT;
109
110#define M_Fr2ByteAlign(x) ((((x) + 1) >> 1) << 1)
111#define M_Fr4ByteAlign(x) ((((x) + 3) >> 2) << 2)
112
113
114#define M_SetShOngoingFlag(Interface) {gShOngoing[Interface] = KAL_TRUE;}
115#define M_ClrShOngoingFlag(Interface) {gShOngoing[Interface] = KAL_FALSE;}
116#define M_IsShOngoing(Interface) (gShOngoing[Interface] == KAL_TRUE)
117
118
119extern kal_uint32 gSwiBitmap;
120extern kal_bool gShOngoing[SYS_MODE_MAX];
121extern kal_uint32 gFhSwiOwnerBitmap;
122
123extern void FrSendEvent(FrModuleT Src, FrModuleT Dest, FrEvtIdT EvtId, kal_bool UseDm, kal_uint8* DataPtr, kal_uint16 Length);
124extern void __FrIrqSendMsg(FrModuleT Src, module_type DestMod, msg_type MsgId, kal_bool UseDm, kal_uint8* DataPtr, kal_uint16 Length);
125extern void FrEventExecutor(FrModuleT Execution);
126extern void FrFhSwiEventExecutor(void);
127extern void FrFhSwiTrigger(SysAirInterfaceT Mode);
128extern void FrSwiTriggerHisr(void);
129extern void FrFhMsgDeliverHisr(void);
130extern void FrShMsgDeliverHisr(void);
131extern void FrRrMsgDeliverHisr(void);
132extern kal_bool FrEvtQueueEmpty(FrModuleT Module);
133extern kal_bool FrMsgQueueEmpty(FrModuleT Module);
134extern kal_bool FrAllQueueEmpty(void);
135
136#if (CUR_GEN>=MD_GEN95)
137extern void FrSamePrioIRQProcess(kal_bool mask,IrqLisrRunT IrqLisrRunLoc);
138#endif
139
140/* 2Bytes alignment is to make sure sizeof(XXX_msg_struct)=sizeof(LOCAL_PARA_HDR)+sizeof(msg),
141 because LOCAL_PARA_HDR has a uint16 item, sizeof(XXX_msg_struct) must be even number.
142 if the sizeof(msg) is odd, the equation is not fullfilled.
143*/
144#define FrIrqSendMsg(Src, DestMod, MsgId, UseDm, DataPtr, Length) \
145 __FrIrqSendMsg(Src, DestMod, MsgId, UseDm, DataPtr, M_Fr2ByteAlign(Length))
146
147#endif
148
149/*****************************************************************************
150* End of File
151*****************************************************************************/
152