FreeCalypso > hg > fc-magnetite
view src/g23m-gprs/grlc/grlc_measf.c @ 629:3231dd9b38c1
armio.c: make GPIOs 8 & 13 outputs driving 1 on all "classic" targets
Calypso GPIOs 8 & 13 are pinmuxed with MCUEN1 & MCUEN2, respectively,
and on powerup these pins are MCUEN, i.e., outputs driving 1. TI's code
for C-Sample and earlier turns them into GPIOs configured as outputs also
driving 1 - so far, so good - but TI's code for BOARD 41 (which covers
D-Sample, Leonardo and all real world Calypso devices derived from the
latter) switches them from MCUEN to GPIOs, but then leaves them as inputs.
Given that the hardware powerup state of these two pins is outputs driving 1,
every Calypso board design MUST be compatible with such driving; typically
these GPIO signals will be either unused and unconnected or connected as
outputs driving some peripheral. Turning these pins into GPIO inputs will
result in floating inputs on every reasonably-wired board, thus I am
convinced that this configuration is nothing but a bug on the part of
whoever wrote this code at TI.
This floating input bug had already been fixed earlier for GTA modem and
FCDEV3B targets; the present change makes the fix unconditional for all
"classic" targets. The newly affected targets are D-Sample, Leonardo,
Tango and GTM900.
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Thu, 02 Jan 2020 05:38:26 +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() */