view src/cs/riviera/rvf/rvf_target.h @ 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 4e78acac3d88
children
line wrap: on
line source

/****************************************************************************/
/*                                                                          */
/*  Name        rvf_target.h                                                */
/*                                                                          */
/*  Function    this file contains definitions that will probably			*/
/*              change for each target system. This includes				*/
/*              such things number of tasks,			                    */
/*              little endian/big endian conversions, etc...				*/
/*																			*/
/*                                                                          */
/*	NOTE        This file should always be included first.					*/
/*																			*/
/*  Version		0.1															*/
/*																			*/
/* 	Date       	Modification												*/
/*  ------------------------------------									*/
/*  4/19/1999	Create														*/
/*  10/27/1999  remove declaration of ntohs, htons, ntohl, htonl			*/
/*				in order to avoid conflict with winsock.h					*/
/*  12/23/1999	add buffer and memory bank related definition				*/
/*  07/12/2000	implement dynamic memory allocation.						*/
/*  01/16/2004  Corrected conversion from seconds/milliseconds to ticks.    */
/*																			*/
/*	Author		David Lamy-Charrier (dlamy@tif.ti.com)						*/
/*																			*/
/* (C) Copyright 1999 by Texas Instruments Incorporated, All Rights Reserved*/
/****************************************************************************/
#ifndef _RVF_TARGET_H
#define _RVF_TARGET_H

#ifndef _WINDOWS
	#include "config/rv.cfg"
	#include "config/swconfig.cfg"
#endif


/* optimizations */
#ifdef _WINDOWS
	#define INLINE __inline
#else
	#define INLINE inline
#endif


/*----------------------------------------------------------------------*/
/*                      RVF Definitions                                 */
/*----------------------------------------------------------------------*/


/* the maximum number of memory bank created by users */
#if (!GSMLITE)
#define RVF_MAX_TOTAL_MB			70
#else // GSMLITE
  #define RVF_MAX_TOTAL_MB			20
#endif // GSMLITE

/* the maximum number of real memory bank managed */
#if (!GSMLITE)
#define RVF_MAX_REAL_MB				60
#else // GSMLITE
  #define RVF_MAX_REAL_MB			20
#endif // GSMLITE

/* max length of memory bank name */
#define RVF_MAX_MB_LEN				10

/* max length of task name */
#define RVF_MAX_TASK_LEN			10


/* RVF_MB_MAPPING defines the correspondance between mb_name and mb_id */
/* WARNING!!!! When adding new memory banks in this default list, take care */
/* to always finish with the {0,0} !!! */
#if (!GSMLITE)
#define RVF_MB_MAPPING {{ "RVM_PRIM", 0},{ "TEST1", 1}, { "TEST2", 2},\
	{ "TEST3", 3}, { "TEST4", 3},\
	{"HCI_RX", 4},{"HCI_TX", 5},\
	{"ATP_PRIM",27},{"ATP_UART",27},\
	{"RV_TRACE", TRACE_MB_ID},\
	{"UWIRE_PRIM",37},{0,0}}
#else // GSMLITE
  #define RVF_MB_MAPPING {{ "RVM_PRIM", 0},{ "TEST1", 1}, { "TEST2", 2},\
						  { "TEST3", 3}, { "TEST4", 3}, {0,0}}
#endif // GSMLITE

/* set the following variable to 1 to check for buffer corruption*/
#define RVF_ENABLE_BUF_CORRUPTION_CHECK	1

/* set the following variable to 1 to check for buffer linkage*/
#define RVF_ENABLE_BUF_LINKAGE_CHECK	1

/* enable or disable memory statistics functions */
#define RVF_ENABLE_STATS				1	


/* The maximum number of RVF tasks allowed in the system*/
#if (!GSMLITE)
#define MAX_RVF_TASKS	            30
#else // GSMLITE
  #define MAX_RVF_TASKS	            11
#endif // GSMLITE

/* max number of callback functions for buffers waiting to be counted on another memory bank */
#if (!GSMLITE)
#define RVF_MAX_WAITING_BUF		300 
#else // GSMLITE
  #define RVF_MAX_WAITING_BUF		 20 
#endif // GSMLITE
/* sum of RVF_BUFi_MAX */







/***********************************************************************
** Timer related definitions. These should be edited per system. The
** macros should convert milliseconds and seconds to system ticks.
** Applications should use these to calculate the number of ticks to
** sleep for.
*/

#ifdef _WINDOWS
#define RVF_MS_TO_TICKS(_x)   ((_x) / 50)
#define RVF_SECS_TO_TICKS(_x) (((_x) * 1000) / 50)
#define RVF_TICKS_TO_MS(_x)   ((_x) * 50)
#else
#if 1	/* new FreeCalypso code */
/*
 * In the present GSM firmware, the Nucleus tick is the TDMA frame,
 * and the duration of one TDMA frame by definition equals 60/13 ms.
 * Hence we use the natural factors of 13 and 60 instead of TI's
 * 200 and 923 (computed to fit the rounded 4.615 ms value),
 * and get not only better accuracy, but also a greater maximum
 * time value: 330382 s (just under 4 days) instead of the old maximum
 * of 21474 s (just under 6 h).
 */
#define RVF_MS_TO_TICKS(_x)   ((((_x) * 13) + 30) / 60) 
#define RVF_SECS_TO_TICKS(_x) ((((_x) * 13000) + 30) / 60)
/* RVF_TICKS_TO_MS() macro was unused and is being removed */
#else	/* old code from TI */
/*
 * To avoid floating point computation, the tick duration 4.615 ms can be
 * resolved to the fraction : 923/200.
 *
 * Due to the multiplication with 200, the maximum usable value for
 * milliseconds is 2^32 / 200 = 21,474,836. The maximum usable value
 * for seconds is 2^32 / (200 * 1000) = 21,474.
 * Both values correspond approximately to 5h 57m 54s.
 */
#define RVF_MS_TO_TICKS(_x)   ((((_x) * 200) + 462) / 923) 
#define RVF_SECS_TO_TICKS(_x) ((((_x) * 1000 * 200) + 462) / 923)
#define RVF_TICKS_TO_MS(_x)   ((((_x) * 923) + 100) / 200)
#endif
#endif

#endif /* _RVF_TARGET_H */