rjw | 6c1fd8f | 2022-11-30 14:33:01 +0800 | [diff] [blame] | 1 | /***************************************************************************** |
| 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 | #ifndef SYSAPI_H |
| 36 | #define SYSAPI_H |
| 37 | /***************************************************************************** |
| 38 | |
| 39 | FILE NAME: sysapi.h |
| 40 | |
| 41 | DESCRIPTION: |
| 42 | |
| 43 | This file contains all the constants, mail message definition and |
| 44 | function prototypes exported by the SYS unit. |
| 45 | |
| 46 | *****************************************************************************/ |
| 47 | |
| 48 | #include "sysdefs.h" |
| 49 | #include "perf_api.h" |
| 50 | |
| 51 | #ifndef GEN_FOR_PC /* Disable for MoDIS CodenGen error */ |
| 52 | /* Define functions normally accessed from the C library */ |
| 53 | #include <string.h> |
| 54 | #include <stdlib.h> |
| 55 | |
| 56 | #endif |
| 57 | |
| 58 | #define SysMemset memset |
| 59 | #define SysMemcpy memcpy |
| 60 | #define SysMemcmp memcmp |
| 61 | #define SysAbs( x ) abs( (x) ) |
| 62 | |
| 63 | #define ALL_ST_INTS_MASK 0xFFFF /* Mask used for all ST interrupt Mask */ |
| 64 | |
| 65 | |
| 66 | #define PAD32(_bytes_) ((((_bytes_) + sizeof(kal_uint32) - 1)/sizeof(kal_uint32)) * sizeof(kal_uint32)) |
| 67 | |
| 68 | /* Define variables used for System Timer interrupts */ |
| 69 | #define ST_CPINT_0 0x0001 |
| 70 | #define ST_CPINT_125 0x0002 |
| 71 | #define ST_CPINT_250 0x0004 |
| 72 | #define ST_CPINT_375 0x0008 |
| 73 | #define ST_CPINT_500 0x0010 |
| 74 | #define ST_CPINT_625 0x0020 |
| 75 | #define ST_CPINT_750 0x0040 |
| 76 | #define ST_CPINT_875 0x0080 |
| 77 | #define ST_CPINT_1000 0x0100 |
| 78 | #define ST_CPINT_1125 0x0200 |
| 79 | #define ST_CPINT_1250 0x0400 |
| 80 | #define ST_CPINT_1375 0x0800 |
| 81 | #define ST_CPINT_1500 0x1000 |
| 82 | #define ST_CPINT_1625 0x2000 |
| 83 | #define ST_CPINT_1750 0x4000 |
| 84 | #define ST_CPINT_1875 0x8000 |
| 85 | |
| 86 | #define ST_CPINT_ALL 0xFFFF |
| 87 | |
| 88 | /* Define variables used for System Timer interrupts for DO*/ |
| 89 | #define ST_DO_CPINT_0 0x0001 |
| 90 | #define ST_DO_CPINT_166 0x0002 |
| 91 | #define ST_DO_CPINT_333 0x0004 |
| 92 | #define ST_DO_CPINT_500 0x0008 |
| 93 | #define ST_DO_CPINT_667 0x0010 |
| 94 | #define ST_DO_CPINT_834 0x0020 |
| 95 | #define ST_DO_CPINT_1001 0x0040 |
| 96 | #define ST_DO_CPINT_1168 0x0080 |
| 97 | #define ST_DO_CPINT_1335 0x0100 |
| 98 | #define ST_DO_CPINT_1502 0x0200 |
| 99 | #define ST_DO_CPINT_1669 0x0400 |
| 100 | #define ST_DO_CPINT_1836 0x0800 |
| 101 | #define ST_DO_CPINT_2003 0x1000 |
| 102 | #define ST_DO_CPINT_2170 0x2000 |
| 103 | #define ST_DO_CPINT_2337 0x4000 |
| 104 | #define ST_DO_CPINT_2504 0x8000 |
| 105 | |
| 106 | #define ST_DO_CPINT_ALL 0xFFFF |
| 107 | |
| 108 | |
| 109 | #define INVALID_SYSTIME_SECS 0xFFFFFFFF |
| 110 | |
| 111 | |
| 112 | #define C2K_INVALID_MODULE_ID 0 |
| 113 | #define C2K_INVALID_MESSAGE_ID 0 |
| 114 | |
| 115 | /*--------------------------------------------------------------- |
| 116 | * Carrier definitions and check for carrier compile options |
| 117 | *----------------------------------------------------------------*/ |
| 118 | /* !!! When adding new carrier extension: !!! */ |
| 119 | /* !!! -update TOTAL_CARRIER_EXTENSIONS check below !!! */ |
| 120 | /* !!! -add carrier to SysCarrierId enum below !!! */ |
| 121 | /* !!! -update function sysGetCarrierdId() in sysutils.c !!! */ |
| 122 | /* !!! -update CarrierFeatureMatrix[][] in function !!! */ |
| 123 | /* !!! sysIsFeatureSupported()in sysutils.c !!! */ |
| 124 | #define TOTAL_CARRIER_EXTENSIONS ( defined(VERIZON_EXTENSIONS) + \ |
| 125 | defined(SPRINT_EXTENSIONS) + \ |
| 126 | defined(LGT_EXTENSIONS) + \ |
| 127 | defined(KDDI_EXTENSIONS) ) |
| 128 | |
| 129 | #if TOTAL_CARRIER_EXTENSIONS > 1 |
| 130 | #error "Multiple carrier extensions(Verizon/Sprint/...) enabled in this build" |
| 131 | #endif |
| 132 | |
| 133 | typedef enum |
| 134 | { |
| 135 | SYS_CARRIER_GENERIC = 0, /* no carrier extension defined */ |
| 136 | SYS_CARRIER_VERIZON, /* VERIZON_EXTENSIONS */ |
| 137 | SYS_CARRIER_SPRINT, /* SPRINT_EXTENSIONS */ |
| 138 | SYS_CARRIER_CHINATELECOM, /* CHINATELECOM_EXTENSIONS */ |
| 139 | SYS_CARRIER_LGT, /* LGT_EXTENSIONS */ |
| 140 | SYS_CARRIER_KDDI, /* KDDI_EXTENSIONS */ |
| 141 | SYS_NUM_CARRIERS |
| 142 | } SysCarrierId; |
| 143 | |
| 144 | /*--------------------------------------------------------------- |
| 145 | * Declare constants and typedefs used for 1x in SysTime.c |
| 146 | *----------------------------------------------------------------*/ |
| 147 | |
| 148 | /* Define interrupt types used in SysIntEnable call */ |
| 149 | typedef enum |
| 150 | { |
| 151 | SYS_FIQ_INT = 0x40, |
| 152 | SYS_IRQ_INT = 0x80, |
| 153 | SYS_ALL_INT = SYS_IRQ_INT | SYS_FIQ_INT |
| 154 | } SysIntT; |
| 155 | |
| 156 | /* structure used for finer system time resolution (36 bits) */ |
| 157 | typedef struct |
| 158 | { |
| 159 | kal_uint32 MostSignificant32Bits; |
| 160 | kal_uint8 LeastSignificant4Bits; |
| 161 | } SysSystemTimeFineT; |
| 162 | |
| 163 | typedef struct |
| 164 | { |
| 165 | kal_bool Immediate; /* do immdediate or at action time */ |
| 166 | SysSystemTimeT Time; /* action time in 20 ms */ |
| 167 | } SysActionTimeT; |
| 168 | |
| 169 | typedef enum |
| 170 | { |
| 171 | SYS_FRAME_SIZE_20MS = 0, |
| 172 | SYS_FRAME_SIZE_26MS = 1 |
| 173 | } SysFrameSizeT; |
| 174 | |
| 175 | typedef enum |
| 176 | { |
| 177 | SYS_TX_SIGNAL_PERIOD_5MS, |
| 178 | SYS_TX_SIGNAL_PERIOD_10MS, |
| 179 | SYS_TX_SIGNAL_PERIOD_20MS |
| 180 | } SysTxSignalPeriodT; |
| 181 | |
| 182 | typedef enum |
| 183 | { |
| 184 | SYS_TX_SIGNAL_START_FRAME_SUBFRAME_0, /* Tx signal starts at 0 ms into 20 ms frame */ |
| 185 | SYS_TX_SIGNAL_START_FRAME_SUBFRAME_1, /* Tx signal starts at 5 ms into 20 ms frame */ |
| 186 | SYS_TX_SIGNAL_START_FRAME_SUBFRAME_2, /* Tx signal starts at 10 ms into 20 ms frame */ |
| 187 | SYS_TX_SIGNAL_START_FRAME_SUBFRAME_3 /* Tx signal starts at 15 ms into 20 ms frame */ |
| 188 | } SysTxSignalStartFrameT; |
| 189 | |
| 190 | |
| 191 | typedef enum |
| 192 | { |
| 193 | SLOT00_NUM = 0x00, /* PCG or Slot 0 */ |
| 194 | SLOT01_NUM, |
| 195 | SLOT02_NUM, |
| 196 | SLOT03_NUM, |
| 197 | SLOT04_NUM, |
| 198 | SLOT05_NUM, |
| 199 | SLOT06_NUM, |
| 200 | SLOT07_NUM, |
| 201 | SLOT08_NUM, |
| 202 | SLOT09_NUM, |
| 203 | SLOT10_NUM, |
| 204 | SLOT11_NUM, |
| 205 | SLOT12_NUM, |
| 206 | SLOT13_NUM, |
| 207 | SLOT14_NUM, |
| 208 | SLOT15_NUM |
| 209 | } SlotMaskNumberT; |
| 210 | |
| 211 | |
| 212 | typedef struct |
| 213 | { |
| 214 | kal_bool Enabled; |
| 215 | kal_uint8 FrameSize; |
| 216 | kal_uint8 Cnt; |
| 217 | kal_uint8 System; |
| 218 | } FreeRunT; |
| 219 | |
| 220 | typedef struct |
| 221 | { |
| 222 | kal_bool ValidCalendarSystemTime; |
| 223 | kal_uint32 Lower32; |
| 224 | kal_uint8 Upper6; |
| 225 | kal_uint8 LpSec; |
| 226 | kal_int8 LtmOff; |
| 227 | kal_bool DayLt; |
| 228 | FreeRunT FreeRun; |
| 229 | } SysTimeDataT; |
| 230 | |
| 231 | typedef struct |
| 232 | { |
| 233 | kal_uint32 Lower32; |
| 234 | kal_uint8 Upper6; |
| 235 | }FullSystemTimeT; |
| 236 | |
| 237 | |
| 238 | typedef struct |
| 239 | { |
| 240 | kal_uint32 Seconds; |
| 241 | kal_uint32 Milliseconds; |
| 242 | } SysCalendarTimeDataT; |
| 243 | |
| 244 | |
| 245 | /*--------------------------------------------------------------- |
| 246 | * Declare constants and typedefs used for DO in SysTime.c |
| 247 | *----------------------------------------------------------------*/ |
| 248 | /* Select the mode when called SysCallbackregister or cancel */ |
| 249 | #define SYS_ACTION_EVENT_MASK 0x1 |
| 250 | #define SYS_ACTION_SLOT_EVENT_MASK 0x2 |
| 251 | #define SYS_PERIODIC_SLOT_EVENT_MASK 0x4 |
| 252 | typedef enum |
| 253 | { /* bit 0 = 0: slot event |
| 254 | bit 0 = 1: action event |
| 255 | bit 1 = 1: action slot event |
| 256 | bit 2 = 0: single event |
| 257 | bit 2 = 1: periodic event |
| 258 | */ |
| 259 | ACTION_EVENT = SYS_ACTION_EVENT_MASK, |
| 260 | ACTION_SLOT_EVENT = (SYS_ACTION_EVENT_MASK | SYS_ACTION_SLOT_EVENT_MASK), |
| 261 | SLOT_EVENT = 0, |
| 262 | PERIODIC_SLOT_EVENT = SYS_PERIODIC_SLOT_EVENT_MASK, |
| 263 | ACTION_PERIODIC_SLOT_EVENT = (ACTION_SLOT_EVENT | SYS_PERIODIC_SLOT_EVENT_MASK) |
| 264 | } SysEventTypeT; |
| 265 | |
| 266 | typedef enum |
| 267 | { |
| 268 | SINGLE_PCG_EVENT = SLOT_EVENT, |
| 269 | PERIODIC_PCG_EVENT = PERIODIC_SLOT_EVENT |
| 270 | } PcgEventTypeT; |
| 271 | #define SINGLE_SLOT_EVENT SLOT_EVENT |
| 272 | |
| 273 | /* For Tag Type */ |
| 274 | #define SYS_TAG_FRMOFT_ADJ_MASK 0x8 /* FrameOffset adjust flag, bit 3: 0 = Offset not yet adjusted, 1 = FrameOffset adjusted */ |
| 275 | #define SYS_TAG_FRMOFT_MASK 0x4 /* FrameOffset, bit 2: 0 = No Offset, 1 = FrameOffset */ |
| 276 | #define SYS_TAG_KEEP_MASK 0x2 /* Flush or Keep, bit 1: 0 = Flush Q, 1 = Keep Q */ |
| 277 | #define SYS_TAG_MODE_MASK 0x1 /* AirInterface, bit 0: 0 = 1xRTT, 1 = EVDO */ |
| 278 | typedef enum |
| 279 | { |
| 280 | FLUSH_QUEUE_1X = 0, /* b000 */ |
| 281 | FLUSH_QUEUE_DO = 1, /* b001 */ |
| 282 | KEEP_QUEUE_1X = 2, /* b010 */ |
| 283 | KEEP_QUEUE_DO = 3, /* b011 */ |
| 284 | OFT_FLUSH_QUEUE_DO = 5, /* b101 */ |
| 285 | OFT_KEEP_QUEUE_DO = 7 /* b111 */ |
| 286 | } SysTagTypeT; |
| 287 | |
| 288 | /* Define Tracking Frame Counter based, according 1X and DO Frame counter */ |
| 289 | typedef struct |
| 290 | { |
| 291 | kal_uint32 Lower32; /* Lower 32 bit */ |
| 292 | kal_uint8 Upper6; /* Upper 6 bit */ |
| 293 | } FrameRecT; |
| 294 | |
| 295 | /* The system time definition in echip level. */ |
| 296 | typedef struct |
| 297 | { |
| 298 | kal_uint64 SuperFrame; /* The superframe in 80ms unit. */ |
| 299 | kal_uint32 Chip8xOffset; /* Offset to 80ms frame boundary, in unit of 1/8 chip. */ |
| 300 | } SysSFrameTimeT; |
| 301 | |
| 302 | |
| 303 | typedef struct |
| 304 | { |
| 305 | kal_uint32 Lower32; |
| 306 | kal_uint8 Upper6; |
| 307 | kal_int8 Subframe; |
| 308 | kal_int8 Slot; |
| 309 | kal_int16 SymbNum; |
| 310 | } SysTimeFullT; |
| 311 | |
| 312 | |
| 313 | /* For Transition from 1x to do or vise versa */ |
| 314 | #define SYS_TRANS_HW_SWITCH 0x1 |
| 315 | #define SYS_TRANS_DUAL_UPDATE 0x2 |
| 316 | #define SYS_TRANS_TIME_RESET 0x4 |
| 317 | #define SYS_TRANS_TIME_RESYNC 0x8 |
| 318 | typedef enum |
| 319 | { |
| 320 | /* (Time << 2) | (Update << 1) | HW |
| 321 | Time : 0 = Curr, 1 = Reset, 2 = Resync |
| 322 | Update: 0 = SINGLE, 1 = DUAL |
| 323 | HW : 0 = NO, 1 = HW |
| 324 | */ |
| 325 | SYS_TRANS_NO_ACTION = 0, |
| 326 | SYS_TRANS_CURR_SINGLE_HW = 1, /* b0001 */ |
| 327 | SYS_TRANS_RESET_SINGLE_HW = 5, /* b0101 */ |
| 328 | SYS_TRANS_RESET_DUAL_HW = 7, /* b0111 */ |
| 329 | SYS_TRANS_RESYNC_SINGLE_NO = 8, /* b1000 */ |
| 330 | SYS_TRANS_RESYNC_SINGLE_HW = 9, /* b1001 */ |
| 331 | SYS_TRANS_RESYNC_DUAL_HW = 11 /* b1011 */ |
| 332 | } SysTransitionTypeT; |
| 333 | |
| 334 | |
| 335 | /*---------------------------------------------------------------------------------- |
| 336 | * Declare constants and typedefs used for Bondout Option functions in SysBondout.c |
| 337 | *-----------------------------------------------------------------------------------*/ |
| 338 | typedef enum |
| 339 | { |
| 340 | SYS_BONDOUT_EVDOREV0_VOICE, |
| 341 | SYS_BONDOUT_EVDOREV0_NO_VOICE, |
| 342 | SYS_BONDOUT_EVDOREV0A_VOICE, |
| 343 | SYS_BONDOUT_EVDOREV0A_NO_VOICE, |
| 344 | SYS_BONDOUT_VOICE_ONLY |
| 345 | } SysBondoutOptionsT; |
| 346 | |
| 347 | typedef enum |
| 348 | { |
| 349 | SYS_ENH_SYSTEM_SELECT_FEATURE, /* Enhanced System Select with AutoA and AutoB options */ |
| 350 | SYS_ERI_FEATURE, /* Enhanced Roaming Indicator */ |
| 351 | SYS_EXT_SMS_INIT_FEATURE, /* External SMS Initialization */ |
| 352 | SYS_RSVD_ASSIGN_MODE_111_FEATURE,/* Enables IS-95A to specify Rate set 1 or 2 for data calls |
| 353 | using Reserved 111 ASSIGN Mode. */ |
| 354 | SYS_GPS_FEATURE, /* Enhanced GPS HW select with features */ |
| 355 | SYS_ALT_AKEY_CHKSUM_FEATURE, /* Alternate Akey Checksum algorithm */ |
| 356 | |
| 357 | SYS_GPS_SUPL_FEATURE, |
| 358 | |
| 359 | SYS_PRL_ENHANCE_FOR_INT_ROAM_FEATURE, /* PRL Enhancements for International Roaming per CDG 86 */ |
| 360 | |
| 361 | SYS_REGISTRATION_THROTTLING_FEATURE, /* Registration throttling (to avoid draining battery in area |
| 362 | where MS continously fails to register due to Max Access |
| 363 | Probe failures) */ |
| 364 | |
| 365 | SYS_SAFETY_NET_REGISTRATION_FEATURE, /* Feature to perform safety net/fallback registration in |
| 366 | * network conditions that may result in the network not |
| 367 | * knowing the whereabouts of the MS for extended periods. |
| 368 | * Feature needed to compensation for poor network configurations |
| 369 | * seen on the TATA network in India. |
| 370 | */ |
| 371 | |
| 372 | SYS_HSC_CLK_CAL_FAST_SETTLE_FEATURE, /* Feature to be turned on on devices with fast drifting 32k clocks */ |
| 373 | |
| 374 | SYS_HWD_KEYBOARD_FEATURE, /* Hwd Keyboard. */ |
| 375 | |
| 376 | SYS_CSS_1X_MAPE_HOME_SYS_AVOID_FEATURE, /* Home system avoidance upon MAPE registration failure. |
| 377 | Acquire less preferred system if available */ |
| 378 | |
| 379 | SYS_CSS_1X_CDG143_MAPE_SYS_AVOID_FEATURE, /* CDG143 Req. The channel over which access failed is placed last |
| 380 | in the channels list */ |
| 381 | |
| 382 | SYS_CSS_1X_CDG143_REDIR_SYS_AVOID_FEATURE, /* CDG143 Req. If Redirection Scan List is exhausted and return_if_fail is KAL_FALSE, |
| 383 | MS shall avoid the original channel over which the redirection was received for 30 sec. */ |
| 384 | |
| 385 | SYS_CSS_1X_CDG143_REDIR_MPSS_FEATURE, /* CDG143 Req 4.5.5. Perform MPSS after T_bsr_redir when acquiring a less pref. sys. following a |
| 386 | redirection. If no better service found, reacquire the original system from which it got redirected */ |
| 387 | |
| 388 | SYS_CSS_1X_CDG143_CALL_RELEASE_MPSS_FEATURE, /* CDG143 Req 4.2.5b. MS shall perform better service reselection T_bsr_call sec after end of call */ |
| 389 | |
| 390 | SYS_CSS_1X_FINISH_1ST_BSR_B4_DATACALL_FEATURE, /* MS will continue the initial BSR after acquiring a less preferred system |
| 391 | if the user attempts to access the network for a data call */ |
| 392 | |
| 393 | SYS_CSS_1X_FINISH_1ST_BSR_AFTER_POWERUP_FEATURE, /* MS will continue the initial BSR after acquiring a less preferred system |
| 394 | during power up if user attempts calls (except for 911) */ |
| 395 | |
| 396 | SYS_CSS_1X_USE_NAM_FOR_VALIDATION_FEATURE, /* A 1x System not found in the PRL, not negative in NAM but found in the NAM |
| 397 | positive SID NID list will be declared Home and accepted (if PRL pref_only=KAL_FALSE) */ |
| 398 | |
| 399 | SYS_CSS_1X_VOICE_ROAM_BARRING_FEATURE, /* Ability to reject International and or Domestic roaming based on ERI */ |
| 400 | |
| 401 | SYS_CSS_1X_LOST_CHANNEL_DWELL_FEATURE, /* The lost channel will be scanned repeatedly for the duratioon specified */ |
| 402 | /* in Phase 0 of OOSA System Lost Stage => Phase 0 scan method MUST be set to timer based. */ |
| 403 | |
| 404 | SYS_CSS_1X_RESET_GEO_UPON_SYSLOST_FEATURE, /* Upon system lost, the MS will scan from the top of the GEO instead of continuing */ |
| 405 | /* from current index */ |
| 406 | |
| 407 | SYS_CSS_1X_RESTRICT_SILENTRETRY_TO_SAME_GEO_FEATURE, /* Only same Geo Systems will be accepted in Silent Retry state */ |
| 408 | |
| 409 | SYS_CSS_1X_ONLY_REJECT_REDIR_IF_NEG_IN_PRL_FEATURE, /* Reject the redirected system only if found negative in PRL or NAM. */ |
| 410 | /* Non-system table systems will be accepted no matter what */ |
| 411 | |
| 412 | SYS_CSS_1X_ACCEPT_SIDNID_CHANGE_IN_IDLE_FEATURE, /* Do not inititate immediate better service scan in SID NID changes */ |
| 413 | /* as a result of idle channel hash, idle handoff */ |
| 414 | |
| 415 | SYS_CSS_1X_USE_RESTRICTIVE_SIDNID_MATCH_FEATURE, /* When matching an SID/NID in the PRL, use more restrictive SID/NID */ |
| 416 | /* matching using the band class and channel */ |
| 417 | |
| 418 | SYS_CSS_DO_USE_RESTRICTIVE_SUBNET_MATCH_FEATURE, /* Restrictive subnet match feature */ |
| 419 | |
| 420 | SYS_CSS_1X_MPSS_PILOT_STRENGTH_FEATURE, /* During MPSS, higher priority system can only be selected if they meet certain pilot strength criteria*/ |
| 421 | |
| 422 | SYS_CSS_1X_CDG143_NEW_SYS_MPSS_FEATURE, /* CDG143 Req 4.2.6. MS shall perform better service reselection T_bsr_newsys sec after idle handoff or hash to less pref system */ |
| 423 | |
| 424 | SYS_CSS_1X_ALLOW_SILENTRETRY_ON_LOWER_PRI_FEATURE, /* Allow Silent Retry on lower priority systems in same geo. */ |
| 425 | |
| 426 | SYS_MMC_MBIM_API_FEATURE, /* Microsoft MBIM API feature */ |
| 427 | |
| 428 | SYS_MCC_1X_LTE_ASSOCIATION, /* SPRINT carrier requirement */ |
| 429 | |
| 430 | SYS_NUM_FEATURES |
| 431 | } SysFeatureId; |
| 432 | |
| 433 | /* bitmap for Home System avoidance customization */ |
| 434 | typedef enum |
| 435 | { |
| 436 | ALLOW_AVOIDANCE_WHEN_SYS_LOST = 0, |
| 437 | ALLOW_LESS_PREF_SYS_AVOIDANCE, |
| 438 | ALLOW_MPSS_DURING_AVOIDANCE |
| 439 | } SysCssHomeSysAvoidanceOptions; |
| 440 | |
| 441 | /* For C2k ,Define for C2k Sys Recover PREF Info Trace */ |
| 442 | typedef struct |
| 443 | { |
| 444 | module_type module_id; /**Module id which call Sys Recover */ |
| 445 | SysAirInterfaceT cur_c2k_rat; /**Modem Rat which call Sys Recover*/ |
| 446 | kal_uint32 RecoverDbgData[16]; |
| 447 | } C2kSysRecoverDbgInfoT; |
| 448 | |
| 449 | |
| 450 | /***************************************************************************** |
| 451 | |
| 452 | FUNCTION NAME: SysGetCpsrValue |
| 453 | |
| 454 | DESCRIPTION: |
| 455 | |
| 456 | PARAMETERS: |
| 457 | |
| 458 | None |
| 459 | |
| 460 | RETURNED VALUES: |
| 461 | |
| 462 | CPSR Value. |
| 463 | |
| 464 | *****************************************************************************/ |
| 465 | extern kal_uint32 SysGetCpsrValue(void); |
| 466 | |
| 467 | |
| 468 | /***************************************************************************** |
| 469 | |
| 470 | FUNCTION NAME: SysGetSpValue |
| 471 | |
| 472 | DESCRIPTION: |
| 473 | |
| 474 | PARAMETERS: |
| 475 | |
| 476 | None |
| 477 | |
| 478 | RETURNED VALUES: |
| 479 | |
| 480 | SP Value. |
| 481 | |
| 482 | *****************************************************************************/ |
| 483 | extern kal_uint32 SysGetSpValue(void); |
| 484 | |
| 485 | /***************************************************************************** |
| 486 | ; |
| 487 | ; FUNCTION NAME: SysSaveArmRegs |
| 488 | ; |
| 489 | ; DESCRIPTION: |
| 490 | ; |
| 491 | ; Stores the Arm current mode regs (r0~r15 to ArmRegs) |
| 492 | ; |
| 493 | ; This function should only be used during crash dump. |
| 494 | ; |
| 495 | ; C FUNCTION PROTOTYPE: |
| 496 | ; |
| 497 | ; void SysSaveArmRegs(void); |
| 498 | ; |
| 499 | ; PARAMETERS: |
| 500 | ; |
| 501 | ; None |
| 502 | ; |
| 503 | ; RETURNED VALUES: |
| 504 | ; |
| 505 | ; None. |
| 506 | ; |
| 507 | ;*****************************************************************************/ |
| 508 | void SysSaveArmRegs(void); |
| 509 | |
| 510 | /***************************************************************************** |
| 511 | |
| 512 | FUNCTION NAME: SysSaveContextHistory |
| 513 | |
| 514 | DESCRIPTION: |
| 515 | |
| 516 | This routine save NU_Thread_Id and 32k time to ContextHistory array. |
| 517 | It is called by high frequency, so use ASM routine to save time. |
| 518 | |
| 519 | C FUNCTION PROTOTYPE: |
| 520 | |
| 521 | void SysSaveContextHistory(void); |
| 522 | |
| 523 | PARAMETERS: |
| 524 | |
| 525 | None. |
| 526 | |
| 527 | RETURNED VALUES: |
| 528 | |
| 529 | None. |
| 530 | |
| 531 | *****************************************************************************/ |
| 532 | void SysSaveContextHistory(void); |
| 533 | |
| 534 | |
| 535 | /***************************************************************************** |
| 536 | |
| 537 | FUNCTION NAME: SysJumpToCodeAddr |
| 538 | |
| 539 | DESCRIPTION: |
| 540 | |
| 541 | This routine jump to the one code section, boot, cp or UA boot etc. |
| 542 | |
| 543 | PARAMETERS: |
| 544 | |
| 545 | CpAddr: The start address of CP code section. |
| 546 | R6Flag: The flag need to save to R6 |
| 547 | |
| 548 | RETURNED VALUES: |
| 549 | |
| 550 | None |
| 551 | |
| 552 | *****************************************************************************/ |
| 553 | extern void SysJumpToCodeAddr(kal_uint32 CpAddr, kal_uint32 R6Flag); |
| 554 | |
| 555 | extern kal_uint32 SaveAndSetIRQMask(void); |
| 556 | extern void RestoreIRQMask(kal_uint32); |
| 557 | extern kal_uint32 kal_hrt_SaveAndSetIRQMask(void); |
| 558 | extern void kal_hrt_RestoreIRQMask(kal_uint32); |
| 559 | |
| 560 | #define SysIntDisable(IntType) \ |
| 561 | { \ |
| 562 | volatile kal_uint32 M_IntStat; \ |
| 563 | if (kal_get_current_domain() != KAL_DOMAIN_NORMAL) \ |
| 564 | { \ |
| 565 | M_IntStat = kal_hrt_SaveAndSetIRQMask(); \ |
| 566 | } \ |
| 567 | else \ |
| 568 | { \ |
| 569 | M_IntStat = SaveAndSetIRQMask(); \ |
| 570 | } \ |
| 571 | |
| 572 | #define SysIntEnable(IntType) \ |
| 573 | if (kal_get_current_domain() != KAL_DOMAIN_NORMAL) \ |
| 574 | { \ |
| 575 | kal_hrt_RestoreIRQMask(M_IntStat); \ |
| 576 | } \ |
| 577 | else \ |
| 578 | { \ |
| 579 | RestoreIRQMask(M_IntStat); \ |
| 580 | } \ |
| 581 | } |
| 582 | |
| 583 | #define SysIntDisableEnd(IntType) M_IntStat;} |
| 584 | |
| 585 | |
| 586 | /***************************************************************************** |
| 587 | |
| 588 | FUNCTION NAME: SysTimeRegister |
| 589 | |
| 590 | DESCRIPTION: |
| 591 | |
| 592 | This routine registers either a signal OR a call back function associated |
| 593 | with an action time in the system time queue. The system time queue contains an order |
| 594 | list of all action times. |
| 595 | |
| 596 | NOTE: 1. The Routine function pointer MUST be set to NULL to cause a message to be sent. |
| 597 | 2. If this Routine function is called in HRT domain, only be allowed in frame/PCG/slot tick. |
| 598 | |
| 599 | PARAMETERS: |
| 600 | |
| 601 | ActionTime - Action time to insert into the time queue |
| 602 | Module_id - Module ID of task to send signal. |
| 603 | Signal - Signal to send. |
| 604 | Routine - Call back routine when action time is reached |
| 605 | |
| 606 | RETURNED VALUES: |
| 607 | |
| 608 | None. |
| 609 | |
| 610 | *****************************************************************************/ |
| 611 | #ifdef SYS_DEBUG_FAULT_FILE_INFO |
| 612 | #define C2kSysTimeRegister(ActionTime, module_id, message, Routine) \ |
| 613 | __C2kSysTimeRegister(ActionTime, module_id, message, Routine, __MODULE__, __LINE__) |
| 614 | extern void __C2kSysTimeRegister(kal_uint32 ActionTime, module_type module_id, msg_type message, void (*Routine) (kal_uint32), |
| 615 | const char *ModuleName, unsigned line); |
| 616 | #else |
| 617 | extern void C2kSysTimeRegister(kal_uint32 ActionTime, module_type module_id, msg_type message, void (*Routine) (kal_uint32)); |
| 618 | #endif |
| 619 | |
| 620 | |
| 621 | /***************************************************************************** |
| 622 | |
| 623 | FUNCTION NAME: SysTimeRegisterCancel |
| 624 | |
| 625 | DESCRIPTION: |
| 626 | |
| 627 | This routine cancels the signal OR callback that is registered at a specified |
| 628 | action time. |
| 629 | |
| 630 | NOTE: If this Routine function is called in HRT domain, only be allowed in frame/PCG/slot tick. |
| 631 | |
| 632 | PARAMETERS: |
| 633 | |
| 634 | ActionTime - Action time of registered signal to cancel. |
| 635 | Module_id - Module ID of task to send signal. |
| 636 | Signal - Signal to send. |
| 637 | Routine - Call back routine when action time is reached |
| 638 | |
| 639 | RETURNED VALUES: |
| 640 | |
| 641 | kal_boolean flag indicating operation status. |
| 642 | Returns KAL_TRUE if action cancelled successfully. |
| 643 | Returns KAL_FALSE if specified action not found in registration queue. |
| 644 | |
| 645 | Note: Input paramters must match those used when SysTimeRegister was called |
| 646 | originally. |
| 647 | |
| 648 | *****************************************************************************/ |
| 649 | #ifdef SYS_DEBUG_FAULT_FILE_INFO |
| 650 | #define C2kSysTimeRegisterCancel(ActionTime, module_id, message, Routine) \ |
| 651 | __C2kSysTimeRegisterCancel(ActionTime, module_id, message, Routine, __MODULE__, __LINE__) |
| 652 | extern kal_bool __C2kSysTimeRegisterCancel(kal_uint32 ActionTime, module_type module_id, msg_type message, void (*Routine) (kal_uint32), |
| 653 | const char *ModuleName, unsigned line); |
| 654 | #else |
| 655 | extern kal_bool C2kSysTimeRegisterCancel(kal_uint32 ActionTime, module_type module_id, msg_type message, void (*Routine) (kal_uint32)); |
| 656 | #endif |
| 657 | |
| 658 | |
| 659 | |
| 660 | |
| 661 | /***************************************************************************** |
| 662 | |
| 663 | FUNCTION NAME: SysCallbackGroupCancel |
| 664 | |
| 665 | DESCRIPTION: |
| 666 | |
| 667 | This routine cancels all the SLOT_EVENT, ACTION_EVENT, and SLOT_ACTION_EVENT |
| 668 | (basically ALL) callbacks associated with the specified module id and Signal. |
| 669 | |
| 670 | NOTE: If this Routine function is called in HRT domain, only be allowed in frame/PCG/slot tick. |
| 671 | |
| 672 | PARAMETERS: |
| 673 | |
| 674 | Module_id - Module ID of task to send signal. |
| 675 | Signal - Signal to send. |
| 676 | |
| 677 | RETURNED VALUES: |
| 678 | |
| 679 | None. |
| 680 | |
| 681 | *****************************************************************************/ |
| 682 | #ifdef SYS_DEBUG_FAULT_FILE_INFO |
| 683 | #define C2kSysCallbackGroupCancel(AirInterface, module_id, message) \ |
| 684 | __C2kSysCallbackGroupCancel(AirInterface, module_id, message, __MODULE__, __LINE__) |
| 685 | extern void __C2kSysCallbackGroupCancel(SysAirInterfaceT AirInterface, module_type module_id, msg_type message, |
| 686 | const char *ModuleName, unsigned line); |
| 687 | #else |
| 688 | extern void C2kSysCallbackGroupCancel(SysAirInterfaceT AirInterface, module_type module_id, msg_type message); |
| 689 | #endif |
| 690 | |
| 691 | |
| 692 | /***************************************************************************** |
| 693 | |
| 694 | FUNCTION NAME: SysPcgEventRegister |
| 695 | |
| 696 | DESCRIPTION: |
| 697 | |
| 698 | This routine registers either a signal OR a call back function associated |
| 699 | with a PCG trigger with the system timer interrupts. The PCG event queue contains |
| 700 | the number of events based on which PCG is checked. |
| 701 | |
| 702 | NOTE: If this Routine function is called in HRT domain, only be allowed in frame/PCG/slot tick. |
| 703 | |
| 704 | PARAMETERS: |
| 705 | |
| 706 | PcgMask - System Timer event mask to identify which PCG(s) to trigger event |
| 707 | EventType - Continuous periodic or single PCG event types. |
| 708 | Module_id - Module ID of task to send signal. |
| 709 | Signal - Signal to send. |
| 710 | Routine - Call back routine when action time is reached |
| 711 | |
| 712 | RETURNED VALUES: |
| 713 | |
| 714 | None. |
| 715 | |
| 716 | *****************************************************************************/ |
| 717 | #ifdef SYS_DEBUG_FAULT_FILE_INFO |
| 718 | #define C2kSysPcgEventRegister(PcgMask, EventType, module_id, message, Routine) \ |
| 719 | __C2kSysPcgEventRegister(PcgMask, EventType, module_id, message, Routine, __MODULE__, __LINE__) |
| 720 | extern void __C2kSysPcgEventRegister(kal_uint16 PcgMask, PcgEventTypeT EventType, module_type module_id, msg_type message, void (*Routine) (kal_uint32), |
| 721 | const char *ModuleName, unsigned line); |
| 722 | #else |
| 723 | extern void C2kSysPcgEventRegister(kal_uint16 PcgMask, PcgEventTypeT EventType, module_type module_id, msg_type message, void (*Routine) (kal_uint32)); |
| 724 | #endif |
| 725 | |
| 726 | |
| 727 | |
| 728 | /***************************************************************************** |
| 729 | |
| 730 | FUNCTION NAME: SysTimePcgEventRegister |
| 731 | |
| 732 | DESCRIPTION: |
| 733 | |
| 734 | This routine registers either a signal OR a callback function associated |
| 735 | with a PCG trigger at an defined action time. This is done with a special |
| 736 | callback at the set action time which then logs the PCG event in the |
| 737 | appropriate PCG event queue. |
| 738 | |
| 739 | NOTE: If this Routine function is called in HRT domain, only be allowed in frame/PCG/slot tick. |
| 740 | |
| 741 | PARAMETERS: |
| 742 | |
| 743 | ActionTime - Action time to insert PCG event callback routine into the time queue |
| 744 | PcgMask - System Timer event mask to identify which PCG(s) to trigger event |
| 745 | EventType - Continuous periodic or single PCG event types. |
| 746 | Module_id - Module ID of task to send signal. |
| 747 | Signal - Signal to send. |
| 748 | Routine - Call back routine when action time is reached |
| 749 | |
| 750 | RETURNED VALUES: |
| 751 | |
| 752 | None. |
| 753 | |
| 754 | *****************************************************************************/ |
| 755 | #ifdef SYS_DEBUG_FAULT_FILE_INFO |
| 756 | #define C2kSysTimePcgEventRegister(ActionTime, PcgMask, EventType, module_id, message, Routine) \ |
| 757 | __C2kSysTimePcgEventRegister(ActionTime, PcgMask, EventType, module_id, message, Routine, __MODULE__, __LINE__) |
| 758 | extern void __C2kSysTimePcgEventRegister(kal_uint32 ActionTime, kal_uint16 PcgMask, PcgEventTypeT EventType, module_type module_id, msg_type message, void (*Routine) (kal_uint32), |
| 759 | const char *ModuleName, unsigned line); |
| 760 | #else |
| 761 | extern void C2kSysTimePcgEventRegister(kal_uint32 ActionTime, kal_uint16 PcgMask, PcgEventTypeT EventType, module_type module_id, msg_type message, void (*Routine) (kal_uint32)); |
| 762 | #endif |
| 763 | |
| 764 | |
| 765 | /***************************************************************************** |
| 766 | |
| 767 | FUNCTION NAME: SysPcgEventRegisterCancel |
| 768 | |
| 769 | DESCRIPTION: |
| 770 | |
| 771 | This routine cancels the signal OR callback that is registered at a specified |
| 772 | PCG event. |
| 773 | |
| 774 | NOTE: Input parameters must match those used when SysEventRegister was called |
| 775 | originally. This function would normally be used to clear a PCG event which |
| 776 | is generated continuously/periodically - single PCG events clear themselves. |
| 777 | |
| 778 | NOTE: If this Routine function is called in HRT domain, only be allowed in frame/PCG/slot tick. |
| 779 | |
| 780 | PARAMETERS: |
| 781 | |
| 782 | PcgMask - System Timer event mask to identify which PCG(s) to clear event |
| 783 | Module_id - Module ID of task to send signal. |
| 784 | Signal - Signal to send. |
| 785 | Routine - Call back routine when action time is reached |
| 786 | |
| 787 | RETURNED VALUES: |
| 788 | |
| 789 | kal_boolean flag indicating operation status. |
| 790 | Returns KAL_TRUE if action cancelled successfully. |
| 791 | Returns KAL_FALSE if specified action not found in PCG event queue. |
| 792 | |
| 793 | *****************************************************************************/ |
| 794 | #ifdef SYS_DEBUG_FAULT_FILE_INFO |
| 795 | #define C2kSysPcgEventRegisterCancel(PcgMask, module_id, message, Routine) \ |
| 796 | __C2kSysPcgEventRegisterCancel(PcgMask, module_id, message, Routine, __MODULE__, __LINE__) |
| 797 | extern kal_bool __C2kSysPcgEventRegisterCancel(kal_uint16 PcgMask, module_type module_id, msg_type message, void (*Routine) (kal_uint32), |
| 798 | const char *ModuleName, unsigned line); |
| 799 | #else |
| 800 | extern kal_bool C2kSysPcgEventRegisterCancel(kal_uint16 PcgMask, module_type module_id, msg_type message, void (*Routine) (kal_uint32)); |
| 801 | #endif |
| 802 | |
| 803 | |
| 804 | |
| 805 | /***************************************************************************** |
| 806 | |
| 807 | FUNCTION NAME: SysTimeIntReg |
| 808 | |
| 809 | DESCRIPTION: |
| 810 | |
| 811 | This routine register systime related IRQ |
| 812 | |
| 813 | PARAMETERS: |
| 814 | |
| 815 | None. |
| 816 | |
| 817 | RETURNED VALUES: |
| 818 | |
| 819 | None. |
| 820 | |
| 821 | *****************************************************************************/ |
| 822 | |
| 823 | extern void SysTimeIntReg(void); |
| 824 | |
| 825 | |
| 826 | /***************************************************************************** |
| 827 | |
| 828 | FUNCTION NAME: SysTimeGet |
| 829 | |
| 830 | DESCRIPTION: |
| 831 | |
| 832 | Frame number updating in Gen93 is at frame boudary but not like Gen91 at PCG0 IRQ. |
| 833 | |
| 834 | To maintain meaning of this Routine return value, the returned frame number should |
| 835 | consider frame-offset. |
| 836 | |
| 837 | PARAMETERS: |
| 838 | |
| 839 | None. |
| 840 | |
| 841 | RETURNED VALUES: |
| 842 | |
| 843 | kal_uint32 - System time variable is returned. |
| 844 | |
| 845 | *****************************************************************************/ |
| 846 | extern kal_uint32 SysTimeGet(void); |
| 847 | |
| 848 | |
| 849 | /***************************************************************************** |
| 850 | |
| 851 | FUNCTION NAME: SysTimeGetWithoutOffset |
| 852 | |
| 853 | DESCRIPTION: |
| 854 | |
| 855 | This routine gets a copy of the 1X system time variable which is not including |
| 856 | frame-offset. |
| 857 | |
| 858 | PARAMETERS: |
| 859 | |
| 860 | None. |
| 861 | |
| 862 | RETURNED VALUES: |
| 863 | |
| 864 | kal_uint32 - System time variable is returned. |
| 865 | |
| 866 | *****************************************************************************/ |
| 867 | extern kal_uint32 SysTimeGetWoOffset(void); |
| 868 | |
| 869 | |
| 870 | |
| 871 | /***************************************************************************** |
| 872 | |
| 873 | FUNCTION NAME: SysTimeGetFine |
| 874 | |
| 875 | DESCRIPTION: |
| 876 | |
| 877 | This routine returns the current system time with finer resolution, |
| 878 | nominally 1.25 ms resolution. |
| 879 | |
| 880 | PARAMETERS: |
| 881 | |
| 882 | None. |
| 883 | |
| 884 | RETURNED VALUES: |
| 885 | |
| 886 | Structure containing 36 bit resolution system time. |
| 887 | |
| 888 | *****************************************************************************/ |
| 889 | extern SysSystemTimeFineT SysTimeGetFine(void); |
| 890 | |
| 891 | |
| 892 | /***************************************************************************** |
| 893 | |
| 894 | FUNCTION NAME: SysTimeLisr |
| 895 | |
| 896 | DESCRIPTION: |
| 897 | |
| 898 | This routine is the Lisr for system time. It increments |
| 899 | the system time variable and then determines if an action |
| 900 | is equal to the new system time. If so the HISR routine |
| 901 | is activated. |
| 902 | |
| 903 | PARAMETERS: |
| 904 | |
| 905 | StIntSrc - System Time Block Interrupt Source register contents at time of |
| 906 | interrupt. |
| 907 | |
| 908 | RETURNED VALUES: |
| 909 | |
| 910 | None. |
| 911 | |
| 912 | *****************************************************************************/ |
| 913 | extern void SysTimeLisr(kal_uint32 StIntSrc, kal_uint8 AirInterface); |
| 914 | |
| 915 | |
| 916 | /***************************************************************************** |
| 917 | |
| 918 | FUNCTION NAME: SysInit |
| 919 | |
| 920 | DESCRIPTION: |
| 921 | |
| 922 | This routine initializes system time variables. |
| 923 | |
| 924 | PARAMETERS: |
| 925 | |
| 926 | None. |
| 927 | |
| 928 | RETURNED VALUES: |
| 929 | |
| 930 | None. |
| 931 | |
| 932 | *****************************************************************************/ |
| 933 | extern void SysInit(void); |
| 934 | |
| 935 | /***************************************************************************** |
| 936 | |
| 937 | FUNCTION NAME: SysEnableTxSignal |
| 938 | |
| 939 | DESCRIPTION: |
| 940 | |
| 941 | This routine controls the sending of the Tx signal to any tasks registered |
| 942 | using the SysRegisterTxSignal routine. |
| 943 | |
| 944 | |
| 945 | PARAMETERS: |
| 946 | |
| 947 | TxSigPeriod - Sets rate at which Tx signal occurs. |
| 948 | TxSigStartFrame - Sets which sub-20ms frame the first Tx signal occurs in. |
| 949 | Parameter is relative to the 20 ms frame. This is ignored |
| 950 | for a 20 ms frame. Note this is valid for the first Tx |
| 951 | Signal; after the first one interrupts occur at each (sub)frame. |
| 952 | |
| 953 | Note: Tx signal interrupt is configured for a constant number of ms before |
| 954 | the frame. |
| 955 | |
| 956 | |
| 957 | RETURNED VALUES: |
| 958 | |
| 959 | None. |
| 960 | |
| 961 | *****************************************************************************/ |
| 962 | extern void SysEnableTxSignal(SysTxSignalPeriodT TxSigPeriod, |
| 963 | SysTxSignalStartFrameT TxSigStartFrame, |
| 964 | kal_uint8 PcgIdx); |
| 965 | |
| 966 | |
| 967 | |
| 968 | /***************************************************************************** |
| 969 | |
| 970 | FUNCTION NAME: SysDisableTxSignal |
| 971 | |
| 972 | DESCRIPTION: |
| 973 | |
| 974 | This routine disables the sending of the Tx signal to any tasks registered |
| 975 | using the SysRegisterTxSignal routine. |
| 976 | |
| 977 | |
| 978 | PARAMETERS: |
| 979 | |
| 980 | None. |
| 981 | |
| 982 | |
| 983 | RETURNED VALUES: |
| 984 | |
| 985 | None. |
| 986 | |
| 987 | *****************************************************************************/ |
| 988 | extern void SysDisableTxSignal(void); |
| 989 | |
| 990 | |
| 991 | |
| 992 | /***************************************************************************** |
| 993 | |
| 994 | FUNCTION NAME: SysEnableTimerSync |
| 995 | |
| 996 | DESCRIPTION: |
| 997 | |
| 998 | This routine enables/disables the synchronization of the CTS/DTS timers |
| 999 | with the System Timer. When enabled the System Timer block controls the |
| 1000 | rollover of the CTS Timer. On disable, the CTS timer is set to rollover |
| 1001 | at 20 ms, but not synced to the System Timer. |
| 1002 | |
| 1003 | PARAMETERS: |
| 1004 | |
| 1005 | Enable - KAL_TRUE for enable, KAL_FALSE for disable. |
| 1006 | |
| 1007 | RETURNED VALUES: |
| 1008 | |
| 1009 | None. |
| 1010 | |
| 1011 | *****************************************************************************/ |
| 1012 | #define SysEnableTimerSync(Enable) |
| 1013 | |
| 1014 | /***************************************************************************** |
| 1015 | |
| 1016 | FUNCTION NAME: SysSetFrameSize |
| 1017 | |
| 1018 | DESCRIPTION: |
| 1019 | |
| 1020 | This routine sets the System Timer block hardware to produce interrupts |
| 1021 | corresponding to either a 20 ms or 26 ms period. |
| 1022 | |
| 1023 | PARAMETERS: |
| 1024 | |
| 1025 | FrameSize - Either 20 or 26 ms frames. |
| 1026 | |
| 1027 | RETURNED VALUES: |
| 1028 | |
| 1029 | None. |
| 1030 | |
| 1031 | *****************************************************************************/ |
| 1032 | extern void SysSetFrameSize(SysFrameSizeT FrameSize); |
| 1033 | |
| 1034 | |
| 1035 | |
| 1036 | /***************************************************************************** |
| 1037 | |
| 1038 | FUNCTION NAME: SysCtsCallbackClear |
| 1039 | |
| 1040 | DESCRIPTION: Clears out all instances of the specified function from the |
| 1041 | CTS callback routine . |
| 1042 | |
| 1043 | PARAMETERS: CallbackPtr - routine to clear out of callback queue |
| 1044 | |
| 1045 | RETURNED VALUES: None |
| 1046 | |
| 1047 | *****************************************************************************/ |
| 1048 | #define SysCtsCallbackClear(CallbackPtr) |
| 1049 | |
| 1050 | |
| 1051 | /***************************************************************************** |
| 1052 | |
| 1053 | FUNCTION NAME: SysCtsRegisterCallback |
| 1054 | |
| 1055 | DESCRIPTION: Provides a callback after the specified delay. The delay |
| 1056 | is generated by using the hardware frame counter to |
| 1057 | determine the current time, and then programming a single |
| 1058 | shot strobe to occur after the specified delay. |
| 1059 | |
| 1060 | Notes: |
| 1061 | 1) Assumes frame time is 20 ms. |
| 1062 | 2) Contains overrun checking. |
| 1063 | |
| 1064 | PARAMETERS: DelayMs - Delay in ms. |
| 1065 | CallbackPtr - Function to call after the delay. |
| 1066 | |
| 1067 | RETURNED VALUES: Flag indicating if a callback was scheduled successfully. |
| 1068 | KAL_TRUE: Callback scheduled. |
| 1069 | KAL_FALSE: NO CTS Timers available, callback NOT scheduled. |
| 1070 | |
| 1071 | *****************************************************************************/ |
| 1072 | #define SysCtsRegisterCallback(DelayMs, CallbackPtr) |
| 1073 | |
| 1074 | |
| 1075 | |
| 1076 | /***************************************************************************** |
| 1077 | |
| 1078 | FUNCTION NAME: SysCtsRegisterCallbackUsec |
| 1079 | |
| 1080 | DESCRIPTION: Provides a callback after the specified delay. The delay |
| 1081 | is generated by using the hardware frame counter to |
| 1082 | determine the current time, and then programming a single |
| 1083 | shot strobe to occur after the specified delay. |
| 1084 | |
| 1085 | Notes: |
| 1086 | 1) Contains overrun checking. |
| 1087 | 2) Minimum delay of 100usec is required due to resolution |
| 1088 | of 80kHz counter value. |
| 1089 | 3) Resolution of 80kHz timer effectively "truncates" usec callbacks |
| 1090 | to units of 12.5usec ticks. |
| 1091 | 4) Specifying the LISR context will cause the system to crash if |
| 1092 | the registered callback attempts to use any EXE/RTOS functionality |
| 1093 | (e.g. - Intertask messagings/signals or MonFaults) This should |
| 1094 | ONLY be used for time-critical operations that does not involve |
| 1095 | the RTOS. |
| 1096 | |
| 1097 | PARAMETERS: DelayUsec - Delay in usec. |
| 1098 | Context - Context in which to execute callback (i.e., LISR or HISR) |
| 1099 | CallbackPtr - Function to call after the delay. |
| 1100 | |
| 1101 | RETURNED VALUES: Flag indicating if a callback was scheduled successfully. |
| 1102 | KAL_TRUE: Callback scheduled. |
| 1103 | KAL_FALSE: NO CTS Timers available, callback NOT scheduled. |
| 1104 | |
| 1105 | *****************************************************************************/ |
| 1106 | #define SysCtsRegisterCallbackUsec(DelayUsec, Context, CallbackPtr) |
| 1107 | |
| 1108 | |
| 1109 | |
| 1110 | /***************************************************************************** |
| 1111 | |
| 1112 | FUNCTION NAME: SysCtsRegisterCallbackAbs |
| 1113 | |
| 1114 | DESCRIPTION: Provides a callback when the hardware frame counter reaches |
| 1115 | the specified value. This is implemented by programming a |
| 1116 | single shot strobe to occur at the specified count. |
| 1117 | |
| 1118 | Notes: |
| 1119 | 1) Assumes frame time is 20 ms. |
| 1120 | 2) Contains overrun checking. |
| 1121 | 3) Uses same CTS as SysCtsRegisterCallbackDly |
| 1122 | |
| 1123 | |
| 1124 | PARAMETERS: AbsCount - Frame counter value to generate callback |
| 1125 | CallbackPtr - Function to call after the delay. |
| 1126 | |
| 1127 | RETURNED VALUES: None |
| 1128 | |
| 1129 | *****************************************************************************/ |
| 1130 | #define SysCtsRegisterCallbackAbs(AbsCount, CallbackPtr) |
| 1131 | |
| 1132 | |
| 1133 | |
| 1134 | |
| 1135 | /***************************************************************************** |
| 1136 | |
| 1137 | FUNCTION NAME: SysTimeReset |
| 1138 | |
| 1139 | DESCRIPTION: |
| 1140 | |
| 1141 | This routine re-initializes system time variables and clears all callback |
| 1142 | queues. |
| 1143 | |
| 1144 | PARAMETERS: |
| 1145 | |
| 1146 | None. |
| 1147 | |
| 1148 | RETURNED VALUES: |
| 1149 | |
| 1150 | None. |
| 1151 | |
| 1152 | *****************************************************************************/ |
| 1153 | extern void SysTimeReset(void); |
| 1154 | |
| 1155 | |
| 1156 | /***************************************************************************** |
| 1157 | |
| 1158 | FUNCTION NAME: SysTimeDataGet |
| 1159 | |
| 1160 | DESCRIPTION: |
| 1161 | |
| 1162 | This routine retrieves the current system time data including the 38 bit |
| 1163 | system time in 20 ms units and the other information most recently received |
| 1164 | in the sync channel message. |
| 1165 | |
| 1166 | PARAMETERS: |
| 1167 | |
| 1168 | TimeDataP - Pointer to Time data structure to fill in with current data. |
| 1169 | |
| 1170 | RETURNED VALUES: |
| 1171 | |
| 1172 | kal_bool - KAL_TRUE if valid data was filled in. KAL_FALSE if valid data does NOT exist. |
| 1173 | |
| 1174 | *****************************************************************************/ |
| 1175 | extern kal_bool SysTimeDataGet(SysTimeDataT *TimeDataP); |
| 1176 | |
| 1177 | |
| 1178 | |
| 1179 | /***************************************************************************** |
| 1180 | |
| 1181 | FUNCTION NAME: SysTimeSync |
| 1182 | |
| 1183 | DESCRIPTION: |
| 1184 | |
| 1185 | This routine is used to synchronize the system time variables received on |
| 1186 | the sync channel with the data stored by SYS. |
| 1187 | |
| 1188 | PARAMETERS: |
| 1189 | |
| 1190 | LpSec : Leap seconds as received in sync channel message. |
| 1191 | LtmOff : Local time offset as received in sync channel message |
| 1192 | (units of signed 30 min). |
| 1193 | DayLt : Daylight savings time kal_boolean flag. |
| 1194 | |
| 1195 | RETURNED VALUES: |
| 1196 | |
| 1197 | None. |
| 1198 | |
| 1199 | *****************************************************************************/ |
| 1200 | extern void SysTimeSync(kal_uint8 *FullSystemTimeP, |
| 1201 | kal_uint8 LpSec, |
| 1202 | kal_int8 LtmOff, |
| 1203 | kal_bool DayLt); |
| 1204 | |
| 1205 | |
| 1206 | /***************************************************************************** |
| 1207 | |
| 1208 | FUNCTION NAME: SysTimeUpper6BitsGet |
| 1209 | |
| 1210 | DESCRIPTION: |
| 1211 | |
| 1212 | This routine retrieves the upper 6 bits of the current system time kept in |
| 1213 | 20 ms units, making the full system time 38 bits. |
| 1214 | |
| 1215 | PARAMETERS: |
| 1216 | |
| 1217 | None. |
| 1218 | |
| 1219 | RETURNED VALUES: |
| 1220 | |
| 1221 | Upper 6 bits of system time (right justified in the 8 bits returned). |
| 1222 | |
| 1223 | *****************************************************************************/ |
| 1224 | extern kal_uint8 SysTimeUpper6BitsGet(void); |
| 1225 | |
| 1226 | |
| 1227 | |
| 1228 | |
| 1229 | /***************************************************************************** |
| 1230 | |
| 1231 | FUNCTION NAME: SysTimeFullGet |
| 1232 | |
| 1233 | DESCRIPTION: |
| 1234 | |
| 1235 | This routine retrieves the current system time in 80 ms units. |
| 1236 | It is returned in the same format as that received on the sync channel, |
| 1237 | 36 bits contained in a five byte array with the data left justified. |
| 1238 | |
| 1239 | |
| 1240 | |
| 1241 | PARAMETERS: |
| 1242 | |
| 1243 | FullSystemTimeP - Pointer to 5 byte array for return data. |
| 1244 | |
| 1245 | RETURNED VALUES: |
| 1246 | |
| 1247 | Format: |
| 1248 | FullSystemTimeP[0] => Current System Time, bits 35-28 |
| 1249 | FullSystemTimeP[1] => Current System Time, bits 27-20 |
| 1250 | FullSystemTimeP[2] => Current System Time, bits 19-12 |
| 1251 | FullSystemTimeP[3] => Current System Time, bits 11-4 |
| 1252 | FullSystemTimeP[4] => Current System Time, bits 3-0 |
| 1253 | (contained in bits 7-4 of this byte) |
| 1254 | |
| 1255 | |
| 1256 | *****************************************************************************/ |
| 1257 | extern void SysTimeFullGet(kal_uint8 *FullSystemTimeP); |
| 1258 | |
| 1259 | /***************************************************************************** |
| 1260 | |
| 1261 | FUNCTION NAME: SysTimeDataCopy |
| 1262 | |
| 1263 | DESCRIPTION: |
| 1264 | |
| 1265 | PARAMETERS: |
| 1266 | |
| 1267 | RETURNED VALUES: |
| 1268 | |
| 1269 | None. |
| 1270 | |
| 1271 | *****************************************************************************/ |
| 1272 | extern void SysTimeDataCopy(SysAirInterfaceT AirInterface); |
| 1273 | |
| 1274 | /***************************************************************************** |
| 1275 | |
| 1276 | FUNCTION NAME: SysTimeDataFlush |
| 1277 | |
| 1278 | DESCRIPTION: |
| 1279 | |
| 1280 | PARAMETERS: |
| 1281 | |
| 1282 | RETURNED VALUES: |
| 1283 | |
| 1284 | None. |
| 1285 | |
| 1286 | *****************************************************************************/ |
| 1287 | extern void SysTimeDataFlush(SysAirInterfaceT AirInterface); |
| 1288 | |
| 1289 | /***************************************************************************** |
| 1290 | |
| 1291 | FUNCTION NAME: SysTime32BitTimeCalc |
| 1292 | |
| 1293 | DESCRIPTION: |
| 1294 | |
| 1295 | This routine calculates the system time in 20 ms, given the system |
| 1296 | time in sync channel message format (36 bits in 80 ms units, left |
| 1297 | justified) and returns the lower 32 bits of the calculated value. |
| 1298 | |
| 1299 | |
| 1300 | |
| 1301 | PARAMETERS: |
| 1302 | |
| 1303 | FullSystemTimeP - Pointer to 5 byte system time array. |
| 1304 | Format: |
| 1305 | FullSystemTimeP[0] => Current System Time, bits 35-28 |
| 1306 | FullSystemTimeP[1] => Current System Time, bits 27-20 |
| 1307 | FullSystemTimeP[2] => Current System Time, bits 19-12 |
| 1308 | FullSystemTimeP[3] => Current System Time, bits 11-4 |
| 1309 | FullSystemTimeP[4] => Current System Time, bits 3-0 |
| 1310 | (contained in bits 7-4 of this byte) |
| 1311 | |
| 1312 | RETURNED VALUES: |
| 1313 | |
| 1314 | Lower 32 bits of system time in 20 ms units. |
| 1315 | |
| 1316 | *****************************************************************************/ |
| 1317 | extern kal_uint32 SysTime32BitTimeCalc(kal_uint8 *FullSystemTimeP); |
| 1318 | |
| 1319 | |
| 1320 | |
| 1321 | /***************************************************************************** |
| 1322 | |
| 1323 | FUNCTION : SysTime2Secs |
| 1324 | |
| 1325 | DESCRIPTION:Converts system time data into number of seconds since |
| 1326 | the beginning of System Time. System time data includes |
| 1327 | local time offset, leap seconds, and daylight savings time |
| 1328 | indicator. |
| 1329 | |
| 1330 | PARAMETERS: TimeDataP |
| 1331 | |
| 1332 | !!!!IMPORTANT!!!! |
| 1333 | TimeDataP must be initialized by SysTimeDataGet(TimeDataP). |
| 1334 | In other words, SysTimeDataGet(TimeDataP) must be called |
| 1335 | right before this function. |
| 1336 | |
| 1337 | RETURNS: kal_uint32 - Number of seconds since start of System Time. |
| 1338 | Returns 0xFFFFFFFF if not valid. |
| 1339 | |
| 1340 | *********************************************************************** |
| 1341 | * NOTE: THIS FUNCTION WILL NOT RETURN CORRECT VALUES FOR SYSTEM TIMES * |
| 1342 | * CORRESPONDING TO A DATE LATER THAN FEB 12, 2067 (1X) or * |
| 1343 | * 31 DEC, 2115 (DO). * |
| 1344 | * SEE EMBEDDED COMMENTS IN THIS FUNCTION FOR MORE DETAILS. * |
| 1345 | *********************************************************************** |
| 1346 | |
| 1347 | *****************************************************************************/ |
| 1348 | extern SysCalendarTimeDataT SysTime2Secs(SysTimeDataT* SysTimeData); |
| 1349 | |
| 1350 | |
| 1351 | |
| 1352 | /***************************************************************************** |
| 1353 | |
| 1354 | FUNCTION NAME: SysCallbackRegister |
| 1355 | |
| 1356 | DESCRIPTION: |
| 1357 | |
| 1358 | This routine registers either a signal OR a call back function associated |
| 1359 | with an action time or Slot/PCG in the system time queue. The system time |
| 1360 | queue contains an order list of all action times and contains Slot masks |
| 1361 | without order. |
| 1362 | |
| 1363 | NOTE: 1. The Routine function pointer MUST be set to NULL to cause a message to be sent. |
| 1364 | 2. If this Routine function is called in HRT domain, only be allowed in frame/PCG/slot tick. |
| 1365 | |
| 1366 | PARAMETERS: |
| 1367 | |
| 1368 | ActionTime - Action time |
| 1369 | SlotMask - System Timer event mask to identify which Slot(s) to trigger event |
| 1370 | TagType - Identify the Air interface with Quese operation for Transition such as Flush or Keep. |
| 1371 | Type - Signal type such as single or periodic shot. |
| 1372 | Module_id - Module ID of task to send signal. |
| 1373 | Signal - Signal to send. |
| 1374 | Routine - Call back routine when action time is reached |
| 1375 | |
| 1376 | RETURNED VALUES: |
| 1377 | |
| 1378 | None. |
| 1379 | |
| 1380 | *****************************************************************************/ |
| 1381 | #ifdef SYS_DEBUG_FAULT_FILE_INFO |
| 1382 | #define C2kSysCallbackRegister(ActionTime, SlotNum, TagType, EventType, module_id, message, Routine) \ |
| 1383 | __C2kSysCallbackRegister(ActionTime, SlotNum, TagType, EventType, module_id, message, Routine, __MODULE__, __LINE__) |
| 1384 | extern kal_bool __C2kSysCallbackRegister(kal_uint32 ActionTime, kal_uint16 SlotNum, SysTagTypeT TagType, |
| 1385 | SysEventTypeT EventType, module_type module_id, msg_type message, |
| 1386 | void (*Routine) (kal_uint32), |
| 1387 | const char *ModuleName, unsigned line); |
| 1388 | #else |
| 1389 | extern kal_bool C2kSysCallbackRegister(kal_uint32 ActionTime, kal_uint16 SlotNum, SysTagTypeT TagType, |
| 1390 | SysEventTypeT EventType, module_type module_id, msg_type message, |
| 1391 | void (*Routine) (kal_uint32)); |
| 1392 | #endif |
| 1393 | |
| 1394 | |
| 1395 | /***************************************************************************** |
| 1396 | |
| 1397 | FUNCTION NAME: SysCallbackRegisterCancel |
| 1398 | |
| 1399 | DESCRIPTION: |
| 1400 | |
| 1401 | This routine registers either a signal OR a call back function associated |
| 1402 | with an action time or Slot in the system time queue. The system time queue contains |
| 1403 | an order list of all action times and contains Slot mask without order. |
| 1404 | |
| 1405 | NOTE: 1. The Routine function pointer MUST be set to NULL to cause a message to be sent. |
| 1406 | 2. If this Routine function is called in HRT domain, only be allowed in frame/PCG/slot tick. |
| 1407 | |
| 1408 | PARAMETERS: |
| 1409 | |
| 1410 | ActionTime - Action time |
| 1411 | SlotMask - System Timer event mask to identify which Slot(s) to trigger event |
| 1412 | TagType - Identify the Air interface with Quese operation for Transition such as Flush or Keep. |
| 1413 | Module_id - Module ID of task to send signal. |
| 1414 | Signal - Signal to send. |
| 1415 | Routine - Call back routine when action time is reached |
| 1416 | |
| 1417 | RETURNED VALUES: |
| 1418 | |
| 1419 | kal_boolean flag indicating operation status. |
| 1420 | Returns KAL_TRUE if action cancelled successfully. |
| 1421 | Returns KAL_FALSE if specified action not found in registration queue. |
| 1422 | |
| 1423 | Note: Input paramters must match those used when SysCallbackRegister was called |
| 1424 | originally. |
| 1425 | |
| 1426 | *****************************************************************************/ |
| 1427 | #ifdef SYS_DEBUG_FAULT_FILE_INFO |
| 1428 | #define C2kSysCallbackRegisterCancel(ActionTime, SlotNum, TagType, EventType, module_id, message, Routine) \ |
| 1429 | __C2kSysCallbackRegisterCancel(ActionTime, SlotNum, TagType, EventType, module_id, message, Routine, __MODULE__, __LINE__) |
| 1430 | extern kal_bool __C2kSysCallbackRegisterCancel(kal_uint32 ActionTime, kal_uint16 SlotNum, SysTagTypeT TagType, |
| 1431 | SysEventTypeT EventType, module_type module_id, msg_type message, |
| 1432 | void (*Routine) (kal_uint32), |
| 1433 | const char *ModuleName, unsigned line); |
| 1434 | #else |
| 1435 | extern kal_bool C2kSysCallbackRegisterCancel(kal_uint32 ActionTime, kal_uint16 SlotNum, SysTagTypeT TagType, |
| 1436 | SysEventTypeT EventType, module_type module_id, msg_type message, |
| 1437 | void (*Routine) (kal_uint32)); |
| 1438 | #endif |
| 1439 | |
| 1440 | |
| 1441 | /***************************************************************************** |
| 1442 | |
| 1443 | FUNCTION NAME: SysTimeCbOperation |
| 1444 | |
| 1445 | DESCRIPTION: |
| 1446 | |
| 1447 | This routine executes in message deliver HISR to run the systime CB operation which is called in HRT domain; |
| 1448 | |
| 1449 | NOTE: If systime CB operation is called in HRT domain, only be allowed in frame/PCG/slot tick. |
| 1450 | |
| 1451 | PARAMETERS: |
| 1452 | |
| 1453 | Ptr - Pointer to the parameters |
| 1454 | |
| 1455 | RETURNED VALUES: |
| 1456 | |
| 1457 | None |
| 1458 | |
| 1459 | *****************************************************************************/ |
| 1460 | extern void SysTimeCbOperation(kal_uint8* Ptr); |
| 1461 | |
| 1462 | |
| 1463 | /***************************************************************************** |
| 1464 | |
| 1465 | FUNCTION NAME: SysDoTimeGet |
| 1466 | |
| 1467 | DESCRIPTION: |
| 1468 | |
| 1469 | This routine gets a copy of the system time variable as 26msec unit. |
| 1470 | |
| 1471 | PARAMETERS: |
| 1472 | |
| 1473 | None. |
| 1474 | |
| 1475 | RETURNED VALUES: |
| 1476 | |
| 1477 | kal_uint32 - System time variable is returned. |
| 1478 | |
| 1479 | *****************************************************************************/ |
| 1480 | extern kal_uint32 SysDoTimeGet( kal_bool useFrameOffset ); |
| 1481 | |
| 1482 | |
| 1483 | /***************************************************************************** |
| 1484 | |
| 1485 | FUNCTION NAME: SysDoTimeGetSubframe |
| 1486 | |
| 1487 | DESCRIPTION: |
| 1488 | |
| 1489 | Returns Subframe: a 0-11 subframe count for an 80ms interval. |
| 1490 | |
| 1491 | PARAMETERS: |
| 1492 | |
| 1493 | UseFrameOffset: Set to KAL_TRUE to subtrace FrameOffset from the SYS unit hardware subframe. |
| 1494 | |
| 1495 | RETURNED VALUES: |
| 1496 | kal_int8 |
| 1497 | |
| 1498 | *****************************************************************************/ |
| 1499 | extern kal_int8 SysDoTimeGetSubframe( kal_bool UseFrameOffset ); |
| 1500 | |
| 1501 | |
| 1502 | /***************************************************************************** |
| 1503 | |
| 1504 | FUNCTION NAME: SysDoTimeInSlotGet |
| 1505 | |
| 1506 | DESCRIPTION: |
| 1507 | |
| 1508 | This routine returns the current system time in units of slots. |
| 1509 | Slots are 1.66ms duration. |
| 1510 | |
| 1511 | PARAMETERS: |
| 1512 | |
| 1513 | None. |
| 1514 | |
| 1515 | RETURNED VALUES: |
| 1516 | |
| 1517 | Structure containing 36 bit resolution system time. |
| 1518 | |
| 1519 | *****************************************************************************/ |
| 1520 | extern kal_uint64 SysDoTimeInSlotGet( kal_bool UseFrameOffset ); |
| 1521 | |
| 1522 | |
| 1523 | /***************************************************************************** |
| 1524 | |
| 1525 | FUNCTION NAME: SysDoTimeUpdateLtfLps |
| 1526 | |
| 1527 | DESCRIPTION: |
| 1528 | |
| 1529 | This routine writes the LeapSecs and LocalTimeOffset into global structure |
| 1530 | SysTimeData. |
| 1531 | |
| 1532 | PARAMETERS: |
| 1533 | |
| 1534 | FrameOffset - in units of slots |
| 1535 | |
| 1536 | RETURNED VALUES: |
| 1537 | |
| 1538 | None. |
| 1539 | |
| 1540 | *****************************************************************************/ |
| 1541 | extern void SysDoTimeUpdateLtfLps(kal_uint8 LpSec, kal_uint16 LtmOff); |
| 1542 | |
| 1543 | /***************************************************************************** |
| 1544 | |
| 1545 | FUNCTION NAME: SysTimeStatusUpdate |
| 1546 | |
| 1547 | DESCRIPTION: |
| 1548 | |
| 1549 | PARAMETERS: |
| 1550 | |
| 1551 | None. |
| 1552 | |
| 1553 | RETURNED VALUES: |
| 1554 | |
| 1555 | None. |
| 1556 | |
| 1557 | *****************************************************************************/ |
| 1558 | extern void SysTimeStatusUpdate(SysAirInterfaceT AirInterface, kal_uint8 UpdateReason); |
| 1559 | |
| 1560 | |
| 1561 | /***************************************************************************** |
| 1562 | |
| 1563 | FUNCTION NAME: SysDoTimeFullSet |
| 1564 | |
| 1565 | DESCRIPTION: |
| 1566 | |
| 1567 | This routine sets the current system time. |
| 1568 | |
| 1569 | PARAMETERS: |
| 1570 | |
| 1571 | FrameRecT FullSystemTime - Structure to 37 bits input system time array. |
| 1572 | |
| 1573 | RETURNED VALUES: |
| 1574 | |
| 1575 | None. |
| 1576 | |
| 1577 | *****************************************************************************/ |
| 1578 | extern void SysDoTimeFullSet(FrameRecT FullSystemTime); |
| 1579 | |
| 1580 | |
| 1581 | /***************************************************************************** |
| 1582 | |
| 1583 | FUNCTION NAME: SysDoTimeFullGet |
| 1584 | |
| 1585 | DESCRIPTION: |
| 1586 | |
| 1587 | Returns: |
| 1588 | - frame count in units of 26.66ms frame |
| 1589 | - subframe count within 26.66ms frame [0-3] |
| 1590 | - slot count within 26.66ms frame [0-15] |
| 1591 | - symbol number within 26.66ms frame [0-511] |
| 1592 | |
| 1593 | PARAMETERS: |
| 1594 | |
| 1595 | none |
| 1596 | |
| 1597 | RETURNED VALUES: |
| 1598 | See SysTimeFullT in sysapi.h |
| 1599 | |
| 1600 | *****************************************************************************/ |
| 1601 | extern SysTimeFullT SysDoTimeFullGet(kal_bool UseFrameOffset); |
| 1602 | |
| 1603 | |
| 1604 | /***************************************************************************** |
| 1605 | |
| 1606 | FUNCTION NAME: SysSetFrameOffset |
| 1607 | |
| 1608 | DESCRIPTION: |
| 1609 | |
| 1610 | This routine sets C2K modem's frame offset |
| 1611 | |
| 1612 | PARAMETERS: |
| 1613 | |
| 1614 | AirInterface - 1X or DO |
| 1615 | FrameOffset - in units of slots |
| 1616 | |
| 1617 | RETURNED VALUES: |
| 1618 | |
| 1619 | None. |
| 1620 | |
| 1621 | *****************************************************************************/ |
| 1622 | extern void SysSetFrameOffset(SysAirInterfaceT AirInterface, kal_uint8 FrameOffset); |
| 1623 | |
| 1624 | |
| 1625 | /***************************************************************************** |
| 1626 | |
| 1627 | FUNCTION NAME: SysGetFrameOffset |
| 1628 | |
| 1629 | DESCRIPTION: |
| 1630 | |
| 1631 | This routine gets C2K modem's frame offset |
| 1632 | |
| 1633 | PARAMETERS: |
| 1634 | |
| 1635 | AirInterface - 1X or DO |
| 1636 | |
| 1637 | |
| 1638 | RETURNED VALUES: |
| 1639 | |
| 1640 | FrameOffset - in units of slots |
| 1641 | |
| 1642 | *****************************************************************************/ |
| 1643 | extern kal_uint8 SysGetFrameOffset(SysAirInterfaceT AirInterface); |
| 1644 | |
| 1645 | |
| 1646 | /***************************************************************************** |
| 1647 | |
| 1648 | FUNCTION NAME: SysTimeSymbNum |
| 1649 | |
| 1650 | DESCRIPTION: |
| 1651 | Returns the Symbol count [0-0x5FF] if AirInterface==SYS_MODE_EVDO. (wraps 80ms) |
| 1652 | Returns 0 if AirInterface== SYS_MODE_1xRTT. (wraps 80ms) |
| 1653 | |
| 1654 | PARAMETERS: |
| 1655 | |
| 1656 | StIntSrc - Current setted Interrupt Mask. |
| 1657 | |
| 1658 | RETURNED VALUES: |
| 1659 | |
| 1660 | *****************************************************************************/ |
| 1661 | extern kal_uint16 CphSysTimeSymbNum(SysAirInterfaceT Airinterface); |
| 1662 | #define SysTimeSymbNum(AirInterface) CphSysTimeSymbNum(AirInterface) |
| 1663 | |
| 1664 | /***************************************************************************** |
| 1665 | |
| 1666 | FUNCTION NAME: SysTime9MHzCnt |
| 1667 | |
| 1668 | DESCRIPTION: |
| 1669 | Returns the 9MHz SystemTime count of the corresponding AirInterface |
| 1670 | |
| 1671 | PARAMETERS: |
| 1672 | |
| 1673 | StIntSrc - Current setted Interrupt Mask. |
| 1674 | |
| 1675 | RETURNED VALUES: |
| 1676 | |
| 1677 | *****************************************************************************/ |
| 1678 | extern kal_uint32 CphSysTimeEchipCnt(SysAirInterfaceT Airinterface); |
| 1679 | #define SysTime9MHzCnt(AirInterface) CphSysTimeEchipCnt(AirInterface) |
| 1680 | |
| 1681 | /***************************************************************************** |
| 1682 | |
| 1683 | FUNCTION NAME: SysFrameCntGet |
| 1684 | |
| 1685 | DESCRIPTION: |
| 1686 | |
| 1687 | PARAMETERS: |
| 1688 | Return Upper8 and Lower 32 Frame Cnt (NO Frame Offset for EVDO!) |
| 1689 | |
| 1690 | RETURNED VALUES: |
| 1691 | |
| 1692 | None. |
| 1693 | |
| 1694 | *****************************************************************************/ |
| 1695 | extern void SysFrameCntGet(kal_uint8 AirInterfaceBM, FrameRecT* FrameCntP); |
| 1696 | |
| 1697 | /***************************************************************************** |
| 1698 | |
| 1699 | FUNCTION NAME: SysTimeRemove |
| 1700 | |
| 1701 | DESCRIPTION: |
| 1702 | |
| 1703 | This routine requests removes system time from active list. |
| 1704 | |
| 1705 | PARAMETERS: |
| 1706 | |
| 1707 | SysAirInterfaceT AirInterface |
| 1708 | |
| 1709 | RETURNED VALUES: |
| 1710 | |
| 1711 | None. |
| 1712 | |
| 1713 | *****************************************************************************/ |
| 1714 | extern void SysTimeRemove(SysAirInterfaceT AirInterface); |
| 1715 | |
| 1716 | /***************************************************************************** |
| 1717 | |
| 1718 | FUNCTION NAME: SysTimeSwitchControl |
| 1719 | |
| 1720 | DESCRIPTION: |
| 1721 | |
| 1722 | This routine requests adds/removes systime for the system. |
| 1723 | |
| 1724 | PARAMETERS: |
| 1725 | |
| 1726 | SysAirInterfaceT NewAirInterface |
| 1727 | kal_bool Enable |
| 1728 | |
| 1729 | RETURNED VALUES: |
| 1730 | |
| 1731 | None. |
| 1732 | |
| 1733 | *****************************************************************************/ |
| 1734 | kal_uint8 SysTimeSwitchControl(SysAirInterfaceT NewAirInterface, kal_bool Enable); |
| 1735 | |
| 1736 | /***************************************************************************** |
| 1737 | |
| 1738 | FUNCTION NAME: SysFrameCountGet |
| 1739 | |
| 1740 | DESCRIPTION: This function feels the 1X and DO time. |
| 1741 | |
| 1742 | PARAMETERS: |
| 1743 | Return |
| 1744 | |
| 1745 | RETURNED VALUES: |
| 1746 | |
| 1747 | None. |
| 1748 | |
| 1749 | *****************************************************************************/ |
| 1750 | extern void SysFrameCountGet(void* pSysTime); |
| 1751 | |
| 1752 | extern void CphSysStIntDisable (SysAirInterfaceT Airinterface, kal_uint16 Mask); |
| 1753 | extern void CphSysStIntEnable (SysAirInterfaceT Airinterface, kal_uint16 Mask); |
| 1754 | #define SysStIntDisable(AirInterface, Mask) CphSysStIntDisable(AirInterface,Mask) |
| 1755 | #define SysStIntEnable(AirInterface, Mask) CphSysStIntEnable(AirInterface,Mask) |
| 1756 | |
| 1757 | /***************************************************************************** |
| 1758 | |
| 1759 | FUNCTION NAME: SysAirInterfaceGet |
| 1760 | |
| 1761 | DESCRIPTION: |
| 1762 | |
| 1763 | PARAMETERS: |
| 1764 | |
| 1765 | RETURNED VALUES: |
| 1766 | return SYS_MODE_1xRTT or SYS_MODE_EVDO |
| 1767 | |
| 1768 | None. |
| 1769 | |
| 1770 | *****************************************************************************/ |
| 1771 | extern kal_uint8 SysAirInterfaceGet(void); |
| 1772 | |
| 1773 | /***************************************************************************** |
| 1774 | |
| 1775 | FUNCTION NAME: SysTimeSetFreqOffset |
| 1776 | |
| 1777 | DESCRIPTION: |
| 1778 | |
| 1779 | PARAMETERS: Airinterface - 1X or DO |
| 1780 | AfcPpb - in unit of ppb, if AfcPpb>0, this setting will |
| 1781 | increase chip-rate of Rx timer; else, decrease it. |
| 1782 | |
| 1783 | RETURNED VALUES: |
| 1784 | |
| 1785 | None. |
| 1786 | |
| 1787 | *****************************************************************************/ |
| 1788 | extern void SysTimeSetFreqOffset(SysAirInterfaceT Airinterface, kal_int16 AfcPpb); |
| 1789 | |
| 1790 | |
| 1791 | /***************************************************************************** |
| 1792 | |
| 1793 | FUNCTION NAME: SysTimeGetFreqOffset |
| 1794 | |
| 1795 | DESCRIPTION: |
| 1796 | |
| 1797 | PARAMETERS: |
| 1798 | |
| 1799 | RETURNED VALUES: |
| 1800 | |
| 1801 | Return the frequency offset of Rx timer usage. |
| 1802 | |
| 1803 | *****************************************************************************/ |
| 1804 | extern kal_int16 SysTimeGetFreqOffset(SysAirInterfaceT Airinterface); |
| 1805 | |
| 1806 | /***************************************************************************** |
| 1807 | |
| 1808 | FUNCTION NAME: SysTimeSyncTime |
| 1809 | |
| 1810 | DESCRIPTION: This Routine will implement the sys time big jump. |
| 1811 | For ICS/Sync Reception/Cross copy/SIB8 timing |
| 1812 | |
| 1813 | PARAMETERS: Airinterface: 1X or DO |
| 1814 | SyncEchip: the terminal e-chip count to restart counting |
| 1815 | EchipIni: e-chip count initial value |
| 1816 | SupfrmIniH/SupfrmIniL: super frame count synchronization initial value |
| 1817 | |
| 1818 | RETURNED VALUES: |
| 1819 | return SYS_MODE_1xRTT or SYS_MODE_EVDO |
| 1820 | |
| 1821 | None. |
| 1822 | |
| 1823 | *****************************************************************************/ |
| 1824 | extern void SysTimeSyncTime(SysAirInterfaceT Airinterface, kal_uint32 SyncEchip, kal_uint32 EchipIni, kal_uint8 SupfrmIniH, kal_uint32 SupfrmIniL); |
| 1825 | |
| 1826 | |
| 1827 | /***************************************************************************** |
| 1828 | |
| 1829 | FUNCTION NAME: Sys9MHzCntInitReq |
| 1830 | |
| 1831 | DESCRIPTION: Uses the hardware 1X System time count to initialize the |
| 1832 | hardware DO System time count |
| 1833 | Note: Can do : 1X time -> DO time. |
| 1834 | CanNOT do: DO time -> 1X time |
| 1835 | |
| 1836 | PARAMETERS: AckRequired: |
| 1837 | KAL_TRUE : INSP_1XASSIST_DOACQ_MSG or some form of acknowledgement |
| 1838 | will be sent upon successful completion of this request. |
| 1839 | KAL_FALSE: No acknowledgement will be sent to indicate completion of |
| 1840 | request. |
| 1841 | |
| 1842 | RETURNED VALUE: |
| 1843 | KAL_TRUE : 1X system time can be used to initialize DO system time. |
| 1844 | KAL_FALSE: 1X system time cannot be used to initialize DO system time. |
| 1845 | |
| 1846 | *****************************************************************************/ |
| 1847 | extern kal_bool Sys9MHzCntInitReq(kal_bool AckRequired); |
| 1848 | |
| 1849 | /***************************************************************************** |
| 1850 | |
| 1851 | FUNCTION NAME: Sys9MHzCntInitProcess |
| 1852 | |
| 1853 | DESCRIPTION: Thie Routine executes in PCG handler |
| 1854 | |
| 1855 | PARAMETERS: NONE |
| 1856 | |
| 1857 | RETURNED VALUE: |
| 1858 | NONE |
| 1859 | |
| 1860 | *****************************************************************************/ |
| 1861 | extern void Sys9MHzCntInitProcess(void); |
| 1862 | |
| 1863 | |
| 1864 | /***************************************************************************** |
| 1865 | |
| 1866 | FUNCTION NAME: SysTimeValid |
| 1867 | |
| 1868 | DESCRIPTION: |
| 1869 | |
| 1870 | Inquire whether the AirInterface has valid or invalid system time. |
| 1871 | |
| 1872 | PARAMETERS: |
| 1873 | |
| 1874 | None. |
| 1875 | |
| 1876 | RETURNED VALUES: |
| 1877 | |
| 1878 | KAL_TRUE: valid system time. KAL_FALSE: invalid system time. |
| 1879 | |
| 1880 | *****************************************************************************/ |
| 1881 | extern kal_uint8 SysTimeValid(kal_uint8 AirInterfaceBM); |
| 1882 | |
| 1883 | |
| 1884 | /***************************************************************************** |
| 1885 | |
| 1886 | FUNCTION NAME: SysTimeCurrent |
| 1887 | |
| 1888 | DESCRIPTION: |
| 1889 | |
| 1890 | Inquire whether the AirInterface has current system time. |
| 1891 | |
| 1892 | PARAMETERS: |
| 1893 | |
| 1894 | None. |
| 1895 | |
| 1896 | RETURNED VALUES: |
| 1897 | |
| 1898 | KAL_TRUE: valid system time. KAL_FALSE: invalid system time. |
| 1899 | |
| 1900 | *****************************************************************************/ |
| 1901 | extern kal_bool SysTimeCurrent(kal_uint8 AirInterfaceBM); |
| 1902 | |
| 1903 | |
| 1904 | |
| 1905 | /***************************************************************************** |
| 1906 | |
| 1907 | FUNCTION NAME: SysTimeTotalGet |
| 1908 | |
| 1909 | DESCRIPTION: |
| 1910 | |
| 1911 | This routine returns full time including super-frame / e-chip. |
| 1912 | |
| 1913 | PARAMETERS: |
| 1914 | |
| 1915 | AirInterface - 1X or DO |
| 1916 | SFramePtr - pointer to the returned full time |
| 1917 | |
| 1918 | RETURNED VALUES: |
| 1919 | |
| 1920 | None. |
| 1921 | |
| 1922 | *****************************************************************************/ |
| 1923 | extern void SysTimeTotalGet(SysAirInterfaceT AirInterface, SysSFrameTimeT * SFramePtr); |
| 1924 | |
| 1925 | |
| 1926 | #if defined (MTK_DEV_C2K_IRAT) && defined (MTK_DEV_C2K_SRLTE_L1) |
| 1927 | /***************************************************************************** |
| 1928 | |
| 1929 | FUNCTION NAME: SysSFrameGet |
| 1930 | |
| 1931 | DESCRIPTION: |
| 1932 | |
| 1933 | PARAMETERS: AirInterface: 1X or DO |
| 1934 | Curr: Return curr super frame num or not |
| 1935 | CheckFrameLo32: If Curr=KAL_FALSE, Return super frame num of CheckFrameLo32 |
| 1936 | |
| 1937 | Return Lower 32 Super Frame Cnt |
| 1938 | |
| 1939 | RETURNED VALUES: |
| 1940 | |
| 1941 | None. |
| 1942 | |
| 1943 | *****************************************************************************/ |
| 1944 | extern kal_uint64 SysSFrameGet(SysAirInterfaceT AirInterface, kal_bool Curr, kal_uint32 CheckFrameLo32); |
| 1945 | |
| 1946 | |
| 1947 | |
| 1948 | /***************************************************************************** |
| 1949 | |
| 1950 | FUNCTION NAME: SysSFrameGetWith9M |
| 1951 | |
| 1952 | DESCRIPTION: Get correct super frame numer with giving 9M Cnt |
| 1953 | |
| 1954 | PARAMETERS: AirInterface: 1X or DO |
| 1955 | Check9M: given 8X clock cnt of system time |
| 1956 | |
| 1957 | Return Lower 32 of Super Frame Cnt |
| 1958 | |
| 1959 | RETURNED VALUES: |
| 1960 | |
| 1961 | None. |
| 1962 | |
| 1963 | *****************************************************************************/ |
| 1964 | extern kal_uint64 SysSFrameGetWith9M(SysAirInterfaceT AirInterface, kal_uint32 Check9M); |
| 1965 | |
| 1966 | |
| 1967 | /***************************************************************************** |
| 1968 | |
| 1969 | FUNCTION NAME: SysFrameSizeIs26ms |
| 1970 | |
| 1971 | DESCRIPTION: |
| 1972 | |
| 1973 | PARAMETERS: |
| 1974 | |
| 1975 | RETURNED VALUES: |
| 1976 | return Frame size type |
| 1977 | KAL_TRUE: is 80/3 ms |
| 1978 | KAL_FALSE: is 20 ms |
| 1979 | |
| 1980 | None. |
| 1981 | |
| 1982 | *****************************************************************************/ |
| 1983 | extern kal_bool SysFrameSizeIs26ms(SysAirInterfaceT AirInterface); |
| 1984 | |
| 1985 | |
| 1986 | extern void SysUpdateSysTime(SysAirInterfaceT AirInterface); |
| 1987 | |
| 1988 | #endif |
| 1989 | |
| 1990 | extern sap_type SysGetSapIdHisr(module_type src,module_type dest); |
| 1991 | |
| 1992 | |
| 1993 | /**************************************************************************** |
| 1994 | |
| 1995 | FUNCTION NAME: EndianSwap |
| 1996 | |
| 1997 | DESCRIPTION: |
| 1998 | |
| 1999 | This function is used to convert |
| 2000 | unsigned integers from Big endian format to Little endian format and vice-versa. |
| 2001 | |
| 2002 | PARAMETERS: |
| 2003 | |
| 2004 | kal_uint8 *input Input that needs to be endian-swapped, in-place. |
| 2005 | kal_uint8 numOfBytes Number of bytes |
| 2006 | |
| 2007 | RETURNED VALUES: |
| 2008 | |
| 2009 | KAL_TRUE if numOfBytes is 2,4,8 KAL_FALSE otherwise. This is because we have |
| 2010 | 16,32 and 64 bit integers only in our S/W. |
| 2011 | |
| 2012 | *****************************************************************************/ |
| 2013 | kal_bool EndianSwap( kal_uint8* input , kal_uint8 numOfBytes); |
| 2014 | |
| 2015 | /**************************************************************************** |
| 2016 | |
| 2017 | FUNCTION NAME: CP_Strnlen |
| 2018 | |
| 2019 | DESCRIPTION: |
| 2020 | |
| 2021 | This function is used to return the length of a "C" Style string (NULL |
| 2022 | Terminated). The max length returned is capped at MAX_LENGTH parameter |
| 2023 | which means that if the string is of size greater than MAX_LENGTH, further |
| 2024 | calculation of the string's length is stopped and MAX_LENGTH is returned, |
| 2025 | hence the name CP_Str **n** len. |
| 2026 | |
| 2027 | PARAMETERS: |
| 2028 | |
| 2029 | char *str Input string that needs to be used |
| 2030 | kal_uint32 MAX_LENGTH Max length to be returned |
| 2031 | |
| 2032 | RETURNED VALUES: the length of the string if its less than or equal to MAX_LENGTH |
| 2033 | else MAX_LENGTH is returned. |
| 2034 | |
| 2035 | *****************************************************************************/ |
| 2036 | kal_uint32 CP_Strnlen( char *str, kal_uint32 MAX_LENGTH); |
| 2037 | |
| 2038 | /**************************************************************************** |
| 2039 | ; |
| 2040 | ; FUNCTION NAME: SysArmSleep |
| 2041 | ; |
| 2042 | ; DESCRIPTION: |
| 2043 | ; |
| 2044 | ; Puts Arm into light sleep using coprocessor. Any INT should wake |
| 2045 | ; (SN bit does not work for CBP70 A0 so we use Arm968 light sleep) |
| 2046 | ; |
| 2047 | ; |
| 2048 | ; PARAMETERS: |
| 2049 | ; |
| 2050 | ; None |
| 2051 | ; |
| 2052 | ; RETURNED VALUES: |
| 2053 | ; |
| 2054 | ; None. |
| 2055 | ; |
| 2056 | *****************************************************************************/ |
| 2057 | void SysArmSleep(void); |
| 2058 | |
| 2059 | /***************************************************************************** |
| 2060 | ; |
| 2061 | ; FUNCTION NAME: SysArmModeRegs |
| 2062 | ; |
| 2063 | ; DESCRIPTION: |
| 2064 | ; |
| 2065 | ; Stores the Arm mode regs (CPSR, SP, LR, SPSR) for 5 Arm modes |
| 2066 | ; (supervisor, FIQ, IRQ, Undef, Abort, Sytem). User mode does not have |
| 2067 | ; its own mode specific registers. |
| 2068 | ; |
| 2069 | ; This function should only be used during crash dump. |
| 2070 | ; |
| 2071 | ; C FUNCTION PROTOTYPE: |
| 2072 | ; |
| 2073 | ; void SysArmModeRegs(MonExceptArmModeRegs* pRegs); |
| 2074 | ; Use kal_uint32* so we don't need definition of MonExceptArmModeRegs |
| 2075 | ; |
| 2076 | ; PARAMETERS: |
| 2077 | ; |
| 2078 | ; pRegs (r0), pointer to array of 6 MonExceptArmModeRegs |
| 2079 | ; |
| 2080 | ; RETURNED VALUES: |
| 2081 | ; |
| 2082 | ; None. |
| 2083 | ; |
| 2084 | ;*****************************************************************************/ |
| 2085 | void SysArmModeRegs(kal_uint32* pRegs); |
| 2086 | |
| 2087 | /**************************************************************************** |
| 2088 | * |
| 2089 | * Name: sysIsBandSupported() |
| 2090 | * |
| 2091 | * Description: This routine validates the band by examining the allowed |
| 2092 | * operation modes as set by teh compile time switches in |
| 2093 | * custom.h. |
| 2094 | * |
| 2095 | * Parameters: SysCdmaBandT band - band to be validated |
| 2096 | * |
| 2097 | * Returns: kal_bool - KAL_TRUE if the band is supported |
| 2098 | * |
| 2099 | * Notes: |
| 2100 | * |
| 2101 | ****************************************************************************/ |
| 2102 | kal_bool sysIsBandSupported(SysCdmaBandT band); |
| 2103 | |
| 2104 | |
| 2105 | /**************************************************************************** |
| 2106 | * |
| 2107 | * Name: sysFrequencyToBlock() |
| 2108 | * |
| 2109 | * Description: This routine finds the block for the given channel. |
| 2110 | * |
| 2111 | * Parameters: SysCdmaBandT band - band channel is in |
| 2112 | * kal_uint16 channel - channel for which block is to be found |
| 2113 | * |
| 2114 | * Returns: kal_uint8 - PCS block |
| 2115 | * |
| 2116 | * Notes: A liberal range is used for channel numbers since this is |
| 2117 | * not validating the channels, only selecting a system. |
| 2118 | * |
| 2119 | ****************************************************************************/ |
| 2120 | kal_uint8 sysFrequencyToBlock(SysCdmaBandT band, kal_uint16 channel); |
| 2121 | |
| 2122 | /**************************************************************************** |
| 2123 | * |
| 2124 | * Name: sysFrequencyToSubClass() |
| 2125 | * |
| 2126 | * Description: This routine finds the subclass for the given channel. |
| 2127 | * |
| 2128 | * Parameters: SysCdmaBandT band - band channel is in |
| 2129 | * kal_uint16 channel - channel for which block is to be found |
| 2130 | * |
| 2131 | * Returns: kal_uint8 - Subclass |
| 2132 | * |
| 2133 | ****************************************************************************/ |
| 2134 | kal_uint8 sysFrequencyToSubClass(SysCdmaBandT band, kal_uint16 channel); |
| 2135 | |
| 2136 | /**************************************************************************** |
| 2137 | * |
| 2138 | * Name: sysIsBandChannelValid() |
| 2139 | * |
| 2140 | * Description: This routine validates a given channel against the given |
| 2141 | * band, based on Standard band definion only. |
| 2142 | * It DOES NOT consider hardware, including possible hwd |
| 2143 | * band SubClass limitation. |
| 2144 | * |
| 2145 | * Parameters: BandChannel *bandChannel - band and channel to validate |
| 2146 | * |
| 2147 | * Returns: kal_bool - KAL_TRUE if channel is valid within the band |
| 2148 | * |
| 2149 | * Notes: |
| 2150 | * |
| 2151 | ****************************************************************************/ |
| 2152 | kal_bool sysIsBandChannelValid(SysBandChannelT *bandChannel); |
| 2153 | |
| 2154 | /**************************************************************************** |
| 2155 | * |
| 2156 | * Name: sysSupportCDMAChannel() |
| 2157 | * |
| 2158 | * Description: This routine determines if the provided band and channel |
| 2159 | * are supported and valid. |
| 2160 | * |
| 2161 | * Parameters: BandChannel *bandChannel - band and channel |
| 2162 | * |
| 2163 | * Returns: kal_bool - KAL_TRUE if the band is supported and the channel is valid |
| 2164 | * |
| 2165 | * Notes: |
| 2166 | * |
| 2167 | ****************************************************************************/ |
| 2168 | kal_bool sysIsBandChannelSupported(SysBandChannelT *bandChannel); |
| 2169 | |
| 2170 | /***************************************************************************** |
| 2171 | |
| 2172 | FUNCTION NAME: sysSOServiceType |
| 2173 | |
| 2174 | DESCRIPTION: |
| 2175 | |
| 2176 | This routine returns the service type for the passed Service option. |
| 2177 | |
| 2178 | PARAMETERS: |
| 2179 | |
| 2180 | SysServiceOptionT serviceOption |
| 2181 | |
| 2182 | RETURNED VALUES: |
| 2183 | |
| 2184 | SysServiceTypeT service type (e.g. VOICE, PACKET_DATA, etc...) |
| 2185 | |
| 2186 | *****************************************************************************/ |
| 2187 | SysServiceTypeT sysSOServiceType(SysServiceOptionT serviceOption); |
| 2188 | |
| 2189 | /***************************************************************************** |
| 2190 | |
| 2191 | FUNCTION NAME: sysLoopbackSvcType |
| 2192 | |
| 2193 | DESCRIPTION: |
| 2194 | |
| 2195 | This routine returns the service subtype for a loopback Service option. |
| 2196 | |
| 2197 | PARAMETERS: |
| 2198 | |
| 2199 | SysServiceOptionT serviceOption |
| 2200 | |
| 2201 | RETURNED VALUES: |
| 2202 | |
| 2203 | SysLoopbackSvcTypeT service sub type (IS126, Markov, TDSO) |
| 2204 | |
| 2205 | *****************************************************************************/ |
| 2206 | SysLoopbackSvcTypeT sysLoopbackSvcType(SysServiceOptionT serviceOption); |
| 2207 | |
| 2208 | /***************************************************************************** |
| 2209 | |
| 2210 | FUNCTION NAME: sysCircuitDataSvcType |
| 2211 | |
| 2212 | DESCRIPTION: |
| 2213 | |
| 2214 | This routine returns the service subtype for a cicuit data Service option. |
| 2215 | |
| 2216 | PARAMETERS: |
| 2217 | |
| 2218 | SysServiceOptionT serviceOption |
| 2219 | |
| 2220 | RETURNED VALUES: |
| 2221 | |
| 2222 | SysCircuitDataSvcTypeT service sub type (Async, Fax) |
| 2223 | |
| 2224 | *****************************************************************************/ |
| 2225 | SysCircuitDataSvcTypeT sysCircuitDataSvcType(SysServiceOptionT serviceOption); |
| 2226 | |
| 2227 | /***************************************************************************** |
| 2228 | |
| 2229 | FUNCTION NAME: sysPacketDataSvcType |
| 2230 | |
| 2231 | DESCRIPTION: |
| 2232 | |
| 2233 | This routine returns the service subtype for a packet data Service option. |
| 2234 | |
| 2235 | PARAMETERS: |
| 2236 | |
| 2237 | SysPacketDataSvcTypeT serviceOption |
| 2238 | |
| 2239 | RETURNED VALUES: |
| 2240 | |
| 2241 | SysPacketDataSvcTypeT service sub type (LSPD, MSPD, HSPD) |
| 2242 | |
| 2243 | *****************************************************************************/ |
| 2244 | |
| 2245 | SysPacketDataSvcTypeT sysPacketDataSvcType(SysServiceOptionT serviceOption); |
| 2246 | |
| 2247 | |
| 2248 | |
| 2249 | SysSoGrpT sysSOSvcGrp(kal_uint16 serviceOption); |
| 2250 | |
| 2251 | /***************************************************************************** |
| 2252 | |
| 2253 | FUNCTION NAME: calcChecksum |
| 2254 | |
| 2255 | DESCRIPTION: |
| 2256 | |
| 2257 | Calculates the checksum for the data pointed to by ptrtodata whose size |
| 2258 | is given by sizeofdata. The function also inverts the checksum before |
| 2259 | returning it. |
| 2260 | |
| 2261 | PARAMETERS: |
| 2262 | |
| 2263 | kal_uint8 *ptrtodata - pointer to the data whose checksum has to be calc |
| 2264 | kal_uint16 sizeofdata - size of the data whose checksum has to be calc |
| 2265 | (this does not incl the checksum size) |
| 2266 | |
| 2267 | RETURNED VALUES: Inverted checksum. |
| 2268 | |
| 2269 | *****************************************************************************/ |
| 2270 | kal_uint16 calcChecksum(kal_uint8 *ptrtodata, kal_uint16 sizeofdata); |
| 2271 | |
| 2272 | /**************************************************************************** |
| 2273 | * |
| 2274 | * Name: SysBondoutOptionGet () |
| 2275 | * |
| 2276 | * Description: This routine returns the chip's bondout option configuration. |
| 2277 | * |
| 2278 | * Parameters: None |
| 2279 | * |
| 2280 | * Returns: SysBondoutOptionsT - Bondout option |
| 2281 | * |
| 2282 | ****************************************************************************/ |
| 2283 | SysBondoutOptionsT SysBondoutOptionGet (void); |
| 2284 | |
| 2285 | /**************************************************************************** |
| 2286 | * |
| 2287 | * Name: SysIsVoiceSupported() |
| 2288 | * |
| 2289 | * Description: This routine returns a kal_boolean indicating whether voice is |
| 2290 | * supported based on the chip's bondout option configuration. |
| 2291 | * |
| 2292 | * Parameters: None |
| 2293 | * |
| 2294 | * Returns: KAL_TRUE if voice is supported, KAL_FALSE otherwise |
| 2295 | * |
| 2296 | ****************************************************************************/ |
| 2297 | kal_bool SysIsVoiceSupported (void); |
| 2298 | |
| 2299 | |
| 2300 | /**************************************************************************** |
| 2301 | * |
| 2302 | * Name: SysIsDORevASupported() |
| 2303 | * |
| 2304 | * Description: This routine returns a kal_boolean indicating whether or not EV-DO |
| 2305 | * RevA is supported based on the chip's bondout option configuration. |
| 2306 | * |
| 2307 | * Parameters: None |
| 2308 | * |
| 2309 | * Returns: KAL_TRUE if EV-DO RevA is supported, KAL_FALSE otherwise |
| 2310 | * |
| 2311 | ****************************************************************************/ |
| 2312 | kal_bool SysIsDORevASupported (void); |
| 2313 | |
| 2314 | /**************************************************************************** |
| 2315 | * |
| 2316 | * Name: sysIsFeatureSupported() |
| 2317 | * |
| 2318 | * Description: This routine returns whether a system wide feature is |
| 2319 | * supported. |
| 2320 | * |
| 2321 | * Parameters: SysFeatures Feature |
| 2322 | * |
| 2323 | * Returns: kal_bool - KAL_FALSE: Feature not supported |
| 2324 | * KAL_TRUE: Feature supported |
| 2325 | * |
| 2326 | ****************************************************************************/ |
| 2327 | kal_bool sysIsFeatureSupported(SysFeatureId Feature); |
| 2328 | |
| 2329 | |
| 2330 | /**************************************************************************** |
| 2331 | * |
| 2332 | * Name: sysSWFeatureValue() |
| 2333 | * |
| 2334 | * Description: Returns an indication as to which variation of a software |
| 2335 | * feature is supported. |
| 2336 | * |
| 2337 | * Parameters: SysFeatures Feature |
| 2338 | * |
| 2339 | * Returns: |
| 2340 | * |
| 2341 | ****************************************************************************/ |
| 2342 | kal_uint32 sysSWFeatureValue(SysFeatureId Feature); |
| 2343 | |
| 2344 | /**************************************************************************** |
| 2345 | * |
| 2346 | * Name: sysGetCarrierdId() |
| 2347 | * |
| 2348 | * Description: Returns the carrier Id for which the SW was compiled for |
| 2349 | * |
| 2350 | * Parameters: none |
| 2351 | * |
| 2352 | * Returns: SysCarrierId enum |
| 2353 | * |
| 2354 | ****************************************************************************/ |
| 2355 | SysCarrierId sysGetCarrierId(void); |
| 2356 | |
| 2357 | |
| 2358 | |
| 2359 | /***************************************************************************** |
| 2360 | |
| 2361 | FUNCTION NAME: SysTransitionReq |
| 2362 | |
| 2363 | DESCRIPTION: |
| 2364 | |
| 2365 | This routine requests transition from 1x to Do and vice versa. |
| 2366 | |
| 2367 | PARAMETERS: |
| 2368 | |
| 2369 | SysAirInterfaceT NewAirInterface |
| 2370 | kal_bool HybridMode |
| 2371 | |
| 2372 | RETURNED VALUES: |
| 2373 | |
| 2374 | None. |
| 2375 | |
| 2376 | *****************************************************************************/ |
| 2377 | kal_uint8 SysTransitionReq(SysAirInterfaceT NewAirInterface); |
| 2378 | |
| 2379 | |
| 2380 | |
| 2381 | /**************************************************************************** |
| 2382 | * |
| 2383 | * Name: max8 |
| 2384 | * |
| 2385 | * Scope: public |
| 2386 | * |
| 2387 | * Description: Returns the greater of two kal_uint8 values. |
| 2388 | * |
| 2389 | * Parameters: |
| 2390 | * kal_uint8 a - First value. |
| 2391 | * kal_uint8 b - Second value. |
| 2392 | * |
| 2393 | * Returns: |
| 2394 | * kal_uint8 |
| 2395 | * |
| 2396 | * Notes: |
| 2397 | * |
| 2398 | ****************************************************************************/ |
| 2399 | kal_uint8 max8 (kal_uint8 a, kal_uint8 b); |
| 2400 | |
| 2401 | /**************************************************************************** |
| 2402 | * |
| 2403 | * Name: min8 |
| 2404 | * |
| 2405 | * Scope: public |
| 2406 | * |
| 2407 | * Description: Returns the lesser of two kal_uint8 values. |
| 2408 | * |
| 2409 | * Parameters: |
| 2410 | * kal_uint8 a - First value. |
| 2411 | * kal_uint8 b - Second value. |
| 2412 | * |
| 2413 | * Returns: |
| 2414 | * kal_uint8 |
| 2415 | * |
| 2416 | * Notes: |
| 2417 | * |
| 2418 | ****************************************************************************/ |
| 2419 | kal_uint8 min8 (kal_uint8 a, kal_uint8 b); |
| 2420 | |
| 2421 | /**************************************************************************** |
| 2422 | * |
| 2423 | * Name: max16 |
| 2424 | * |
| 2425 | * Scope: public |
| 2426 | * |
| 2427 | * Description: Returns the greater of two kal_uint16 values. |
| 2428 | * |
| 2429 | * Parameters: |
| 2430 | * kal_uint16 a - First value. |
| 2431 | * kal_uint16 b - Second value. |
| 2432 | * |
| 2433 | * Returns: |
| 2434 | * kal_uint16 |
| 2435 | * |
| 2436 | * Notes: |
| 2437 | * |
| 2438 | ****************************************************************************/ |
| 2439 | kal_uint16 max16 (kal_uint16 a, kal_uint16 b); |
| 2440 | |
| 2441 | /**************************************************************************** |
| 2442 | * |
| 2443 | * Name: min16 |
| 2444 | * |
| 2445 | * Scope: public |
| 2446 | * |
| 2447 | * Description: Returns the lesser of two kal_uint16 values. |
| 2448 | * |
| 2449 | * Parameters: |
| 2450 | * kal_uint16 a - First value. |
| 2451 | * kal_uint16 b - Second value. |
| 2452 | * |
| 2453 | * Returns: |
| 2454 | * kal_uint16 |
| 2455 | * |
| 2456 | * Notes: |
| 2457 | * |
| 2458 | ****************************************************************************/ |
| 2459 | kal_uint16 min16 (kal_uint16 a, kal_uint16 b); |
| 2460 | |
| 2461 | /***************************************************************************** |
| 2462 | |
| 2463 | FUNCTION NAME: C2KPerfRecovery |
| 2464 | |
| 2465 | DESCRIPTION: flight mode recovery API |
| 2466 | |
| 2467 | PARAMETERS: module_id: module id,such as MOD_CPSW |
| 2468 | debug_info: the information to be printed |
| 2469 | debug_length: the length of debug_info |
| 2470 | |
| 2471 | RETURNED VALUES: None |
| 2472 | |
| 2473 | *****************************************************************************/ |
| 2474 | void C2KPerfRecovery( module_type module_id, C2kSysRecoverDbgInfoT* debug_info, |
| 2475 | const char* debug_file, kal_uint16 debug_line); |
| 2476 | |
| 2477 | /***************************************************************************** |
| 2478 | |
| 2479 | FUNCTION NAME: C2K_PERF_RECOVERY |
| 2480 | |
| 2481 | DESCRIPTION: C2K PERF recovery API |
| 2482 | |
| 2483 | PARAMETERS: module_id: module id,such as MOD_CPSW |
| 2484 | p_buffer: pointer to debug variable |
| 2485 | buf_size: the size of debug variable |
| 2486 | |
| 2487 | RETURNED VALUES: None |
| 2488 | |
| 2489 | *****************************************************************************/ |
| 2490 | |
| 2491 | #define C2K_PERF_RECOVERY(module_id,p_buffer,buf_size) \ |
| 2492 | { \ |
| 2493 | protocol_exception_recovery_info_struct info; \ |
| 2494 | info.protocol_id = ((ValIratGetSimAccessIndex() >= UIM_IRAT_ACCESS_REMOTE_SIM1) && (ValIratGetSimAccessIndex() < UIM_IRAT_ACCESS_NUM)) \ |
| 2495 | ?(ValIratGetSimAccessIndex() - UIM_IRAT_ACCESS_REMOTE_SIM1):(PEFR_ALL_PROTOCOL_ID); \ |
| 2496 | info.debug.p_buf = (p_buffer); \ |
| 2497 | info.debug.size = (buf_size); \ |
| 2498 | PROTOCOL_EXCEPTION_RECOVERY((module_id), RECOVERY_TYPE_FLIGHT_MODE, &info); \ |
| 2499 | } |
| 2500 | |
| 2501 | /**************************************************************************** |
| 2502 | * |
| 2503 | * Name: waitForExtMsg |
| 2504 | * |
| 2505 | * Scope: public |
| 2506 | * |
| 2507 | * Description: Wait for an external message |
| 2508 | * |
| 2509 | * Parameters: |
| 2510 | * kal_uint32 expMsgId - Id of the expected external message. |
| 2511 | * ilm_struct *ilm - pointer to the received expected message. |
| 2512 | * |
| 2513 | * Returns: |
| 2514 | * void |
| 2515 | * |
| 2516 | * Notes: |
| 2517 | * Do NOT forget to destroy the expected ilm after calling this function |
| 2518 | ****************************************************************************/ |
| 2519 | extern void waitForExtMsg(kal_uint32 expMsgId, ilm_struct *ilm); |
| 2520 | |
| 2521 | |
| 2522 | extern void SysInitWaitEg(void); |
| 2523 | |
| 2524 | extern void SysInitSetEg(void); |
| 2525 | |
| 2526 | |
| 2527 | /***************************************************************************** |
| 2528 | |
| 2529 | Empty MACRO stubbing for MON&HWD sleep |
| 2530 | |
| 2531 | *****************************************************************************/ |
| 2532 | #define MonDeepSleepStatistInit(SetDefaultCheckLength) |
| 2533 | #define MonDeepSleepStatistCtrlMsg(CheckLengthP) |
| 2534 | #define MonDeepClearSleepRecordInfo() |
| 2535 | #define MonDeepReadSleepRecordInfo(SleepCnts,MdSystemTime1,MdSystemTime2,MdRtcCnts,AllSleepduration) |
| 2536 | #define MonDeepRecordRtcCntOfEnterSleep() |
| 2537 | #define MonDeepRecordTotalSleepDuration() |
| 2538 | #define MonDeepRecordSystimeOfExitSleep() |
| 2539 | |
| 2540 | #endif |
| 2541 | |
| 2542 | /***************************************************************************** |
| 2543 | * removed! |
| 2544 | *****************************************************************************/ |
| 2545 | |
| 2546 | /**Log information: \main\CBP80\cbp80_cshen_scbp10098\1 2012-07-26 06:27:42 GMT cshen |
| 2547 | ** cbp80_cshen_scbp10098**/ |
| 2548 | /**Log information: \main\Trophy\Trophy_czhang_href21785\1 2013-11-25 02:42:46 GMT czhang |
| 2549 | ** HREF#21785**/ |
| 2550 | /**Log information: \main\Trophy\1 2013-11-25 02:55:25 GMT czhang |
| 2551 | ** HREF#21785**/ |
| 2552 | /**Log information: \main\Trophy\Trophy_xding_href22331\1 2013-12-10 07:18:04 GMT xding |
| 2553 | ** HREF#22331, ºÏ²¢MMCÏà¹Ø¹¦Äܵ½Trophy baselineÉÏ**/ |
| 2554 | /**Log information: \main\Trophy\2 2013-12-10 08:33:42 GMT jzwang |
| 2555 | ** href#22331:Merge MMC latest implementation from Qilian branch.**/ |
| 2556 | |
| 2557 | |
| 2558 | |
| 2559 | |
| 2560 | |