|
QP/C++
|
00001 00002 // Product: QK/C++ port to Lint, Generic C++ compiler 00003 // Last Updated for Version: 4.5.04 00004 // Date of the Last Update: Feb 09, 2013 00005 // 00006 // Q u a n t u m L e a P s 00007 // --------------------------- 00008 // innovating embedded systems 00009 // 00010 // Copyright (C) 2002-2013 Quantum Leaps, LLC. All rights reserved. 00011 // 00012 // This program is open source software: you can redistribute it and/or 00013 // modify it under the terms of the GNU General Public License as published 00014 // by the Free Software Foundation, either version 2 of the License, or 00015 // (at your option) any later version. 00016 // 00017 // Alternatively, this program may be distributed and modified under the 00018 // terms of Quantum Leaps commercial licenses, which expressly supersede 00019 // the GNU General Public License and are specifically designed for 00020 // licensees interested in retaining the proprietary status of their code. 00021 // 00022 // This program is distributed in the hope that it will be useful, 00023 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00024 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00025 // GNU General Public License for more details. 00026 // 00027 // You should have received a copy of the GNU General Public License 00028 // along with this program. If not, see <http://www.gnu.org/licenses/>. 00029 // 00030 // Contact information: 00031 // Quantum Leaps Web sites: http://www.quantum-leaps.com 00032 // http://www.state-machine.com 00033 // e-mail: info@quantum-leaps.com 00035 #ifndef qk_port_h 00036 #define qk_port_h 00037 00038 /*lint -save -e1960 MISRA-C++:2008 Rule 7-3-1, Global declaration */ 00039 00046 00048 // QK extended context (FPU) save/restore 00049 00057 #define QK_EXT_SAVE(act_) \ 00058 FPU_save(static_cast<FPU_context *>((act_)->m_thread)) 00059 00067 #define QK_EXT_RESTORE(act_) \ 00068 FPU_restore(static_cast<FPU_context *>((act_)->m_thread)) 00069 00071 // QK interrupt entry and exit 00072 00080 #define QK_ISR_ENTRY() do { \ 00081 ++QK_intNest_; \ 00082 QF_QS_ISR_ENTRY(QK_intNest_, QK_currPrio_); \ 00083 } while (false) 00084 00085 00093 #define QK_ISR_EXIT() do { \ 00094 send End-Of-Interrupt instruction to the Interrupt Controller; \ 00095 QF_QS_ISR_EXIT(QK_intNest_, QK_currPrio_); \ 00096 --QK_intNest_; \ 00097 if (QK_intNest_ == static_cast<uint8_t>(0)) { \ 00098 QK_scheduleExt_(); \ 00099 } \ 00100 } while (false) 00101 00102 00103 extern "C" { 00104 00105 struct FPU_context { 00106 uint32_t align; 00107 uint8_t fpu[108]; // the x87 FPU context takes 108-bytes 00108 }; 00109 void FPU_save(FPU_context *ctx); // defined in assembly 00110 void FPU_restore(FPU_context *ctx); // defined in assembly 00111 00113 // Thread-Local-Storage switching 00114 00123 #define QK_TLS(act_) \ 00124 (impure_ptr = static_cast<reent *>((act_)->m_thread)) 00125 00126 // fake struct _reent and _impure_ptr elements of Newlib... 00127 struct reent { 00128 uint32_t foo[32]; 00129 }; 00130 extern reent *impure_ptr; 00131 00132 } // extern "C" 00133 00134 /*lint -restore */ 00135 00136 00137 #include "qk.h" // QK platform-independent public interface 00138 00139 #endif // qk_port_h
1.7.6.1