dma.h 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. /* MN10300 ISA DMA handlers and definitions
  2. *
  3. * Copyright (C) 2007 Matsushita Electric Industrial Co., Ltd.
  4. * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
  5. *
  6. * This program is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU General Public Licence
  8. * as published by the Free Software Foundation; either version
  9. * 2 of the Licence, or (at your option) any later version.
  10. */
  11. #ifndef _ASM_DMA_H
  12. #define _ASM_DMA_H
  13. #include <linux/spinlock.h>
  14. #include <asm/io.h>
  15. #include <linux/delay.h>
  16. #undef MAX_DMA_CHANNELS /* switch off linux/kernel/dma.c */
  17. #define MAX_DMA_ADDRESS 0xbfffffff
  18. extern spinlock_t dma_spin_lock;
  19. static inline unsigned long claim_dma_lock(void)
  20. {
  21. unsigned long flags;
  22. spin_lock_irqsave(&dma_spin_lock, flags);
  23. return flags;
  24. }
  25. static inline void release_dma_lock(unsigned long flags)
  26. {
  27. spin_unlock_irqrestore(&dma_spin_lock, flags);
  28. }
  29. /* enable/disable a specific DMA channel */
  30. static inline void enable_dma(unsigned int dmanr)
  31. {
  32. }
  33. static inline void disable_dma(unsigned int dmanr)
  34. {
  35. }
  36. /* Clear the 'DMA Pointer Flip Flop'.
  37. * Write 0 for LSB/MSB, 1 for MSB/LSB access.
  38. * Use this once to initialize the FF to a known state.
  39. * After that, keep track of it. :-)
  40. * --- In order to do that, the DMA routines below should ---
  41. * --- only be used while holding the DMA lock ! ---
  42. */
  43. static inline void clear_dma_ff(unsigned int dmanr)
  44. {
  45. }
  46. /* set mode (above) for a specific DMA channel */
  47. static inline void set_dma_mode(unsigned int dmanr, char mode)
  48. {
  49. }
  50. /* Set only the page register bits of the transfer address.
  51. * This is used for successive transfers when we know the contents of
  52. * the lower 16 bits of the DMA current address register, but a 64k boundary
  53. * may have been crossed.
  54. */
  55. static inline void set_dma_page(unsigned int dmanr, char pagenr)
  56. {
  57. }
  58. /* Set transfer address & page bits for specific DMA channel.
  59. * Assumes dma flipflop is clear.
  60. */
  61. static inline void set_dma_addr(unsigned int dmanr, unsigned int a)
  62. {
  63. }
  64. /* Set transfer size (max 64k for DMA1..3, 128k for DMA5..7) for
  65. * a specific DMA channel.
  66. * You must ensure the parameters are valid.
  67. * NOTE: from a manual: "the number of transfers is one more
  68. * than the initial word count"! This is taken into account.
  69. * Assumes dma flip-flop is clear.
  70. * NOTE 2: "count" represents _bytes_ and must be even for channels 5-7.
  71. */
  72. static inline void set_dma_count(unsigned int dmanr, unsigned int count)
  73. {
  74. }
  75. /* Get DMA residue count. After a DMA transfer, this
  76. * should return zero. Reading this while a DMA transfer is
  77. * still in progress will return unpredictable results.
  78. * If called before the channel has been used, it may return 1.
  79. * Otherwise, it returns the number of _bytes_ left to transfer.
  80. *
  81. * Assumes DMA flip-flop is clear.
  82. */
  83. static inline int get_dma_residue(unsigned int dmanr)
  84. {
  85. return 0;
  86. }
  87. /* These are in kernel/dma.c: */
  88. extern int request_dma(unsigned int dmanr, const char *device_id);
  89. extern void free_dma(unsigned int dmanr);
  90. /* From PCI */
  91. #ifdef CONFIG_PCI
  92. extern int isa_dma_bridge_buggy;
  93. #else
  94. #define isa_dma_bridge_buggy (0)
  95. #endif
  96. #endif /* _ASM_DMA_H */