xref: /qemu/include/hw/cris/etraxfs_dma.h (revision abff1abf)
1 #ifndef HW_ETRAXFS_DMA_H
2 #define HW_ETRAXFS_DMA_H
3 
4 #include "exec/hwaddr.h"
5 
6 struct dma_context_metadata {
7 	/* data descriptor md */
8 	uint16_t metadata;
9 };
10 
11 struct etraxfs_dma_client
12 {
13 	/* DMA controller. */
14 	int channel;
15 	void *ctrl;
16 
17 	/* client.  */
18 	struct {
19 		int (*push)(void *opaque, unsigned char *buf,
20 		            int len, bool eop);
21 		void (*pull)(void *opaque);
22 		void (*metadata_push)(void *opaque,
23 		                      const struct dma_context_metadata *md);
24 		void *opaque;
25 	} client;
26 };
27 
28 void *etraxfs_dmac_init(hwaddr base, int nr_channels);
29 void etraxfs_dmac_connect(void *opaque, int channel, qemu_irq *line,
30 			  int input);
31 void etraxfs_dmac_connect_client(void *opaque, int c,
32 				 struct etraxfs_dma_client *cl);
33 int etraxfs_dmac_input(struct etraxfs_dma_client *client,
34 		       void *buf, int len, int eop);
35 
36 #endif
37