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