]>
Commit | Line | Data |
---|---|---|
1 | /** @file | |
2 | ||
3 | Abstractions for simple OMAP DMA. | |
4 | OMAP_DMA4 structure elements are described in the OMAP35xx TRM. | |
5 | ||
6 | Copyright (c) 2008 - 2010, Apple Inc. All rights reserved.<BR> | |
7 | ||
8 | This program and the accompanying materials | |
9 | are licensed and made available under the terms and conditions of the BSD License | |
10 | which accompanies this distribution. The full text of the license may be found at | |
11 | http://opensource.org/licenses/bsd-license.php | |
12 | ||
13 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, | |
14 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. | |
15 | ||
16 | **/ | |
17 | ||
18 | #ifndef __OMAP_DMA_LIB_H__ | |
19 | #define __OMAP_DMA_LIB_H__ | |
20 | ||
21 | ||
22 | // Example from DMA chapter of the OMAP35xx spec | |
23 | typedef struct {\r | |
24 | UINT8 DataType; // DMA4_CSDPi[1:0]\r | |
25 | UINT8 ReadPortAccessType; // DMA4_CSDPi[8:7]\r | |
26 | UINT8 WritePortAccessType; // DMA4_CSDPi[15:14]\r | |
27 | UINT8 SourceEndiansim; // DMA4_CSDPi[21]\r | |
28 | UINT8 DestinationEndianism; // DMA4_CSDPi[19]\r | |
29 | UINT8 WriteMode; // DMA4_CSDPi[17:16]\r | |
30 | UINT8 SourcePacked; // DMA4_CSDPi[6]\r | |
31 | UINT8 DestinationPacked; // DMA4_CSDPi[13]\r | |
32 | UINT32 NumberOfElementPerFrame; // DMA4_CENi\r | |
33 | UINT32 NumberOfFramePerTransferBlock; // DMA4_CFNi\r | |
34 | UINT32 SourceStartAddress; // DMA4_CSSAi\r | |
35 | UINT32 DestinationStartAddress; // DMA4_CDSAi\r | |
36 | UINT32 SourceElementIndex; // DMA4_CSEi\r | |
37 | UINT32 SourceFrameIndex; // DMA4_CSFi\r | |
38 | UINT32 DestinationElementIndex; // DMA4_CDEi\r | |
39 | UINT32 DestinationFrameIndex; // DMA4_CDFi\r | |
40 | UINT8 ReadPortAccessMode; // DMA4_CCRi[13:12]\r | |
41 | UINT8 WritePortAccessMode; // DMA4_CCRi[15:14]\r | |
42 | UINT8 ReadPriority; // DMA4_CCRi[6]\r | |
43 | UINT8 WritePriority; // DMA4_CCRi[23]\r | |
44 | UINT8 ReadRequestNumber; // DMA4_CCRi[4:0]\r | |
45 | UINT8 WriteRequestNumber; // DMA4_CCRi[20:19] | |
46 | } OMAP_DMA4; | |
47 | ||
48 | ||
49 | /** \r | |
50 | Configure OMAP DMA Channel\r | |
51 | \r | |
52 | @param Channel DMA Channel to configure\r | |
53 | @param Dma4 Pointer to structure used to initialize DMA registers for the Channel \r | |
54 | \r | |
55 | @retval EFI_SUCCESS The range was mapped for the returned NumberOfBytes.\r | |
56 | @retval EFI_INVALID_PARAMETER Channel is not valid\r | |
57 | @retval EFI_DEVICE_ERROR The system hardware could not map the requested information.\r | |
58 | \r | |
59 | **/ | |
60 | EFI_STATUS | |
61 | EFIAPI | |
62 | EnableDmaChannel ( | |
63 | IN UINTN Channel, | |
64 | IN OMAP_DMA4 *Dma4 | |
65 | ); | |
66 | ||
67 | /** \r | |
68 | Turn of DMA channel configured by EnableDma().\r | |
69 | \r | |
70 | @param Channel DMA Channel to configure\r | |
71 | @param SuccesMask Bits in DMA4_CSR register indicate EFI_SUCCESS\r | |
72 | @param ErrorMask Bits in DMA4_CSR register indicate EFI_DEVICE_ERROR\r | |
73 | \r | |
74 | @retval EFI_SUCCESS DMA hardware disabled\r | |
75 | @retval EFI_INVALID_PARAMETER Channel is not valid\r | |
76 | @retval EFI_DEVICE_ERROR The system hardware could not map the requested information.\r | |
77 | \r | |
78 | **/ | |
79 | EFI_STATUS | |
80 | EFIAPI | |
81 | DisableDmaChannel ( | |
82 | IN UINTN Channel, | |
83 | IN UINT32 SuccessMask, | |
84 | IN UINT32 ErrorMask | |
85 | ); | |
86 | ||
87 | ||
88 | ||
89 | #endif | |
90 |