view src/cs/services/atp/atp_uart_i.h @ 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_i.h                                           */
/*                                                                              */
/*    Purpose:           This header file contains the internal structures,     */
/*                       constants and prototypes 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.   */
/*                                                                              */
/********************************************************************************/
#ifndef _ATP_UART_I_
#define _ATP_UART_I_

#include <windows.h>
#include "atp/atp_uart_api.h"
#include "rvm/rvm_gen.h"
#include "atp/atp_messages.h"
#include "atp/atp_gsm_bt_api.h"
#include "atp/atp_gsm_gsm_api.h"


/************************************ MAILBOX ***********************************/
/*                                                                              */
/* Define the mailbox assigned to the ATP-UART interface.                       */
#define ATP_UART_MAILBOX                              (RVF_TASK_MBOX_0)

/* Define the main features of the mailbox assigned to the ATP-UART interface.  */
#define ATP_UART_ALL_EVENT_FLAGS                      (0xFFFF)
#define ATP_UART_EXPECTED_EVENT                       (RVF_TASK_MBOX_0_EVT_MASK)


/****************************** MAXIMUM PACKET SIZE *****************************/
/*                                                                              */
/* Define the maximum packet size exchanged with the AT Parser.                 */
#define ATP_UART_MAX_PACKET_SIZE                      (0x0100)


/********************************** PORT NUMBER *********************************/
/*                                                                              */
/* Define the port number dedicated to the virtual modem port opened with the   */
/* AT Parser.                                                                   */
#define ATP_UART_GSM_PORT_NB                          (0x00FF)


/*************************** CONNECTION CONTROL BLOCK ***************************/
/*                                                                              */
/* Define the default name assigned to the the COM port. Note that such a name  */
/* must be a NULL-terminated string.                                            */
#define ATP_UART_DEFAULT_COM_PORT_NAME                ("COM0")

/* Define a structure used to gather information related to the COM port as     */
/* well as the virtual modem port established with the AT Parser.               */
typedef struct
{
	T_ATP_SW_ENTITY_ID  atp_id;							/* Unique entity        */
														/* identifier assigned  */
														/* to the ATP-UART      */
														/* interface after its  */
														/* registration to the  */
														/* AT Parser.           */
	char                com_port_name[5];				/* Name associated with */
														/* the COM port.        */
	HANDLE              com_port_handle;				/* Unique handle        */
														/* assigned to the COM  */
														/* port.                */
	BOOLEAN             virtual_modem_port_established;	/* Indicate whether the */
														/* virtual modem port   */
														/* is established with  */
														/* the AT Parser.       */
	T_ATP_PORT_MODE     virtual_modem_port_mode;		/* Indicate whether the */
														/* virtual modem port   */
														/* is in 'Command' or   */
														/* 'Data' state.        */
	T_ATP_PORT_SIGNAL   control_signals;				/* RS232 control        */
														/* signals.             */
	UINT32              nb_bytes_left;					/* Number of bytes      */
														/* left.                */
	UINT8               in_buffer_p[ATP_UART_MAX_PACKET_SIZE];
} T_ATP_UART_CONN_CTRL_BLK;


/******************** GLOBAL ATP-UART INTERFACE CONTROL BLOCK *******************/
/*                                                                              */
/* Define a global structure used to gather information related to the 'Global  */
/* ATP-UART Interface Control Block', such as the address and memory bank       */
/* identifier assigned to the ATP-UART interface.                               */
typedef struct
{
	T_ATP_UART_CONN_CTRL_BLK  conn_ctrl_blk;
	T_RVF_MB_ID               mb_id;			/* 'Memory Bank' identifier     */
												/* assigned to the ATP-UART     */
												/* interface.                   */
	T_RVF_ADDR_ID             addr_id;			/* Unique address identifier    */
												/* assigned to the ATP-UART     */
												/* interface.                   */
	T_RVM_CB_FUNC             error_function_p;	/* Function to be called        */
												/* whenever any unrecoverable   */
												/* error occurs.                */
} T_ATP_UART_CTRL_BLK;

/* Define a pointer to the 'Global ATP-UART Interface Control Block'.           */
extern T_ATP_UART_CTRL_BLK  *gbl_atp_uart_ctrl_blk_p;


/****************************** UNRECOVERABLE ERROR *****************************/
/*                                                                              */
/* Define a macro used to call the function due to an unrecoverable error.      */
/*                                                                              */
/* Prototype:                                                                   */
/*   ATP_UART_UNRECOVERABLE_ERROR (T_RVM_RETURN  error_cause,                   */
/*                                 T_RVM_STRING  error_message);                */
#define ATP_UART_UNRECOVERABLE_ERROR(error_cause, \
									 error_message) \
		{ \
			(gbl_atp_uart_ctrl_blk_p->error_function_p) (ATP_UART_NAME, \
														 (error_cause), \
														 0x00000000, \
														 (error_message)); \
		}


/*************************** LOCAL FUNCTION PROTOTYPES **************************/
/*                                                                              */
/* Define the local fonction prototypes.                                        */
T_ATP_UART_ERROR_CODES atp_uart_create_com_port (T_ATP_UART_COM_PORT   com_port,
												 T_ATP_UART_BAUD_RATE  baud_rate);

T_ATP_UART_ERROR_CODES atp_uart_write_com_port (UINT8   *data_buffer_p,
												UINT32  data_size);

T_ATP_UART_ERROR_CODES atp_uart_read_com_port (UINT8   *data_buffer_p,
											   UINT32  *data_size_p);

T_ATP_UART_ERROR_CODES atp_uart_remove_com_port (void);

/********************************************************************************/

T_ATP_UART_ERROR_CODES atp_uart_handle_msg (void);

#endif