Changeset 8a64320e in mainline for uspace/drv/nic/ar9271/htc.h
- Timestamp:
- 2015-04-23T23:40:14Z (10 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- dcba819
- Parents:
- 09044cb
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/nic/ar9271/htc.h
r09044cb r8a64320e 29 29 /** @file htc.h 30 30 * 31 * Definitions of the Atheros HTC (Host Target Communication) technology 31 * Definitions of the Atheros HTC (Host Target Communication) technology 32 32 * for communication between host (PC) and target (device firmware). 33 33 * … … 35 35 36 36 #ifndef ATHEROS_HTC_H 37 #define 37 #define ATHEROS_HTC_H 38 38 39 39 #include <ieee80211.h> … … 41 41 #include <sys/types.h> 42 42 #include <nic.h> 43 44 43 #include "ath.h" 45 44 46 #define HTC_RTS_THRESHOLD 230447 #define HTC_RATES_MAX_LENGTH 3048 49 /** 50 * HTC message IDs.45 #define HTC_RTS_THRESHOLD 2304 46 #define HTC_RATES_MAX_LENGTH 30 47 48 /** HTC message IDs. 49 * 51 50 */ 52 51 typedef enum { 53 52 HTC_MESSAGE_READY = 1, 54 53 HTC_MESSAGE_CONNECT_SERVICE, 55 56 57 54 HTC_MESSAGE_CONNECT_SERVICE_RESPONSE, 55 HTC_MESSAGE_SETUP_COMPLETE, 56 HTC_MESSAGE_CONFIG 58 57 } htc_message_id_t; 59 58 60 /** 61 * HTC response message status codes.59 /** HTC response message status codes. 60 * 62 61 */ 63 62 typedef enum { 64 65 66 67 68 63 HTC_SERVICE_SUCCESS = 0, 64 HTC_SERVICE_NOT_FOUND, 65 HTC_SERVICE_FAILED, 66 HTC_SERVICE_NO_RESOURCES, 67 HTC_SERVICE_NO_MORE_EP 69 68 } htc_response_status_code_t; 70 69 71 /** 72 * HTC operating mode definition.70 /** HTC operating mode definition. 71 * 73 72 */ 74 73 typedef enum { … … 79 78 } htc_operating_mode_t; 80 79 81 /** 82 * HTC data type indicator.80 /** HTC data type indicator. 81 * 83 82 */ 84 83 typedef enum { … … 89 88 } htc_data_type_t; 90 89 91 /** 92 * HTC endpoint numbers.93 */ 94 typedef struct { 95 90 /** HTC endpoint numbers. 91 * 92 */ 93 typedef struct { 94 int ctrl_endpoint; 96 95 int wmi_endpoint; 97 96 int beacon_endpoint; … … 105 104 } htc_pipes_t; 106 105 107 /** 108 * HTC device data.109 */ 110 typedef struct { 111 112 113 106 /** HTC device data. 107 * 108 */ 109 typedef struct { 110 /** WMI message sequence number */ 111 uint16_t sequence_number; 112 114 113 /** HTC endpoints numbers */ 115 114 htc_pipes_t endpoints; … … 128 127 } htc_device_t; 129 128 130 /** 131 * HTC frame header structure.132 */ 133 typedef struct { 134 uint8_t 135 uint8_t 136 uint16_t payload_length;/**< Big Endian value! */137 uint8_t 129 /** HTC frame header structure. 130 * 131 */ 132 typedef struct { 133 uint8_t endpoint_id; 134 uint8_t flags; 135 uint16_t payload_length; /**< Big Endian value! */ 136 uint8_t control_bytes[4]; 138 137 } __attribute__((packed)) htc_frame_header_t; 139 138 140 /** 141 * HTC management TX frame header structure.139 /** HTC management TX frame header structure. 140 * 142 141 */ 143 142 typedef struct { … … 152 151 } __attribute__((packed)) htc_tx_management_header_t; 153 152 154 /** 155 * HTC data TX frame header structure.153 /** HTC data TX frame header structure. 154 * 156 155 */ 157 156 typedef struct { … … 160 159 uint8_t vif_idx; 161 160 uint8_t tidno; 162 uint32_t flags; 161 uint32_t flags; /**< Big Endian value! */ 163 162 uint8_t key_type; 164 163 uint8_t keyix; … … 167 166 } __attribute__((packed)) htc_tx_data_header_t; 168 167 169 /** 170 * HTC ready message structure.171 */ 172 typedef struct { 173 uint16_t message_id;/**< Big Endian value! */174 uint16_t credits;/**< Big Endian value! */175 uint16_t credit_size;/**< Big Endian value! */176 177 168 /** HTC ready message structure. 169 * 170 */ 171 typedef struct { 172 uint16_t message_id; /**< Big Endian value! */ 173 uint16_t credits; /**< Big Endian value! */ 174 uint16_t credit_size; /**< Big Endian value! */ 175 176 uint8_t max_endpoints; 178 177 uint8_t pad; 179 178 } __attribute__((packed)) htc_ready_msg_t; 180 179 181 /** 182 * HTC service message structure.183 */ 184 typedef struct { 185 uint16_t message_id; 186 uint16_t service_id; 187 uint16_t connection_flags; 180 /** HTC service message structure. 181 * 182 */ 183 typedef struct { 184 uint16_t message_id; /**< Big Endian value! */ 185 uint16_t service_id; /**< Big Endian value! */ 186 uint16_t connection_flags; /**< Big Endian value! */ 188 187 189 188 uint8_t download_pipe_id; … … 193 192 } __attribute__((packed)) htc_service_msg_t; 194 193 195 /** 196 * HTC service response message structure.197 */ 198 typedef struct { 199 uint16_t message_id;/**< Big Endian value! */200 uint16_t service_id;/**< Big Endian value! */201 202 203 uint16_t max_message_length;/**< Big Endian value! */204 205 194 /** HTC service response message structure. 195 * 196 */ 197 typedef struct { 198 uint16_t message_id; /**< Big Endian value! */ 199 uint16_t service_id; /**< Big Endian value! */ 200 uint8_t status; 201 uint8_t endpoint_id; 202 uint16_t max_message_length; /**< Big Endian value! */ 203 uint8_t service_meta_length; 204 uint8_t pad; 206 205 } __attribute__((packed)) htc_service_resp_msg_t; 207 206 208 /** 209 * HTC credits config message structure.210 */ 211 typedef struct { 212 uint16_t message_id;/**< Big Endian value! */213 214 207 /** HTC credits config message structure. 208 * 209 */ 210 typedef struct { 211 uint16_t message_id; /**< Big Endian value! */ 212 uint8_t pipe_id; 213 uint8_t credits; 215 214 } __attribute__((packed)) htc_config_msg_t; 216 215 217 /** 218 * HTC new virtual interface message.219 */ 220 typedef struct { 221 216 /** HTC new virtual interface message. 217 * 218 */ 219 typedef struct { 220 uint8_t index; 222 221 uint8_t op_mode; 223 222 uint8_t addr[ETH_ADDR]; 224 223 uint8_t ath_cap; 225 uint16_t rts_thres; 224 uint16_t rts_thres; /**< Big Endian value! */ 226 225 uint8_t pad; 227 226 } __attribute__((packed)) htc_vif_msg_t; 228 227 229 /** 230 * HTC new station message.228 /** HTC new station message. 229 * 231 230 */ 232 231 typedef struct { 233 232 uint8_t addr[ETH_ADDR]; 234 233 uint8_t bssid[ETH_ADDR]; 235 234 uint8_t sta_index; 236 235 uint8_t vif_index; 237 236 uint8_t is_vif_sta; 238 239 uint16_t flags; 240 uint16_t ht_cap; 241 uint16_t max_ampdu; 237 238 uint16_t flags; /**< Big Endian value! */ 239 uint16_t ht_cap; /**< Big Endian value! */ 240 uint16_t max_ampdu; /**< Big Endian value! */ 242 241 243 242 uint8_t pad; 244 243 } __attribute__((packed)) htc_sta_msg_t; 245 244 246 /** 247 * HTC message to inform target about available capabilities.248 */ 249 typedef struct { 250 uint32_t ampdu_limit; 245 /** HTC message to inform target about available capabilities. 246 * 247 */ 248 typedef struct { 249 uint32_t ampdu_limit; /**< Big Endian value! */ 251 250 uint8_t ampdu_subframes; 252 251 uint8_t enable_coex; … … 258 257 uint8_t sta_index; 259 258 uint8_t is_new; 260 uint32_t cap_flags; 259 uint32_t cap_flags; /**< Big Endian value! */ 261 260 uint8_t legacy_rates_count; 262 261 uint8_t legacy_rates[HTC_RATES_MAX_LENGTH]; … … 264 263 } htc_rate_msg_t; 265 264 266 /** 267 * HTC RX status structure used in incoming HTC data messages.268 */ 269 typedef struct { 270 uint64_t timestamp; 271 uint16_t data_length; 265 /** HTC RX status structure used in incoming HTC data messages. 266 * 267 */ 268 typedef struct { 269 uint64_t timestamp; /**< Big Endian value! */ 270 uint16_t data_length; /**< Big Endian value! */ 272 271 uint8_t status; 273 272 uint8_t phy_err; … … 284 283 uint8_t flags; 285 284 uint8_t dummy; 286 uint32_t evm0; 287 uint32_t evm1; 288 uint32_t evm2; 285 uint32_t evm0; /**< Big Endian value! */ 286 uint32_t evm1; /**< Big Endian value! */ 287 uint32_t evm2; /**< Big Endian value! */ 289 288 } htc_rx_status_t; 290 289 291 /** 292 * HTC setup complete message structure293 */ 294 typedef struct { 295 uint16_t message_id;/**< Big Endian value! */290 /** HTC setup complete message structure 291 * 292 */ 293 typedef struct { 294 uint16_t message_id; /**< Big Endian value! */ 296 295 } __attribute__((packed)) htc_setup_complete_msg_t; 297 296 298 extern int htc_device_init(ath_t *ath_device, ieee80211_dev_t *ieee80211_dev, 299 htc_device_t *htc_device); 300 extern int htc_init(htc_device_t *htc_device); 301 extern int htc_init_new_vif(htc_device_t *htc_device); 302 extern int htc_read_control_message(htc_device_t *htc_device, void *buffer, 303 size_t buffer_size, size_t *transferred_size); 304 extern int htc_read_data_message(htc_device_t *htc_device, void *buffer, 305 size_t buffer_size, size_t *transferred_size); 306 extern int htc_send_control_message(htc_device_t *htc_device, void *buffer, 307 size_t buffer_size, uint8_t endpoint_id); 308 extern int htc_send_data_message(htc_device_t *htc_device, void *buffer, 309 size_t buffer_size, uint8_t endpoint_id); 310 311 #endif /* ATHEROS_HTC_H */ 312 297 extern int htc_device_init(ath_t *, ieee80211_dev_t *, htc_device_t *); 298 extern int htc_init(htc_device_t *); 299 extern int htc_init_new_vif(htc_device_t *); 300 extern int htc_read_control_message(htc_device_t *, void *, size_t, size_t *); 301 extern int htc_read_data_message(htc_device_t *, void *, size_t, size_t *); 302 extern int htc_send_control_message(htc_device_t *, void *, size_t, uint8_t); 303 extern int htc_send_data_message(htc_device_t *, void *, size_t, uint8_t); 304 305 #endif /* ATHEROS_HTC_H */
Note:
See TracChangeset
for help on using the changeset viewer.