brintos

brintos / linux-shallow public Read only

0
0
Text · 2.8 KiB · 9d2b12d Raw
115 lines · c
1/* SPDX-License-Identifier: GPL-2.0+ */2/*3 * COMEDI ISA DMA support functions4 * Copyright (c) 2014 H Hartley Sweeten <hsweeten@visionengravers.com>5 */6 7#ifndef _COMEDI_ISADMA_H8#define _COMEDI_ISADMA_H9 10#include <linux/types.h>11 12struct comedi_device;13struct device;14 15/*16 * These are used to avoid issues when <asm/dma.h> and the DMA_MODE_17 * defines are not available.18 */19#define COMEDI_ISADMA_READ	020#define COMEDI_ISADMA_WRITE	121 22/**23 * struct comedi_isadma_desc - cookie for ISA DMA24 * @virt_addr:	virtual address of buffer25 * @hw_addr:	hardware (bus) address of buffer26 * @chan:	DMA channel27 * @maxsize:	allocated size of buffer (in bytes)28 * @size:	transfer size (in bytes)29 * @mode:	DMA_MODE_READ or DMA_MODE_WRITE30 */31struct comedi_isadma_desc {32	void *virt_addr;33	dma_addr_t hw_addr;34	unsigned int chan;35	unsigned int maxsize;36	unsigned int size;37	char mode;38};39 40/**41 * struct comedi_isadma - ISA DMA data42 * @dev:	device to allocate non-coherent memory for43 * @desc:	cookie for each DMA buffer44 * @n_desc:	the number of cookies45 * @cur_dma:	the current cookie in use46 * @chan:	the first DMA channel requested47 * @chan2:	the second DMA channel requested48 */49struct comedi_isadma {50	struct device *dev;51	struct comedi_isadma_desc *desc;52	int n_desc;53	int cur_dma;54	unsigned int chan;55	unsigned int chan2;56};57 58#if IS_ENABLED(CONFIG_ISA_DMA_API)59 60void comedi_isadma_program(struct comedi_isadma_desc *desc);61unsigned int comedi_isadma_disable(unsigned int dma_chan);62unsigned int comedi_isadma_disable_on_sample(unsigned int dma_chan,63					     unsigned int size);64unsigned int comedi_isadma_poll(struct comedi_isadma *dma);65void comedi_isadma_set_mode(struct comedi_isadma_desc *desc, char dma_dir);66 67struct comedi_isadma *comedi_isadma_alloc(struct comedi_device *dev,68					  int n_desc, unsigned int dma_chan1,69					  unsigned int dma_chan2,70					  unsigned int maxsize, char dma_dir);71void comedi_isadma_free(struct comedi_isadma *dma);72 73#else	/* !IS_ENABLED(CONFIG_ISA_DMA_API) */74 75static inline void comedi_isadma_program(struct comedi_isadma_desc *desc)76{77}78 79static inline unsigned int comedi_isadma_disable(unsigned int dma_chan)80{81	return 0;82}83 84static inline unsigned int85comedi_isadma_disable_on_sample(unsigned int dma_chan, unsigned int size)86{87	return 0;88}89 90static inline unsigned int comedi_isadma_poll(struct comedi_isadma *dma)91{92	return 0;93}94 95static inline void comedi_isadma_set_mode(struct comedi_isadma_desc *desc,96					  char dma_dir)97{98}99 100static inline struct comedi_isadma *101comedi_isadma_alloc(struct comedi_device *dev, int n_desc,102		    unsigned int dma_chan1, unsigned int dma_chan2,103		    unsigned int maxsize, char dma_dir)104{105	return NULL;106}107 108static inline void comedi_isadma_free(struct comedi_isadma *dma)109{110}111 112#endif	/* !IS_ENABLED(CONFIG_ISA_DMA_API) */113 114#endif	/* #ifndef _COMEDI_ISADMA_H */115