zyfeier commented on code in PR #21496:
URL: https://github.com/apache/nuttx/pull/21496#discussion_r4490151536
##########
arch/tricore/src/common/tricore_trapcall.c:
##########
@@ -39,13 +39,92 @@
#include "tricore_internal.h"
-#include "IfxCpu_Trap.h"
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+
+/* Trap classes and trap identification numbers (TIN), as named in the
+ * TriCore architecture manual.
+ */
+
+#define TRICORE_TRAP_CLASS_MMU 0 /* Memory management */
+#define TRICORE_TRAP_CLASS_PROT 1 /* Internal protection */
+#define TRICORE_TRAP_CLASS_INSN 2 /* Instruction errors */
+#define TRICORE_TRAP_CLASS_CTX 3 /* Context management */
+#define TRICORE_TRAP_CLASS_BUS 4 /* System bus and peripheral errors */
+#define TRICORE_TRAP_CLASS_ASSERT 5 /* Assertion */
+#define TRICORE_TRAP_CLASS_NMI 7 /* Non-maskable interrupt */
+
+#define TRICORE_TIN_VAF 0 /* Class 0: virtual address fill */
+#define TRICORE_TIN_VAP 1 /* Class 0: virtual addr protection */
+
+#define TRICORE_TIN_PRIV 1 /* Class 1: privilege violation */
+#define TRICORE_TIN_MPR 2 /* Class 1: protection read */
+#define TRICORE_TIN_MPW 3 /* Class 1: protection write */
+#define TRICORE_TIN_MPX 4 /* Class 1: protection execute */
+#define TRICORE_TIN_MPP 5 /* Class 1: peripheral access */
+#define TRICORE_TIN_MPN 6 /* Class 1: null address */
+#define TRICORE_TIN_GRWP 7 /* Class 1: global register write */
+
+#define TRICORE_TIN_IOPC 1 /* Class 2: illegal opcode */
+#define TRICORE_TIN_UOPC 2 /* Class 2: unimplemented opcode */
+#define TRICORE_TIN_OPD 3 /* Class 2: invalid operand */
+#define TRICORE_TIN_ALN 4 /* Class 2: data address alignment */
+#define TRICORE_TIN_MEM 5 /* Class 2: invalid local memory */
+#define TRICORE_TIN_CSE 6 /* Class 2: coprocessor synchronous */
+
+#define TRICORE_TIN_FCD 1 /* Class 3: free context depletion */
+#define TRICORE_TIN_CDO 2 /* Class 3: call depth overflow */
+#define TRICORE_TIN_CDU 3 /* Class 3: call depth underflow */
+#define TRICORE_TIN_FCU 4 /* Class 3: free context underflow */
+#define TRICORE_TIN_CSU 5 /* Class 3: call stack underflow */
+#define TRICORE_TIN_CTYP 6 /* Class 3: context type error */
+#define TRICORE_TIN_NEST 7 /* Class 3: nesting error */
+
+#define TRICORE_TIN_PSE 1 /* Class 4: program fetch synchronous */
+#define TRICORE_TIN_DSE 2 /* Class 4: data access synchronous */
+#define TRICORE_TIN_DAE 3 /* Class 4: data access asynchronous */
+#define TRICORE_TIN_CAE 4 /* Class 4: coprocessor asynchronous */
+#define TRICORE_TIN_PIE 5 /* Class 4: program memory integrity */
+#define TRICORE_TIN_DIE 6 /* Class 4: data memory integrity */
+#define TRICORE_TIN_TAE 7 /* Class 4: temporal asynchronous */
+
+#define TRICORE_TIN_OVF 1 /* Class 5: arithmetic overflow */
+#define TRICORE_TIN_SOVF 2 /* Class 5: sticky overflow */
+
+/* The trap vectors enter tricore_trapcall() with jli, return with ji */
+
+#ifdef CONFIG_TRICORE_TOOLCHAIN_TASKING
+# define tricore_trap_return() __asm__ volatile ("ji a11" : : : "a11")
+#else
+# define tricore_trap_return() __asm__ volatile ("ji %a11")
+#endif
+
+/* Smallest FCU pool: two CSAs for the trapped context, the rest for the
+ * panic path.
+ */
+
+#define TRICORE_FCU_CSA_MINNUM 20
Review Comment:
If CONFIG_TRICORE_FCU_CSA_NUM is defined, this macro is not needed.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]