/*
* carl9170 firmware - used by the ar9170 wireless device
*
- * WLAN
+ * shared WLAN functions, interfaces and definitions
*
* Copyright (c) 2000-2005 ZyDAS Technology Corporation
* Copyright (c) 2007-2009 Atheros Communications, Inc.
* Copyright 2009 Johannes Berg <johannes@sipsolutions.net>
- * Copyright 2009, 2010 Christian Lamparter <chunkeey@googlemail.com>
+ * Copyright 2009-2011 Christian Lamparter <chunkeey@googlemail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ * with this program; If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __CARL9170FW_WLAN_H
set(AR9170_MAC_REG_DMA_TXQ_CURR_ADDR + (q << 3), v);
}
-static inline __inline struct dma_desc *get_wlan_txq_dma_addr(const unsigned int q)
+static inline __inline volatile struct dma_desc *get_wlan_txq_dma_addr(const unsigned int q)
{
return getp(AR9170_MAC_REG_DMA_TXQ_ADDR + (q << 3));
}
-static inline __inline struct dma_desc *get_wlan_txq_addr(const unsigned int q)
+static inline __inline volatile struct dma_desc *get_wlan_txq_addr(const unsigned int q)
{
return getp(AR9170_MAC_REG_DMA_TXQ_CURR_ADDR + (q << 3));
}
-static inline __inline void _wlan_trigger(const uint32_t queue_bit)
+static inline __inline volatile struct dma_desc *get_wlan_txq_last_addr(const unsigned int q)
{
- set(AR9170_MAC_REG_DMA_TRIGGER, queue_bit);
+ return getp(AR9170_MAC_REG_DMA_TXQ_LAST_ADDR + (q << 2));
}
-#ifdef CONFIG_CARL9170FW_DELAYED_TX
-static inline __inline void wlan_trigger(const uint32_t queue_bit)
-{
- fw.wlan.tx_trigger |= queue_bit;
-}
-#else
static inline __inline void wlan_trigger(const uint32_t queue_bit)
{
- _wlan_trigger(queue_bit);
+ set(AR9170_MAC_REG_DMA_TRIGGER, queue_bit);
}
-#endif /* CONFIG_CARL9170FW_DELAYED_TX */
static inline __inline uint8_t ar9170_get_rx_macstatus_status(struct dma_desc *desc)
{
static inline __inline struct ieee80211_hdr *ar9170_get_rx_i3e(struct dma_desc *desc)
{
if (!((ar9170_get_rx_macstatus_status(desc) &
- AR9170_RX_STATUS_MPDU_MASK) & AR9170_RX_STATUS_MPDU_LAST)) {
+ AR9170_RX_STATUS_MPDU) & AR9170_RX_STATUS_MPDU_LAST)) {
return (void *)(DESC_PAYLOAD_OFF(desc,
offsetof(struct ar9170_rx_frame_head, i3e)));
} else {
static inline __inline struct ar9170_rx_head *ar9170_get_rx_head(struct dma_desc *desc)
{
if (!((ar9170_get_rx_macstatus_status(desc) &
- AR9170_RX_STATUS_MPDU_MASK) & AR9170_RX_STATUS_MPDU_LAST)) {
+ AR9170_RX_STATUS_MPDU) & AR9170_RX_STATUS_MPDU_LAST)) {
return (void *)((uint8_t *)DESC_PAYLOAD(desc) +
offsetof(struct ar9170_rx_frame_head, phy_head));
} else {
mac_status = ar9170_get_rx_macstatus_status(rx);
- phy.modulation = mac_status & AR9170_RX_STATUS_MODULATION_MASK;
+ phy.modulation = mac_status & AR9170_RX_STATUS_MODULATION;
phy.chains = AR9170_TX_PHY_TXCHAIN_1;
switch (phy.modulation) {
mpdu_len -= sizeof(struct ar9170_rx_macstatus);
- switch (ar9170_get_rx_macstatus_status(desc) & AR9170_RX_STATUS_MPDU_MASK) {
+ switch (ar9170_get_rx_macstatus_status(desc) & AR9170_RX_STATUS_MPDU) {
case AR9170_RX_STATUS_MPDU_LAST:
mpdu_len -= sizeof(struct ar9170_rx_phystatus);
break;
f);
}
+static inline __inline struct carl9170_tx_superframe *__get_super(struct dma_desc *desc)
+{
+ return DESC_PAYLOAD(desc);
+}
+
static inline __inline void hide_super(struct dma_desc *desc)
{
desc->dataAddr = (uint8_t *)
tsf[1] = get(AR9170_MAC_REG_TSF_H);
}
+/* This function will only work on uint32_t-aligned pointers! */
+static inline bool compare_ether_address(const void *_d0, const void *_d1)
+{
+ const uint32_t *d0 = _d0;
+ const uint32_t *d1 = _d1;
+
+ /* BUG_ON((unsigned long)d0 & 3 || (unsigned long)d1 & 3)) */
+ return !((d0[0] ^ d1[0]) | (unsigned short)(d0[1] ^ d1[1]));
+}
+
void wlan_tx(struct dma_desc *desc);
+void wlan_tx_fw(struct carl9170_tx_superdesc *super, fw_desc_callback_t cb);
void wlan_timer(void);
void handle_wlan(void);
-void wlan_tx_stuck(const struct carl9170_cmd *cmd, struct carl9170_rsp *rsp);
+
+void handle_wlan_rx(void);
+
+void wlan_send_buffered_tx_status(void);
+void wlan_send_buffered_cab(void);
+void wlan_send_buffered_ba(void);
+void handle_wlan_tx_completion(void);
+void wlan_dma_bump(unsigned int qidx);
+
+void wlan_cab_flush_queue(const unsigned int vif);
+void wlan_modify_beacon(const unsigned int vif,
+ const unsigned int bcn_addr,
+ const unsigned int bcn_len);
+
+void wlan_tx_complete(struct carl9170_tx_superframe *super, bool txs);
+void wlan_prepare_wol(void);
static inline void __check_wlantx(void)
{
+ BUILD_BUG_ON(CARL9170_TX_SUPERDESC_LEN & 3);
BUILD_BUG_ON(sizeof(struct carl9170_tx_superdesc) != CARL9170_TX_SUPERDESC_LEN);
+ BUILD_BUG_ON(sizeof(struct _carl9170_tx_superdesc) != CARL9170_TX_SUPERDESC_LEN);
+ BUILD_BUG_ON(sizeof(struct _carl9170_tx_superframe) != CARL9170_TX_SUPERFRAME_LEN);
BUILD_BUG_ON((offsetof(struct carl9170_tx_superframe, f) & 3) != 0);
+ BUILD_BUG_ON(offsetof(struct _carl9170_tx_superframe, f) !=
+ (offsetof(struct _carl9170_tx_superframe, f)));
BUILD_BUG_ON(sizeof(struct ar9170_tx_hwdesc) != AR9170_TX_HWDESC_LEN);
- BUILD_BUG_ON(sizeof(struct ar9170_rx_head) != 12);
- BUILD_BUG_ON(sizeof(struct ar9170_rx_phystatus) != 20);
- BUILD_BUG_ON(sizeof(struct ar9170_rx_macstatus) != 4);
+ BUILD_BUG_ON(sizeof(struct _ar9170_tx_hwdesc) != AR9170_TX_HWDESC_LEN);
+ BUILD_BUG_ON(sizeof(struct ar9170_rx_head) != AR9170_RX_HEAD_LEN);
+ BUILD_BUG_ON(sizeof(struct ar9170_rx_phystatus) != AR9170_RX_PHYSTATUS_LEN);
+ BUILD_BUG_ON(sizeof(struct ar9170_rx_macstatus) != AR9170_RX_MACSTATUS_LEN);
}
#endif /* __CARL9170FW_WLAN_H */