view src/aci2/aci/cmh_smsq.c @ 600:8f50b202e81f

board preprocessor conditionals: prep for more FC hw in the future This change eliminates the CONFIG_TARGET_FCDEV3B preprocessor symbol and all preprocessor conditionals throughout the code base that tested for it, replacing them with CONFIG_TARGET_FCFAM or CONFIG_TARGET_FCMODEM. These new symbols are specified as follows: CONFIG_TARGET_FCFAM is intended to cover all hardware designs created by Mother Mychaela under the FreeCalypso trademark. This family will include modem products (repackagings of the FCDEV3B, possibly with RFFE or even RF transceiver changes), and also my desired FreeCalypso handset product. CONFIG_TARGET_FCMODEM is intended to cover all FreeCalypso modem products (which will be firmware-compatible with the FCDEV3B if they use TI Rita transceiver, or will require a different fw build if we switch to one of Silabs Aero transceivers), but not the handset product. Right now this CONFIG_TARGET_FCMODEM preprocessor symbol is used to conditionalize everything dealing with MCSI. At the present moment the future of FC hardware evolution is still unknown: it is not known whether we will ever have any beyond-FCDEV3B hardware at all (contingent on uncertain funding), and if we do produce further FC hardware designs, it is not known whether they will retain the same FIC modem core (triband), if we are going to have a quadband design that still retains the classic Rita transceiver, or if we are going to switch to Silabs Aero II or some other transceiver. If we produce a quadband modem that still uses Rita, it will run exactly the same fw as the FCDEV3B thanks to the way we define TSPACT signals for the RF_FAM=12 && CONFIG_TARGET_FCFAM combination, and the current fcdev3b build target will be renamed to fcmodem. OTOH, if that putative quadband modem will be Aero-based, then it will require a different fw build target, the fcdev3b target will stay as it is, and the two targets will both define CONFIG_TARGET_FCFAM and CONFIG_TARGET_FCMODEM, but will have different RF_FAM numbers. But no matter which way we are going to evolve, it is not right to have conditionals on CONFIG_TARGET_FCDEV3B in places like ACI, and the present change clears the way for future evolution.
author Mychaela Falconia <falcon@freecalypso.org>
date Mon, 01 Apr 2019 01:05:24 +0000
parents 93999a60b835
children
line wrap: on
line source

/* 
+----------------------------------------------------------------------------- 
|  Project :  GSM-PS (6147)
|  Modul   :  CMH_SMSQ
+----------------------------------------------------------------------------- 
|  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 provides the query functions related to the 
|             protocol stack adapter for short message service.
+----------------------------------------------------------------------------- 
*/ 

#ifndef CMH_SMSQ_C
#define CMH_SMSQ_C
#endif

#include "aci_all.h"
/*==== INCLUDES ===================================================*/
#include "aci_cmh.h"
#include "ati_cmd.h"
#include "aci_cmd.h"

#ifdef FAX_AND_DATA
#include "aci_fd.h"
#endif    /* of #ifdef FAX_AND_DATA */


#include "aci.h"
#include "psa.h"
#include "psa_sms.h"
#include "cmh.h"
#include "cmh_sms.h"

/*==== CONSTANTS ==================================================*/

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

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

/* parameter block for delayed rAT_PlusCPMS call */
  LOCAL struct qAT_PlusCPMS_buffer { 
    T_ACI_CMD_SRC srcId;
    T_ACI_SMS_STOR_OCC m1;
    T_ACI_SMS_STOR_OCC m2;
    T_ACI_SMS_STOR_OCC m3;
  } qAT_PlusCPMS_buffer;


/*==== PROTOTYPES =================================================*/
LOCAL UCHAR qAT_PlusCPMS_delayed (void* arg);

/*==== FUNCTIONS ==================================================*/
/*
+--------------------------------------------------------------------+
| PROJECT : GSM-PS (6147)         MODULE  : CMH_SMSQ                 |
| STATE   : code                  ROUTINE : qAT_PlusCSMP             |
+--------------------------------------------------------------------+

  PURPOSE : This is the functional counterpart to the +CSMP? 
            AT command which returns the current settings of the
            text mode parameter.

            <fo>:    first octet of SMS-SUBMIT
            <vprel>: relative validity period
            <vpabs>: absolute validity period
            <vpenh>: enhanced validity period
            <pid>:   TP-Protocol-Identifier
            <dcs>:   SMS data coding scheme 
*/
GLOBAL T_ACI_RETURN qAT_PlusCSMP  ( T_ACI_CMD_SRC srcId,
                                    SHORT*        fo,
                                    SHORT*        vprel,
                                    T_ACI_VP_ABS* vpabs,
                                    T_ACI_VP_ENH* vpenh,
                                    SHORT*        pid,
                                    SHORT*        dcs )
{
  T_SMS_SET_PRM * pSMSSetPrm; /* points to SMS parameter set */

  TRACE_FUNCTION ("qAT_PlusCSMP ()");

  /*
   *-----------------------------------------------------------------
   * check command source
   *-----------------------------------------------------------------
   */
  if(!cmh_IsVldCmdSrc (srcId)) 
  {
    ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter );
    return( AT_FAIL );
  }

  /*
   *-----------------------------------------------------------------
   * check if command executable
   *-----------------------------------------------------------------
   */  
  if(!cmhSMS_checkSIM ()) 
    return AT_FAIL;

  pSMSSetPrm = smsShrdPrm.pSetPrm[srcId];

  /*
   *-----------------------------------------------------------------
   * fill in parameters
   *-----------------------------------------------------------------
   */  
  *fo    = pSMSSetPrm -> msgType;

  *vprel = pSMSSetPrm -> vpRel;

  if (vpabs)
    cmhSMS_setVpabsCmh ( vpabs, &pSMSSetPrm -> vpAbs );

  if (vpenh)
    cmhSMS_setVpenhCmh ( vpenh, &pSMSSetPrm -> vpEnh );
  
  *pid   = pSMSSetPrm -> pid;
  *dcs   = pSMSSetPrm -> dcs;

  return ( AT_CMPL );
}

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

  PURPOSE : This is the functional counterpart to the +CPMS? 
            AT command which returns the current settings and usage
            of the memory for writing, reading, ... of SMS.

            <mem1>: memory information, reading, deleting
            <mem2>: memory information, writing, sending
            <mem3>: memory information, storing
*/
GLOBAL T_ACI_RETURN qAT_PlusCPMS  ( T_ACI_CMD_SRC srcId )
{
  T_ACI_RETURN  ret;          /* AT response code            */

  T_ACI_AT_CMD  cmdBuf = AT_CMD_CPMS;

  TRACE_FUNCTION ("qAT_PlusCPMS ()");

  /*
   *-----------------------------------------------------------------
   * check if command executable
   *-----------------------------------------------------------------
   */
  if(!cmhSMS_checkAccess (srcId, &ret)) 
    return ret;

  if (!cmh_set_delayed_call (qAT_PlusCPMS_delayed, &qAT_PlusCPMS_buffer))
    return AT_BUSY;
  
  /*
   *-----------------------------------------------------------------
   * Fills the T_ACI_SMS_STOR_OCC structure with data from the
   * shared parameter buffer (used mem, total mem).
   *-----------------------------------------------------------------
   */
  qAT_PlusCPMS_buffer.srcId = srcId;
  cmhSMS_setStorOcc ( &qAT_PlusCPMS_buffer.m1, smsShrdPrm.mem1 );
  cmhSMS_setStorOcc ( &qAT_PlusCPMS_buffer.m2, smsShrdPrm.mem2 );
  cmhSMS_setStorOcc ( &qAT_PlusCPMS_buffer.m3, smsShrdPrm.mem3 );

#ifdef FF_ATI
  cpmsCallType = QAT_CALL;
#endif /* FF_ATI */
  TRACE_EVENT("delayed return requested: 100 ms");
  cmh_start_delayed_call (100);
  
  return( AT_EXCT );
}

/* function for delivering delayed rAT_PlusCPMS callback */
LOCAL UCHAR qAT_PlusCPMS_delayed (void* arg)
{
  struct qAT_PlusCPMS_buffer* p = (struct qAT_PlusCPMS_buffer*) arg;
  TRACE_EVENT("delayed delivery of RAT_CPMS after qAT_PlusCPMS");
  R_AT ( RAT_CPMS, p->srcId ) ( &p->m1, &p->m2, &p->m3 );
  R_AT ( RAT_OK, p->srcId ) ( AT_CMD_CPMS );
  return FALSE; /* single-shot */
}

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

  PURPOSE : This is the functional counterpart to the +CSMS?
            AT command which returns the current settings of the
            message service.

            <service>: message service
            <mt>:      mobile terminated messages
            <mo>:      mobile originated messages
            <bm>:      broadcast type messages
*/
GLOBAL T_ACI_RETURN qAT_PlusCSMS  ( T_ACI_CMD_SRC    srcId,
                                    T_ACI_CSMS_SERV *service,
                                    T_ACI_CSMS_SUPP *mt,
                                    T_ACI_CSMS_SUPP *mo,
                                    T_ACI_CSMS_SUPP *bm )
{
  TRACE_FUNCTION ("qAT_PlusCSMS ()");

  /*
   *-----------------------------------------------------------------
   * check command source
   *-----------------------------------------------------------------
   */  
  if( ! cmh_IsVldCmdSrc (srcId) ) 
  {    
    ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter );
    return ( AT_FAIL );
  }

  /*
   *-----------------------------------------------------------------
   * check if command executable
   *-----------------------------------------------------------------
   */  
  if(!cmhSMS_checkSIM ()) 
    return AT_FAIL;

  /*
   *-----------------------------------------------------------------
   * fill in parameters
   *-----------------------------------------------------------------
   */  
  *service = smsShrdPrm.CSMSservice;
  *mt      = smsShrdPrm.CSMSmt;
  *mo      = smsShrdPrm.CSMSmo;
  *bm      = smsShrdPrm.CSMSbm;

  return ( AT_CMPL );
}

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

  PURPOSE : This is the functional counterpart to the +CMGF?
            AT command which returns the current settings of the
            message format.

            <mode>: indicates the message format
*/
GLOBAL T_ACI_RETURN qAT_PlusCMGF ( T_ACI_CMD_SRC   srcId,
                                   T_ACI_CMGF_MOD* mode )
{
  T_SMS_SET_PRM * pSMSSetPrm; /* points to SMS parameter set */

  TRACE_FUNCTION ("qAT_PlusCMGF ()");


  /*
   *-----------------------------------------------------------------
   * check command source
   *-----------------------------------------------------------------
   */  
  if( ! cmh_IsVldCmdSrc (srcId) ) 
  {    
    ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter );
    return ( AT_FAIL );
  }

  pSMSSetPrm = smsShrdPrm.pSetPrm[srcId];

  /*
   *-----------------------------------------------------------------
   * fill in parameters
   *-----------------------------------------------------------------
   */  
  *mode = pSMSSetPrm -> CMGFmode;

  return ( AT_CMPL );
}

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

  PURPOSE : This is the functional counterpart to the %SMBS?
            <mode>: indicates whether presenting of both text and pdu modes is enabled
*/
#ifdef FF_MMI_RIV
GLOBAL T_ACI_RETURN qAT_PercentSMBS ( T_ACI_CMD_SRC       srcId,
                                      T_ACI_PERC_SMBS_MOD *mode )
{
  TRACE_FUNCTION ("qAT_PercentSMBS ()");

  /* check command source */  
  if( ! cmh_IsVldCmdSrc (srcId) ) 
  {    
    ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter );
    return ( AT_FAIL );
  }

  /* fill in parameters */  
  *mode = smsShrdPrm.perccmgf_smbs_mode;

  return ( AT_CMPL );
}
#endif /* #ifdef FF_MMI_RIV */

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

  PURPOSE : This is the functional counterpart to the +CSCA?
            AT command which returns the current settings of the 
            service center address.

            <sca>:   service center address
            <tosca>: type of service center address
*/
GLOBAL T_ACI_RETURN qAT_PlusCSCA ( T_ACI_CMD_SRC srcId,
                                   CHAR*         sca,
                                   T_ACI_TOA*    tosca )
{
  T_SMS_SET_PRM * pSMSSetPrm; /* points to SMS parameter set */

  TRACE_FUNCTION ("qAT_PlusCSCA ()");

  /*
   *-----------------------------------------------------------------
   * check command source
   *-----------------------------------------------------------------
   */
  if(!cmh_IsVldCmdSrc (srcId) AND (srcId NEQ OWN_SAT)) 
  {    
    ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter );
    return( AT_FAIL );
  }

  /*
   *-----------------------------------------------------------------
   * check if command executable
   *-----------------------------------------------------------------
   */  
  if(!cmhSMS_checkSIM ()) 
    return AT_FAIL;

  pSMSSetPrm = smsShrdPrm.pSetPrm[srcId];

  /*
   *-----------------------------------------------------------------
   * fill in parameters
   *-----------------------------------------------------------------
   */  
  tosca -> ton = cmhSMS_getTon ( pSMSSetPrm -> sca.ton );
  tosca -> npi = cmhSMS_getNpi ( pSMSSetPrm -> sca.npi );

  cmhSMS_getAdrStr ( sca, 
                     MAX_SMS_NUM_LEN - 1,
                     pSMSSetPrm -> sca.num,
                     pSMSSetPrm -> sca.c_num );

  return ( AT_CMPL );
}

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

  PURPOSE : This is the functional counterpart to the +CNMI?
            AT command which returns the current settings of the 
            new message indication parameter.

            <mt>: indication routing for SMS-DELIVER
            <bm>: indication routing for CBM
            <ds>: indication routing for SMS-STATUS-REPORT
*/
GLOBAL T_ACI_RETURN qAT_PlusCNMI ( T_ACI_CMD_SRC  srcId,
                                   T_ACI_CNMI_MT* mt,
                                   T_ACI_CNMI_BM* bm,
                                   T_ACI_CNMI_DS* ds)
{
  TRACE_FUNCTION ("qAT_PlusCNMI ()");


  /*
   *-----------------------------------------------------------------
   * check command source
   *-----------------------------------------------------------------
   */
  if(!cmh_IsVldCmdSrc (srcId)) 
  {    
    ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter );
    return( AT_FAIL );
  }

  /*
   *-----------------------------------------------------------------
   * check if command executable
   *-----------------------------------------------------------------
   */  
  if(!cmhSMS_checkSIM ()) 
    return AT_FAIL;

  /*
   *-----------------------------------------------------------------
   * fill in parameters
   *-----------------------------------------------------------------
   */  
  *mt = smsShrdPrm.CNMImt;
  *bm = smsShrdPrm.CNMIbm;
  *ds = smsShrdPrm.CNMIds;

  return ( AT_CMPL );
}

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

  PURPOSE : This is the functional counterpart to the +CSCB?
            AT command which returns the current selected cell
            broadcast message types.

            <mode>: acception mode 
            <mids>: message identifiers
            <dcss>: data coding schemes
*/
GLOBAL T_ACI_RETURN qAT_PlusCSCB ( T_ACI_CMD_SRC   srcId,
                                   T_ACI_CSCB_MOD* mode,
                                   USHORT*         mids,
                                   UBYTE*          dcss)
{

  TRACE_FUNCTION ("qAT_PlusCSCB ()");

  /*
   *-----------------------------------------------------------------
   * check command source
   *-----------------------------------------------------------------
   */
  if(!cmh_IsVldCmdSrc (srcId)) 
  {    
    ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter );
    return( AT_FAIL );
  }

  /*
   *-----------------------------------------------------------------
   * check if command executable
   *-----------------------------------------------------------------
   */  
  if(!cmhSMS_checkSIM ()) 
    return AT_FAIL;

  /*
   *-----------------------------------------------------------------
   * fill in parameters
   *-----------------------------------------------------------------
   */
  memcpy ( ( CHAR * ) mids, ( CHAR * ) smsShrdPrm.cbmPrm.msgId,
           sizeof ( smsShrdPrm.cbmPrm.msgId ) );

  memcpy ( ( CHAR * ) dcss, ( CHAR * ) smsShrdPrm.cbmPrm.dcsId,
           sizeof ( smsShrdPrm.cbmPrm.dcsId ) );

  if (smsShrdPrm.cbmPrm.cbmMode NEQ CBCH_IGNORE)
    *mode = CSCB_MOD_Accept;
  else
    *mode = CSCB_MOD_NotAccept;

  return ( AT_CMPL );
}


#ifdef FF_HOMEZONE
/*
+--------------------------------------------------------------------+
| PROJECT : GSM-PS (6147)         MODULE  : CMH_SMSQ                 |
| STATE   : code                  ROUTINE : qAT_PercentCBHZ          |
+--------------------------------------------------------------------+

  PURPOSE : This is the functional counterpart to the %CBHZ?
            AT command which returns the current selected homezone
            parameters.

            <mode>   : acctivation mode 
            <dcs>    : data coding scheme for homezone period
            <timeout>: timeout period for homezone CBM
*/
GLOBAL T_ACI_RETURN qAT_PercentCBHZ ( T_ACI_CMD_SRC   srcId,
                                      T_ACI_CBHZ_MOD* mode,
                                      T_ACI_CS*       dcs,
                                      UBYTE*          timeout)
{

  TRACE_FUNCTION ("qAT_PercentCBHZ()");

  /*
   *-----------------------------------------------------------------
   * check command source
   *-----------------------------------------------------------------
   */
  if(!cmh_IsVldCmdSrc (srcId)) 
  {    
    ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter );
    return( AT_FAIL );
  }

  /*
   *-----------------------------------------------------------------
   * check if command executable
   *-----------------------------------------------------------------
   */  
  if(!cmhSMS_checkSIM ()) 
    return AT_FAIL;

  /*
   *-----------------------------------------------------------------
   * fill in parameters
   *-----------------------------------------------------------------
   */
  *mode    = smsShrdPrm.cbmPrm.hzMode;
  *dcs     = smsShrdPrm.cbmPrm.hzDcs;
  *timeout = smsShrdPrm.cbmPrm.hzTimeout;  

  return ( AT_CMPL );
}

#endif /* FF_HOMEZONE */

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

  PURPOSE : This is the functional counterpart to the +CMMS? 
            AT command which returns the current mode setting.

            <mode>:    mode for +CMMS
            
*/
GLOBAL T_ACI_RETURN qAT_PlusCMMS  ( T_ACI_CMD_SRC srcId,
                                    UBYTE*        mode)
{
  

  TRACE_FUNCTION ("qAT_PlusCMMS ()");

  /*
   *-----------------------------------------------------------------
   * check command source
   *-----------------------------------------------------------------
   */
  if(!cmh_IsVldCmdSrc (srcId)) 
  {
    ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter );
    return( AT_FAIL );
  }
  
  *mode   = smsShrdPrm.CMMSmode;

  return ( AT_CMPL );
}





/*==== EOF ========================================================*/