blob: 122929a481648a7d15c6a34b5563af9d5d35b999 [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) 2008-2010 VIA Telecom, Inc. All rights reserved.
42*
43*************************************************************/
44/*****************************************************************************
45*
46* FILE NAME : rtmqos.h
47*
48* DESCRIPTION : This file contains function prototypes and other definitions
49* for the RCP RTM QOS component
50*
51*
52* HISTORY :
53* See Log at end of file
54*
55*****************************************************************************/
56
57/*----------------------------------------------------------------------------
58* Include Files
59----------------------------------------------------------------------------*/
60#ifndef _RTM_QOS_H_
61#define _RTM_QOS_H_
62
63#include "rtm.h"
64#include "sysdefs.h"
65#include "do_rcpapi.h"
66#include "do_rtmapi.h"
67#define RTM_QOS_SPY_SUBFR_NO 3
68
69/* Internal Data for each MAC flow */
70typedef struct
71{
72 kal_int32 t2POutflow; /* Q8 */ /* 0 ~ 2000 */
73 kal_int32 deltaT2PInflow; /* Q8 */ /* -1000~1000 : -32 to 31.75 dB */
74 kal_uint32 potentialT2POutflowHC; /* Q8 */ /* 0~1000000 */
75 kal_uint32 potentialT2POutflowLL; /* Q8 */ /* 0~1000000 */
76 kal_uint16 queueOutflowHC; /* suppose max 32788 bytes */
77 kal_uint16 queueOutflowLL; /* suppose max 32788 bytes */
78 kal_bool setF;
79 /* for real time mode selection */
80 kal_bool setFLL[(RTM_MAX_REV_RATE_PHY2-1)];
81 kal_uint8 qrab;
82} MfcFlowDataT;
83
84/* Internal common Data for MAC flow - temporal parameter in RTM QOS module */
85typedef struct
86{
87 kal_int8 rN; /* -255~255 (-1 to 1) signed Q7 */
88 kal_uint8 TMmin;
89 kal_uint32 txT2P; /* Q8 */ /* 0~1000 */ /* output to Tx Pwr ctrl */
90 kal_uint32 sumQueueOutflow; /* 32 * max 32788 bytes */
91 kal_int16 pilotStrength[SYS_CP_MAX_NUM_TC_ACTIVE_PILOTS]; /* Q2 dB */
92 kal_int8 frab; /* signed Q7 */ /* Soft value FRABn */
93} MfcCommonDataT;
94
95/* Stored Data - data should be saved for next packet calculation */
96typedef struct
97{
98 kal_uint8 lastBucketLevelMax[MAX_MAC_FLOW_NUM]; /* 0:NULL, 1~255: 0 to 63.5 dB per 0.25dB unit */
99 kal_int32 t2PInflow[MAX_MAC_FLOW_NUM]; /* Q8 */ /* -1000000~1000000 : 0 to 63.5 dB */
100 kal_int32 bucketLevel[MAX_MAC_FLOW_NUM]; /* Q8->Q6 to avoid overflow */ /* -1000000~1000000 : 0 to 63.5 dB */
101 kal_int32 bucketLevelSat[MAX_MAC_FLOW_NUM]; /* Q8->Q6 to avoid overflow */ /* -1000000~1000000 : 0 to 63.5 dB */
102 kal_uint8 tT2PHold[MAX_MAC_FLOW_NUM]; /* 0 to 15 frames for n-1 */
103
104 /* 0x0~0x80 (0~32dB per 0.25dB) unsigned Q2 */
105 kal_uint8 txT2PHiCap[(RTM_MAX_REV_RATE_PHY2-1)][ MAX_SUB_PACKET_NUM]; /* Q2 */
106 /* 8bits (0 to 0x80, 0~32dB per 0.25 dB), unsigned Q2;default: 0x3,0xf¡¦. */
107 kal_uint8 txT2PLoLat[(RTM_MAX_REV_RATE_PHY2-1)][ MAX_SUB_PACKET_NUM]; /* Q2 */
108 /* 8bits (0 to 0x80, 0~32dB per 0.25 dB), unsigned Q2;default: 0x3,0xf¡¦. */
109 kal_uint8 txT2PHiCapNominal[(RTM_MAX_REV_RATE_PHY2-1)]; /* Q2 */
110 /* 0x0~0x80 (0~32dB per 0.25dB) unsigned Q2 */
111 kal_uint8 txT2PLoLatNominal[(RTM_MAX_REV_RATE_PHY2-1)]; /* Q2 */
112 /* 0x0~0x80 (0~32dB per 0.25dB) unsigned Q2 */
113 kal_uint16 t2PConversionFactorHC; /* Q8 */ /* 0~1536 */
114 kal_uint16 t2PConversionFactorLL; /* Q8 */ /* 0~1536 */
115 kal_int32 bucketFactor[MAX_MAC_FLOW_NUM]; /* Q8 */ /* 0~1000000 : 0 to 63.5 dB */
116 /* bucketFactor_interpolation(linearTodB10(MfcStoredData.t2PInflow[i]), MfcIn->frab, i) * MfcStoredData.t2PInflow[i]) ); */
117 kal_uint32 txT2PHiCapNominalLinear[(RTM_MAX_REV_RATE_PHY2-1)]; /* Q8 */
118 /* 0x0~0x80 (0~32dB per 0.25dB) unsigned Q2 */
119 kal_uint32 txT2PLoLatNominalLinear[(RTM_MAX_REV_RATE_PHY2-1)]; /* Q8 */
120 /* 0x0~0x80 (0~32dB per 0.25dB) unsigned Q2 */
121 kal_uint8 t2PHiCapNominalTransition[(RTM_MAX_REV_RATE_PHY2-1)]; /* Q2 */
122 /* 8bits (0 to 0x80, 0~32dB per 0.25 dB), unsigned Q2;default: 0x1c,0x28¡¦. */
123 kal_uint8 t2PLoLatNominalTransition[(RTM_MAX_REV_RATE_PHY2-1)]; /* Q2 */
124 /* 8bits (0 to 0x80, 0~32dB per 0.25 dB), unsigned Q2;default: 0x1c,0x28¡¦. */
125 kal_int32 t2PHiCapNominalAuxTransition[(RTM_MAX_REV_RATE_PHY2-1)]; /* Q2 */
126 /* 8bits (0 to 0x80, 0~32dB per 0.25 dB), unsigned Q2;default: 0x1c,0x28¡¦. */
127 kal_int32 t2PLoLatNominalAuxTransition[(RTM_MAX_REV_RATE_PHY2-1)]; /* Q2 */
128 /* 8bits (0 to 0x80, 0~32dB per 0.25 dB), unsigned Q2;default: 0x1c,0x28¡¦. */
129
130 kal_int16 maxTxT2P;
131 /* 0x0~0x80 (0~32dB per 0.25dB) unsigned Q2 */
132
133 kal_int16 availableTxPwr; /* Q7 */
134} MfcStoredDataT;
135
136
137/* Pre-calculated (dB to Linear conversion) Linear Attribute table */
138typedef struct
139{
140 /* T2PInflowRangeNN */
141 kal_uint32 t2PInflowmax[MAX_MAC_FLOW_NUM]; /* Q8 */
142 /* 255:infinite, 0~255 (0~63.5dB/ 0.25dB), unsigned Q2, default :00:0x10,else:0x07 */
143 kal_uint32 t2PInflowmin[MAX_MAC_FLOW_NUM]; /* Q8 */
144 /* 255:infinite, 0~255 (0~63.5dB/ 0.25dB), unsigned Q2, default :00:0x10,else:0x07 */
145 /* BucketLevelMax00/01/NN */
146 kal_int32 bucketLevelMax[MAX_MAC_FLOW_NUM]; /* Q8 */
147 /* 0: NULL, 1~255 (0~63.5 dB per 0.25 dB), unsigned Q2 ; default 00:0x50,01:0x6c,NN:0x00 */
148 /* AuxiliaryPilotChannelParameters */
149 kal_uint32 auxPilotChannelGain; /* Q8 */ /* 4bits, 0 to -15dB per -1dB; default: 0x0c */
150 /* CommonPowerParameters */
151 kal_uint32 txT2Pmin; /* Q8 */ /* 8bits unsigned Q2, 0~255(0~63.75dB per0.25dB); default:0xf */
152 /* RRIChannelPowerParameters */
153 kal_uint32 rRIChannelGainPreTransition[MAX_SUB_PACKET_NUM]; /* Q8 */
154 /* 2'comp 4 bit (-8¡¦7 per 1 dB); default: 0x0,0x0,0xa,0xa */
155 kal_uint32 rRIChannelGainPostTransition[MAX_SUB_PACKET_NUM-1]; /* Q8 */
156 /* 2'comp 4 bit (-8¡¦7 per 1 dB); default: 0xa,0xa,0xa */
157
158 /* prepared data for interpolation */
159 kal_int16 pilotStrengthStrengthAxisSlope[14]; /* Q6 */
160 kal_int16 txT2PmaxPilotStrengthT2PAxisSlope[6]; /* Q7 */
161 kal_int8 pilotStrengthStrengthAxis[15]; /* -8~7 dB per 1dB */
162 kal_int8 T2PTransitionFunctionT2PDnT2PAxisFRABAxis[MAX_MAC_FLOW_NUM][128];
163 /* -128~127(-32¡¦31.75 dB per 0.25 dB), signed Q2 */
164 kal_int8 T2PTransitionFunctionT2PUpT2PAxisFRABAxis[MAX_MAC_FLOW_NUM][128];
165 /* -128~127(-32¡¦31.75 dB per 0.25 dB), signed Q2 */
166 kal_int8 T2PTransitionFunctionFRABAxis[MAX_MAC_FLOW_NUM][8];
167 /* -8~7(-1¡¦7/8), signed Q3 */
168 kal_int8 BucketFactorFRABAxis[MAX_MAC_FLOW_NUM][8];
169 /* -8~7(-1¡¦7/8), signed Q3 */
170
171 kal_int16 T2PTransitionFunctionT2PAxisSlopeConst[MAX_MAC_FLOW_NUM][15]; /* Q12 */
172 /* (1<<16)/T2PTransitionFunctionT2PAxis[index][i]-T2PTransitionFunctionT2PAxis[index][i-1] */
173 kal_int16 T2PTransitionFunctionFRABAxisSlopeConst[MAX_MAC_FLOW_NUM][7]; /* Q11 */
174 /* (1<<16)/T2PTransitionFunctionFRABAxis[index][i]-T2PTransitionFunctionFRABAxis[index][i-1] */
175
176 kal_int16 BucketFactorT2PAxisSlopeConst[MAX_MAC_FLOW_NUM][15]; /* Q12 */
177 /* (1<<16)/BucketFactorT2PAxis[index][i]-BucketFactorT2PAxis[index][i-1] */
178 kal_int16 BucketFactorFRABAxisSlopeConst[MAX_MAC_FLOW_NUM][7]; /* Q11 */
179 /* (1<<16)/BucketFactorFRABAxis[index][i]-BucketFactorFRABAxis[index][i-1] */
180
181} MfcAttributeLinearDataT;
182
183
184#define RAB_UNLOADED_PERIOD 60000 /* 20 sec */ //for signaling conformance test variable
185
186#endif
187