wmix.h 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276
  1. //------------------------------------------------------------------------------
  2. // <copyright file="wmix.h" company="Atheros">
  3. // Copyright (c) 2004-2007 Atheros Corporation. All rights reserved.
  4. //
  5. // This program is free software; you can redistribute it and/or modify
  6. // it under the terms of the GNU General Public License version 2 as
  7. // published by the Free Software Foundation;
  8. //
  9. // Software distributed under the License is distributed on an "AS
  10. // IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
  11. // implied. See the License for the specific language governing
  12. // rights and limitations under the License.
  13. //
  14. //
  15. //------------------------------------------------------------------------------
  16. //==============================================================================
  17. // Author(s): ="Atheros"
  18. //==============================================================================
  19. /*
  20. * This file contains extensions of the WMI protocol specified in the
  21. * Wireless Module Interface (WMI). It includes definitions of all
  22. * extended commands and events. Extensions include useful commands
  23. * that are not directly related to wireless activities. They may
  24. * be hardware-specific, and they might not be supported on all
  25. * implementations.
  26. *
  27. * Extended WMIX commands are encapsulated in a WMI message with
  28. * cmd=WMI_EXTENSION_CMD.
  29. */
  30. #ifndef _WMIX_H_
  31. #define _WMIX_H_
  32. #ifdef __cplusplus
  33. extern "C" {
  34. #endif
  35. #ifndef ATH_TARGET
  36. #include "athstartpack.h"
  37. #endif
  38. #include "dbglog.h"
  39. /*
  40. * Extended WMI commands are those that are needed during wireless
  41. * operation, but which are not really wireless commands. This allows,
  42. * for instance, platform-specific commands. Extended WMI commands are
  43. * embedded in a WMI command message with WMI_COMMAND_ID=WMI_EXTENSION_CMDID.
  44. * Extended WMI events are similarly embedded in a WMI event message with
  45. * WMI_EVENT_ID=WMI_EXTENSION_EVENTID.
  46. */
  47. typedef PREPACK struct {
  48. A_UINT32 commandId;
  49. } POSTPACK WMIX_CMD_HDR;
  50. typedef enum {
  51. WMIX_DSETOPEN_REPLY_CMDID = 0x2001,
  52. WMIX_DSETDATA_REPLY_CMDID,
  53. WMIX_GPIO_OUTPUT_SET_CMDID,
  54. WMIX_GPIO_INPUT_GET_CMDID,
  55. WMIX_GPIO_REGISTER_SET_CMDID,
  56. WMIX_GPIO_REGISTER_GET_CMDID,
  57. WMIX_GPIO_INTR_ACK_CMDID,
  58. WMIX_HB_CHALLENGE_RESP_CMDID,
  59. WMIX_DBGLOG_CFG_MODULE_CMDID,
  60. WMIX_PROF_CFG_CMDID, /* 0x200a */
  61. WMIX_PROF_ADDR_SET_CMDID,
  62. WMIX_PROF_START_CMDID,
  63. WMIX_PROF_STOP_CMDID,
  64. WMIX_PROF_COUNT_GET_CMDID,
  65. } WMIX_COMMAND_ID;
  66. typedef enum {
  67. WMIX_DSETOPENREQ_EVENTID = 0x3001,
  68. WMIX_DSETCLOSE_EVENTID,
  69. WMIX_DSETDATAREQ_EVENTID,
  70. WMIX_GPIO_INTR_EVENTID,
  71. WMIX_GPIO_DATA_EVENTID,
  72. WMIX_GPIO_ACK_EVENTID,
  73. WMIX_HB_CHALLENGE_RESP_EVENTID,
  74. WMIX_DBGLOG_EVENTID,
  75. WMIX_PROF_COUNT_EVENTID,
  76. } WMIX_EVENT_ID;
  77. /*
  78. * =============DataSet support=================
  79. */
  80. /*
  81. * WMIX_DSETOPENREQ_EVENTID
  82. * DataSet Open Request Event
  83. */
  84. typedef PREPACK struct {
  85. A_UINT32 dset_id;
  86. A_UINT32 targ_dset_handle; /* echo'ed, not used by Host, */
  87. A_UINT32 targ_reply_fn; /* echo'ed, not used by Host, */
  88. A_UINT32 targ_reply_arg; /* echo'ed, not used by Host, */
  89. } POSTPACK WMIX_DSETOPENREQ_EVENT;
  90. /*
  91. * WMIX_DSETCLOSE_EVENTID
  92. * DataSet Close Event
  93. */
  94. typedef PREPACK struct {
  95. A_UINT32 access_cookie;
  96. } POSTPACK WMIX_DSETCLOSE_EVENT;
  97. /*
  98. * WMIX_DSETDATAREQ_EVENTID
  99. * DataSet Data Request Event
  100. */
  101. typedef PREPACK struct {
  102. A_UINT32 access_cookie;
  103. A_UINT32 offset;
  104. A_UINT32 length;
  105. A_UINT32 targ_buf; /* echo'ed, not used by Host, */
  106. A_UINT32 targ_reply_fn; /* echo'ed, not used by Host, */
  107. A_UINT32 targ_reply_arg; /* echo'ed, not used by Host, */
  108. } POSTPACK WMIX_DSETDATAREQ_EVENT;
  109. typedef PREPACK struct {
  110. A_UINT32 status;
  111. A_UINT32 targ_dset_handle;
  112. A_UINT32 targ_reply_fn;
  113. A_UINT32 targ_reply_arg;
  114. A_UINT32 access_cookie;
  115. A_UINT32 size;
  116. A_UINT32 version;
  117. } POSTPACK WMIX_DSETOPEN_REPLY_CMD;
  118. typedef PREPACK struct {
  119. A_UINT32 status;
  120. A_UINT32 targ_buf;
  121. A_UINT32 targ_reply_fn;
  122. A_UINT32 targ_reply_arg;
  123. A_UINT32 length;
  124. A_UINT8 buf[1];
  125. } POSTPACK WMIX_DSETDATA_REPLY_CMD;
  126. /*
  127. * =============GPIO support=================
  128. * All masks are 18-bit masks with bit N operating on GPIO pin N.
  129. */
  130. #include "gpio.h"
  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. A_UINT32 set_mask; /* pins to set */
  142. A_UINT32 clear_mask; /* pins to clear */
  143. A_UINT32 enable_mask; /* pins to enable for output */
  144. A_UINT32 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. A_UINT32 gpioreg_id; /* GPIO register ID */
  153. A_UINT32 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. A_UINT32 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. A_UINT32 ack_mask; /* interrupts to acknowledge */
  166. } POSTPACK WMIX_GPIO_INTR_ACK_CMD;
  167. /*
  168. * Target informs Host of GPIO interrupts that have ocurred 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. A_UINT32 intr_mask; /* pending GPIO interrupts */
  175. A_UINT32 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. A_UINT32 value;
  194. A_UINT32 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. A_UINT32 cookie;
  205. A_UINT32 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. A_UINT32 period; /* Time (in 30.5us ticks) between samples */
  220. A_UINT32 nbins;
  221. } POSTPACK WMIX_PROF_CFG_CMD;
  222. typedef PREPACK struct {
  223. A_UINT32 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. A_UINT32 addr;
  233. A_UINT32 count;
  234. } POSTPACK WMIX_PROF_COUNT_EVENT;
  235. #ifndef ATH_TARGET
  236. #include "athendpack.h"
  237. #endif
  238. #ifdef __cplusplus
  239. }
  240. #endif
  241. #endif /* _WMIX_H_ */