FreeCalypso > hg > fc-tourmaline
view src/g23m-gprs/sm/sm_aci_output_handler.c @ 275:79cfefc1e2b4
audio mode load: gracefully handle mode files of wrong AEC version
Unfortunately our change of enabling L1_NEW_AEC (which is necessary
in order to bring our Calypso ARM fw into match with the underlying
DSP reality) brings along a change in the audio mode file binary
format and file size - all those new tunable AEC parameters do need
to be stored somewhere, after all. But we already have existing
mode files in the old format, and setting AEC config to garbage when
loading old audio modes (which is what would happen without the
present change) is not an appealing proposition.
The solution implemented in the present change is as follows: the
audio mode loading code checks the file size, and if it differs
from the active version of T_AUDIO_MODE, the T_AUDIO_AEC_CFG structure
is cleared - set to the default (disabled AEC) for the compiled type
of AEC. We got lucky in that this varying T_AUDIO_AEC_CFG structure
sits at the end of T_AUDIO_MODE!
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Fri, 30 Jul 2021 02:55:48 +0000 |
parents | fa8dc04885d8 |
children |
line wrap: on
line source
/*---------------------------------------------------------------------------- | Project : 3G PS | Module : SM +----------------------------------------------------------------------------- | Copyright 2003 Texas Instruments. | All rights reserved. | | This file is confidential and a trade secret of Texas | Instruments . | 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. +----------------------------------------------------------------------------- | Purpose: Output functions for primitives from SM to the ACI entity. | For design details, see: | 8010.908 SM Detailed Specification +---------------------------------------------------------------------------*/ /*==== DECLARATION CONTROL =================================================*/ /*==== INCLUDES ============================================================*/ #include "sm.h" #include "sm_aci_output_handler.h" #include "sm_qos.h" /*==== CONSTS ===============================================================*/ /*==== TYPES ================================================================*/ /*==== LOCALS ===============================================================*/ /*==== PUBLIC FUNCTIONS =====================================================*/ /* +------------------------------------------------------------------------------ | Function : send_smreg_pdp_activate_cnf +------------------------------------------------------------------------------ | Description : Allocate, pack and send SMREG_PDP_ACTIVATE_CNF primitive. | | Parameters : context - Pointer to context structure +------------------------------------------------------------------------------ */ void send_smreg_pdp_activate_cnf(struct T_SM_CONTEXT_DATA *context) { U16 pco_len; (void)TRACE_FUNCTION("send_smreg_pdp_activate_cnf"); pco_len = (context->negotiated_pco != NULL ? (U16)context->negotiated_pco->c_pco_value : (U16)0); { U16 pco_bit_len = pco_len << 3; PALLOC_SDU(prim, SMREG_PDP_ACTIVATE_CNF, pco_bit_len); if (prim != NULL) { prim->nsapi = context->nsapi; prim->pdp_type = context->pdp_type; sm_qos_copy_from_sm(&prim->qos, &context->accepted_qos, &prim->ctrl_qos); memcpy(&prim->comp_params, &context->comp_params, sizeof(T_NAS_comp_params)); prim->ctrl_ip_address = context->negotiated_address.ctrl_ip_address; memcpy(&prim->ip_address, &context->negotiated_address.ip_address, sizeof(T_NAS_ip_address)); if (pco_len > 0 && context->negotiated_pco != NULL) { U16 offset = prim->sdu.o_buf >> 3; /* sdu.o_buf and sdu.l_buf already by PALLOC_SDU macro above! */ memcpy(&prim->sdu.buf[offset], context->negotiated_pco->pco_value, (size_t)pco_len); } else { prim->sdu.l_buf = 0; } (void)PSEND(hCommACI, prim); } else { (void)TRACE_ERROR("Unable to allocate SMREG_PDP_ACTIVATE_CNF primitive!"); } } } /* +------------------------------------------------------------------------------ | Function : send_smreg_pdp_activate_ind +------------------------------------------------------------------------------ | Description : Allocate, pack and send SMREG_PDP_ACTIVATE_IND primitive. | | Parameters : context - Pointer to context structure +------------------------------------------------------------------------------ */ void send_smreg_pdp_activate_ind(struct T_SM_CONTEXT_DATA *context) { (void)TRACE_FUNCTION("send_smreg_pdp_activate_ind"); { PALLOC(prim, SMREG_PDP_ACTIVATE_IND); prim->ti = context->ti; prim->pdp_type = context->pdp_type; prim->ctrl_ip_address = context->negotiated_address.ctrl_ip_address; memcpy(&prim->ip_address, &context->negotiated_address.ip_address, sizeof(T_NAS_ip_address)); if (context->apn != NULL) { /* NOTE: *MUST* be present acc to 3G 24.008, but just in case... */ memcpy(&prim->apn, context->apn, sizeof(T_SMREG_apn)); } else { prim->apn.c_apn_buf = (U8)0; } (void)PSEND(hCommACI, prim); } } /* +------------------------------------------------------------------------------ | Function : send_smreg_pdp_activate_rej +------------------------------------------------------------------------------ | Description : Allocate, pack and send SMREG_PDP_ACTIVATE_REJ primitive. | | Parameters : context - Pointer to context structure +------------------------------------------------------------------------------ */ void send_smreg_pdp_activate_rej(U8 nsapi, T_CAUSE_ps_cause *cause) { (void)TRACE_FUNCTION("send_smreg_pdp_activate_rej"); { PALLOC(prim, SMREG_PDP_ACTIVATE_REJ); prim->nsapi = nsapi; prim->ps_cause.ctrl_value = cause->ctrl_value; prim->ps_cause.value = cause->value; (void)PSEND(hCommACI, prim); } } /* +------------------------------------------------------------------------------ | Function : send_smreg_pdp_activate_sec_cnf +------------------------------------------------------------------------------ | Description : Allocate, pack and send SMREG_PDP_ACTIVATE_SEC_CNF primitive. | | Parameters : context - Pointer to context structure +------------------------------------------------------------------------------ */ void send_smreg_pdp_activate_sec_cnf(struct T_SM_CONTEXT_DATA *context) { (void)TRACE_FUNCTION("send_smreg_pdp_activate_sec_cnf"); { PALLOC(prim, SMREG_PDP_ACTIVATE_SEC_CNF); prim->nsapi = context->nsapi; sm_qos_copy_from_sm(&prim->qos, &context->accepted_qos, &prim->ctrl_qos); (void)PSEND(hCommACI, prim); } } /* +------------------------------------------------------------------------------ | Function : send_smreg_pdp_activate_sec_rej +------------------------------------------------------------------------------ | Description : Allocate, pack and send SMREG_PDP_ACTIVATE_SEC_REJ primitive. | | Parameters : nsapi - Context identifier | cause - Rejection cause +------------------------------------------------------------------------------ */ void send_smreg_pdp_activate_sec_rej(U8 nsapi, T_CAUSE_ps_cause *cause) { (void)TRACE_FUNCTION("send_smreg_pdp_activate_sec_rej"); { PALLOC(prim, SMREG_PDP_ACTIVATE_SEC_REJ); prim->nsapi = nsapi; prim->ps_cause.ctrl_value = cause->ctrl_value; prim->ps_cause.value = cause->value; (void)PSEND(hCommACI, prim); } } /* +------------------------------------------------------------------------------ | Function : send_smreg_pdp_deactivate_cnf +------------------------------------------------------------------------------ | Description : Allocate, pack and send SMREG_PDP_DEACTIVATE_CNF primitive. | | Parameters : nsapi_set - Set of NSAPIs successfully deactivated +------------------------------------------------------------------------------ */ void send_smreg_pdp_deactivate_cnf(U16 nsapi_set) { (void)TRACE_FUNCTION("send_smreg_pdp_deactivate_cnf"); { PALLOC(prim, SMREG_PDP_DEACTIVATE_CNF); prim->nsapi_set = nsapi_set; (void)PSEND(hCommACI, prim); } } /* +------------------------------------------------------------------------------ | Function : send_smreg_pdp_deactivate_ind +------------------------------------------------------------------------------ | Description : Allocate, pack and send SMREG_PDP_DEACTIVATE_IND primitive. | | Parameters : nsapi_set - Set of NSAPIs being deactivated | cause - Reason for deactivation +------------------------------------------------------------------------------ */ void send_smreg_pdp_deactivate_ind(U16 nsapi_set, T_CAUSE_ps_cause *cause) { (void)TRACE_FUNCTION("send_smreg_pdp_deactivate_ind"); { PALLOC(prim, SMREG_PDP_DEACTIVATE_IND); prim->nsapi_set = nsapi_set; prim->ps_cause.ctrl_value = cause->ctrl_value; prim->ps_cause.value = cause->value; (void)PSEND(hCommACI, prim); } } /* +------------------------------------------------------------------------------ | Function : send_smreg_pdp_modify_cnf +------------------------------------------------------------------------------ | Description : Allocate, pack and send SMREG_PDP_MODIFY_CNF primitive. | | Parameters : None +------------------------------------------------------------------------------ */ void send_smreg_pdp_modify_cnf(struct T_SM_CONTEXT_DATA *context, T_SM_UPDATE_FLAGS update_flags) { (void)TRACE_FUNCTION("send_smreg_pdp_modify_cnf"); { PALLOC(prim, SMREG_PDP_MODIFY_CNF); prim->nsapi = context->nsapi; if ((update_flags & SM_UPDATE_QOS) != (T_SM_UPDATE_FLAGS)0) { sm_qos_copy_from_sm(&prim->qos, &context->accepted_qos, &prim->ctrl_qos); } else { prim->ctrl_qos = PS_is_qos_not_present; } (void)PSEND(hCommACI, prim); } } /* +------------------------------------------------------------------------------ | Function : send_smreg_pdp_modify_ind +------------------------------------------------------------------------------ | Description : Allocate, pack and send SMREG_PDP_MODIFY_IND primitive. | | Parameters : None +------------------------------------------------------------------------------ */ void send_smreg_pdp_modify_ind(struct T_SM_CONTEXT_DATA *context, T_SM_UPDATE_FLAGS update_flags) { (void)TRACE_FUNCTION("send_smreg_pdp_modify_ind"); { PALLOC(prim, SMREG_PDP_MODIFY_IND); prim->nsapi = context->nsapi; if ((int)(update_flags & SM_UPDATE_QOS) != 0) { sm_qos_copy_from_sm(&prim->qos, &context->accepted_qos, &prim->ctrl_qos); } else { prim->ctrl_qos = PS_is_qos_not_present; } if ((int)(update_flags & SM_UPDATE_ADDRESS) != 0) { prim->ctrl_ip_address = context->negotiated_address.ctrl_ip_address; memcpy(&prim->ip_address, &context->negotiated_address.ip_address, sizeof(T_NAS_ip_address)); } else { prim->ctrl_ip_address = NAS_is_ip_not_present; } (void)PSEND(hCommACI, prim); } } /* +------------------------------------------------------------------------------ | Function : send_smreg_pdp_modify_ind_multiple +------------------------------------------------------------------------------ | Description : Allocate, pack and send SMREG_PDP_MODIFY_IND primitives for | several NSAPIs. | | Parameters : None +------------------------------------------------------------------------------ */ void send_smreg_pdp_modify_ind_multiple(U16 nsapi_set, T_SM_UPDATE_FLAGS update_flags) { int nsapi; (void)TRACE_FUNCTION("send_smreg_pdp_modify_ind_multiple"); for (nsapi = (int)NAS_NSAPI_5; nsapi < NAS_SIZE_NSAPI && sm_is_nsapi_in_nsapi_set(nsapi, nsapi_set); nsapi++) { struct T_SM_CONTEXT_DATA *context; context = sm_get_context_data_from_nsapi(nsapi); if (context != NULL) { PALLOC(prim, SMREG_PDP_MODIFY_IND); prim->nsapi = context->nsapi; if ((update_flags & SM_UPDATE_QOS_DOWNGRADE) != (T_SM_UPDATE_FLAGS)0) { sm_qos_copy_from_sm(&prim->qos, &context->accepted_qos, &prim->ctrl_qos); /* QoS downgraded to 0kbps */ prim->qos.qos_r99.max_rate_ul = 0; prim->qos.qos_r99.max_rate_dl = 0; } else { prim->ctrl_qos = PS_is_qos_not_present; } /* IP address is not changed/set using this function */ prim->ctrl_ip_address = NAS_is_ip_not_present; (void)PSEND(hCommACI, prim); } /* if */ } /* for */ } /* +------------------------------------------------------------------------------ | Function : send_smreg_pdp_modify_rej +------------------------------------------------------------------------------ | Description : Allocate, pack and send SMREG_PDP_MODIFY_REJ primitive. | | Parameters : None +------------------------------------------------------------------------------ */ void send_smreg_pdp_modify_rej(U8 nsapi, T_CAUSE_ps_cause *cause) { (void)TRACE_FUNCTION("send_smreg_pdp_modify_rej"); { PALLOC(prim, SMREG_PDP_MODIFY_REJ); prim->nsapi = nsapi; prim->ps_cause.ctrl_value = cause->ctrl_value; prim->ps_cause.value = cause->value; (void)PSEND(hCommACI, prim); } } /*==== END OF FILE ==========================================================*/