Home | History | Annotate | Download | only in TWDriver
      1 /*
      2  * TWDriverMsr.h
      3  *
      4  * Copyright(c) 1998 - 2009 Texas Instruments. All rights reserved.
      5  * All rights reserved.
      6  *
      7  * Redistribution and use in source and binary forms, with or without
      8  * modification, are permitted provided that the following conditions
      9  * are met:
     10  *
     11  *  * Redistributions of source code must retain the above copyright
     12  *    notice, this list of conditions and the following disclaimer.
     13  *  * Redistributions in binary form must reproduce the above copyright
     14  *    notice, this list of conditions and the following disclaimer in
     15  *    the documentation and/or other materials provided with the
     16  *    distribution.
     17  *  * Neither the name Texas Instruments nor the names of its
     18  *    contributors may be used to endorse or promote products derived
     19  *    from this software without specific prior written permission.
     20  *
     21  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
     22  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
     23  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
     24  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
     25  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
     26  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
     27  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
     28  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     29  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     30  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
     31  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     32  */
     33 
     34 #ifndef TWDDRIVERMSR_H
     35 #define TWDDRIVERMSR_H
     36 
     37 /** \file  TWDriverMsr.h
     38  *  \brief TWDriver Measurement APIs
     39  *
     40  *  \see
     41  */
     42 
     43 #include "TWDriverScan.h"
     44 #include "tidef.h"
     45 #include "public_radio.h"
     46 
     47 #define NOISE_HISTOGRAM_LENGTH              8
     48 #define MAX_NUM_OF_MSR_TYPES_IN_PARALLEL    3
     49 
     50 /* The size of the time frame in which we must start the */
     51 /* measurement request or give up */
     52 #define MSR_START_MAX_DELAY             50
     53 
     54 /* In non unicast measurement requests a random delay */
     55 /* between 4 and 40 milliseconds */
     56 #define MSR_ACTIVATION_DELAY_RANDOM     36
     57 #define MSR_ACTIVATION_DELAY_OFFSET     4
     58 
     59 
     60 /** \enum EMeasurementType
     61  * \brief different measurement types
     62  *
     63  * \par Description
     64  *
     65  * \sa
     66  */
     67 typedef enum
     68 {
     69 /*	0	*/	MSR_TYPE_BASIC_MEASUREMENT  = 0,			/**< */
     70 /*	1	*/	MSR_TYPE_CCA_LOAD_MEASUREMENT,				/**< */
     71 /*	2	*/	MSR_TYPE_NOISE_HISTOGRAM_MEASUREMENT,		/**< */
     72 /*	3	*/	MSR_TYPE_BEACON_MEASUREMENT,				/**< */
     73 /*	4	*/	MSR_TYPE_FRAME_MEASUREMENT,					/**< */
     74 /*	5	*/	MSR_TYPE_MAX_NUM_OF_MEASURE_TYPES			/**< */
     75 
     76 } EMeasurementType;
     77 
     78 /** \enum EMeasurementScanMode
     79  * \brief Measurement Scan Modes
     80  *
     81  * \par Description
     82  * enumerates the different scan modes available for beacon measurement
     83  *
     84  * \sa
     85  */
     86 typedef enum
     87 {
     88 /*	0	*/	MSR_SCAN_MODE_PASSIVE = 0,				/**< Passive Scan Mode			*/
     89 /*	1	*/	MSR_SCAN_MODE_ACTIVE,					/**< Active Scan Mode			*/
     90 /*	2	*/	MSR_SCAN_MODE_BEACON_TABLE,				/**< Beacon Table Scan Mode		*/
     91 /*	3	*/	MSR_SCAN_MODE_MAX_NUM_OF_SCAN_MODES		/**< Max number of Scan Modes	*/
     92 
     93 } EMeasurementScanMode;
     94 
     95 /** \enum EMeasurementFrameType
     96  * \brief Measurement Frame Types
     97  *
     98  * \par Description
     99  *
    100  * \sa
    101  */
    102 typedef enum
    103 {
    104 /*	0	*/	MSR_FRAME_TYPE_NO_ACTIVE = 0,	/**< */
    105 /*	1	*/	MSR_FRAME_TYPE_BROADCAST,		/**< */
    106 /*	2	*/	MSR_FRAME_TYPE_MULTICAST,		/**< */
    107 /*	3	*/	MSR_FRAME_TYPE_UNICAST			/**< */
    108 
    109 } EMeasurementFrameType;
    110 
    111 /** \enum EMeasurementMode
    112  * \brief Measurement Modes
    113  *
    114  * \par Description
    115  *
    116  * \sa
    117  */
    118 typedef enum
    119 {
    120 /*	0	*/	MSR_MODE_NONE = 0,				/**< */
    121 /*	1	*/	MSR_MODE_XCC,					/**< */
    122 /*	2	*/	MSR_MODE_SPECTRUM_MANAGEMENT	/**< */
    123 
    124 } EMeasurementMode;
    125 
    126 /** \enum EMeasurementRejectReason
    127  * \brief Measurement Reject Reason
    128  *
    129  * \par Description
    130  *
    131  * \sa
    132  */
    133 typedef enum
    134 {
    135 /*	1	*/	MSR_REJECT_OTHER_REASON = 1, 				/**< */
    136 /*	2	*/	MSR_REJECT_INVALID_MEASUREMENT_TYPE,		/**< */
    137 /*	3	*/	MSR_REJECT_DTIM_OVERLAP,					/**< */
    138 /*	4	*/	MSR_REJECT_DURATION_EXCEED_MAX_DURATION,	/**< */
    139 /*	5	*/	MSR_REJECT_TRAFFIC_INTENSITY_TOO_HIGH,		/**< */
    140 /*	6	*/	MSR_REJECT_SCR_UNAVAILABLE,					/**< */
    141 /*	7	*/	MSR_REJECT_MAX_DELAY_PASSED,				/**< */
    142 /*	8	*/	MSR_REJECT_INVALID_CHANNEL,					/**< */
    143 /*	9	*/	MSR_REJECT_NOISE_HIST_FAIL,					/**< */
    144 /*	10	*/	MSR_REJECT_CHANNEL_LOAD_FAIL,				/**< */
    145 /*	11	*/	MSR_REJECT_EMPTY_REPORT						/**< */
    146 
    147 } EMeasurementRejectReason;
    148 
    149  /*
    150  ***********************************************************************
    151  *  Unions.
    152  ***********************************************************************
    153  */
    154 /** \union TMeasurementReplyValue
    155  * \brief Measurement possible Reply Values
    156  *
    157  * \par Description
    158  *
    159  * \sa
    160  */
    161 typedef union
    162 {
    163     TI_UINT8                            CCABusyFraction;						/**< */
    164     TI_UINT8                            RPIDensity[ NOISE_HISTOGRAM_LENGTH ];   /**< */
    165 
    166 } TMeasurementReplyValue;
    167 
    168 /***********************************************************************
    169  *  Structure definitions.
    170  ***********************************************************************
    171  */
    172 /** \struct TMeasurementTypeRequest
    173  * \brief Measurement Type Request
    174  *
    175  * \par Description
    176  * This structure defines single channel parameters for normal scan operation (inc. triggered)
    177  *
    178  * \sa
    179  */
    180 typedef struct
    181 {
    182     EMeasurementType                    msrType;	/**< */
    183     EMeasurementScanMode                scanMode;	/**< */
    184     TI_UINT32                           duration;	/**< */
    185     TI_UINT8                            reserved;	/**< */
    186 
    187 } TMeasurementTypeRequest;
    188 
    189 /** \struct TMeasurementRequest
    190  * \brief Measurement Request
    191  *
    192  * \par Description
    193  * This structure defines measurement parameters of several measurement request types
    194  * for one channel
    195  *
    196  * \sa
    197  */
    198 typedef struct
    199 {
    200     ERadioBand                          band;												/**< */
    201     TI_UINT8                            channel;											/**< */
    202     TI_UINT64                           startTime;											/**< */
    203     TI_UINT8                            txPowerDbm;								  			/**< */
    204     EScanResultTag                      eTag;												/**< */
    205     TI_UINT8                            numberOfTypes;										/**< */
    206     TMeasurementTypeRequest             msrTypes[ MAX_NUM_OF_MSR_TYPES_IN_PARALLEL ];		/**< */
    207 
    208 } TMeasurementRequest;
    209 
    210 /** \struct TMeasurementTypeReply
    211  * \brief Measurement Type Reply
    212  *
    213  * \par Description
    214  * This structure defines the reply parameters for measurement of specific type performed
    215  * (the type is indicated in the msrType field)
    216  *
    217  * \sa
    218  */
    219 typedef struct
    220 {
    221     EMeasurementType                    msrType;		/**< The type of performed measurement the reply reffer to	*/
    222     TI_UINT8                            status;			/**< The status of measurement performed					*/
    223     TMeasurementReplyValue              replyValue;		/**< The Reply Value of performed measurement			 	*/
    224     TI_UINT8                            reserved;		/**< */
    225 
    226 } TMeasurementTypeReply;
    227 
    228 /** \struct TMeasurementReply
    229  * \brief Measurement Reply
    230  *
    231  * \par Description
    232  * This structure defines the reply parameters for some measurements of some types performed
    233  *
    234  * \sa
    235  */
    236 typedef struct
    237 {
    238     TI_UINT8                            numberOfTypes;									/**< Number of measurements types (equal to number of measurement replys)	*/
    239     TMeasurementTypeReply               msrTypes[ MAX_NUM_OF_MSR_TYPES_IN_PARALLEL ];	/**< Measurements Replys buffer. One Reply per type							*/
    240 
    241 } TMeasurementReply;
    242 
    243 /** \struct TMeasurementFrameHdr
    244  * \brief Measurement Frame Header
    245  *
    246  * \par Description
    247  * This structure defines a Header of a measurement
    248  *
    249  * \sa
    250  */
    251 typedef struct
    252 {
    253     TI_UINT16                           dialogToken;			/**< Indicates if the received Measurement is the same as the one that is being processed	*/
    254     TI_UINT8                            activatioDelay;			/**< */
    255     TI_UINT8                            measurementOffset;		/**< */
    256 
    257 } TMeasurementFrameHdr;
    258 
    259 /** \struct TMeasurementFrameRequest
    260  * \brief Measurement Frame Request
    261  *
    262  * \par Description
    263  *
    264  * \sa
    265  */
    266 typedef struct
    267 {
    268     TMeasurementFrameHdr                 *hdr; 			/**< */
    269     EMeasurementFrameType                frameType;		/**< */
    270     TI_UINT8                             *requests;		/**< */
    271     TI_INT32                             requestsLen;	/**< */
    272 
    273 } TMeasurementFrameRequest;
    274 
    275 
    276 #endif /* #define TWDDRIVERMSR_H */
    277