view src/aci2/aci/ati_omcompat.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 1badec9097de
children
line wrap: on
line source

/*
 * This module has been added to the Leonardo GSM firmware source by
 * Spacefalcon the Outlaw.  It contains the implementation of the AT@
 * commands which were invented by Openmoko.  The addition of this code
 * to the present leo2moko source tree allows our fw to serve as a
 * compatible and fully functional replacement for the closed original
 * mokoN firmware.
 */

#ifndef ATI_OMCOMPAT_C
#define ATI_OMCOMPAT_C

#include "aci_all.h"

#include <ctype.h>
#include <string.h>

#include "aci_cmh.h"
#include "ati_cmd.h"
#include "aci_cmd.h"
#include "aci_io.h"
#include "aci_cmd.h"
#include "l4_tim.h"
#include "line_edit.h"
#include "aci_lst.h"

#include "pcm.h"
#include "audio.h"
#include "aci.h"
#include "rx.h"
#include "pwr.h"
#include "l4_tim.h"

#ifdef GPRS
#ifdef DTI
#include "dti.h"
#include "dti_conn_mng.h"
#include "dti_cntrl_mng.h"
#endif /* DTI */
#include "gaci.h"
#include "gaci_cmh.h"
#include "gaci_cmd.h"
#endif  /* GPRS */

#include "aci_mem.h"
#include "aci_prs.h"

#include "ati_int.h"

#ifndef _SIMULATION_
#include "ffs/ffs.h"
#endif

#ifdef FF_ATI_BAT

#include "typedefs.h"
#include "gdd.h"
#include "bat.h"

#include "ati_bat.h"

#endif /*FF_ATI_BAT*/

#include "audio/audio_api.h"
#include "abb.h"
#include "dar/dar_api.h"

#ifdef GPRS
#include "p_mph.h"
#include "p_mphc.h"
#include "../alr/alr_gprs.h"
#endif
#include "p_tb.h"
#include "../alr/alr.h"

/*
 * PURPOSE : @ST command (Configure the sidetone level)
 */
GLOBAL T_ATI_RSLT atAtST (char *cl, UBYTE srcId)
{
	char tmp[8]={0};
	INT8 gain = -26;
	TRACE_FUNCTION("atAtST()");

	/*
	 * input functionality
	 */
	cl = parse(cl,"s", (LONG)8, tmp);

	gain = atoi(tmp);

	if ( cl )
	{
		if ( gain == -23 || gain == -20 || gain == -17 || gain == -14 || gain == -11 || gain == -8 || gain == -5 || gain == -2 || gain == 1 || gain == -26 )
		{
			Side_Tone_Write(gain);
			return (ATI_CMPL);
		}
		else
		{
			cmdCmsError(CMS_ERR_OpNotAllowed);
			return (ATI_FAIL);
		}
	}
}

GLOBAL T_ATI_RSLT queatAtST (char *cl, UBYTE srcId)
{
	char *me="+ST: ";
	INT8 ST1;

	TRACE_FUNCTION("queatAtST()");

	ST1 = Side_Tone_Read();

	sprintf(g_sa,"%s%d",me,ST1);

	io_sendMessage(srcId, g_sa, ATI_NORMAL_OUTPUT);

	return (ATI_CMPL);
}

/*
 * PURPOSE : @POFF command (Power Off GSM Modem)
 */
 
GLOBAL T_ATI_RSLT atAtPOFF (char *cl, UBYTE srcId)
{
	TRACE_FUNCTION("atAtPOFF");

	sprintf(g_sa,"%s","OK");
	io_sendMessage(srcId, g_sa, ATI_NORMAL_OUTPUT);

	ABB_Power_Off();

	return (ATI_CMPL);
}

/*
 * PURPOSE : @RST command (Reset GSM Modem)
 */
 
GLOBAL T_ATI_RSLT atAtRST (char *cl, UBYTE srcId)
{
	TRACE_FUNCTION("atAtRST");

	dar_reset_system();

	return (ATI_CMPL);
}

/*
 * Openmoko's firmware contains an undocumented AT@SC command that
 * sets/changes the IMEI of the modem.  However, it takes the IMEI
 * input in an obfuscated form, and the logic is broken - hence
 * we are NOT reimplementing this bogon in FreeCalypso.
 *
 * If you feel like changing your modem's IMEI, you can do it
 * through the RVTMUX interface with our fc-fsio utility's
 * set-imeisv command.
 */

/*
 * PURPOSE : @BAND command (Get RF band)
 */

GLOBAL T_ATI_RSLT atAtBAND (char *cl, UBYTE srcId)
{		
    char szDummy[32]; // to produce the exact same assembler code
    char szBand[32];    
    UBYTE band_sc = get_band (alr_data->serving_cell); // to produce the exact same assembler code

	TRACE_FUNCTION("atAtBAND");			
	band_sc = alr_data->sc_band;
    switch(band_sc)
    {
    case BAND_GSM_900:
      strcpy(szBand, "GSM 900");
      break;
    case BAND_DCS_1800:
      strcpy(szBand, "DCS 1800");
      break;
    case BAND_PCS_1900:
      strcpy(szBand, "PCS 1900");
      break;
    case BAND_E_GSM:
      strcpy(szBand, "EGSM");
      break;
    case BAND_GSM_850:
      strcpy(szBand, "GSM 850");
      break;
    default:
      strcpy(szBand, "Unknown");
      break;
    }
	sprintf(g_sa,"%s", szBand);  		
	io_sendMessage(srcId, g_sa, ATI_NORMAL_OUTPUT);
		
	return (ATI_CMPL);	
}

#endif /* ATI_OMCOMPAT_C */