[59fa7ab] | 1 | /*
|
---|
| 2 | * Copyright (c) 2014 Jan Kolarik
|
---|
| 3 | * All rights reserved.
|
---|
| 4 | *
|
---|
| 5 | * Redistribution and use in source and binary forms, with or without
|
---|
| 6 | * modification, are permitted provided that the following conditions
|
---|
| 7 | * are met:
|
---|
| 8 | *
|
---|
| 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.
|
---|
| 16 | *
|
---|
| 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.
|
---|
| 27 | */
|
---|
| 28 |
|
---|
| 29 | /** @file wmi.h
|
---|
| 30 | *
|
---|
[1b20da0] | 31 | * Definitions of the Atheros WMI protocol specified in the
|
---|
[59fa7ab] | 32 | * Wireless Module Interface (WMI).
|
---|
| 33 | *
|
---|
| 34 | */
|
---|
| 35 |
|
---|
| 36 | #ifndef ATHEROS_WMI_H
|
---|
[8a64320e] | 37 | #define ATHEROS_WMI_H
|
---|
[59fa7ab] | 38 |
|
---|
| 39 | #include "htc.h"
|
---|
| 40 |
|
---|
| 41 | /* Macros for creating service identificators. */
|
---|
[8a64320e] | 42 | #define WMI_SERVICE_GROUP 1
|
---|
[59fa7ab] | 43 |
|
---|
[8a64320e] | 44 | #define CREATE_SERVICE_ID(group, i) \
|
---|
| 45 | (unsigned int) (((unsigned int) group << 8) | (unsigned int) (i))
|
---|
[1dcc0b9] | 46 |
|
---|
[8a64320e] | 47 | #define WMI_MGMT_CMD_MASK 0x1000
|
---|
| 48 |
|
---|
| 49 | /** WMI header structure.
|
---|
| 50 | *
|
---|
[59fa7ab] | 51 | */
|
---|
| 52 | typedef struct {
|
---|
[8a64320e] | 53 | uint16_t command_id; /**< Big Endian value! */
|
---|
| 54 | uint16_t sequence_number; /**< Big Endian value! */
|
---|
[59fa7ab] | 55 | } __attribute__((packed)) wmi_command_header_t;
|
---|
| 56 |
|
---|
[8a64320e] | 57 | /** WMI services IDs
|
---|
| 58 | *
|
---|
[59fa7ab] | 59 | */
|
---|
| 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;
|
---|
| 71 |
|
---|
[8a64320e] | 72 | /** List of WMI commands
|
---|
| 73 | *
|
---|
[59fa7ab] | 74 | */
|
---|
| 75 | typedef enum {
|
---|
| 76 | WMI_ECHO = 0x0001,
|
---|
| 77 | WMI_ACCESS_MEMORY,
|
---|
[a35b458] | 78 |
|
---|
[59fa7ab] | 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;
|
---|
| 110 |
|
---|
[8a64320e] | 111 | /**Structure used when sending registry buffer
|
---|
| 112 | *
|
---|
[59fa7ab] | 113 | */
|
---|
| 114 | typedef struct {
|
---|
[8a64320e] | 115 | uint32_t offset; /**< Big Endian value! */
|
---|
| 116 | uint32_t value; /**< Big Endian value! */
|
---|
[59fa7ab] | 117 | } wmi_reg_t;
|
---|
| 118 |
|
---|
[b7fd2a0] | 119 | extern errno_t wmi_reg_read(htc_device_t *, uint32_t, uint32_t *);
|
---|
| 120 | extern errno_t wmi_reg_write(htc_device_t *, uint32_t, uint32_t);
|
---|
| 121 | extern errno_t wmi_reg_set_clear_bit(htc_device_t *, uint32_t, uint32_t, uint32_t);
|
---|
| 122 | extern errno_t wmi_reg_set_bit(htc_device_t *, uint32_t, uint32_t);
|
---|
| 123 | extern errno_t wmi_reg_clear_bit(htc_device_t *, uint32_t, uint32_t);
|
---|
| 124 | extern errno_t wmi_reg_buffer_write(htc_device_t *, wmi_reg_t *, size_t);
|
---|
| 125 | extern errno_t wmi_send_command(htc_device_t *, wmi_command_t, uint8_t *, uint32_t,
|
---|
[8a64320e] | 126 | void *);
|
---|
[59fa7ab] | 127 |
|
---|
[8a64320e] | 128 | #endif /* ATHEROS_WMI_H */
|
---|