| 1 | /* |
| 2 | * Copyright (c) 2004-2005 Atheros Communications Inc. |
| 3 | * All rights reserved. |
| 4 | * |
| 5 | * |
| 6 | * $ATH_LICENSE_HOSTSDK0_C$ |
| 7 | * |
| 8 | * This file contains extensions of the WMI protocol specified in the |
| 9 | * Wireless Module Interface (WMI). It includes definitions of all |
| 10 | * extended commands and events. Extensions include useful commands |
| 11 | * that are not directly related to wireless activities. They may |
| 12 | * be hardware-specific, and they might not be supported on all |
| 13 | * implementations. |
| 14 | * |
| 15 | * Extended WMIX commands are encapsulated in a WMI message with |
| 16 | * cmd=WMI_EXTENSION_CMD. |
| 17 | * |
| 18 | */ |
| 19 | |
| 20 | #ifndef _WMIX_H_ |
| 21 | #define _WMIX_H_ |
| 22 | |
| 23 | #ifdef __cplusplus |
| 24 | extern "C" { |
| 25 | #endif |
| 26 | |
| 27 | #ifndef ATH_TARGET |
| 28 | #include "athstartpack.h" |
| 29 | #endif |
| 30 | |
| 31 | #include "dbglog.h" |
| 32 | |
| 33 | /* |
| 34 | * Extended WMI commands are those that are needed during wireless |
| 35 | * operation, but which are not really wireless commands. This allows, |
| 36 | * for instance, platform-specific commands. Extended WMI commands are |
| 37 | * embedded in a WMI command message with WMI_COMMAND_ID=WMI_EXTENSION_CMDID. |
| 38 | * Extended WMI events are similarly embedded in a WMI event message with |
| 39 | * WMI_EVENT_ID=WMI_EXTENSION_EVENTID. |
| 40 | */ |
| 41 | typedef PREPACK struct { |
| 42 | A_UINT32 commandId; |
| 43 | } POSTPACK WMIX_CMD_HDR; |
| 44 | |
| 45 | typedef enum { |
| 46 | WMIX_DSETOPEN_REPLY_CMDID = 0x2001, |
| 47 | WMIX_DSETDATA_REPLY_CMDID, |
| 48 | WMIX_GPIO_OUTPUT_SET_CMDID, |
| 49 | WMIX_GPIO_INPUT_GET_CMDID, |
| 50 | WMIX_GPIO_REGISTER_SET_CMDID, |
| 51 | WMIX_GPIO_REGISTER_GET_CMDID, |
| 52 | WMIX_GPIO_INTR_ACK_CMDID, |
| 53 | WMIX_HB_CHALLENGE_RESP_CMDID, |
| 54 | WMIX_DBGLOG_CFG_MODULE_CMDID, |
| 55 | } WMIX_COMMAND_ID; |
| 56 | |
| 57 | typedef enum { |
| 58 | WMIX_DSETOPENREQ_EVENTID = 0x3001, |
| 59 | WMIX_DSETCLOSE_EVENTID, |
| 60 | WMIX_DSETDATAREQ_EVENTID, |
| 61 | WMIX_GPIO_INTR_EVENTID, |
| 62 | WMIX_GPIO_DATA_EVENTID, |
| 63 | WMIX_GPIO_ACK_EVENTID, |
| 64 | WMIX_HB_CHALLENGE_RESP_EVENTID, |
| 65 | WMIX_DBGLOG_EVENTID, |
| 66 | } WMIX_EVENT_ID; |
| 67 | |
| 68 | /* |
| 69 | * =============DataSet support================= |
| 70 | */ |
| 71 | |
| 72 | /* |
| 73 | * WMIX_DSETOPENREQ_EVENTID |
| 74 | * DataSet Open Request Event |
| 75 | */ |
| 76 | typedef PREPACK struct { |
| 77 | A_UINT32 dset_id; |
| 78 | A_UINT32 targ_dset_handle; /* echo'ed, not used by Host, */ |
| 79 | A_UINT32 targ_reply_fn; /* echo'ed, not used by Host, */ |
| 80 | A_UINT32 targ_reply_arg; /* echo'ed, not used by Host, */ |
| 81 | } POSTPACK WMIX_DSETOPENREQ_EVENT; |
| 82 | |
| 83 | /* |
| 84 | * WMIX_DSETCLOSE_EVENTID |
| 85 | * DataSet Close Event |
| 86 | */ |
| 87 | typedef PREPACK struct { |
| 88 | A_UINT32 access_cookie; |
| 89 | } POSTPACK WMIX_DSETCLOSE_EVENT; |
| 90 | |
| 91 | /* |
| 92 | * WMIX_DSETDATAREQ_EVENTID |
| 93 | * DataSet Data Request Event |
| 94 | */ |
| 95 | typedef PREPACK struct { |
| 96 | A_UINT32 access_cookie; |
| 97 | A_UINT32 offset; |
| 98 | A_UINT32 length; |
| 99 | A_UINT32 targ_buf; /* echo'ed, not used by Host, */ |
| 100 | A_UINT32 targ_reply_fn; /* echo'ed, not used by Host, */ |
| 101 | A_UINT32 targ_reply_arg; /* echo'ed, not used by Host, */ |
| 102 | } POSTPACK WMIX_DSETDATAREQ_EVENT; |
| 103 | |
| 104 | typedef PREPACK struct { |
| 105 | A_UINT32 status; |
| 106 | A_UINT32 targ_dset_handle; |
| 107 | A_UINT32 targ_reply_fn; |
| 108 | A_UINT32 targ_reply_arg; |
| 109 | A_UINT32 access_cookie; |
| 110 | A_UINT32 size; |
| 111 | A_UINT32 version; |
| 112 | } POSTPACK WMIX_DSETOPEN_REPLY_CMD; |
| 113 | |
| 114 | typedef PREPACK struct { |
| 115 | A_UINT32 status; |
| 116 | A_UINT32 targ_buf; |
| 117 | A_UINT32 targ_reply_fn; |
| 118 | A_UINT32 targ_reply_arg; |
| 119 | A_UINT32 length; |
| 120 | A_UINT8 buf[1]; |
| 121 | } POSTPACK WMIX_DSETDATA_REPLY_CMD; |
| 122 | |
| 123 | |
| 124 | /* |
| 125 | * =============GPIO support================= |
| 126 | * All masks are 18-bit masks with bit N operating on GPIO pin N. |
| 127 | */ |
| 128 | |
| 129 | #include "gpio.h" |
| 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 | 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 | /* |
| 148 | * Set a GPIO register. For debug/exceptional cases. |
| 149 | * Values for gpioreg_id are GPIO_REGISTER_IDs, defined in a |
| 150 | * platform-dependent header. |
| 151 | */ |
| 152 | typedef PREPACK struct { |
| 153 | A_UINT32 gpioreg_id; /* GPIO register ID */ |
| 154 | A_UINT32 value; /* value to write */ |
| 155 | } POSTPACK WMIX_GPIO_REGISTER_SET_CMD; |
| 156 | |
| 157 | /* Get a GPIO register. For debug/exceptional cases. */ |
| 158 | typedef PREPACK struct { |
| 159 | A_UINT32 gpioreg_id; /* GPIO register to read */ |
| 160 | } POSTPACK WMIX_GPIO_REGISTER_GET_CMD; |
| 161 | |
| 162 | /* |
| 163 | * Host acknowledges and re-arms GPIO interrupts. A single |
| 164 | * message should be used to acknowledge all interrupts that |
| 165 | * were delivered in an earlier WMIX_GPIO_INTR_EVENT message. |
| 166 | */ |
| 167 | typedef PREPACK struct { |
| 168 | A_UINT32 ack_mask; /* interrupts to acknowledge */ |
| 169 | } POSTPACK WMIX_GPIO_INTR_ACK_CMD; |
| 170 | |
| 171 | /* |
| 172 | * Target informs Host of GPIO interrupts that have ocurred since the |
| 173 | * last WMIX_GIPO_INTR_ACK_CMD was received. Additional information -- |
| 174 | * the current GPIO input values is provided -- in order to support |
| 175 | * use of a GPIO interrupt as a Data Valid signal for other GPIO pins. |
| 176 | */ |
| 177 | typedef PREPACK struct { |
| 178 | A_UINT32 intr_mask; /* pending GPIO interrupts */ |
| 179 | A_UINT32 input_values; /* recent GPIO input values */ |
| 180 | } POSTPACK WMIX_GPIO_INTR_EVENT; |
| 181 | |
| 182 | /* |
| 183 | * Target responds to Host's earlier WMIX_GPIO_INPUT_GET_CMDID request |
| 184 | * using a GPIO_DATA_EVENT with |
| 185 | * value set to the mask of GPIO pin inputs and |
| 186 | * reg_id set to GPIO_ID_NONE |
| 187 | * |
| 188 | * |
| 189 | * Target responds to Hosts's earlier WMIX_GPIO_REGISTER_GET_CMDID request |
| 190 | * using a GPIO_DATA_EVENT with |
| 191 | * value set to the value of the requested register and |
| 192 | * reg_id identifying the register (reflects the original request) |
| 193 | * NB: reg_id supports the future possibility of unsolicited |
| 194 | * WMIX_GPIO_DATA_EVENTs (for polling GPIO input), and it may |
| 195 | * simplify Host GPIO support. |
| 196 | */ |
| 197 | typedef PREPACK struct { |
| 198 | A_UINT32 value; |
| 199 | A_UINT32 reg_id; |
| 200 | } POSTPACK WMIX_GPIO_DATA_EVENT; |
| 201 | |
| 202 | /* |
| 203 | * =============Error Detection support================= |
| 204 | */ |
| 205 | |
| 206 | /* |
| 207 | * WMIX_HB_CHALLENGE_RESP_CMDID |
| 208 | * Heartbeat Challenge Response command |
| 209 | */ |
| 210 | typedef PREPACK struct { |
| 211 | A_UINT32 cookie; |
| 212 | A_UINT32 source; |
| 213 | } POSTPACK WMIX_HB_CHALLENGE_RESP_CMD; |
| 214 | |
| 215 | /* |
| 216 | * WMIX_HB_CHALLENGE_RESP_EVENTID |
| 217 | * Heartbeat Challenge Response Event |
| 218 | */ |
| 219 | #define WMIX_HB_CHALLENGE_RESP_EVENT WMIX_HB_CHALLENGE_RESP_CMD |
| 220 | |
| 221 | typedef PREPACK struct { |
| 222 | struct dbglog_config_s config; |
| 223 | } POSTPACK WMIX_DBGLOG_CFG_MODULE_CMD; |
| 224 | |
| 225 | #ifndef ATH_TARGET |
| 226 | #include "athendpack.h" |
| 227 | #endif |
| 228 | |
| 229 | #ifdef __cplusplus |
| 230 | } |
| 231 | #endif |
| 232 | |
| 233 | #endif /* _WMIX_H_ */ |
| 234 | |