OmapDmaLib.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. /** @file
  2. Abstractions for simple OMAP DMA.
  3. OMAP_DMA4 structure elements are described in the OMAP35xx TRM.
  4. Copyright (c) 2008 - 2010, Apple Inc. All rights reserved.<BR>
  5. SPDX-License-Identifier: BSD-2-Clause-Patent
  6. **/
  7. #ifndef __OMAP_DMA_LIB_H__
  8. #define __OMAP_DMA_LIB_H__
  9. // Example from DMA chapter of the OMAP35xx spec
  10. typedef struct {
  11. UINT8 DataType; // DMA4_CSDPi[1:0]
  12. UINT8 ReadPortAccessType; // DMA4_CSDPi[8:7]
  13. UINT8 WritePortAccessType; // DMA4_CSDPi[15:14]
  14. UINT8 SourceEndiansim; // DMA4_CSDPi[21]
  15. UINT8 DestinationEndianism; // DMA4_CSDPi[19]
  16. UINT8 WriteMode; // DMA4_CSDPi[17:16]
  17. UINT8 SourcePacked; // DMA4_CSDPi[6]
  18. UINT8 DestinationPacked; // DMA4_CSDPi[13]
  19. UINT32 NumberOfElementPerFrame; // DMA4_CENi
  20. UINT32 NumberOfFramePerTransferBlock; // DMA4_CFNi
  21. UINT32 SourceStartAddress; // DMA4_CSSAi
  22. UINT32 DestinationStartAddress; // DMA4_CDSAi
  23. UINT32 SourceElementIndex; // DMA4_CSEi
  24. UINT32 SourceFrameIndex; // DMA4_CSFi
  25. UINT32 DestinationElementIndex; // DMA4_CDEi
  26. UINT32 DestinationFrameIndex; // DMA4_CDFi
  27. UINT8 ReadPortAccessMode; // DMA4_CCRi[13:12]
  28. UINT8 WritePortAccessMode; // DMA4_CCRi[15:14]
  29. UINT8 ReadPriority; // DMA4_CCRi[6]
  30. UINT8 WritePriority; // DMA4_CCRi[23]
  31. UINT8 ReadRequestNumber; // DMA4_CCRi[4:0]
  32. UINT8 WriteRequestNumber; // DMA4_CCRi[20:19]
  33. } OMAP_DMA4;
  34. /**
  35. Configure OMAP DMA Channel
  36. @param Channel DMA Channel to configure
  37. @param Dma4 Pointer to structure used to initialize DMA registers for the Channel
  38. @retval EFI_SUCCESS The range was mapped for the returned NumberOfBytes.
  39. @retval EFI_INVALID_PARAMETER Channel is not valid
  40. @retval EFI_DEVICE_ERROR The system hardware could not map the requested information.
  41. **/
  42. EFI_STATUS
  43. EFIAPI
  44. EnableDmaChannel (
  45. IN UINTN Channel,
  46. IN OMAP_DMA4 *Dma4
  47. );
  48. /**
  49. Turn of DMA channel configured by EnableDma().
  50. @param Channel DMA Channel to configure
  51. @param SuccesMask Bits in DMA4_CSR register indicate EFI_SUCCESS
  52. @param ErrorMask Bits in DMA4_CSR register indicate EFI_DEVICE_ERROR
  53. @retval EFI_SUCCESS DMA hardware disabled
  54. @retval EFI_INVALID_PARAMETER Channel is not valid
  55. @retval EFI_DEVICE_ERROR The system hardware could not map the requested information.
  56. **/
  57. EFI_STATUS
  58. EFIAPI
  59. DisableDmaChannel (
  60. IN UINTN Channel,
  61. IN UINT32 SuccessMask,
  62. IN UINT32 ErrorMask
  63. );
  64. #endif