summaryrefslogtreecommitdiff
path: root/ports/risc-v32/gnu/src/tx_thread_interrupt_control.S
diff options
context:
space:
mode:
authorFrédéric Desbiens <[email protected]>2026-03-06 19:27:49 +0100
committerGitHub <[email protected]>2026-03-06 19:27:49 +0100
commit3726d7906b4808bfec7855fc088e073199df9120 (patch)
tree8789bfd03d1d49e1967e80d04aa4ff606fda43eb /ports/risc-v32/gnu/src/tx_thread_interrupt_control.S
parent4b6e8100d932a3a67b34c6eb17f84f3bffb9e2ae (diff)
parentc3259a216026372e3833dd8996a68f77e8595fbd (diff)
Merge pull request #510 from eclipse-threadx/devv6.5.0.202601_rel
Merge changes ahead of the v6.5.0.202601 release
Diffstat (limited to 'ports/risc-v32/gnu/src/tx_thread_interrupt_control.S')
-rw-r--r--ports/risc-v32/gnu/src/tx_thread_interrupt_control.S88
1 files changed, 88 insertions, 0 deletions
diff --git a/ports/risc-v32/gnu/src/tx_thread_interrupt_control.S b/ports/risc-v32/gnu/src/tx_thread_interrupt_control.S
new file mode 100644
index 00000000..aab2955b
--- /dev/null
+++ b/ports/risc-v32/gnu/src/tx_thread_interrupt_control.S
@@ -0,0 +1,88 @@
+/***************************************************************************
+ * Copyright (c) 2025 10xEngineers
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the MIT License which is available at
+ * https://opensource.org/licenses/MIT.
+ *
+ * SPDX-License-Identifier: MIT
+ **************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** ThreadX Component */
+/** */
+/** Thread */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+
+ .section .text
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _tx_thread_interrupt_control RISC-V32/GNU */
+/* 6.4.x */
+/* AUTHOR */
+/* */
+/* Akif Ejaz, 10xEngineers */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function is responsible for changing the interrupt lockout */
+/* posture of the system. */
+/* */
+/* INPUT */
+/* */
+/* new_posture New interrupt lockout posture */
+/* */
+/* OUTPUT */
+/* */
+/* old_posture Old interrupt lockout posture */
+/* */
+/* CALLS */
+/* */
+/* None */
+/* */
+/* CALLED BY */
+/* */
+/* Application Code */
+/* */
+/**************************************************************************/
+/* UINT _tx_thread_interrupt_control(UINT new_posture)
+{ */
+ .global _tx_thread_interrupt_control
+_tx_thread_interrupt_control:
+
+ /* Pickup current interrupt posture. */
+
+ csrr a1, mstatus // Pickup mstatus
+ andi a1, a1, 0x08 // Mask out all but MIE
+
+ /* Check for the new posture. */
+
+ beqz a0, _tx_thread_interrupt_disable // If 0, disable interrupts
+
+ /* Enable interrupts. */
+
+ csrsi mstatus, 0x08 // Enable interrupts (MIE bit 3)
+ j _tx_thread_interrupt_control_exit // Return to caller
+
+_tx_thread_interrupt_disable:
+
+ /* Disable interrupts. */
+
+ csrci mstatus, 0x08 // Disable interrupts (MIE bit 3)
+
+_tx_thread_interrupt_control_exit:
+
+ /* Return the old interrupt posture. */
+
+ mv a0, a1 // Setup return value
+ ret // Return to caller
+
+/* } */