• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 {
24   UINT8     DataType;                      // DMA4_CSDPi[1:0]
25   UINT8     ReadPortAccessType;            // DMA4_CSDPi[8:7]
26   UINT8     WritePortAccessType;           // DMA4_CSDPi[15:14]
27   UINT8     SourceEndiansim;               // DMA4_CSDPi[21]
28   UINT8     DestinationEndianism;          // DMA4_CSDPi[19]
29   UINT8     WriteMode;                     // DMA4_CSDPi[17:16]
30   UINT8     SourcePacked;                  // DMA4_CSDPi[6]
31   UINT8     DestinationPacked;             // DMA4_CSDPi[13]
32   UINT32    NumberOfElementPerFrame;       // DMA4_CENi
33   UINT32    NumberOfFramePerTransferBlock; // DMA4_CFNi
34   UINT32    SourceStartAddress;            // DMA4_CSSAi
35   UINT32    DestinationStartAddress;       // DMA4_CDSAi
36   UINT32    SourceElementIndex;            // DMA4_CSEi
37   UINT32    SourceFrameIndex;              // DMA4_CSFi
38   UINT32    DestinationElementIndex;       // DMA4_CDEi
39   UINT32    DestinationFrameIndex;         // DMA4_CDFi
40   UINT8     ReadPortAccessMode;            // DMA4_CCRi[13:12]
41   UINT8     WritePortAccessMode;           // DMA4_CCRi[15:14]
42   UINT8     ReadPriority;                  // DMA4_CCRi[6]
43   UINT8     WritePriority;                 // DMA4_CCRi[23]
44   UINT8     ReadRequestNumber;             // DMA4_CCRi[4:0]
45   UINT8     WriteRequestNumber;            // DMA4_CCRi[20:19]
46 } OMAP_DMA4;
47 
48 
49 /**
50   Configure OMAP DMA Channel
51 
52   @param  Channel               DMA Channel to configure
53   @param  Dma4                  Pointer to structure used to initialize DMA registers for the Channel
54 
55   @retval EFI_SUCCESS           The range was mapped for the returned NumberOfBytes.
56   @retval EFI_INVALID_PARAMETER Channel is not valid
57   @retval EFI_DEVICE_ERROR      The system hardware could not map the requested information.
58 
59 **/
60 EFI_STATUS
61 EFIAPI
62 EnableDmaChannel (
63   IN  UINTN       Channel,
64   IN  OMAP_DMA4   *Dma4
65   );
66 
67 /**
68   Turn of DMA channel configured by EnableDma().
69 
70   @param  Channel               DMA Channel to configure
71   @param  SuccesMask            Bits in DMA4_CSR register indicate EFI_SUCCESS
72   @param  ErrorMask             Bits in DMA4_CSR register indicate EFI_DEVICE_ERROR
73 
74   @retval EFI_SUCCESS           DMA hardware disabled
75   @retval EFI_INVALID_PARAMETER Channel is not valid
76   @retval EFI_DEVICE_ERROR      The system hardware could not map the requested information.
77 
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 
91