view cdg-hybrid/cdginc/p_mon.h @ 220:0ed36de51973

ABB semaphore protection overhaul The ABB semaphone protection logic that came with TCS211 from TI was broken in several ways: * Some semaphore-protected functions were called from Application_Initialize() context. NU_Obtain_Semaphore() called with NU_SUSPEND fails with NU_INVALID_SUSPEND in this context, but the return value wasn't checked, and NU_Release_Semaphore() would be called unconditionally at the end. The latter call would increment the semaphore count past 1, making the semaphore no longer binary and thus no longer effective for resource protection. The fix is to check the return value from NU_Obtain_Semaphore() and skip the NU_Release_Semaphore() call if the semaphore wasn't properly obtained. * Some SPI hardware manipulation was being done before entering the semaphore- protected critical section. The fix is to reorder the code: first obtain the semaphore, then do everything else. * In the corner case of L1/DSP recovery, l1_abb_power_on() would call some non-semaphore-protected ABB & SPI init functions. The fix is to skip those calls in the case of recovery. * A few additional corner cases existed, all of which are fixed by making ABB semaphore protection 100% consistent for all ABB functions and code paths. There is still one remaining problem of priority inversion: suppose a low- priority task calls an ABB function, and some medium-priority task just happens to preempt right in the middle of that semaphore-protected ABB operation. Then the high-priority SPI task is locked out for a non-deterministic time until that medium-priority task finishes its work and goes back to sleep. This priority inversion problem remains outstanding for now.
author Mychaela Falconia <falcon@freecalypso.org>
date Mon, 26 Apr 2021 20:55:25 +0000
parents 35f7a1dc9f7d
children
line wrap: on
line source

/*
+--------------------------------------------------------------------------+
| PROJECT : PROTOCOL STACK                                                 |
| FILE    : p_mon.h                                                        |
| SOURCE  : "sap\mon.pdf"                                                  |
| LastModified : "2003-02-04"                                              |
| IdAndVersion : "8304.129.96.103"                                         |
| SrcFileTime  : "Thu Nov 29 09:49:00 2007"                                |
| Generated by CCDGEN_2.5.5A on Fri Oct 14 21:41:52 2016                   |
|           !!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_MON_H
#define P_MON_H


#define CDG_ENTER__P_MON_H

#define CDG_ENTER__FILENAME _P_MON_H
#define CDG_ENTER__P_MON_H__FILE_TYPE CDGINC
#define CDG_ENTER__P_MON_H__LAST_MODIFIED _2003_02_04
#define CDG_ENTER__P_MON_H__ID_AND_VERSION _8304_129_96_103

#define CDG_ENTER__P_MON_H__SRC_FILE_TIME _Thu_Nov_29_09_49_00_2007

#include "CDG_ENTER.h"

#undef CDG_ENTER__P_MON_H

#undef CDG_ENTER__FILENAME


#include "p_mon.val"

#ifndef __T_plmn__
#define __T_plmn__
/*
 * PLMN identification
 * CCDGEN:WriteStruct_Count==2017
 */
typedef struct
{
  U8                        v_plmn;                   /*<  0:  1> valid flag                                         */
  U8                        mcc[SIZE_MCC];            /*<  1:  3> mobile country code                                */
  U8                        mnc[SIZE_MNC];            /*<  4:  3> mobile network code                                */
  U8                        _align0;                  /*<  7:  1> alignment                                          */
} T_plmn;
#endif


/*
 * End of substructure section, begin of primitive definition section
 */

#ifndef __T_MON_CHAN_IDLE_IND__
#define __T_MON_CHAN_IDLE_IND__
/*
 * 
 * CCDGEN:WriteStruct_Count==2018
 */
typedef struct
{
  U16                       arfcn;                    /*<  0:  2> channel number                                     */
  U8                        att_flag;                 /*<  2:  1> attach flag                                        */
  U8                        conf_ccch;                /*<  3:  1> CCCH configuration                                 */
  U8                        tn;                       /*<  4:  1> timeslot number                                    */
  U8                        dlt;                      /*<  5:  1> downlink initial value                             */
  U8                        pg;                       /*<  6:  1> paging group                                       */
  U8                        bs_ag_blocks_res;         /*<  7:  1> Blocks reserved for AGCH                           */
  U8                        bs_pa_mfrms;              /*<  8:  1> Multiframe Period                                  */
  U8                        power;                    /*<  9:  1> Power Level                                        */
  U8                        _align0;                  /*< 10:  1> alignment                                          */
  U8                        _align1;                  /*< 11:  1> alignment                                          */
  T_plmn                    plmn;                     /*< 12:  8> PLMN identification                                */
  U16                       lac;                      /*< 20:  2> location area code                                 */
  U16                       cell_id;                  /*< 22:  2> cell identity                                      */
} T_MON_CHAN_IDLE_IND;
#endif

#ifndef __T_MON_MEAS_IDLE_IND__
#define __T_MON_MEAS_IDLE_IND__
/*
 * 
 * CCDGEN:WriteStruct_Count==2019
 */
typedef struct
{
  U16                       arfcn;                    /*<  0:  2> channel number                                     */
  U8                        bsic;                     /*<  2:  1> base station identification code                   */
  U8                        rx_lev;                   /*<  3:  1> received field strength                            */
  U8                        c1;                       /*<  4:  1> path loss criterion C1                             */
  U8                        _align0;                  /*<  5:  1> alignment                                          */
  U16                       arfcn_nc[6];              /*<  6: 12> channel number                                     */
  U8                        bsic_nc[6];               /*< 18:  6> base station identification code                   */
  U8                        rx_lev_nc[6];             /*< 24:  6> received field strength                            */
  U8                        tav_nc[6];                /*< 30:  6> timing advance                                     */
  U8                        c2_nc[6];                 /*< 36:  6> reselection criterion C2                           */
  U8                        _align1;                  /*< 42:  1> alignment                                          */
  U8                        _align2;                  /*< 43:  1> alignment                                          */
} T_MON_MEAS_IDLE_IND;
#endif

#ifndef __T_MON_COUNTER_IDLE_IND__
#define __T_MON_COUNTER_IDLE_IND__
/*
 * 
 * CCDGEN:WriteStruct_Count==2020
 */
typedef struct
{
  U8                        max_dlt;                  /*<  0:  1> maximum downlink timeout counter                   */
  U8                        act_dlt;                  /*<  1:  1> actual downlink timeout counter                    */
  U8                        _align0;                  /*<  2:  1> alignment                                          */
  U8                        _align1;                  /*<  3:  1> alignment                                          */
} T_MON_COUNTER_IDLE_IND;
#endif

#ifndef __T_MON_CHAN_DEDI_IND__
#define __T_MON_CHAN_DEDI_IND__
/*
 * 
 * CCDGEN:WriteStruct_Count==2021
 */
typedef struct
{
  U8                        ch_type;                  /*<  0:  1> channel type                                       */
  U8                        _align0;                  /*<  1:  1> alignment                                          */
  U16                       arfcn;                    /*<  2:  2> channel number                                     */
  U8                        tsc;                      /*<  4:  1> training sequence code                             */
  U8                        tn;                       /*<  5:  1> timeslot number                                    */
  U8                        ch_mode;                  /*<  6:  1> channel mode                                       */
  U8                        hop;                      /*<  7:  1> frequency hopping flag                             */
  U8                        hsn;                      /*<  8:  1> hopping sequence number                            */
  U8                        maio;                     /*<  9:  1> mobile allocation offset                           */
  U8                        power;                    /*< 10:  1> Power Level                                        */
  U8                        _align1;                  /*< 11:  1> alignment                                          */
} T_MON_CHAN_DEDI_IND;
#endif

#ifndef __T_MON_MEAS_DEDI_IND__
#define __T_MON_MEAS_DEDI_IND__
/*
 * 
 * CCDGEN:WriteStruct_Count==2022
 */
typedef struct
{
  U8                        rx_lev_full;              /*<  0:  1> received field strength                            */
  U8                        rx_lev_sub;               /*<  1:  1> received field strength                            */
  U8                        rx_qual_full;             /*<  2:  1> received quality                                   */
  U8                        rx_qual_sub;              /*<  3:  1> received quality                                   */
  U8                        tav;                      /*<  4:  1> timing advance                                     */
  U8                        _align0;                  /*<  5:  1> alignment                                          */
  U16                       arfcn_nc[6];              /*<  6: 12> channel number                                     */
  U8                        bsic_nc[6];               /*< 18:  6> base station identification code                   */
  U8                        rx_lev_nc[6];             /*< 24:  6> received field strength                            */
  U8                        tav_nc[6];                /*< 30:  6> timing advance                                     */
} T_MON_MEAS_DEDI_IND;
#endif

#ifndef __T_MON_COUNTER_DEDI_IND__
#define __T_MON_COUNTER_DEDI_IND__
/*
 * 
 * CCDGEN:WriteStruct_Count==2023
 */
typedef struct
{
  U8                        max_rlt;                  /*<  0:  1> maximum radiolink timeout counter                  */
  U8                        act_rlt;                  /*<  1:  1> actual radiolink timeout counter                   */
  U8                        _align0;                  /*<  2:  1> alignment                                          */
  U8                        _align1;                  /*<  3:  1> alignment                                          */
} T_MON_COUNTER_DEDI_IND;
#endif

#ifndef __T_MON_COVERAGE_IND__
#define __T_MON_COVERAGE_IND__
/*
 * 
 * CCDGEN:WriteStruct_Count==2024
 */
typedef struct
{
  U8                        rx_lev[124];              /*<  0:124> received field strength                            */
  U8                        bsic[124];                /*<124:124> base station identification code                   */
} T_MON_COVERAGE_IND;
#endif


#include "CDG_LEAVE.h"


#endif