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) 2005 |
| 8 | * |
| 9 | * BY OPENING THIS FILE, BUYER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES |
| 10 | * THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE") |
| 11 | * RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO BUYER ON |
| 12 | * AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES, |
| 13 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF |
| 14 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT. |
| 15 | * NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE |
| 16 | * SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR |
| 17 | * SUPPLIED WITH THE MEDIATEK SOFTWARE, AND BUYER AGREES TO LOOK ONLY TO SUCH |
| 18 | * THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. MEDIATEK SHALL ALSO |
| 19 | * NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE RELEASES MADE TO BUYER'S |
| 20 | * SPECIFICATION OR TO CONFORM TO A PARTICULAR STANDARD OR OPEN FORUM. |
| 21 | * |
| 22 | * BUYER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND CUMULATIVE |
| 23 | * LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE, |
| 24 | * AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE, |
| 25 | * OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY BUYER TO |
| 26 | * MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE. |
| 27 | * |
| 28 | * THE TRANSACTION CONTEMPLATED HEREUNDER SHALL BE CONSTRUED IN ACCORDANCE |
| 29 | * WITH THE LAWS OF THE STATE OF CALIFORNIA, USA, EXCLUDING ITS CONFLICT OF |
| 30 | * LAWS PRINCIPLES. ANY DISPUTES, CONTROVERSIES OR CLAIMS ARISING THEREOF AND |
| 31 | * RELATED THERETO SHALL BE SETTLED BY ARBITRATION IN SAN FRANCISCO, CA, UNDER |
| 32 | * THE RULES OF THE INTERNATIONAL CHAMBER OF COMMERCE (ICC). |
| 33 | * |
| 34 | *****************************************************************************/ |
| 35 | |
| 36 | /******************************************************************************* |
| 37 | * Filename: |
| 38 | * --------- |
| 39 | * gps_common.h |
| 40 | * |
| 41 | * Project: |
| 42 | * -------- |
| 43 | * MAUI |
| 44 | * |
| 45 | * Description: |
| 46 | * ------------ |
| 47 | * GPS related interface hand file, such as GPS uart and NMEA parser |
| 48 | * |
| 49 | * Author: |
| 50 | * ------- |
| 51 | * ------- |
| 52 | * |
| 53 | *============================================================================ |
| 54 | * HISTORY |
| 55 | * Below this line, this part is controlled by PVCS VM. DO NOT MODIFY!! |
| 56 | *------------------------------------------------------------------------------ |
| 57 | * removed! |
| 58 | * |
| 59 | * removed! |
| 60 | * removed! |
| 61 | * removed! |
| 62 | * removed! |
| 63 | * |
| 64 | * removed! |
| 65 | * removed! |
| 66 | * removed! |
| 67 | * |
| 68 | * removed! |
| 69 | * removed! |
| 70 | * removed! |
| 71 | * removed! |
| 72 | * |
| 73 | * removed! |
| 74 | * removed! |
| 75 | * removed! |
| 76 | * removed! |
| 77 | * |
| 78 | * removed! |
| 79 | * removed! |
| 80 | * removed! |
| 81 | * |
| 82 | * removed! |
| 83 | * removed! |
| 84 | * removed! |
| 85 | * |
| 86 | * removed! |
| 87 | * removed! |
| 88 | * removed! |
| 89 | * |
| 90 | * removed! |
| 91 | * removed! |
| 92 | * removed! |
| 93 | * |
| 94 | * removed! |
| 95 | * removed! |
| 96 | * removed! |
| 97 | * |
| 98 | * removed! |
| 99 | * removed! |
| 100 | * removed! |
| 101 | * |
| 102 | * removed! |
| 103 | * removed! |
| 104 | * removed! |
| 105 | * removed! |
| 106 | * |
| 107 | * removed! |
| 108 | * removed! |
| 109 | * removed! |
| 110 | * |
| 111 | * removed! |
| 112 | * removed! |
| 113 | * |
| 114 | * removed! |
| 115 | * removed! |
| 116 | * |
| 117 | * removed! |
| 118 | * removed! |
| 119 | * removed! |
| 120 | * removed! |
| 121 | * |
| 122 | * removed! |
| 123 | * removed! |
| 124 | * removed! |
| 125 | * |
| 126 | * removed! |
| 127 | * removed! |
| 128 | * removed! |
| 129 | * |
| 130 | * removed! |
| 131 | * removed! |
| 132 | * removed! |
| 133 | * |
| 134 | * removed! |
| 135 | * removed! |
| 136 | * removed! |
| 137 | * |
| 138 | * removed! |
| 139 | * removed! |
| 140 | * removed! |
| 141 | * |
| 142 | * removed! |
| 143 | * removed! |
| 144 | * removed! |
| 145 | * removed! |
| 146 | * |
| 147 | * removed! |
| 148 | * removed! |
| 149 | * removed! |
| 150 | * removed! |
| 151 | * |
| 152 | * removed! |
| 153 | * removed! |
| 154 | * removed! |
| 155 | * removed! |
| 156 | * |
| 157 | * removed! |
| 158 | * removed! |
| 159 | * removed! |
| 160 | * removed! |
| 161 | * |
| 162 | * removed! |
| 163 | * removed! |
| 164 | * removed! |
| 165 | * removed! |
| 166 | * |
| 167 | * removed! |
| 168 | * removed! |
| 169 | * removed! |
| 170 | * |
| 171 | * removed! |
| 172 | * removed! |
| 173 | * removed! |
| 174 | * |
| 175 | * removed! |
| 176 | * removed! |
| 177 | * removed! |
| 178 | * |
| 179 | *------------------------------------------------------------------------------ |
| 180 | * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!! |
| 181 | *============================================================================ |
| 182 | *******************************************************************************/ |
| 183 | #ifndef _GPS_COMMON_H_ |
| 184 | #define _GPS_COMMON_H_ |
| 185 | |
| 186 | #include "kal_public_defs.h" |
| 187 | #include "kal_general_types.h" |
| 188 | #include "ps_public_utility.h" |
| 189 | #include "lbs_common_enum.h" |
| 190 | #include "gnss2lcsp_enum.h" |
| 191 | |
| 192 | |
| 193 | #define GPS_PARSER_P_VERSION_MAX 32 |
| 194 | #define GPS_NMEA_MAX_SVVIEW 20 |
| 195 | #define GPS_NMEA_MESSAGE_MAX_LENGTH (100) |
| 196 | |
| 197 | /* mdi_datatype.h UART port 7000 */ |
| 198 | #define RES_GPS_UART_SUCCEED 0 |
| 199 | #define RES_GPS_UART_ERR_PORT_NUMBER_WRONG -7002 |
| 200 | #define RES_GPS_UART_ERR_PORT_ERR_UNKNOW -7005 |
| 201 | #define RES_GPS_UART_ERR_NO_SLOT -7007 |
| 202 | |
| 203 | #define AGPS_NR_AS_MAX_SERVING_CELL_NUM 8 /* We truncate the maximum number due to CCCI channl limitation.*/ |
| 204 | #define AGPS_NR_AS_MAX_MEASURED_CELL_NUM 32 |
| 205 | |
| 206 | |
| 207 | /*Data type for callback function of NMEA data or parserred data*/ |
| 208 | typedef enum |
| 209 | { |
| 210 | GPS_PARSER_RAW_DATA = 0, /*Raw data of NMEA*/ |
| 211 | GPS_PARSER_NMEA_GGA, /*Data structure of GGA info*/ |
| 212 | GPS_PARSER_NMEA_GLL, /*Data structure of GLL info*/ |
| 213 | GPS_PARSER_NMEA_GSA, /*Data structure of GSA info*/ |
| 214 | GPS_PARSER_NMEA_GSV, /*Data structure of GSV info*/ |
| 215 | GPS_PARSER_NMEA_RMC, /*Data structure of RMC info*/ |
| 216 | GPS_PARSER_NMEA_VTG, /*Data structure of VTG info*/ |
| 217 | GPS_PARSER_NMEA_SENTENCE, |
| 218 | GPS_UART_EVENT_VPORT_LOST, /*Virtual port is lost, maybe bluetooth connection is break(not support current)*/ |
| 219 | GPS_SHOW_AGPS_ICON, |
| 220 | GPS_HIDE_AGPS_ICON, |
| 221 | GPS_PARSER_NMEA_END, |
| 222 | GPS_PARSER_MA_STATUS = 255 |
| 223 | } gps_common_parser_info_enum; |
| 224 | |
| 225 | |
| 226 | /*Enum of GPS command*/ |
| 227 | typedef enum |
| 228 | { |
| 229 | GPS_UART_GPS_WARM_START = 0, /*Let GPS do warm start*/ |
| 230 | GPS_UART_GPS_HOT_START, /*Let GPS do hot start*/ |
| 231 | GPS_UART_GPS_COLD_START, /*Let GPS do cold start*/ |
| 232 | GPS_UART_GPS_VERSION, |
| 233 | GPS_UART_GPS_ENABLE_DEBUG_INFO, |
| 234 | GPS_UART_GPS_SWITCH_MODE_MA, |
| 235 | GPS_UART_GPS_SWITCH_MODE_MB, |
| 236 | GPS_UART_GPS_SWITCH_MODE_NORMAL, |
| 237 | GPS_UART_GPS_QUERY_POS, |
| 238 | GPS_UART_GPS_QUERY_MEAS, |
| 239 | GPS_UART_GPS_CLEAR_NVRAM, /*Clear GPS NVRAM*/ |
| 240 | GPS_UART_GPS_AGPS_START, /*Clear GPS data*/ |
| 241 | GPS_UART_GPS_SLEEP, /*Let GPS chip goto sleep mode*/ |
| 242 | GPS_UART_GPS_STOP, /*Let GPS chip stop*/ |
| 243 | GPS_UART_GPS_WAKE_UP, /*Let GPS chip wake up from sleep mode*/ |
| 244 | GPS_UART_GPS_DUMMY = -1 |
| 245 | } gps_common_uart_cmd_type_enum; |
| 246 | |
| 247 | /*Enum of GPS work mode*/ |
| 248 | typedef enum |
| 249 | { |
| 250 | GPS_UART_MODE_RAW_DATA = 0, /*Just need raw data*/ |
| 251 | GPS_UART_MODE_LOCATION, /*Just need location*/ |
| 252 | GPS_UART_MODE_LOCATION_WITH_QOP /*Need AGPS data with Qop*/ |
| 253 | } gps_common_uart_work_mode_enum; |
| 254 | |
| 255 | typedef struct |
| 256 | { |
| 257 | LOCAL_PARA_HDR |
| 258 | kal_uint32 length; |
| 259 | kal_uint8 data[GPS_NMEA_MESSAGE_MAX_LENGTH]; |
| 260 | }gps_common_uart_write_req_struct; |
| 261 | |
| 262 | typedef struct |
| 263 | { |
| 264 | kal_int8 hour; |
| 265 | kal_int8 minute; |
| 266 | kal_int8 second; |
| 267 | kal_int8 millisecond; |
| 268 | } gps_common_nmea_utc_time_struct; |
| 269 | |
| 270 | typedef struct |
| 271 | { |
| 272 | kal_int8 year; |
| 273 | kal_int8 month; |
| 274 | kal_int8 day; |
| 275 | } gps_common_nmea_utc_date_struct; |
| 276 | |
| 277 | /*GPGGA -- Global Positioning System Fix Data*/ |
| 278 | typedef struct |
| 279 | { |
| 280 | double latitude; /*Latitude South<0 North>0*/ |
| 281 | double longitude; /*Longitude West<0 east>0*/ |
| 282 | float h_precision; /*Horizontal Dilution of precision*/ |
| 283 | double altitude; /*Antenna Altitude above/below mean-sea-level (geoid)*/ |
| 284 | float unit_of_altitude; /*Units of antenna altitude, meters*/ |
| 285 | float geoidal ; /*Geoidal separation, the difference between the WGS-84 earth*/ |
| 286 | float unit_of_geoidal; /*Units of geoidal separation, meters*/ |
| 287 | float gps_age; /*Age of differential GPS data, time in seconds since last SC104*/ |
| 288 | kal_uint16 station_id; /*Differential reference station ID, 0000-1023*/ |
| 289 | kal_uint8 sat_in_view; /*Number of satellites in use*/ |
| 290 | gps_common_nmea_utc_time_struct utc_time; /*Time (UTC)*/ |
| 291 | kal_int8 north_south; /*north or south*/ |
| 292 | kal_int8 east_west; /*east or west*/ |
| 293 | kal_int8 quality; /*GPS Quality Indicator*/ |
| 294 | } gps_common_nmea_gga_struct; |
| 295 | |
| 296 | |
| 297 | /*GPGSA -- GNSS DOP and Active Satellites*/ |
| 298 | typedef struct |
| 299 | { |
| 300 | float pdop; /*PDOP in meters*/ |
| 301 | float hdop; /*HDOP in meters*/ |
| 302 | float vdop; /*VDOP in meters*/ |
| 303 | kal_uint16 sate_id[12]; /*ID of satellites*/ |
| 304 | kal_int8 op_mode; /*Selection mode: A=auto M=manual*/ |
| 305 | kal_int8 fix_mode; /*Mode*/ |
| 306 | } gps_common_nmea_gsa_struct; |
| 307 | |
| 308 | |
| 309 | /*GPGSV -- GNSS Satellites in View*/ |
| 310 | typedef struct |
| 311 | { |
| 312 | kal_int16 msg_sum; /*total number of messages*/ |
| 313 | kal_int16 msg_index; /*message number*/ |
| 314 | kal_int16 sates_in_view; /*satellites in view*/ |
| 315 | kal_int16 max_snr; /*Max snr*/ |
| 316 | kal_int16 min_snr; /*Min snr*/ |
| 317 | kal_int16 num_sv_trk; /*satellite number*/ |
| 318 | struct |
| 319 | { |
| 320 | kal_uint8 sate_id; /*satellite id*/ |
| 321 | kal_uint8 elevation; /*elevation in degrees*/ |
| 322 | kal_int16 azimuth; /*azimuth in degrees to true*/ |
| 323 | kal_uint8 snr; /*SNR in dB*/ |
| 324 | } rsv[GPS_NMEA_MAX_SVVIEW]; |
| 325 | } gps_common_nmea_gsv_struct; |
| 326 | |
| 327 | |
| 328 | /*GPRMC -- Recommended Minimum Specific GNSS Data*/ |
| 329 | typedef struct |
| 330 | { |
| 331 | double latitude; /*latitude*/ |
| 332 | double longitude; /*longitude*/ |
| 333 | float ground_speed; /*Speed over ground, knots*/ |
| 334 | float trace_degree; /*Track mode degrees,north is 0*/ |
| 335 | float magnetic; |
| 336 | gps_common_nmea_utc_time_struct utc_time; /*UTC time*/ |
| 337 | gps_common_nmea_utc_date_struct utc_date; /*UTC date*/ |
| 338 | kal_int8 status; /*Status, V = Navigation receiver warning*/ |
| 339 | kal_int8 north_south; /*N or S*/ |
| 340 | kal_int8 east_west; /*E or W*/ |
| 341 | kal_int8 magnetic_e_w; /*Magnetic E or W*/ |
| 342 | kal_int8 cmode; /*Mode*/ |
| 343 | } gps_common_nmea_rmc_struct; |
| 344 | |
| 345 | |
| 346 | /*GPGLL -- Geographic Position - Latitude/Longitude*/ |
| 347 | typedef struct |
| 348 | { |
| 349 | double latitude; /*latitude*/ |
| 350 | double longitude; /*longitude*/ |
| 351 | gps_common_nmea_utc_time_struct utc_time; /*UTC time*/ |
| 352 | kal_int8 north_south; /*N or S*/ |
| 353 | kal_int8 east_west; /*E or W*/ |
| 354 | kal_int8 status; /*Status A - Data Valid, V - Data Invalid*/ |
| 355 | kal_int8 mode; /*mode*/ |
| 356 | } gps_common_nmea_gll_struct; |
| 357 | |
| 358 | |
| 359 | /*GPVTG -- VTG Data*/ |
| 360 | typedef struct |
| 361 | { |
| 362 | float true_heading; /*Track Degrees*/ |
| 363 | float mag_heading; /*Magnetic Track Degrees*/ |
| 364 | float hspeed_knot; /*Speed Knots*/ |
| 365 | float hspeed_km; /*Speed Kilometers Per Hour*/ |
| 366 | kal_int8 mode; /*Mode*/ |
| 367 | } gps_common_nmea_vtg_struct; |
| 368 | |
| 369 | |
| 370 | typedef struct |
| 371 | { |
| 372 | kal_char version[GPS_PARSER_P_VERSION_MAX]; |
| 373 | kal_uint32 number; |
| 374 | } gps_common_p_release_struct; |
| 375 | |
| 376 | typedef struct |
| 377 | { |
| 378 | gps_common_p_release_struct release; |
| 379 | } gps_common_p_info_struct; |
| 380 | |
| 381 | typedef struct |
| 382 | { |
| 383 | LOCAL_PARA_HDR |
| 384 | kal_uint16 port; |
| 385 | kal_char* buffer; |
| 386 | kal_uint32 length; |
| 387 | }gps_uart_log_write_struct; |
| 388 | |
| 389 | #if defined(__GPS_SUPPORT__)||defined(__BT_GPS_SUPPORT__) |
| 390 | kal_uint16 gnss_agnss_capability_query(void); |
| 391 | void gnss_agnss_capability_set(kal_uint16 gnssMethod); |
| 392 | kal_bool gnss_is_agps_supported(void); |
| 393 | kal_uint8 gnss_agnss_sid_query(gnss_id_enum gnssID); |
| 394 | #endif /* #if defined(__GPS_SUPPORT__)||defined(__BT_GPS_SUPPORT__) */ |
| 395 | |
| 396 | /*Enum of GNSS rat mode*/ |
| 397 | typedef enum |
| 398 | { |
| 399 | GNSS_RAT_GSM = 0, |
| 400 | GNSS_RAT_UMTS, |
| 401 | GNSS_RAT_LTE, |
| 402 | GNSS_RAT_NR |
| 403 | } gnss_rat_enum; |
| 404 | |
| 405 | /* ------------------------------------------------------- */ |
| 406 | /* For Neighbor cell struct, copy from nbr_struct_public.h */ |
| 407 | /* ------------------------------------------------------- */ |
| 408 | |
| 409 | typedef struct |
| 410 | { |
| 411 | kal_uint16 mcc; |
| 412 | kal_uint16 mnc; |
| 413 | kal_uint16 lac; |
| 414 | kal_uint16 ci; |
| 415 | } agps_global_cell_id_struct; |
| 416 | |
| 417 | typedef struct |
| 418 | { |
| 419 | agps_global_cell_id_struct gci; |
| 420 | kal_uint8 nbr_meas_rslt_index; |
| 421 | } agps_gas_cell_info_struct; |
| 422 | |
| 423 | typedef struct |
| 424 | { |
| 425 | kal_uint16 arfcn; |
| 426 | kal_uint8 bsic; |
| 427 | kal_uint8 rxlev; |
| 428 | } agps_gas_nbr_cell_meas_struct; |
| 429 | |
| 430 | typedef struct |
| 431 | { |
| 432 | kal_int8 nbr_meas_num; |
| 433 | agps_gas_nbr_cell_meas_struct nbr_cells[15]; |
| 434 | } agps_gas_nbr_meas_struct; |
| 435 | |
| 436 | typedef struct |
| 437 | { |
| 438 | agps_gas_cell_info_struct serv_info; |
| 439 | kal_uint8 ta; |
| 440 | kal_uint8 ordered_tx_pwr_lev; |
| 441 | kal_uint8 nbr_cell_num; |
| 442 | agps_gas_cell_info_struct nbr_cell_info[6]; |
| 443 | agps_gas_nbr_meas_struct nbr_meas_rslt; |
| 444 | } agps_gas_nbr_cell_info_struct; |
| 445 | |
| 446 | /* WCDMA cell info */ |
| 447 | typedef struct |
| 448 | { |
| 449 | kal_uint8 uarfcn_ul_used; |
| 450 | kal_uint16 uarfcn_ul; |
| 451 | kal_uint16 uarfcn_dl; |
| 452 | } agps_uas_freq_info_fdd_struct; |
| 453 | |
| 454 | typedef struct |
| 455 | { |
| 456 | kal_uint16 uarfcn; |
| 457 | } agps_uas_freq_info_tdd_struct; |
| 458 | |
| 459 | typedef struct agps_uas_freq_info_mode_specific_info_struct |
| 460 | { |
| 461 | kal_uint8 mode; // uas_freq_info_mode_enum |
| 462 | union |
| 463 | { |
| 464 | agps_uas_freq_info_fdd_struct fdd; |
| 465 | agps_uas_freq_info_tdd_struct tdd; |
| 466 | } choice; |
| 467 | } agps_uas_freq_info_mode_specific_info_struct; |
| 468 | |
| 469 | typedef struct |
| 470 | { |
| 471 | agps_uas_freq_info_mode_specific_info_struct mode_specific_info; |
| 472 | } agps_uas_freq_info_struct; |
| 473 | |
| 474 | typedef struct |
| 475 | { |
| 476 | kal_uint16 psc; |
| 477 | kal_uint8 cpich_Ec_N0_used; |
| 478 | kal_uint8 cpich_Ec_N0; |
| 479 | kal_uint8 cpich_rscp_used; |
| 480 | kal_uint8 cpich_rscp; |
| 481 | kal_uint8 pathloss_used; |
| 482 | kal_uint8 pathloss; |
| 483 | } agps_uas_cell_measured_results_fdd_struct; |
| 484 | |
| 485 | typedef struct |
| 486 | { |
| 487 | kal_uint8 num; |
| 488 | kal_uint8 element[2*7]; |
| 489 | } agps_uas_cell_measured_result_tdd_timeslot_iscp_struct; |
| 490 | |
| 491 | typedef struct |
| 492 | { |
| 493 | kal_uint8 cellParameterId; |
| 494 | kal_uint8 tgsn_used; |
| 495 | kal_uint8 tgsn; |
| 496 | kal_uint8 pccpch_rscp_used; |
| 497 | kal_uint8 pccpch_rscp; |
| 498 | kal_uint8 pathloss_used; |
| 499 | kal_uint8 pathloss; |
| 500 | kal_uint8 timeSlot_iscp_used; |
| 501 | agps_uas_cell_measured_result_tdd_timeslot_iscp_struct timeslot_iscp_list; |
| 502 | |
| 503 | } agps_uas_cell_measured_results_tdd_struct; |
| 504 | |
| 505 | typedef struct agps_uas_cell_measured_results_mode_specific_info_struct |
| 506 | { |
| 507 | kal_uint8 mode; // uas_cell_measured_results_mode_enum |
| 508 | |
| 509 | union |
| 510 | { |
| 511 | agps_uas_cell_measured_results_fdd_struct fdd; |
| 512 | agps_uas_cell_measured_results_tdd_struct tdd; |
| 513 | } choice; |
| 514 | } agps_uas_cell_measured_results_mode_specific_info_struct; |
| 515 | |
| 516 | typedef struct |
| 517 | { |
| 518 | kal_uint8 cell_id_used; |
| 519 | kal_uint32 cell_id; |
| 520 | agps_uas_cell_measured_results_mode_specific_info_struct mode_specific_info; |
| 521 | } agps_uas_cell_measured_results_struct; |
| 522 | |
| 523 | typedef struct |
| 524 | { |
| 525 | kal_uint8 num; |
| 526 | agps_uas_cell_measured_results_struct element[6]; |
| 527 | } agps_uas_cell_measured_results_list_struct; |
| 528 | |
| 529 | typedef struct |
| 530 | { |
| 531 | kal_uint8 freq_info_used; |
| 532 | agps_uas_freq_info_struct freq_info; |
| 533 | kal_uint8 utra_carrier_rssi_used; |
| 534 | kal_uint8 utra_carrier_rssi; |
| 535 | kal_uint8 cell_measured_results_list_used; |
| 536 | agps_uas_cell_measured_results_list_struct cell_measured_results_list; |
| 537 | } agps_uas_measured_results_struct; |
| 538 | |
| 539 | typedef struct |
| 540 | { |
| 541 | kal_uint8 num; |
| 542 | agps_uas_measured_results_struct element[3]; |
| 543 | } agps_uas_measured_results_list_struct; |
| 544 | |
| 545 | typedef struct agps_uas_cell_plmn_id_struct |
| 546 | { |
| 547 | kal_uint16 mcc; |
| 548 | kal_uint16 mnc; |
| 549 | } agps_uas_cell_plmn_id_struct; |
| 550 | |
| 551 | typedef struct |
| 552 | { |
| 553 | kal_uint8 is_LAC_valid; |
| 554 | kal_uint16 lac; |
| 555 | kal_uint8 is_RAC_valid; |
| 556 | kal_uint8 rac; |
| 557 | kal_uint8 num_plmn_id; |
| 558 | agps_uas_cell_plmn_id_struct plmn_id_list[6]; |
| 559 | } agps_uas_cell_info_struct; |
| 560 | |
| 561 | typedef struct |
| 562 | { |
| 563 | kal_uint8 num; |
| 564 | agps_uas_cell_info_struct cell_info[6]; |
| 565 | } agps_uas_cell_info_list_struct; |
| 566 | |
| 567 | typedef struct |
| 568 | { |
| 569 | agps_uas_cell_info_list_struct cell_info_list; |
| 570 | } agps_uas_cell_info_per_freq_struct; |
| 571 | |
| 572 | /* Measurement results of most 3 different UARFCN's */ |
| 573 | typedef struct |
| 574 | { |
| 575 | kal_uint8 num_freq; |
| 576 | agps_uas_cell_info_per_freq_struct cell_info_per_freq[3]; |
| 577 | } agps_uas_cell_info_ext_struct; |
| 578 | |
| 579 | typedef struct |
| 580 | { |
| 581 | kal_uint16 mcc; |
| 582 | kal_uint16 mnc; |
| 583 | kal_uint32 uc; |
| 584 | kal_uint8 freq_info_used; |
| 585 | agps_uas_freq_info_struct freq_info; |
| 586 | kal_uint8 psc_used; |
| 587 | kal_uint16 psc; |
| 588 | kal_uint8 measured_results_list_used; |
| 589 | agps_uas_measured_results_list_struct measured_results_list; |
| 590 | |
| 591 | agps_uas_cell_measured_results_mode_specific_info_struct serving_meas_result; |
| 592 | agps_uas_cell_info_struct serving_cell_ext_info; |
| 593 | agps_uas_cell_info_ext_struct cell_info_ext_list; |
| 594 | } agps_uas_nbr_cell_info_struct; |
| 595 | |
| 596 | typedef struct |
| 597 | { |
| 598 | kal_uint32 dl_freq; |
| 599 | kal_uint16 pci; //0~503 |
| 600 | kal_uint8 rsrp; //0~97 |
| 601 | kal_uint8 rsrq; //0~34 |
| 602 | |
| 603 | kal_uint8 is_cell_id_used; |
| 604 | kal_uint32 cell_id; //0~0x0FFFFFFF |
| 605 | kal_uint16 mcc; //0~999 |
| 606 | kal_uint16 mnc; //0~999 |
| 607 | kal_uint8 is_2_digit_mnc; //ncell cell plmn is 2 digits or 3 digits |
| 608 | kal_uint16 tac; //0~65535 |
| 609 | } agps_eas_cell_measured_results_struct; |
| 610 | |
| 611 | /* LTE cell info */ |
| 612 | typedef struct |
| 613 | { |
| 614 | /* Serving cell info */ |
| 615 | kal_uint16 mcc; //0~999 |
| 616 | kal_uint16 mnc; //0~999 |
| 617 | kal_uint8 is_2_digit_mnc; //serving cell plmn is 2 digits or 3 digits |
| 618 | kal_uint32 cell_id; //0~0x0FFFFFFF |
| 619 | kal_uint32 dl_freq; |
| 620 | kal_uint8 ul_freq_used; |
| 621 | kal_uint32 ul_freq; |
| 622 | kal_uint16 pci; //0~503 |
| 623 | kal_uint8 is_ta_used; |
| 624 | kal_uint16 time_advance; //0~1282 |
| 625 | kal_uint8 is_rsrp_valid; |
| 626 | kal_uint8 rsrp; //0~97 |
| 627 | kal_uint8 is_rsrq_valid; |
| 628 | kal_uint8 rsrq; //0~34 |
| 629 | kal_uint16 tac; //0~65535 |
| 630 | |
| 631 | /* Neighbor cell info */ |
| 632 | kal_uint8 num_nbr_cell; |
| 633 | agps_eas_cell_measured_results_struct nbr_cell_list[32]; |
| 634 | } agps_eas_nbr_cell_info_struct; |
| 635 | |
| 636 | typedef struct |
| 637 | { |
| 638 | kal_bool is_rsrp_valid; |
| 639 | kal_uint8 rsrp; // 0~127 |
| 640 | |
| 641 | kal_bool is_rsrq_valid; |
| 642 | kal_uint8 rsrq; // 0~127 |
| 643 | |
| 644 | kal_bool is_sinr_valid; |
| 645 | kal_uint8 sinr; // 0~127 |
| 646 | } agps_ssb_measurement_struct, agps_csi_measurement_struct; |
| 647 | |
| 648 | #pragma pack(push) // Backup the current alignment configuration |
| 649 | #pragma pack(4) // Let the max alignment be 4-byte even if we have an element of alignment 8 like kal_uint64 |
| 650 | /* NR serving cell info */ |
| 651 | typedef struct |
| 652 | { |
| 653 | kal_uint32 phys_cell_id; // 0~1007 |
| 654 | kal_uint32 arfcn; // 0~3279165 |
| 655 | |
| 656 | // In case cell broadcasts several sets of NAS sysinfo, NR AS informs |
| 657 | // first set of NAS sysinfo in SIB1 of the cell. |
| 658 | |
| 659 | // NAS sys info (mcc/mnc/cell_id/tac) validity |
| 660 | kal_bool is_nas_sysinfo_valid; |
| 661 | |
| 662 | kal_uint16 primary_plmn_mcc; // 0~999 |
| 663 | |
| 664 | kal_bool is_2_digit_mnc; |
| 665 | kal_uint16 primary_plmn_mnc; // 0~999 |
| 666 | |
| 667 | kal_uint64 primary_plmn_cell_id; // 36-bit |
| 668 | kal_uint32 primary_plmn_tac; // 24-bit |
| 669 | |
| 670 | kal_bool is_ssb_valid; |
| 671 | agps_ssb_measurement_struct ssb; |
| 672 | |
| 673 | kal_bool is_csi_valid; |
| 674 | agps_csi_measurement_struct csi; |
| 675 | |
| 676 | kal_bool is_ta_valid; |
| 677 | kal_uint16 ta; |
| 678 | } agps_nr_as_serving_cell_info_struct; |
| 679 | |
| 680 | /* NR neighbor cell info */ |
| 681 | typedef struct |
| 682 | { |
| 683 | kal_uint32 phys_cell_id; // 0~1007 |
| 684 | kal_uint32 arfcn; // 0~3279165 |
| 685 | |
| 686 | // In case cell broadcasts several sets of NAS sysinfo, NR AS informs |
| 687 | // first set of NAS sysinfo in SIB1 of the cell. |
| 688 | |
| 689 | // NAS sys info (mcc/mnc/cell_id/tac) validity |
| 690 | kal_bool is_nas_sysinfo_valid; |
| 691 | |
| 692 | kal_uint16 primary_plmn_mcc; // 0~999 |
| 693 | |
| 694 | kal_bool is_2_digit_mnc; |
| 695 | kal_uint16 primary_plmn_mnc; // 0~999 |
| 696 | |
| 697 | kal_uint64 primary_plmn_cell_id; // 36-bit |
| 698 | kal_uint32 primary_plmn_tac; // 24-bit |
| 699 | |
| 700 | kal_bool is_ssb_valid; |
| 701 | agps_ssb_measurement_struct ssb; |
| 702 | |
| 703 | kal_bool is_csi_valid; |
| 704 | agps_csi_measurement_struct csi; |
| 705 | } agps_nr_as_cell_measured_result_struct; |
| 706 | #pragma pack(pop) // Restore the alignment configuration |
| 707 | |
| 708 | /* NR cell info */ |
| 709 | typedef struct |
| 710 | { |
| 711 | kal_uint8 num_serving_cell; |
| 712 | agps_nr_as_serving_cell_info_struct nr_serving_cell_list[AGPS_NR_AS_MAX_SERVING_CELL_NUM]; |
| 713 | |
| 714 | kal_uint8 num_nbr_cell; |
| 715 | agps_nr_as_cell_measured_result_struct nbr_cell_list[AGPS_NR_AS_MAX_MEASURED_CELL_NUM]; |
| 716 | } agps_nr_as_nbr_cell_info_struct; |
| 717 | |
| 718 | typedef union |
| 719 | { |
| 720 | agps_gas_nbr_cell_info_struct gas_nbr_cell_info; |
| 721 | agps_uas_nbr_cell_info_struct uas_nbr_cell_info; |
| 722 | agps_eas_nbr_cell_info_struct eas_nbr_cell_info; |
| 723 | agps_nr_as_nbr_cell_info_struct nr_as_nbr_cell_info; |
| 724 | } agps_ps_nbr_cell_info_union_type; |
| 725 | |
| 726 | |
| 727 | extern kal_bool is_agps_cp_allowed_by_rat(gnss_rat_enum rat_mode); |
| 728 | extern void lbs_update_cfun_state(kal_uint8 sim_index, kal_uint8 cfun_state); |
| 729 | extern void agps_cp_allowed_set_by_rat(gnss_rat_enum rat_mode, kal_bool is_allowed); |
| 730 | extern pos_mode_enum check_positioning_mode_capability(void); |
| 731 | extern pos_mode_enum check_agnss_positioning_mode_capability(gnss_rat_enum rat_mode,protocol_id_enum ps_id); |
| 732 | extern kal_int8 lbs_cp_guard_time(); |
| 733 | extern kal_bool is_lbs_cp_guard_time_enable(); |
| 734 | extern kal_bool lbs_cp_pos_method_capability_query(pos_method_enum pos_method); |
| 735 | extern kal_bool lbs_op_id_check(protocol_id_enum pid, kal_uint8 gnss_rat_mode, kal_uint32 gnss_query_op); |
| 736 | extern kal_bool lbs_gvc_block_non_ems_nilr(protocol_id_enum ps_id); |
| 737 | /* Query API for AGPSD LPPe support capability */ |
| 738 | kal_bool is_agps_lppe_enabled(void); |
| 739 | kal_bool is_agps_lppe_network_location_enabled(void); |
| 740 | |
| 741 | #define __LBS_SETTING_SUPPORT__ |
| 742 | #define __EARLY_FIX_SUPPORT__ |
| 743 | #define __LBS_EM_SUPPORT__ |
| 744 | #define __LBS_LIO_SUPPORT__ |
| 745 | |
| 746 | /* Type for LBS AP setting query API */ |
| 747 | typedef enum |
| 748 | { |
| 749 | LBS_GENERIC_AP_SETTING, |
| 750 | LBS_SETTING_MAX_NUM |
| 751 | } lbs_setting_enum; |
| 752 | |
| 753 | /* Structure for LBS AP setting query API */ |
| 754 | //typedef agps_md_sim_info_req lbs_setting_generic_ap; |
| 755 | |
| 756 | /* Error cause for LBS AP setting query API */ |
| 757 | #define LBS_SETTING_NOT_AVAILABLE (0) |
| 758 | |
| 759 | /* Prototype for LBS AP setting query API */ |
| 760 | #if defined(__UE_SIMULATOR__) || !defined(__AGPS_SUPPORT__) |
| 761 | #define lbs_query_setting(a,b,c) (0) |
| 762 | #else |
| 763 | kal_int32 lbs_query_setting(lbs_setting_enum setting, void *buf, kal_uint32 buf_size); |
| 764 | #endif |
| 765 | kal_uint8 custom_lcsp_adj_rsp_time(kal_uint8 rsp, protocol_id_enum pid); |
| 766 | |
| 767 | typedef kal_bool (*lbs_gnss_time_update_callback)(kal_uint64); |
| 768 | void register_ssu_gnss_time_update_callback(lbs_gnss_time_update_callback api); |
| 769 | void deregister_ssu_gnss_time_update_callback(); |
| 770 | |
| 771 | #endif /* _GPS_COMMON_H_ */ |
| 772 | |
| 773 | |
| 774 | |
| 775 | |