dma.h
上传用户:jlfgdled
上传日期:2013-04-10
资源大小:33168k
文件大小:2k
源码类别:

Linux/Unix编程

开发平台:

Unix_Linux

  1. /* DMA.h - DMA functions and definitions*/
  2. /* Copyright Galileo Technology. */
  3. #ifndef __INCdmah
  4. #define __INCdmah
  5. /* includes */
  6. #include "core.h"
  7. /* defines */
  8. #define FIRST_DMA_ENGINE   0
  9. #define LAST_DMA_ENGINE    3
  10. #define FLY_BY BIT0
  11. #define RD_WR_FLY BIT1
  12. #define DECREMENT_SOURCE_ADDRESS BIT2
  13. #define HOLD_SOURCE_ADDRESS BIT3
  14. #define DECREMENT_DEST_ADDRESS BIT4
  15. #define HOLD_DEST_ADDRESS BIT5
  16. #define DTL_1BYTE BIT6 | BIT8
  17. #define DTL_2BYTES BIT7 | BIT8
  18. #define DTL_4BYTES BIT7
  19. #define DTL_8BYTES NO_BIT
  20. #define DTL_16BYTES BIT6
  21. #define DTL_32BYTES BIT6 | BIT7
  22. #define DTL_64BYTES BIT6 | BIT7 | BIT8
  23. #define NON_CHAIN_MOD BIT9
  24. #define INT_EVERY_NULL_POINTER BIT10
  25. #define BLOCK_TRANSFER_MODE BIT11
  26. #define CHANNEL_ENABLE BIT12
  27. #define FETCH_NEXT_RECORED BIT13
  28. #define DMA_ACTIVITY_STATUS         BIT14
  29. #define ALIGN_TOWARD_DEST BIT15
  30. #define MASK_DMA_REQ BIT16
  31. #define ENABLE_DESCRIPTOR BIT17
  32. #define ENABLE_EOT BIT18
  33. #define ENABLE_EOT_INTERRUPT BIT19
  34. #define ABORT_DMA BIT20
  35. #define SOURCE_ADDR_IN_PCI0 BIT21
  36. #define SOURCE_ADDR_IN_PCI1 BIT22
  37. #define DEST_ADDR_IN_PCI0 BIT23
  38. #define DEST_ADDR_IN_PCI1 BIT24
  39. #define REC_ADDR_IN_PCI0 BIT25
  40. #define REC_ADDR_IN_PCI1 BIT26
  41. #define REQ_FROM_TIMER_COUNTER BIT28
  42. /* typedefs */
  43. typedef enum dmaEngine{DMA_ENG_0,DMA_ENG_1,DMA_ENG_2,DMA_ENG_3} DMA_ENGINE;
  44. /* priority definitions */
  45. typedef enum prioChan01{ROUND_ROBIN01,CH_1,CH_0} PRIO_CHAN_0_1;
  46. typedef enum prioChan23{ROUND_ROBIN23,CH_3,CH_2} PRIO_CHAN_2_3;
  47. typedef enum prioGroup{ROUND_ROBIN,CH_2_3,CH_0_1} PRIO_GROUP;
  48. typedef enum prioOpt{RETURN_BUS,KEEP_BUS} PRIO_OPT;
  49. typedef struct dmaRecored
  50. {
  51.     unsigned int    ByteCnt;
  52.     unsigned int    SrcAdd;
  53.     unsigned int    DestAdd;
  54.     unsigned int    NextRecPtr;
  55. } DMA_RECORED;
  56. typedef enum __dma_status{CHANNEL_BUSY,NO_SUCH_CHANNEL,DMA_OK,
  57.                             GENERAL_ERROR} DMA_STATUS;
  58. DMA_STATUS dmaTransfer (DMA_ENGINE engine,unsigned int sourceAddr,
  59.                         unsigned int destAddr,unsigned int numOfBytes,
  60.                         unsigned int command,DMA_RECORED * nextRecoredPointer);
  61. bool dmaCommand (DMA_ENGINE channel,unsigned int command);
  62. bool    isDmaChannelActive (DMA_ENGINE channel);
  63. bool    changeDmaPriority(PRIO_CHAN_0_1 prio_01, PRIO_CHAN_2_3 prio_23,
  64.                           PRIO_GROUP prioGrp, PRIO_OPT prioOpt);
  65. #endif /* __INCdmah */