mpc107Dma.h
上传用户:luoyougen
上传日期:2008-05-12
资源大小:23136k
文件大小:7k
源码类别:

VxWorks

开发平台:

C/C++

  1. /* mpc107Dma.h - MPC107 DMA registers definitions  */
  2. /* Copyright 1984-2000 Wind River Systems, Inc. */
  3. /*
  4. modification history
  5. --------------------
  6. 01b,11sep00,rcs  fix include path for mpc107.h
  7. 01a,06jun00,bri written
  8. */
  9. #ifndef __INCmpc107Dmah
  10. #define __INCmpc107Dmah
  11. #ifdef __cplusplus
  12. extern "C" {
  13. #endif
  14. /* includes */
  15. #include "drv/multi/mpc107.h"
  16. /* defines */
  17. /* MPC107 configuration registers for DMA interface  */
  18. #define MPC107_DMA_EUMBBAR 0x1000  /* Offset of DMA registers */
  19.                                         /* in EUMBBAR Space */
  20. /* DMA Channel Zero Register Definitions */
  21. #define MPC107_DMA_DMR0  (MPC107_DMA_EUMBBAR + 0x100)/* Mode Register */
  22. #define MPC107_DMA_DSR0  (MPC107_DMA_EUMBBAR + 0x104)/* Status Register */
  23. #define MPC107_DMA_CDAR0 (MPC107_DMA_EUMBBAR + 0x108)/* Current Descriptor */
  24. #define MPC107_DMA_SAR0  (MPC107_DMA_EUMBBAR + 0x110)/* Source Address */
  25. #define MPC107_DMA_DAR0  (MPC107_DMA_EUMBBAR + 0x118)/* Destination Address */
  26. #define MPC107_DMA_BCR0  (MPC107_DMA_EUMBBAR + 0x120)/* Byte Count */
  27. #define MPC107_DMA_NDAR0 (MPC107_DMA_EUMBBAR + 0x124)/* Next Descriptor */
  28. /* DMA Channel One  Register Definitions */
  29. #define MPC107_DMA_DMR1   (MPC107_DMA_EUMBBAR + 0x200) /* Mode Register */
  30. #define MPC107_DMA_DSR1   (MPC107_DMA_EUMBBAR + 0x204) /* Status Register */
  31. #define MPC107_DMA_CDAR1  (MPC107_DMA_EUMBBAR + 0x208) /* Current Descriptor */
  32. #define MPC107_DMA_SAR1   (MPC107_DMA_EUMBBAR + 0x210) /* Source Address */
  33. #define MPC107_DMA_DAR1   (MPC107_DMA_EUMBBAR + 0x218) /* Destination Address */
  34. #define MPC107_DMA_BCR1   (MPC107_DMA_EUMBBAR + 0x220) /* Byte Count */
  35. #define MPC107_DMA_NDAR1  (MPC107_DMA_EUMBBAR + 0x224) /* Next Descriptor */
  36. /* Bit Definitions */
  37. /* Mode Register Bit Definitons */
  38. #define MPC107_DMA_DMR_CS        0x00000001   /* Channel Start */
  39. #define MPC107_DMA_DMR_CC        0x00000002   /* Channel Continue */
  40. #define MPC107_DMA_DMR_CTM       0x00000004   /* Direct DMA mode */
  41.                                               /* Channel Transfer */
  42. #define MPC107_DMA_DMR_DL        0x00000008   /* Descriptor Location */
  43. #define MPC107_DMA_DMR_EOTIE     0x00000080   /* End of Transfer */
  44.                                               /* Interrupt Enable */
  45. #define MPC107_DMA_DMR_EIE       0x00000100   /* Error Interrupt Enable */
  46. #define MPC107_DMA_DMR_PDE       0x00040000   /* Periodic DMA Enable */
  47. /*  Status Register Bit Definitions */
  48. #define MPC107_DMA_DSR_EOCAI       0x00000001   /* End of chain or */
  49.                                                 /* direct Interrupt */
  50. #define MPC107_DMA_DSR_EOSI        0x00000002   /* End of Segment Interrupt */
  51. #define MPC107_DMA_DSR_CB          0x00000004   /* Channel Busy */
  52. #define MPC107_DMA_DSR_PE          0x00000010   /* PCI Error */
  53. #define MPC107_DMA_DSR_LME         0x00000080   /* Local Memory Error  */
  54. /* Current Descriptor Address Register  Bit definitions */
  55. #define MPC107_DMA_CDAR_CTT_SHIFT  0x2          /* Transfer Type Shift */
  56. #define MPC107_DMA_CDAR_ADDR_MASK  0xffffffc0   /* Address Mask  */
  57. #define MPC107_DMA_CDAR_EOSIE      0x00000008   /* End of Segment Interrupt */
  58. #define MPC107_DMA_CDAR_SNEN       0x00000010   /* Snoop Enable */
  59. /* Next Descriptor Address Register Bit definitions */
  60. #define MPC107_DMA_NDAR_EOTD      0x00000001   /* End of transfer descriptor */
  61. #define MPC107_DMA_NDAR_NDEOSIE   0x00000008   /* Next descriptor */
  62.                                                /* end-of-segment interrupt */
  63.                                                /* enable */
  64. #define MPC107_DMA_NDAR_NDSNEN    0x00000010   /* Snoop Enable */
  65. #define MPC107_DMA_NDAR_ADDR_MASK 0xffffffc0   /* Address Mask  */
  66. /*
  67.  * DMA 0 Mode register default value
  68.  * Error Interrupt Disabled ,End of Transfer
  69.  * Interrupt Disabled and Direct Mode DMA transfer
  70.  */
  71. #define MPC107_DMA_DMR0_DEFAULT   0x04
  72. /*
  73.  * DMA 1 Mode register default value
  74.  * Error Interrupt Disabled ,End of Transfer
  75.  * Interrupt Disabled and Direct Mode DMA transfer
  76.  */
  77. #define MPC107_DMA_DMR1_DEFAULT   0x04
  78. /* General Definitions */
  79. #define MPC107_DMA_CHANNEL0          0x0  /* Channel Zero */
  80. #define MPC107_DMA_CHANNEL1          0x1  /* Channel One */
  81. #define MPC107_DMA_MEM_ALIGN         0x3  /* For aligining to 8 words */
  82.                                           /* 2exp3 = 8 */
  83. #define MPC107_DMA_CH_BUSY_MASK     0x00000001 /* Channel busy mask */
  84. #define MPC107_DMA_TIMEOUT_BUSY     0x10000
  85. /* Error Numbers and Return Values */
  86. #define MPC107_DMA_PERIODIC_CH       0x01  /* Channel configured for */
  87.                                            /* Periodic DMA */
  88. #define MPC107_DMA_CHAIN_CH          0x02  /* Channel configured for */
  89.                                            /* Chained DMA */
  90. #define MPC107_DMA_DIRECT_CH         0x03  /* Channel configured for */
  91.                                            /* Direct DMA */
  92. #define MPC107_DMA_PERIODIC_CH_FREE  0x04  /* periodic DMA is configured */
  93.                                            /* and channel is free */
  94. #define MPC107_DMA_PERIODIC_CH_BUSY  0x05  /* "periodic" DMA is configured */
  95.                                            /* and channel is Busy */
  96. #define MPC107_DMA_CHAIN_CH_FREE     0x06  /* chained  DMA is configured */
  97.                                            /* and channel is free */
  98. #define MPC107_DMA_CHAIN_CH_BUSY     0x07  /* chained  DMA is configured */
  99.                                            /* and channel is busy */
  100. #define MPC107_DMA_DIRECT_CH_FREE    0x08  /* direct  DMA is configured */
  101.                                            /* and channel is free */
  102. #define MPC107_DMA_DIRECT_CH_BUSY    0x09  /* direct  DMA is configured */
  103.                                            /* and channel is busy */
  104. #define  MPC107_DMA_NUM_BYTES        0x0a  /* Number of bytes is zero  */
  105. #define  MPC107_DMA_UNDEF_CH         0x0b  /* Undefined Channel Number */
  106. /* typedefs */
  107. /*
  108.  * Descriptors  for  Chained /Periodic DMA transfers .
  109.  * Descriptors should be alligned on a 8 word byte boundary
  110.  */
  111. typedef struct mpc107DmaDescriptors
  112.     {
  113.      UCHAR *pSourceAddress;        /* Pointer to Source address  */
  114.      ULONG reserved1;              /* Reserved 1 */
  115.      UCHAR *pDestinationAddress;   /* Pointer to Destination address  */
  116.      ULONG reserved2;              /* Reserved 2 */
  117.      struct mpc107DmaDescriptors *pNextDescriptorAddress; /* Pointer to next */
  118.                                                           /* descriptor */
  119.      ULONG reserved3;              /* Reserved 3 */
  120.      ULONG numberOfBytes;          /* Number of bytes */
  121.      ULONG reserved4;              /* Reserved 4 */
  122.     } MPC107_DMA_DESCRIPTOR;
  123. /* function declrations */
  124. IMPORT void  mpc107DmaInit (void);
  125. IMPORT STATUS  mpc107DmaStartDirect (UINT32 channelNumber, UINT32 transferType,
  126.                                      UINT32 sourceAddress ,
  127.                                      UINT32 destinationAddress,
  128.                                      UINT32 numberOfBytes);
  129. IMPORT STATUS  mpc107DmaChainedStart (UINT32 channelNumber,UINT32 timePeriod);
  130. IMPORT STATUS  mpc107DmaPeriodicStop (UINT32 channelNumber );
  131. IMPORT STATUS  mpc107DmaBuildDecsriptor (UINT32 channelNumber,
  132.                                          UCHAR *pSourceAddress,
  133.                                          UCHAR *pDestinationAddress,
  134.                                          UINT32 transferType,
  135.                                          UINT32 numberOfBytes);
  136. IMPORT INT32 mpc107DmaStatus (ULONG channel);
  137. #ifdef __cplusplus
  138. }
  139. #endif
  140. #endif /* __INCmpc107Dmah */