2 * @File: dma_engine_api.h
4 * @Abstract: DMA Engine api
8 * Copyright (c) 2008 Atheros Communications Inc.
13 #ifndef _DMA_ENGINE_API_H
14 #define _DMA_ENGINE_API_H
17 #include <vdesc_api.h>
22 volatile u16_t ctrl; // Descriptor control
23 volatile u16_t status; // Descriptor status
24 volatile u16_t totalLen; // Total length
25 volatile u16_t dataSize; // Data size
27 volatile u16_t status; // Descriptor status
28 volatile u16_t ctrl; // Descriptor control
29 volatile u16_t dataSize; // Data size
30 volatile u16_t totalLen; // Total length
32 struct zsDmaDesc* lastAddr; // Last address of this chain
33 volatile u32_t dataAddr; // Data buffer address
34 struct zsDmaDesc* nextAddr; // Next TD address
39 struct zsDmaDesc* head;
40 struct zsDmaDesc* terminator;
43 // Subclass of zsDmaQueue for TX
46 struct zsDmaDesc* head;
47 struct zsDmaDesc* terminator;
49 /* Below are fields specific to TX */
50 VBUF *xmited_buf_head;
51 VBUF *xmited_buf_tail;
54 /* hardware API table structure (API descriptions below) */
59 void (*_init_rx_queue)(struct zsDmaQueue *q);
61 void (*_init_tx_queue)(struct zsTxDmaQueue *q);
63 void (*_config_rx_queue)(struct zsDmaQueue *q, int num_desc, int buf_size);
65 void (*_xmit_buf)(struct zsTxDmaQueue *q, VBUF *buf);
67 void (*_flush_xmit)(struct zsDmaQueue *q);
69 VBUF* (*_reap_recv_buf)(struct zsDmaQueue *q);
71 void (*_return_recv_buf)(struct zsDmaQueue *q, VBUF *buf);
73 VBUF* (*_reap_xmited_buf)(struct zsTxDmaQueue *q);
75 void (*_swap_data)(struct zsDmaDesc* desc);
77 int (*_has_compl_packets)(struct zsDmaQueue *q);
79 void (*_desc_dump)(struct zsDmaQueue *q);
81 /* The functions below are for patchable */
82 struct zsDmaDesc* (*_get_packet)(struct zsDmaQueue* q);
83 void (*_reclaim_packet)(struct zsDmaQueue* q, struct zsDmaDesc* desc);
84 void (*_put_packet)(struct zsDmaQueue* q, struct zsDmaDesc* desc);
86 /* room to expand this table by another table */
90 extern void dma_engine_module_install(struct dma_engine_api *apis);
92 #endif /* #ifndef _DMA_ENGINE_API_H */