pre-merge coding style cleanup and code review
[helenos.git] / uspace / drv / nic / ar9271 / wmi.h
blobbc01e986662b8bbc50ddc37e1a909d251dd95635
1 /*
2 * Copyright (c) 2014 Jan Kolarik
3 * All rights reserved.
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
9 * - Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * - Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 * - The name of the author may not be used to endorse or promote products
15 * derived from this software without specific prior written permission.
17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 /** @file wmi.h
31 * Definitions of the Atheros WMI protocol specified in the
32 * Wireless Module Interface (WMI).
36 #ifndef ATHEROS_WMI_H
37 #define ATHEROS_WMI_H
39 #include "htc.h"
41 /* Macros for creating service identificators. */
42 #define WMI_SERVICE_GROUP 1
44 #define CREATE_SERVICE_ID(group, i) \
45 (unsigned int) (((unsigned int) group << 8) | (unsigned int) (i))
47 #define WMI_MGMT_CMD_MASK 0x1000
49 /** WMI header structure.
52 typedef struct {
53 uint16_t command_id; /**< Big Endian value! */
54 uint16_t sequence_number; /**< Big Endian value! */
55 } __attribute__((packed)) wmi_command_header_t;
57 /** WMI services IDs
60 typedef enum {
61 WMI_CONTROL_SERVICE = CREATE_SERVICE_ID(WMI_SERVICE_GROUP, 0),
62 WMI_BEACON_SERVICE = CREATE_SERVICE_ID(WMI_SERVICE_GROUP, 1),
63 WMI_CAB_SERVICE = CREATE_SERVICE_ID(WMI_SERVICE_GROUP, 2),
64 WMI_UAPSD_SERVICE = CREATE_SERVICE_ID(WMI_SERVICE_GROUP, 3),
65 WMI_MGMT_SERVICE = CREATE_SERVICE_ID(WMI_SERVICE_GROUP, 4),
66 WMI_DATA_VOICE_SERVICE = CREATE_SERVICE_ID(WMI_SERVICE_GROUP, 5),
67 WMI_DATA_VIDEO_SERVICE = CREATE_SERVICE_ID(WMI_SERVICE_GROUP, 6),
68 WMI_DATA_BE_SERVICE = CREATE_SERVICE_ID(WMI_SERVICE_GROUP, 7),
69 WMI_DATA_BK_SERVICE = CREATE_SERVICE_ID(WMI_SERVICE_GROUP, 8)
70 } wmi_services_t;
72 /** List of WMI commands
75 typedef enum {
76 WMI_ECHO = 0x0001,
77 WMI_ACCESS_MEMORY,
79 /* Commands used for HOST -> DEVICE communication */
80 WMI_GET_FW_VERSION,
81 WMI_DISABLE_INTR,
82 WMI_ENABLE_INTR,
83 WMI_ATH_INIT,
84 WMI_ABORT_TXQ,
85 WMI_STOP_TX_DMA,
86 WMI_ABORT_TX_DMA,
87 WMI_DRAIN_TXQ,
88 WMI_DRAIN_TXQ_ALL,
89 WMI_START_RECV,
90 WMI_STOP_RECV,
91 WMI_FLUSH_RECV,
92 WMI_SET_MODE,
93 WMI_NODE_CREATE,
94 WMI_NODE_REMOVE,
95 WMI_VAP_REMOVE,
96 WMI_VAP_CREATE,
97 WMI_REG_READ,
98 WMI_REG_WRITE,
99 WMI_RC_STATE_CHANGE,
100 WMI_RC_RATE_UPDATE,
101 WMI_TARGET_IC_UPDATE,
102 WMI_TX_AGGR_ENABLE,
103 WMI_TGT_DETACH,
104 WMI_NODE_UPDATE,
105 WMI_INT_STATS,
106 WMI_TX_STATS,
107 WMI_RX_STATS,
108 WMI_BITRATE_MASK
109 } wmi_command_t;
111 /**Structure used when sending registry buffer
114 typedef struct {
115 uint32_t offset; /**< Big Endian value! */
116 uint32_t value; /**< Big Endian value! */
117 } wmi_reg_t;
119 extern int wmi_reg_read(htc_device_t *, uint32_t, uint32_t *);
120 extern int wmi_reg_write(htc_device_t *, uint32_t, uint32_t);
121 extern int wmi_reg_set_clear_bit(htc_device_t *, uint32_t, uint32_t, uint32_t);
122 extern int wmi_reg_set_bit(htc_device_t *, uint32_t, uint32_t);
123 extern int wmi_reg_clear_bit(htc_device_t *, uint32_t, uint32_t);
124 extern int wmi_reg_buffer_write(htc_device_t *, wmi_reg_t *, size_t);
125 extern int wmi_send_command(htc_device_t *, wmi_command_t, uint8_t *, uint32_t,
126 void *);
128 #endif /* ATHEROS_WMI_H */