FreeCalypso > hg > fc-magnetite
view src/aci2/aci/aci_bat_ss.c @ 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
/* +----------------------------------------------------------------------------- | Project : GSM-F&D (8411) | Modul : ACI_BAT +----------------------------------------------------------------------------- | Copyright 2002 Texas Instruments Berlin, AG | All rights reserved. | | This file is confidential and a trade secret of Texas | Instruments Berlin, AG | The receipt of or possession of this file does not convey | any rights to reproduce or disclose its contents or to | manufacture, use, or sell anything it may describe, in | whole, or in part, without the specific written consent of | Texas Instruments Berlin, AG. +----------------------------------------------------------------------------- | Purpose : This BAT wrapper modul is ... | +----------------------------------------------------------------------------- */ #include "aci_all.h" /* includes prim.h, which includes p_bat.h */ #include "aci_cmh.h" #include "ati_cmd.h" #include "aci_cmd.h" /* prototypes of helper functions */ #include "psa.h" #include "cmh.h" #include "aci_bat_cmh.h" /* prototypes of sBAT_,qBAT_,tBAT_ */ #include "aci_bat.h" #include "aci_bat_err.h" /*prototypes of err functions for BAT*/ /* +--------------------------------------------------------------------+ | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT | | STATE : code ROUTINE : sBAT_PlusCTFR | +--------------------------------------------------------------------+ PURPOSE : */ GLOBAL T_ACI_BAT_RSLT sBAT_PlusCTFR (T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_send *cmd) { T_ACI_BAT_RSLT ret = ACI_BAT_FAIL; T_ACI_TOA type; T_ACI_TOA *p_type; T_ACI_TOS satype; T_ACI_TOS *p_satype; //CHAR *subadr = subBuf; char subBuf[MAX_SUBADDR_LEN]={0}; char* p_subBuf; SHORT toa_oct = 0; SHORT tos_oct = 0; CHAR numBuf[MAX_B_SUBSCR_NUM_LEN]; TRACE_FUNCTION ("sBAT_PlusCTFR()"); p_type = &type; p_satype = &satype; p_subBuf = subBuf; memset( numBuf, 0, sizeof(numBuf)); memcpy(numBuf,cmd->params.ptr_set_plus_ctfr->number,cmd->params.ptr_set_plus_ctfr->c_number); if ( cmd->params.ptr_set_plus_ctfr->type EQ BAT_PARAMETER_NOT_PRESENT ) { p_type = NULL; } else { toa_oct = cmd->params.ptr_set_plus_ctfr->type; } if ( cmd->params.ptr_set_plus_ctfr->satype EQ BAT_PARAMETER_NOT_PRESENT ) { p_satype = NULL; } else { tos_oct = cmd->params.ptr_set_plus_ctfr->satype; } /* Type Of Address present */ type = toa_demerge (toa_oct); if (type.ton < 0 OR type.npi < 0) { ACI_ERR_DESC(ACI_ERR_CLASS_Cme,CME_ERR_OpNotAllow); return (ACI_BAT_FAIL); } satype = tos_demerge (tos_oct); if (satype.tos < 0 OR satype.oe < 0) { ACI_ERR_DESC(ACI_ERR_CLASS_Cme,CME_ERR_OpNotAllow); return (ACI_BAT_FAIL); } if(cmd->params.ptr_set_plus_ctfr->v_subaddr) { memcpy(subBuf,cmd->params.ptr_set_plus_ctfr->subaddr,cmd->params.ptr_set_plus_ctfr->c_subaddr); } else { p_subBuf = NULL; } ret = sAT_PlusCTFR (src_infos_psi->srcId, numBuf, p_type, p_subBuf, p_satype); return(ret); } /* +--------------------------------------------------------------------+ | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT | | STATE : code ROUTINE : sBAT_PlusCCFC | +--------------------------------------------------------------------+ PURPOSE : */ GLOBAL T_ACI_BAT_RSLT sBAT_PlusCCFC (T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_send *cmd) { T_ACI_BAT_RSLT ret = ACI_BAT_FAIL; T_BAT_plus_ccfc_reason reason; T_BAT_plus_ccfc_mode mode; T_ACI_TOA type; T_ACI_TOA *p_type; T_ACI_TOS satype; T_ACI_TOS *p_satype; T_BAT_plus_ccfc_bearer_class class_type=BAT_CCFC_CLASS_NOT_PRESENT; //CHAR *subadr = subBuf; char subBuf[MAX_SUBADDR_LEN]={0}; char* p_subBuf; T_BAT_plus_ccfc_time time=BAT_CCFC_TIME_NOT_PRESENT; SHORT toa_oct=0; SHORT tos_oct=0; CHAR numBuf[MAX_B_SUBSCR_NUM_LEN]; CHAR* p_numBuf; TRACE_FUNCTION ("sBAT_PlusCCFC()"); p_type=&type; p_satype=&satype; p_subBuf = subBuf; p_numBuf = numBuf; memset( numBuf, 0, sizeof(numBuf)); reason = cmd->params.ptr_set_plus_ccfc->reason; mode = cmd->params.ptr_set_plus_ccfc->mode; toa_oct = cmd->params.ptr_set_plus_ccfc->type; tos_oct = cmd->params.ptr_set_plus_ccfc->satype; class_type = cmd->params.ptr_set_plus_ccfc->bearer_class; time = cmd->params.ptr_set_plus_ccfc->time; if (mode EQ BAT_CCFC_MODE_QUERY) /*query mode*/ { ret = qAT_PlusCCFC(src_infos_psi->srcId,reason,class_type); switch (ret) { case AT_EXCT: case ATI_BUSY: case ATI_FAIL: { return ret; } default: { return (ACI_BAT_FAIL); } } } if(cmd->params.ptr_set_plus_ccfc->v_subaddr) { memcpy(subBuf,cmd->params.ptr_set_plus_ccfc->subaddr,cmd->params.ptr_set_plus_ccfc->c_subaddr); } else { p_subBuf = NULL; } if ( cmd->params.ptr_set_plus_ccfc->type EQ BAT_PARAMETER_NOT_PRESENT ) { p_type = NULL; } else { toa_oct = cmd->params.ptr_set_plus_ccfc->type; } if ( cmd->params.ptr_set_plus_ccfc->satype EQ BAT_PARAMETER_NOT_PRESENT ) { p_satype = NULL; } else { tos_oct = cmd->params.ptr_set_plus_ccfc->satype; } /* Type Of Address present */ type = toa_demerge (toa_oct); if (type.ton < 0 OR type.npi < 0) { ACI_ERR_DESC(ACI_ERR_CLASS_Cme,CME_ERR_OpNotAllow); return (ACI_BAT_FAIL); } satype = tos_demerge (tos_oct); if (satype.tos < 0 OR satype.oe < 0) { ACI_ERR_DESC(ACI_ERR_CLASS_Cme,CME_ERR_OpNotAllow); return (ACI_BAT_FAIL); } if(cmd->params.ptr_set_plus_ccfc->v_number) { memcpy(numBuf,cmd->params.ptr_set_plus_ccfc->number,cmd->params.ptr_set_plus_ccfc->c_number); } else { p_numBuf = NULL; } ret = sAT_PlusCCFC(src_infos_psi->srcId,reason,mode,p_numBuf,p_type,class_type,p_subBuf,p_satype,time); return(ret); } /* +--------------------------------------------------------------------+ | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT | | STATE : code ROUTINE : sBAT_PlusCLCK | +--------------------------------------------------------------------+ PURPOSE : */ GLOBAL T_ACI_BAT_RSLT sBAT_PlusCLCK (T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_send *cmd) { T_ACI_BAT_RSLT ret = ACI_BAT_FAIL; T_BAT_plus_clck_fac fac_num; T_BAT_plus_clck_mode mod; T_BAT_bearer_class class_type = BAT_CLASS_NOT_PRESENT; T_BAT_cmd_response resp; T_ACI_CLSSTAT clsStat; char passwd[MAX_PWD_LENGTH]={0}; TRACE_FUNCTION ("sBAT_PlusCLCK()"); fac_num = cmd->params.ptr_set_plus_clck->fac; mod = cmd->params.ptr_set_plus_clck->mode; class_type = cmd->params.ptr_set_plus_clck->bearer_class; if (mod EQ BAT_CLCK_MODE_QUERY) /*query mode*/ { T_BAT_res_set_plus_clck clck; ret=qAT_PlusCLCK(src_infos_psi->srcId,fac_num,class_type,&clsStat); resp.ctrl_response = BAT_RES_SET_PLUS_CLCK; resp.response.ptr_set_plus_clck = &clck; resp.response.ptr_set_plus_clck->status = BAT_CLCK_STATUS_NOT_ACTIVE ; resp.response.ptr_set_plus_clck->bearer_class = BAT_CLASS_NOT_PRESENT; if(ret EQ AT_CMPL) { switch(clsStat.status) { case STATUS_Active: resp.response.ptr_set_plus_clck->status = BAT_CLCK_STATUS_ACTIVE; break; case STATUS_NotActive: resp.response.ptr_set_plus_clck->status = BAT_CLCK_STATUS_NOT_ACTIVE; break; } if(clsStat.class_type NEQ CLASS_NotPresent) { resp.response.ptr_set_plus_clck->bearer_class = clsStat.class_type; } aci_bat_send(src_infos_psi , &resp); return (ACI_BAT_CMPL); } } else /*set mode*/ { if(cmd->params.ptr_set_plus_clck->v_passwd) { memcpy(passwd,cmd->params.ptr_set_plus_clck->passwd,cmd->params.ptr_set_plus_clck->c_passwd); } ret = sAT_PlusCLCK(src_infos_psi->srcId,fac_num,mod,passwd,class_type); } switch(ret) { case AT_EXCT: case AT_FAIL: { break; } case(AT_BUSY): { TRACE_EVENT("sBAT_PlusCLCK(): ME is busy"); break; } } return(ret); } /* +--------------------------------------------------------------------+ | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT | | STATE : code ROUTINE : sBAT_PlusCPWD | +--------------------------------------------------------------------+ PURPOSE : */ GLOBAL T_ACI_BAT_RSLT sBAT_PlusCPWD (T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_send *cmd) { T_ACI_BAT_RSLT ret = ACI_BAT_FAIL; T_BAT_plus_cpwd_fac fac_num; CHAR oldpwd[MAX_PWD_LENGTH]={0}; CHAR newpwd[MAX_PWD_LENGTH]={0}; TRACE_FUNCTION ("sBAT_PlusCPWD()"); fac_num = cmd->params.ptr_set_plus_cpwd->fac; memcpy(oldpwd, cmd->params.ptr_set_plus_cpwd->oldpwd,cmd->params.ptr_set_plus_cpwd->c_oldpwd); memcpy(newpwd, cmd->params.ptr_set_plus_cpwd->newpwd,cmd->params.ptr_set_plus_cpwd->c_newpwd); ret = sAT_PlusCPWD(src_infos_psi->srcId,fac_num,oldpwd,newpwd); return(ret); } /* +--------------------------------------------------------------------+ | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT | | STATE : code ROUTINE : sBAT_PlusCUSD | +--------------------------------------------------------------------+ PURPOSE : */ GLOBAL T_ACI_BAT_RSLT sBAT_PlusCUSD (T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_send *cmd) { T_ACI_BAT_RSLT ret; T_ACI_USSD_DATA ussd; T_ACI_USSD_DATA *ussd_ptr; T_BAT_cmd_set_plus_cusd *cusd; TRACE_FUNCTION ("sBAT_PlusCUSD()"); /* * Get a pointer to the BAT structure for convenience. */ cusd=cmd->params.ptr_set_plus_cusd; ussd_ptr=NULL; if (cusd->v_str) { USHORT len; utl_ussdDtaFromTe ( (UBYTE*)cusd->str, cusd->c_str, (UBYTE*)ussd.data, &len, (UBYTE)cusd->dcs); if (len>MAX_USSD_LEN) { /* * The USSD string is too big for the ACI structure. This should * not happen, and if it does means that we have overwritten * memory. */ ACI_ERR_DESC(ACI_ERR_CLASS_Cme,CME_ERR_TxtToLong); return(ACI_BAT_FAIL); } ussd.len=(UBYTE)len; ussd_ptr=&ussd; } /* * Call the corresponding sAT function. T_ACI_BAT_RSLT is * assumed to be equivalent to T_ACI_RESULT. */ ret=(T_ACI_BAT_RSLT)sAT_PlusCUSD( src_infos_psi->srcId, ussd_ptr, (SHORT)cusd->dcs); return(ret); }