view src/aci2/aci/cmh_raf.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 93999a60b835
children
line wrap: on
line source

/* 
+----------------------------------------------------------------------------- 
|  Project :  GSM-PS (6147)
|  Modul   :  CMH_RAF
+----------------------------------------------------------------------------- 
|  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 used by the command
|             handler for RA.
+----------------------------------------------------------------------------- 
*/ 
#ifdef DTI
#ifndef CMH_RAF_C
#define CMH_RAF_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 "aci_io.h"
#include "psa_ra.h"
#include "psa_cc.h"
#include "cmh.h"
#include "cmh_ra.h"
#include "cmh_cc.h"

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

/*==== TYPES ======================================================*/

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

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

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



/*
+-------------------------------------------------------------------+
| PROJECT : GSM-PS (6147)         MODULE  : CMH_RA                  |
|                                 ROUTINE : cmhRA_SelTrfProt        |
+-------------------------------------------------------------------+

  PURPOSE : select transfer protocol 

*/

GLOBAL UBYTE cmhRA_SelTrfProt( SHORT cId )
{
  switch( cmhCC_getcalltype(cId) )
  {
    case( TRANS_CALL ):
      return( RA_MODEL_TRANS );

    case( NON_TRANS_CALL ):
      return( RA_MODEL_RLP );
      
    case( FAX_CALL   ): 
      return( RA_MODEL_FAX   );
#ifdef CO_UDP_IP
    /* a WAP call should be a non-transparent call for RA */
    case( UDPIP_CALL ):
      return( RA_MODEL_RLP );
#endif
#ifdef FF_TCP_IP
    case( PPP_CALL ):
      return( RA_MODEL_RLP );
#endif
#if defined(FF_GPF_TCPIP)
    case TCPIP_CALL:
      return RA_MODEL_RLP ;
        
#endif /* FF_GPF_TCPIP */
    default: 
      TRACE_EVENT( "UNEXP TYPE OF CALL IN CTB" );
      return( NOT_PRESENT_8BIT );
  }
}

/*
+-------------------------------------------------------------------+
| PROJECT : GSM-PS (6147)         MODULE  : CMH_RA                  |
|                                 ROUTINE : cmhRA_SelChnRate        |
+-------------------------------------------------------------------+

  PURPOSE : select channel rate  

*/

GLOBAL UBYTE cmhRA_SelChnRate ( void )
{
  switch( ccShrdPrm.chType )
  {
    case( CH_TCH_F ):
      switch( ccShrdPrm.chMod )
      {
      case( CHM_DATA_14_4  ): return( TRA_FULLRATE_14400 ); 
      case( CHM_DATA_9_6   ): return( TRA_FULLRATE_9600 );
      case( CHM_DATA_4_8   ): return( TRA_FULLRATE_4800 );
      case( CHM_DATA_2_4   ): return( TRA_FULLRATE_2400 );
      default:                TRACE_EVENT( "UNEXP CHN MODE IN CTB" );
                              return( -1 );
      }

    case( CH_TCH_H ):
      switch( ccShrdPrm.chMod )
      {
      case( CHM_DATA_2_4   ): return( TRA_HALFRATE_2400 );
      case( CHM_DATA_4_8   ): return( TRA_HALFRATE_4800 );
      case( CHM_DATA_14_4  ):
      case( CHM_DATA_9_6   ):
      default:                TRACE_EVENT( "UNEXP CHN MODE IN CTB" );
                              return( -1 );
      }

    default:                  TRACE_EVENT( "UNEXP CHN TYPE IN CTB" );
                              return( -1 );
  }
}

/*
+-------------------------------------------------------------------+
| PROJECT : GSM-PS (6147)         MODULE  : CMH_RA                  |
|                                 ROUTINE : cmhRA_SelChnRate        |
+-------------------------------------------------------------------+

  PURPOSE : select channel rate  

*/

GLOBAL UBYTE cmhRA_SelUsrRate( SHORT cId )
{
  if (ccShrdPrm.ctb[cId] EQ NULL)
    return NOT_PRESENT_8BIT;

  switch (psaCC_ctb(cId)->BC[psaCC_ctb(cId)->curBC].rate)
  {
    case( UR_0_3_KBIT     ): return( URA_300     );
    case( UR_1_2_KBIT     ): return( URA_1200    );
    case( UR_2_4_KBIT     ): return( URA_2400    );
    case( UR_4_8_KBIT     ): return( URA_4800    );
    case( UR_9_6_KBIT     ): return( URA_9600    );
    case( UR_1_2_KBIT_V23 ): return( URA_1200_75 );
    case( UR_12_0_KBIT_TRANS): return( URA_14400   );
    case( 8               ): return( URA_14400   ); /* !!! change if SAP is updated */
    default:                 TRACE_EVENT( "UNEXP USER RATE IN CTB" );
                             return( NOT_PRESENT_8BIT );
  }
}

/*
+-------------------------------------------------------------------+
| PROJECT : GSM-PS (6147)         MODULE  : CMH_RA                  |
|                                 ROUTINE : cmhRA_SelDataBits       |
+-------------------------------------------------------------------+

  PURPOSE : select number of data bits

*/

GLOBAL UBYTE cmhRA_SelDataBits( SHORT cId )
{
  if (ccShrdPrm.ctb[cId] EQ NULL)
    return NOT_PRESENT_8BIT;

  switch (psaCC_ctb(cId)->BC[psaCC_ctb(cId)->curBC].data_bits)
  {
    case( DATA_7_BIT ): return( 7 );
    case( DATA_8_BIT ): return( 8 );
    default:            TRACE_EVENT( "UNEXP NR OF DATA BITS IN CTB" );
                        return( NOT_PRESENT_8BIT );
  }
}

/*
+-------------------------------------------------------------------+
| PROJECT : GSM-PS (6147)         MODULE  : CMH_RA                  |
|                                 ROUTINE : cmhRA_SelStopBits       |
+-------------------------------------------------------------------+

  PURPOSE : select number of stop bits

*/

GLOBAL UBYTE cmhRA_SelStopBits( SHORT cId ) 
{
  if (ccShrdPrm.ctb[cId] EQ NULL)
    return NOT_PRESENT_8BIT;

  switch (psaCC_ctb(cId)->BC[psaCC_ctb(cId)->curBC].stop_bits)
  {
    case( STOP_1_BIT ): return( 1 );
    case( STOP_2_BIT ): return( 2 );
    default:            TRACE_EVENT( "UNEXP NR OF STOP BITS IN CTB" );
                        return( NOT_PRESENT_8BIT );
  }
}

#ifdef FF_FAX

/*
+-------------------------------------------------------------------+
| PROJECT : GSM-PS (6147)         MODULE  : CMH_RA                  |
|                                 ROUTINE : cmhRA_SelBitOrder       |
+-------------------------------------------------------------------+

  PURPOSE : select bit order

*/

GLOBAL UBYTE cmhRA_SelBitOrder( T_ACI_CMD_SRC srcId ) 
{
  switch( fnd_cmhPrm[srcId].t30CmdPrm.FBOval )
  {
    case( FBO_VAL_DirCDirBD ): return( FBO_NRM_STATUS + FBO_NRM_DATA );
    case( FBO_VAL_RvrCDirBD ): return( FBO_NRM_STATUS + FBO_REV_DATA );
    case( FBO_VAL_DirCRvrBD ): return( FBO_REV_STATUS + FBO_NRM_DATA );
    case( FBO_VAL_RvrCRvrBD ): return( FBO_REV_STATUS + FBO_REV_DATA );
    default:            TRACE_EVENT( "UNEXP FBO VALUE" );
                        return( NOT_PRESENT_8BIT );
  }
}

#endif /* FF_FAX */
#endif /* DTI */
/*==== EOF ========================================================*/