FreeCalypso > hg > freecalypso-sw
comparison gsm-fw/g23m-gsm/mm/mm_regf.c @ 726:105ac33aa5a1
mm_regf.c compiles
author | Michael Spacefalcon <msokolov@ivan.Harhan.ORG> |
---|---|
date | Sat, 04 Oct 2014 21:45:54 +0000 |
parents | 2f7df7a314f8 |
children |
comparison
equal
deleted
inserted
replaced
725:9ffa468dab07 | 726:105ac33aa5a1 |
---|---|
17 | Purpose : This Modul defines the functions for the registration | 17 | Purpose : This Modul defines the functions for the registration |
18 | capability of the module Mobility Management. | 18 | capability of the module Mobility Management. |
19 +----------------------------------------------------------------------------- | 19 +----------------------------------------------------------------------------- |
20 */ | 20 */ |
21 | 21 |
22 #include "config.h" | |
23 #include "fixedconf.h" | |
24 #include "condat-features.h" | |
25 | |
22 #define MM_REGF_C | 26 #define MM_REGF_C |
23 #define ENTITY_MM | 27 #define ENTITY_MM |
24 | 28 |
25 /*==== INCLUDES ===================================================*/ | 29 /*==== INCLUDES ===================================================*/ |
26 #if defined (NEW_FRAME) | 30 #if defined (NEW_FRAME) |
109 +----------------------------------------------------------------------------+ | 113 +----------------------------------------------------------------------------+ |
110 | PROJECT : GSM-PS (6147) MODULE : MM_REG | | 114 | PROJECT : GSM-PS (6147) MODULE : MM_REG | |
111 | STATE : code ROUTINE : reg_send_mmr_reg_cnf | | 115 | STATE : code ROUTINE : reg_send_mmr_reg_cnf | |
112 +----------------------------------------------------------------------------+ | 116 +----------------------------------------------------------------------------+ |
113 | 117 |
114 PURPOSE : This function builds and sends a MMR_REG_CNF primitive to the MMR SAP. | 118 PURPOSE : This function builds and sends a MMR_REG_CNF primitive to |
119 the MMR SAP. | |
115 This is only done if G23 is compiled as a GSM only protocol stack | 120 This is only done if G23 is compiled as a GSM only protocol stack |
116 without GPRS. Otherwise this function is deactivated. | 121 without GPRS. Otherwise this function is deactivated. |
117 | 122 |
118 */ | 123 */ |
119 | 124 |
144 +----------------------------------------------------------------------------+ | 149 +----------------------------------------------------------------------------+ |
145 | PROJECT : GSM-PS (6147) MODULE : MM_REG | | 150 | PROJECT : GSM-PS (6147) MODULE : MM_REG | |
146 | STATE : code ROUTINE : reg_build_mmr_reg_cnf | | 151 | STATE : code ROUTINE : reg_build_mmr_reg_cnf | |
147 +----------------------------------------------------------------------------+ | 152 +----------------------------------------------------------------------------+ |
148 | 153 |
149 PURPOSE : This function indicates change in service or change in PLMN to the MMR SAP. | 154 PURPOSE : This function indicates change in service or change in PLMN to |
155 the MMR SAP. | |
150 This is only done if G23 is compiled as a GSM only protocol stack | 156 This is only done if G23 is compiled as a GSM only protocol stack |
151 without GPRS. Otherwise this function is deactivated. | 157 without GPRS. Otherwise this function is deactivated. |
152 | 158 |
153 */ | 159 */ |
154 | 160 |
340 memcpy (mmr_ahplmn_ind->ahplmn.mcc, acting_hplmn->mcc, SIZE_MCC); | 346 memcpy (mmr_ahplmn_ind->ahplmn.mcc, acting_hplmn->mcc, SIZE_MCC); |
341 memcpy (mmr_ahplmn_ind->ahplmn.mnc, acting_hplmn->mnc, SIZE_MNC); | 347 memcpy (mmr_ahplmn_ind->ahplmn.mnc, acting_hplmn->mnc, SIZE_MNC); |
342 | 348 |
343 PSENDX(MMI, mmr_ahplmn_ind); | 349 PSENDX(MMI, mmr_ahplmn_ind); |
344 } | 350 } |
345 | |
346 } | 351 } |
347 | 352 |
348 #endif /* !defined(GPRS) */ | 353 #endif /* !defined(GPRS) */ |
349 | 354 |
350 /* | 355 /* |
434 * Copy the information of SIM_MM_INSERT_IND into the | 439 * Copy the information of SIM_MM_INSERT_IND into the |
435 * data fields of the registration | 440 * data fields of the registration |
436 */ | 441 */ |
437 reg_read_imsi (&mm_data->reg.imsi_struct, &sim_mm_insert_ind->imsi_field); | 442 reg_read_imsi (&mm_data->reg.imsi_struct, &sim_mm_insert_ind->imsi_field); |
438 reg_read_loc_info (&sim_mm_insert_ind->loc_info); | 443 reg_read_loc_info (&sim_mm_insert_ind->loc_info); |
439 /*add by TISH 0418 to write imsi to FFS*/ | 444 |
440 mm_read_ffs_imsi(); | 445 /*add by TISH 0418 to write imsi to FFS*/ |
441 if (reg_imsi_equal(&imsi_in_ffs, &mm_data->reg.imsi_struct)) | 446 mm_read_ffs_imsi(); |
442 { | 447 if (reg_imsi_equal(&imsi_in_ffs, &mm_data->reg.imsi_struct)) |
443 | 448 { |
444 /* added by TISH 0418 to write simloci to FFS */ | 449 /* added by TISH 0418 to write simloci to FFS */ |
445 if( mm_data->reg.update_stat NEQ MS_UPDATED)//only use value in FFS in this case | 450 if( mm_data->reg.update_stat NEQ MS_UPDATED) |
446 { | 451 { //only use value in FFS in this case |
447 TRACE_EVENT("MS NOT UPDATED, readsimloci from FFS"); | 452 TRACE_EVENT("MS NOT UPDATED, readsimloci from FFS"); |
448 if(mm_read_ffs_simloci()) | 453 if(mm_read_ffs_simloci()) |
449 { | 454 { |
450 /*Successful read*/ | 455 /*Successful read*/ |
451 TRACE_EVENT_P7("readlocinfo:%d,%d,%d,%d,%d,%d,%d", loc_info_ffs.loc[4], loc_info_ffs.loc[5], loc_info_ffs.loc[6], loc_info_ffs.loc[7], | 456 TRACE_EVENT_P7("readlocinfo:%d,%d,%d,%d,%d,%d,%d", loc_info_ffs.loc[4], |
452 loc_info_ffs.loc[8], loc_info_ffs.loc[9], loc_info_ffs.loc[10]); | 457 loc_info_ffs.loc[5], loc_info_ffs.loc[6], |
453 reg_read_loc_info (&loc_info_ffs); | 458 loc_info_ffs.loc[7], loc_info_ffs.loc[8], |
454 } | 459 loc_info_ffs.loc[9], loc_info_ffs.loc[10]); |
455 } | 460 reg_read_loc_info (&loc_info_ffs); |
456 /* added by TISH 0418 to write simloci to FFS */ | 461 } |
457 } | 462 } |
463 } | |
458 mm_data->reg.acc_class = sim_mm_insert_ind->acc_ctrl.acc[0] * 256 + | 464 mm_data->reg.acc_class = sim_mm_insert_ind->acc_ctrl.acc[0] * 256 + |
459 sim_mm_insert_ind->acc_ctrl.acc[1]; | 465 sim_mm_insert_ind->acc_ctrl.acc[1]; |
460 reg_read_bcch_info (sim_mm_insert_ind); | 466 reg_read_bcch_info (sim_mm_insert_ind); |
461 reg_read_kc_cksn (sim_mm_insert_ind); | 467 reg_read_kc_cksn (sim_mm_insert_ind); |
462 | 468 |
483 * if the value delivered by the SIM exceeds the allowed limit. */ | 489 * if the value delivered by the SIM exceeds the allowed limit. */ |
484 mm_data->reg.thplmn = HPLMN_DEF_SEARCH_PERIOD; | 490 mm_data->reg.thplmn = HPLMN_DEF_SEARCH_PERIOD; |
485 } | 491 } |
486 | 492 |
487 /* | 493 /* |
488 * If file size is indicated in SIM MM insert indication, MM shall read files from SIM. | 494 * If file size is indicated in SIM MM insert indication, |
495 * MM shall read files from SIM. | |
489 */ | 496 */ |
490 if(reg_sim_files_to_be_read(sim_mm_insert_ind)) | 497 if(reg_sim_files_to_be_read(sim_mm_insert_ind)) |
491 { | 498 { |
492 /* | 499 /* |
493 * Read indicated EFs in SIM_MM_INSERT_IND from SIM. | 500 * Read indicated EFs in SIM_MM_INSERT_IND from SIM. |
494 */ | 501 */ |
495 reg_read_next_sim_file(); | 502 reg_read_next_sim_file(); |
496 } | 503 } |
497 | 504 |
498 /*Re-read any valid EPLMNs..*/ | 505 /*Re-read any valid EPLMNs..*/ |
499 mm_read_ffs_init(); | 506 mm_read_ffs_init(); |
669 { | 676 { |
670 TRACE_EVENT ("Don't ignore actual PLMN for cause #12"); | 677 TRACE_EVENT ("Don't ignore actual PLMN for cause #12"); |
671 } | 678 } |
672 else | 679 else |
673 { | 680 { |
674 TRACE_EVENT ("Ignore actual PLMN"); | 681 TRACE_EVENT ("Ignore actual PLMN"); |
675 copy_plmn[i] = FALSE; | 682 copy_plmn[i] = FALSE; |
683 } | |
676 } | 684 } |
677 } | 685 } |
678 } | |
679 } | 686 } |
680 | 687 |
681 /* | 688 /* |
682 * GSM 03.22 subclause 4.4.3 gives some rules in which way the PLMN list | 689 * GSM 03.22 subclause 4.4.3 gives some rules in which way the PLMN list |
683 * has to be sorted. These rules apply for manual and for automatic mode. | 690 * has to be sorted. These rules apply for manual and for automatic mode. |
793 memcpy(plmn->mcc,mm_data->reg.acting_hplmn.mcc,SIZE_MCC); | 800 memcpy(plmn->mcc,mm_data->reg.acting_hplmn.mcc,SIZE_MCC); |
794 memcpy(plmn->mnc,mm_data->reg.acting_hplmn.mnc,SIZE_MNC); | 801 memcpy(plmn->mnc,mm_data->reg.acting_hplmn.mnc,SIZE_MNC); |
795 } | 802 } |
796 else | 803 else |
797 { | 804 { |
798 plmn->v_plmn = V_PLMN_PRES; | 805 plmn->v_plmn = V_PLMN_PRES; |
799 plmn->mcc[0] = mm_data->reg.imsi_struct.id[0]; | 806 plmn->mcc[0] = mm_data->reg.imsi_struct.id[0]; |
800 plmn->mcc[1] = mm_data->reg.imsi_struct.id[1]; | 807 plmn->mcc[1] = mm_data->reg.imsi_struct.id[1]; |
801 plmn->mcc[2] = mm_data->reg.imsi_struct.id[2]; | 808 plmn->mcc[2] = mm_data->reg.imsi_struct.id[2]; |
802 plmn->mnc[0] = mm_data->reg.imsi_struct.id[3]; | 809 plmn->mnc[0] = mm_data->reg.imsi_struct.id[3]; |
803 plmn->mnc[1] = mm_data->reg.imsi_struct.id[4]; | 810 plmn->mnc[1] = mm_data->reg.imsi_struct.id[4]; |
804 | 811 |
805 /* | 812 /* |
806 * We cannot be sure that plmn->mnc[2] really belongs to the MNC, | 813 * We cannot be sure that plmn->mnc[2] really belongs to the MNC, |
807 * but the comparison routines for the HPLMN are done in a way that | 814 * but the comparison routines for the HPLMN are done in a way that |
808 * this doesn't matter anyway. See GSM 03.03 subclause 2.2, | 815 * this doesn't matter anyway. See GSM 03.03 subclause 2.2, |
809 * which is far away from being clear and GSM 03.22 version 7.1.0 | 816 * which is far away from being clear and GSM 03.22 version 7.1.0 |
810 * Release 1998 Annex A (normative). Figure A.2 in this annex makes | 817 * Release 1998 Annex A (normative). Figure A.2 in this annex makes |
811 * it obvious that 3-digit-MNC isn't only a NA issue! | 818 * it obvious that 3-digit-MNC isn't only a NA issue! |
812 */ | 819 */ |
813 plmn->mnc[2] = mm_data->reg.imsi_struct.id[5]; | 820 plmn->mnc[2] = mm_data->reg.imsi_struct.id[5]; |
814 }/* end of mm_data->reg.acting_hplmn.v_plmn */ | 821 }/* end of mm_data->reg.acting_hplmn.v_plmn */ |
815 } | 822 } |
816 | 823 |
817 | 824 |
818 /* | 825 /* |
1250 +--------------------------------------------------------------------+ | 1257 +--------------------------------------------------------------------+ |
1251 | PROJECT : GSM-PS MODULE : MM_REG | | 1258 | PROJECT : GSM-PS MODULE : MM_REG | |
1252 | STATE : code ROUTINE : reg_sim_files_to_be_read | | 1259 | STATE : code ROUTINE : reg_sim_files_to_be_read | |
1253 +--------------------------------------------------------------------+ | 1260 +--------------------------------------------------------------------+ |
1254 | 1261 |
1255 PURPOSE : Read the EFs size (EFu=EFPLMNwAcT, EFo=EFOPLMNwAcT, EFs=EFPLMNSEL) information delivered | 1262 PURPOSE : Read the EFs size (EFu=EFPLMNwAcT, EFo=EFOPLMNwAcT, EFs=EFPLMNSEL) |
1263 information delivered | |
1256 by the SIM into the registration data structures. | 1264 by the SIM into the registration data structures. |
1257 | 1265 |
1258 */ | 1266 */ |
1259 | 1267 |
1260 GLOBAL BOOL reg_sim_files_to_be_read (const T_SIM_MM_INSERT_IND *sim_mm_insert_ind) | 1268 GLOBAL BOOL reg_sim_files_to_be_read (const T_SIM_MM_INSERT_IND *sim_mm_insert_ind) |
1268 * If the SIM insert indication and file size is indicated, it MM shall read files from SIM. | 1276 * If the SIM insert indication and file size is indicated, it MM shall read files from SIM. |
1269 */ | 1277 */ |
1270 if (sim_mm_insert_ind->u_ctl_plmn_sel_actech_list_sz >0) | 1278 if (sim_mm_insert_ind->u_ctl_plmn_sel_actech_list_sz >0) |
1271 { | 1279 { |
1272 mm_data->reg.upd_sim_ucps_at = SAT_READ_FILE; | 1280 mm_data->reg.upd_sim_ucps_at = SAT_READ_FILE; |
1273 /*Set indicatort sim reading is in progress to true*/ | 1281 /*Set indicatort sim reading is in progress to true*/ |
1274 mm_data->reg.sim_read_in_progress = TRUE; | 1282 mm_data->reg.sim_read_in_progress = TRUE; |
1275 /* | 1283 /* |
1276 * MM cant decide here how many PLMNs are supported GSM access Technology so | 1284 * MM cant decide here how many PLMNs are supported GSM access Technology so |
1277 * MM should read maximum number of plmn as much it can read. | 1285 * MM should read maximum number of plmn as much it can read. |
1278 * At present there is a limitation in SIM read req. It cant read more than | 1286 * At present there is a limitation in SIM read req. It cant read more than |
1279 * 256 bytes in one request. May be PLMN reading can be extended using more | 1287 * 256 bytes in one request. May be PLMN reading can be extended using more |
1280 * than one sim read req for the same EF in future. | 1288 * than one sim read req for the same EF in future. |
1281 */ | 1289 */ |
1296 { | 1304 { |
1297 mm_data->reg.upd_sim_ocps_at = SAT_READ_FILE; | 1305 mm_data->reg.upd_sim_ocps_at = SAT_READ_FILE; |
1298 /*Set indicatort sim reading is in progress to true*/ | 1306 /*Set indicatort sim reading is in progress to true*/ |
1299 mm_data->reg.sim_read_in_progress = TRUE; | 1307 mm_data->reg.sim_read_in_progress = TRUE; |
1300 /* | 1308 /* |
1301 * MM cant decide here how many PLMNs are supported GSM access Technology so | 1309 * MM cant decide here how many PLMNs are supported GSM access Technology so |
1302 * MM should read maximum number of plmn as much it can read. | 1310 * MM should read maximum number of plmn as much it can read. |
1303 * At present there is a limitation in SIM read req. It cant read more than | 1311 * At present there is a limitation in SIM read req. It cant read more than |
1304 * 256 bytes in one request. May be PLMN reading can be extended using more | 1312 * 256 bytes in one request. May be PLMN reading can be extended using more |
1305 * than one sim read req for the same EF in future. | 1313 * than one sim read req for the same EF in future. |
1306 */ | 1314 */ |
1423 /* Inform ACI & RR of the AHPLMN present in SIM */ | 1431 /* Inform ACI & RR of the AHPLMN present in SIM */ |
1424 valid_acting_hplmn(&mm_data->reg.acting_hplmn); | 1432 valid_acting_hplmn(&mm_data->reg.acting_hplmn); |
1425 mm_build_rr_sync_hplmn_req(); | 1433 mm_build_rr_sync_hplmn_req(); |
1426 mm_mmgmm_ahplmn_ind(&mm_data->reg.acting_hplmn); | 1434 mm_mmgmm_ahplmn_ind(&mm_data->reg.acting_hplmn); |
1427 } | 1435 } |
1428 | |
1429 } | 1436 } |
1430 | 1437 |
1431 | 1438 |
1432 /* | 1439 /* |
1433 +--------------------------------------------------------------------+ | 1440 +--------------------------------------------------------------------+ |
1502 mm_data->ef_indicator|=(0x01 << 3); | 1509 mm_data->ef_indicator|=(0x01 << 3); |
1503 } | 1510 } |
1504 memcpy (mm_data->reg.kc, sim_mm_insert_ind->kc_n.kc, MAX_KC); | 1511 memcpy (mm_data->reg.kc, sim_mm_insert_ind->kc_n.kc, MAX_KC); |
1505 mm_data->reg.cksn = sim_mm_insert_ind->kc_n.kc[8]; | 1512 mm_data->reg.cksn = sim_mm_insert_ind->kc_n.kc[8]; |
1506 } | 1513 } |
1507 | |
1508 } | 1514 } |
1509 | 1515 |
1510 /* | 1516 /* |
1511 +--------------------------------------------------------------------+ | 1517 +--------------------------------------------------------------------+ |
1512 | PROJECT : GSM-PS (6147) MODULE : MM_REG | | 1518 | PROJECT : GSM-PS (6147) MODULE : MM_REG | |
1578 USHORT index; | 1584 USHORT index; |
1579 USHORT plmnsel_plmn_count; | 1585 USHORT plmnsel_plmn_count; |
1580 USHORT plmn_count = 0; | 1586 USHORT plmn_count = 0; |
1581 | 1587 |
1582 TRACE_FUNCTION ("reg_read_pref_plmn ()"); | 1588 TRACE_FUNCTION ("reg_read_pref_plmn ()"); |
1583 /* | 1589 /* |
1584 * If any additional which does not give complete PLMN id(length MOD UBYTES_PER_PLMN > 0), | 1590 * If any additional which does not give complete |
1591 * PLMN id(length MOD UBYTES_PER_PLMN > 0), | |
1585 * ignore these additional bytes at the end | 1592 * ignore these additional bytes at the end |
1586 */ | 1593 */ |
1587 mm_data->reg.sim_plmnsel_len = length-length%UBYTES_PER_PLMN; | 1594 mm_data->reg.sim_plmnsel_len = length-length%UBYTES_PER_PLMN; |
1588 | 1595 |
1589 if (mm_data->reg.sim_plmnsel_len > MAX_PREF_PLMN_ID * UBYTES_PER_PLMN) | 1596 if (mm_data->reg.sim_plmnsel_len > MAX_PREF_PLMN_ID * UBYTES_PER_PLMN) |
1604 &data[index*UBYTES_PER_PLMN], UBYTES_PER_PLMN); | 1611 &data[index*UBYTES_PER_PLMN], UBYTES_PER_PLMN); |
1605 plmn_count++; | 1612 plmn_count++; |
1606 } | 1613 } |
1607 } | 1614 } |
1608 } | 1615 } |
1609 | |
1610 | 1616 |
1611 #ifdef REL99 | 1617 #ifdef REL99 |
1612 | 1618 |
1613 /* | 1619 /* |
1614 +-------------------------------------------------------------------------+ | 1620 +-------------------------------------------------------------------------+ |
1722 +------------------------------------------------------------------------------+ | 1728 +------------------------------------------------------------------------------+ |
1723 | PROJECT : GSM-PS (6147) MODULE : MM_REG | | 1729 | PROJECT : GSM-PS (6147) MODULE : MM_REG | |
1724 | STATE : code ROUTINE : reg_read_ocps_acctec | | 1730 | STATE : code ROUTINE : reg_read_ocps_acctec | |
1725 +------------------------------------------------------------------------------+ | 1731 +------------------------------------------------------------------------------+ |
1726 | 1732 |
1727 PURPOSE : Read Operator controlled PLMN selector with access technology list delivered by | 1733 PURPOSE : Read Operator controlled PLMN selector with access technology list |
1728 the SIM card. This can happens only after SIM insert indication indicates to read | 1734 delivered by the SIM card. This can happens only after SIM insert |
1729 file from SIM. | 1735 indication indicates to read file from SIM. |
1730 */ | 1736 */ |
1731 GLOBAL void reg_read_ocps_acctec(UBYTE* data, USHORT length) | 1737 GLOBAL void reg_read_ocps_acctec(UBYTE* data, USHORT length) |
1732 { | 1738 { |
1733 GET_INSTANCE_DATA; | 1739 GET_INSTANCE_DATA; |
1734 USHORT index; | 1740 USHORT index; |
1770 } | 1776 } |
1771 } | 1777 } |
1772 } | 1778 } |
1773 } | 1779 } |
1774 | 1780 |
1775 | |
1776 #endif | 1781 #endif |
1782 | |
1777 /* | 1783 /* |
1778 +--------------------------------------------------------------------+ | 1784 +--------------------------------------------------------------------+ |
1779 | PROJECT : GSM-PS (6147) MODULE : MM_REG | | 1785 | PROJECT : GSM-PS (6147) MODULE : MM_REG | |
1780 | STATE : code ROUTINE : reg_clear_plmn | | 1786 | STATE : code ROUTINE : reg_clear_plmn | |
1781 +--------------------------------------------------------------------+ | 1787 +--------------------------------------------------------------------+ |
2044 T_path_info *path_info_ptr, | 2050 T_path_info *path_info_ptr, |
2045 UBYTE act_length, | 2051 UBYTE act_length, |
2046 UBYTE max_length ) | 2052 UBYTE max_length ) |
2047 { | 2053 { |
2048 GET_INSTANCE_DATA; | 2054 GET_INSTANCE_DATA; |
2049 PALLOC (read_req, SIM_READ_REQ); | 2055 PALLOC (read_req, SIM_READ_REQ); |
2050 | 2056 |
2051 TRACE_FUNCTION ("mm_send_sim_read_req()"); | 2057 TRACE_FUNCTION ("mm_send_sim_read_req()"); |
2052 | 2058 |
2053 read_req->source = SRC_MM; | 2059 read_req->source = SRC_MM; |
2054 /* req_id can be set to 0 as MM sends a SIM_READ_REQ only | 2060 /* req_id can be set to 0 as MM sends a SIM_READ_REQ only |
2055 * when it gets the SIM_READ_CNF to the previous request */ | 2061 * when it gets the SIM_READ_CNF to the previous request */ |
2056 read_req->req_id = 0; | 2062 read_req->req_id = 0; |
2057 | 2063 |
2058 read_req->offset = 0; | 2064 read_req->offset = 0; |
2059 | 2065 |
2060 if(path_info_ptr NEQ NULL) | 2066 if(path_info_ptr NEQ NULL) |
2061 { | 2067 { |
2062 read_req->v_path_info = TRUE; | 2068 read_req->v_path_info = TRUE; |
2063 read_req->path_info = *path_info_ptr; | 2069 read_req->path_info = *path_info_ptr; |
2064 } | 2070 } |
2065 else | 2071 else |
2066 { | 2072 { |
2067 read_req->v_path_info = FALSE; | 2073 read_req->v_path_info = FALSE; |
2068 } | 2074 } |
2069 | 2075 |
2070 mm_data->sim_read_req_data_field = read_req->datafield = datafield; | 2076 mm_data->sim_read_req_data_field = read_req->datafield = datafield; |
2071 | 2077 |
2072 read_req->length = act_length; | 2078 read_req->length = act_length; |
2073 read_req->max_length = max_length; | 2079 read_req->max_length = max_length; |
2074 PSENDX (SIM, read_req); | 2080 PSENDX (SIM, read_req); |
2075 } | 2081 } |
2076 | 2082 |
2077 /* | 2083 /* |
2078 +--------------------------------------------------------------------+ | 2084 +--------------------------------------------------------------------+ |
2079 | PROJECT : GSM-PS (6147) MODULE : MM_REG | | 2085 | PROJECT : GSM-PS (6147) MODULE : MM_REG | |
2111 reg_send_sim_read_req (SIM_HPLMN, NULL, NOT_PRESENT_8BIT, sizeof (insert_ind->hplmn)); | 2117 reg_send_sim_read_req (SIM_HPLMN, NULL, NOT_PRESENT_8BIT, sizeof (insert_ind->hplmn)); |
2112 mm_data->reg.upd_sim_hplmn = SAT_PEND_CNF; | 2118 mm_data->reg.upd_sim_hplmn = SAT_PEND_CNF; |
2113 return TRUE; | 2119 return TRUE; |
2114 } | 2120 } |
2115 | 2121 |
2116 #ifdef REL99 | 2122 #ifdef REL99 |
2117 /*updating status user controlled & operator controlled PLMN selection*/ | 2123 /*updating status user controlled & operator controlled PLMN selection*/ |
2118 | 2124 |
2119 if (mm_data->reg.upd_sim_ucps_at EQ SAT_READ_FILE) | 2125 if (mm_data->reg.upd_sim_ucps_at EQ SAT_READ_FILE) |
2120 { | 2126 { |
2121 /* | 2127 /* |
2128 */ | 2134 */ |
2129 reg_send_sim_read_req (SIM_UCPS_ACTEC, NULL, (UBYTE)mm_data->reg.sim_ucps_at_len, 0xFF); | 2135 reg_send_sim_read_req (SIM_UCPS_ACTEC, NULL, (UBYTE)mm_data->reg.sim_ucps_at_len, 0xFF); |
2130 mm_data->reg.upd_sim_ucps_at = SAT_PEND_CNF; | 2136 mm_data->reg.upd_sim_ucps_at = SAT_PEND_CNF; |
2131 return TRUE; | 2137 return TRUE; |
2132 } | 2138 } |
2133 | |
2134 | 2139 |
2135 if (mm_data->reg.upd_sim_ocps_at EQ SAT_READ_FILE) | 2140 if (mm_data->reg.upd_sim_ocps_at EQ SAT_READ_FILE) |
2136 { | 2141 { |
2137 /* | 2142 /* |
2138 * Read Operator controlled PLMN selector with access technology list. | 2143 * Read Operator controlled PLMN selector with access technology list. |
2363 | 2368 |
2364 /* Update all EFs on SIM */ | 2369 /* Update all EFs on SIM */ |
2365 mm_data->ef_indicator = 0xFF; | 2370 mm_data->ef_indicator = 0xFF; |
2366 /* Write changed data to SIM */ | 2371 /* Write changed data to SIM */ |
2367 reg_build_sim_update (); | 2372 reg_build_sim_update (); |
2368 /* added by TISH 0418 to write simloci to FFS */ | 2373 /* added by TISH 0418 to write simloci to FFS */ |
2369 mm_write_simloci_to_ffs(); | 2374 mm_write_simloci_to_ffs(); |
2370 mm_write_imsi_to_ffs(); | 2375 mm_write_imsi_to_ffs(); |
2371 /* added by TISH 0418 to write simloci to FFS */ | |
2372 | 2376 |
2373 /* Check HPLMN timer state */ | 2377 /* Check HPLMN timer state */ |
2374 reg_check_hplmn_tim (mm_data->reg.thplmn); | 2378 reg_check_hplmn_tim (mm_data->reg.thplmn); |
2375 } | 2379 } |
2376 | 2380 |
2438 reg_extract_hplmn (&hplmn); | 2442 reg_extract_hplmn (&hplmn); |
2439 | 2443 |
2440 /* fix for CT PTCRB- TC_26_7_4_5_4_6. HPLMN timer is not started only if | 2444 /* fix for CT PTCRB- TC_26_7_4_5_4_6. HPLMN timer is not started only if |
2441 bcch PLMN and HPLMN belong to same country and both are in equivalent PLMN list. | 2445 bcch PLMN and HPLMN belong to same country and both are in equivalent PLMN list. |
2442 Detailed analysis present in OMAPS00150594*/ | 2446 Detailed analysis present in OMAPS00150594*/ |
2443 if (reg_same_country_plmn (bcch_plmn, &hplmn)) | 2447 if (reg_same_country_plmn (bcch_plmn, &hplmn)) |
2444 { | 2448 { |
2445 | |
2446 if (reg_plmn_equal_eqv (bcch_plmn, &hplmn)) | 2449 if (reg_plmn_equal_eqv (bcch_plmn, &hplmn)) |
2447 return TRUE; /* The PLMN is the HPLMN */ | 2450 return TRUE; /* The PLMN is the HPLMN */ |
2448 else | 2451 else |
2449 return FALSE; /* National roaming */ | 2452 return FALSE; /* National roaming */ |
2450 } | 2453 } |
2451 /* International roaming: Check the preferred PLMN list */ | 2454 /* International roaming: Check the preferred PLMN list */ |
2452 for (i = 0; i < MAX_PREF_PLMN_ID; i++) | 2455 for (i = 0; i < MAX_PREF_PLMN_ID; i++) |
2453 { | 2456 { |
2454 T_plmn pref_plmn; | 2457 T_plmn pref_plmn; |
2455 | 2458 |
2469 | PROJECT : GSM-PS (6147) MODULE : MM_REG | | 2472 | PROJECT : GSM-PS (6147) MODULE : MM_REG | |
2470 | STATE : code ROUTINE : reg_check_hplmn_tim | | 2473 | STATE : code ROUTINE : reg_check_hplmn_tim | |
2471 +----------------------------------------------------------------------------+ | 2474 +----------------------------------------------------------------------------+ |
2472 | 2475 |
2473 PURPOSE : This function checks whether: | 2476 PURPOSE : This function checks whether: |
2474 - the HPLMN timer has to be started (if not running) with the duration given as input parameter or | 2477 - the HPLMN timer has to be started (if not running) |
2478 with the duration given as input parameter or | |
2475 - stopped. | 2479 - stopped. |
2476 Time unit is decihour. | 2480 Time unit is decihour. |
2477 */ | 2481 */ |
2478 | 2482 |
2479 GLOBAL void reg_check_hplmn_tim (UBYTE decihours) | 2483 GLOBAL void reg_check_hplmn_tim (UBYTE decihours) |
2496 if (mm_data->reg.op.m EQ M_AUTO AND | 2500 if (mm_data->reg.op.m EQ M_AUTO AND |
2497 mm_data->reg.thplmn NEQ 0 AND | 2501 mm_data->reg.thplmn NEQ 0 AND |
2498 mm_data->reg.update_stat NEQ MS_LA_NOT_ALLOWED AND | 2502 mm_data->reg.update_stat NEQ MS_LA_NOT_ALLOWED AND |
2499 !reg_best_plmn_in_country (&mm_data->reg.actual_plmn)) | 2503 !reg_best_plmn_in_country (&mm_data->reg.actual_plmn)) |
2500 { | 2504 { |
2501 /* | 2505 /* |
2502 * Period of HPLMN is controlled by EF_HPLMN file of the SIM. | 2506 * Period of HPLMN is controlled by EF_HPLMN file of the SIM. |
2503 * According to TS 11.11 chapter 10.3.5 : | 2507 * According to TS 11.11 chapter 10.3.5 : |
2504 * 0- no search attempt | 2508 * 0- no search attempt |
2505 * N- search attempts every N*6 min intervals (6 min to 8 hours) | 2509 * N- search attempts every N*6 min intervals (6 min to 8 hours) |
2506 * For phase 1 SIM wehereby this EF is not available, a default | 2510 * For phase 1 SIM wehereby this EF is not available, a default |
2507 * value of 1 hour shall be used according to TS 22.011 | 2511 * value of 1 hour shall be used according to TS 22.011 |
2508 * chapter 3.2.2.5. In G23 this is managed by SIM entity that | 2512 * chapter 3.2.2.5. In G23 this is managed by SIM entity that |
2509 * will force this default value within SIM_INSERT_IND. | 2513 * will force this default value within SIM_INSERT_IND. |
2510 */ | 2514 */ |
2511 if (!TIMERACTIVE(T_HPLMN)) | 2515 if (!TIMERACTIVE(T_HPLMN)) |
2512 { | 2516 { |
2513 if (mm_data->first_attach_mem) | 2517 if (mm_data->first_attach_mem) |
2514 { | 2518 { |
2515 TRACE_EVENT_P1 ("Start initial HPLMN timer: %d min", 2); | 2519 TRACE_EVENT_P1 ("Start initial HPLMN timer: %d min", 2); |
2693 TRACE_EVENT ("VPLMN hit - cancel"); | 2697 TRACE_EVENT ("VPLMN hit - cancel"); |
2694 break; | 2698 break; |
2695 } | 2699 } |
2696 else if (reg_plmn_equal_hplmn (&plmn)) | 2700 else if (reg_plmn_equal_hplmn (&plmn)) |
2697 { | 2701 { |
2698 /* fix for TC 26.7.4.5.4.4. Select a PLMN of Same country | 2702 /* fix for TC 26.7.4.5.4.4. Select a PLMN of Same country |
2699 and not HPLMN if in International roaming only for Test sim.*/ | 2703 and not HPLMN if in International roaming only for Test sim.*/ |
2700 if((mm_data->reg.op.ts EQ TS_NO_AVAIL) OR | 2704 if((mm_data->reg.op.ts EQ TS_NO_AVAIL) OR |
2701 reg_same_country_plmn (&plmn, &mm_data->reg.actual_plmn)) | 2705 reg_same_country_plmn (&plmn, &mm_data->reg.actual_plmn)) |
2702 { | 2706 { |
2703 TRACE_EVENT ("HPLMN found - success"); | 2707 TRACE_EVENT ("HPLMN found - success"); |
2704 success = TRUE; | 2708 success = TRUE; |
2705 break; | 2709 break; |
2707 else | 2711 else |
2708 { | 2712 { |
2709 mm_data->reg.plmn_index++; | 2713 mm_data->reg.plmn_index++; |
2710 continue; | 2714 continue; |
2711 } | 2715 } |
2712 | |
2713 } | 2716 } |
2714 else if (!reg_plmn_in_pref_list (&plmn)) | 2717 else if (!reg_plmn_in_pref_list (&plmn)) |
2715 { | 2718 { |
2716 TRACE_EVENT ("PPLMN list end - cancel"); | 2719 TRACE_EVENT ("PPLMN list end - cancel"); |
2717 break; | 2720 break; |
2736 { | 2739 { |
2737 TRACE_EVENT ("PPLMN rescan pass"); | 2740 TRACE_EVENT ("PPLMN rescan pass"); |
2738 | 2741 |
2739 /* | 2742 /* |
2740 * An alternate network candidate has been found, so try to camp | 2743 * An alternate network candidate has been found, so try to camp |
2741 * on it. It the registration procedure fails, then the normal automatic | 2744 * on it. It the registration procedure fails, then the normal |
2742 * network selection procedure will apply. | 2745 * automatic network selection procedure will apply. |
2743 */ | 2746 */ |
2744 reg_select_network (&plmn); /*lint !e772 conceivably not initialized */ | 2747 reg_select_network (&plmn); /*lint !e772 conceivably not initialized */ |
2745 } | 2748 } |
2746 else | 2749 else |
2747 { | 2750 { |
2985 mm_data->reg.is_cingular_sim = TRUE; | 2988 mm_data->reg.is_cingular_sim = TRUE; |
2986 break; | 2989 break; |
2987 } | 2990 } |
2988 } | 2991 } |
2989 } | 2992 } |
2990 |