view src/cs/services/atp/atp_uart_api.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 945cf7f506b2
children
line wrap: on
line source

/********************************************************************************/
/*                                                                              */
/*    File Name:         atp_uart_api.c                                         */
/*                                                                              */
/*    Purpose:           This file contains the external functions related to   */
/*                       the ATP-UART interface.                                */
/*                                                                              */
/*    Note:              None.                                                  */
/*                                                                              */
/*    Revision History:                                                         */
/*       10/04/01        Pascal Pompei                                          */
/*                          - Create.                                           */
/*                                                                              */
/* (C) Copyright 2001 by Texas Instruments Incorporated, All Rights Reserved.   */
/*                                                                              */
/********************************************************************************/
#include "atp/atp_uart_i.h"
#include "rvm/rvm_use_id_list.h"


/********************************************************************************/
/*                                                                              */
/*    Function Name:     atp_uart_open_com_port                                 */
/*                                                                              */
/*    Purpose:           This function instructs the ATP-UART interface to open */
/*                       the COM port.                                          */
/*                                                                              */
/*    Input Parameters:                                                         */
/*       com_port           - Contains the COM port number.                     */
/*       baud_rate          - Contains the baud rate (in bits per second).      */
/*                                                                              */
/*    Output Parameters: None.                                                  */
/*                                                                              */
/*    Global Parameters: None.                                                  */
/*                                                                              */
/*    Note:              None.                                                  */
/*                                                                              */
/*    Revision History:                                                         */
/*       10/04/01        Pascal Pompei                                          */
/*                          - Create.                                           */
/*                                                                              */
/********************************************************************************/
T_ATP_UART_ERROR_CODES atp_uart_open_com_port (T_ATP_UART_COM_PORT   com_port,
											   T_ATP_UART_BAUD_RATE  baud_rate)
{
    /* Declare a local variable.                                                */
	T_ATP_UART_OPEN_COM_PORT  *open_com_port_p = NULL;

/******************** atp_uart_open_com_port function begins ********************/

	/* Allocate memory required to instruct the ATP-UART interface to open the  */
	/* COM port. If insufficient resources, then report an internal memory      */
	/* error and abort.                                                         */
	if (rvf_get_buf (gbl_atp_uart_ctrl_blk_p->mb_id, \
					 sizeof (T_ATP_UART_OPEN_COM_PORT), \
					 (T_RVF_BUFFER **) (&open_com_port_p)) == RVF_RED)
	{
		rvf_send_trace ("  ATP-UART (api). Insufficient resources ",
						41,
						NULL_PARAM,
						RV_TRACE_LEVEL_WARNING,
						ATP_USE_ID);
		return (RV_MEMORY_ERR);
	}

	/* Fill the 'ATP-UART Open COM Port' header up.                             */
	(open_com_port_p->os_header).msg_id        = ATP_UART_OPEN_COM_PORT;
	(open_com_port_p->os_header).src_addr_id   = RVF_INVALID_ADDR_ID;
	(open_com_port_p->os_header).callback_func = NULL;

	/* Fill the 'ATP-UART Open COM Port' payload up.                            */
	open_com_port_p->com_port  = com_port;
	open_com_port_p->baud_rate = baud_rate;

	/* Send the 'ATP-UART Open COM Port' notification to the ATP-UART           */
	/* interface.                                                               */
	return (rvf_send_msg (gbl_atp_uart_ctrl_blk_p->addr_id, \
						  open_com_port_p));

} /******************* End of atp_uart_open_com_port function *******************/


/********************************************************************************/
/*                                                                              */
/*    Function Name:     atp_uart_start_gsm                                     */
/*                                                                              */
/*    Purpose:           This function instructs the ATP-UART interface to      */
/*                       initiate using the GSM protocol stack.                 */
/*                                                                              */
/*    Input Parameters:  None.                                                  */
/*                                                                              */
/*    Output Parameters: None.                                                  */
/*                                                                              */
/*    Global Parameters: None.                                                  */
/*                                                                              */
/*    Note:              The GSM protocol stack is initialized by invoking the  */
/*                       following AT commands:                                 */
/*                          AT+CFUN=1 : Set Phone Functionality (Full),         */
/*                          AT+COPS=0 : Operator Selection.                     */
/*                                                                              */
/*    Revision History:                                                         */
/*       09/26/02        Pascal Pompei                                          */
/*                          - Create.                                           */
/*                                                                              */
/********************************************************************************/
T_ATP_UART_ERROR_CODES atp_uart_start_gsm (void)
{
    /* Declare a local variable.                                                */
	T_ATP_UART_START_GSM  *start_gsm_p = NULL;

/********************** atp_uart_start_gsm function begins **********************/

	/* Allocate memory required to instruct the ATP-UART interface to initiate  */
	/* using the GSM protocol stack. If insufficient resources, then report an  */
	/* internal memory error and abort.                                         */
	if (rvf_get_buf (gbl_atp_uart_ctrl_blk_p->mb_id, \
					 sizeof (T_ATP_UART_START_GSM), \
					 (T_RVF_BUFFER **) (&start_gsm_p)) == RVF_RED)
	{
		rvf_send_trace ("  ATP-UART (api). Insufficient resources ",
						41,
						NULL_PARAM,
						RV_TRACE_LEVEL_WARNING,
						ATP_USE_ID);
		return (RV_MEMORY_ERR);
	}

	/* Fill the 'ATP-UART Start GSM' header up.                                 */
	(start_gsm_p->os_header).msg_id        = ATP_UART_START_GSM;
	(start_gsm_p->os_header).src_addr_id   = RVF_INVALID_ADDR_ID;
	(start_gsm_p->os_header).callback_func = NULL;

	/* Send the 'ATP-UART Start GSM' notification to the ATP-UART interface.    */
	return (rvf_send_msg (gbl_atp_uart_ctrl_blk_p->addr_id, \
						  start_gsm_p));

} /********************* End of atp_uart_start_gsm function *********************/