Replaced QF_EVT_REF_CTR_INC_() with QEvt_refCtr_inc_() in ports
- embOS
- FreeRTOS
- ThreadX
- uC-OS2
- Qt
This commit is contained in:
MMS 2022-11-22 13:11:43 -05:00
parent e39400bdbe
commit 264b16f566
8 changed files with 99 additions and 439 deletions

View File

@ -1,327 +0,0 @@
##############################################################################
# Product: Makefile for QP/C++ on EK-TM4C123GXL, uC/OS-II kernel, GNU-ARM
# Last Updated for Version: 7.0.1
# Date of the Last Update: 2022-05-23
#
# Q u a n t u m L e a P s
# ------------------------
# Modern Embedded Software
#
# Copyright (C) 2005-2021 Quantum Leaps, LLC. All rights reserved.
#
# This program is open source software: you can redistribute it and/or
# modify it under the terms of the GNU General Public License as published
# by the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Alternatively, this program may be distributed and modified under the
# terms of Quantum Leaps commercial licenses, which expressly supersede
# the GNU General Public License and are specifically designed for
# licensees interested in retaining the proprietary status of their code.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses>.
#
# Contact information:
# <www.state-machine.com/licensing>
# <info@state-machine.com>
##############################################################################
# examples of invoking this Makefile:
# building configurations: Debug (default), Release, and Spy
# make
# make CONF=rel
# make CONF=spy
#
# cleaning configurations: Debug (default), Release, and Spy
# make clean
# make CONF=rel clean
# make CONF=spy clean
#
# NOTE:
# To use this Makefile on Windows, you will need the GNU make utility, which
# is included in the Qtools collection for Windows, see:
# https://sourceforge.net/projects/qpc/files/QTools/
#
#-----------------------------------------------------------------------------
# project name
#
PROJECT := dpp
#-----------------------------------------------------------------------------
# project directories
#
# location of the QP/C++ framework (if not provided in an environemnt var.)
ifeq ($(QPCPP),)
QPCPP := ../../../../..
endif
# QP port used in this project
QP_PORT_DIR := $(QPCPP)/ports/uc-os2
# list of all source directories used by this project
VPATH = \
.. \
$(QPCPP)/src/qf \
$(QPCPP)/src/qs \
$(QP_PORT_DIR) \
$(QPCPP)/3rd_party/uC-OS2/Source \
$(QPCPP)/3rd_party/uC-OS2/Ports/ARM-Cortex-M/ARMv7-M \
$(QPCPP)/3rd_party/uC-OS2/Ports/ARM-Cortex-M/ARMv7-M/GNU \
$(QPCPP)/3rd_party/ek-tm4c123gxl \
$(QPCPP)/3rd_party/ek-tm4c123gxl/gnu
# list of all include directories needed by this project
INCLUDES = \
-I.. \
-I$(QPCPP)/include \
-I$(QP_PORT_DIR) \
-I$(QPCPP)/3rd_party/uC-OS2/Source \
-I$(QPCPP)/3rd_party/uC-OS2/Ports/ARM-Cortex-M/ARMv7-M/GNU \
-I$(QPCPP)/3rd_party/CMSIS/Include \
-I$(QPCPP)/3rd_party/ek-tm4c123gxl
#-----------------------------------------------------------------------------
# files
#
# assembler source files
ASM_SRCS := \
os_cpu_a.s
# C source files
C_SRCS := \
system_TM4C123GH6PM.c \
startup_TM4C123GH6PM.c
# C++ source files
CPP_SRCS := \
bsp.cpp \
main.cpp \
philo.cpp \
table.cpp
OUTPUT := $(PROJECT)
LD_SCRIPT := $(PROJECT).ld
QP_SRCS := \
qep_hsm.cpp \
qep_msm.cpp \
qf_act.cpp \
qf_actq.cpp \
qf_defer.cpp \
qf_dyn.cpp \
qf_mem.cpp \
qf_ps.cpp \
qf_qact.cpp \
qf_qeq.cpp \
qf_qmact.cpp \
qf_time.cpp \
qf_port.cpp
RTOS_SRCS := \
os_core.c \
os_flag.c \
os_mbox.c \
os_mem.c \
os_mutex.c \
os_q.c \
os_sem.c \
os_task.c \
os_time.c \
os_tmr.c \
os_dbg.c \
os_cpu_c.c
QS_SRCS := \
qs.cpp \
qs_rx.cpp \
qs_fp.cpp
LIB_DIRS :=
LIBS :=
# defines
DEFINES := -DTARGET_IS_TM4C123_RB1 -D__FPU_PRESENT
# ARM CPU, ARCH, FPU, and Float-ABI types...
# ARM_CPU: [cortex-m0 | cortex-m0plus | cortex-m1 | cortex-m3 | cortex-m4]
# ARM_FPU: [ | vfp]
# FLOAT_ABI: [ | soft | softfp | hard]
#
ARM_CPU := -mcpu=cortex-m4
ARM_FPU := -mfpu=vfp
FLOAT_ABI := -mfloat-abi=softfp
ASM_FPU := -defsym=__FPU_PRESENT=1
#-----------------------------------------------------------------------------
# GNU-ARM toolset (NOTE: You need to adjust to your machine)
# see https://developer.arm.com/open-source/gnu-toolchain/gnu-rm/downloads
#
ifeq ($(GNU_ARM),)
GNU_ARM := $(QTOOLS)/gnu_arm-none-eabi
endif
# make sure that the GNU-ARM toolset exists...
ifeq ("$(wildcard $(GNU_ARM))","")
$(error GNU_ARM toolset not found. Please adjust the Makefile)
endif
CC := $(GNU_ARM)/bin/arm-none-eabi-gcc
CPP := $(GNU_ARM)/bin/arm-none-eabi-g++
AS := $(GNU_ARM)/bin/arm-none-eabi-as
LINK := $(GNU_ARM)/bin/arm-none-eabi-g++
BIN := $(GNU_ARM)/bin/arm-none-eabi-objcopy
##############################################################################
# Typically, you should not need to change anything below this line
# basic utilities (included in Qtools for Windows), see:
# http://sourceforge.net/projects/qpc/files/Qtools
MKDIR := mkdir
RM := rm
#-----------------------------------------------------------------------------
# build options for various configurations for ARM Cortex-M
#
# combine all the soruces...
CPP_SRCS += $(QP_SRCS)
ASM_SRCS += $(QP_ASMS)
C_SRCS += $(RTOS_SRCS)
ifeq (rel, $(CONF)) # Release configuration ..................................
BIN_DIR := rel
ASFLAGS = $(ARM_CPU) $(ARM_FPU) $(ASM_CPU) $(ASM_FPU)
CFLAGS = -c $(ARM_CPU) $(ARM_FPU) $(FLOAT_ABI) -mthumb -Wall \
-ffunction-sections -fdata-sections \
-O1 $(INCLUDES) $(DEFINES) -DNDEBUG
CPPFLAGS = -c $(ARM_CPU) $(ARM_FPU) $(FLOAT_ABI) -mthumb -Wall \
-ffunction-sections -fdata-sections -fno-rtti -fno-exceptions \
-O1 $(INCLUDES) $(DEFINES) -DNDEBUG
else ifeq (spy, $(CONF)) # Spy configuration ................................
BIN_DIR := spy
CPP_SRCS += $(QS_SRCS)
ASFLAGS = -g $(ARM_CPU) $(ARM_FPU) $(ASM_CPU) $(ASM_FPU)
CFLAGS = -c -g $(ARM_CPU) $(ARM_FPU) $(FLOAT_ABI) -mthumb -Wall \
-ffunction-sections -fdata-sections \
-O $(INCLUDES) $(DEFINES) -DQ_SPY
CPPFLAGS = -c -g $(ARM_CPU) $(ARM_FPU) $(FLOAT_ABI) -mthumb -Wall \
-ffunction-sections -fdata-sections -fno-rtti -fno-exceptions \
-O $(INCLUDES) $(DEFINES) -DQ_SPY
else # default Debug configuration ..........................................
BIN_DIR := dbg
ASFLAGS = -g $(ARM_CPU) $(ARM_FPU) $(ASM_CPU) $(ASM_FPU)
CFLAGS = -c -g $(ARM_CPU) $(ARM_FPU) $(FLOAT_ABI) -mthumb -Wall \
-ffunction-sections -fdata-sections \
-O $(INCLUDES) $(DEFINES)
CPPFLAGS = -c -g $(ARM_CPU) $(ARM_FPU) $(FLOAT_ABI) -mthumb -Wall \
-ffunction-sections -fdata-sections -fno-rtti -fno-exceptions \
-O $(INCLUDES) $(DEFINES)
endif # ......................................................................
LINKFLAGS = -T$(LD_SCRIPT) $(ARM_CPU) $(ARM_FPU) $(FLOAT_ABI) -mthumb \
-specs=nosys.specs -specs=nano.specs \
-Wl,-Map,$(BIN_DIR)/$(OUTPUT).map,--cref,--gc-sections $(LIB_DIRS)
ASM_OBJS := $(patsubst %.s,%.o, $(notdir $(ASM_SRCS)))
C_OBJS := $(patsubst %.c,%.o, $(notdir $(C_SRCS)))
CPP_OBJS := $(patsubst %.cpp,%.o,$(notdir $(CPP_SRCS)))
TARGET_BIN := $(BIN_DIR)/$(OUTPUT).bin
TARGET_ELF := $(BIN_DIR)/$(OUTPUT).elf
ASM_OBJS_EXT := $(addprefix $(BIN_DIR)/, $(ASM_OBJS))
C_OBJS_EXT := $(addprefix $(BIN_DIR)/, $(C_OBJS))
C_DEPS_EXT := $(patsubst %.o, %.d, $(C_OBJS_EXT))
CPP_OBJS_EXT := $(addprefix $(BIN_DIR)/, $(CPP_OBJS))
CPP_DEPS_EXT := $(patsubst %.o, %.d, $(CPP_OBJS_EXT))
# create $(BIN_DIR) if it does not exist
ifeq ("$(wildcard $(BIN_DIR))","")
$(shell $(MKDIR) $(BIN_DIR))
endif
#-----------------------------------------------------------------------------
# rules
#
all: $(TARGET_BIN)
#all: $(TARGET_ELF)
$(TARGET_BIN): $(TARGET_ELF)
$(BIN) -O binary $< $@
$(TARGET_ELF) : $(ASM_OBJS_EXT) $(C_OBJS_EXT) $(CPP_OBJS_EXT)
$(CPP) $(CPPFLAGS) $(QPCPP)/include/qstamp.cpp -o $(BIN_DIR)/qstamp.o
$(LINK) $(LINKFLAGS) -o $@ $^ $(BIN_DIR)/qstamp.o $(LIBS)
$(BIN_DIR)/%.d : %.c
$(CC) -MM -MT $(@:.d=.o) $(CFLAGS) $< > $@
$(BIN_DIR)/%.d : %.cpp
$(CPP) -MM -MT $(@:.d=.o) $(CPPFLAGS) $< > $@
$(BIN_DIR)/%.o : %.s
$(AS) $(ASFLAGS) $< -o $@
$(BIN_DIR)/%.o : %.c
$(CC) $(CFLAGS) $< -o $@
$(BIN_DIR)/%.o : %.cpp
$(CPP) $(CPPFLAGS) $< -o $@
# include dependency files only if our goal depends on their existence
ifneq ($(MAKECMDGOALS),clean)
ifneq ($(MAKECMDGOALS),show)
-include $(C_DEPS_EXT) $(CPP_DEPS_EXT)
endif
endif
.PHONY : clean
clean:
-$(RM) $(BIN_DIR)/*.o \
$(BIN_DIR)/*.d \
$(BIN_DIR)/*.bin \
$(BIN_DIR)/*.elf \
$(BIN_DIR)/*.map
show:
@echo PROJECT = $(PROJECT)
@echo CONF = $(CONF)
@echo DEFINES = $(DEFINES)
@echo ASM_FPU = $(ASM_FPU)
@echo ASM_SRCS = $(ASM_SRCS)
@echo C_SRCS = $(C_SRCS)
@echo CPP_SRCS = $(CPP_SRCS)
@echo ASM_OBJS_EXT = $(ASM_OBJS_EXT)
@echo C_OBJS_EXT = $(C_OBJS_EXT)
@echo C_DEPS_EXT = $(C_DEPS_EXT)
@echo CPP_DEPS_EXT = $(CPP_DEPS_EXT)
@echo TARGET_ELF = $(TARGET_ELF)

View File

@ -22,8 +22,8 @@
// <www.state-machine.com>
// <info@state-machine.com>
//============================================================================
//! @date Last updated on: 2022-09-17
//! @version Last updated for: @ref qpcpp_7_1_1
//! @date Last updated on: 2022-11-22
//! @version Last updated for: @ref qpcpp_7_1_3
//!
//! @file
//! @brief QF/C++ port to embOS RTOS kernel, all supported compilers
@ -74,7 +74,7 @@ int_t QF::run(void) {
OS_Start(); // start embOS multitasking
Q_ERROR_ID(100); // OS_Start() should never return
return 0; // dummy return to make the compiler happy
return 0; // dummy return to make the compiler happy
}
//............................................................................
void QF::stop(void) {
@ -186,17 +186,17 @@ bool QActive::post_(QEvt const * const e, std::uint_fast16_t const margin,
if (status) { // can post the event?
QS_BEGIN_NOCRIT_PRE_(QS_QF_ACTIVE_POST, m_prio)
QS_TIME_PRE_(); // timestamp
QS_OBJ_PRE_(sender); // the sender object
QS_SIG_PRE_(e->sig); // the signal of the event
QS_OBJ_PRE_(this); // this active object (recipient)
QS_TIME_PRE_(); // timestamp
QS_OBJ_PRE_(sender); // the sender object
QS_SIG_PRE_(e->sig); // the signal of the event
QS_OBJ_PRE_(this); // this active object (recipient)
QS_2U8_PRE_(e->poolId_, e->refCtr_); // pool Id & ref Count
QS_EQC_PRE_(nFree); // # free entries
QS_EQC_PRE_(0U); // min # free (unknown)
QS_EQC_PRE_(nFree); // # free entries
QS_EQC_PRE_(0U); // min # free (unknown)
QS_END_NOCRIT_PRE_()
if (e->poolId_ != 0U) { // is it a pool event?
QF_EVT_REF_CTR_INC_(e); // increment the reference counter
if (e->poolId_ != 0U) { // is it a pool event?
QEvt_refCtr_inc_(e); // increment the reference counter
}
QF_CRIT_X_();
@ -209,13 +209,13 @@ bool QActive::post_(QEvt const * const e, std::uint_fast16_t const margin,
else {
QS_BEGIN_NOCRIT_PRE_(QS_QF_ACTIVE_POST_ATTEMPT, m_prio)
QS_TIME_PRE_(); // timestamp
QS_OBJ_PRE_(sender); // the sender object
QS_SIG_PRE_(e->sig); // the signal of the event
QS_OBJ_PRE_(this); // this active object (recipient)
QS_TIME_PRE_(); // timestamp
QS_OBJ_PRE_(sender); // the sender object
QS_SIG_PRE_(e->sig); // the signal of the event
QS_OBJ_PRE_(this); // this active object (recipient)
QS_2U8_PRE_(e->poolId_, e->refCtr_); // pool Id & ref Count
QS_EQC_PRE_(nFree); // # free entries
QS_EQC_PRE_(0U); // min # free (unknown)
QS_EQC_PRE_(nFree); // # free entries
QS_EQC_PRE_(0U); // min # free (unknown)
QS_END_NOCRIT_PRE_()
QF_CRIT_X_();
@ -229,16 +229,16 @@ void QActive::postLIFO(QEvt const * const e) noexcept {
QF_CRIT_E_();
QS_BEGIN_NOCRIT_PRE_(QS_QF_ACTIVE_POST_LIFO, m_prio)
QS_TIME_PRE_(); // timestamp
QS_SIG_PRE_(e->sig); // the signal of this event
QS_OBJ_PRE_(this); // this active object
QS_TIME_PRE_(); // timestamp
QS_SIG_PRE_(e->sig); // the signal of this event
QS_OBJ_PRE_(this); // this active object
QS_2U8_PRE_(e->poolId_, e->refCtr_); // pool Id & ref Count
QS_EQC_PRE_(m_eQueue.maxMsg - m_eQueue.nofMsg); // # free entries
QS_EQC_PRE_(0U); // min # free entries (unknown)
QS_EQC_PRE_(0U); // min # free entries (unknown)
QS_END_NOCRIT_PRE_()
if (e->poolId_ != 0U) { // is it a pool event?
QF_EVT_REF_CTR_INC_(e); // increment the reference counter
if (e->poolId_ != 0U) { // is it a pool event?
QEvt_refCtr_inc_(e); // increment the reference counter
}
QF_CRIT_X_();
@ -256,9 +256,9 @@ QEvt const *QActive::get_(void) noexcept {
OS_GetMail(&m_eQueue, &e);
QS_BEGIN_PRE_(QS_QF_ACTIVE_GET, m_prio)
QS_TIME_PRE_(); // timestamp
QS_SIG_PRE_(e->sig); // the signal of this event
QS_OBJ_PRE_(this); // this active object
QS_TIME_PRE_(); // timestamp
QS_SIG_PRE_(e->sig); // the signal of this event
QS_OBJ_PRE_(this); // this active object
QS_2U8_PRE_(e->poolId_, e->refCtr_); // pool Id & ref Count
QS_EQC_PRE_(m_eQueue.maxMsg - m_eQueue.nofMsg); // # free entries
QS_END_PRE_()

View File

@ -22,8 +22,8 @@
// <www.state-machine.com>
// <info@state-machine.com>
//============================================================================
//! @date Last updated on: 2022-09-17
//! @version Last updated for: @ref qpcpp_7_1_1
//! @date Last updated on: 2022-11-22
//! @version Last updated for: @ref qpcpp_7_1_3
//!
//! @file
//! @brief QF/C++ port to FreeRTOS (v10.x) kernel, all supported compilers
@ -229,7 +229,7 @@ bool QActive::post_(QEvt const * const e, std::uint_fast16_t const margin,
// is it a pool event?
if (e->poolId_ != 0U) {
QF_EVT_REF_CTR_INC_(e); // increment the reference counter
QEvt_refCtr_inc_(e); // increment the reference counter
}
QF_CRIT_X_();
@ -267,12 +267,12 @@ void QActive::postLIFO(QEvt const * const e) noexcept {
QS_OBJ_PRE_(this); // this active object
QS_2U8_PRE_(e->poolId_, e->refCtr_); // pool Id & refCtr of the evt
QS_EQC_PRE_(FREERTOS_QUEUE_GET_FREE()); // # free slots
QS_EQC_PRE_(0U); // min # free entries (unknown)
QS_EQC_PRE_(0U); // min # free entries (unknown)
QS_END_NOCRIT_PRE_()
// is it a pool event?
if (e->poolId_ != 0U) {
QF_EVT_REF_CTR_INC_(e); // increment the reference counter
QEvt_refCtr_inc_(e); // increment the reference counter
}
QF_CRIT_X_();
@ -340,8 +340,8 @@ bool QActive::postFromISR_(QEvt const * const e,
QS_EQC_PRE_(0U); // min # free entries (unknown)
QS_END_NOCRIT_PRE_()
if (e->poolId_ != 0U) { // is it a pool event?
QF_EVT_REF_CTR_INC_(e); // increment the reference counter
if (e->poolId_ != 0U) { // is it a pool event?
QEvt_refCtr_inc_(e); // increment the reference counter
}
portCLEAR_INTERRUPT_MASK_FROM_ISR(uxSavedInterruptStatus);
@ -396,7 +396,7 @@ void QActive::publishFromISR_(QEvt const *e, void *par,
// and recycles the event if the counter drops to zero. This covers
// the case when the event was published without any subscribers.
//
QF_EVT_REF_CTR_INC_(e);
QEvt_refCtr_inc_(e);
}
// make a local, modifiable copy of the subscriber list
@ -600,7 +600,7 @@ void QF::gcFromISR(QEvt const * const e) noexcept {
// isn't this the last reference?
if (e->refCtr_ > 1U) {
QF_EVT_REF_CTR_DEC_(e); // decrement the ref counter
QEvt_refCtr_dec_(e); // decrement the ref counter
QS_BEGIN_NOCRIT_PRE_(QS_QF_GC_ATTEMPT,
static_cast<uint_fast8_t>(e->poolId_))

View File

@ -21,8 +21,8 @@
// <www.state-machine.com/licensing>
// <info@state-machine.com>
//============================================================================
//! @date Last updated on: 2022-08-25
//! @version Last updated for: @ref qpcpp_7_1_0
//! @date Last updated on: 2022-11-22
//! @version Last updated for: @ref qpcpp_7_1_3
//!
//! @file
//! @brief QP/C++ port to Qt
@ -114,9 +114,8 @@ bool GuiQActive::post_(QEvt const * const e,
QF_CRIT_STAT_
QF_CRIT_E_();
// is it a dynamic event?
if (QF_EVT_POOL_ID_(e) != 0U) {
QF_EVT_REF_CTR_INC_(e); // increment the reference counter
if (e->poolId_ != 0U) { // is it a dynamic event?
QEvt_refCtr_inc_(e); // increment the reference counter
}
QS_BEGIN_NOCRIT_PRE_(QS_QF_ACTIVE_POST, m_prio)
@ -124,8 +123,7 @@ bool GuiQActive::post_(QEvt const * const e,
QS_OBJ_PRE_(sender); // the sender object
QS_SIG_PRE_(e->sig); // the signal of the event
QS_OBJ_PRE_(this); // this active object
QS_2U8_PRE_(QF_EVT_POOL_ID_(e), /* the poolID of the event */
QF_EVT_REF_CTR_(e)); // the ref Ctr of the event
QS_2U8_PRE_(e->poolId_, e->refCtr_); // pool-Id & ref-ctr
QS_EQC_PRE_(0U); // number of free entries (not used)
QS_EQC_PRE_(0U); // min number of free entries (not used)
QS_END_NOCRIT_PRE_()
@ -141,17 +139,15 @@ void GuiQActive::postLIFO(QEvt const * const e) noexcept {
QF_CRIT_STAT_
QF_CRIT_E_();
// is it a dynamic event?
if (QF_EVT_POOL_ID_(e) != 0U) {
QF_EVT_REF_CTR_INC_(e); // increment the reference counter
if (e->poolId_ != 0U) { // is it a dynamic event?
QEvt_refCtr_inc_(e); // increment the reference counter
}
QS_BEGIN_NOCRIT_PRE_(QS_QF_ACTIVE_POST_LIFO, m_prio)
QS_TIME_PRE_(); // timestamp
QS_SIG_PRE_(e->sig); // the signal of this event
QS_OBJ_PRE_(this); // this active object
QS_2U8_PRE_(QF_EVT_POOL_ID_(e), /* the poolID of the event */
QF_EVT_REF_CTR_(e)); // the ref Ctr of the event
QS_2U8_PRE_(e->poolId_, e->refCtr_); // pool-Id & ref-ctr
QS_EQC_PRE_(0U); // number of free entries (not used)
QS_EQC_PRE_(0U); // min number of free entries (not used)
QS_END_NOCRIT_PRE_()
@ -193,9 +189,8 @@ bool GuiQMActive::post_(QEvt const * const e,
QF_CRIT_STAT_
QF_CRIT_E_();
// is it a dynamic event?
if (QF_EVT_POOL_ID_(e) != 0U) {
QF_EVT_REF_CTR_INC_(e); // increment the reference counter
if (e->poolId_ != 0U) { // is it a dynamic event?
QEvt_refCtr_inc_(e); // increment the reference counter
}
QS_BEGIN_NOCRIT_PRE_(QS_QF_ACTIVE_POST, m_prio)
@ -203,8 +198,7 @@ bool GuiQMActive::post_(QEvt const * const e,
QS_OBJ_PRE_(sender); // the sender object
QS_SIG_PRE_(e->sig); // the signal of the event
QS_OBJ_PRE_(this); // this active object
QS_2U8_PRE_(QF_EVT_POOL_ID_(e), /* the poolID of the event */
QF_EVT_REF_CTR_(e)); // the ref Ctr of the event
QS_2U8_PRE_(e->poolId_, e->refCtr_); // pool-Id & ref-ctr
QS_EQC_PRE_(0U); // number of free entries (not used)
QS_EQC_PRE_(0U); // min number of free entries (not used)
QS_END_NOCRIT_PRE_()
@ -220,17 +214,15 @@ void GuiQMActive::postLIFO(QEvt const * const e) noexcept {
QF_CRIT_STAT_
QF_CRIT_E_();
// is it a dynamic event?
if (QF_EVT_POOL_ID_(e) != 0U) {
QF_EVT_REF_CTR_INC_(e); // increment the reference counter
if (e->poolId_ != 0U) { // is it a dynamic event?
QEvt_refCtr_inc_(e); // increment the reference counter
}
QS_BEGIN_NOCRIT_PRE_(QS_QF_ACTIVE_POST_LIFO, m_prio)
QS_TIME_PRE_(); // timestamp
QS_SIG_PRE_(e->sig); // the signal of this event
QS_OBJ_PRE_(this); // this active object
QS_2U8_PRE_(QF_EVT_POOL_ID_(e), /* the poolID of the event */
QF_EVT_REF_CTR_(e)); // the ref Ctr of the event
QS_2U8_PRE_(e->poolId_, e->refCtr_); // pool-Id & ref-ctr
QS_EQC_PRE_(0U); // number of free entries (not used)
QS_EQC_PRE_(0U); // min number of free entries (not used)
QS_END_NOCRIT_PRE_()

View File

@ -22,8 +22,8 @@
// <www.state-machine.com>
// <info@state-machine.com>
//============================================================================
//! @date Last updated on: 2022-09-17
//! @version Last updated for: @ref qpcpp_7_1_1
//! @date Last updated on: 2022-11-22
//! @version Last updated for: @ref qpcpp_7_1_3
//!
//! @file
//! @brief QF/C++ port to ThreadX, all supported compilers
@ -168,9 +168,8 @@ bool QActive::post_(QEvt const * const e, std::uint_fast16_t const margin,
QS_EQC_PRE_(0U); // min # free (unknown)
QS_END_NOCRIT_PRE_()
// is it a pool event?
if (e->poolId_ != 0U) {
QF_EVT_REF_CTR_INC_(e); // increment the reference counter
if (e->poolId_ != 0U) { // is it a pool event?
QEvt_refCtr_inc_(e); // increment the reference counter
}
QF_CRIT_X_();
@ -209,12 +208,11 @@ void QActive::postLIFO(QEvt const * const e) noexcept {
QS_2U8_PRE_(e->poolId_, e->refCtr_); // pool Id & refCtr of the evt
// # free entries available
QS_EQC_PRE_(m_eQueue.tx_queue_available_storage);
QS_EQC_PRE_(0U); // min # free entries (unknown)
QS_EQC_PRE_(0U); // min # free entries (unknown)
QS_END_NOCRIT_PRE_()
// is it a pool event?
if (e->poolId_ != 0U) {
QF_EVT_REF_CTR_INC_(e); // increment the reference counter
if (e->poolId_ != 0U) { // is it a pool event?
QEvt_refCtr_inc_(e); // increment the reference counter
}
QF_CRIT_X_();

View File

@ -22,8 +22,8 @@
// <www.state-machine.com>
// <info@state-machine.com>
//============================================================================
//! @date Last updated on: 2022-09-22
//! @version Last updated for: @ref qpcpp_7_1_1
//! @date Last updated on: 2022-11-22
//! @version Last updated for: @ref qpcpp_7_1_3
//!
//! @file
//! @brief QF/C++ port to uC-OS2, generic C++11 compiler
@ -75,10 +75,6 @@ void QActive::start(QPrioSpec const prioSpec,
void * const stkSto, std::uint_fast16_t const stkSize,
void const * const par)
{
m_prio = static_cast<std::uint8_t>(prioSpec & 0xFFU); // QF-priority
m_pthre = static_cast<std::uint8_t>(prioSpec >> 8U); // preemption-thre.
register_(); // make QF aware of this AO
// task name to be passed to OSTaskCreateExt()
void * const task_name = static_cast<void *>(m_eQueue);
@ -86,6 +82,10 @@ void QActive::start(QPrioSpec const prioSpec,
m_eQueue = OSQCreate((void **)qSto, qLen);
Q_ASSERT_ID(210, m_eQueue != nullptr);
m_prio = static_cast<std::uint8_t>(prioSpec & 0xFFU); // QF-priority
m_pthre = static_cast<std::uint8_t>(prioSpec >> 8U); // preemption-thre.
register_(); // make QF aware of this AO
init(par, m_prio); // take the top-most initial tran.
QS_FLUSH(); // flush the trace buffer to the host
@ -148,8 +148,6 @@ void QActive::thread_(QActive *act) {
act->dispatch(e, act->m_prio); // dispatch to the AO's state machine
QF::gc(e); // check if the event is garbage, and collect it if so
}
act->unregister_(); // remove this object from QF
OSTaskDel(OS_PRIO_SELF); // make uC-OS2 forget about this task
}
//............................................................................
static void task_function(void *pdata) { // uC-OS2 task signature
@ -160,7 +158,6 @@ bool QActive::post_(QEvt const * const e, std::uint_fast16_t const margin,
void const * const sender) noexcept
{
QF_CRIT_STAT_
QF_CRIT_E_();
std::uint_fast16_t const nFree = static_cast<std::uint_fast16_t>(
reinterpret_cast<OS_Q_DATA *>(m_eQueue)->OSQSize
@ -169,15 +166,15 @@ bool QActive::post_(QEvt const * const e, std::uint_fast16_t const margin,
bool status;
if (margin == QF::NO_MARGIN) {
if (nFree > 0U) {
status = true; // can post
status = true; // can post
}
else {
status = false; // cannot post
status = false; // cannot post
Q_ERROR_ID(710); // must be able to post the event
}
}
else if (nFree > static_cast<QEQueueCtr>(margin)) {
status = true; // can post
status = true; // can post
}
else {
status = false; // cannot post
@ -195,8 +192,8 @@ bool QActive::post_(QEvt const * const e, std::uint_fast16_t const margin,
QS_EQC_PRE_(0U); // min # free (unknown)
QS_END_NOCRIT_PRE_()
if (e->poolId_ != 0U) { // is it a pool event?
QF_EVT_REF_CTR_INC_(e); // increment the reference counter
if (e->poolId_ != 0U) { // is it a pool event?
QEvt_refCtr_inc_(e); // increment the reference counter
}
QF_CRIT_X_();
@ -228,18 +225,18 @@ void QActive::postLIFO(QEvt const * const e) noexcept {
QF_CRIT_E_();
QS_BEGIN_NOCRIT_PRE_(QS_QF_ACTIVE_POST_LIFO, m_prio)
QS_TIME_PRE_(); // timestamp
QS_SIG_PRE_(e->sig); // the signal of this event
QS_OBJ_PRE_(this); // this active object
QS_TIME_PRE_(); // timestamp
QS_SIG_PRE_(e->sig); // the signal of this event
QS_OBJ_PRE_(this); // this active object
QS_2U8_PRE_(e->poolId_, e->refCtr_); // pool Id & ref Count
// # free entries
// # free entries
QS_EQC_PRE_(reinterpret_cast<OS_Q *>(m_eQueue)->OSQSize
- reinterpret_cast<OS_Q *>(m_eQueue)->OSQEntries);
QS_EQC_PRE_(0U); // min # free (unknown)
QS_EQC_PRE_(0U); // min # free (unknown)
QS_END_NOCRIT_PRE_()
if (e->poolId_ != 0U) { // is it a pool event?
QF_EVT_REF_CTR_INC_(e); // increment the reference counter
if (e->poolId_ != 0U) { // is it a pool event?
QEvt_refCtr_inc_(e); // increment the reference counter
}
QF_CRIT_X_();

View File

@ -1,5 +1,5 @@
//============================================================================
// QS/C++ port to uC-OS2 RTOS, generic C++11 compiler
// QP/C Real-Time Embedded Framework (RTEF)
// Copyright (C) 2005 Quantum Leaps, LLC. All rights reserved.
//
// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-QL-commercial

View File

@ -22,8 +22,8 @@
// <www.state-machine.com>
// <info@state-machine.com>
//============================================================================
//! @date Last updated on: 2022-09-17
//! @version Last updated for: Zephyr 3.1.99 and @ref qpcpp_7_1_1
//! @date Last updated on: 2022-11-22
//! @version Last updated for: Zephyr 3.1.99 and @ref qpcpp_7_1_3
//!
//! @file
//! @brief QF/C++ port to Zephyr RTOS kernel, all supported compilers
@ -189,17 +189,17 @@ bool QActive::post_(QEvt const * const e, std::uint_fast16_t const margin,
if (status) { // can post the event?
QS_BEGIN_NOCRIT_PRE_(QS_QF_ACTIVE_POST, m_prio)
QS_TIME_PRE_(); // timestamp
QS_OBJ_PRE_(sender); // the sender object
QS_SIG_PRE_(e->sig); // the signal of the event
QS_OBJ_PRE_(this); // this active object (recipient)
QS_TIME_PRE_(); // timestamp
QS_OBJ_PRE_(sender); // the sender object
QS_SIG_PRE_(e->sig); // the signal of the event
QS_OBJ_PRE_(this); // this active object (recipient)
QS_2U8_PRE_(e->poolId_, e->refCtr_); // pool Id & ref Count
QS_EQC_PRE_(nFree); // # free entries
QS_EQC_PRE_(0U); // min # free (unknown)
QS_EQC_PRE_(nFree); // # free entries
QS_EQC_PRE_(0U); // min # free (unknown)
QS_END_NOCRIT_PRE_()
if (e->poolId_ != 0U) { // is it a pool event?
QF_EVT_REF_CTR_INC_(e); // increment the reference counter
if (e->poolId_ != 0U) { // is it a pool event?
QEvt_refCtr_inc_(e); // increment the reference counter
}
QF_CRIT_X_();
@ -212,13 +212,13 @@ bool QActive::post_(QEvt const * const e, std::uint_fast16_t const margin,
else {
QS_BEGIN_NOCRIT_PRE_(QS_QF_ACTIVE_POST_ATTEMPT, m_prio)
QS_TIME_PRE_(); // timestamp
QS_OBJ_PRE_(sender); // the sender object
QS_SIG_PRE_(e->sig); // the signal of the event
QS_OBJ_PRE_(this); // this active object (recipient)
QS_TIME_PRE_(); // timestamp
QS_OBJ_PRE_(sender); // the sender object
QS_SIG_PRE_(e->sig); // the signal of the event
QS_OBJ_PRE_(this); // this active object (recipient)
QS_2U8_PRE_(e->poolId_, e->refCtr_); // pool Id & ref Count
QS_EQC_PRE_(nFree); // # free entries
QS_EQC_PRE_(0U); // min # free (unknown)
QS_EQC_PRE_(nFree); // # free entries
QS_EQC_PRE_(0U); // min # free (unknown)
QS_END_NOCRIT_PRE_()
QF_CRIT_X_();
@ -232,16 +232,16 @@ void QActive::postLIFO(QEvt const * const e) noexcept {
QF_CRIT_E_();
QS_BEGIN_NOCRIT_PRE_(QS_QF_ACTIVE_POST_LIFO, m_prio)
QS_TIME_PRE_(); // timestamp
QS_SIG_PRE_(e->sig); // the signal of this event
QS_OBJ_PRE_(this); // this active object
QS_TIME_PRE_(); // timestamp
QS_SIG_PRE_(e->sig); // the signal of this event
QS_OBJ_PRE_(this); // this active object
QS_2U8_PRE_(e->poolId_, e->refCtr_); // pool Id & ref Count
QS_EQC_PRE_(k_msgq_num_free_get(&m_eQueue)); // # free entries
QS_EQC_PRE_(0U); // min # free entries (unknown)
QS_EQC_PRE_(0U); // min # free entries (unknown)
QS_END_NOCRIT_PRE_()
if (e->poolId_ != 0U) { // is it a pool event?
QF_EVT_REF_CTR_INC_(e); // increment the reference counter
QEvt_refCtr_inc_(e); // increment the reference counter
}
QF_CRIT_X_();
@ -263,9 +263,9 @@ QEvt const *QActive::get_(void) noexcept {
k_msgq_get(&m_eQueue, static_cast<void *>(&e), K_FOREVER) == 0);
QS_BEGIN_PRE_(QS_QF_ACTIVE_GET, m_prio)
QS_TIME_PRE_(); // timestamp
QS_SIG_PRE_(e->sig); // the signal of this event
QS_OBJ_PRE_(this); // this active object
QS_TIME_PRE_(); // timestamp
QS_SIG_PRE_(e->sig); // the signal of this event
QS_OBJ_PRE_(this); // this active object
QS_2U8_PRE_(e->poolId_, e->refCtr_); // pool Id & ref Count
QS_EQC_PRE_(k_msgq_num_free_get(&m_eQueue)); // # free entries
QS_END_PRE_()