PageRenderTime 53ms CodeModel.GetById 21ms RepoModel.GetById 0ms app.codeStats 0ms

/drivers/net/wireless/tiwlan1251/common/src/hal/FirmwareApi/public_types.h

http://github.com/CyanogenMod/cm-kernel
C Header | 325 lines | 200 code | 42 blank | 83 comment | 3 complexity | bbde4a8624ad28cb044b0ac373586960 MD5 | raw file
Possible License(s): AGPL-1.0, GPL-2.0, LGPL-2.0
  1. /****************************************************************************
  2. **+-----------------------------------------------------------------------+**
  3. **| |**
  4. **| Copyright(c) 1998 - 2008 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. /** \file public_types.h
  36. * \brief Basic types and general macros, bit manipulations, etc.
  37. *
  38. */
  39. #ifndef PUBLIC_TYPES_H
  40. #define PUBLIC_TYPES_H
  41. /******************************************************************************
  42. Basic definitions
  43. ******************************************************************************/
  44. #ifndef uint8
  45. typedef unsigned char uint8;
  46. #endif
  47. #ifndef uint16
  48. typedef unsigned short uint16;
  49. #endif
  50. #ifndef uint32
  51. typedef unsigned long int uint32;
  52. #endif
  53. #ifndef int8
  54. typedef signed char int8;
  55. #endif
  56. #ifndef int16
  57. typedef short int16;
  58. #endif
  59. #ifndef int32
  60. typedef long int int32;
  61. #endif
  62. #ifndef TRUE
  63. #define TRUE 1
  64. #endif
  65. #ifndef FALSE
  66. #define FALSE 0
  67. #endif
  68. /* !! LAC - NULL definition conflicts with the compilers version.
  69. I redid this definition to the ANSI version....
  70. #define NULL 0
  71. */
  72. #if !defined( NULL )
  73. #if defined( __cplusplus )
  74. #define NULL 0
  75. #else
  76. #define NULL ((void *)0)
  77. #endif
  78. #endif
  79. /* Bool_e should be used when we need it to be a byte. */
  80. typedef uint8 Bool_e;
  81. /* Bool32 should be used whenever possible for efficiency */
  82. typedef uint32 Bool32;
  83. /* to align enum to 32/16 bits */
  84. #define MAX_POSITIVE32 0x7FFFFFFF
  85. #define MAX_POSITIVE16 0x7FFF
  86. #define MAC_ADDR_SIZE 6
  87. #ifndef HOST_COMPILE
  88. #define HOST_COMPILE /* temp fix for suppl build err */
  89. #endif
  90. #ifdef HOST_COMPILE
  91. #else
  92. typedef struct macAddress_t
  93. {
  94. uint8 addr[MAC_ADDR_SIZE];
  95. }macAddress_t;
  96. #endif
  97. #define BIT_0 0x00000001
  98. #define BIT_1 0x00000002
  99. #define BIT_2 0x00000004
  100. #define BIT_3 0x00000008
  101. #define BIT_4 0x00000010
  102. #define BIT_5 0x00000020
  103. #define BIT_6 0x00000040
  104. #define BIT_7 0x00000080
  105. #define BIT_8 0x00000100
  106. #define BIT_9 0x00000200
  107. #define BIT_10 0x00000400
  108. #define BIT_11 0x00000800
  109. #define BIT_12 0x00001000
  110. #define BIT_13 0x00002000
  111. #define BIT_14 0x00004000
  112. #define BIT_15 0x00008000
  113. #define BIT_16 0x00010000
  114. #define BIT_17 0x00020000
  115. #define BIT_18 0x00040000
  116. #define BIT_19 0x00080000
  117. #define BIT_20 0x00100000
  118. #define BIT_21 0x00200000
  119. #define BIT_22 0x00400000
  120. #define BIT_23 0x00800000
  121. #define BIT_24 0x01000000
  122. #define BIT_25 0x02000000
  123. #define BIT_26 0x04000000
  124. #define BIT_27 0x08000000
  125. #define BIT_28 0x10000000
  126. #define BIT_29 0x20000000
  127. #define BIT_30 0x40000000
  128. #define BIT_31 0x80000000
  129. #define BIT_32 0x00000001
  130. #define BIT_33 0x00000002
  131. #define BIT_34 0x00000004
  132. #define BIT_35 0x00000008
  133. #define BIT_36 0x00000010
  134. #define BIT_37 0x00000020
  135. #define BIT_38 0x00000040
  136. #define BIT_39 0x00000080
  137. #define BIT_40 0x00000100
  138. #define BIT_41 0x00000200
  139. #define BIT_42 0x00000400
  140. #define BIT_43 0x00000800
  141. #define BIT_44 0x00001000
  142. #define BIT_45 0x00002000
  143. #define BIT_46 0x00004000
  144. #define BIT_47 0x00008000
  145. #define BIT_48 0x00010000
  146. #define BIT_49 0x00020000
  147. #define BIT_50 0x00040000
  148. #define BIT_51 0x00080000
  149. #define BIT_52 0x00100000
  150. #define BIT_53 0x00200000
  151. #define BIT_54 0x00400000
  152. #define BIT_55 0x00800000
  153. #define BIT_56 0x01000000
  154. #define BIT_57 0x02000000
  155. #define BIT_58 0x04000000
  156. #define BIT_59 0x08000000
  157. #define BIT_60 0x10000000
  158. #define BIT_61 0x20000000
  159. #define BIT_62 0x40000000
  160. #define BIT_63 0x80000000
  161. /******************************************************************************
  162. CHANNELS, BAND & REG DOMAINS definitions
  163. ******************************************************************************/
  164. typedef uint8 Channel_e;
  165. typedef enum
  166. {
  167. RADIO_BAND_2_4GHZ = 0, /* 2.4 Ghz band */
  168. RADIO_BAND_5GHZ = 1, /* 5 Ghz band */
  169. RADIO_BAND_JAPAN_4_9_GHZ = 2,
  170. DEFAULT_BAND = RADIO_BAND_2_4GHZ,
  171. INVALID_BAND = 0xFE,
  172. MAX_RADIO_BANDS = 0xFF
  173. } RadioBand_enum;
  174. #ifdef HOST_COMPILE
  175. typedef uint8 RadioBand_e;
  176. #else
  177. typedef RadioBand_enum RadioBand_e;
  178. #endif
  179. typedef enum
  180. {
  181. NO_RATE = 0,
  182. RATE_1MBPS = 0x0A,
  183. RATE_2MBPS = 0x14,
  184. RATE_5_5MBPS = 0x37,
  185. RATE_6MBPS = 0x0B,
  186. RATE_9MBPS = 0x0F,
  187. RATE_11MBPS = 0x6E,
  188. RATE_12MBPS = 0x0A,
  189. RATE_18MBPS = 0x0E,
  190. RATE_22MBPS = 0xDC,
  191. RATE_24MBPS = 0x09,
  192. RATE_36MBPS = 0x0D,
  193. RATE_48MBPS = 0x08,
  194. RATE_54MBPS = 0x0C
  195. } Rate_enum;
  196. #ifdef HOST_COMPILE
  197. typedef uint8 Rate_e;
  198. #else
  199. typedef Rate_enum Rate_e;
  200. #endif
  201. typedef enum
  202. {
  203. RATE_INDEX_1MBPS = 0,
  204. RATE_INDEX_2MBPS = 1,
  205. RATE_INDEX_5_5MBPS = 2,
  206. RATE_INDEX_6MBPS = 3,
  207. RATE_INDEX_9MBPS = 4,
  208. RATE_INDEX_11MBPS = 5,
  209. RATE_INDEX_12MBPS = 6,
  210. RATE_INDEX_18MBPS = 7,
  211. RATE_INDEX_22MBPS = 8,
  212. RATE_INDEX_24MBPS = 9,
  213. RATE_INDEX_36MBPS = 10,
  214. RATE_INDEX_48MBPS = 11,
  215. RATE_INDEX_54MBPS = 12,
  216. RATE_INDEX_MAX = RATE_INDEX_54MBPS,
  217. MAX_RATE_INDEX,
  218. INVALID_RATE_INDEX = MAX_RATE_INDEX,
  219. RATE_INDEX_ENUM_MAX_SIZE = 0x7FFFFFFF
  220. } RateIndex_e;
  221. #define SHORT_PREAMBLE_BIT BIT_0 /* CCK or Barker depending on the rate */
  222. #define OFDM_RATE_BIT BIT_6
  223. #define PBCC_RATE_BIT BIT_7
  224. typedef enum
  225. {
  226. CCK_LONG = 0,
  227. CCK_SHORT = SHORT_PREAMBLE_BIT,
  228. PBCC_LONG = PBCC_RATE_BIT,
  229. PBCC_SHORT = PBCC_RATE_BIT | SHORT_PREAMBLE_BIT,
  230. OFDM = OFDM_RATE_BIT
  231. } Mod_enum;
  232. #ifdef HOST_COMPILE
  233. typedef uint8 Mod_e;
  234. #else
  235. typedef Mod_enum Mod_e;
  236. #endif
  237. typedef uint16 BasicRateSet_t;
  238. /******************************************************************************
  239. Transmit-Descriptor RATE-SET field definitions...
  240. Define a new "Rate-Set" for TX path that incorporates the
  241. Rate & Modulation info into a single 16-bit field.
  242. TxdRateSet_t:
  243. b15 - Indicates Preamble type (1=SHORT, 0=LONG).
  244. Notes:
  245. Must be LONG (0) for 1Mbps rate.
  246. Does not apply (set to 0) for RevG-OFDM rates.
  247. b14 - Indicates PBCC encoding (1=PBCC, 0=not).
  248. Notes:
  249. Does not apply (set to 0) for rates 1 and 2 Mbps.
  250. Does not apply (set to 0) for RevG-OFDM rates.
  251. b13 - Unused (set to 0).
  252. b12-b0 - Supported Rate indicator bits as defined below.
  253. ******************************************************************************/
  254. typedef uint16 TxdRateSet_t;
  255. /******************************************************************************
  256. CHIP_ID definitions
  257. ******************************************************************************/
  258. #define TNETW1150_PG10_CHIP_ID 0x04010101
  259. #define TNETW1150_PG11_CHIP_ID 0x04020101
  260. #define TNETW1150_CHIP_ID 0x04030101 /* 1150 PG2.0, 1250, 1350, 1450*/
  261. #define TNETW1350A_CHIP_ID 0x06010101
  262. #define TNETW1251_CHIP_ID_PG1_0 0x07010101
  263. #define TNETW1251_CHIP_ID_PG1_1 0x07020101
  264. #define TNETW1251_CHIP_ID_PG1_2 0x07030101
  265. #define IS_CHIP_PG_LESS_THEN_PG12() ((CHIP_ID == TNETW1251_CHIP_ID_PG1_0) || (CHIP_ID == TNETW1251_CHIP_ID_PG1_1))
  266. /******************************************************************************
  267. Enable bits for SOC1251 PG1.2
  268. ******************************************************************************/
  269. #define PDET_BINARY_OFFSET_EN BIT_0
  270. #define STOP_TOGGLE_MONADC_EN BIT_1
  271. #define RX_ADC_BIAS_DEC_EN BIT_2
  272. #define RX_LNB_AND_DIGI_GAIN_EN BIT_3
  273. #endif /* PUBLIC_TYPES_H*/