view src/aci2/mfw/mfw_sima.c @ 685:3fb7384e820d

tpudrv12.h: FCDEV3B goes back to being itself A while back we had the idea of a FreeCalypso modem family whereby our current fcdev3b target would some day morph into fcmodem, with multiple FC modem family products, potentially either triband or quadband, being firmware-compatible with each other and with our original FCDEV3B. But in light of the discovery of Tango modules that earlier idea is now being withdrawn: instead the already existing Tango hw is being adopted into our FreeCalypso family. Tango cannot be firmware-compatible with triband OM/FCDEV3B targets because the original quadband RFFE on Tango modules is wired in TI's original Leonardo arrangement. Because this Leonardo/Tango way is now becoming the official FreeCalypso way of driving quadband RFFEs thanks to the adoption of Tango into our FC family, our earlier idea of extending FIC's triband RFFE control signals with TSPACT5 no longer makes much sense - we will probably never produce any new hardware with that once-proposed arrangement. Therefore, that triband-or-quadband FCFAM provision is being removed from the code base, and FCDEV3B goes back to being treated the same way as CONFIG_TARGET_GTAMODEM for RFFE control purposes.
author Mychaela Falconia <falcon@freecalypso.org>
date Thu, 24 Sep 2020 21:03:08 +0000
parents 93999a60b835
children
line wrap: on
line source

/*
+--------------------------------------------------------------------+
| PROJECT: MMI-Framework (8417)         $Workfile:: mfw_sima.c      $|
| $Author:: Es                          $Revision::  1              $|
| CREATED: 13.10.98                     $Modtime:: 2.03.00 15:14    $|
| STATE  : code                                                      |
+--------------------------------------------------------------------+

   MODULE  : MFW_SIMA

   PURPOSE : This modul contains the functions for SIM management.

	Jan 16, 2006 DR: OMAPS00061460 - Shashi Shekar B.S.
	Description: SAT Icon support
	Solution : SAT icon support added.

*/


#define ENTITY_MFW

#include "mfw_sys.h"

#if defined (NEW_FRAME)

#include "typedefs.h"
#include "vsi.h"
#include "custom.h"
#include "gsm.h"

#else

#include "STDDEFS.H"
#include "custom.h"
#include "gsm.h"
#include "vsi.h"

#endif

#include "prim.h"

#include "message.h"
#include "prim.h"
#include "aci_cmh.h"
#include "prim.h"
#ifndef PCM_2_FFS
#include "pcm.h"
#endif


#include "psa.h"
#include "psa_sim.h"

#include "mfw_mfw.h"
#include "mfw_nm.h"
#include "mfw_sim.h"
#include "mfw_simi.h"
#include "mfw_sima.h"
#include "mfw_nmi.h"
#include "mfw_phb.h"
#include "mfw_cm.h"
#include "mfw_cmi.h"
// Shashi Shekar B.S., a0876501, Jan 16, 2006, DR: OMAPS00061460
#ifdef FF_MMI_SAT_ICON
#include "mfw_sat.h"
#endif

#ifndef FF_2TO1_PS
#include "p_sim.val"
#endif

#include <string.h>

#define hCommSIM _ENTITY_PREFIXED(hCommSIM)
#if defined (NEW_FRAME)
EXTERN T_HANDLE      hCommSIM;        /* SIM    Communication       */
#else
EXTERN T_VSI_CHANDLE hCommSIM;        /* SIM    Communication       */
#endif

EXTERN void          aci_create (BOOL (*r_cb)(USHORT opc, void * data),
                                 BOOL (*cmd)(char *));

T_MFW_READ_CALLBACK read_callback_data;

// Shashi Shekar B.S., a0876501, Jan 16, 2006, DR: OMAPS00061460
#ifdef FF_MMI_SAT_ICON
EXTERN U8 read_image_instance_file;
#endif

/*
+--------------------------------------------------------------------+
| PROJECT: MMI-Framework (8417)         MODULE: MFW_SIMA             |
| STATE  : code                         ROUTINE: sima_response_cb    |
+--------------------------------------------------------------------+

   PURPOSE : Response Callback Handler.

*/

GLOBAL BOOL sima_response_cb (ULONG opc, void * data)
{
//  TRACE_FUNCTION ("sim_response_cb()");

  switch (opc)
  {
    case SIM_MMI_INSERT_IND:
      /* MMI relevant parameters from the SIM card has received. */
      rAT_PlusCFUNP ((T_SIM_MMI_INSERT_IND *)data);
      return FALSE;   /* processed also by ACI */

    case SIM_ACTIVATE_CNF:
      sim_mmi_parameter((T_SIM_ACTIVATE_CNF *)data);
      return FALSE;

    case SIM_ACTIVATE_IND:
      sim_mmi_update_parameter((T_SIM_ACTIVATE_IND *)data);
      return FALSE;
  }

  return FALSE;       /* not processed by extension */
}

/*
+--------------------------------------------------------------------+
| PROJECT: MMI-Framework (8417)         MODULE: MFW_SIMA             |
| STATE  : code                         ROUTINE: sima_init           |
+--------------------------------------------------------------------+

   PURPOSE : Install AT-Command Extension.

*/

void sima_init ()
{
  TRACE_FUNCTION ("sima_init()");
}


/*
+----------------------------------------------------------------------+
| PROJECT: MMI-Framework (8417)         MODULE: MFW_SIMA               |
| STATE  : code                         ROUTINE: sim_read_sim          |
+----------------------------------------------------------------------+


   PURPOSE :   Request to read SIM card.

*/

void sim_read_sim(USHORT data_id, UBYTE len, UBYTE max_length)
{
  SHORT table_id;

  TRACE_FUNCTION ("sim_read_sim()");

  table_id = psaSIM_atbNewEntry();

  if(table_id NEQ NO_ENTRY)
  {
    simShrdPrm.atb[table_id].ntryUsdFlg = TRUE;
    simShrdPrm.atb[table_id].accType    = ACT_RD_DAT;
    simShrdPrm.atb[table_id].reqDataFld = data_id;
    simShrdPrm.atb[table_id].dataOff    = 0;
    simShrdPrm.atb[table_id].dataLen    = len;
    simShrdPrm.atb[table_id].recMax     = max_length;
    simShrdPrm.atb[table_id].exchData   = NULL;
    simShrdPrm.atb[table_id].rplyCB     = sim_read_sim_cb;

    simShrdPrm.aId = table_id;

    if(psaSIM_AccessSIMData( ) < 0)
    {
      TRACE_EVENT("FATAL ERROR");
    }
  }
}

// Shashi Shekar B.S., a0876501, Jan 16, 2006, DR: OMAPS00061460
#ifdef FF_MMI_SAT_ICON
/*
+----------------------------------------------------------------------+
| PROJECT: MMI-Framework (8417)         MODULE: MFW_SIMA               |
| STATE  : code                         ROUTINE: sim_read_sim_icon     |
+----------------------------------------------------------------------+


   PURPOSE :   Request to read SIM card EF IMG. This is separated from the 
			   above SIM read function as we have to specify the record number 
			   also while reading the EF record & we dont want this functionality 
			   for Lite variants.

*/

void sim_read_sim_icon(T_SIM_ACCESS_PARAM *sim_icon_read_param)
{
  SHORT table_id;

  TRACE_FUNCTION ("sim_read_sim_icon()");

  table_id = psaSIM_atbNewEntry();

  if(table_id NEQ NO_ENTRY)
  {
    simShrdPrm.atb[table_id].ntryUsdFlg = TRUE;
    simShrdPrm.atb[table_id].accType    = ACT_RD_REC;
    simShrdPrm.atb[table_id].reqDataFld = sim_icon_read_param -> data_id;
    simShrdPrm.atb[table_id].dataOff    = sim_icon_read_param -> offset;
    simShrdPrm.atb[table_id].dataLen    = sim_icon_read_param -> len;
    simShrdPrm.atb[table_id].recMax     = sim_icon_read_param -> max_length;
    simShrdPrm.atb[table_id].exchData   = NULL;
	/* Read the Record number provided, only if available */
	if(sim_icon_read_param -> record_number)
    simShrdPrm.atb[table_id].recNr      = sim_icon_read_param -> record_number;
    simShrdPrm.atb[table_id].rplyCB     = sim_read_sim_cb;

    simShrdPrm.aId = table_id;

    if(psaSIM_AccessSIMData( ) < 0)
    {
      TRACE_EVENT("FATAL ERROR");
    }
  }
}
#endif

/*
+---------------------------------------------------------------------+
| PROJECT: MMI-Framework (8417)         MODULE: MFW_SIMA              |
| STATE  : code                         ROUTINE: sim_read_sim_cb      |
+---------------------------------------------------------------------+


   PURPOSE :   Call back for SIM read.

*/

void sim_read_sim_cb(SHORT table_id)
{
  TRACE_FUNCTION ("sim_read_sim_cb()");

  simShrdPrm.atb[table_id].ntryUsdFlg = FALSE;

// Shashi Shekar B.S., a0876501, Jan 16, 2006, DR: OMAPS00061460
#ifdef FF_MMI_SAT_ICON
    /* If we are reading the image data contents, 
    we dont need to enter the switch statement */
    if (read_image_instance_file)
	{
		sim_img_instance_data_cnf(simShrdPrm.atb[table_id].errCode, 
			simShrdPrm.atb[table_id].exchData);
        return;
	}
#endif

  switch (simShrdPrm.atb[table_id].reqDataFld)
  {
// Shashi Shekar B.S., a0876501, Jan 16, 2006, DR: OMAPS00061460
#ifdef FF_MMI_SAT_ICON
    /* EF-IMG contents */
    case SIM_IMG:
      sim_img_cnf(simShrdPrm.atb[table_id].errCode, simShrdPrm.atb[table_id].recNr, 
		  (UBYTE *)simShrdPrm.atb[table_id].exchData);
      break;
#endif

    /* Service provide name */
    case SIM_SPN:
      nm_spn_cnf(simShrdPrm.atb[table_id].errCode, (T_EF_SPN *)simShrdPrm.atb[table_id].exchData);
      break;

    /* group identifier level 1 */
    case SIM_GID1:
      sim_gid1_cnf(simShrdPrm.atb[table_id].errCode, simShrdPrm.atb[table_id].exchData);
      break;

    /* group identifier level 2 */
    case SIM_GID2:
      sim_gid2_cnf(simShrdPrm.atb[table_id].errCode, simShrdPrm.atb[table_id].exchData);
      break;

    case SIM_SST:
      sim_read_sst_cnf(simShrdPrm.atb[table_id].errCode, simShrdPrm.atb[table_id].exchData);
      break;
	/*MC CONQ5862, 13/06/02*, if not one of above data fileds, send event to MMI*/
    default:
    	read_callback_data.error_code = simShrdPrm.atb[table_id].errCode;
    	read_callback_data.read_buffer = simShrdPrm.atb[table_id].exchData;
    	sim_signal(E_SIM_READ_CALLBACK, (void*)&read_callback_data);
      break;
  }
}


/*
+----------------------------------------------------------------------+
| PROJECT: MMI-Framework (8417)         MODULE: MFW_SIMA               |
| STATE  : code                         ROUTINE: sim_write_sim         |
+----------------------------------------------------------------------+


   PURPOSE :   Request to write SIM card.

*/

void sim_write_sim(USHORT data_id, UBYTE *data, UBYTE length)
{
  SHORT table_id;

  /* Write preferred PLMN list in SIM card */
  table_id = psaSIM_atbNewEntry();

  if(table_id NEQ NO_ENTRY)
  {
    simShrdPrm.atb[table_id].ntryUsdFlg = TRUE;
    simShrdPrm.atb[table_id].accType    = ACT_WR_DAT;
    simShrdPrm.atb[table_id].reqDataFld = data_id;
    simShrdPrm.atb[table_id].dataOff    = 0;
    simShrdPrm.atb[table_id].dataLen    = length;
    simShrdPrm.atb[table_id].exchData   = data;
    simShrdPrm.atb[table_id].rplyCB     = sim_write_sim_cb;

    simShrdPrm.aId = table_id;

    if(psaSIM_AccessSIMData( ) < 0)
    {
      TRACE_EVENT("FATAL ERROR");
    }
  }
}


/*
+---------------------------------------------------------------------+
| PROJECT: MMI-Framework (8417)         MODULE: MFW_SIMA              |
| STATE  : code                         ROUTINE: sim_write_sim_cb     |
+---------------------------------------------------------------------+


   PURPOSE :   Call back for SIM write.

*/

void sim_write_sim_cb(SHORT table_id)
{
  simShrdPrm.atb[table_id].ntryUsdFlg = FALSE;

#ifdef FF_2TO1_PS
  if (simShrdPrm.atb[table_id].errCode EQ CAUSE_SIM_NO_ERROR)
#else
  if (simShrdPrm.atb[table_id].errCode EQ SIM_NO_ERROR)
#endif
  {
    TRACE_EVENT("FATAL ERROR");
  }
}