view src/g23m-gsm/mm/mm_gprsp.c @ 636:57e67ca2e1cb

pcmdata.c: default +CGMI to "FreeCalypso" and +CGMM to model The present change has no effect whatsoever on Falconia-made and Openmoko-made devices on which /pcm/CGMI and /pcm/CGMM files have been programmed in FFS with sensible ID strings by the respective factories, but what should AT+CGMI and AT+CGMM queries return when the device is a Huawei GTM900 or Tango modem that has been converted to FreeCalypso with a firmware change? Before the present change they would return compiled-in defaults of "<manufacturer>" and "<model>", respectively; with the present change the firmware will self-identify as "FreeCalypso GTM900-FC" or "FreeCalypso Tango" on the two respective targets. This firmware identification will become important if someone incorporates an FC-converted GTM900 or Tango modem into a ZeroPhone-style smartphone where some high-level software like ofono will be talking to the modem and will need to properly identify this modem as FreeCalypso, as opposed to some other AT command modem flavor with different quirks. In technical terms, the compiled-in default for the AT+CGMI query (which will always be overridden by the /pcm/CGMI file in FFS if one is present) is now "FreeCalypso" in all configs on all targets; the compiled-in default for the AT+CGMM query (likewise always overridden by /pcm/CGMM if present) is "GTM900-FC" if CONFIG_TARGET_GTM900 or "Tango" if CONFIG_TARGET_TANGO or the original default of "<model>" otherwise.
author Mychaela Falconia <falcon@freecalypso.org>
date Sun, 19 Jan 2020 20:14:58 +0000
parents 27a4235405c6
children
line wrap: on
line source

/* 
+----------------------------------------------------------------------------- 
|  Project :  GSM-PS (8410)
|  Modul   :  MM_GPRSP.C
+----------------------------------------------------------------------------- 
|  Copyright 2002 Texas Instruments Berlin, AG 
|                 All rights reserved. 
| 
|                 This file is confidential and a trade secret of Texas 
|                 Instruments Berlin, AG 
|                 The receipt of or possession of this file does not convey 
|                 any rights to reproduce or disclose its contents or to 
|                 manufacture, use, or sell anything it may describe, in 
|                 whole, or in part, without the specific written consent of 
|                 Texas Instruments Berlin, AG. 
+----------------------------------------------------------------------------- 
|  Purpose :  This module defines the functions which are necessary 
|             to bind the GPRS Primitives (MMGMM SAP) to the 
|             MM entity's internal functional interface.
+----------------------------------------------------------------------------- 
*/ 

#ifndef MM_GPRSP_C
#define MM_GPRSP_C

#define ENTITY_MM

/*==== INCLUDES ===================================================*/
#include <string.h>
#include "typedefs.h"
#include "pconst.cdg"
#include "message.h"
#include "ccdapi.h"
#include "vsi.h"                     
#include "custom.h"
#include "gsm.h"
#include "prim.h"
#include "cnf_mm.h"
#include "mon_mm.h"
#include "pei.h"                     
#include "tok.h"
#include "mm.h"

#ifdef  GPRS

/*==== EXPORT ==============================================================*/

/*==== TEST ================================================================*/

/*==== PRIVAT ==============================================================*/

/*==== VARIABLES ===========================================================*/

/*==== FUNCTIONS ===========================================================*/

/*
+----------------------------------------------------------------------------+
| PROJECT : GSM-PS (6147)       MODULE  : MM_MM                              |
| STATE   : code                ROUTINE : mm_mmgmm_reg_req                   |
+----------------------------------------------------------------------------+

  PURPOSE : This function receives the MMGMM_REG_REQ primitive and
            forwards it to its appropriate handler.
  
*/

GLOBAL void mm_mmgmm_reg_req (const T_MMGMM_REG_REQ *mmgmm_reg_req)
{
  TRACE_FUNCTION ("mm_mmgmm_reg_req()");
  mm_func_mmgmm_reg_req (mmgmm_reg_req->service_mode, 
                         mmgmm_reg_req->reg_type,
                         mmgmm_reg_req->mobile_class,
                         mmgmm_reg_req->bootup_act);

  PFREE (mmgmm_reg_req);
}


/*
+----------------------------------------------------------------------------+
| PROJECT : GSM-PS (6147)       MODULE  : MM_MM                              |
| STATE   : code                ROUTINE : mm_mmgmm_nreg_req                  |
+----------------------------------------------------------------------------+

  PURPOSE : This function receives the MMGMM_NREG_REQ primitive and
            forwards it to its appropriate handler.
  
*/

GLOBAL void mm_mmgmm_nreg_req (const T_MMGMM_NREG_REQ *mmgmm_nreg_req)
{
  TRACE_FUNCTION ("mm_mmgmm_nreg_req()");

  mm_func_mmgmm_nreg_req (mmgmm_nreg_req->detach_cause, 
                          mmgmm_nreg_req->detach_done,
                          mmgmm_nreg_req->cause);

  PFREE (mmgmm_nreg_req);
}


/*
+----------------------------------------------------------------------------+
| PROJECT : GSM-PS (6147)       MODULE  : MM_MM                              |
| STATE   : code                ROUTINE : mm_mmgmm_net_req                   |
+----------------------------------------------------------------------------+

  PURPOSE : This function receives the MMGMM_NREG_REQ primitive and
            forwards it to its appropriate handler.
  
*/

GLOBAL void mm_mmgmm_net_req (const T_MMGMM_NET_REQ *mmgmm_net_req)
{
  GET_INSTANCE_DATA;
  TRACE_FUNCTION ("mm_mmgmm_net_req()");

 /* Mark the network search as beeing for the MMI */
  mm_data->plmn_scan_mmi = TRUE;

  /* Start scanning for available PLMNs */
  mm_func_mmgmm_net_req ();

  PFREE (mmgmm_net_req);
}


/*
+----------------------------------------------------------------------------+
| PROJECT : GSM-PS (6147)       MODULE  : MM_MM                              |
| STATE   : code                ROUTINE : mm_mmgmm_plmn_res                  |
+----------------------------------------------------------------------------+

  PURPOSE : This function receives the MMGMM_PLMN_RES primitive and
            forwards it to its appropriate handler.
  
*/

GLOBAL void mm_mmgmm_plmn_res (const T_MMGMM_PLMN_RES *mmgmm_plmn_res)
{
  TRACE_FUNCTION ("mm_mmgmm_plmn_res()");
  
#ifdef WIN32
  vsi_o_ttrace (VSI_CALLER TC_EVENT,
                "  plmn = %x%x%x %x%x%x", 
                mmgmm_plmn_res->plmn.mcc[0],
                mmgmm_plmn_res->plmn.mcc[1],
                mmgmm_plmn_res->plmn.mcc[2],
                mmgmm_plmn_res->plmn.mnc[0],
                mmgmm_plmn_res->plmn.mnc[1],
                mmgmm_plmn_res->plmn.mnc[2]);
  vsi_o_ttrace (VSI_CALLER TC_EVENT,
                "  reg_type = %x", 
                mmgmm_plmn_res->reg_type);
#endif /* #ifdef WIN32 */  

  mm_func_mmgmm_plmn_res (&mmgmm_plmn_res->plmn,
                          mmgmm_plmn_res->reg_type,
                          mmgmm_plmn_res->mobile_class);
  
  PFREE (mmgmm_plmn_res);
}


/*
+----------------------------------------------------------------------------+
| PROJECT : GSM-PS (6147)       MODULE  : MM_MM                              |
| STATE   : code                ROUTINE : mm_mmgmm_plmn_mode_req             |
+----------------------------------------------------------------------------+

  PURPOSE : This function receives the MMGMM_PLMN_MODE_REQ primitive and
            forwards it to its appropriate handler.
  
*/

GLOBAL void 
mm_mmgmm_plmn_mode_req (const T_MMGMM_PLMN_MODE_REQ *mmgmm_plmn_mode_req)
{
  TRACE_FUNCTION ("mm_mmgmm_plmn_mode_req()");

  mm_func_mmgmm_plmn_mode_req (mmgmm_plmn_mode_req->mode);

  PFREE (mmgmm_plmn_mode_req);
}


/*
+----------------------------------------------------------------------------+
| PROJECT : GSM-PS (6147)       MODULE  : MM_MM                              |
| STATE   : code                ROUTINE : mm_mmgmm_auth_rej_req              |
+----------------------------------------------------------------------------+

  PURPOSE : This function receives the MMGMM_AUTH_REG_REQ primitive and
            forwards it to its appropriate handler.
  
*/

GLOBAL void 
mm_mmgmm_auth_rej_req (const T_MMGMM_AUTH_REJ_REQ *mmgmm_auth_rej_req)
{
  TRACE_FUNCTION ("mm_mmgmm_auth_rej_req()");

  mm_func_mmgmm_auth_rej_req ();

  PFREE (mmgmm_auth_rej_req);
}

/*
+----------------------------------------------------------------------------+
| PROJECT : GSM-PS (6147)       MODULE  : MM_MM                              |
| STATE   : code                ROUTINE : mm_mmgmm_cm_establish_res          |
+----------------------------------------------------------------------------+

  PURPOSE : This function receives the MMGMM_CM_ESTABLISH_RES primitive and
            forwards it to its appropriate handler.
  
*/

GLOBAL void 
mm_mmgmm_cm_establish_res (const T_MMGMM_CM_ESTABLISH_RES *est_res)
{
  TRACE_FUNCTION ("mm_mmgmm_cm_establish_res()");

  mm_func_mmgmm_cm_establish_res (est_res->cm_establish_res);

  PFREE (est_res);
}


/*
+----------------------------------------------------------------------------+
| PROJECT : GSM-PS (6147)       MODULE  : MM_MM                              |
| STATE   : code                ROUTINE : mm_mmgmm_attach_started_req        |
+----------------------------------------------------------------------------+

  PURPOSE : This function receives the MMGMM_ATTACH_STARTED_REQ primitive and
            forwards it to its appropriate handler.
  
*/

GLOBAL void
mm_mmgmm_attach_started_req (const T_MMGMM_ATTACH_STARTED_REQ *start_req)
{
  TRACE_FUNCTION ("mm_mmgmm_attach_started_req()");

  mm_func_mmgmm_attach_started_req ();

  PFREE (start_req);
}


/*
+----------------------------------------------------------------------------+
| PROJECT : GSM-PS (6147)       MODULE  : MM_MM                              |
| STATE   : code                ROUTINE : mm_mmgmm_attach_acc_req            |
+----------------------------------------------------------------------------+

  PURPOSE : This function receives the MMGMM_ATTACH_ACC_REQ primitive and
            forwards it to its appropriate handler.
  
*/

GLOBAL void 
mm_mmgmm_attach_acc_req (const T_MMGMM_ATTACH_ACC_REQ *mmgmm_attach_acc_req)
{
  TRACE_FUNCTION ("mmgmm_attach_acc_req()");

  mm_func_mmgmm_attach_acc_req (&mmgmm_attach_acc_req->plmn,
                                mmgmm_attach_acc_req->lac,
                                mmgmm_attach_acc_req->v_tmsi,
                                mmgmm_attach_acc_req->tmsi,
                                mmgmm_attach_acc_req->v_equ_plmn_list,
                                &mmgmm_attach_acc_req->equ_plmn_list);
  
  PFREE (mmgmm_attach_acc_req);
}


/*
+----------------------------------------------------------------------------+
| PROJECT : GSM-PS (6147)       MODULE  : MM_MM                              |
| STATE   : code                ROUTINE : mm_mmgmm_attach_rej_req            |
+----------------------------------------------------------------------------+

  PURPOSE : This function receives the MMGMM_ATTACH_REJ_REQ primitive and
            forwards it to its appropriate handler.
  
*/

GLOBAL void
mm_mmgmm_attach_rej_req (const T_MMGMM_ATTACH_REJ_REQ *mmgmm_attach_rej_req)
{
  TRACE_FUNCTION ("mm_mmgmm_attach_rej_req()");

  mm_func_mmgmm_attach_rej_req (mmgmm_attach_rej_req->cause);

  PFREE (mmgmm_attach_rej_req);
}


/*
+----------------------------------------------------------------------------+
| PROJECT : GSM-PS (6147)       MODULE  : MM_MM                              |
| STATE   : code                ROUTINE : mm_mmgmm_detach_started_req        |
+----------------------------------------------------------------------------+

  PURPOSE : This function receives the MMGMM_DETACH_STARTED_REQ primitive and
            forwards it to its appropriate handler.
  
*/

GLOBAL void
mm_mmgmm_detach_started_req (const T_MMGMM_DETACH_STARTED_REQ *det_start_req)
{
  TRACE_FUNCTION ("mm_mmgmm_detach_started_req()");

  mm_func_mmgmm_detach_started_req ();

  PFREE (det_start_req);
}


/*
+----------------------------------------------------------------------------+
| PROJECT : GSM-PS (6147)       MODULE  : MM_MM                              |
| STATE   : code                ROUTINE : mm_mmgmm_start_t3212_req           |
+----------------------------------------------------------------------------+

  PURPOSE : This function receives the MMGMM_START_T3212_REQ primitive and
            forwards it to its appropriate handler.
  
*/

GLOBAL void
mm_mmgmm_start_t3212_req (const T_MMGMM_START_T3212_REQ *start_t3212_req)
{
  TRACE_FUNCTION ("mmgmm_start_t3212_req()");

  mm_func_mmgmm_start_t3212_req ();

  PFREE (start_t3212_req);
}


/*
+----------------------------------------------------------------------------+
| PROJECT : GSM-PS (6147)       MODULE  : MM_MM                              |
| STATE   : code                ROUTINE : mm_mmgmm_cm_emergency_res          |
+----------------------------------------------------------------------------+

  PURPOSE : This function receives the MMGMM_CM_EMERGENCY_RES primitive and
            forwards it to its appropriate handler.
  
*/

GLOBAL void 
mm_mmgmm_cm_emergency_res (const T_MMGMM_CM_EMERGENCY_RES *emerge_res)
{
  TRACE_FUNCTION ("mm_mmgmm_cm_emergency_res()");

  mm_func_mmgmm_cm_emergency_res (emerge_res->cm_establish_res);

  PFREE (emerge_res);
}


/*
+----------------------------------------------------------------------------+
| PROJECT : GSM-PS (6147)       MODULE  : MM_MM                              |
| STATE   : code                ROUTINE : mm_mmgmm_allowed_req               |
+----------------------------------------------------------------------------+

  PURPOSE : This function receives the MMGMM_ALLOWED_REQ primitive and
            forwards it to its appropriate handler.
  
*/

GLOBAL void 
mm_mmgmm_allowed_req (const T_MMGMM_ALLOWED_REQ *allowed_req)
{
  GET_INSTANCE_DATA;
  TRACE_FUNCTION ("mm_mmgmm_allowed_req()");

  /* 
   * It can be safely assumed that the PLMN and the LAC is the 
   * PLMN and the LAC where RR is currently camped on.
   */
  assert (mm_check_lai_from_RR (&mm_data->mm.lai,
                                &allowed_req->plmn,
                                allowed_req->lac));
  
  mm_func_mmgmm_allowed_req (allowed_req->v_equ_plmn_list, &allowed_req->equ_plmn_list);

  PFREE (allowed_req);
}

#if 0
/*
+----------------------------------------------------------------------------+
| PROJECT : GSM-PS (6147)       MODULE  : MM_MM                              |
| STATE   : code                ROUTINE : mm_mmgmm_trigger_req               |
+----------------------------------------------------------------------------+

  PURPOSE : This function receives the MMGMM_TRIGGER_REQ primitive and
            forwards it to its appropriate handler.
  
*/

GLOBAL void mm_mmgmm_trigger_req (const T_MMGMM_TRIGGER_REQ *trigger_req)
{
  TRACE_FUNCTION ("mm_mmgmm_trigger_req()");

  mm_func_mmgmm_trigger_req ();

  PFREE (trigger_req);
}
#endif

#endif /* GPRS */

#endif /* MM_GPRSP_C */