view src/g23m-aci/aci/ati_omcompat.c @ 303:f76436d19a7a default tip

!GPRS config: fix long-standing AT+COPS chance hanging bug There has been a long-standing bug in FreeCalypso going back years: sometimes in the AT command bring-up sequence of an ACI-only MS, the AT+COPS command would produce only a power scan followed by cessation of protocol stack activity (only L1 ADC traces), instead of the expected network search sequence. This behaviour was seen in different FC firmware versions going back to Citrine, and seemed to follow some law of chance, not reliably repeatable. This bug has been tracked down and found to be specific to !GPRS configuration, stemming from our TCS2/TCS3 hybrid and reconstruction of !GPRS support that was bitrotten in TCS3.2/LoCosto version. ACI module psa_mms.c, needed only for !GPRS, was missing in the TCS3 version and had to be pulled from TCS2 - but as it turns out, there is a new field in the MMR_REG_REQ primitive that needs to be set correctly, and that psa_mms.c module is the place where this initialization needed to be added.
author Mychaela Falconia <falcon@freecalypso.org>
date Thu, 08 Jun 2023 08:23:37 +0000
parents fa8dc04885d8
children
line wrap: on
line source

/*
 * This module implements those AT commands that were originally invented
 * by Openmoko and have been retained in FreeCalypso.
 */

#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"

EXTERN void alr_get_band_of_serving_cell (char *strbuf);

/*
 * 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);
}

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

GLOBAL T_ATI_RSLT atAtBAND (char *cl, UBYTE srcId)
{
	TRACE_FUNCTION("atAtBAND");			
	alr_get_band_of_serving_cell(g_sa);
	io_sendMessage(srcId, g_sa, ATI_NORMAL_OUTPUT);

	return (ATI_CMPL);
}

#endif /* ATI_OMCOMPAT_C */