TWD/FirmwareApi/public_types.h
changeset 0 10c42ec6c05f
equal deleted inserted replaced
-1:000000000000 0:10c42ec6c05f
       
     1 /*
       
     2  * public_types.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 /**********************************************************************************************************************
       
    40 
       
    41   FILENAME:       public_types.h
       
    42 
       
    43   DESCRIPTION:    Basic types and general macros, bit manipulations, etc.
       
    44 
       
    45 
       
    46 
       
    47 ***********************************************************************************************************************/
       
    48 #ifndef PUBLIC_TYPES_H
       
    49 #define PUBLIC_TYPES_H
       
    50  
       
    51 
       
    52 /******************************************************************************
       
    53 
       
    54     Basic definitions
       
    55 
       
    56 ******************************************************************************/
       
    57 #ifndef uint8
       
    58 typedef unsigned char   uint8;
       
    59 #endif
       
    60 #ifndef uint16
       
    61 typedef unsigned short  uint16;
       
    62 #endif
       
    63 #ifndef uint32
       
    64 typedef unsigned long int    uint32;
       
    65 #endif
       
    66 #ifndef uint64
       
    67 typedef unsigned long long    uint64;
       
    68 #endif
       
    69 
       
    70 
       
    71 #ifndef int8
       
    72 typedef signed char     int8;
       
    73 #endif
       
    74 #ifndef int16
       
    75 typedef short           int16;
       
    76 #endif
       
    77 #ifndef int32
       
    78 typedef long int        int32;
       
    79 #endif
       
    80 #ifndef int64
       
    81 typedef long long       int64;
       
    82 #endif
       
    83 
       
    84 
       
    85 #ifdef HOST_COMPILE
       
    86     #ifndef TI_TRUE
       
    87     #define TI_TRUE  1
       
    88     #endif
       
    89     #ifndef TI_FALSE
       
    90     #define TI_FALSE 0
       
    91     #endif
       
    92 #else
       
    93     #ifndef TRUE
       
    94     #define TRUE  1
       
    95     #endif
       
    96     #ifndef FALSE
       
    97     #define FALSE 0
       
    98     #endif
       
    99     #define STATIC			static
       
   100     #define INLINE			inline
       
   101 #endif
       
   102 
       
   103 /* !! LAC - NULL definition conflicts with the compilers version.
       
   104    I redid this definition to the ANSI version....
       
   105     #define NULL 0
       
   106 */
       
   107 #if !defined( NULL )
       
   108 #if defined( __cplusplus )
       
   109 #define NULL 0
       
   110 #else
       
   111 #define NULL ((void *)0)
       
   112 #endif
       
   113 #endif
       
   114 
       
   115 /* Bool_e should be used when we need it to be a byte. */
       
   116 typedef uint8           Bool_e;
       
   117 
       
   118 /* Bool32 should be used whenever possible for efficiency */
       
   119 typedef uint32          Bool32;
       
   120 
       
   121 /* to align enum to 32/16 bits */
       
   122 #define MAX_POSITIVE32 0x7FFFFFFF
       
   123 #define MAX_POSITIVE16 0x7FFF
       
   124 #define MAX_POSITIVE8  0x7F
       
   125 
       
   126 #define MAC_ADDR_SIZE							6   /* In Bytes */
       
   127 #define MAC_ADDRESS_MANUFACTURE_TYPE_LENGHT		3   /* In Bytes */
       
   128 #define MAC_ADDRESS_STATION_ID_LENGHT			3   /* In Bytes */
       
   129 
       
   130 #ifdef HOST_COMPILE
       
   131 #else
       
   132 typedef struct macAddress_t
       
   133 {
       
   134     uint8 addr[MAC_ADDR_SIZE];
       
   135 }macAddress_t;
       
   136 #endif
       
   137 
       
   138 
       
   139 #define  BIT_0    0x00000001
       
   140 #define  BIT_1    0x00000002
       
   141 #define  BIT_2    0x00000004
       
   142 #define  BIT_3    0x00000008
       
   143 #define  BIT_4    0x00000010
       
   144 #define  BIT_5    0x00000020
       
   145 #define  BIT_6    0x00000040
       
   146 #define  BIT_7    0x00000080
       
   147 #define  BIT_8    0x00000100
       
   148 #define  BIT_9    0x00000200
       
   149 #define  BIT_10   0x00000400
       
   150 #define  BIT_11   0x00000800
       
   151 #define  BIT_12   0x00001000
       
   152 #define  BIT_13   0x00002000
       
   153 #define  BIT_14   0x00004000
       
   154 #define  BIT_15   0x00008000
       
   155 #define  BIT_16   0x00010000
       
   156 #define  BIT_17   0x00020000
       
   157 #define  BIT_18   0x00040000
       
   158 #define  BIT_19   0x00080000
       
   159 #define  BIT_20   0x00100000
       
   160 #define  BIT_21   0x00200000
       
   161 #define  BIT_22   0x00400000
       
   162 #define  BIT_23   0x00800000
       
   163 #define  BIT_24   0x01000000
       
   164 #define  BIT_25   0x02000000
       
   165 #define  BIT_26   0x04000000
       
   166 #define  BIT_27   0x08000000
       
   167 #define  BIT_28   0x10000000
       
   168 #define  BIT_29   0x20000000
       
   169 #define  BIT_30   0x40000000
       
   170 #define  BIT_31   0x80000000
       
   171 
       
   172 #define  BIT_32   0x00000001
       
   173 #define  BIT_33   0x00000002
       
   174 #define  BIT_34   0x00000004
       
   175 #define  BIT_35   0x00000008
       
   176 #define  BIT_36   0x00000010
       
   177 #define  BIT_37   0x00000020
       
   178 #define  BIT_38   0x00000040
       
   179 #define  BIT_39   0x00000080
       
   180 #define  BIT_40   0x00000100
       
   181 #define  BIT_41   0x00000200
       
   182 #define  BIT_42   0x00000400
       
   183 #define  BIT_43   0x00000800
       
   184 #define  BIT_44   0x00001000
       
   185 #define  BIT_45   0x00002000
       
   186 #define  BIT_46   0x00004000
       
   187 #define  BIT_47   0x00008000
       
   188 #define  BIT_48   0x00010000
       
   189 #define  BIT_49   0x00020000
       
   190 #define  BIT_50   0x00040000
       
   191 #define  BIT_51   0x00080000
       
   192 #define  BIT_52   0x00100000
       
   193 #define  BIT_53   0x00200000
       
   194 #define  BIT_54   0x00400000
       
   195 #define  BIT_55   0x00800000
       
   196 #define  BIT_56   0x01000000
       
   197 #define  BIT_57   0x02000000
       
   198 #define  BIT_58   0x04000000
       
   199 #define  BIT_59   0x08000000
       
   200 #define  BIT_60   0x10000000
       
   201 #define  BIT_61   0x20000000
       
   202 #define  BIT_62   0x40000000
       
   203 #define  BIT_63   0x80000000
       
   204 
       
   205 
       
   206 /******************************************************************************
       
   207 
       
   208     CHANNELS, BAND & REG DOMAINS definitions
       
   209 
       
   210 ******************************************************************************/
       
   211 
       
   212 
       
   213 typedef uint8 Channel_e;
       
   214 
       
   215 typedef enum
       
   216 {
       
   217     RADIO_BAND_2_4GHZ = 0,  /* 2.4 Ghz band */
       
   218     RADIO_BAND_5GHZ = 1,    /* 5 Ghz band */
       
   219     RADIO_BAND_JAPAN_4_9_GHZ = 2,
       
   220     DEFAULT_BAND = RADIO_BAND_2_4GHZ,
       
   221     INVALID_BAND = 0x7E,
       
   222     MAX_RADIO_BANDS = 0x7F
       
   223 } RadioBand_enum;
       
   224 
       
   225 #ifdef HOST_COMPILE
       
   226 typedef uint8 RadioBand_e;
       
   227 #else
       
   228 typedef RadioBand_enum RadioBand_e;
       
   229 #endif
       
   230 
       
   231 /* The following enum is used in the FW for HIF interface only !!!!! */
       
   232 typedef enum
       
   233 {
       
   234     HW_BIT_RATE_1MBPS   = BIT_0 ,
       
   235     HW_BIT_RATE_2MBPS   = BIT_1 ,
       
   236     HW_BIT_RATE_5_5MBPS = BIT_2 ,
       
   237     HW_BIT_RATE_6MBPS   = BIT_3 ,
       
   238     HW_BIT_RATE_9MBPS   = BIT_4 ,
       
   239     HW_BIT_RATE_11MBPS  = BIT_5 ,
       
   240     HW_BIT_RATE_12MBPS  = BIT_6 ,
       
   241     HW_BIT_RATE_18MBPS  = BIT_7 ,
       
   242     HW_BIT_RATE_22MBPS  = BIT_8 ,
       
   243     HW_BIT_RATE_24MBPS  = BIT_9 ,
       
   244     HW_BIT_RATE_36MBPS  = BIT_10,
       
   245     HW_BIT_RATE_48MBPS  = BIT_11,
       
   246     HW_BIT_RATE_54MBPS  = BIT_12,
       
   247     HW_BIT_RATE_MCS_0  	= BIT_13,
       
   248     HW_BIT_RATE_MCS_1  	= BIT_14,
       
   249     HW_BIT_RATE_MCS_2  	= BIT_15,
       
   250     HW_BIT_RATE_MCS_3  	= BIT_16,
       
   251     HW_BIT_RATE_MCS_4  	= BIT_17,
       
   252     HW_BIT_RATE_MCS_5  	= BIT_18,
       
   253     HW_BIT_RATE_MCS_6  	= BIT_19,
       
   254     HW_BIT_RATE_MCS_7  	= BIT_20
       
   255 } EHwBitRate;
       
   256 
       
   257 /* The following enum is used in the FW for HIF interface only !!!!! */
       
   258 typedef enum
       
   259 {
       
   260     txPolicyMcs7 = 0,
       
   261     txPolicyMcs6,
       
   262     txPolicyMcs5,
       
   263     txPolicyMcs4,
       
   264     txPolicyMcs3,
       
   265     txPolicyMcs2,
       
   266     txPolicyMcs1,
       
   267     txPolicyMcs0,
       
   268     txPolicy54,
       
   269     txPolicy48,
       
   270     txPolicy36,
       
   271     txPolicy24,
       
   272     txPolicy22,
       
   273     txPolicy18,
       
   274     txPolicy12,
       
   275     txPolicy11,
       
   276     txPolicy9,
       
   277     txPolicy6,
       
   278     txPolicy5_5,
       
   279     txPolicy2,
       
   280     txPolicy1,
       
   281     MAX_NUM_OF_TX_RATES_IN_CLASS,
       
   282     TX_RATE_INDEX_ENUM_MAX_SIZE = 0xFF
       
   283 } ETxRateClassId;
       
   284 
       
   285 
       
   286 
       
   287 
       
   288 #define SHORT_PREAMBLE_BIT   BIT_0 /* CCK or Barker depending on the rate */
       
   289 #define OFDM_RATE_BIT        BIT_6
       
   290 #define PBCC_RATE_BIT        BIT_7
       
   291 
       
   292 
       
   293 typedef enum
       
   294 {
       
   295     CCK_LONG = 0,
       
   296     CCK_SHORT = SHORT_PREAMBLE_BIT,
       
   297     PBCC_LONG = PBCC_RATE_BIT,
       
   298     PBCC_SHORT = PBCC_RATE_BIT | SHORT_PREAMBLE_BIT,
       
   299     OFDM = OFDM_RATE_BIT
       
   300 } Mod_enum;
       
   301 
       
   302 #ifdef HOST_COMPILE
       
   303 typedef  uint8 Mod_e;
       
   304 #else
       
   305 typedef  Mod_enum Mod_e;
       
   306 #endif
       
   307 
       
   308 
       
   309 typedef uint16 BasicRateSet_t;
       
   310 
       
   311 
       
   312 /******************************************************************************
       
   313 
       
   314 Transmit-Descriptor RATE-SET field definitions...
       
   315 
       
   316 ******************************************************************************/
       
   317 
       
   318 typedef uint32 EHwRateBitFiled;/* set with EHwBitRate values */
       
   319 
       
   320 #ifdef HOST_COMPILE
       
   321 typedef uint8  TxRateIndex_t;  /* set with ETxRateClassId values */
       
   322 #else 
       
   323 typedef ETxRateClassId TxRateIndex_t;
       
   324 #endif
       
   325 
       
   326 /******************************************************************************
       
   327  
       
   328     CHIP_ID definitions
       
   329  
       
   330 ******************************************************************************/
       
   331 #define TNETW1150_PG10_CHIP_ID          0x04010101
       
   332 #define TNETW1150_PG11_CHIP_ID          0x04020101
       
   333 #define TNETW1150_CHIP_ID               0x04030101  /* 1150 PG2.0, 1250, 1350, 1450*/
       
   334 #define TNETW1350A_CHIP_ID              0x06010101
       
   335 #define TNETW1251_CHIP_ID_PG1_0         0x07010101
       
   336 #define TNETW1251_CHIP_ID_PG1_1         0x07020101
       
   337 #define TNETW1251_CHIP_ID_PG1_2	        0x07030101
       
   338 #define TNETW1273_CHIP_ID_PG1_0	        0x04030101
       
   339 #define TNETW1273_CHIP_ID_PG1_1	        0x04030111 
       
   340 
       
   341 #define CHECK_CHIP_ID(chipId) (CHIP_ID_B == chipId)
       
   342 
       
   343 /******************************************************************************
       
   344 Enable bits for SOC1251 PG1.2
       
   345 ******************************************************************************/
       
   346 #define PDET_BINARY_OFFSET_EN   BIT_0
       
   347 #define STOP_TOGGLE_MONADC_EN   BIT_1
       
   348 #define RX_ADC_BIAS_DEC_EN      BIT_2
       
   349 #define RX_LNB_AND_DIGI_GAIN_EN BIT_3
       
   350 
       
   351 
       
   352 #endif /* PUBLIC_TYPES_H*/