00001 00002 // Product: QK/C++ port to Lint, Generic C++ compiler 00003 // Last Updated for Version: 4.0.03 00004 // Date of the Last Update: Dec 27, 2008 00005 // 00006 // Q u a n t u m L e a P s 00007 // --------------------------- 00008 // innovating embedded systems 00009 // 00010 // Copyright (C) 2002-2008 Quantum Leaps, LLC. All rights reserved. 00011 // 00012 // This software may be distributed and modified under the terms of the GNU 00013 // General Public License version 2 (GPL) as published by the Free Software 00014 // Foundation and appearing in the file GPL.TXT included in the packaging of 00015 // this file. Please note that GPL Section 2[b] requires that all works based 00016 // on this software must also be made publicly available under the terms of 00017 // the GPL ("Copyleft"). 00018 // 00019 // Alternatively, this software may be distributed and modified under the 00020 // terms of Quantum Leaps commercial licenses, which expressly supersede 00021 // the GPL and are specifically designed for licensees interested in 00022 // retaining the proprietary status of their code. 00023 // 00024 // Contact information: 00025 // Quantum Leaps Web site: http://www.quantum-leaps.com 00026 // e-mail: info@quantum-leaps.com 00028 #ifndef qk_port_h 00029 #define qk_port_h 00030 00037 00039 // QK extended context (FPU) save/restore 00040 00048 #define QK_EXT_SAVE(act_) FPU_save((FPU_context *)(act_)->m_thread) 00049 00057 #define QK_EXT_RESTORE(act_) FPU_restore((FPU_context *)(act_)->m_thread) 00058 00059 struct FPU_context { 00060 uint32_t align; 00061 uint8_t fpu[108]; // the x87 FPU context takes 108-bytes 00062 }; 00063 extern "C" void FPU_save(FPU_context *ctx); // defined in assembly 00064 extern "C" void FPU_restore(FPU_context *ctx); // defined in assembly 00065 00067 // Thread-Local-Storage switching 00068 00077 #define QK_TLS(act_) \ 00078 _impure_ptr = (struct _reent *)(act_)->m_thread 00079 00080 // fake struct _reent and _impure_ptr elements of Newlib... 00081 struct _reent { 00082 int foo[32]; 00083 }; 00084 extern struct _reent *_impure_ptr; 00085 00087 // QK interrupt entry and exit 00088 00096 #define QK_ISR_ENTRY() do { \ 00097 ++QK_intNest_; \ 00098 QF_QS_ISR_ENTRY(QK_intNest_, QK_currPrio_); \ 00099 } while (0) 00100 00101 00109 #define QK_ISR_EXIT() do { \ 00110 send End-Of-Interrupt instruction to the Interrupt Controller; \ 00111 QF_QS_ISR_EXIT(QK_intNest_, QK_currPrio_); \ 00112 --QK_intNest_; \ 00113 if (QK_intNest_ == (uint8_t)0) { \ 00114 QK_scheduleExt_(); \ 00115 } \ 00116 } while (0) 00117 00118 00119 #include "qk.h" // QK platform-independent public interface 00120 00121 #endif // qk_port_h
1.5.4