|
QP/C
|
00001 /***************************************************************************** 00002 * Product: QK/C port for Lint, Generic C compiler 00003 * Last Updated for Version: 4.4.00 00004 * Date of the Last Update: Jan 16, 2012 00005 * 00006 * Q u a n t u m L e a P s 00007 * --------------------------- 00008 * innovating embedded systems 00009 * 00010 * Copyright (C) 2002-2012 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 00027 *****************************************************************************/ 00028 #ifndef qk_port_h 00029 #define qk_port_h 00030 00039 /****************************************************************************/ 00040 /* QK extended context save/restore */ 00041 00050 #define QK_EXT_SAVE(act_) FPU_save((FPU_context *)(act_)->thread) 00051 00060 #define QK_EXT_RESTORE(act_) FPU_restore((FPU_context *)(act_)->thread) 00061 00062 typedef struct FPU_contextTag { 00063 uint8_t fpu[108]; /* the x87 FPU context takes 108-bytes */ 00064 } FPU_context; 00065 void FPU_save(FPU_context *ctx); /* defined in assembly */ 00066 void FPU_restore(FPU_context *ctx); /* defined in assembly */ 00067 00068 /****************************************************************************/ 00069 /* Thread-Local-Storage switching */ 00070 00080 #define QK_TLS(act_) \ 00081 (impure_ptr = (reent *)(act_)->thread) 00082 00083 /* fake struct reent and impure_ptr elements of Newlib... */ 00084 typedef struct reentTag { 00085 uint32_t foo[32]; 00086 } reent; 00087 extern reent *impure_ptr; 00088 00089 /****************************************************************************/ 00090 /* QK interrupt entry and exit */ 00091 00100 #define QK_ISR_ENTRY() do { \ 00101 ++QK_intNest_; \ 00102 QF_QS_ISR_ENTRY(QK_intNest_, QK_currPrio_); \ 00103 } while (0) 00104 00105 00114 #define QK_ISR_EXIT() do { \ 00115 send End-Of-Interrupt instruction to the Interrupt Controller; \ 00116 QF_QS_ISR_EXIT(QK_intNest_, QK_currPrio_); \ 00117 --QK_intNest_; \ 00118 if (QK_intNest_ == (uint8_t)0) { \ 00119 QK_scheduleExt_(); \ 00120 } \ 00121 } while (0) 00122 00123 00124 #include "qk.h" /* QK platform-independent public interface */ 00125 00126 #endif /* qk_port_h */ 00127
1.7.6.1