You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by je...@apache.org on 2023/07/26 07:33:51 UTC
[nuttx] 04/05: arch/sparc: Add g_tcb_info
This is an automated email from the ASF dual-hosted git repository.
jerpelea pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git
commit 7ca4c916ebf5b7efd6ec0e3ac202416730c5a5ed
Author: Xiang Xiao <xi...@xiaomi.com>
AuthorDate: Tue Jul 25 21:26:14 2023 +0800
arch/sparc: Add g_tcb_info
Signed-off-by: Xiang Xiao <xi...@xiaomi.com>
---
arch/sparc/src/common/Make.defs | 2 +-
arch/sparc/src/common/sparc_tcbinfo.c | 92 +++++++++++++++++++++++++++++++++++
2 files changed, 93 insertions(+), 1 deletion(-)
diff --git a/arch/sparc/src/common/Make.defs b/arch/sparc/src/common/Make.defs
index 7d3d13b242..b79fd5d56e 100644
--- a/arch/sparc/src/common/Make.defs
+++ b/arch/sparc/src/common/Make.defs
@@ -25,7 +25,7 @@ CMN_CSRCS += sparc_getintstack.c sparc_idle.c sparc_initialize.c
CMN_CSRCS += sparc_lowputs.c sparc_mdelay.c sparc_modifyreg8.c
CMN_CSRCS += sparc_modifyreg16.c sparc_modifyreg32.c sparc_nputs.c
CMN_CSRCS += sparc_releasestack.c sparc_stackframe.c
-CMN_CSRCS += sparc_udelay.c sparc_usestack.c
+CMN_CSRCS += sparc_udelay.c sparc_usestack.c sparc_tcbinfo.c
# Configuration-dependent common files
diff --git a/arch/sparc/src/common/sparc_tcbinfo.c b/arch/sparc/src/common/sparc_tcbinfo.c
new file mode 100644
index 0000000000..aaf6dad9ed
--- /dev/null
+++ b/arch/sparc/src/common/sparc_tcbinfo.c
@@ -0,0 +1,92 @@
+/****************************************************************************
+ * arch/sparc/src/common/sparc_tcbinfo.c
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <nuttx/sched.h>
+#include <arch/irq.h>
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+static const uint16_t g_reg_offs[] =
+{
+ UINT16_MAX, /* G0 */
+ TCB_REG_OFF(REG_G1), /* G1 */
+ TCB_REG_OFF(REG_G2), /* G2 */
+ TCB_REG_OFF(REG_G3), /* G3 */
+ TCB_REG_OFF(REG_G4), /* G4 */
+ TCB_REG_OFF(REG_G5), /* G5 */
+ TCB_REG_OFF(REG_G6), /* G6 */
+ TCB_REG_OFF(REG_G7), /* G7 */
+ TCB_REG_OFF(REG_O0), /* O0 */
+ TCB_REG_OFF(REG_O1), /* O1 */
+ TCB_REG_OFF(REG_O2), /* O2 */
+ TCB_REG_OFF(REG_O3), /* O3 */
+ TCB_REG_OFF(REG_O4), /* O4 */
+ TCB_REG_OFF(REG_O5), /* O5 */
+ TCB_REG_OFF(REG_O6), /* O6 */
+ TCB_REG_OFF(REG_O7), /* O7 */
+ TCB_REG_OFF(REG_L0), /* L0 */
+ TCB_REG_OFF(REG_L1), /* L1 */
+ TCB_REG_OFF(REG_L2), /* L2 */
+ TCB_REG_OFF(REG_L3), /* L3 */
+ TCB_REG_OFF(REG_L4), /* L4 */
+ TCB_REG_OFF(REG_L5), /* L5 */
+ TCB_REG_OFF(REG_L6), /* L6 */
+ TCB_REG_OFF(REG_L7), /* L7 */
+ TCB_REG_OFF(REG_I0), /* I0 */
+ TCB_REG_OFF(REG_I1), /* I1 */
+ TCB_REG_OFF(REG_I2), /* I2 */
+ TCB_REG_OFF(REG_I3), /* I3 */
+ TCB_REG_OFF(REG_I4), /* I4 */
+ TCB_REG_OFF(REG_I5), /* I5 */
+ TCB_REG_OFF(REG_I6), /* I6 */
+ TCB_REG_OFF(REG_I7), /* I7 */
+};
+
+/****************************************************************************
+ * Public Data
+ ****************************************************************************/
+
+const struct tcbinfo_s g_tcbinfo =
+{
+ .pid_off = TCB_PID_OFF,
+ .state_off = TCB_STATE_OFF,
+ .pri_off = TCB_PRI_OFF,
+ .name_off = TCB_NAME_OFF,
+ .stack_off = TCB_STACK_OFF,
+ .stack_size_off = TCB_STACK_SIZE_OFF,
+ .regs_off = TCB_REGS_OFF,
+ .basic_num = sizeof(g_reg_offs) / sizeof(g_reg_offs[0]),
+ .total_num = sizeof(g_reg_offs) / sizeof(g_reg_offs[0]),
+ {
+ .p = g_reg_offs,
+ },
+};
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/