view src/aci2/atb/ATBPb_i.h @ 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 93999a60b835
children
line wrap: on
line source

/**********************************************
 * T_PB_COMMAND
 *
 * Command ID of executing function
 *
 **********************************************/

typedef enum
{
	PB_INITIALISE,
	PB_READREC,
	PB_WRITEREC,
	PB_DELETEREC,
	PB_FIND,
	PB_READRECLIST,
	PB_SEARCH
}
T_PB_COMMAND;


/**********************************************
 * T_PB_STATUS
 *
 * Status of executing function
 *
 **********************************************/
 
typedef enum
{
	PB_STATUS_NONE,
	PB_STATUS_INIT,
	PB_STATUS_EXEC,
	PB_STATUS_COMPLETE
} T_PB_STATUS;

typedef struct
{
	T_PB_TYPE	type;			/* The type of phonebook */
	SHORT			records_max;	/* The maximum no. of records that can be stored */
	SHORT			phys_index;
	T_PB_RECORD *record;			/* Currently read record */
	UBYTE		first_record;	/* Flag that is true when the first record is being read */
}
T_PB_INITIALISE;

typedef struct
{
	SHORT log_index;
	T_PB_TYPE index_type;
	SHORT phys_index;
	T_PB_RECORD *record;
}
T_PB_WRITEREC;

typedef struct
{
	SHORT log_index;
	T_PB_TYPE index_type;
	SHORT phys_index;
}
T_PB_DELETEREC;

typedef union
{
	T_PB_INITIALISE	Initialise;
	T_PB_WRITEREC	WriteRec;
	T_PB_DELETEREC	DeleteRec;
}
T_PB_PARAM;

/**************************************************
 * T_PB_DATA
 *
 * Data structure to keep track of phonebook entries
 * and index tables.
 *
**************************************************/
 
typedef struct
{
	T_PB_TYPE		current_type;	/* Currently selected phonebook */
	SHORT 			records_max;	/* Total number of records available */
	SHORT 			records_used;	/* Number of records that are in use */
	SHORT			search_results;	/* Number of results for last search */
	
	SHORT			alpha_max;		/* Max size of alpha tag in bytes */
	SHORT			number_max;		/* Max size of phone number in bytes */
	SHORT			ext_max;		/* Max size of extended data in bytes */
	
	SHORT* 			name_table;		/* Index table, sorted by name.  Dynamically updated. */
	SHORT*			number_table;	/* Index table, sorted by phone number. Dynamically updated. */
	SHORT*			search_table;	/* Search table, contains matching elements.  Sorted by whichever field is searched.
									   Not dynamically updated.  */

	SHORT*			in_memory;		/* -1 if the record does not exist
									 * 0 if the record is not in RAM
									 * >0 - number of times record has been read */
	SHORT			cache_max;		/* Maximum number of records that can be stored in memory concurrently*/
	SHORT			cache_size;		/* Current size of the cache */
	T_PB_RECORD**	cache;			/* List of entries in cache */
	
	T_PB_COMMAND	command_id;		/* Currently processing command */
	T_PB_STATUS		status;			/* Status of current command */
	T_PB_PARAM		param;			/* Parameter storage for current command */
}
T_PB_DATA;


/* FUNCTION PROTOTYPES */
T_PB_DATA*		ATB_hnd_GetPbData(SHORT phonebook_id);
void			ATB_hnd_SetPbData(SHORT phonebook_id, T_PB_DATA *data);
PB_RET			ATB_status_Initialise(SHORT phonebook_id);
PB_RET			ATB_status_WriteRec(SHORT phonebook_id);
PB_RET			ATB_status_DeleteRec(SHORT phonebook_id);

PB_RET			ATB_index_Find (SHORT phonebook_id, T_PB_INDEX index_type, T_PB_RECORD *record, SHORT *new_log_index, T_PB_MATCH *match);
SHORT			*ATB_index_GetTable(SHORT phonebook_id, T_PB_INDEX index_type);
SHORT			ATB_index_GetPhysIndex(SHORT phonebook_id, T_PB_INDEX index_type, SHORT log_index);
SHORT			ATB_index_GetLogIndex(SHORT phonebook_id, T_PB_INDEX index_type, SHORT phys_index);
void			ATB_index_AddRec(SHORT phonebook_id, T_PB_INDEX index_type, SHORT phys_index, T_PB_RECORD *record, SHORT *new_log_index);
void			ATB_index_RemoveRec(SHORT phonebook_id, T_PB_INDEX index_type, SHORT log_index);

T_PB_MATCH 		ATB_index_Match(T_PB_RECORD *record1, T_PB_RECORD *record2, T_PB_INDEX index_type);
T_PB_COMPARE	ATB_index_Compare(T_PB_RECORD *record1, T_PB_RECORD *record2, T_PB_INDEX index_type);
T_PB_COMPARE	ATB_alpha_Match(T_PB_ALPHA *alpha1, T_PB_ALPHA *alpha2);
T_PB_COMPARE	ATB_alpha_Compare(T_PB_ALPHA *Alpha_1, T_PB_ALPHA *Alpha_2);
UBYTE			ATB_num_Digit(UBYTE *num, SHORT numIndex);
T_PB_MATCH		ATB_num_Match(UBYTE *num1, UBYTE *num2);
T_PB_COMPARE	ATB_num_Compare(UBYTE *num1, UBYTE *num2);
void			ATB_mem_UpdateCache(SHORT phonebook_id, SHORT phys_index, T_PB_RECORD *record);
PB_RET			ATB_mem_ReadRec(SHORT phonebook_id, T_PB_INDEX index_type, SHORT log_index, T_PB_RECORD *record);