view src/aci2/alr/alr_csf.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 5e39123540e6
children
line wrap: on
line source

/*
+-----------------------------------------------------------------------------
|  Project :  GSM-PS
|  Modul   :  alr_CSF
+-----------------------------------------------------------------------------
|  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 Modul defines the customer specific functions.
+-----------------------------------------------------------------------------
*/

#ifndef ALR_CSF_C
#define ALR_CSF_C

#define ENTITY_PL

/*==== INCLUDES ===================================================*/
#include <string.h>
#include <stdlib.h>
#include <ctype.h>
#include "typedefs.h"
#include "pconst.cdg"
#include "mconst.cdg"
#include "message.h"
#include "ccdapi.h"
#include "vsi.h"
#include "custom.h"
#include "gsm.h"
#include "prim.h"
#include "cnf_alr.h"
#include "mon_alr.h"
#include "pei.h"
#include "tok.h"

#include "pcm.h"
#ifdef GPRS
#include "alr_gprs.h"
#endif

#ifdef _TMS470
#include "inth/iq.h"
#include "armio/armio.h"
#endif  /* _TMS470 */

#include "alr.h"


/*==== IMPORT =====================================================*/

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

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

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

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

/*
+--------------------------------------------------------------------+
| PROJECT : GSM-PS (8403)       MODULE  : alr_CSF                    |
| STATE   : code                ROUTINE : csf_show_version           |
+--------------------------------------------------------------------+

  PURPOSE : Trace Layer 1 DSP version numbers

*/

GLOBAL const void csf_show_version (T_TST_TEST_HW_CON  *ver)
{
#if defined (_TMS470)
  USHORT build, hw, jtag, rev;

  /*
   * Retrieve hardware info and build from library
   */
  hw = 0;

  build = IQ_GetBuild();
  jtag  = IQ_GetJtagId();
  rev   = IQ_GetRevision();

  TRACE_EVENT_P4 ("Build=%04d HW ver=%04X, jtag=%04X, rev=%04X", build, hw, jtag, rev);

  if (ver)
  {
    /*
     * Retrieve Layer 1 info from primitive
     */
    TRACE_EVENT_P3 ("DSP version/patch=%04X, %04x, chksum=%04X",
                    ver->dsp_code_version,
                    ver->dsp_patch_version,
                    ver->dsp_checksum);
    TRACE_EVENT_P3 ("MCU version ALR=%04X, GPRS=%04X, TM=%04X",
                    ver->mcu_alr_version,
                    ver->mcu_gprs_version,
                    ver->mcu_tm_version);
    PFREE (ver);
  }
#else  /* _TMS470  */
  if (ver)
  {
    PFREE (ver);
  }
#endif  /* _TMS470 */
}

#if !defined NTRACE
/*
 * The following monitor capabilities are used by the Condat RT system.
 * They are only included in the trace version of protocol stack.
/*
+--------------------------------------------------------------------+
| PROJECT : GSM-PS (6147)       MODULE  : alr_CSF                    |
| STATE   : code                ROUTINE : trc_mon_counter_idle       |
+--------------------------------------------------------------------+

  PURPOSE : traces the downlink counter values in idle mode if a change
            occur.

*/

UBYTE v_mon_counter_idle = 0;

GLOBAL void trc_mon_counter_idle (UBYTE act_dlt, UBYTE max_dlt)
{
  if (v_mon_counter_idle)
  {
    /*
     * only if monitoring is enabled
     */
    PALLOC (mon_counter_idle, MON_COUNTER_IDLE_IND);

    mon_counter_idle->act_dlt = act_dlt;
    mon_counter_idle->max_dlt = max_dlt;

    PSENDX(RR, mon_counter_idle);
  }
}

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

  PURPOSE : traces the radiolink counter values in dedicated mode
            if a change occur.

*/

UBYTE v_mon_counter_dedi = 0;

GLOBAL void trc_mon_counter_dedi (UBYTE act_rlt, UBYTE max_rlt)
{
  if (v_mon_counter_dedi)
  {
    /*
     * only if monitoring is enabled
     */
    PALLOC (mon_counter_dedi, MON_COUNTER_DEDI_IND);

    mon_counter_dedi->act_rlt = act_rlt;
    mon_counter_dedi->max_rlt = max_rlt;

    PSENDX(RR, mon_counter_dedi);
  }
}

#endif /* !NTRACE */

/*
 * Function added in FreeCalypso to support Openmoko's AT@BAND command
 * without making ACI include ALR header files.
 */

GLOBAL void alr_get_band_of_serving_cell (char *strbuf)
{
    switch(alr_data->sc_band)
    {
    case BAND_GSM_900:
      strcpy(strbuf, "GSM 900");
      break;
    case BAND_DCS_1800:
      strcpy(strbuf, "DCS 1800");
      break;
    case BAND_PCS_1900:
      strcpy(strbuf, "PCS 1900");
      break;
    case BAND_E_GSM:
      strcpy(strbuf, "EGSM");
      break;
    case BAND_GSM_850:
      strcpy(strbuf, "GSM 850");
      break;
    default:
      strcpy(strbuf, "Unknown");
    }
}

#endif