2022-04-30 18:29:48 -04:00
|
|
|
/*============================================================================
|
|
|
|
* QP/C Real-Time Embedded Framework (RTEF)
|
2022-04-19 19:18:37 -04:00
|
|
|
* Copyright (C) 2005 Quantum Leaps, LLC. All rights reserved.
|
2012-08-14 18:07:04 -04:00
|
|
|
*
|
2022-04-30 18:29:48 -04:00
|
|
|
* SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-QL-commercial
|
2012-08-14 18:07:04 -04:00
|
|
|
*
|
2022-04-30 18:29:48 -04:00
|
|
|
* 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.
|
2012-08-14 18:07:04 -04:00
|
|
|
*
|
2022-04-30 18:29:48 -04:00
|
|
|
* The terms of the open source GNU General Public License version 3
|
|
|
|
* can be found at: <www.gnu.org/licenses/gpl-3.0>
|
2012-08-14 18:07:04 -04:00
|
|
|
*
|
2022-04-30 18:29:48 -04:00
|
|
|
* 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.
|
2012-08-14 18:07:04 -04:00
|
|
|
*
|
|
|
|
* Contact information:
|
2022-04-30 18:29:48 -04:00
|
|
|
* <www.state-machine.com>
|
2019-12-31 15:55:08 -05:00
|
|
|
* <info@state-machine.com>
|
2022-04-30 18:29:48 -04:00
|
|
|
============================================================================*/
|
|
|
|
/*!
|
2022-12-20 17:02:45 -05:00
|
|
|
* @date Last updated on: 2022-12-18
|
|
|
|
* @version Last updated for: @ref qpc_7_2_0
|
2022-04-30 18:29:48 -04:00
|
|
|
*
|
|
|
|
* @file
|
|
|
|
* @brief QV/C port to ARM Cortex-M, IAR-ARM toolset
|
2014-04-06 11:43:13 -04:00
|
|
|
*/
|
2019-10-27 11:57:33 -04:00
|
|
|
#ifndef QV_PORT_H
|
|
|
|
#define QV_PORT_H
|
2012-08-14 18:07:04 -04:00
|
|
|
|
2022-12-20 17:02:45 -05:00
|
|
|
#if (__ARM_ARCH == 6) /* ARMv6-M? */
|
2015-04-28 13:45:35 -04:00
|
|
|
|
|
|
|
/* macro to put the CPU to sleep inside QV_onIdle() */
|
|
|
|
#define QV_CPU_SLEEP() do { \
|
2020-10-01 12:48:48 -04:00
|
|
|
__WFI(); \
|
|
|
|
QF_INT_ENABLE(); \
|
2019-12-31 15:55:08 -05:00
|
|
|
} while (false)
|
2015-04-28 13:45:35 -04:00
|
|
|
|
2020-10-01 12:48:48 -04:00
|
|
|
#define QV_ARM_ERRATUM_838869() ((void)0)
|
|
|
|
|
2022-12-20 17:02:45 -05:00
|
|
|
#else /* ARMv7-M or higher */
|
2015-04-28 13:45:35 -04:00
|
|
|
|
|
|
|
/* macro to put the CPU to sleep inside QV_onIdle() */
|
|
|
|
#define QV_CPU_SLEEP() do { \
|
2020-10-01 12:48:48 -04:00
|
|
|
QF_PRIMASK_DISABLE(); \
|
|
|
|
QF_INT_ENABLE(); \
|
|
|
|
__WFI(); \
|
|
|
|
QF_PRIMASK_ENABLE(); \
|
2019-12-31 15:55:08 -05:00
|
|
|
} while (false)
|
2015-04-28 13:45:35 -04:00
|
|
|
|
2020-10-01 12:48:48 -04:00
|
|
|
/* The following macro implements the recommended workaround for the
|
|
|
|
* ARM Erratum 838869. Specifically, for Cortex-M3/M4/M7 the DSB
|
|
|
|
* (memory barrier) instruction needs to be added before exiting an ISR.
|
|
|
|
* This macro should be inserted at the end of ISRs.
|
|
|
|
*/
|
|
|
|
#define QV_ARM_ERRATUM_838869() __DSB()
|
|
|
|
|
2015-04-28 13:45:35 -04:00
|
|
|
#endif
|
|
|
|
|
2022-12-20 17:02:45 -05:00
|
|
|
/* initialization of the QV kernel */
|
|
|
|
#define QV_INIT() QV_init()
|
|
|
|
void QV_init(void);
|
|
|
|
|
|
|
|
#if (__ARM_FP != 0) /* if VFP available... */
|
|
|
|
/* When the FPU is configured, clear the FPCA bit in the CONTROL register
|
|
|
|
* to prevent wasting the stack space for the FPU context.
|
|
|
|
*/
|
|
|
|
#define QV_START() __set_CONTROL(0U)
|
|
|
|
#endif
|
|
|
|
|
2015-04-28 13:45:35 -04:00
|
|
|
#include "qv.h" /* QV platform-independent public interface */
|
|
|
|
|
2019-10-27 11:57:33 -04:00
|
|
|
#endif /* QV_PORT_H */
|
2020-10-01 12:48:48 -04:00
|
|
|
|