rjw | 6c1fd8f | 2022-11-30 14:33:01 +0800 | [diff] [blame] | 1 | #ifndef _MRS_NRAS_SEARCH_H |
| 2 | #define _MRS_NRAS_SEARCH_H |
| 3 | |
| 4 | #include "mrs_common_capability.h" |
| 5 | #include "mrs_common_search.h" |
| 6 | #include "mrs_as_struct.h" |
| 7 | #include "mcc_recog_train_data.h" |
| 8 | #ifdef UNIT_TEST |
| 9 | #include "mcc_recog_test_data.h" |
| 10 | #endif /* UNIT_TEST */ |
| 11 | |
| 12 | #define MRS_NRAS_MCC_RECOG_MAX_SUBBAND_NUM 64 |
| 13 | |
| 14 | typedef struct |
| 15 | { |
| 16 | kal_uint32 min_gscn; |
| 17 | kal_uint32 max_gscn; |
| 18 | kal_uint8 step_size; |
| 19 | } nr_gscn_range_struct; |
| 20 | |
| 21 | typedef struct |
| 22 | { |
| 23 | kal_uint32 begin; |
| 24 | kal_uint32 end; |
| 25 | } nr_freq_range_struct; |
| 26 | |
| 27 | typedef struct nras_mcc_recog_mcc_list { |
| 28 | kal_uint8 mcc_num; |
| 29 | mrs_mcc_id mcc[MCC_RECOG_NR_MAX_MCC_LEN]; |
| 30 | } mrs_nras_mcc_recog_mcc_list_struct; |
| 31 | |
| 32 | typedef struct |
| 33 | { |
| 34 | nr_freq_range_struct freq_range; |
| 35 | kal_int16 rssi; // qdbm = dbm * 4 |
| 36 | } mrs_nras_subband_rssi_struct; |
| 37 | |
| 38 | typedef struct |
| 39 | { |
| 40 | kal_uint16 band; |
| 41 | kal_uint8 subband_num; // The number of subbands to report. |
| 42 | mrs_nras_subband_rssi_struct subband_rssi[MRS_NRAS_MCC_RECOG_MAX_SUBBAND_NUM]; |
| 43 | } mrs_nras_band_rssi_distribution_struct; |
| 44 | |
| 45 | typedef struct |
| 46 | { |
| 47 | kal_uint16 band_num; |
| 48 | mrs_nras_band_rssi_distribution_struct band[MCC_RECOG_NR_BAND_NUM]; |
| 49 | } mrs_nras_rssi_distribution_struct; |
| 50 | |
| 51 | extern mrs_nras_mcc_recog_mcc_list_struct nr_mcc_list; |
| 52 | |
| 53 | void mrs_get_predict_nrarfcn_table_by_band(kal_uint32 nr_band, mrs_freq_table_struct *nrarfcn_table); |
| 54 | kal_uint32 mrs_nras_gscn_to_nrarfcn(kal_uint32 gscn); |
| 55 | |
| 56 | kal_uint16 mrs_nras_get_predict_freq_list_by_band( |
| 57 | MRS_SIM_INDEX sim_index, |
| 58 | const kal_uint32 band_list_num, |
| 59 | const kal_uint16 *band_list, |
| 60 | const NRARFCN *skip_freq_list, |
| 61 | const kal_uint16 skip_freq_list_num, |
| 62 | NRARFCN *predict_freq_list // kal_uint32 array[64] |
| 63 | ); |
| 64 | |
| 65 | kal_uint16 mrs_nras_get_predict_freq_list_by_plmn( |
| 66 | MRS_SIM_INDEX sim_index, |
| 67 | const mrs_plmn_id_list *plmn_list, |
| 68 | const NRARFCN *skip_freq_list, |
| 69 | const kal_uint16 skip_freq_list_num, |
| 70 | NRARFCN *predict_freq_list); |
| 71 | |
| 72 | void mrs_get_predict_nrarfcn_table_by_band(kal_uint32 nr_band, mrs_freq_table_struct *nrarfcn_table); |
| 73 | kal_uint32 mrs_nras_gscn_to_nrarfcn(kal_uint32 gscn); |
| 74 | |
| 75 | void mrs_nras_plmn_id_to_mrs_plmn_id(const plmn_id_struct *src, mrs_plmn_id *dst); |
| 76 | |
| 77 | kal_uint16 mrs_nras_get_predict_freq_list_by_band( |
| 78 | MRS_SIM_INDEX sim_index, |
| 79 | const kal_uint32 band_list_num, |
| 80 | const kal_uint16 *band_list, |
| 81 | const NRARFCN *skip_freq_list, |
| 82 | const kal_uint16 skip_freq_list_num, |
| 83 | NRARFCN *predict_freq_list // kal_uint32 array[64] |
| 84 | ); |
| 85 | kal_uint16 mrs_nras_get_predict_freq_list_by_plmn( |
| 86 | MRS_SIM_INDEX sim_index, |
| 87 | const mrs_plmn_id_list *plmn_list, |
| 88 | const NRARFCN *skip_freq_list, |
| 89 | const kal_uint16 skip_freq_list_num, |
| 90 | NRARFCN *predict_freq_list); |
| 91 | |
| 92 | double mrs_nras_mcc_recog_centered_cosine_distance(const kal_int16 *data1, const kal_int16 *data2, kal_uint32 data_len); |
| 93 | kal_bool mrs_nras_mcc_recog_is_remarkable_band(kal_uint16 band); |
| 94 | mrs_nras_mcc_recog_mcc_list_struct mrs_nras_mcc_recog_get_mcc(mrs_nras_rssi_distribution_struct *rssi_distribution); |
| 95 | mrs_nras_mcc_recog_mcc_list_struct mrs_nras_mcc_recog_get_latest_mcc(); |
| 96 | #ifdef UNIT_TEST |
| 97 | void mrs_nras_mcc_recog_regression(); |
| 98 | #endif /* UNIT_TEST */ |
| 99 | #endif |