1 |
199 |
simons |
/*
|
2 |
|
|
* arch/arm/kernel/dma.h
|
3 |
|
|
*
|
4 |
|
|
* Copyright (C) 1998 Russell King
|
5 |
|
|
*
|
6 |
|
|
* This header file describes the interface between the generic DMA handler
|
7 |
|
|
* (dma.c) and the architecture-specific DMA backends (dma-*.c)
|
8 |
|
|
*/
|
9 |
|
|
|
10 |
|
|
typedef struct {
|
11 |
|
|
dmasg_t buf; /* single DMA */
|
12 |
|
|
int sgcount; /* number of DMA SG */
|
13 |
|
|
dmasg_t *sg; /* DMA Scatter-Gather List */
|
14 |
|
|
|
15 |
|
|
unsigned int active:1; /* Transfer active */
|
16 |
|
|
unsigned int invalid:1; /* Address/Count changed */
|
17 |
|
|
dmamode_t dma_mode; /* DMA mode */
|
18 |
|
|
|
19 |
|
|
unsigned int lock; /* Device is allocated */
|
20 |
|
|
const char *device_id; /* Device name */
|
21 |
|
|
|
22 |
|
|
unsigned int dma_base; /* Controller base address */
|
23 |
|
|
int dma_irq; /* Controller IRQ */
|
24 |
|
|
int state; /* Controller state */
|
25 |
|
|
dmasg_t cur_sg; /* Current controller buffer */
|
26 |
|
|
} dma_t;
|
27 |
|
|
|
28 |
|
|
/* Prototype: int arch_request_dma(channel, dma, dev_id)
|
29 |
|
|
* Purpose : Perform architecture specific claiming of a DMA channel
|
30 |
|
|
* Params : channel - DMA channel number
|
31 |
|
|
* : dma - DMA structure (above) for channel
|
32 |
|
|
* : dev_id - device ID string passed with request
|
33 |
|
|
* Returns : 0 on success, E????? number on error
|
34 |
|
|
*/
|
35 |
|
|
int arch_request_dma(dmach_t channel, dma_t *dma, const char *dev_id);
|
36 |
|
|
|
37 |
|
|
/* Prototype: int arch_free_dma(channel, dma)
|
38 |
|
|
* Purpose : Perform architecture specific freeing of a DMA channel
|
39 |
|
|
* Params : channel - DMA channel number
|
40 |
|
|
* : dma - DMA structure for channel
|
41 |
|
|
*/
|
42 |
|
|
void arch_free_dma(dmach_t channel, dma_t *dma);
|
43 |
|
|
|
44 |
|
|
/* Prototype: void arch_enable_dma(channel, dma)
|
45 |
|
|
* Purpose : Enable a claimed DMA channel
|
46 |
|
|
* Params : channel - DMA channel number
|
47 |
|
|
* : dma - DMA structure for channel
|
48 |
|
|
*/
|
49 |
|
|
void arch_enable_dma(dmach_t channel, dma_t *dma);
|
50 |
|
|
|
51 |
|
|
/* Prototype: void arch_disable_dma(channel, dma)
|
52 |
|
|
* Purpose : Disable a claimed DMA channel
|
53 |
|
|
* Params : channel - DMA channel number
|
54 |
|
|
* : dma - DMA structure for channel
|
55 |
|
|
*/
|
56 |
|
|
void arch_disable_dma(dmach_t channel, dma_t *dma);
|
57 |
|
|
|
58 |
|
|
/* Prototype: int arch_get_dma_residue(channel, dma)
|
59 |
|
|
* Purpose : Return number of bytes left to DMA
|
60 |
|
|
* Params : channel - DMA channel number
|
61 |
|
|
* : dma - DMA structure for channel
|
62 |
|
|
* Returns : Number of bytes left to DMA
|
63 |
|
|
*/
|
64 |
|
|
int arch_get_dma_residue(dmach_t channel, dma_t *dma);
|
65 |
|
|
|
66 |
|
|
/* Prototype: void arch_dma_init(dma)
|
67 |
|
|
* Purpose : Initialise architecture specific DMA
|
68 |
|
|
* Params : dma - pointer to array of DMA structures
|
69 |
|
|
*/
|
70 |
|
|
void arch_dma_init(dma_t *dma);
|