From 11807abd4e09b70ecc6b65856d00edb8a1a62063 Mon Sep 17 00:00:00 2001 From: Abdelatif Guettouche Date: Thu, 24 Mar 2022 22:37:48 +0100 Subject: [PATCH] arch/xtensa: Add xtensa_tcbinfo struct that contains helpful offsets. Signed-off-by: Abdelatif Guettouche --- arch/xtensa/src/common/xtensa_tcbinfo.c | 75 +++++++++++++++++++++++++ arch/xtensa/src/esp32/Make.defs | 5 ++ 2 files changed, 80 insertions(+) create mode 100644 arch/xtensa/src/common/xtensa_tcbinfo.c diff --git a/arch/xtensa/src/common/xtensa_tcbinfo.c b/arch/xtensa/src/common/xtensa_tcbinfo.c new file mode 100644 index 00000000000..7e9c9ab2848 --- /dev/null +++ b/arch/xtensa/src/common/xtensa_tcbinfo.c @@ -0,0 +1,75 @@ +/**************************************************************************** + * arch/xtensa/src/common/xtensa_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 + +#include +#include + +/**************************************************************************** + * Private Data + ****************************************************************************/ + +static const uint16_t g_reg_offs[] = +{ + TCB_REG_OFF(REG_PC), + TCB_REG_OFF(REG_PS), + TCB_REG_OFF(REG_A0), + TCB_REG_OFF(REG_A1), + TCB_REG_OFF(REG_A2), + TCB_REG_OFF(REG_A3), + TCB_REG_OFF(REG_A4), + TCB_REG_OFF(REG_A5), + TCB_REG_OFF(REG_A6), + TCB_REG_OFF(REG_A7), + TCB_REG_OFF(REG_A8), + TCB_REG_OFF(REG_A9), + TCB_REG_OFF(REG_A10), + TCB_REG_OFF(REG_A11), + TCB_REG_OFF(REG_A12), + TCB_REG_OFF(REG_A13), + TCB_REG_OFF(REG_A14), + TCB_REG_OFF(REG_A15), +}; + +/**************************************************************************** + * 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, + .reg_num = XCPTCONTEXT_REGS, + { + .p = g_reg_offs, + }, +}; + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + diff --git a/arch/xtensa/src/esp32/Make.defs b/arch/xtensa/src/esp32/Make.defs index 5e0b238a55e..f90195d53bf 100644 --- a/arch/xtensa/src/esp32/Make.defs +++ b/arch/xtensa/src/esp32/Make.defs @@ -43,6 +43,11 @@ CMN_CSRCS += xtensa_unblocktask.c xtensa_usestack.c xtensa_swint.c xtensa_switch # Configuration-dependent common XTENSA files +ifeq ($(CONFIG_DEBUG_TCBINFO),y) + CMN_CSRCS += xtensa_tcbinfo.c +endif + + ifeq ($(CONFIG_DEBUG_ALERT),y) CMN_CSRCS += xtensa_dumpstate.c endif