···11+/*22+ * Copyright (C) 2011 Tobias Klauser <tklauser@distanz.ch>33+ *44+ * This program is free software; you can redistribute it and/or modify55+ * it under the terms of the GNU General Public License as published by66+ * the Free Software Foundation; either version 2 of the License, or77+ * (at your option) any later version.88+ *99+ * This program is distributed in the hope that it will be useful,1010+ * but WITHOUT ANY WARRANTY; without even the implied warranty of1111+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the1212+ * GNU General Public License for more details.1313+ *1414+ * You should have received a copy of the GNU General Public License1515+ * along with this program. If not, see <http://www.gnu.org/licenses/>.1616+ *1717+ */1818+1919+#ifndef _ASM_NIOS2_REGISTERS_H2020+#define _ASM_NIOS2_REGISTERS_H2121+2222+#ifndef __ASSEMBLY__2323+#include <asm/cpuinfo.h>2424+#endif2525+2626+/* control register numbers */2727+#define CTL_STATUS 02828+#define CTL_ESTATUS 12929+#define CTL_BSTATUS 23030+#define CTL_IENABLE 33131+#define CTL_IPENDING 43232+#define CTL_CPUID 53333+#define CTL_RSV1 63434+#define CTL_EXCEPTION 73535+#define CTL_PTEADDR 83636+#define CTL_TLBACC 93737+#define CTL_TLBMISC 103838+#define CTL_RSV2 113939+#define CTL_BADADDR 124040+#define CTL_CONFIG 134141+#define CTL_MPUBASE 144242+#define CTL_MPUACC 154343+4444+/* access control registers using GCC builtins */4545+#define RDCTL(r) __builtin_rdctl(r)4646+#define WRCTL(r, v) __builtin_wrctl(r, v)4747+4848+/* status register bits */4949+#define STATUS_PIE (1 << 0) /* processor interrupt enable */5050+#define STATUS_U (1 << 1) /* user mode */5151+#define STATUS_EH (1 << 2) /* Exception mode */5252+5353+/* estatus register bits */5454+#define ESTATUS_EPIE (1 << 0) /* processor interrupt enable */5555+#define ESTATUS_EU (1 << 1) /* user mode */5656+#define ESTATUS_EH (1 << 2) /* Exception mode */5757+5858+/* tlbmisc register bits */5959+#define TLBMISC_PID_SHIFT 46060+#ifndef __ASSEMBLY__6161+#define TLBMISC_PID_MASK ((1UL << cpuinfo.tlb_pid_num_bits) - 1)6262+#endif6363+#define TLBMISC_WAY_MASK 0xf6464+#define TLBMISC_WAY_SHIFT 206565+6666+#define TLBMISC_PID (TLBMISC_PID_MASK << TLBMISC_PID_SHIFT) /* TLB PID */6767+#define TLBMISC_WE (1 << 18) /* TLB write enable */6868+#define TLBMISC_RD (1 << 19) /* TLB read */6969+#define TLBMISC_WAY (TLBMISC_WAY_MASK << TLBMISC_WAY_SHIFT) /* TLB way */7070+7171+#endif /* _ASM_NIOS2_REGISTERS_H */