xref: /openbmc/linux/drivers/media/pci/ivtv/ivtv-udma.h (revision fadbafc1)
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 /*
3     Copyright (C) 2003-2004  Kevin Thayer <nufan_wfk at yahoo.com>
4     Copyright (C) 2004  Chris Kennedy <c@groovy.org>
5     Copyright (C) 2006-2007  Hans Verkuil <hverkuil@xs4all.nl>
6 
7  */
8 
9 #ifndef IVTV_UDMA_H
10 #define IVTV_UDMA_H
11 
12 /* User DMA functions */
13 void ivtv_udma_get_page_info(struct ivtv_dma_page_info *dma_page, unsigned long first, unsigned long size);
14 int ivtv_udma_fill_sg_list(struct ivtv_user_dma *dma, struct ivtv_dma_page_info *dma_page, int map_offset);
15 void ivtv_udma_fill_sg_array(struct ivtv_user_dma *dma, u32 buffer_offset, u32 buffer_offset_2, u32 split);
16 int ivtv_udma_setup(struct ivtv *itv, unsigned long ivtv_dest_addr,
17 		       void __user *userbuf, int size_in_bytes);
18 void ivtv_udma_unmap(struct ivtv *itv);
19 void ivtv_udma_free(struct ivtv *itv);
20 void ivtv_udma_alloc(struct ivtv *itv);
21 void ivtv_udma_prepare(struct ivtv *itv);
22 void ivtv_udma_start(struct ivtv *itv);
23 
24 static inline void ivtv_udma_sync_for_device(struct ivtv *itv)
25 {
26 	dma_sync_single_for_device(&itv->pdev->dev, itv->udma.SG_handle,
27 				   sizeof(itv->udma.SGarray), DMA_TO_DEVICE);
28 }
29 
30 static inline void ivtv_udma_sync_for_cpu(struct ivtv *itv)
31 {
32 	dma_sync_single_for_cpu(&itv->pdev->dev, itv->udma.SG_handle,
33 				sizeof(itv->udma.SGarray), DMA_TO_DEVICE);
34 }
35 
36 #endif
37