changeset 726:105ac33aa5a1

mm_regf.c compiles
author Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
date Sat, 04 Oct 2014 21:45:54 +0000
parents 9ffa468dab07
children 87cef40cf601
files gsm-fw/g23m-gsm/mm/Makefile gsm-fw/g23m-gsm/mm/mm_regf.c
diffstat 2 files changed, 111 insertions(+), 109 deletions(-) [+]
line wrap: on
line diff
--- a/gsm-fw/g23m-gsm/mm/Makefile	Sat Oct 04 21:08:33 2014 +0000
+++ b/gsm-fw/g23m-gsm/mm/Makefile	Sat Oct 04 21:45:54 2014 +0000
@@ -6,7 +6,7 @@
 	-I../../cdginc
 
 OBJS=	mm_csf.o mm_em.o mm_forf.o mm_forp.o mm_fors.o mm_mmf.o mm_mmp.o \
-	mm_mms.o mm_pei.o
+	mm_mms.o mm_pei.o mm_regf.o
 
 all:	${OBJS}
 
--- a/gsm-fw/g23m-gsm/mm/mm_regf.c	Sat Oct 04 21:08:33 2014 +0000
+++ b/gsm-fw/g23m-gsm/mm/mm_regf.c	Sat Oct 04 21:45:54 2014 +0000
@@ -19,6 +19,10 @@
 +----------------------------------------------------------------------------- 
 */ 
 
+#include "config.h"
+#include "fixedconf.h"
+#include "condat-features.h"
+
 #define MM_REGF_C
 #define ENTITY_MM
 
@@ -111,7 +115,8 @@
 | STATE   : code                ROUTINE : reg_send_mmr_reg_cnf              |
 +----------------------------------------------------------------------------+
 
-  PURPOSE : This function builds and sends a MMR_REG_CNF primitive to the MMR SAP. 
+  PURPOSE : This function builds and sends a MMR_REG_CNF primitive to
+	    the MMR SAP. 
             This is only done if G23 is compiled as a GSM only protocol stack 
             without GPRS. Otherwise this function is deactivated.
 
@@ -146,7 +151,8 @@
 | STATE   : code                ROUTINE : reg_build_mmr_reg_cnf              |
 +----------------------------------------------------------------------------+
 
-  PURPOSE : This function indicates change in service or change in PLMN to the MMR SAP. 
+  PURPOSE : This function indicates change in service or change in PLMN to
+	    the MMR SAP. 
             This is only done if G23 is compiled as a GSM only protocol stack 
             without GPRS. Otherwise this function is deactivated.
 
@@ -342,7 +348,6 @@
 
     PSENDX(MMI, mmr_ahplmn_ind);	 
   }
-
 }
 
 #endif /* !defined(GPRS) */
@@ -436,25 +441,26 @@
    */
   reg_read_imsi     (&mm_data->reg.imsi_struct, &sim_mm_insert_ind->imsi_field);
   reg_read_loc_info (&sim_mm_insert_ind->loc_info);
-/*add by TISH 0418 to write imsi to FFS*/
-mm_read_ffs_imsi();
-if (reg_imsi_equal(&imsi_in_ffs, &mm_data->reg.imsi_struct))
-{
-
-/* added by TISH 0418 to write simloci to FFS */
-if( mm_data->reg.update_stat NEQ MS_UPDATED)//only use value in FFS in this case
-{
- TRACE_EVENT("MS NOT UPDATED, readsimloci from FFS");
-  if(mm_read_ffs_simloci())
-  	{
-    /*Successful read*/
-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], 
-						loc_info_ffs.loc[8], loc_info_ffs.loc[9], loc_info_ffs.loc[10]);
-  reg_read_loc_info (&loc_info_ffs);
-  	}
-}
-/* added by TISH 0418 to write simloci to FFS */
-}
+
+  /*add by TISH 0418 to write imsi to FFS*/
+  mm_read_ffs_imsi();
+  if (reg_imsi_equal(&imsi_in_ffs, &mm_data->reg.imsi_struct))
+  {
+    /* added by TISH 0418 to write simloci to FFS */
+    if( mm_data->reg.update_stat NEQ MS_UPDATED)
+    {	//only use value in FFS in this case
+      TRACE_EVENT("MS NOT UPDATED, readsimloci from FFS");
+      if(mm_read_ffs_simloci())
+      {
+        /*Successful read*/
+        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], loc_info_ffs.loc[8],
+			loc_info_ffs.loc[9], loc_info_ffs.loc[10]);
+        reg_read_loc_info (&loc_info_ffs);
+      }
+    }
+  }
   mm_data->reg.acc_class = sim_mm_insert_ind->acc_ctrl.acc[0] * 256 +
                            sim_mm_insert_ind->acc_ctrl.acc[1];
   reg_read_bcch_info (sim_mm_insert_ind);
@@ -485,13 +491,14 @@
   }
 
   /*
-   * If file size is indicated in SIM MM insert indication, MM shall read files from SIM.
+   * If file size is indicated in SIM MM insert indication,
+   * MM shall read files from SIM.
    */
   if(reg_sim_files_to_be_read(sim_mm_insert_ind))
   {
     /*
-    * Read indicated EFs in SIM_MM_INSERT_IND from SIM.
-    */
+     * Read indicated EFs in SIM_MM_INSERT_IND from SIM.
+     */
     reg_read_next_sim_file();
   }
 
@@ -671,12 +678,12 @@
         }
         else
         {
-        TRACE_EVENT ("Ignore actual PLMN");
-        copy_plmn[i] = FALSE;
+          TRACE_EVENT ("Ignore actual PLMN");
+          copy_plmn[i] = FALSE;
+        }
       }
     }
   }
-  }
 
   /* 
    * GSM 03.22 subclause 4.4.3 gives some rules in which way the PLMN list 
@@ -795,22 +802,22 @@
   }
   else
   {
-  plmn->v_plmn = V_PLMN_PRES;
-  plmn->mcc[0] = mm_data->reg.imsi_struct.id[0];
-  plmn->mcc[1] = mm_data->reg.imsi_struct.id[1];
-  plmn->mcc[2] = mm_data->reg.imsi_struct.id[2];
-  plmn->mnc[0] = mm_data->reg.imsi_struct.id[3];
-  plmn->mnc[1] = mm_data->reg.imsi_struct.id[4];
-
-  /* 
-   * We cannot be sure that plmn->mnc[2] really belongs to the MNC, 
-   * but the comparison routines for the HPLMN are done in a way that 
-   * this doesn't matter anyway. See GSM 03.03 subclause 2.2, 
-   * which is far away from being clear and GSM 03.22 version 7.1.0 
-   * Release 1998 Annex A (normative). Figure A.2 in this annex makes 
-   * it obvious that 3-digit-MNC isn't only a NA issue!
-   */
-  plmn->mnc[2] = mm_data->reg.imsi_struct.id[5];
+    plmn->v_plmn = V_PLMN_PRES;
+    plmn->mcc[0] = mm_data->reg.imsi_struct.id[0];
+    plmn->mcc[1] = mm_data->reg.imsi_struct.id[1];
+    plmn->mcc[2] = mm_data->reg.imsi_struct.id[2];
+    plmn->mnc[0] = mm_data->reg.imsi_struct.id[3];
+    plmn->mnc[1] = mm_data->reg.imsi_struct.id[4];
+
+    /* 
+     * We cannot be sure that plmn->mnc[2] really belongs to the MNC, 
+     * but the comparison routines for the HPLMN are done in a way that 
+     * this doesn't matter anyway. See GSM 03.03 subclause 2.2, 
+     * which is far away from being clear and GSM 03.22 version 7.1.0 
+     * Release 1998 Annex A (normative). Figure A.2 in this annex makes 
+     * it obvious that 3-digit-MNC isn't only a NA issue!
+     */
+    plmn->mnc[2] = mm_data->reg.imsi_struct.id[5];
   }/* end of mm_data->reg.acting_hplmn.v_plmn */
 }
 
@@ -1252,7 +1259,8 @@
 | STATE   : code                ROUTINE : reg_sim_files_to_be_read   |
 +--------------------------------------------------------------------+
 
-  PURPOSE : Read the EFs size (EFu=EFPLMNwAcT, EFo=EFOPLMNwAcT, EFs=EFPLMNSEL) information delivered 
+  PURPOSE : Read the EFs size (EFu=EFPLMNwAcT, EFo=EFOPLMNwAcT, EFs=EFPLMNSEL)
+	    information delivered 
             by the SIM into the registration data structures.
 
 */
@@ -1270,10 +1278,10 @@
   if (sim_mm_insert_ind->u_ctl_plmn_sel_actech_list_sz >0)
   {
     mm_data->reg.upd_sim_ucps_at = SAT_READ_FILE;
-   /*Set indicatort sim reading is in progress to true*/
+    /*Set indicatort sim reading is in progress to true*/
     mm_data->reg.sim_read_in_progress = TRUE;
     /*
-     * MM cant decide here how many PLMNs are supported GSM access Technology so 
+     * MM cant decide here how many PLMNs are supported GSM access Technology so
      * MM should read maximum number of plmn as much it can read.
      * At present there is a limitation in SIM read req. It cant read more than 
      * 256 bytes in one request. May be PLMN reading can be extended using more
@@ -1298,7 +1306,7 @@
     /*Set indicatort sim reading is in progress to true*/
     mm_data->reg.sim_read_in_progress = TRUE;
     /*
-     * MM cant decide here how many PLMNs are supported GSM access Technology so 
+     * MM cant decide here how many PLMNs are supported GSM access Technology so
      * MM should read maximum number of plmn as much it can read.
      * At present there is a limitation in SIM read req. It cant read more than 
      * 256 bytes in one request. May be PLMN reading can be extended using more
@@ -1425,7 +1433,6 @@
     mm_build_rr_sync_hplmn_req();
     mm_mmgmm_ahplmn_ind(&mm_data->reg.acting_hplmn);
   }
-  
 }
 
 
@@ -1504,7 +1511,6 @@
     memcpy (mm_data->reg.kc, sim_mm_insert_ind->kc_n.kc, MAX_KC);
     mm_data->reg.cksn = sim_mm_insert_ind->kc_n.kc[8];
   }
-
 }
 
 /*
@@ -1580,8 +1586,9 @@
   USHORT plmn_count = 0;
 
   TRACE_FUNCTION ("reg_read_pref_plmn ()");
-/* 
-   * If any additional which does not give complete PLMN id(length MOD UBYTES_PER_PLMN > 0),
+  /* 
+   * If any additional which does not give complete
+   * PLMN id(length MOD UBYTES_PER_PLMN > 0),
    * ignore these additional bytes at the end
    */
   mm_data->reg.sim_plmnsel_len = length-length%UBYTES_PER_PLMN;
@@ -1607,7 +1614,6 @@
   }
 }
 
-
 #ifdef REL99
 
 /*
@@ -1724,9 +1730,9 @@
 | STATE   : code                ROUTINE : reg_read_ocps_acctec                 |
 +------------------------------------------------------------------------------+
 
-  PURPOSE : Read Operator controlled PLMN selector with access technology list delivered by
-            the SIM card. This can happens only after SIM insert indication indicates to read
-            file from SIM.
+  PURPOSE : Read Operator controlled PLMN selector with access technology list
+	    delivered by the SIM card. This can happens only after SIM insert
+	    indication indicates to read file from SIM.
 */
 GLOBAL void reg_read_ocps_acctec(UBYTE* data, USHORT length)
 {
@@ -1772,8 +1778,8 @@
   }  
 }
 
-
 #endif
+
 /*
 +--------------------------------------------------------------------+
 | PROJECT : GSM-PS (6147)       MODULE  : MM_REG                     |
@@ -2046,32 +2052,32 @@
                                    UBYTE max_length )
 {
   GET_INSTANCE_DATA;
-    PALLOC (read_req, SIM_READ_REQ);
-
-    TRACE_FUNCTION ("mm_send_sim_read_req()");
-
-    read_req->source = SRC_MM;
+  PALLOC (read_req, SIM_READ_REQ);
+
+  TRACE_FUNCTION ("mm_send_sim_read_req()");
+
+  read_req->source = SRC_MM;
   /* req_id can be set to 0 as MM sends a SIM_READ_REQ only 
    * when it gets the SIM_READ_CNF to the previous request */
-    read_req->req_id = 0;              
-
-    read_req->offset = 0;
-
-    if(path_info_ptr NEQ NULL)
-    {
-      read_req->v_path_info = TRUE;
-      read_req->path_info = *path_info_ptr;
-    }
-    else
-    {
-      read_req->v_path_info = FALSE;
-    }
-
-    mm_data->sim_read_req_data_field = read_req->datafield = datafield;
-
-    read_req->length = act_length;
-    read_req->max_length = max_length;
-    PSENDX (SIM, read_req);
+  read_req->req_id = 0;              
+
+  read_req->offset = 0;
+
+  if(path_info_ptr NEQ NULL)
+  {
+    read_req->v_path_info = TRUE;
+    read_req->path_info = *path_info_ptr;
+  }
+  else
+  {
+    read_req->v_path_info = FALSE;
+  }
+
+  mm_data->sim_read_req_data_field = read_req->datafield = datafield;
+
+  read_req->length = act_length;
+  read_req->max_length = max_length;
+  PSENDX (SIM, read_req);
 }
 
 /*
@@ -2113,7 +2119,7 @@
     return TRUE;
   }
 
-  #ifdef REL99
+#ifdef REL99
   /*updating status user controlled & operator controlled PLMN selection*/
 
   if (mm_data->reg.upd_sim_ucps_at EQ SAT_READ_FILE)
@@ -2131,7 +2137,6 @@
     return TRUE;
   }
 
-
   if (mm_data->reg.upd_sim_ocps_at EQ SAT_READ_FILE)
   {
     /*
@@ -2365,10 +2370,9 @@
   mm_data->ef_indicator = 0xFF;
   /* Write changed data to SIM */
   reg_build_sim_update ();
-/* added by TISH 0418 to write simloci to FFS */
-        mm_write_simloci_to_ffs();
-        mm_write_imsi_to_ffs();
-/* added by TISH 0418 to write simloci to FFS */
+  /* added by TISH 0418 to write simloci to FFS */
+  mm_write_simloci_to_ffs();
+  mm_write_imsi_to_ffs();
 
   /* Check HPLMN timer state */
   reg_check_hplmn_tim (mm_data->reg.thplmn);
@@ -2440,14 +2444,13 @@
   /* fix for CT PTCRB- TC_26_7_4_5_4_6. HPLMN timer is not started only if 
    bcch PLMN and HPLMN belong to same country and both are in equivalent PLMN list.
    Detailed analysis present in OMAPS00150594*/
-if (reg_same_country_plmn (bcch_plmn, &hplmn))
+  if (reg_same_country_plmn (bcch_plmn, &hplmn))
   {
-
       if (reg_plmn_equal_eqv (bcch_plmn, &hplmn))
         return TRUE; /* The PLMN is the HPLMN */
       else
         return FALSE; /* National roaming */
-}
+  }
   /* International roaming: Check the preferred PLMN list */
   for (i = 0; i < MAX_PREF_PLMN_ID; i++)
   {
@@ -2471,7 +2474,8 @@
 +----------------------------------------------------------------------------+
 
   PURPOSE : This function checks whether:
-            - the HPLMN timer has to be started (if not running) with the duration given as input parameter or 
+            - the HPLMN timer has to be started (if not running)
+	      with the duration given as input parameter or 
             - stopped. 
             Time unit is decihour.
 */
@@ -2498,16 +2502,16 @@
         mm_data->reg.update_stat NEQ MS_LA_NOT_ALLOWED AND
         !reg_best_plmn_in_country (&mm_data->reg.actual_plmn))
     {
-     /*
-      * Period of HPLMN is controlled by EF_HPLMN file of the SIM.
-      * According to TS 11.11 chapter 10.3.5 :
-      *  0- no search attempt
-      *  N- search attempts every N*6 min intervals (6 min to 8 hours)
-      * For phase 1 SIM wehereby this EF is not available, a default 
-      * value of 1 hour shall be used according to TS 22.011 
-      * chapter 3.2.2.5. In G23 this is managed by SIM entity that 
-      * will force this default value within SIM_INSERT_IND.
-      */
+      /*
+       * Period of HPLMN is controlled by EF_HPLMN file of the SIM.
+       * According to TS 11.11 chapter 10.3.5 :
+       *  0- no search attempt
+       *  N- search attempts every N*6 min intervals (6 min to 8 hours)
+       * For phase 1 SIM wehereby this EF is not available, a default 
+       * value of 1 hour shall be used according to TS 22.011 
+       * chapter 3.2.2.5. In G23 this is managed by SIM entity that 
+       * will force this default value within SIM_INSERT_IND.
+       */
       if (!TIMERACTIVE(T_HPLMN))
       {
         if (mm_data->first_attach_mem)
@@ -2695,9 +2699,9 @@
           }
           else if (reg_plmn_equal_hplmn (&plmn))
           {
-             /* fix for TC 26.7.4.5.4.4. Select a PLMN of Same country 
-                and not HPLMN if in International roaming only for Test sim.*/
-             if((mm_data->reg.op.ts EQ TS_NO_AVAIL) OR
+            /* fix for TC 26.7.4.5.4.4. Select a PLMN of Same country 
+               and not HPLMN if in International roaming only for Test sim.*/
+            if((mm_data->reg.op.ts EQ TS_NO_AVAIL) OR
                reg_same_country_plmn (&plmn, &mm_data->reg.actual_plmn))
             {
               TRACE_EVENT ("HPLMN found - success");
@@ -2709,7 +2713,6 @@
               mm_data->reg.plmn_index++;
               continue;
             }
-
           }
           else if (!reg_plmn_in_pref_list (&plmn))
           {
@@ -2738,8 +2741,8 @@
 
           /* 
            * An alternate network candidate has been found, so try to camp
-           * on it. It the registration procedure fails, then the normal automatic 
-           * network selection procedure will apply.
+           * on it. It the registration procedure fails, then the normal
+	   * automatic network selection procedure will apply.
            */
           reg_select_network (&plmn); /*lint !e772 conceivably not initialized */
         }
@@ -2987,4 +2990,3 @@
     }
   }
 }
-