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