]>
Commit | Line | Data |
---|---|---|
327f7a02 WD |
1 | #ifndef DMA_EXPORT_H |
2 | #define DMA_EXPORT_H | |
3 | ||
4 | /**************************************************** | |
5 | * $Id: | |
6 | * | |
7 | * Copyright Motorola 1999 | |
8 | * | |
9 | * $Log: | |
10 | * | |
11 | ****************************************************/ | |
12 | ||
13 | /* These are the defined return values for the DMA_* functions. | |
14 | * Any non-zero value indicates failure. Failure modes can be added for | |
15 | * more detailed error reporting. | |
16 | */ | |
17 | typedef enum _dma_status | |
18 | { | |
19 | DMA_SUCCESS = 0, | |
20 | DMA_ERROR, | |
21 | } DMA_Status; | |
22 | ||
23 | /* These are the defined channel transfer types. */ | |
24 | typedef enum _dma_transfer_types | |
25 | { | |
26 | DMA_M2M = 0, /* local memory to local memory */ | |
27 | DMA_M2P = 1, /* local memory to PCI */ | |
28 | DMA_P2M = 2, /* PCI to local memory */ | |
29 | DMA_P2P = 3, /* PCI to PCI */ | |
30 | } DMA_TRANSFER_TYPE; | |
31 | ||
32 | typedef enum _dma_interrupt_steer | |
33 | { | |
34 | DMA_INT_STEER_LOCAL = 0, /* steer DMA int to local processor */ | |
35 | DMA_INT_STEER_PCI = 1, /* steer DMA int to PCI bus through INTA_ */ | |
36 | } DMA_INTERRUPT_STEER; | |
37 | ||
38 | typedef enum _dma_channel | |
39 | { | |
40 | DMA_CHN_0 = 0, /* kahlua has two dma channels: 0 and 1 */ | |
41 | DMA_CHN_1 = 1, | |
42 | } DMA_CHANNEL; | |
43 | ||
44 | typedef enum _dma_snoop_mode | |
45 | { | |
46 | DMA_SNOOP_DISABLE = 0, | |
47 | DMA_SNOOP_ENABLE = 1, | |
48 | } DMA_SNOOP_MODE; | |
49 | ||
50 | /******************** App. API ******************** | |
51 | * The application API is for user level application | |
52 | * to use the functionality provided by DMA driver. | |
53 | * This is a "generic" DMA interface, it should contain | |
54 | * nothing specific to the Kahlua implementation. | |
55 | * Only the generic functions are exported by the library. | |
56 | * | |
57 | * Note: Its App.s responsibility to swap the data | |
58 | * byte. In our API, we currently transfer whatever | |
59 | * we are given - Big/Little Endian. This could | |
60 | * become part of the DMA config, though. | |
61 | **************************************************/ | |
62 | ||
63 | ||
64 | /* Initialize DMA unit with the following: | |
65 | * optional pointer to application layer print function | |
66 | * | |
67 | * These parameters may be added: | |
68 | * ??? | |
69 | * Interrupt enables, modes, etc. are set for each transfer. | |
70 | * | |
71 | * This function must be called before DMA unit can be used. | |
72 | */ | |
73 | extern DMA_Status DMA_Initialize( | |
8bde7f77 WD |
74 | int (*app_print_function)(char *,...)); /* pointer to optional "printf" |
75 | * provided by application | |
76 | */ | |
327f7a02 WD |
77 | |
78 | /* Perform the DMA transfer, only direct mode is currently implemented. | |
79 | * At this point, I think it would be better to define a different | |
80 | * function for chaining mode. | |
81 | * Also, I'm not sure if it is appropriate to have the "generic" API | |
82 | * accept snoop and int_steer parameters. The DINK user interface allows | |
83 | * them, so for now I'll leave them. | |
84 | * | |
85 | * int_steer controls DMA interrupt steering to PCI or local processor | |
86 | * type is the type of transfer: M2M, M2P, P2M, P2P | |
87 | * source is the source address of the data | |
88 | * dest is the destination address of the data | |
89 | * len is the length of data to transfer | |
90 | * channel is the DMA channel to use for the transfer | |
91 | * snoop is the snoop enable control | |
92 | */ | |
93 | extern DMA_Status DMA_direct_transfer( DMA_INTERRUPT_STEER int_steer, | |
8bde7f77 WD |
94 | DMA_TRANSFER_TYPE type, |
95 | unsigned int source, | |
96 | unsigned int dest, | |
97 | unsigned int len, | |
98 | DMA_CHANNEL channel, | |
99 | DMA_SNOOP_MODE snoop); | |
327f7a02 | 100 | #endif |