162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-or-later */ 262306a36Sopenharmony_ci/* 362306a36Sopenharmony_ci Copyright (C) 2003-2004 Kevin Thayer <nufan_wfk at yahoo.com> 462306a36Sopenharmony_ci Copyright (C) 2004 Chris Kennedy <c@groovy.org> 562306a36Sopenharmony_ci Copyright (C) 2006-2007 Hans Verkuil <hverkuil@xs4all.nl> 662306a36Sopenharmony_ci 762306a36Sopenharmony_ci */ 862306a36Sopenharmony_ci 962306a36Sopenharmony_ci#ifndef IVTV_UDMA_H 1062306a36Sopenharmony_ci#define IVTV_UDMA_H 1162306a36Sopenharmony_ci 1262306a36Sopenharmony_ci/* User DMA functions */ 1362306a36Sopenharmony_civoid ivtv_udma_get_page_info(struct ivtv_dma_page_info *dma_page, unsigned long first, unsigned long size); 1462306a36Sopenharmony_ciint ivtv_udma_fill_sg_list(struct ivtv_user_dma *dma, struct ivtv_dma_page_info *dma_page, int map_offset); 1562306a36Sopenharmony_civoid ivtv_udma_fill_sg_array(struct ivtv_user_dma *dma, u32 buffer_offset, u32 buffer_offset_2, u32 split); 1662306a36Sopenharmony_ciint ivtv_udma_setup(struct ivtv *itv, unsigned long ivtv_dest_addr, 1762306a36Sopenharmony_ci void __user *userbuf, int size_in_bytes); 1862306a36Sopenharmony_civoid ivtv_udma_unmap(struct ivtv *itv); 1962306a36Sopenharmony_civoid ivtv_udma_free(struct ivtv *itv); 2062306a36Sopenharmony_civoid ivtv_udma_alloc(struct ivtv *itv); 2162306a36Sopenharmony_civoid ivtv_udma_prepare(struct ivtv *itv); 2262306a36Sopenharmony_civoid ivtv_udma_start(struct ivtv *itv); 2362306a36Sopenharmony_ci 2462306a36Sopenharmony_cistatic inline void ivtv_udma_sync_for_device(struct ivtv *itv) 2562306a36Sopenharmony_ci{ 2662306a36Sopenharmony_ci dma_sync_single_for_device(&itv->pdev->dev, itv->udma.SG_handle, 2762306a36Sopenharmony_ci sizeof(itv->udma.SGarray), DMA_TO_DEVICE); 2862306a36Sopenharmony_ci} 2962306a36Sopenharmony_ci 3062306a36Sopenharmony_cistatic inline void ivtv_udma_sync_for_cpu(struct ivtv *itv) 3162306a36Sopenharmony_ci{ 3262306a36Sopenharmony_ci dma_sync_single_for_cpu(&itv->pdev->dev, itv->udma.SG_handle, 3362306a36Sopenharmony_ci sizeof(itv->udma.SGarray), DMA_TO_DEVICE); 3462306a36Sopenharmony_ci} 3562306a36Sopenharmony_ci 3662306a36Sopenharmony_ci#endif 37