rm9k-ocd.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. /*
  2. * Copyright (C) 2004 by Basler Vision Technologies AG
  3. * Author: Thomas Koeller <thomas.koeller@baslerweb.com>
  4. *
  5. * This program is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation; either version 2 of the License, or
  8. * (at your option) any later version.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this program; if not, write to the Free Software
  17. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  18. */
  19. #if !defined(_ASM_RM9K_OCD_H)
  20. #define _ASM_RM9K_OCD_H
  21. #include <linux/types.h>
  22. #include <linux/spinlock.h>
  23. #include <asm/io.h>
  24. extern volatile void __iomem * const ocd_base;
  25. extern volatile void __iomem * const titan_base;
  26. #define ocd_addr(__x__) (ocd_base + (__x__))
  27. #define titan_addr(__x__) (titan_base + (__x__))
  28. #define scram_addr(__x__) (scram_base + (__x__))
  29. /* OCD register access */
  30. #define ocd_readl(__offs__) __raw_readl(ocd_addr(__offs__))
  31. #define ocd_readw(__offs__) __raw_readw(ocd_addr(__offs__))
  32. #define ocd_readb(__offs__) __raw_readb(ocd_addr(__offs__))
  33. #define ocd_writel(__val__, __offs__) \
  34. __raw_writel((__val__), ocd_addr(__offs__))
  35. #define ocd_writew(__val__, __offs__) \
  36. __raw_writew((__val__), ocd_addr(__offs__))
  37. #define ocd_writeb(__val__, __offs__) \
  38. __raw_writeb((__val__), ocd_addr(__offs__))
  39. /* TITAN register access - 32 bit-wide only */
  40. #define titan_readl(__offs__) __raw_readl(titan_addr(__offs__))
  41. #define titan_writel(__val__, __offs__) \
  42. __raw_writel((__val__), titan_addr(__offs__))
  43. /* Protect access to shared TITAN registers */
  44. extern spinlock_t titan_lock;
  45. extern int titan_irqflags;
  46. #define lock_titan_regs() spin_lock_irqsave(&titan_lock, titan_irqflags)
  47. #define unlock_titan_regs() spin_unlock_irqrestore(&titan_lock, titan_irqflags)
  48. #endif /* !defined(_ASM_RM9K_OCD_H) */