FreeCalypso > hg > fc-magnetite
view src/g23m-gprs/grlc/grlc_measf.c @ 673:62a5285e014a
Lorekeeping: allow tpudrv-leonardo.lib on Leonardo/Tango
Back in 2015 the Mother's idea was to produce a FreeCalypso development
board that would be a clone of TI Leonardo, including the original
quadband RFFE; one major additional stipulation was that this board
needed to be able to run original unmodified TCS211-20070608 firmware
with all blobs intact, with only minimal binary patches to main.lib
and tpudrv.lib. The necessary patched libs were produced at that time
in the tcs211-patches repository.
That plan was changed and we produced FCDEV3B instead, with Openmoko's
triband RFFE instead of Leonardo quadband, but when FC Magnetite started
in 2016, a TPUDRV_blob= provision was still made, allowing the possibility
of patching OM's tpudrv.lib for a restored Leonardo RFFE.
Now in 2020 we have FC Tango which is essentially a verbatim clone of
Leonardo core, including the original quadband RFFE. We have also
deblobbed our firmware so much that we have absolutely no real need
for a blob version of tpudrv.lib - but I thought it would be neat to put
the ancient TPUDRV_blob= mechanism (classic config) to its originally
intended use, just for the heck of it.
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Fri, 29 May 2020 03:55:36 +0000 |
parents | 219afcfc6250 |
children |
line wrap: on
line source
/* +----------------------------------------------------------------------------- | Project : GPRS (8441) | Modul : GRLC +----------------------------------------------------------------------------- | 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 module implements local functions for service | MEAS of entity GRLC. +----------------------------------------------------------------------------- */ #ifndef GRLC_MEASF_C #define GRLC_MEASF_C #endif /* #ifndef GRLC_MEASF_C */ #define ENTITY_GRLC /*==== INCLUDES =============================================================*/ #include "typedefs.h" #include "vsi.h" #include "macdef.h" #include "gprs.h" #include "gsm.h" #include "ccdapi.h" #include "prim.h" #include "message.h" #include "grlc.h" #include "grlc_measf.h" /*==== CONST ================================================================*/ #define I_LEVEL_MIN I_LEVEL_0 #define I_LEVEL_0 0 /* i.lev. is greater than C */ #define I_LEVEL_15 15 /* i.lev. is less than or equal to C - 28 dB */ #define I_LEVEL_MAX I_LEVEL_15 #define I_LEVEL_GAMMA_0_SKIPPED 0xF0 /* used for tracing */ #define I_LEVEL_GAMMA_1_SKIPPED 0xF1 /* used for tracing */ #define I_LEVEL_GAMMA_2_SKIPPED 0xF2 /* used for tracing */ #define I_LEVEL_GAMMA_3_SKIPPED 0xF3 /* used for tracing */ #define I_LEVEL_STATE_MISMATCH 0xFD /* used for tracing */ #define I_LEVEL_IDX_TO_SMALL 0xFE /* used for tracing */ #define I_LEVEL_NOT_AVAIL 0xFF /* used for tracing */ /*==== LOCAL VARS ===========================================================*/ /*==== LOCAL TYPES===========================================================*/ /*==== PUBLIC FUNCTIONS =====================================================*/ /* +------------------------------------------------------------------------------ | Function : meas_c_calc_mean +------------------------------------------------------------------------------ | Description : This function calculates the mean of the received signal level | of the four normal bursts that compose a block. It returns | the amount of bursts with valid receibed signal values. | | Parameters : burst_level - receive signal level of the first valid downlink | PDCH radio block | radio_freq - radio frequency of TDMA frame within a | radio block | ss_block - mean of the received signal level | pb_rdc - Pb reduction | +------------------------------------------------------------------------------ */ GLOBAL UBYTE meas_c_calc_mean ( UBYTE *burst_level, USHORT *radio_freq, ULONG *ss_block, UBYTE *pb_rdc, T_CGRLC_freq_param *freq_param ) { UBYTE i; /* used for counting */ UBYTE vld_smpl = 0; /* valid measurement samples */ TRACE_FUNCTION( "meas_c_calc_mean" ); *pb_rdc = 0; *ss_block = 0; /* add up all measurement data */ for( i = 0; i < MAC_BURST_PER_BLOCK; i++ ) { if( burst_level[i] NEQ MAC_RXLEV_NONE ) { vld_smpl++; *ss_block += burst_level[i]; if( !( grlc_data->tm.freq_param.pdch_hopping EQ FALSE AND grlc_data->tm.freq_param.bcch_arfcn EQ radio_freq[i] ) ) { *pb_rdc += 1; } } } /* calculate the mean */ if( vld_smpl ) { *ss_block = ( *ss_block * MEAS_ACRCY ) / vld_smpl; } return( vld_smpl ); } /* meas_c_calc_mean() */ /* +------------------------------------------------------------------------------ | Function : meas_int_fill_rel_iLevel +------------------------------------------------------------------------------ | Description : ... | | Parameters : ... | +------------------------------------------------------------------------------ */ GLOBAL void meas_int_fill_rel_iLevel ( UBYTE *v_ilev, UBYTE *ilev, UBYTE idx, USHORT c_raw_data_lev ) { UBYTE val; /* holds interference level data */ if( grlc_data->meas.ilev.ilev[idx] NEQ CGRLC_ILEV_NONE ) { if( c_raw_data_lev < grlc_data->meas.ilev.ilev[idx] * MEAS_ACRCY ) { *ilev = I_LEVEL_MIN; } else { val = ( c_raw_data_lev - grlc_data->meas.ilev.ilev[idx] * MEAS_ACRCY ) / ( 2 * MEAS_ACRCY ) + 1; if( val > I_LEVEL_MAX ) *ilev = I_LEVEL_MAX; else *ilev = val; } *v_ilev = TRUE; } else { *v_ilev = FALSE; } } /* meas_int_fill_rel_iLevel() */