basicAlgorithmEncapsulation.h 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. /*
  2. * dma.h - Blackfin DMA defines/structures/etc...
  3. *
  4. * Copyright 2004-2008 Analog Devices Inc.
  5. * Licensed under the GPL-2 or later.
  6. */
  7. #ifndef _BLACKFIN_DMA_H_
  8. #define _BLACKFIN_DMA_H_
  9. #include <linux/interrupt.h>
  10. #include <mach/dma.h>
  11. #include <linux/atomic.h>
  12. #include <asm/blackfin.h>
  13. #include <asm/page.h>
  14. #include <asm-generic/dma.h>
  15. #include <asm/bfin_dma.h>
  16. /*-------------------------
  17. * config reg bits value
  18. *-------------------------*/
  19. #define DATA_SIZE_8 0
  20. #define DATA_SIZE_16 1
  21. #define DATA_SIZE_32 2
  22. #ifdef CONFIG_BF60x
  23. #define DATA_SIZE_64 3
  24. #endif
  25. #define DMA_FLOW_STOP 0
  26. #define DMA_FLOW_AUTO 1
  27. #ifdef CONFIG_BF60x
  28. #define DMA_FLOW_LIST 4
  29. #define DMA_FLOW_ARRAY 5
  30. #define DMA_FLOW_LIST_DEMAND 6
  31. #define DMA_FLOW_ARRAY_DEMAND 7
  32. #else
  33. #define DMA_FLOW_ARRAY 4
  34. #define DMA_FLOW_SMALL 6
  35. #define DMA_FLOW_LARGE 7
  36. #endif
  37. #define DIMENSION_LINEAR 0
  38. #define DIMENSION_2D 1
  39. #define DIR_READ 0
  40. #define DIR_WRITE 1
  41. #define INTR_DISABLE 0
  42. #ifdef CONFIG_BF60x
  43. #define INTR_ON_PERI 1
  44. #endif
  45. #define INTR_ON_BUF 2
  46. #define INTR_ON_ROW 3
  47. #define DMA_NOSYNC_KEEP_DMA_BUF 0
  48. #define DMA_SYNC_RESTART 1
  49. #ifdef DMA_MMR_SIZE_32
  50. #define DMA_MMR_SIZE_TYPE long
  51. #define DMA_MMR_READ bfin_read32
  52. #define DMA_MMR_WRITE bfin_write32
  53. #else
  54. #define DMA_MMR_SIZE_TYPE short
  55. #define DMA_MMR_READ bfin_read16
  56. #define DMA_MMR_WRITE bfin_write16
  57. #endif
  58. struct dma_desc_array {
  59. unsigned long start_addr;
  60. unsigned DMA_MMR_SIZE_TYPE cfg;
  61. unsigned DMA_MMR_SIZE_TYPE x_count;
  62. DMA_MMR_SIZE_TYPE x_modify;
  63. } __attribute__((packed));
  64. struct dmasg {
  65. void *next_desc_addr;
  66. unsigned long start_addr;
  67. unsigned DMA_MMR_SIZE_TYPE cfg;
  68. unsigned DMA_MMR_SIZE_TYPE x_count;
  69. DMA_MMR_SIZE_TYPE x_modify;
  70. unsigned DMA_MMR_SIZE_TYPE y_count;
  71. DMA_MMR_SIZE_TYPE y_modify;
  72. } __attribute__((packed));
  73. struct dma_register {
  74. void *next_desc_ptr; /* DMA Next Descriptor Pointer register */
  75. unsigned long start_addr; /* DMA Start address register */
  76. #ifdef CONFIG_BF60x
  77. unsigned long cfg; /* DMA Configuration register */
  78. unsigned long x_count; /* DMA x_count register */
  79. long x_modify; /* DMA x_modify register */
  80. unsigned long y_count; /* DMA y_count register */
  81. long y_modify; /* DMA y_modify register */
  82. unsigned long reserved;
  83. unsigned long reserved2;
  84. void *curr_desc_ptr; /* DMA Current Descriptor Pointer
  85. register */
  86. void *prev_desc_ptr; /* DMA previous initial Descriptor Pointer
  87. register */
  88. unsigned long curr_addr_ptr; /* DMA Current Address Pointer
  89. register */
  90. unsigned long irq_status; /* DMA irq status register */
  91. unsigned long curr_x_count; /* DMA Current x-count register */
  92. unsigned long curr_y_count; /* DMA Current y-count register */
  93. unsigned long reserved3;
  94. unsigned long bw_limit_count; /* DMA band width limit count register */
  95. unsigned long curr_bw_limit_count; /* DMA Current band width limit
  96. count register */
  97. unsigned long bw_monitor_count; /* DMA band width limit count register */
  98. unsigned long curr_bw_monitor_count; /* DMA Current band width limit
  99. count register */
  100. #else
  101. unsigned short cfg; /* DMA Configuration register */