irc-regs.h 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. /* irc-regs.h: on-chip interrupt controller registers
  2. *
  3. * Copyright (C) 2003 Red Hat, Inc. All Rights Reserved.
  4. * Written by David Howells (dhowells@redhat.com)
  5. *
  6. * This program is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU General Public License
  8. * as published by the Free Software Foundation; either version
  9. * 2 of the License, or (at your option) any later version.
  10. */
  11. #ifndef _ASM_IRC_REGS
  12. #define _ASM_IRC_REGS
  13. #define __reg(ADDR) (*(volatile unsigned long *)(ADDR))
  14. #define __get_TM0() ({ __reg(0xfeff9800); })
  15. #define __get_TM1() ({ __reg(0xfeff9808); })
  16. #define __set_TM1(V) do { __reg(0xfeff9808) = (V); mb(); } while(0)
  17. #define __set_TM1x(XI,V) \
  18. do { \
  19. int shift = (XI) * 2 + 16; \
  20. unsigned long tm1 = __reg(0xfeff9808); \
  21. tm1 &= ~(0x3 << shift); \
  22. tm1 |= (V) << shift; \
  23. __reg(0xfeff9808) = tm1; \
  24. mb(); \
  25. } while(0)
  26. #define __get_RS(C) ({ (__reg(0xfeff9810) >> ((C)+16)) & 1; })
  27. #define __clr_RC(C) do { __reg(0xfeff9818) = 1 << ((C)+16); mb(); } while(0)
  28. #define __get_MASK(C) ({ (__reg(0xfeff9820) >> ((C)+16)) & 1; })
  29. #define __set_MASK(C) do { __reg(0xfeff9820) |= 1 << ((C)+16); mb(); } while(0)
  30. #define __clr_MASK(C) do { __reg(0xfeff9820) &= ~(1 << ((C)+16)); mb(); } while(0)
  31. #define __get_MASK_all() __get_MASK(0)
  32. #define __set_MASK_all() __set_MASK(0)
  33. #define __clr_MASK_all() __clr_MASK(0)
  34. #define __get_IRL() ({ (__reg(0xfeff9828) >> 16) & 0xf; })
  35. #define __clr_IRL() do { __reg(0xfeff9828) = 0x100000; mb(); } while(0)
  36. #define __get_IRR(N) ({ __reg(0xfeff9840 + (N) * 8); })
  37. #define __set_IRR(N,V) do { __reg(0xfeff9840 + (N) * 8) = (V); } while(0)
  38. #define __get_IITMR(N) ({ __reg(0xfeff9880 + (N) * 8); })
  39. #define __set_IITMR(N,V) do { __reg(0xfeff9880 + (N) * 8) = (V); } while(0)
  40. #endif /* _ASM_IRC_REGS */