|
QP/C
|
00001 /***************************************************************************** 00002 * Product: QK/C port for Lint, Generic C compiler 00003 * Last Updated for Version: 4.5.04 00004 * Date of the Last Update: Feb 01, 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 00034 *****************************************************************************/ 00035 #ifndef qk_port_h 00036 #define qk_port_h 00037 00046 /****************************************************************************/ 00047 /* QK extended context save/restore */ 00048 00057 #define QK_EXT_SAVE(act_) (FPU_save((FPU_context *)(act_)->thread)) 00058 00067 #define QK_EXT_RESTORE(act_) (FPU_restore((FPU_context *)(act_)->thread)) 00068 00069 typedef struct FPU_contextTag { 00070 uint8_t fpu[108]; /* the x87 FPU context takes 108-bytes */ 00071 } FPU_context; 00072 void FPU_save(FPU_context *ctx); /* defined in assembly */ 00073 void FPU_restore(FPU_context *ctx); /* defined in assembly */ 00074 00075 /****************************************************************************/ 00076 /* Thread-Local-Storage switching */ 00077 00087 #define QK_TLS(act_) \ 00088 (impure_ptr = (reent *)(act_)->thread) 00089 00090 /* fake struct reent and _impure_ptr elements of Newlib... */ 00091 typedef struct reentTag { 00092 uint32_t foo[32]; 00093 } reent; 00094 extern reent *impure_ptr; 00095 00096 /****************************************************************************/ 00097 /* QK interrupt entry and exit */ 00098 00107 #define QK_ISR_ENTRY() do { \ 00108 ++QK_intNest_; \ 00109 QF_QS_ISR_ENTRY(QK_intNest_, QK_currPrio_); \ 00110 } while (0) 00111 00112 00121 #define QK_ISR_EXIT() do { \ 00122 send End-Of-Interrupt instruction to the Interrupt Controller; \ 00123 QF_QS_ISR_EXIT(QK_intNest_, QK_currPrio_); \ 00124 --QK_intNest_; \ 00125 if (QK_intNest_ == (uint8_t)0) { \ 00126 QK_scheduleExt_(); \ 00127 } \ 00128 } while (0) 00129 00130 00131 #include "qk.h" /* QK platform-independent public interface */ 00132 00133 #endif /* qk_port_h */ 00134
1.7.6.1