registers.h 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. /*
  2. * Copyright (C) 2011 Tobias Klauser <tklauser@distanz.ch>
  3. *
  4. * This program is free software; you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License as published by
  6. * the Free Software Foundation; either version 2 of the License, or
  7. * (at your option) any later version.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  16. *
  17. */
  18. #ifndef _ASM_NIOS2_REGISTERS_H
  19. #define _ASM_NIOS2_REGISTERS_H
  20. #ifndef __ASSEMBLY__
  21. #include <asm/cpuinfo.h>
  22. #endif
  23. /* control register numbers */
  24. #define CTL_STATUS 0
  25. #define CTL_ESTATUS 1
  26. #define CTL_BSTATUS 2
  27. #define CTL_IENABLE 3
  28. #define CTL_IPENDING 4
  29. #define CTL_CPUID 5
  30. #define CTL_RSV1 6
  31. #define CTL_EXCEPTION 7
  32. #define CTL_PTEADDR 8
  33. #define CTL_TLBACC 9
  34. #define CTL_TLBMISC 10
  35. #define CTL_RSV2 11
  36. #define CTL_BADADDR 12
  37. #define CTL_CONFIG 13
  38. #define CTL_MPUBASE 14
  39. #define CTL_MPUACC 15
  40. /* access control registers using GCC builtins */
  41. #define RDCTL(r) __builtin_rdctl(r)
  42. #define WRCTL(r, v) __builtin_wrctl(r, v)
  43. /* status register bits */
  44. #define STATUS_PIE (1 << 0) /* processor interrupt enable */
  45. #define STATUS_U (1 << 1) /* user mode */
  46. #define STATUS_EH (1 << 2) /* Exception mode */
  47. /* estatus register bits */
  48. #define ESTATUS_EPIE (1 << 0) /* processor interrupt enable */
  49. #define ESTATUS_EU (1 << 1) /* user mode */
  50. #define ESTATUS_EH (1 << 2) /* Exception mode */
  51. /* tlbmisc register bits */
  52. #define TLBMISC_PID_SHIFT 4
  53. #ifndef __ASSEMBLY__
  54. #define TLBMISC_PID_MASK ((1UL << cpuinfo.tlb_pid_num_bits) - 1)
  55. #endif
  56. #define TLBMISC_WAY_MASK 0xf
  57. #define TLBMISC_WAY_SHIFT 20
  58. #define TLBMISC_PID (TLBMISC_PID_MASK << TLBMISC_PID_SHIFT) /* TLB PID */
  59. #define TLBMISC_WE (1 << 18) /* TLB write enable */
  60. #define TLBMISC_RD (1 << 19) /* TLB read */
  61. #define TLBMISC_WAY (TLBMISC_WAY_MASK << TLBMISC_WAY_SHIFT) /* TLB way */
  62. #endif /* _ASM_NIOS2_REGISTERS_H */