5 #define TX_BUF_FULL_INT 2
6 #define TRANSMIT_CPT_INT 4
8 #define QOS_DEFAULT_WGT 0x7fffffffUL;
19 #ifdef CONFIG_CPU_LITTLE_ENDIAN
20 typedef struct rx_desc{
22 volatile u32 reserved:7;
23 volatile u32 byte_offset:2;
24 volatile u32 Burst_length_offset:3;
29 volatile u32 Data_Pointer;
30 /*fix me:should be 28 bits here, 32 bits just for host simulatiuon purpose*/
34 typedef struct tx_desc{
35 volatile u32 data_length:16;
36 volatile u32 reserved1:7;
37 volatile u32 byte_offset:5;
42 volatile u32 Data_Pointer;//fix me:should be 28 bits here
45 typedef struct rx_desc{
54 volatile u32 Burst_length_offset :3;
55 volatile u32 byte_offset :2;
56 volatile u32 reserve :7;
57 volatile u32 data_length :16;
63 volatile u32 Data_Pointer;
67 typedef struct tx_desc{
76 volatile u32 byte_offset :5;
77 volatile u32 reserved :7;
78 volatile u32 data_length :16;
84 volatile u32 Data_Pointer;
89 struct dma_channel_info{
90 /*filled by driver, optional*/
91 enum attr_t attr;/*TX or RX*/
95 int control;/*on or off*/
101 typedef struct dma_channel_info _dma_channel_info;
103 struct dma_device_info{
105 /*filled by driver, compulsary*/
106 char device_name[15];
107 enum attr_t attr;/*default or else*/
111 int logic_rx_chan_base;
112 int logic_tx_chan_base;
114 /*filled by driver, optional*/
120 struct dma_channel_info tx_chan[2];
121 struct dma_channel_info rx_chan[4];
123 /*functions, optional*/
124 u8* (*buffer_alloc)(int len,int* offset, void** opt);
125 int (*buffer_free)(u8* dataptr, void* opt);
126 int (*intr_handler)(struct dma_device_info* info, int status);
127 /*set by device, clear by dma*/
129 void * priv; /* used by peripheral driver only */
131 typedef struct dma_device_info _dma_device_info;
133 int dma_device_register(struct dma_device_info* info);
135 int dma_device_unregister(struct dma_device_info* info);
137 int dma_device_read(struct dma_device_info* info, u8** dataptr, void** opt);
139 int dma_device_write(struct dma_device_info* info, u8* dataptr, int len, void* opt);
141 int dma_device_update(struct dma_device_info* info);
143 void dma_device_update_rx(struct dma_device_info* dma_dev);
145 void dma_device_update_tx(struct dma_device_info* dma_dev);
147 void register_handler_sim(int (*handler)(int));
148 #endif /* AMAZON_DMA_H */