| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
#ifndef __CARL9170FW_CARL9170_H |
| 23 |
#define __CARL9170FW_CARL9170_H |
| 24 |
|
| 25 |
#include "generated/autoconf.h" |
| 26 |
#include "version.h" |
| 27 |
#include "config.h" |
| 28 |
#include "types.h" |
| 29 |
#include "compiler.h" |
| 30 |
#include "unaligned.h" |
| 31 |
#include "fwcmd.h" |
| 32 |
#include "hw.h" |
| 33 |
#include "dma.h" |
| 34 |
#include "usb.h" |
| 35 |
#include "cmd.h" |
| 36 |
|
| 37 |
struct carl9170_bar_ctx { |
| 38 |
uint8_t ta[6]; |
| 39 |
uint8_t ra[6]; |
| 40 |
__le16 start_seq_num; |
| 41 |
__le16 control; |
| 42 |
}; |
| 43 |
|
| 44 |
enum carl9170_cab_trigger { |
| 45 |
CARL9170_CAB_TRIGGER_EMPTY = 0, |
| 46 |
CARL9170_CAB_TRIGGER_ARMED = BIT(0), |
| 47 |
CARL9170_CAB_TRIGGER_DEFER = BIT(1), |
| 48 |
}; |
| 49 |
|
| 50 |
enum carl9170_ep0_action { |
| 51 |
CARL9170_EP0_NO_ACTION = 0, |
| 52 |
CARL9170_EP0_STALL = BIT(0), |
| 53 |
CARL9170_EP0_TRIGGER = BIT(1), |
| 54 |
}; |
| 55 |
|
| 56 |
enum carl9170_mac_reset_state { |
| 57 |
CARL9170_MAC_RESET_OFF = 0, |
| 58 |
CARL9170_MAC_RESET_ARMED, |
| 59 |
CARL9170_MAC_RESET_RESET, |
| 60 |
CARL9170_MAC_RESET_FORCE, |
| 61 |
}; |
| 62 |
|
| 63 |
enum carl9170_suspend_mode { |
| 64 |
CARL9170_HOST_AWAKE = 0, |
| 65 |
CARL9170_HOST_SUSPENDED, |
| 66 |
CARL9170_AWAKE_HOST, |
| 67 |
}; |
| 68 |
|
| 69 |
enum carl9170_phy_state { |
| 70 |
CARL9170_PHY_OFF = 0, |
| 71 |
CARL9170_PHY_ON |
| 72 |
}; |
| 73 |
|
| 74 |
typedef void (*fw_desc_callback_t)(void *, const bool); |
| 75 |
|
| 76 |
|
| 77 |
|
| 78 |
|
| 79 |
|
| 80 |
|
| 81 |
struct firmware_context_struct { |
| 82 |
|
| 83 |
unsigned int ticks_per_usec; |
| 84 |
unsigned int counter; |
| 85 |
|
| 86 |
|
| 87 |
unsigned int watchdog_enable; |
| 88 |
unsigned int reboot; |
| 89 |
unsigned int suspend_mode; |
| 90 |
|
| 91 |
struct { |
| 92 |
|
| 93 |
struct dma_queue up_queue; |
| 94 |
struct dma_queue down_queue; |
| 95 |
} pta; |
| 96 |
|
| 97 |
struct { |
| 98 |
|
| 99 |
struct dma_queue tx_queue[__AR9170_NUM_TX_QUEUES]; |
| 100 |
struct dma_queue tx_retry; |
| 101 |
struct dma_queue rx_queue; |
| 102 |
|
| 103 |
|
| 104 |
struct carl9170_tx_superframe *ampdu_prev[__AR9170_NUM_TX_QUEUES]; |
| 105 |
|
| 106 |
|
| 107 |
unsigned int last_super_num[__AR9170_NUM_TX_QUEUES]; |
| 108 |
struct carl9170_tx_superframe *last_super[__AR9170_NUM_TX_QUEUES]; |
| 109 |
unsigned int mac_reset; |
| 110 |
unsigned int soft_int; |
| 111 |
|
| 112 |
|
| 113 |
unsigned int rx_filter; |
| 114 |
|
| 115 |
|
| 116 |
unsigned int sequence[CARL9170_INTF_NUM]; |
| 117 |
|
| 118 |
|
| 119 |
struct dma_queue cab_queue[CARL9170_INTF_NUM]; |
| 120 |
unsigned int cab_queue_len[CARL9170_INTF_NUM]; |
| 121 |
unsigned int cab_flush_time; |
| 122 |
enum carl9170_cab_trigger cab_flush_trigger[CARL9170_INTF_NUM]; |
| 123 |
|
| 124 |
|
| 125 |
unsigned int tx_status_pending, |
| 126 |
tx_status_head_idx, |
| 127 |
tx_status_tail_idx; |
| 128 |
struct carl9170_tx_status tx_status_cache[CARL9170_TX_STATUS_NUM]; |
| 129 |
|
| 130 |
|
| 131 |
struct dma_desc *fw_desc; |
| 132 |
unsigned int fw_desc_available; |
| 133 |
void *fw_desc_data; |
| 134 |
fw_desc_callback_t fw_desc_callback; |
| 135 |
|
| 136 |
|
| 137 |
struct carl9170_bar_ctx ba_cache[CONFIG_CARL9170FW_BACK_REQS_NUM]; |
| 138 |
unsigned int ba_tail_idx, |
| 139 |
ba_head_idx, |
| 140 |
queued_ba; |
| 141 |
|
| 142 |
unsigned int queued_bar; |
| 143 |
} wlan; |
| 144 |
|
| 145 |
struct { |
| 146 |
unsigned int config, |
| 147 |
interface_setting, |
| 148 |
alternate_interface_setting, |
| 149 |
device_feature; |
| 150 |
enum carl9170_ep0_action ep0_action; |
| 151 |
|
| 152 |
void *ep0_txrx_buffer; |
| 153 |
unsigned int ep0_txrx_len, |
| 154 |
ep0_txrx_pos; |
| 155 |
|
| 156 |
struct ar9170_usb_config *cfg_desc; |
| 157 |
struct ar9170_usb_config *os_cfg_desc; |
| 158 |
|
| 159 |
|
| 160 |
|
| 161 |
|
| 162 |
|
| 163 |
|
| 164 |
|
| 165 |
unsigned int int_pending, |
| 166 |
int_desc_available, |
| 167 |
int_head_index, |
| 168 |
int_tail_index; |
| 169 |
struct dma_desc *int_desc; |
| 170 |
struct carl9170_rsp int_buf[CARL9170_INT_RQ_CACHES]; |
| 171 |
|
| 172 |
#ifdef CONFIG_CARL9170FW_DEBUG_USB |
| 173 |
|
| 174 |
unsigned int put_index; |
| 175 |
uint8_t put_buffer[CARL9170_MAX_CMD_PAYLOAD_LEN]; |
| 176 |
#endif |
| 177 |
|
| 178 |
} usb; |
| 179 |
|
| 180 |
struct { |
| 181 |
#ifdef CONFIG_CARL9170FW_RADIO_FUNCTIONS |
| 182 |
|
| 183 |
|
| 184 |
|
| 185 |
unsigned int frequency; |
| 186 |
unsigned int ht_settings; |
| 187 |
|
| 188 |
enum carl9170_phy_state state; |
| 189 |
struct carl9170_psm psm; |
| 190 |
#endif |
| 191 |
} phy; |
| 192 |
|
| 193 |
unsigned int tally_clock; |
| 194 |
struct carl9170_tally_rsp tally; |
| 195 |
unsigned int tx_time; |
| 196 |
|
| 197 |
#ifdef CONFIG_CARL9170FW_WOL |
| 198 |
struct { |
| 199 |
struct carl9170_wol_cmd cmd; |
| 200 |
unsigned int last_beacon; |
| 201 |
unsigned int lost_null; |
| 202 |
unsigned int last_null; |
| 203 |
bool wake_up; |
| 204 |
} wol; |
| 205 |
#endif |
| 206 |
|
| 207 |
#ifdef CONFIG_CARL9170FW_GPIO_INTERRUPT |
| 208 |
struct carl9170_gpio cached_gpio_state; |
| 209 |
#endif |
| 210 |
}; |
| 211 |
|
| 212 |
|
| 213 |
|
| 214 |
|
| 215 |
|
| 216 |
|
| 217 |
extern struct firmware_context_struct fw; |
| 218 |
#endif |