/drivers/staging/ath6kl/include/common/wmix.h

https://bitbucket.org/wisechild/galaxy-nexus · C++ Header · 271 lines · 117 code · 33 blank · 121 comment · 0 complexity · c186c1e6faf7ef0e041012c84bb34533 MD5 · raw file

  1. //------------------------------------------------------------------------------
  2. // <copyright file="wmix.h" company="Atheros">
  3. // Copyright (c) 2004-2010 Atheros Corporation. All rights reserved.
  4. //
  5. //
  6. // Permission to use, copy, modify, and/or distribute this software for any
  7. // purpose with or without fee is hereby granted, provided that the above
  8. // copyright notice and this permission notice appear in all copies.
  9. //
  10. // THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
  11. // WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
  12. // MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
  13. // ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  14. // WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
  15. // ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  16. // OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  17. //
  18. //
  19. //------------------------------------------------------------------------------
  20. //==============================================================================
  21. // Author(s): ="Atheros"
  22. //==============================================================================
  23. /*
  24. * This file contains extensions of the WMI protocol specified in the
  25. * Wireless Module Interface (WMI). It includes definitions of all
  26. * extended commands and events. Extensions include useful commands
  27. * that are not directly related to wireless activities. They may
  28. * be hardware-specific, and they might not be supported on all
  29. * implementations.
  30. *
  31. * Extended WMIX commands are encapsulated in a WMI message with
  32. * cmd=WMI_EXTENSION_CMD.
  33. */
  34. #ifndef _WMIX_H_
  35. #define _WMIX_H_
  36. #ifdef __cplusplus
  37. extern "C" {
  38. #endif
  39. #include "dbglog.h"
  40. /*
  41. * Extended WMI commands are those that are needed during wireless
  42. * operation, but which are not really wireless commands. This allows,
  43. * for instance, platform-specific commands. Extended WMI commands are
  44. * embedded in a WMI command message with WMI_COMMAND_ID=WMI_EXTENSION_CMDID.
  45. * Extended WMI events are similarly embedded in a WMI event message with
  46. * WMI_EVENT_ID=WMI_EXTENSION_EVENTID.
  47. */
  48. typedef PREPACK struct {
  49. u32 commandId;
  50. } POSTPACK WMIX_CMD_HDR;
  51. typedef enum {
  52. WMIX_DSETOPEN_REPLY_CMDID = 0x2001,
  53. WMIX_DSETDATA_REPLY_CMDID,
  54. WMIX_GPIO_OUTPUT_SET_CMDID,
  55. WMIX_GPIO_INPUT_GET_CMDID,
  56. WMIX_GPIO_REGISTER_SET_CMDID,
  57. WMIX_GPIO_REGISTER_GET_CMDID,
  58. WMIX_GPIO_INTR_ACK_CMDID,
  59. WMIX_HB_CHALLENGE_RESP_CMDID,
  60. WMIX_DBGLOG_CFG_MODULE_CMDID,
  61. WMIX_PROF_CFG_CMDID, /* 0x200a */
  62. WMIX_PROF_ADDR_SET_CMDID,
  63. WMIX_PROF_START_CMDID,
  64. WMIX_PROF_STOP_CMDID,
  65. WMIX_PROF_COUNT_GET_CMDID,
  66. } WMIX_COMMAND_ID;
  67. typedef enum {
  68. WMIX_DSETOPENREQ_EVENTID = 0x3001,
  69. WMIX_DSETCLOSE_EVENTID,
  70. WMIX_DSETDATAREQ_EVENTID,
  71. WMIX_GPIO_INTR_EVENTID,
  72. WMIX_GPIO_DATA_EVENTID,
  73. WMIX_GPIO_ACK_EVENTID,
  74. WMIX_HB_CHALLENGE_RESP_EVENTID,
  75. WMIX_DBGLOG_EVENTID,
  76. WMIX_PROF_COUNT_EVENTID,
  77. } WMIX_EVENT_ID;
  78. /*
  79. * =============DataSet support=================
  80. */
  81. /*
  82. * WMIX_DSETOPENREQ_EVENTID
  83. * DataSet Open Request Event
  84. */
  85. typedef PREPACK struct {
  86. u32 dset_id;
  87. u32 targ_dset_handle; /* echo'ed, not used by Host, */
  88. u32 targ_reply_fn; /* echo'ed, not used by Host, */
  89. u32 targ_reply_arg; /* echo'ed, not used by Host, */
  90. } POSTPACK WMIX_DSETOPENREQ_EVENT;
  91. /*
  92. * WMIX_DSETCLOSE_EVENTID
  93. * DataSet Close Event
  94. */
  95. typedef PREPACK struct {
  96. u32 access_cookie;
  97. } POSTPACK WMIX_DSETCLOSE_EVENT;
  98. /*
  99. * WMIX_DSETDATAREQ_EVENTID
  100. * DataSet Data Request Event
  101. */
  102. typedef PREPACK struct {
  103. u32 access_cookie;
  104. u32 offset;
  105. u32 length;
  106. u32 targ_buf; /* echo'ed, not used by Host, */
  107. u32 targ_reply_fn; /* echo'ed, not used by Host, */
  108. u32 targ_reply_arg; /* echo'ed, not used by Host, */
  109. } POSTPACK WMIX_DSETDATAREQ_EVENT;
  110. typedef PREPACK struct {
  111. u32 status;
  112. u32 targ_dset_handle;
  113. u32 targ_reply_fn;
  114. u32 targ_reply_arg;
  115. u32 access_cookie;
  116. u32 size;
  117. u32 version;
  118. } POSTPACK WMIX_DSETOPEN_REPLY_CMD;
  119. typedef PREPACK struct {
  120. u32 status;
  121. u32 targ_buf;
  122. u32 targ_reply_fn;
  123. u32 targ_reply_arg;
  124. u32 length;
  125. u8 buf[1];
  126. } POSTPACK WMIX_DSETDATA_REPLY_CMD;
  127. /*
  128. * =============GPIO support=================
  129. * All masks are 18-bit masks with bit N operating on GPIO pin N.
  130. */
  131. /*
  132. * Set GPIO pin output state.
  133. * In order for output to be driven, a pin must be enabled for output.
  134. * This can be done during initialization through the GPIO Configuration
  135. * DataSet, or during operation with the enable_mask.
  136. *
  137. * If a request is made to simultaneously set/clear or set/disable or
  138. * clear/disable or disable/enable, results are undefined.
  139. */
  140. typedef PREPACK struct {
  141. u32 set_mask; /* pins to set */
  142. u32 clear_mask; /* pins to clear */
  143. u32 enable_mask; /* pins to enable for output */
  144. u32 disable_mask; /* pins to disable/tristate */
  145. } POSTPACK WMIX_GPIO_OUTPUT_SET_CMD;
  146. /*
  147. * Set a GPIO register. For debug/exceptional cases.
  148. * Values for gpioreg_id are GPIO_REGISTER_IDs, defined in a
  149. * platform-dependent header.
  150. */
  151. typedef PREPACK struct {
  152. u32 gpioreg_id; /* GPIO register ID */
  153. u32 value; /* value to write */
  154. } POSTPACK WMIX_GPIO_REGISTER_SET_CMD;
  155. /* Get a GPIO register. For debug/exceptional cases. */
  156. typedef PREPACK struct {
  157. u32 gpioreg_id; /* GPIO register to read */
  158. } POSTPACK WMIX_GPIO_REGISTER_GET_CMD;
  159. /*
  160. * Host acknowledges and re-arms GPIO interrupts. A single
  161. * message should be used to acknowledge all interrupts that
  162. * were delivered in an earlier WMIX_GPIO_INTR_EVENT message.
  163. */
  164. typedef PREPACK struct {
  165. u32 ack_mask; /* interrupts to acknowledge */
  166. } POSTPACK WMIX_GPIO_INTR_ACK_CMD;
  167. /*
  168. * Target informs Host of GPIO interrupts that have occurred since the
  169. * last WMIX_GIPO_INTR_ACK_CMD was received. Additional information --
  170. * the current GPIO input values is provided -- in order to support
  171. * use of a GPIO interrupt as a Data Valid signal for other GPIO pins.
  172. */
  173. typedef PREPACK struct {
  174. u32 intr_mask; /* pending GPIO interrupts */
  175. u32 input_values; /* recent GPIO input values */
  176. } POSTPACK WMIX_GPIO_INTR_EVENT;
  177. /*
  178. * Target responds to Host's earlier WMIX_GPIO_INPUT_GET_CMDID request
  179. * using a GPIO_DATA_EVENT with
  180. * value set to the mask of GPIO pin inputs and
  181. * reg_id set to GPIO_ID_NONE
  182. *
  183. *
  184. * Target responds to Hosts's earlier WMIX_GPIO_REGISTER_GET_CMDID request
  185. * using a GPIO_DATA_EVENT with
  186. * value set to the value of the requested register and
  187. * reg_id identifying the register (reflects the original request)
  188. * NB: reg_id supports the future possibility of unsolicited
  189. * WMIX_GPIO_DATA_EVENTs (for polling GPIO input), and it may
  190. * simplify Host GPIO support.
  191. */
  192. typedef PREPACK struct {
  193. u32 value;
  194. u32 reg_id;
  195. } POSTPACK WMIX_GPIO_DATA_EVENT;
  196. /*
  197. * =============Error Detection support=================
  198. */
  199. /*
  200. * WMIX_HB_CHALLENGE_RESP_CMDID
  201. * Heartbeat Challenge Response command
  202. */
  203. typedef PREPACK struct {
  204. u32 cookie;
  205. u32 source;
  206. } POSTPACK WMIX_HB_CHALLENGE_RESP_CMD;
  207. /*
  208. * WMIX_HB_CHALLENGE_RESP_EVENTID
  209. * Heartbeat Challenge Response Event
  210. */
  211. #define WMIX_HB_CHALLENGE_RESP_EVENT WMIX_HB_CHALLENGE_RESP_CMD
  212. typedef PREPACK struct {
  213. struct dbglog_config_s config;
  214. } POSTPACK WMIX_DBGLOG_CFG_MODULE_CMD;
  215. /*
  216. * =============Target Profiling support=================
  217. */
  218. typedef PREPACK struct {
  219. u32 period; /* Time (in 30.5us ticks) between samples */
  220. u32 nbins;
  221. } POSTPACK WMIX_PROF_CFG_CMD;
  222. typedef PREPACK struct {
  223. u32 addr;
  224. } POSTPACK WMIX_PROF_ADDR_SET_CMD;
  225. /*
  226. * Target responds to Hosts's earlier WMIX_PROF_COUNT_GET_CMDID request
  227. * using a WMIX_PROF_COUNT_EVENT with
  228. * addr set to the next address
  229. * count set to the corresponding count
  230. */
  231. typedef PREPACK struct {
  232. u32 addr;
  233. u32 count;
  234. } POSTPACK WMIX_PROF_COUNT_EVENT;
  235. #ifdef __cplusplus
  236. }
  237. #endif
  238. #endif /* _WMIX_H_ */