Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-only */
0002 /*
0003  *  arch/arm/include/asm/mach/dma.h
0004  *
0005  *  Copyright (C) 1998-2000 Russell King
0006  *
0007  *  This header file describes the interface between the generic DMA handler
0008  *  (dma.c) and the architecture-specific DMA backends (dma-*.c)
0009  */
0010 
0011 struct dma_struct;
0012 typedef struct dma_struct dma_t;
0013 
0014 struct dma_ops {
0015     int (*request)(unsigned int, dma_t *);      /* optional */
0016     void    (*free)(unsigned int, dma_t *);         /* optional */
0017     void    (*enable)(unsigned int, dma_t *);       /* mandatory */
0018     void    (*disable)(unsigned int, dma_t *);      /* mandatory */
0019     int (*residue)(unsigned int, dma_t *);      /* optional */
0020     int (*setspeed)(unsigned int, dma_t *, int);    /* optional */
0021     const char *type;
0022 };
0023 
0024 struct dma_struct {
0025     void        *addr;      /* single DMA address       */
0026     unsigned long   count;      /* single DMA size      */
0027     struct scatterlist buf;     /* single DMA           */
0028     int     sgcount;    /* number of DMA SG     */
0029     struct scatterlist *sg;     /* DMA Scatter-Gather List  */
0030 
0031     unsigned int    active:1;   /* Transfer active      */
0032     unsigned int    invalid:1;  /* Address/Count changed    */
0033 
0034     unsigned int    dma_mode;   /* DMA mode         */
0035     int     speed;      /* DMA speed            */
0036 
0037     unsigned int    lock;       /* Device is allocated      */
0038     const char  *device_id; /* Device name          */
0039 
0040     const struct dma_ops *d_ops;
0041 };
0042 
0043 /*
0044  * isa_dma_add - add an ISA-style DMA channel
0045  */
0046 extern int isa_dma_add(unsigned int, dma_t *dma);
0047 
0048 /*
0049  * Add the ISA DMA controller.  Always takes channels 0-7.
0050  */
0051 extern void isa_init_dma(void);