FreeCalypso > hg > fc-magnetite
view cdg211/cdginc/p_mphc.val @ 516:1ed9de6c90bd
src/g23m-gsm/sms/sms_for.c: bogus malloc removed
The new error handling code that was not present in TCS211 blob version
contains a malloc call that is bogus for 3 reasons:
1) The memory allocation in question is not needed in the first place;
2) libc malloc is used instead of one of the firmware's proper ways;
3) The memory allocation is made inside a function and then never freed,
i.e., a memory leak.
This bug was caught in gcc-built FreeCalypso fw projects (Citrine
and Selenite) because our gcc environment does not allow any use of
libc malloc (any reference to malloc produces a link failure),
but this code from TCS3.2 is wrong even for Magnetite: if this code
path is executed repeatedly over a long time, the many small allocations
made by this malloc call without a subsequent free will eventually
exhaust the malloc heap provided by the TMS470 environment, malloc will
start returning NULL, and the bogus code will treat it as an error.
Because the memory allocation in question is not needed at all,
the fix entails simply removing it.
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Sun, 22 Jul 2018 06:04:49 +0000 |
parents | 56abf6cf8a0b |
children |
line wrap: on
line source
/* +--------------------------------------------------------------------------+ | PROJECT : PROTOCOL STACK | | FILE : p_mphc.val | | SOURCE : "__out__\g23m_dfile\prim\mphc.pdf" | | LastModified : "2003-04-03" | | IdAndVersion : "10.10.10.011" | | SrcFileTime : "Mon Sep 26 14:30:48 2005" | | Generated by CCDGEN_2.5.5 on Fri Jun 08 13:59:15 2007 | | !!DO NOT MODIFY!!DO NOT MODIFY!!DO NOT MODIFY!! | +--------------------------------------------------------------------------+ */ /* PRAGMAS * PREFIX : NONE * COMPATIBILITY_DEFINES : NO (require PREFIX) * ALWAYS_ENUM_IN_VAL_FILE: NO * ENABLE_GROUP: NO * CAPITALIZE_TYPENAME: NO */ #ifndef P_MPHC_VAL #define P_MPHC_VAL #define CDG_ENTER__P_MPHC_VAL #define CDG_ENTER__FILENAME _P_MPHC_VAL #define CDG_ENTER__P_MPHC_VAL__FILE_TYPE CDGINC #define CDG_ENTER__P_MPHC_VAL__LAST_MODIFIED _2003_04_03 #define CDG_ENTER__P_MPHC_VAL__ID_AND_VERSION _10_10_10_011 #define CDG_ENTER__P_MPHC_VAL__SRC_FILE_TIME _Mon_Sep_26_14_30_48_2005 #include "CDG_ENTER.h" #undef CDG_ENTER__P_MPHC_VAL #undef CDG_ENTER__FILENAME /* * Value constants for VAL_bs_pa_mfrms */ #define VAL_BS_PA_MFRMS___2 (0x2) /* 2 Multiframe Periods */ #define VAL_BS_PA_MFRMS___3 (0x3) /* 3 Multiframe Periods */ #define VAL_BS_PA_MFRMS___4 (0x4) /* 4 Multiframe Periods */ #define VAL_BS_PA_MFRMS___5 (0x5) /* 5 Multiframe Periods */ #define VAL_BS_PA_MFRMS___6 (0x6) /* 6 Multiframe Periods */ #define VAL_BS_PA_MFRMS___7 (0x7) /* 7 Multiframe Periods */ #define VAL_BS_PA_MFRMS___8 (0x8) /* 8 Multiframe Periods */ #define VAL_BS_PA_MFRMS___9 (0x9) /* 9 Multiframe Periods */ /* * Value constants for VAL_bcch_combined */ #define COMB_CCCH_NOT_COMB (0x0) /* CCCH not combined with SDCCH */ #define COMB_CCCH_COMB (0x1) /* CCCH combined with SDCCH */ /* * Value constants for VAL_ccch_group */ #define CCCH_GROUP_TS0 (0x0) /* equal to timeslot 0 */ #define CCCH_GROUP_TS2 (0x1) /* equal to timeslot 2 */ #define CCCH_GROUP_TS4 (0x2) /* equal to timeslot 4 */ #define CCCH_GROUP_TS6 (0x3) /* equal to timeslot 6 */ /* * Value constants for VAL_page_block_index */ /* * Value constants for VAL_page_mode */ #define PGM_NORMAL (0x0) /* Use normal paging */ #define PGM_EXTENDED (0x1) /* Use extended paging */ #define PGM_REORG (0x2) /* use reorganise paging */ /* * Value constants for VAL_modulus */ /* * Value constants for VAL_radio_freq */ // VALTAB-FF: !TI_DUAL_MODE /* * Value constants for VAL_l2_channel */ #define L2_CHANNEL_SACCH (0x1) /* SACCH block */ #define L2_CHANNEL_SDCCH (0x2) /* SDCCH block */ #define L2_CHANNEL_FACCH_H (0x3) /* FACCH halfrate block */ #define L2_CHANNEL_FACCH_F (0x4) /* FACCH fullrate block */ #define L2_CHANNEL_CCCH (0x5) /* CCCH block */ #define L2_CHANNEL_NBCCH (0x6) /* normal BCCH block */ #define L2_CHANNEL_PCH (0x7) /* PCH block */ #define L2_CHANNEL_EPCH (0x8) /* extended PCH block */ #define L2_CHANNEL_CBCH (0x9) /* CBCH block */ #define L2_CHANNEL_EBCCH (0xa) /* extended BCCH */ /* * Value constants for VAL_error_flag */ #define VALID_BLOCK (0x0) /* valid block received */ #define INVALID_BLOCK (0x1) /* invalid block received */ /* * Value constants for VAL_tc */ /* * Value constants for VAL_fn_offset */ /* * Value constants for VAL_time_alignment */ /* * Value constants for VAL_timing_validity */ #define TV_INVALID_TIMING_INFO (0x0) /* timing info shall not be used, do full FB and SB detection */ #define TV_APPROX_TIMING_INFO (0x1) /* timing info may be used, do full FB and SB detection */ #define TV_VALID_TIMING_INFO (0x2) /* read SB based based on timing info (only for ncell) */ /* * Value constants for VAL_search_mode */ #define SM_WIDE_MODE (0x0) /* wideband capture and open-loop afc algorithm */ #define SM_NARROW_MODE (0x1) /* narrowband capture and open-loop afc algorithm */ /* * Value constants for VAL_bsic */ /* * Value constants for VAL_tsc */ /* * Value constants for VAL_bcch_blocks_required */ #define SI_NBLOCK_0 (0x1) /* TC 0 normal */ #define SI_NBLOCK_1 (0x2) /* TC 1 normal */ #define SI_NBLOCK_2 (0x4) /* TC 2 normal */ #define SI_NBLOCK_3 (0x8) /* TC 3 normal */ #define SI_NBLOCK_4 (0x10) /* TC 4 normal */ #define SI_NBLOCK_5 (0x20) /* TC 5 normal */ #define SI_NBLOCK_6 (0x40) /* TC 6 normal */ #define SI_NBLOCK_7 (0x80) /* TC 7 normal */ #define SI_EBLOCK_0 (0x100) /* TC 0 extended */ #define SI_EBLOCK_1 (0x200) /* TC 1 extended */ #define SI_EBLOCK_2 (0x400) /* TC 2 extended */ #define SI_EBLOCK_3 (0x800) /* TC 3 extended */ #define SI_EBLOCK_4 (0x1000) /* TC 4 extended */ #define SI_EBLOCK_5 (0x2000) /* TC 5 extended */ #define SI_EBLOCK_6 (0x4000) /* TC 6 extended */ #define SI_EBLOCK_7 (0x8000) /* TC 7 extended */ #define NCELL_BCCH_SI_2 (0x2) /* PLMN Search */ #define NCELL_BCCH_SI_3_4 (0xcc) /* Ncell BCCH */ #define NCELL_BCCH_SI_2_3_4 (0xce) /* PLMN Search */ #define NCELL_BCCH_SI_3_7_8 (0x8844) /* Ncell BCCH */ /* * Value constants for VAL_channel_type */ #define CH_TCH_F (0x1) /* TCH/F */ #define CH_TCH_H (0x2) /* TCH/H */ #define CH_SDCCH_4 (0x3) /* SDCCH/4 */ #define CH_SDCCH_8 (0x4) /* SDCCH/8 */ /* * Value constants for VAL_timeslot_no */ /* * Value constants for VAL_h */ #define NO_HOPPING (0x0) /* no hopping */ #define HOPPING (0x1) /* hopping */ /* * Value constants for VAL_hsn */ /* * Value constants for VAL_maio */ /* * Value constants for VAL_cbch_select */ #define CBCH_READ_EXT (0x1) /* read extended CBCH */ #define CBCH_READ_NORM (0x0) /* read normal CBCH */ /* * Value constants for VAL_schedule_length */ #define CBCH_NO_SCHED (0x0) /* no scheduling provided */ /* * Value constants for VAL_tb_bitmap */ #define CBCH_NORM_BLOCK2 (0x1) /* norm block 2 */ #define CBCH_NORM_BLOCK3 (0x2) /* norm block 3 */ #define CBCH_NORM_BLOCK4 (0x4) /* norm block 4 */ #define CBCH_EXT_BLOCK2 (0x8) /* ext block 2 */ #define CBCH_EXT_BLOCK3 (0x10) /* ext block 3 */ #define CBCH_EXT_BLOCK4 (0x20) /* ext block 4 */ #define CBCH_NORM_BLOCK234 (0x7) /* request all blocks */ #define CBCH_EXT_BLOCK234 (0x38) /* all ext blocks */ /* * Value constants for VAL_normal_cbch */ #define CBCH_DONT_STOP (0x0) /* dont stop cbch */ #define CBCH_STOP (0x1) /* stop cbch */ /* * Value constants for VAL_txpwr */ /* * Value constants for VAL_powerclass_gsm */ #define POW_CLASS_1 (0x1) /* Class 1 */ #define POW_CLASS_2 (0x2) /* Class 2 */ #define POW_CLASS_3 (0x3) /* Class 3 */ #define POW_CLASS_4 (0x4) /* Class 4 */ #define POW_CLASS_5 (0x5) /* Class 5 */ /* * Value constants for VAL_dtx_allowed */ #define DTX_NOTALLOWED (0x0) /* DTX is not allowed */ #define DTX_ALLOWED (0x1) /* DTX is allowed */ /* * Value constants for VAL_pwrc */ #define PWRC_NOT_SET (0x0) /* PWRC is not set */ #define PWRC_SET (0x1) /* PWRC is set */ /* * Value constants for VAL_channel_mode */ #define CM_SIGNALLING_ONLY (0x0) /* signalling only */ #define CM_TCH_FS (0x1) /* TCH full rate speech */ #define CM_TCH_HS (0x2) /* TCH half rate speech */ #define CM_TCH_96 (0x3) /* TCH data 9600 */ #define CM_TCH_F_48 (0x4) /* TCH data full rate 4800 */ #define CM_TCH_H_48 (0x5) /* TCH data half rate 4800 */ #define CM_TCH_F_24 (0x6) /* TCH data full rate 2400 */ #define CM_TCH_H_24 (0x7) /* TCH data half rate 2400 */ #define CM_TCH_EFR (0x8) /* TCH */ #define CM_TCH_144 (0x9) /* TCH */ #define CM_TCH_AHS (0xa) /* TCH AMR half rate */ #define CM_TCH_AFS (0xb) /* TCH AMR full rate */ /* * Value constants for VAL_cipher_mode */ #define CI_NO_CIPHERING (0x0) /* ciphering off */ #define CI_CIPHERING (0x1) /* ciphering on */ /* * Value constants for VAL_a5_algorithm */ #define A5_1 (0x0) /* A5/1 algorithm */ #define A5_2 (0x1) /* A5/2 algorithm */ #define A5_3 (0x2) /* A5/3 algorithm */ #define A5_4 (0x3) /* A5/4 algorithm */ #define A5_5 (0x4) /* A5/5 algorithm */ #define A5_6 (0x5) /* A5/6 algorithm */ #define A5_7 (0x6) /* A5/7 algorithm */ /* * Value constants for VAL_cause */ #define HO_COMPLETE (0x0) /* success */ #define HO_TIMEOUT (0x1) /* timeout */ /* * Value constants for VAL_nci */ #define HO_TA_OUT_IGNORED (0x0) /* timing advance out of range is ignored */ #define HO_TA_OUT_NOT_IGNORED (0x1) /* timing advance out of range is not ignored */ /* * Value constants for VAL_timing_advance_valid */ #define HO_TA_NOT_VALID (0x0) /* timing advance information is not valid */ #define HO_TA_VALID (0x1) /* timing advance information is valid */ /* * Value constants for VAL_dtx_used */ #define DTX_NOT_USED (0x0) /* DTX was not used */ #define DTX_USED (0x1) /* DTX was used */ /* * Value constants for VAL_meas_valid */ #define MEAS_ARE_NOT_VALID (0x0) /* measurement values are not valid */ #define MEAS_ARE_VALID (0x1) /* measurement values are valid */ /* * Value constants for VAL_bcch_freq */ /* * Value constants for VAL_sub_channel */ #define SUB_CH_0 (0x0) /* sub channel 0 */ #define SUB_CH_1 (0x1) /* sub channel 1 */ /* * Value constants for VAL_frame_erasure */ #define TCH_LOOP_A (0x0) /* TCH loop A */ #define TCH_LOOP_B (0x1) /* TCH loop B */ #define TCH_LOOP_C (0x2) /* TCH loop C */ #define TCH_LOOP_D (0x3) /* TCH loop D */ #define TCH_LOOP_E (0x4) /* TCH loop E */ #define TCH_LOOP_F (0x5) /* TCH loop F */ #define TCH_LOOP_I (0x6) /* TCH loop I */ /* * Value constants for VAL_tested_device */ #define DAI_NO_TEST (0x0) /* no test */ #define DAI_S_DEC (0x1) /* speech decoder */ #define DAI_S_COD (0x2) /* speech coder */ #define DAI_ACOUSTIC (0x4) /* acoustic tests */ /* * Value constants for VAL_sleep_mode */ #define NO_SLEEP (0x0) /* no sleep mode */ #define SMALL_SLEEP (0x1) /* small sleep mode */ #define BIG_SLEEP (0x2) /* big sleep mode */ #define DEEP_SLEEP (0x3) /* deep sleep mode */ #define ALL_SLEEP (0x4) /* all sleep modes */ /* * Value constants for VAL_Clocks */ #define CL_ARMIO (0x1) /* ARMIO_CLK */ #define CL_RIFR (0x2) /* RIF_CLKR */ #define CL_RIFX (0x4) /* RIF_CLKX */ #define CL_RIF13 (0x10) /* RIF_CLK13 */ #define CL_NCLK (0x20) /* UWIRE_CLK */ #define CL_SIM (0x40) /* SIM_CLK */ #define CL_TSP (0x80) /* TSP_CLK */ #define CL_TIMER (0x100) /* TIMER_CLK */ #define CL_TPU (0x200) /* TPU_CLK */ #define CL_UART (0x400) /* UART_CLK */ #define CL_SW_CLOCK (0x800) /* SWITCH_IRQ_CLK */ /* * Value constants for VAL_sb_flag */ #define NO_SB_FOUND (0x0) /* synchron burst not found (fn_offset, time_alignment and bsic are not valid) */ #define SB_FOUND (0x1) /* synchron burst found (fn_offset, time_alignment and bsic are valid */ /* * Value constants for VAL_gprs_prio */ #define GPRS_PRIO_TOP (0x0) /* Higher than serving cell */ #define GPRS_PRIO_HIGH (0x1) /* Higher than normal ncell bcch reading */ #define GPRS_PRIO_NORM (0x2) /* Normal */ /* * Value constants for VAL_radio_band_config */ #define STD_900 (0x1) /* GSM 900 */ #define STD_EGSM (0x2) /* extended GSM */ #define STD_1900 (0x3) /* PCS 1900 */ #define STD_1800 (0x4) /* DCS 1800 */ #define STD_DUAL (0x5) /* GSM 900 / DCS 1800 */ #define STD_DUAL_EGSM (0x6) /* extended GSM / DCS 1800 */ #define STD_850 (0x7) /* GSM 850 */ #define STD_DUAL_US (0x8) /* GSM 850 / PCS 1900 */ /* * Value constants for VAL_initial_codec_mode */ #define CODEC_MODE_1 (0x0) /* lowest codec mode */ #define CODEC_MODE_2 (0x1) /* second lowest mode */ #define CODEC_MODE_3 (0x2) /* third lowest mode */ #define CODEC_MODE_4 (0x3) /* highest mode */ /* * Value constants for VAL_eodt_data_valid */ #define EOTD_NOT_PRES (0x0) /* EOTD data not present */ #define EOTD_PRES (0x1) /* EOTD data present */ /* * Value constants for VAL_eotd */ #define NC_MON (0x0) /* neighbour cell monitoring */ #define EOTD_MON (0x1) /* EOTD monitoring */ /* * Value constants for VAL_mode */ #define MODE_IDLE (0x0) /* idle */ #define MODE_DEDIC (0x1) /* dedicated or packet transfer */ /* * user defined constants */ #define BA_LIST_SIZE (0x21) #define MAX_NCELL_EOTD_L1 (0xc) #define MAX_NCELL (0x6) #define MAX_CARRIERS (0x224) #define BCCH_LIST_SIZE (0x20) #define MAX_MEAS_VALUES (0x8) #define MAX_L2_FRAME_SIZE (0x17) #define MAX_MA_CARRIER (0x40) #define MAX_SCHED_SIZE (0xa) #define ADC_LIST_SIZE (0x5) #include "CDG_LEAVE.h" #endif