mirror of
https://github.com/QuantumLeaps/qpc.git
synced 2025-01-14 06:43:19 +08:00
7.4.0-rc.2
This commit is contained in:
parent
e8df0ee996
commit
d18627d1fb
2
examples
2
examples
@ -1 +1 @@
|
||||
Subproject commit 4ecb703d24102773d7f7e631d93e1b8b88da5a73
|
||||
Subproject commit 8912782f022cdf8ebf2528619d7d46af7fd4f097
|
@ -1,15 +0,0 @@
|
||||
# ports/pic32
|
||||
if(QPC_CFG_UNIT_TEST)
|
||||
target_include_directories(qpc PUBLIC qutest/xc32)
|
||||
else()
|
||||
if(NOT KERNEL MATCHES "q[vk]")
|
||||
message(WARNING "Kernel ${KERNEL} is not supported! Falling back to QV kernel")
|
||||
set(KERNEL qv)
|
||||
endif()
|
||||
|
||||
set(KERNEL_PORT_C ${CMAKE_CURRENT_LIST_DIR}/${KERNEL}/xc32/${KERNEL}_port.c)
|
||||
if(EXISTS ${KERNEL_PORT_C})
|
||||
target_sources(qpc PRIVATE ${KERNEL_PORT_C})
|
||||
endif()
|
||||
target_include_directories(qpc PUBLIC ${KERNEL}/xc32)
|
||||
endif()
|
@ -1,74 +0,0 @@
|
||||
//============================================================================
|
||||
// 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
|
||||
//
|
||||
// This software is dual-licensed under the terms of the open source GNU
|
||||
// General Public License version 3 (or any later version), or alternatively,
|
||||
// under the terms of one of the closed source Quantum Leaps commercial
|
||||
// licenses.
|
||||
//
|
||||
// The terms of the open source GNU General Public License version 3
|
||||
// can be found at: <www.gnu.org/licenses/gpl-3.0>
|
||||
//
|
||||
// The terms of the closed source Quantum Leaps commercial licenses
|
||||
// can be found at: <www.state-machine.com/licensing>
|
||||
//
|
||||
// Redistributions in source code must retain this top-level comment block.
|
||||
// Plagiarizing this software to sidestep the license obligations is illegal.
|
||||
//
|
||||
// Contact information:
|
||||
// <www.state-machine.com>
|
||||
// <info@state-machine.com>
|
||||
//============================================================================
|
||||
//! @date Last updated on: 2023-08-16
|
||||
//! @version Last updated for: @ref qpc_7_3_0
|
||||
//!
|
||||
//! @file
|
||||
//! @brief QK/C port, MPLAB-X XC32 compiler
|
||||
#define QP_IMPL 1U
|
||||
#include "qp_port.h"
|
||||
|
||||
//............................................................................
|
||||
void QK_init(void) {
|
||||
INTCONSET = _INTCON_MVEC_MASK; // configure multi-vectored interrupts
|
||||
|
||||
IPC0bits.CS0IP = 1; // priority 1 for Core Software Interrupt 0, NOTE1
|
||||
IPC0bits.CS0IS = 0; // sub-priority 0 for Core Software Interrupt 0
|
||||
|
||||
IFS0CLR = _IFS0_CS0IF_MASK; // clear the Core Software Interrupt 0 flag
|
||||
IEC0SET = _IEC0_CS0IE_MASK; // enable the Core Software Interrupt 0
|
||||
}
|
||||
|
||||
//............................................................................
|
||||
__attribute__((vector(_CORE_SOFTWARE_0_VECTOR),interrupt(IPL1AUTO), nomips16))
|
||||
void QK_isr_(void) { // NOTE2
|
||||
IFS0CLR = _IFS0_CS0IF_MASK; // clear the Core Software Interrupt 0 flag
|
||||
|
||||
QF_INT_DISABLE();
|
||||
_mtc0(_CP0_STATUS, _CP0_STATUS_SELECT, 0U); // drop IPL to 0
|
||||
QK_activate_(); // activate higher priority AO
|
||||
_mtc0(_CP0_STATUS, _CP0_STATUS_SELECT, 1U << 10); //restore IPL to 1
|
||||
QF_INT_ENABLE();
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
// NOTE1:
|
||||
// The Core Software Interrupt 0 at priority 1, sub-priority 0 is reserved for
|
||||
// QK. All other interrupts must have higher priority, e.g. 2-7. The user may
|
||||
// _not_ set the shadow register set to priority 1.
|
||||
//
|
||||
// NOTE2:
|
||||
// The QK_isr_() Core Software Interrupt 0 is used to perform the scheduling
|
||||
// (asynchronous preemption in QK). This ISR is configured to use software
|
||||
// register stacking (IPL1SOFT), because it can nest on itself. The QK_isr_()
|
||||
// runs at IPL1, which should be the lowest of all other ISRs. This will
|
||||
// guarantee that the Core Software Interrupt 0 will not execute until all
|
||||
// other interrupts have completed, including any nesting.
|
||||
//
|
||||
// Any ISR that interacts with QP must trigger Core Software Interrupt 0.
|
||||
// This triggering is accomplished in the macros QK_ISR_ENTRY()/
|
||||
// QK_ISR_EXIT(), which _must_ be placed at the entry and exit of every ISR,
|
||||
// respectively.
|
||||
//
|
@ -1,121 +0,0 @@
|
||||
//============================================================================
|
||||
// QP/C Real-Time Embedded Framework (RTEF)
|
||||
//
|
||||
// Q u a n t u m L e a P s
|
||||
// ------------------------
|
||||
// Modern Embedded Software
|
||||
//
|
||||
// Copyright (C) 2005 Quantum Leaps, LLC <state-machine.com>.
|
||||
//
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-QL-commercial
|
||||
//
|
||||
// This software is dual-licensed under the terms of the open source GNU
|
||||
// General Public License version 3 (or any later version), or alternatively,
|
||||
// under the terms of one of the closed source Quantum Leaps commercial
|
||||
// licenses.
|
||||
//
|
||||
// The terms of the open source GNU General Public License version 3
|
||||
// can be found at: <www.gnu.org/licenses/gpl-3.0>
|
||||
//
|
||||
// The terms of the closed source Quantum Leaps commercial licenses
|
||||
// can be found at: <www.state-machine.com/licensing>
|
||||
//
|
||||
// Redistributions in source code must retain this top-level comment block.
|
||||
// Plagiarizing this software to sidestep the license obligations is illegal.
|
||||
//
|
||||
// Contact information:
|
||||
// <www.state-machine.com/licensing>
|
||||
// <info@state-machine.com>
|
||||
//============================================================================
|
||||
//! @date Last updated on: 2023-09-07
|
||||
//! @version Last updated for: @ref qpc_7_3_0
|
||||
//!
|
||||
//! @file
|
||||
//! @brief QP/C port to PIC32, QK kernel, MPLAB-X XC32
|
||||
|
||||
#ifndef QP_PORT_H_
|
||||
#define QP_PORT_H_
|
||||
|
||||
#include <stdint.h> // Exact-width types. WG14/N843 C99 Standard
|
||||
#include <stdbool.h> // Boolean type. WG14/N843 C99 Standard
|
||||
#include <xc.h> // for _clz()
|
||||
|
||||
#ifdef QP_CONFIG
|
||||
#include "qp_config.h" // external QP configuration
|
||||
#endif
|
||||
|
||||
// no-return function specifier (C11 Standard)
|
||||
#define Q_NORETURN _Noreturn void
|
||||
|
||||
// QF configuration for QK -- data members of the QActive class...
|
||||
|
||||
// QActive event queue type
|
||||
#define QACTIVE_EQUEUE_TYPE QEQueue
|
||||
// QACTIVE_OS_OBJ_TYPE not used in this port
|
||||
// QACTIVE_THREAD_TYPE not used in this port
|
||||
|
||||
// QF interrupt disable/enable, see NOTE1
|
||||
#define QF_INT_DISABLE() __builtin_disable_interrupts()
|
||||
#define QF_INT_ENABLE() __builtin_enable_interrupts()
|
||||
|
||||
// QF critical section entry/exit, see NOTE1
|
||||
#define QF_CRIT_STAT
|
||||
#define QF_CRIT_ENTRY() QF_INT_DISABLE()
|
||||
#define QF_CRIT_EXIT() QF_INT_ENABLE()
|
||||
|
||||
// fast log-base-2 with CLZ instruction
|
||||
#define QF_LOG2(n_) ((uint8_t)(32U - _clz(n_)))
|
||||
|
||||
// Check if the code executes in the ISR context
|
||||
#define QK_ISR_CONTEXT_() (QK_priv_.intNest != 0U)
|
||||
|
||||
// QK interrupt entry and exit
|
||||
#define QK_ISR_ENTRY() do { \
|
||||
QF_INT_DISABLE(); \
|
||||
++QK_priv_.intNest; \
|
||||
QF_INT_ENABLE(); \
|
||||
} while (false)
|
||||
|
||||
#define QK_ISR_EXIT() do { \
|
||||
QF_INT_DISABLE(); \
|
||||
--QK_priv_.intNest; \
|
||||
if (QK_sched_() != 0U) { \
|
||||
IFS0SET = _IFS0_CS0IF_MASK; \
|
||||
} \
|
||||
QF_INT_ENABLE(); \
|
||||
} while (false)
|
||||
|
||||
// include files -------------------------------------------------------------
|
||||
#include "qequeue.h" // QK kernel uses the native QP event queue
|
||||
#include "qmpool.h" // QK kernel uses the native QP memory pool
|
||||
#include "qp.h" // QP framework
|
||||
#include "qk.h" // QK kernel
|
||||
|
||||
// initialization of the QK kernel
|
||||
#define QK_INIT() QK_init()
|
||||
void QK_init(void);
|
||||
|
||||
//============================================================================
|
||||
// NOTE1:
|
||||
// The intrinsic functions __builtin_disable_interrupts() and
|
||||
// __builtin_enable_interrupts() use the DI (disable interrupts) and
|
||||
// EI (enable interrupts) instruction, unconditional disabling and enabling
|
||||
// of interrupts. The DI instruction only disables interrupts with priority
|
||||
// levels 1-6. Priority level 7 interrupts and all trap events still have
|
||||
// the ability to interrupt the CPU when the DI instruction is active.
|
||||
// This means that from the perspective of QP framework, the level 7 interrupts
|
||||
// are treated "kernel unaware" interrupts or non-maskable interrupts.
|
||||
// Such "kernel unaware" interrupts **cannot** call any QP services.
|
||||
// In particular, they cannot post events.
|
||||
//
|
||||
// CAUTION: This QP port assumes that interrupt nesting is **enabled**,
|
||||
// which is the default in the PIC32 processors. Interrupt nesting should
|
||||
// never be disabled by setting the NSTDIS control bit (INTCON1<15>). If you
|
||||
// don't want interrupts to nest, you can always prioritize them at the same
|
||||
// level. For example, the default priority level for all interrupts is 4 out
|
||||
// of reset. If you don't change this level for any interrupt the nesting of
|
||||
// interrupt will not occur.
|
||||
//
|
||||
|
||||
#endif // QP_PORT_H_
|
||||
|
@ -1,57 +0,0 @@
|
||||
//============================================================================
|
||||
// QP/C Real-Time Embedded Framework (RTEF)
|
||||
//
|
||||
// Q u a n t u m L e a P s
|
||||
// ------------------------
|
||||
// Modern Embedded Software
|
||||
//
|
||||
// Copyright (C) 2005 Quantum Leaps, LLC. All rights reserved.
|
||||
//
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-QL-commercial
|
||||
//
|
||||
// This software is dual-licensed under the terms of the open source GNU
|
||||
// General Public License version 3 (or any later version), or alternatively,
|
||||
// under the terms of one of the closed source Quantum Leaps commercial
|
||||
// licenses.
|
||||
//
|
||||
// The terms of the open source GNU General Public License version 3
|
||||
// can be found at: <www.gnu.org/licenses/gpl-3.0>
|
||||
//
|
||||
// The terms of the closed source Quantum Leaps commercial licenses
|
||||
// can be found at: <www.state-machine.com/licensing>
|
||||
//
|
||||
// Redistributions in source code must retain this top-level comment block.
|
||||
// Plagiarizing this software to sidestep the license obligations is illegal.
|
||||
//
|
||||
// Contact information:
|
||||
// <www.state-machine.com>
|
||||
// <info@state-machine.com>
|
||||
//============================================================================
|
||||
//! @date Last updated on: 2024-06-06
|
||||
//! @version Last updated for: @ref qpc_7_4_0
|
||||
//!
|
||||
//! @file
|
||||
//! @brief QS/C port to a 32-bit CPU and a generic C99 compiler.
|
||||
|
||||
#ifndef QS_PORT_H_
|
||||
#define QS_PORT_H_
|
||||
|
||||
// object pointer size in bytes
|
||||
#define QS_OBJ_PTR_SIZE 4U
|
||||
|
||||
// function pointer size in bytes
|
||||
#define QS_FUN_PTR_SIZE 4U
|
||||
|
||||
//============================================================================
|
||||
// NOTE: QS might be used with or without other QP components, in which
|
||||
// case the separate definitions of the macros QF_CRIT_STAT, QF_CRIT_ENTRY(),
|
||||
// and QF_CRIT_EXIT() are needed. In this port QS is configured to be used
|
||||
// with the other QP component, by simply including "qp_port.h"
|
||||
// *before* "qs.h".
|
||||
#ifndef QP_PORT_H_
|
||||
#include "qp_port.h" // use QS with QP
|
||||
#endif
|
||||
|
||||
#include "qs.h" // QS platform-independent public interface
|
||||
|
||||
#endif // QS_PORT_H_
|
@ -1,106 +0,0 @@
|
||||
//============================================================================
|
||||
// QP/C Real-Time Embedded Framework (RTEF)
|
||||
//
|
||||
// Q u a n t u m L e a P s
|
||||
// ------------------------
|
||||
// Modern Embedded Software
|
||||
//
|
||||
// Copyright (C) 2005 Quantum Leaps, LLC <state-machine.com>.
|
||||
//
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-QL-commercial
|
||||
//
|
||||
// This software is dual-licensed under the terms of the open source GNU
|
||||
// General Public License version 3 (or any later version), or alternatively,
|
||||
// under the terms of one of the closed source Quantum Leaps commercial
|
||||
// licenses.
|
||||
//
|
||||
// The terms of the open source GNU General Public License version 3
|
||||
// can be found at: <www.gnu.org/licenses/gpl-3.0>
|
||||
//
|
||||
// The terms of the closed source Quantum Leaps commercial licenses
|
||||
// can be found at: <www.state-machine.com/licensing>
|
||||
//
|
||||
// Redistributions in source code must retain this top-level comment block.
|
||||
// Plagiarizing this software to sidestep the license obligations is illegal.
|
||||
//
|
||||
// Contact information:
|
||||
// <www.state-machine.com>
|
||||
// <info@state-machine.com>
|
||||
//============================================================================
|
||||
//! @date Last updated on: 2023-09-07
|
||||
//! @version Last updated for: @ref qpc_7_3_0
|
||||
//!
|
||||
//! @file
|
||||
//! @brief QP/C port to PIC32, QUTest, MPLAB-X XC32
|
||||
|
||||
#ifndef QP_PORT_H_
|
||||
#define QP_PORT_H_
|
||||
|
||||
#include <stdint.h> // Exact-width types. WG14/N843 C99 Standard
|
||||
#include <stdbool.h> // Boolean type. WG14/N843 C99 Standard
|
||||
|
||||
#ifdef QP_CONFIG
|
||||
#include "qp_config.h" // external QP configuration
|
||||
#endif
|
||||
|
||||
// no-return function specifier (C11 Standard)
|
||||
#define Q_NORETURN _Noreturn void
|
||||
|
||||
// QF configuration for "QUTest" -- data members of the QActive class...
|
||||
|
||||
// QUTest event-queue used for AOs
|
||||
#define QACTIVE_EQUEUE_TYPE QEQueue
|
||||
// QACTIVE_OS_OBJ_TYPE not used in this port
|
||||
// QACTIVE_THREAD_TYPE not used in this port
|
||||
|
||||
// QF interrupt disable/enable
|
||||
#define QF_INT_DISABLE() (++QS_tstPriv_.intLock)
|
||||
#define QF_INT_ENABLE() (--QS_tstPriv_.intLock)
|
||||
|
||||
// QF critical section entry/exit, see NOTE02
|
||||
#define QF_CRIT_STAT
|
||||
#define QF_CRIT_ENTRY() QF_INT_DISABLE()
|
||||
#define QF_CRIT_EXIT() QF_INT_ENABLE()
|
||||
|
||||
// QF_LOG2 not defined -- use the internal LOG2() implementation
|
||||
|
||||
// include files -------------------------------------------------------------
|
||||
#include "qequeue.h" // QUTest port uses the native QP event queue
|
||||
#include "qmpool.h" // QUTest port uses the native QP memory pool
|
||||
#include "qp.h" // QP framework
|
||||
|
||||
//============================================================================
|
||||
// interface used only inside QF implementation, but not in applications
|
||||
|
||||
#ifdef QP_IMPL
|
||||
|
||||
// scheduler locking (not used in QUTest)
|
||||
#define QF_SCHED_STAT_
|
||||
#define QF_SCHED_LOCK_(dummy) ((void)0)
|
||||
#define QF_SCHED_UNLOCK_() ((void)0)
|
||||
|
||||
// native event queue operations
|
||||
#define QACTIVE_EQUEUE_WAIT_(me_) \
|
||||
Q_ASSERT_INCRIT(302, (me_)->eQueue.frontEvt != (QEvt *)0)
|
||||
#ifndef Q_UNSAFE
|
||||
#define QACTIVE_EQUEUE_SIGNAL_(me_) \
|
||||
QPSet_insert(&QS_tstPriv_.readySet, (uint_fast8_t)(me_)->prio); \
|
||||
QPSet_update_(&QS_tstPriv_.readySet, &QS_tstPriv_.readySet_dis)
|
||||
#else
|
||||
#define QACTIVE_EQUEUE_SIGNAL_(me_) \
|
||||
QPSet_insert(&QF_readySet_, (uint_fast8_t)(me_)->prio)
|
||||
#endif
|
||||
|
||||
// native QF event pool operations
|
||||
#define QF_EPOOL_TYPE_ QMPool
|
||||
#define QF_EPOOL_INIT_(p_, poolSto_, poolSize_, evtSize_) \
|
||||
(QMPool_init(&(p_), (poolSto_), (poolSize_), (evtSize_)))
|
||||
#define QF_EPOOL_EVENT_SIZE_(p_) ((uint_fast16_t)(p_).blockSize)
|
||||
#define QF_EPOOL_GET_(p_, e_, m_, qsId_) \
|
||||
((e_) = (QEvt *)QMPool_get(&(p_), (m_), (qsId_)))
|
||||
#define QF_EPOOL_PUT_(p_, e_, qsId_) (QMPool_put(&(p_), (e_), (qsId_)))
|
||||
|
||||
#endif // QP_IMPL
|
||||
|
||||
#endif // QP_PORT_H_
|
||||
|
@ -1,57 +0,0 @@
|
||||
//============================================================================
|
||||
// QP/C Real-Time Embedded Framework (RTEF)
|
||||
//
|
||||
// Q u a n t u m L e a P s
|
||||
// ------------------------
|
||||
// Modern Embedded Software
|
||||
//
|
||||
// Copyright (C) 2005 Quantum Leaps, LLC. All rights reserved.
|
||||
//
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-QL-commercial
|
||||
//
|
||||
// This software is dual-licensed under the terms of the open source GNU
|
||||
// General Public License version 3 (or any later version), or alternatively,
|
||||
// under the terms of one of the closed source Quantum Leaps commercial
|
||||
// licenses.
|
||||
//
|
||||
// The terms of the open source GNU General Public License version 3
|
||||
// can be found at: <www.gnu.org/licenses/gpl-3.0>
|
||||
//
|
||||
// The terms of the closed source Quantum Leaps commercial licenses
|
||||
// can be found at: <www.state-machine.com/licensing>
|
||||
//
|
||||
// Redistributions in source code must retain this top-level comment block.
|
||||
// Plagiarizing this software to sidestep the license obligations is illegal.
|
||||
//
|
||||
// Contact information:
|
||||
// <www.state-machine.com>
|
||||
// <info@state-machine.com>
|
||||
//============================================================================
|
||||
//! @date Last updated on: 2024-06-06
|
||||
//! @version Last updated for: @ref qpc_7_4_0
|
||||
//!
|
||||
//! @file
|
||||
//! @brief QS/C port to a 32-bit CPU and a generic C99 compiler.
|
||||
|
||||
#ifndef QS_PORT_H_
|
||||
#define QS_PORT_H_
|
||||
|
||||
// object pointer size in bytes
|
||||
#define QS_OBJ_PTR_SIZE 4U
|
||||
|
||||
// function pointer size in bytes
|
||||
#define QS_FUN_PTR_SIZE 4U
|
||||
|
||||
//============================================================================
|
||||
// NOTE: QS might be used with or without other QP components, in which
|
||||
// case the separate definitions of the macros QF_CRIT_STAT, QF_CRIT_ENTRY(),
|
||||
// and QF_CRIT_EXIT() are needed. In this port QS is configured to be used
|
||||
// with the other QP component, by simply including "qp_port.h"
|
||||
// *before* "qs.h".
|
||||
#ifndef QP_PORT_H_
|
||||
#include "qp_port.h" // use QS with QP
|
||||
#endif
|
||||
|
||||
#include "qs.h" // QS platform-independent public interface
|
||||
|
||||
#endif // QS_PORT_H_
|
@ -1,98 +0,0 @@
|
||||
//============================================================================
|
||||
// QP/C Real-Time Embedded Framework (RTEF)
|
||||
//
|
||||
// Q u a n t u m L e a P s
|
||||
// ------------------------
|
||||
// Modern Embedded Software
|
||||
//
|
||||
// Copyright (C) 2005 Quantum Leaps, LLC <state-machine.com>.
|
||||
//
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-QL-commercial
|
||||
//
|
||||
// This software is dual-licensed under the terms of the open source GNU
|
||||
// General Public License version 3 (or any later version), or alternatively,
|
||||
// under the terms of one of the closed source Quantum Leaps commercial
|
||||
// licenses.
|
||||
//
|
||||
// The terms of the open source GNU General Public License version 3
|
||||
// can be found at: <www.gnu.org/licenses/gpl-3.0>
|
||||
//
|
||||
// The terms of the closed source Quantum Leaps commercial licenses
|
||||
// can be found at: <www.state-machine.com/licensing>
|
||||
//
|
||||
// Redistributions in source code must retain this top-level comment block.
|
||||
// Plagiarizing this software to sidestep the license obligations is illegal.
|
||||
//
|
||||
// Contact information:
|
||||
// <www.state-machine.com/licensing>
|
||||
// <info@state-machine.com>
|
||||
//============================================================================
|
||||
//! @date Last updated on: 2023-09-07
|
||||
//! @version Last updated for: @ref qpc_7_3_0
|
||||
//!
|
||||
//! @file
|
||||
//! @brief QP/C port to PIC32, QV kernel, MPLAB-X XC32
|
||||
|
||||
#ifndef QP_PORT_H_
|
||||
#define QP_PORT_H_
|
||||
|
||||
#include <stdint.h> // Exact-width types. WG14/N843 C99 Standard
|
||||
#include <stdbool.h> // Boolean type. WG14/N843 C99 Standard
|
||||
#include <xc.h> // for _clz()
|
||||
|
||||
#ifdef QP_CONFIG
|
||||
#include "qp_config.h" // external QP configuration
|
||||
#endif
|
||||
|
||||
// no-return function specifier (C11 Standard)
|
||||
#define Q_NORETURN _Noreturn void
|
||||
|
||||
// QF configuration for QV -- data members of the QActive class...
|
||||
|
||||
// QActive event queue type
|
||||
#define QACTIVE_EQUEUE_TYPE QEQueue
|
||||
// QACTIVE_OS_OBJ_TYPE not used in this port
|
||||
// QACTIVE_THREAD_TYPE not used in this port
|
||||
|
||||
// QF interrupt disable/enable, see NOTE1
|
||||
#define QF_INT_DISABLE() __builtin_disable_interrupts()
|
||||
#define QF_INT_ENABLE() __builtin_enable_interrupts()
|
||||
|
||||
// QF critical section entry/exit, see NOTE1
|
||||
#define QF_CRIT_STAT
|
||||
#define QF_CRIT_ENTRY() QF_INT_DISABLE()
|
||||
#define QF_CRIT_EXIT() QF_INT_ENABLE()
|
||||
|
||||
// fast log-base-2 with CLZ instruction
|
||||
#define QF_LOG2(n_) ((uint8_t)(32U - _clz(n_)))
|
||||
|
||||
// include files -------------------------------------------------------------
|
||||
#include "qequeue.h" // QV kernel uses the native QP event queue
|
||||
#include "qmpool.h" // QV kernel uses the native QP memory pool
|
||||
#include "qp.h" // QP framework
|
||||
#include "qv.h" // QV kernel
|
||||
|
||||
//============================================================================
|
||||
// NOTE1:
|
||||
// The intrinsic functions __builtin_disable_interrupts() and
|
||||
// __builtin_enable_interrupts() use the DI (disable interrupts) and
|
||||
// EI (enable interrupts) instruction, unconditional disabling and enabling
|
||||
// of interrupts. The DI instruction only disables interrupts with priority
|
||||
// levels 1-6. Priority level 7 interrupts and all trap events still have
|
||||
// the ability to interrupt the CPU when the DI instruction is active.
|
||||
// This means that from the perspective of QP framework, the level 7 interrupts
|
||||
// are treated "kernel unaware" interrupts or non-maskable interrupts.
|
||||
// Such "kernel unaware" interrupts **cannot** call any QP services.
|
||||
// In particular, they cannot post events.
|
||||
//
|
||||
// CAUTION: This QP port assumes that interrupt nesting is **enabled**,
|
||||
// which is the default in the PIC32 processors. Interrupt nesting should
|
||||
// never be disabled by setting the NSTDIS control bit (INTCON1<15>). If you
|
||||
// don't want interrupts to nest, you can always prioritize them at the same
|
||||
// level. For example, the default priority level for all interrupts is 4 out
|
||||
// of reset. If you don't change this level for any interrupt the nesting of
|
||||
// interrupt will not occur.
|
||||
//
|
||||
|
||||
#endif // QP_PORT_H_
|
||||
|
@ -1,57 +0,0 @@
|
||||
//============================================================================
|
||||
// QP/C Real-Time Embedded Framework (RTEF)
|
||||
//
|
||||
// Q u a n t u m L e a P s
|
||||
// ------------------------
|
||||
// Modern Embedded Software
|
||||
//
|
||||
// Copyright (C) 2005 Quantum Leaps, LLC. All rights reserved.
|
||||
//
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-QL-commercial
|
||||
//
|
||||
// This software is dual-licensed under the terms of the open source GNU
|
||||
// General Public License version 3 (or any later version), or alternatively,
|
||||
// under the terms of one of the closed source Quantum Leaps commercial
|
||||
// licenses.
|
||||
//
|
||||
// The terms of the open source GNU General Public License version 3
|
||||
// can be found at: <www.gnu.org/licenses/gpl-3.0>
|
||||
//
|
||||
// The terms of the closed source Quantum Leaps commercial licenses
|
||||
// can be found at: <www.state-machine.com/licensing>
|
||||
//
|
||||
// Redistributions in source code must retain this top-level comment block.
|
||||
// Plagiarizing this software to sidestep the license obligations is illegal.
|
||||
//
|
||||
// Contact information:
|
||||
// <www.state-machine.com>
|
||||
// <info@state-machine.com>
|
||||
//============================================================================
|
||||
//! @date Last updated on: 2024-06-06
|
||||
//! @version Last updated for: @ref qpc_7_4_0
|
||||
//!
|
||||
//! @file
|
||||
//! @brief QS/C port to a 32-bit CPU and a generic C99 compiler.
|
||||
|
||||
#ifndef QS_PORT_H_
|
||||
#define QS_PORT_H_
|
||||
|
||||
// object pointer size in bytes
|
||||
#define QS_OBJ_PTR_SIZE 4U
|
||||
|
||||
// function pointer size in bytes
|
||||
#define QS_FUN_PTR_SIZE 4U
|
||||
|
||||
//============================================================================
|
||||
// NOTE: QS might be used with or without other QP components, in which
|
||||
// case the separate definitions of the macros QF_CRIT_STAT, QF_CRIT_ENTRY(),
|
||||
// and QF_CRIT_EXIT() are needed. In this port QS is configured to be used
|
||||
// with the other QP component, by simply including "qp_port.h"
|
||||
// *before* "qs.h".
|
||||
#ifndef QP_PORT_H_
|
||||
#include "qp_port.h" // use QS with QP
|
||||
#endif
|
||||
|
||||
#include "qs.h" // QS platform-independent public interface
|
||||
|
||||
#endif // QS_PORT_H_
|
Loading…
x
Reference in New Issue
Block a user