18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-or-later */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci    Copyright (C) 2003-2004  Kevin Thayer <nufan_wfk at yahoo.com>
48c2ecf20Sopenharmony_ci    Copyright (C) 2004  Chris Kennedy <c@groovy.org>
58c2ecf20Sopenharmony_ci    Copyright (C) 2006-2007  Hans Verkuil <hverkuil@xs4all.nl>
68c2ecf20Sopenharmony_ci
78c2ecf20Sopenharmony_ci */
88c2ecf20Sopenharmony_ci
98c2ecf20Sopenharmony_ci#ifndef IVTV_UDMA_H
108c2ecf20Sopenharmony_ci#define IVTV_UDMA_H
118c2ecf20Sopenharmony_ci
128c2ecf20Sopenharmony_ci/* User DMA functions */
138c2ecf20Sopenharmony_civoid ivtv_udma_get_page_info(struct ivtv_dma_page_info *dma_page, unsigned long first, unsigned long size);
148c2ecf20Sopenharmony_ciint ivtv_udma_fill_sg_list(struct ivtv_user_dma *dma, struct ivtv_dma_page_info *dma_page, int map_offset);
158c2ecf20Sopenharmony_civoid ivtv_udma_fill_sg_array(struct ivtv_user_dma *dma, u32 buffer_offset, u32 buffer_offset_2, u32 split);
168c2ecf20Sopenharmony_ciint ivtv_udma_setup(struct ivtv *itv, unsigned long ivtv_dest_addr,
178c2ecf20Sopenharmony_ci		       void __user *userbuf, int size_in_bytes);
188c2ecf20Sopenharmony_civoid ivtv_udma_unmap(struct ivtv *itv);
198c2ecf20Sopenharmony_civoid ivtv_udma_free(struct ivtv *itv);
208c2ecf20Sopenharmony_civoid ivtv_udma_alloc(struct ivtv *itv);
218c2ecf20Sopenharmony_civoid ivtv_udma_prepare(struct ivtv *itv);
228c2ecf20Sopenharmony_civoid ivtv_udma_start(struct ivtv *itv);
238c2ecf20Sopenharmony_ci
248c2ecf20Sopenharmony_cistatic inline void ivtv_udma_sync_for_device(struct ivtv *itv)
258c2ecf20Sopenharmony_ci{
268c2ecf20Sopenharmony_ci	pci_dma_sync_single_for_device(itv->pdev, itv->udma.SG_handle,
278c2ecf20Sopenharmony_ci		sizeof(itv->udma.SGarray), PCI_DMA_TODEVICE);
288c2ecf20Sopenharmony_ci}
298c2ecf20Sopenharmony_ci
308c2ecf20Sopenharmony_cistatic inline void ivtv_udma_sync_for_cpu(struct ivtv *itv)
318c2ecf20Sopenharmony_ci{
328c2ecf20Sopenharmony_ci	pci_dma_sync_single_for_cpu(itv->pdev, itv->udma.SG_handle,
338c2ecf20Sopenharmony_ci		sizeof(itv->udma.SGarray), PCI_DMA_TODEVICE);
348c2ecf20Sopenharmony_ci}
358c2ecf20Sopenharmony_ci
368c2ecf20Sopenharmony_ci#endif
37