dma_export.h 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. #ifndef DMA_EXPORT_H
  2. #define DMA_EXPORT_H
  3. /****************************************************
  4. * $Id:
  5. *
  6. * Copyright Motorola 1999
  7. *
  8. * $Log:
  9. *
  10. ****************************************************/
  11. /* These are the defined return values for the DMA_* functions.
  12. * Any non-zero value indicates failure. Failure modes can be added for
  13. * more detailed error reporting.
  14. */
  15. typedef enum _dma_status
  16. {
  17. DMA_SUCCESS = 0,
  18. DMA_ERROR,
  19. } DMA_Status;
  20. /* These are the defined channel transfer types. */
  21. typedef enum _dma_transfer_types
  22. {
  23. DMA_M2M = 0, /* local memory to local memory */
  24. DMA_M2P = 1, /* local memory to PCI */
  25. DMA_P2M = 2, /* PCI to local memory */
  26. DMA_P2P = 3, /* PCI to PCI */
  27. } DMA_TRANSFER_TYPE;
  28. typedef enum _dma_interrupt_steer
  29. {
  30. DMA_INT_STEER_LOCAL = 0, /* steer DMA int to local processor */
  31. DMA_INT_STEER_PCI = 1, /* steer DMA int to PCI bus through INTA_ */
  32. } DMA_INTERRUPT_STEER;
  33. typedef enum _dma_channel
  34. {
  35. DMA_CHN_0 = 0, /* kahlua has two dma channels: 0 and 1 */
  36. DMA_CHN_1 = 1,
  37. } DMA_CHANNEL;
  38. typedef enum _dma_snoop_mode
  39. {
  40. DMA_SNOOP_DISABLE = 0,
  41. DMA_SNOOP_ENABLE = 1,
  42. } DMA_SNOOP_MODE;
  43. /******************** App. API ********************
  44. * The application API is for user level application
  45. * to use the functionality provided by DMA driver.
  46. * This is a "generic" DMA interface, it should contain
  47. * nothing specific to the Kahlua implementation.
  48. * Only the generic functions are exported by the library.
  49. *
  50. * Note: Its App.s responsibility to swap the data
  51. * byte. In our API, we currently transfer whatever
  52. * we are given - Big/Little Endian. This could
  53. * become part of the DMA config, though.
  54. **************************************************/
  55. /* Initialize DMA unit with the following:
  56. * optional pointer to application layer print function
  57. *
  58. * These parameters may be added:
  59. * ???
  60. * Interrupt enables, modes, etc. are set for each transfer.
  61. *
  62. * This function must be called before DMA unit can be used.
  63. */
  64. extern DMA_Status DMA_Initialize(
  65. int (*app_print_function)(char *,...)); /* pointer to optional "printf"
  66. * provided by application
  67. */
  68. /* Perform the DMA transfer, only direct mode is currently implemented.
  69. * At this point, I think it would be better to define a different
  70. * function for chaining mode.
  71. * Also, I'm not sure if it is appropriate to have the "generic" API
  72. * accept snoop and int_steer parameters. The DINK user interface allows
  73. * them, so for now I'll leave them.
  74. *
  75. * int_steer controls DMA interrupt steering to PCI or local processor
  76. * type is the type of transfer: M2M, M2P, P2M, P2P
  77. * source is the source address of the data
  78. * dest is the destination address of the data
  79. * len is the length of data to transfer
  80. * channel is the DMA channel to use for the transfer
  81. * snoop is the snoop enable control
  82. */
  83. extern DMA_Status DMA_direct_transfer( DMA_INTERRUPT_STEER int_steer,
  84. DMA_TRANSFER_TYPE type,
  85. unsigned int source,
  86. unsigned int dest,
  87. unsigned int len,
  88. DMA_CHANNEL channel,
  89. DMA_SNOOP_MODE snoop);
  90. #endif