X-Git-Url: https://jxself.org/git/?a=blobdiff_plain;f=carlfw%2Finclude%2Fdma.h;h=11a760dfc98139cb68c921d188d1cc19c8b71941;hb=990ce9efaea1c6e46372a6758988aff6e9d202e9;hp=0f45e513bcf98d9b1db1d94f3a3cd0b76b65add7;hpb=2cb1f03e4cf246a6254c71d84dc00435057fe09e;p=carl9170fw.git diff --git a/carlfw/include/dma.h b/carlfw/include/dma.h index 0f45e51..11a760d 100644 --- a/carlfw/include/dma.h +++ b/carlfw/include/dma.h @@ -6,7 +6,7 @@ * Copyright (c) 2000-2005 ZyDAS Technology Corporation * Copyright (c) 2007-2009 Atheros Communications, Inc. * Copyright 2009 Johannes Berg - * Copyright 2009, 2010 Christian Lamparter + * Copyright 2009-2011 Christian Lamparter * * 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 @@ -44,19 +44,13 @@ struct dma_desc { void *dataAddr; } __packed; struct dma_desc *nextAddr; /* Next TD address */ -} __packed; +} __packed __aligned(4); -/* (Up, Dn, 5x Tx, Rx), USB Int, (5x delayed Tx + retry), CAB, BA */ -#define AR9170_TERMINATOR_NUMBER_B 8 +/* Up, Dn, 5x Tx, retry, Rx, [USB Int], (CAB), (BA) */ +#define AR9170_TERMINATOR_NUMBER_B 9 #define AR9170_TERMINATOR_NUMBER_INT 1 -#ifdef CONFIG_CARL9170FW_DELAYED_TX -#define AR9170_TERMINATOR_NUMBER_DELAY 6 -#else -#define AR9170_TERMINATOR_NUMBER_DELAY 0 -#endif /* CONFIG_CARL9170FW_DELAYED_TX */ - #ifdef CONFIG_CARL9170FW_CAB_QUEUE #define AR9170_TERMINATOR_NUMBER_CAB CARL9170_INTF_NUM #else @@ -70,7 +64,6 @@ struct dma_desc { #endif /* CONFIG_CARL9170FW_HANDLE_BACK_REQ */ #define AR9170_TERMINATOR_NUMBER (AR9170_TERMINATOR_NUMBER_B + \ AR9170_TERMINATOR_NUMBER_INT + \ - AR9170_TERMINATOR_NUMBER_DELAY + \ AR9170_TERMINATOR_NUMBER_CAB + \ AR9170_TERMINATOR_NUMBER_BA) @@ -121,11 +114,11 @@ struct carl9170_sram_reserved { * | - Up (to USB host) * | - Down (from USB host) * | - TX (5x, to wifi) + * | - AMPDU TX retry * | - RX (from wifi) * | - CAB Queue * | - FW cmd & req descriptor * | - BlockAck descriptor - * | - Delayed TX (5x) * | total: AR9170_TERMINATOR_NUMBER * +-- * | block descriptors (dma_desc) @@ -169,8 +162,8 @@ struct ar9170_data_block { struct ar9170_dma_memory { struct dma_desc terminator[AR9170_TERMINATOR_NUMBER]; struct dma_desc block[AR9170_BLOCK_NUMBER]; - struct ar9170_data_block data[AR9170_BLOCK_NUMBER] __attribute__((aligned(BLOCK_ALIGNMENT))); - struct carl9170_sram_reserved reserved __attribute__((aligned(BLOCK_ALIGNMENT))); + struct ar9170_data_block data[AR9170_BLOCK_NUMBER] __aligned(BLOCK_ALIGNMENT); + struct carl9170_sram_reserved reserved __aligned(BLOCK_ALIGNMENT); }; extern struct ar9170_dma_memory dma_mem; @@ -222,7 +215,6 @@ struct dma_desc *dma_unlink_head(struct dma_queue *queue); void dma_init_descriptors(void); void dma_reclaim(struct dma_queue *q, struct dma_desc *desc); void dma_put(struct dma_queue *q, struct dma_desc *desc); -void dma_queue_reclaim(struct dma_queue *dst, struct dma_queue *src); static inline __inline bool is_terminator(struct dma_queue *q, struct dma_desc *desc) { @@ -282,6 +274,10 @@ static inline __inline struct dma_desc *dma_dequeue_not_bits(struct dma_queue *q (desc->status & AR9170_OWN_BITS) == bits); \ desc = (queue)->head) +#define __for_each_desc_continue(desc, queue) \ + for (;desc != (queue)->terminator; \ + desc = (desc)->lastAddr->nextAddr) + #define __for_each_desc(desc, queue) \ for (desc = (queue)->head; \ desc != (queue)->terminator; \ @@ -318,6 +314,15 @@ static inline __inline void dma_rearm(struct dma_desc *desc) AR9170_OWN_BITS_HW); } +static inline __inline void dma_fix_downqueue(struct dma_desc *desc) +{ + desc->status = AR9170_OWN_BITS_HW; + desc->ctrl = 0; + desc->dataSize = 0; + desc->totalLen = AR9170_BLOCK_SIZE; + desc->lastAddr = desc; +} + static inline void __check_desc(void) { struct ar9170_dma_memory mem;