X-Git-Url: https://jxself.org/git/?a=blobdiff_plain;f=carlfw%2Finclude%2Fdma.h;h=07d06d607f9bc2fea7429fede6e6799ac94fdd50;hb=cdced53c2ede33a9fe9004db4d93cfc984ad4243;hp=565c48ddcbc706d7e5667f3efd0eae24827cecba;hpb=1765258283f5fc36987ae44cdd516163290629e0;p=carl9170fw.git diff --git a/carlfw/include/dma.h b/carlfw/include/dma.h index 565c48d..07d06d6 100644 --- a/carlfw/include/dma.h +++ b/carlfw/include/dma.h @@ -46,33 +46,20 @@ struct dma_desc { struct dma_desc *nextAddr; /* Next TD address */ } __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), FW */ +#define AR9170_TERMINATOR_NUMBER_B 10 #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 #define AR9170_TERMINATOR_NUMBER_CAB 0 #endif /* CONFIG_CARL9170FW_CAB_QUEUE */ -#ifdef CONFIG_CARL9170FW_HANDLE_BACK_REQ -#define AR9170_TERMINATOR_NUMBER_BA 1 -#else -#define AR9170_TERMINATOR_NUMBER_BA 0 -#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) + AR9170_TERMINATOR_NUMBER_CAB) #define AR9170_BLOCK_SIZE (256 + 64) @@ -92,12 +79,11 @@ struct carl9170_tx_ba_superframe { #define CARL9170_RSP_BUFFER_LEN AR9170_BLOCK_SIZE struct carl9170_sram_reserved { -#ifdef CONFIG_CARL9170FW_HANDLE_BACK_REQ union { uint32_t buf[CARL9170_BA_BUFFER_LEN / sizeof(uint32_t)]; struct carl9170_tx_ba_superframe ba; } ba; -#endif /* CONFIG_CARL9170FW_HANDLE_BACK_REQ */ + union { uint32_t buf[CARL9170_MAX_CMD_LEN / sizeof(uint32_t)]; struct carl9170_cmd cmd; @@ -121,11 +107,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) @@ -222,7 +208,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 +267,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 +307,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; @@ -326,9 +324,7 @@ static inline void __check_desc(void) BUILD_BUG_ON(sizeof(mem) > AR9170_SRAM_SIZE); -#ifdef CONFIG_CARL9170FW_HANDLE_BACK_REQ BUILD_BUG_ON(offsetof(struct carl9170_sram_reserved, ba.buf) & (BLOCK_ALIGNMENT - 1)); -#endif /* CONFIG_CARL9170FW_HANDLE_BACK_REQ */ BUILD_BUG_ON(offsetof(struct carl9170_sram_reserved, cmd.buf) & (BLOCK_ALIGNMENT - 1)); BUILD_BUG_ON(offsetof(struct carl9170_sram_reserved, rsp.buf) & (BLOCK_ALIGNMENT - 1)); BUILD_BUG_ON(offsetof(struct carl9170_sram_reserved, bcn.buf) & (BLOCK_ALIGNMENT - 1));