summaryrefslogtreecommitdiff
path: root/cpu/mpc824x/drivers/dma/dma_export.h
blob: 471e488c4043dd6c51b8790b4239d43625a5b2a8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
#ifndef DMA_EXPORT_H
#define DMA_EXPORT_H

/****************************************************
 * $Id:
 *
 * Copyright Motorola 1999
 *
 * $Log:
 *
 ****************************************************/

/* These are the defined return values for the DMA_* functions.
 * Any non-zero value indicates failure.  Failure modes can be added for
 * more detailed error reporting.
 */
typedef enum _dma_status
{
 DMA_SUCCESS     = 0,
 DMA_ERROR,
} DMA_Status;

/* These are the defined channel transfer types.  */
typedef enum _dma_transfer_types
{
	DMA_M2M =  0,	/* local memory to local memory */
	DMA_M2P =  1,	/* local memory to PCI */
	DMA_P2M =  2,	/* PCI to local memory */
	DMA_P2P =  3,	/* PCI to PCI */
} DMA_TRANSFER_TYPE;

typedef enum _dma_interrupt_steer
{
	DMA_INT_STEER_LOCAL =  0, /* steer DMA int to local processor */
	DMA_INT_STEER_PCI = 1,    /* steer DMA int to PCI bus through INTA_ */
} DMA_INTERRUPT_STEER;

typedef enum _dma_channel
{
	DMA_CHN_0 =  0, /* kahlua has two dma channels: 0 and 1 */
	DMA_CHN_1 =  1,
} DMA_CHANNEL;

typedef enum _dma_snoop_mode
{
	DMA_SNOOP_DISABLE =  0,
	DMA_SNOOP_ENABLE = 1,
} DMA_SNOOP_MODE;

/******************** App. API ********************
 * The application API is for user level application
 * to use the functionality provided by DMA driver.
 * This is a "generic" DMA interface, it should contain
 * nothing specific to the Kahlua implementation.
 * Only the generic functions are exported by the library.
 *
 * Note: Its App.s responsibility to swap the data
 *       byte. In our API, we currently transfer whatever
 *       we are given - Big/Little Endian.  This could
 *       become part of the DMA config, though.
 **************************************************/


/*  Initialize DMA unit with the following:
 *  optional pointer to application layer print function
 *
 *  These parameters may be added:
 *  ???
 *  Interrupt enables, modes, etc. are set for each transfer.
 *
 *  This function must be called before DMA unit can be used.
 */
extern DMA_Status DMA_Initialize(
	int (*app_print_function)(char *,...)); /* pointer to optional "printf"
						 * provided by application
						 */

/* Perform the DMA transfer, only direct mode is currently implemented.
 * At this point, I think it would be better to define a different
 * function for chaining mode.
 * Also, I'm not sure if it is appropriate to have the "generic" API
 * accept snoop and int_steer parameters.  The DINK user interface allows
 * them, so for now I'll leave them.
 *
 * int_steer controls DMA interrupt steering to PCI or local processor
 * type is the type of transfer: M2M, M2P, P2M, P2P
 * source is the source address of the data
 * dest is the destination address of the data
 * len is the length of data to transfer
 * channel is the DMA channel to use for the transfer
 * snoop is the snoop enable control
 */
extern DMA_Status DMA_direct_transfer( DMA_INTERRUPT_STEER int_steer,
				       DMA_TRANSFER_TYPE type,
				       unsigned int source,
				       unsigned int dest,
				       unsigned int len,
				       DMA_CHANNEL channel,
				       DMA_SNOOP_MODE snoop);
#endif