blob: d53c4f337877a066ec4866354e6a1a02cb241083 [file] [log] [blame]
rjw6c1fd8f2022-11-30 14:33:01 +08001/*****************************************************************************
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* This Software is the property of VIA Telecom, Inc. and may only be used pursuant to a license from VIA Telecom, Inc.
38*
39* Any unauthorized use inconsistent with the terms of such license is strictly prohibited.
40*
41* Copyright (c) 1998-2010 VIA Telecom, Inc. All rights reserved.
42*
43*************************************************************/
44#ifndef SYSDEFS_H
45#define SYSDEFS_H
46#include "kal_public_defs.h"
47#include "c2k_defs.h"
48#include "svc_sap.h"
49/*****************************************************************************
50
51 FILE NAME: sysdefs.h
52
53 DESCRIPTION:
54
55 This include file provides system wide global type declarations and
56 constants.
57
58*****************************************************************************/
59
60/*---------------------------------------------------------------------
61* The structure ExeRspMsgT is used in the command-response paradigm
62* for many of the tasks.
63*---------------------------------------------------------------------*/
64
65
66#define HWD_RF_SUB_CLASS_0_SUPPORTED (1<<31)
67#define HWD_RF_SUB_CLASS_1_SUPPORTED (1<<30)
68#define HWD_RF_SUB_CLASS_2_SUPPORTED (1<<29)
69#define HWD_RF_SUB_CLASS_3_SUPPORTED (1<<28)
70#define HWD_RF_SUB_CLASS_4_SUPPORTED (1<<27)
71#define HWD_RF_SUB_CLASS_5_SUPPORTED (1<<26)
72#define HWD_RF_SUB_CLASS_6_SUPPORTED (1<<25)
73#define HWD_RF_SUB_CLASS_7_SUPPORTED (1<<24)
74#define HWD_RF_SUB_CLASS_8_SUPPORTED (1<<23)
75#define HWD_RF_SUB_CLASS_9_SUPPORTED (1<<22)
76#define HWD_RF_SUB_CLASS_10_SUPPORTED (1<<21)
77#define HWD_RF_SUB_CLASS_11_SUPPORTED (1<<20)
78#define HWD_RF_SUB_CLASS_12_SUPPORTED (1<<19)
79#define HWD_RF_SUB_CLASS_13_SUPPORTED (1<<18)
80#define HWD_RF_SUB_CLASS_14_SUPPORTED (1<<17)
81#define HWD_RF_SUB_CLASS_15_SUPPORTED (1<<16)
82
83#define HWD_RF_SUB_CLASS_0_UNSUPPORTED (0<<31)
84#define HWD_RF_SUB_CLASS_1_UNSUPPORTED (0<<30)
85#define HWD_RF_SUB_CLASS_2_UNSUPPORTED (0<<29)
86#define HWD_RF_SUB_CLASS_3_UNSUPPORTED (0<<28)
87#define HWD_RF_SUB_CLASS_4_UNSUPPORTED (0<<27)
88#define HWD_RF_SUB_CLASS_5_UNSUPPORTED (0<<26)
89#define HWD_RF_SUB_CLASS_6_UNSUPPORTED (0<<25)
90#define HWD_RF_SUB_CLASS_7_UNSUPPORTED (0<<24)
91#define HWD_RF_SUB_CLASS_8_UNSUPPORTED (0<<23)
92#define HWD_RF_SUB_CLASS_9_UNSUPPORTED (0<<22)
93#define HWD_RF_SUB_CLASS_10_UNSUPPORTED (0<<21)
94#define HWD_RF_SUB_CLASS_11_UNSUPPORTED (0<<20)
95#define HWD_RF_SUB_CLASS_12_UNSUPPORTED (0<<19)
96#define HWD_RF_SUB_CLASS_13_UNSUPPORTED (0<<18)
97#define HWD_RF_SUB_CLASS_14_UNSUPPORTED (0<<17)
98#define HWD_RF_SUB_CLASS_15_UNSUPPORTED (0<<16)
99
100
101#define HWD_ST_SYMB_NUM_MASK_26MS 0x000001FF
102#define HWD_ST_SYMB_NUM_MASK 0x000007FF
103
104/* System time interrupt mask definitions */
105#define HWD_FRAME_CNT_INT_MASK 0x0001 /* Frame counter mask */
106
107#ifdef MTK_PLT_ON_PC
108#ifdef MTK_DEV_93M_PREIT
109#define HWD_R_MDGPTM_CODA_VERSION (0xBF2A0000)
110#define HWD_R_MDGPTM_CNT_VALUE1 (0xBF2A0010)
111#define HWD_R_MDGPTM_PRESCALE1 (0xBF2A0014)
112#define HWD_R_MDGPTM_CTRL1 (0xBF2A0018)
113#define HWD_R_MDGPTM_DATA1 (0xBF2A001C)
114#define HWD_R_MDGPTM_CNT_VALUE2 (0xBF2A0020)
115#define HWD_R_MDGPTM_PRESCALE2 (0xBF2A0024)
116#define HWD_R_MDGPTM_CTRL2 (0xBF2A0028)
117#define HWD_R_MDGPTM_DATA2 (0xBF2A002C)
118#define HWD_R_DELAY_TIMER1_CTRL (0xAAAA0000)
119#define HWD_R_DELAY_TIMER1_DELAY (0xAAAA0004)
120#define HWD_R_DELAY_TIMER2_CTRL (0xAAAA0008)
121#define HWD_R_DELAY_TIMER2_DELAY (0xAAAA000C)
122#define HWD_R_DELAY_TIMER3_CTRL (0xAAAA0010)
123#define HWD_R_DELAY_TIMER3_DELAY (0xAAAA0014)
124#define HWD_R_DELAY_TIMER4_CTRL (0xAAAA0018)
125#define HWD_R_DELAY_TIMER4_DELAY (0xAAAA001C)
126#define HWD_R_DELAY_TIMER5_CTRL (0xAAAA0020)
127#define HWD_R_DELAY_TIMER5_DELAY (0xAAAA0024)
128
129/* Bit0: FR_FH_SWI,
130 Bit1: DO_CRP_SWI,
131 Bit2: BACKUP_SWI */
132#define HWD_SWI_TRIGGER (0xBFFF0000)
133
134#define FR_FH_SWI_ENABLE (1U << 0)
135#define DO_RCP_SWI_ENABLE (1U << 1)
136#define BACKUP_SWI_ENABLE (1U << 2)
137
138#define FRC_VAL_R (0xA00D0830)
139#define FRC_VAL_R_H (0xA00D0834)
140
141#endif
142#endif
143
144
145typedef struct
146{
147 module_type dest_mod_id; /* Destination module ID of response message */
148 kal_uint32 MsgId;
149}ExeRspMsgT;
150
151typedef kal_uint32 HwdRegT;
152/*-----------------**
153** Register Access **
154**-----------------*/
155#if defined (SIM_MT6280) && defined (MTK_PLT_ON_PC_IT) && !defined (GEN_FOR_PC)
156#include "simul_public.h"
157#elif defined (MTK_PLT_ON_PC)
158// Include the software model
159// Note: Included here as the HwdRegT type above needs to be defined.
160#include "c2k_dma_model_api.h"
161#endif
162
163#ifdef MTK_PLT_ON_PC
164#if defined (MTK_PLT_ON_PC_IT) && defined (SIM_MT6280)
165 #define HwdWrite(REG, VAL) HW_WRITE(((volatile int*)REG),VAL)
166 #define HW_WRITE(ptr,data) RegSimSimulateWrite( (int)(ptr), (data), sizeof(*(ptr)), __FILE__, __LINE__ )
167#else
168 #define HwdWrite(Reg, Data) hwd_write((HwdRegT)(Reg), Data)
169#endif
170#else
171 #define HwdWrite(Reg, Data) \
172 *((volatile HwdRegT*) (Reg)) = (Data)
173#endif
174
175
176#if defined MTK_PLT_ON_PC
177#if defined (MTK_PLT_ON_PC_IT) && defined (SIM_MT6280)
178 #define HwdRead(REG) HW_READ(((volatile int*)REG))
179 #define HW_READ(ptr) RegSimSimulateRead( (int)(ptr), sizeof(*(ptr)), __FILE__, __LINE__ )
180#else
181 #define HwdRead(Reg) hwd_read((HwdRegT)(Reg))
182#endif
183#else
184 #define HwdRead(Reg) \
185 (*((volatile kal_uint16*) (Reg)))
186#endif
187
188#undef HwdClearBit32
189#ifdef MTK_PLT_ON_PC
190#define HwdClearBit32( Reg, BitMask ) hwd_clear_bit((HwdRegT)Reg, BitMask)
191#else
192#define HwdClearBit32( Reg, BitMask ) \
193 *( (volatile kal_uint32 *)(Reg) ) = *((volatile kal_uint32 *)(Reg)) & ~((kal_uint32)(BitMask))
194#endif
195
196#undef HwdClearBit16
197#ifdef MTK_PLT_ON_PC
198#define HwdClearBit16( Reg, BitMask ) hwd_clear_bit(Reg, BitMask)
199#else
200#define HwdClearBit16( Reg, BitMask ) \
201 *( (volatile kal_uint16 *)(Reg) ) = *((volatile kal_uint16 *)(Reg)) & ~((kal_uint16)(BitMask))
202#endif
203
204#undef HwdClearBit8
205#ifdef MTK_PLT_ON_PC
206#define HwdClearBit8( Reg, BitMask ) hwd_clear_bit(Reg, BitMask)
207#else
208#define HwdClearBit8( Reg, BitMask ) \
209 *( (volatile kal_uint8 *)(Reg) ) = *((volatile kal_uint8 *)(Reg)) & ~((kal_uint8)(BitMask))
210#endif
211
212 /* 32-Bit Register MACROS - used by USB */
213#undef HwdWrite32
214#ifdef MTK_PLT_ON_PC
215#define HwdWrite32(Reg, Data) hwd_write_32((HwdRegT)(Reg), Data)
216#else
217#define HwdWrite32(Reg, Data) \
218 *((volatile kal_uint32*)(Reg)) = (kal_uint32)(Data)
219#endif
220
221#undef HwdRead32
222#if defined MTK_PLT_ON_PC
223#if defined (MTK_PLT_ON_PC_IT) && defined (SIM_MT6280)
224#define HwdRead32(REG) hwd_read_32((HwdRegT)(REG))
225#else
226#define HwdRead32(Reg) hwd_read_32((HwdRegT)(Reg))
227#endif
228#else
229#define HwdRead32(Reg) \
230 (*((volatile kal_uint32*) (Reg)))
231#endif
232
233#undef HwdSetBit32
234#ifdef MTK_PLT_ON_PC
235#define HwdSetBit32( Reg, BitMask ) hwd_set_bit_32((HwdRegT)Reg, BitMask)
236#else
237#define HwdSetBit32( Reg, BitMask ) \
238 *( (volatile kal_uint32 *)(Reg) ) = *((volatile kal_uint32 *)(Reg)) | ((kal_uint32)(BitMask))
239#endif
240
241#undef HwdResetBit32
242#ifdef MTK_PLT_ON_PC
243#define HwdResetBit32( Reg, BitMask ) hwd_reset_bit_32(Reg, BitMask)
244#else
245#define HwdResetBit32( Reg, BitMask ) \
246 *((volatile kal_uint32 *)(Reg)) = *((volatile kal_uint32 *)(Reg)) & ~((kal_uint32)(BitMask))
247#endif
248
249 /* 16-Bit Register MACROS */
250#undef HwdWrite16
251#ifdef MTK_PLT_ON_PC
252#define HwdWrite16(Reg, Data) hwd_write_16(Reg, Data)
253#else
254#define HwdWrite16(Reg, Data) \
255 *((volatile kal_uint16*) (Reg)) = (Data)
256#endif
257
258#undef HwdRead16
259#ifdef MTK_PLT_ON_PC
260#if defined (MTK_PLT_ON_PC_IT) && defined (SIM_MT6280)
261#define HwdRead16(rEG) (kal_int16)(HW_READ((volatile kal_uint32*)rEG) & 0xffff)
262#else
263#define HwdRead16(rEG) hwd_read_16(rEG)
264#endif
265#else
266#define HwdRead16(Reg) \
267 (*((volatile kal_uint16*) (Reg)))
268#endif
269
270#undef HwdSetBit16
271#ifdef MTK_PLT_ON_PC
272#define HwdSetBit16( Reg, BitMask ) hwd_set_bit_16(Reg, BitMask)
273#else
274#define HwdSetBit16( Reg, BitMask ) \
275 *( (volatile kal_uint16 *)(Reg) ) = *((volatile kal_uint16 *)(Reg)) | ((kal_uint16)(BitMask))
276#endif
277
278#undef HwdResetBit16
279#ifdef MTK_PLT_ON_PC
280#define HwdResetBit16( Reg, BitMask ) hwd_reset_bit_16(Reg, BitMask)
281#else
282#define HwdResetBit16( Reg, BitMask ) \
283 *((volatile kal_uint16 *)(Reg)) = *((volatile kal_uint16 *)(Reg)) & ~((kal_uint16)(BitMask))
284#endif
285
286
287 /* 8-Bit Register MACROS - used by EBI */
288#undef HwdWrite8
289#ifdef MTK_PLT_ON_PC
290#define HwdWrite8(Reg, Data) hwd_write_8(Reg, Data)
291#else
292#define HwdWrite8(Reg, Data) \
293 *((volatile kal_uint8*) (Reg)) = (Data)
294#endif
295
296#undef HwdRead8
297#ifdef MTK_PLT_ON_PC
298#define HwdRead8(Reg) hwd_read_8(Reg)
299#else
300#define HwdRead8(Reg) \
301 (*((volatile kal_uint8*) (Reg)))
302#endif
303
304#undef HwdSetBit8
305#ifdef MTK_PLT_ON_PC
306#define HwdSetBit8( Reg, BitMask ) hwd_set_bit_8(Reg, BitMask)
307#else
308#define HwdSetBit8( Reg, BitMask ) \
309 *( (volatile kal_uint8 *)(Reg) ) = *((volatile kal_uint8 *)(Reg)) | ((kal_uint8)(BitMask))
310#endif
311
312#undef HwdResetBit8
313#ifdef MTK_PLT_ON_PC
314#define HwdResetBit8( Reg, BitMask ) hwd_reset_bit_8(Reg, BitMask)
315#else
316#define HwdResetBit8( Reg, BitMask ) \
317 *((volatile kal_uint8 *)(Reg)) = *((volatile kal_uint8 *)(Reg)) & ~((kal_uint8)(BitMask))
318#endif
319/*--------------------------------------------------------------------
320* Define system wide data types
321*--------------------------------------------------------------------*/
322
323#if defined (MTK_PLT_ON_PC)
324#define __func__ "func not known"
325#endif
326#define __MODULE__ __FILE__
327
328
329#include "ottsdefs.h"
330
331typedef double DOUBLE; /* Double precision IEEE */
332
333#define CONST const
334#define ROM
335
336#define YES KAL_TRUE
337#define NO KAL_FALSE
338
339#define PASS 1
340#define FAIL 0
341
342/* A NULL value is required such that it is not mistaken for a valid */
343/* value which includes values in the range of modulo 64. */
344#define NULL_VAL 0xFF
345
346#define ENABLED KAL_TRUE
347#define DISABLED KAL_FALSE
348
349#ifndef BIT0
350#define BIT0 0x01
351#define BIT1 0x02
352#define BIT2 0x04
353#define BIT3 0x08
354#define BIT4 0x10
355#define BIT5 0x20
356#define BIT6 0x40
357#define BIT7 0x80
358#define BIT8 0x100
359#define BIT9 0x200
360#define BIT10 0x400
361#define BIT11 0x800
362#define BIT12 0x1000
363#define BIT13 0x2000
364#define BIT14 0x4000
365#define BIT15 0x8000
366#define BIT16 0x10000UL
367#define BIT17 0x20000UL
368#define BIT18 0x40000UL
369#define BIT19 0x80000UL
370#define BIT20 0x100000UL
371#define BIT21 0x200000UL
372#define BIT22 0x400000UL
373#define BIT23 0x800000UL
374#define BIT24 0x1000000UL
375#define BIT25 0x2000000UL
376#define BIT26 0x4000000UL
377#define BIT27 0x8000000UL
378#define BIT28 0x10000000UL
379#define BIT29 0x20000000UL
380#define BIT30 0x40000000UL
381#define BIT31 0x80000000UL
382#endif
383
384typedef enum
385{
386 HWD_ENABLE = 0,
387 HWD_DISABLE,
388 HWD_LOAD
389} HwdCtrlModeT;
390
391/* Min and Max macros.
392 */
393#ifndef MTK_PLT_ON_PC
394#ifndef L1_SIM
395#ifndef max
396#define max(x,y) (((x) > (y)) ? (x) : (y))
397#endif /* max */
398
399#ifndef min
400#define min(x,y) (((x) > (y)) ? (y) : (x))
401#endif /* min */
402#endif
403#endif
404
405#ifndef MAX
406#define MAX(x,y) (((x) > (y)) ? (x) : (y))
407#endif
408
409#ifndef MIN
410#define MIN(x,y) (((x) < (y)) ? (x) : (y))
411#endif
412
413/* legacy SE1 HISRs */
414#define FMP_HW_SLOT_FOUND_HISR DOSF_DO_SLOT_FOUND_HISR
415
416#endif
417/**Log information: \main\CBP80\cbp80_cshen_scbp10098\1 2012-07-26 06:27:47 GMT cshen
418** cbp80_cshen_scbp10098**/