├── Doc └── TINIUX_tutorial_zh.pdf ├── TINIUX.ORG.url ├── README.md ├── LICENSE ├── Kernel ├── TINIUX.h ├── OSMutex.h ├── OSSem.h ├── OSMemory.h ├── OSSchedule.h ├── OSTimer.h ├── OSMsgQ.h └── OSList.h ├── CPU ├── ARM │ ├── IAR │ │ ├── Cortex_M3 │ │ │ ├── FitType.h │ │ │ ├── FitCPU.h │ │ │ └── FitAsm.s │ │ ├── Cortex_M0 │ │ │ ├── FitType.h │ │ │ ├── FitCPU.h │ │ │ └── FitAsm.s │ │ ├── Cortex_M4 │ │ │ ├── FitType.h │ │ │ ├── FitCPU.h │ │ │ └── FitAsm.s │ │ └── Cortex_M7 │ │ │ ├── FitType.h │ │ │ ├── FitCPU.h │ │ │ └── FitAsm.s │ ├── KEIL │ │ ├── Cortex_M3 │ │ │ ├── FitType.h │ │ │ └── FitCPU.h │ │ ├── Cortex_M0 │ │ │ ├── FitType.h │ │ │ └── FitCPU.h │ │ ├── Cortex_M7 │ │ │ ├── FitType.h │ │ │ └── FitCPU.h │ │ └── Cortex_M4 │ │ │ ├── FitType.h │ │ │ └── FitCPU.h │ └── GCC │ │ ├── Cortex_M0 │ │ ├── FitType.h │ │ └── FitCPU.h │ │ ├── Cortex_M7 │ │ └── FitType.h │ │ ├── Cortex_M3 │ │ ├── FitType.h │ │ └── FitCPU.h │ │ └── Cortex_M4 │ │ ├── FitType.h │ │ └── FitCPU.h └── MCS51 │ └── SDCC │ ├── 8051 │ ├── FitType.h │ └── FitCPU.h │ └── 8052 │ ├── FitType.h │ └── FitCPU.h └── Preset ├── MCS51 ├── 8051 │ └── OSPreset.h └── 8052 │ └── OSPreset.h └── ARM ├── Cortex_M0 └── OSPreset.h ├── Cortex_M3 └── OSPreset.h ├── Cortex_M4 └── OSPreset.h └── Cortex_M7 └── OSPreset.h /Doc/TINIUX_tutorial_zh.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xuchanglong/Tiniux-v3.0.0-comments/HEAD/Doc/TINIUX_tutorial_zh.pdf -------------------------------------------------------------------------------- /TINIUX.ORG.url: -------------------------------------------------------------------------------- 1 | [{000214A0-0000-0000-C000-000000000046}] 2 | Prop3=19,2 3 | [InternetShortcut] 4 | URL=http://www.tiniux.org/ 5 | IDList= 6 | HotKey=0 7 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # TINIUX 2 | 3 | TINIUX - A tiny and efficient embedded real time operating system (RTOS) From http://www.tiniux.org 4 | 5 | Copyright (C) 2012~2018 SenseRate.com All rights reserved. 6 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (C) SenseRate.com All rights reserved. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Kernel/TINIUX.h: -------------------------------------------------------------------------------- 1 | /********************************************************************************************************** 2 | TINIUX - A tiny and efficient embedded real time operating system (RTOS) 3 | Copyright (C) SenseRate.com All rights reserved. 4 | http://www.tiniux.org -- Documentation, latest information, license and contact details. 5 | http://www.tiniux.com -- Commercial support, development, porting, licensing and training services. 6 | -------------------------------------------------------------------------------------------------------- 7 | Redistribution and use in source and binary forms, with or without modification, 8 | are permitted provided that the following conditions are met: 9 | 1. Redistributions of source code must retain the above copyright notice, this list of 10 | conditions and the following disclaimer. 11 | 2. Redistributions in binary form must reproduce the above copyright notice, this list 12 | of conditions and the following disclaimer in the documentation and/or other materials 13 | provided with the distribution. 14 | 3. Neither the name of the copyright holder nor the names of its contributors may be used 15 | to endorse or promote products derived from this software without specific prior written 16 | permission. 17 | -------------------------------------------------------------------------------------------------------- 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 20 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 21 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 22 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 23 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 24 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 25 | OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 26 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 27 | OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 28 | ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | -------------------------------------------------------------------------------------------------------- 30 | Notice of Export Control Law 31 | -------------------------------------------------------------------------------------------------------- 32 | TINIUX may be subject to applicable export control laws and regulations, which might 33 | include those applicable to TINIUX of U.S. and the country in which you are located. 34 | Import, export and usage of TINIUX in any manner by you shall be in compliance with such 35 | applicable export control laws and regulations. 36 | ***********************************************************************************************************/ 37 | 38 | #ifndef __TINIUX_H_ 39 | #define __TINIUX_H_ 40 | 41 | #ifdef __cplusplus 42 | extern "C" { 43 | #endif 44 | 45 | #include "FitType.h" 46 | #include "OSType.h" 47 | #include "FitCPU.h" 48 | #include "OSMemory.h" 49 | #include "OSList.h" 50 | #include "OSSchedule.h" 51 | #include "OSTask.h" 52 | #include "OSMsgQ.h" 53 | #include "OSSem.h" 54 | #include "OSMutex.h" 55 | #include "OSTimer.h" 56 | 57 | #define MAJOR_VERSION 3 58 | #define MINOR_VERSION 0 59 | #define REVISION_NUM 0 60 | 61 | //MAJOR_VERSION.MINOR_VERSION.REVISION_NUM 62 | 63 | #ifdef __cplusplus 64 | } 65 | #endif 66 | 67 | #endif //__TINIUX_H_ 68 | -------------------------------------------------------------------------------- /CPU/ARM/IAR/Cortex_M3/FitType.h: -------------------------------------------------------------------------------- 1 | /********************************************************************************************************** 2 | TINIUX - A tiny and efficient embedded real time operating system (RTOS) 3 | Copyright (C) SenseRate.com All rights reserved. 4 | http://www.tiniux.org -- Documentation, latest information, license and contact details. 5 | http://www.tiniux.com -- Commercial support, development, porting, licensing and training services. 6 | -------------------------------------------------------------------------------------------------------- 7 | Redistribution and use in source and binary forms, with or without modification, 8 | are permitted provided that the following conditions are met: 9 | 1. Redistributions of source code must retain the above copyright notice, this list of 10 | conditions and the following disclaimer. 11 | 2. Redistributions in binary form must reproduce the above copyright notice, this list 12 | of conditions and the following disclaimer in the documentation and/or other materials 13 | provided with the distribution. 14 | 3. Neither the name of the copyright holder nor the names of its contributors may be used 15 | to endorse or promote products derived from this software without specific prior written 16 | permission. 17 | -------------------------------------------------------------------------------------------------------- 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 20 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 21 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 22 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 23 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 24 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 25 | OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 26 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 27 | OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 28 | ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | -------------------------------------------------------------------------------------------------------- 30 | Notice of Export Control Law 31 | -------------------------------------------------------------------------------------------------------- 32 | TINIUX may be subject to applicable export control laws and regulations, which might 33 | include those applicable to TINIUX of U.S. and the country in which you are located. 34 | Import, export and usage of TINIUX in any manner by you shall be in compliance with such 35 | applicable export control laws and regulations. 36 | ***********************************************************************************************************/ 37 | 38 | #ifndef __FIT_TYPE_H_ 39 | #define __FIT_TYPE_H_ 40 | 41 | #ifdef __cplusplus 42 | extern "C" { 43 | #endif 44 | 45 | typedef unsigned char uOS8_t; 46 | typedef char sOS8_t; 47 | typedef unsigned short uOS16_t; 48 | typedef signed short sOS16_t; 49 | typedef unsigned int uOS32_t; 50 | typedef signed int sOS32_t; 51 | 52 | typedef uOS32_t uOSStack_t; 53 | typedef sOS32_t sOSBase_t; 54 | typedef uOS32_t uOSBase_t; 55 | typedef uOS32_t uOSTick_t; 56 | 57 | #define FITSTACK_GROWTH ( -1 ) 58 | #define FITBYTE_ALIGNMENT ( 8 ) 59 | 60 | #ifdef __cplusplus 61 | } 62 | #endif 63 | 64 | #endif //__FIT_TYPE_H_ 65 | -------------------------------------------------------------------------------- /CPU/ARM/KEIL/Cortex_M3/FitType.h: -------------------------------------------------------------------------------- 1 | /********************************************************************************************************** 2 | TINIUX - A tiny and efficient embedded real time operating system (RTOS) 3 | Copyright (C) SenseRate.com All rights reserved. 4 | http://www.tiniux.org -- Documentation, latest information, license and contact details. 5 | http://www.tiniux.com -- Commercial support, development, porting, licensing and training services. 6 | -------------------------------------------------------------------------------------------------------- 7 | Redistribution and use in source and binary forms, with or without modification, 8 | are permitted provided that the following conditions are met: 9 | 1. Redistributions of source code must retain the above copyright notice, this list of 10 | conditions and the following disclaimer. 11 | 2. Redistributions in binary form must reproduce the above copyright notice, this list 12 | of conditions and the following disclaimer in the documentation and/or other materials 13 | provided with the distribution. 14 | 3. Neither the name of the copyright holder nor the names of its contributors may be used 15 | to endorse or promote products derived from this software without specific prior written 16 | permission. 17 | -------------------------------------------------------------------------------------------------------- 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 20 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 21 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 22 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 23 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 24 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 25 | OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 26 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 27 | OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 28 | ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | -------------------------------------------------------------------------------------------------------- 30 | Notice of Export Control Law 31 | -------------------------------------------------------------------------------------------------------- 32 | TINIUX may be subject to applicable export control laws and regulations, which might 33 | include those applicable to TINIUX of U.S. and the country in which you are located. 34 | Import, export and usage of TINIUX in any manner by you shall be in compliance with such 35 | applicable export control laws and regulations. 36 | ***********************************************************************************************************/ 37 | 38 | #ifndef __FIT_TYPE_H_ 39 | #define __FIT_TYPE_H_ 40 | 41 | #ifdef __cplusplus 42 | extern "C" { 43 | #endif 44 | 45 | typedef unsigned char uOS8_t; 46 | typedef char sOS8_t; 47 | typedef unsigned short uOS16_t; 48 | typedef signed short sOS16_t; 49 | typedef unsigned int uOS32_t; 50 | typedef signed int sOS32_t; 51 | 52 | typedef uOS32_t uOSStack_t; 53 | typedef sOS32_t sOSBase_t; 54 | typedef uOS32_t uOSBase_t; 55 | typedef uOS32_t uOSTick_t; 56 | 57 | #define FITSTACK_GROWTH ( -1 ) 58 | #define FITBYTE_ALIGNMENT ( 8 ) 59 | 60 | #ifdef __cplusplus 61 | } 62 | #endif 63 | 64 | #endif //__FIT_TYPE_H_ 65 | -------------------------------------------------------------------------------- /CPU/ARM/GCC/Cortex_M0/FitType.h: -------------------------------------------------------------------------------- 1 | /********************************************************************************************************** 2 | TINIUX - A tiny and efficient embedded real time operating system (RTOS) 3 | Copyright (C) SenseRate.com All rights reserved. 4 | http://www.tiniux.org -- Documentation, latest information, license and contact details. 5 | http://www.tiniux.com -- Commercial support, development, porting, licensing and training services. 6 | -------------------------------------------------------------------------------------------------------- 7 | Redistribution and use in source and binary forms, with or without modification, 8 | are permitted provided that the following conditions are met: 9 | 1. Redistributions of source code must retain the above copyright notice, this list of 10 | conditions and the following disclaimer. 11 | 2. Redistributions in binary form must reproduce the above copyright notice, this list 12 | of conditions and the following disclaimer in the documentation and/or other materials 13 | provided with the distribution. 14 | 3. Neither the name of the copyright holder nor the names of its contributors may be used 15 | to endorse or promote products derived from this software without specific prior written 16 | permission. 17 | -------------------------------------------------------------------------------------------------------- 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 20 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 21 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 22 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 23 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 24 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 25 | OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 26 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 27 | OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 28 | ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | -------------------------------------------------------------------------------------------------------- 30 | Notice of Export Control Law 31 | -------------------------------------------------------------------------------------------------------- 32 | TINIUX may be subject to applicable export control laws and regulations, which might 33 | include those applicable to TINIUX of U.S. and the country in which you are located. 34 | Import, export and usage of TINIUX in any manner by you shall be in compliance with such 35 | applicable export control laws and regulations. 36 | ***********************************************************************************************************/ 37 | 38 | #ifndef __FIT_TYPE_H_ 39 | #define __FIT_TYPE_H_ 40 | 41 | #ifdef __cplusplus 42 | extern "C" { 43 | #endif 44 | 45 | typedef unsigned char uOS8_t; 46 | typedef char sOS8_t; 47 | typedef unsigned short uOS16_t; 48 | typedef signed short sOS16_t; 49 | typedef unsigned int uOS32_t; 50 | typedef signed int sOS32_t; 51 | 52 | 53 | typedef uOS32_t uOSStack_t; 54 | typedef sOS32_t sOSBase_t; 55 | typedef uOS32_t uOSBase_t; 56 | typedef uOS32_t uOSTick_t; 57 | 58 | #define FITSTACK_GROWTH ( -1 ) 59 | #define FITBYTE_ALIGNMENT ( 8 ) 60 | 61 | #ifdef __cplusplus 62 | } 63 | #endif 64 | 65 | #endif //__FIT_TYPE_H_ 66 | -------------------------------------------------------------------------------- /CPU/ARM/GCC/Cortex_M7/FitType.h: -------------------------------------------------------------------------------- 1 | /********************************************************************************************************** 2 | TINIUX - A tiny and efficient embedded real time operating system (RTOS) 3 | Copyright (C) SenseRate.com All rights reserved. 4 | http://www.tiniux.org -- Documentation, latest information, license and contact details. 5 | http://www.tiniux.com -- Commercial support, development, porting, licensing and training services. 6 | -------------------------------------------------------------------------------------------------------- 7 | Redistribution and use in source and binary forms, with or without modification, 8 | are permitted provided that the following conditions are met: 9 | 1. Redistributions of source code must retain the above copyright notice, this list of 10 | conditions and the following disclaimer. 11 | 2. Redistributions in binary form must reproduce the above copyright notice, this list 12 | of conditions and the following disclaimer in the documentation and/or other materials 13 | provided with the distribution. 14 | 3. Neither the name of the copyright holder nor the names of its contributors may be used 15 | to endorse or promote products derived from this software without specific prior written 16 | permission. 17 | -------------------------------------------------------------------------------------------------------- 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 20 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 21 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 22 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 23 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 24 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 25 | OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 26 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 27 | OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 28 | ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | -------------------------------------------------------------------------------------------------------- 30 | Notice of Export Control Law 31 | -------------------------------------------------------------------------------------------------------- 32 | TINIUX may be subject to applicable export control laws and regulations, which might 33 | include those applicable to TINIUX of U.S. and the country in which you are located. 34 | Import, export and usage of TINIUX in any manner by you shall be in compliance with such 35 | applicable export control laws and regulations. 36 | ***********************************************************************************************************/ 37 | 38 | #ifndef __FIT_TYPE_H_ 39 | #define __FIT_TYPE_H_ 40 | 41 | #ifdef __cplusplus 42 | extern "C" { 43 | #endif 44 | 45 | typedef unsigned char uOS8_t; 46 | typedef char sOS8_t; 47 | typedef unsigned short uOS16_t; 48 | typedef signed short sOS16_t; 49 | typedef unsigned int uOS32_t; 50 | typedef signed int sOS32_t; 51 | 52 | 53 | typedef uOS32_t uOSStack_t; 54 | typedef sOS32_t sOSBase_t; 55 | typedef uOS32_t uOSBase_t; 56 | typedef uOS32_t uOSTick_t; 57 | 58 | #define FITSTACK_GROWTH ( -1 ) 59 | #define FITBYTE_ALIGNMENT ( 8 ) 60 | 61 | #ifdef __cplusplus 62 | } 63 | #endif 64 | 65 | #endif //__FIT_TYPE_H_ 66 | -------------------------------------------------------------------------------- /CPU/ARM/IAR/Cortex_M0/FitType.h: -------------------------------------------------------------------------------- 1 | /********************************************************************************************************** 2 | TINIUX - A tiny and efficient embedded real time operating system (RTOS) 3 | Copyright (C) SenseRate.com All rights reserved. 4 | http://www.tiniux.org -- Documentation, latest information, license and contact details. 5 | http://www.tiniux.com -- Commercial support, development, porting, licensing and training services. 6 | -------------------------------------------------------------------------------------------------------- 7 | Redistribution and use in source and binary forms, with or without modification, 8 | are permitted provided that the following conditions are met: 9 | 1. Redistributions of source code must retain the above copyright notice, this list of 10 | conditions and the following disclaimer. 11 | 2. Redistributions in binary form must reproduce the above copyright notice, this list 12 | of conditions and the following disclaimer in the documentation and/or other materials 13 | provided with the distribution. 14 | 3. Neither the name of the copyright holder nor the names of its contributors may be used 15 | to endorse or promote products derived from this software without specific prior written 16 | permission. 17 | -------------------------------------------------------------------------------------------------------- 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 20 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 21 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 22 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 23 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 24 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 25 | OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 26 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 27 | OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 28 | ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | -------------------------------------------------------------------------------------------------------- 30 | Notice of Export Control Law 31 | -------------------------------------------------------------------------------------------------------- 32 | TINIUX may be subject to applicable export control laws and regulations, which might 33 | include those applicable to TINIUX of U.S. and the country in which you are located. 34 | Import, export and usage of TINIUX in any manner by you shall be in compliance with such 35 | applicable export control laws and regulations. 36 | ***********************************************************************************************************/ 37 | 38 | #ifndef __FIT_TYPE_H 39 | #define __FIT_TYPE_H 40 | 41 | #ifdef __cplusplus 42 | extern "C" { 43 | #endif 44 | 45 | typedef unsigned char uOS8_t; 46 | typedef char sOS8_t; 47 | typedef unsigned short uOS16_t; 48 | typedef signed short sOS16_t; 49 | typedef unsigned int uOS32_t; 50 | typedef signed int sOS32_t; 51 | 52 | 53 | typedef uOS32_t uOSStack_t; 54 | typedef sOS32_t sOSBase_t; 55 | typedef uOS32_t uOSBase_t; 56 | typedef uOS32_t uOSTick_t; 57 | 58 | #define FITSTACK_GROWTH ( -1 ) 59 | #define FITBYTE_ALIGNMENT ( 8 ) 60 | 61 | #ifdef __cplusplus 62 | } 63 | #endif 64 | 65 | #endif //__FIT_TYPE_H 66 | -------------------------------------------------------------------------------- /CPU/ARM/IAR/Cortex_M4/FitType.h: -------------------------------------------------------------------------------- 1 | /********************************************************************************************************** 2 | TINIUX - A tiny and efficient embedded real time operating system (RTOS) 3 | Copyright (C) SenseRate.com All rights reserved. 4 | http://www.tiniux.org -- Documentation, latest information, license and contact details. 5 | http://www.tiniux.com -- Commercial support, development, porting, licensing and training services. 6 | -------------------------------------------------------------------------------------------------------- 7 | Redistribution and use in source and binary forms, with or without modification, 8 | are permitted provided that the following conditions are met: 9 | 1. Redistributions of source code must retain the above copyright notice, this list of 10 | conditions and the following disclaimer. 11 | 2. Redistributions in binary form must reproduce the above copyright notice, this list 12 | of conditions and the following disclaimer in the documentation and/or other materials 13 | provided with the distribution. 14 | 3. Neither the name of the copyright holder nor the names of its contributors may be used 15 | to endorse or promote products derived from this software without specific prior written 16 | permission. 17 | -------------------------------------------------------------------------------------------------------- 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 20 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 21 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 22 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 23 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 24 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 25 | OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 26 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 27 | OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 28 | ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | -------------------------------------------------------------------------------------------------------- 30 | Notice of Export Control Law 31 | -------------------------------------------------------------------------------------------------------- 32 | TINIUX may be subject to applicable export control laws and regulations, which might 33 | include those applicable to TINIUX of U.S. and the country in which you are located. 34 | Import, export and usage of TINIUX in any manner by you shall be in compliance with such 35 | applicable export control laws and regulations. 36 | ***********************************************************************************************************/ 37 | 38 | #ifndef __FIT_TYPE_H 39 | #define __FIT_TYPE_H 40 | 41 | #ifdef __cplusplus 42 | extern "C" { 43 | #endif 44 | 45 | typedef unsigned char uOS8_t; 46 | typedef char sOS8_t; 47 | typedef unsigned short uOS16_t; 48 | typedef signed short sOS16_t; 49 | typedef unsigned int uOS32_t; 50 | typedef signed int sOS32_t; 51 | 52 | 53 | typedef uOS32_t uOSStack_t; 54 | typedef sOS32_t sOSBase_t; 55 | typedef uOS32_t uOSBase_t; 56 | typedef uOS32_t uOSTick_t; 57 | 58 | #define FITSTACK_GROWTH ( -1 ) 59 | #define FITBYTE_ALIGNMENT ( 8 ) 60 | 61 | #ifdef __cplusplus 62 | } 63 | #endif 64 | 65 | #endif //__FIT_TYPE_H 66 | -------------------------------------------------------------------------------- /CPU/ARM/IAR/Cortex_M7/FitType.h: -------------------------------------------------------------------------------- 1 | /********************************************************************************************************** 2 | TINIUX - A tiny and efficient embedded real time operating system (RTOS) 3 | Copyright (C) SenseRate.com All rights reserved. 4 | http://www.tiniux.org -- Documentation, latest information, license and contact details. 5 | http://www.tiniux.com -- Commercial support, development, porting, licensing and training services. 6 | -------------------------------------------------------------------------------------------------------- 7 | Redistribution and use in source and binary forms, with or without modification, 8 | are permitted provided that the following conditions are met: 9 | 1. Redistributions of source code must retain the above copyright notice, this list of 10 | conditions and the following disclaimer. 11 | 2. Redistributions in binary form must reproduce the above copyright notice, this list 12 | of conditions and the following disclaimer in the documentation and/or other materials 13 | provided with the distribution. 14 | 3. Neither the name of the copyright holder nor the names of its contributors may be used 15 | to endorse or promote products derived from this software without specific prior written 16 | permission. 17 | -------------------------------------------------------------------------------------------------------- 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 20 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 21 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 22 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 23 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 24 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 25 | OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 26 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 27 | OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 28 | ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | -------------------------------------------------------------------------------------------------------- 30 | Notice of Export Control Law 31 | -------------------------------------------------------------------------------------------------------- 32 | TINIUX may be subject to applicable export control laws and regulations, which might 33 | include those applicable to TINIUX of U.S. and the country in which you are located. 34 | Import, export and usage of TINIUX in any manner by you shall be in compliance with such 35 | applicable export control laws and regulations. 36 | ***********************************************************************************************************/ 37 | 38 | #ifndef __FIT_TYPE_H_ 39 | #define __FIT_TYPE_H_ 40 | 41 | #ifdef __cplusplus 42 | extern "C" { 43 | #endif 44 | 45 | typedef unsigned char uOS8_t; 46 | typedef char sOS8_t; 47 | typedef unsigned short uOS16_t; 48 | typedef signed short sOS16_t; 49 | typedef unsigned int uOS32_t; 50 | typedef signed int sOS32_t; 51 | 52 | 53 | typedef uOS32_t uOSStack_t; 54 | typedef sOS32_t sOSBase_t; 55 | typedef uOS32_t uOSBase_t; 56 | typedef uOS32_t uOSTick_t; 57 | 58 | #define FITSTACK_GROWTH ( -1 ) 59 | #define FITBYTE_ALIGNMENT ( 8 ) 60 | 61 | #ifdef __cplusplus 62 | } 63 | #endif 64 | 65 | #endif //__FIT_TYPE_H_ 66 | -------------------------------------------------------------------------------- /CPU/ARM/KEIL/Cortex_M0/FitType.h: -------------------------------------------------------------------------------- 1 | /********************************************************************************************************** 2 | TINIUX - A tiny and efficient embedded real time operating system (RTOS) 3 | Copyright (C) SenseRate.com All rights reserved. 4 | http://www.tiniux.org -- Documentation, latest information, license and contact details. 5 | http://www.tiniux.com -- Commercial support, development, porting, licensing and training services. 6 | -------------------------------------------------------------------------------------------------------- 7 | Redistribution and use in source and binary forms, with or without modification, 8 | are permitted provided that the following conditions are met: 9 | 1. Redistributions of source code must retain the above copyright notice, this list of 10 | conditions and the following disclaimer. 11 | 2. Redistributions in binary form must reproduce the above copyright notice, this list 12 | of conditions and the following disclaimer in the documentation and/or other materials 13 | provided with the distribution. 14 | 3. Neither the name of the copyright holder nor the names of its contributors may be used 15 | to endorse or promote products derived from this software without specific prior written 16 | permission. 17 | -------------------------------------------------------------------------------------------------------- 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 20 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 21 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 22 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 23 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 24 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 25 | OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 26 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 27 | OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 28 | ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | -------------------------------------------------------------------------------------------------------- 30 | Notice of Export Control Law 31 | -------------------------------------------------------------------------------------------------------- 32 | TINIUX may be subject to applicable export control laws and regulations, which might 33 | include those applicable to TINIUX of U.S. and the country in which you are located. 34 | Import, export and usage of TINIUX in any manner by you shall be in compliance with such 35 | applicable export control laws and regulations. 36 | ***********************************************************************************************************/ 37 | 38 | #ifndef __FIT_TYPE_H_ 39 | #define __FIT_TYPE_H_ 40 | 41 | #ifdef __cplusplus 42 | extern "C" { 43 | #endif 44 | 45 | typedef unsigned char uOS8_t; 46 | typedef char sOS8_t; 47 | typedef unsigned short uOS16_t; 48 | typedef signed short sOS16_t; 49 | typedef unsigned int uOS32_t; 50 | typedef signed int sOS32_t; 51 | 52 | 53 | typedef uOS32_t uOSStack_t; 54 | typedef sOS32_t sOSBase_t; 55 | typedef uOS32_t uOSBase_t; 56 | typedef uOS32_t uOSTick_t; 57 | 58 | #define FITSTACK_GROWTH ( -1 ) 59 | #define FITBYTE_ALIGNMENT ( 8 ) 60 | 61 | #ifdef __cplusplus 62 | } 63 | #endif 64 | 65 | #endif //__FIT_TYPE_H_ 66 | -------------------------------------------------------------------------------- /CPU/ARM/KEIL/Cortex_M7/FitType.h: -------------------------------------------------------------------------------- 1 | /********************************************************************************************************** 2 | TINIUX - A tiny and efficient embedded real time operating system (RTOS) 3 | Copyright (C) SenseRate.com All rights reserved. 4 | http://www.tiniux.org -- Documentation, latest information, license and contact details. 5 | http://www.tiniux.com -- Commercial support, development, porting, licensing and training services. 6 | -------------------------------------------------------------------------------------------------------- 7 | Redistribution and use in source and binary forms, with or without modification, 8 | are permitted provided that the following conditions are met: 9 | 1. Redistributions of source code must retain the above copyright notice, this list of 10 | conditions and the following disclaimer. 11 | 2. Redistributions in binary form must reproduce the above copyright notice, this list 12 | of conditions and the following disclaimer in the documentation and/or other materials 13 | provided with the distribution. 14 | 3. Neither the name of the copyright holder nor the names of its contributors may be used 15 | to endorse or promote products derived from this software without specific prior written 16 | permission. 17 | -------------------------------------------------------------------------------------------------------- 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 20 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 21 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 22 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 23 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 24 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 25 | OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 26 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 27 | OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 28 | ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | -------------------------------------------------------------------------------------------------------- 30 | Notice of Export Control Law 31 | -------------------------------------------------------------------------------------------------------- 32 | TINIUX may be subject to applicable export control laws and regulations, which might 33 | include those applicable to TINIUX of U.S. and the country in which you are located. 34 | Import, export and usage of TINIUX in any manner by you shall be in compliance with such 35 | applicable export control laws and regulations. 36 | ***********************************************************************************************************/ 37 | 38 | #ifndef __FIT_TYPE_H_ 39 | #define __FIT_TYPE_H_ 40 | 41 | #ifdef __cplusplus 42 | extern "C" { 43 | #endif 44 | 45 | typedef unsigned char uOS8_t; 46 | typedef char sOS8_t; 47 | typedef unsigned short uOS16_t; 48 | typedef signed short sOS16_t; 49 | typedef unsigned int uOS32_t; 50 | typedef signed int sOS32_t; 51 | 52 | 53 | typedef uOS32_t uOSStack_t; 54 | typedef sOS32_t sOSBase_t; 55 | typedef uOS32_t uOSBase_t; 56 | typedef uOS32_t uOSTick_t; 57 | 58 | #define FITSTACK_GROWTH ( -1 ) 59 | #define FITBYTE_ALIGNMENT ( 8 ) 60 | 61 | #ifdef __cplusplus 62 | } 63 | #endif 64 | 65 | #endif //__FIT_TYPE_H_ 66 | -------------------------------------------------------------------------------- /CPU/ARM/GCC/Cortex_M3/FitType.h: -------------------------------------------------------------------------------- 1 | /********************************************************************************************************** 2 | TINIUX - A tiny and efficient embedded real time operating system (RTOS) 3 | Copyright (C) SenseRate.com All rights reserved. 4 | http://www.tiniux.org -- Documentation, latest information, license and contact details. 5 | http://www.tiniux.com -- Commercial support, development, porting, licensing and training services. 6 | -------------------------------------------------------------------------------------------------------- 7 | Redistribution and use in source and binary forms, with or without modification, 8 | are permitted provided that the following conditions are met: 9 | 1. Redistributions of source code must retain the above copyright notice, this list of 10 | conditions and the following disclaimer. 11 | 2. Redistributions in binary form must reproduce the above copyright notice, this list 12 | of conditions and the following disclaimer in the documentation and/or other materials 13 | provided with the distribution. 14 | 3. Neither the name of the copyright holder nor the names of its contributors may be used 15 | to endorse or promote products derived from this software without specific prior written 16 | permission. 17 | -------------------------------------------------------------------------------------------------------- 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 20 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 21 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 22 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 23 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 24 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 25 | OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 26 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 27 | OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 28 | ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | -------------------------------------------------------------------------------------------------------- 30 | Notice of Export Control Law 31 | -------------------------------------------------------------------------------------------------------- 32 | TINIUX may be subject to applicable export control laws and regulations, which might 33 | include those applicable to TINIUX of U.S. and the country in which you are located. 34 | Import, export and usage of TINIUX in any manner by you shall be in compliance with such 35 | applicable export control laws and regulations. 36 | ***********************************************************************************************************/ 37 | 38 | #ifndef __FIT_TYPE_H_ 39 | #define __FIT_TYPE_H_ 40 | 41 | #ifdef __cplusplus 42 | extern "C" { 43 | #endif 44 | 45 | 46 | typedef unsigned char uOS8_t; 47 | typedef char sOS8_t; 48 | typedef unsigned short uOS16_t; 49 | typedef signed short sOS16_t; 50 | typedef unsigned int uOS32_t; 51 | typedef signed int sOS32_t; 52 | 53 | 54 | typedef uOS32_t uOSStack_t; 55 | typedef sOS32_t sOSBase_t; 56 | typedef uOS32_t uOSBase_t; 57 | typedef uOS32_t uOSTick_t; 58 | 59 | #define FITSTACK_GROWTH ( -1 ) 60 | #define FITBYTE_ALIGNMENT ( 8 ) 61 | 62 | #ifdef __cplusplus 63 | } 64 | #endif 65 | 66 | #endif //__FIT_TYPE_H_ 67 | -------------------------------------------------------------------------------- /CPU/ARM/GCC/Cortex_M4/FitType.h: -------------------------------------------------------------------------------- 1 | /********************************************************************************************************** 2 | TINIUX - A tiny and efficient embedded real time operating system (RTOS) 3 | Copyright (C) SenseRate.com All rights reserved. 4 | http://www.tiniux.org -- Documentation, latest information, license and contact details. 5 | http://www.tiniux.com -- Commercial support, development, porting, licensing and training services. 6 | -------------------------------------------------------------------------------------------------------- 7 | Redistribution and use in source and binary forms, with or without modification, 8 | are permitted provided that the following conditions are met: 9 | 1. Redistributions of source code must retain the above copyright notice, this list of 10 | conditions and the following disclaimer. 11 | 2. Redistributions in binary form must reproduce the above copyright notice, this list 12 | of conditions and the following disclaimer in the documentation and/or other materials 13 | provided with the distribution. 14 | 3. Neither the name of the copyright holder nor the names of its contributors may be used 15 | to endorse or promote products derived from this software without specific prior written 16 | permission. 17 | -------------------------------------------------------------------------------------------------------- 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 20 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 21 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 22 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 23 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 24 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 25 | OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 26 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 27 | OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 28 | ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | -------------------------------------------------------------------------------------------------------- 30 | Notice of Export Control Law 31 | -------------------------------------------------------------------------------------------------------- 32 | TINIUX may be subject to applicable export control laws and regulations, which might 33 | include those applicable to TINIUX of U.S. and the country in which you are located. 34 | Import, export and usage of TINIUX in any manner by you shall be in compliance with such 35 | applicable export control laws and regulations. 36 | ***********************************************************************************************************/ 37 | 38 | #ifndef __FIT_TYPE_H_ 39 | #define __FIT_TYPE_H_ 40 | 41 | #ifdef __cplusplus 42 | extern "C" { 43 | #endif 44 | 45 | typedef unsigned char uOS8_t; 46 | typedef char sOS8_t; 47 | typedef unsigned short uOS16_t; 48 | typedef signed short sOS16_t; 49 | typedef unsigned int uOS32_t; 50 | typedef signed int sOS32_t; 51 | 52 | 53 | typedef uOS32_t uOSStack_t; 54 | typedef sOS32_t sOSBase_t; 55 | typedef uOS32_t uOSBase_t; 56 | typedef uOS32_t uOSTick_t; 57 | 58 | #define FITSTACK_GROWTH ( -1 ) 59 | #define FITBYTE_ALIGNMENT ( 8 ) 60 | 61 | 62 | #ifdef __cplusplus 63 | } 64 | #endif 65 | 66 | #endif //__FIT_TYPE_H_ 67 | -------------------------------------------------------------------------------- /CPU/ARM/KEIL/Cortex_M4/FitType.h: -------------------------------------------------------------------------------- 1 | /********************************************************************************************************** 2 | TINIUX - A tiny and efficient embedded real time operating system (RTOS) 3 | Copyright (C) SenseRate.com All rights reserved. 4 | http://www.tiniux.org -- Documentation, latest information, license and contact details. 5 | http://www.tiniux.com -- Commercial support, development, porting, licensing and training services. 6 | -------------------------------------------------------------------------------------------------------- 7 | Redistribution and use in source and binary forms, with or without modification, 8 | are permitted provided that the following conditions are met: 9 | 1. Redistributions of source code must retain the above copyright notice, this list of 10 | conditions and the following disclaimer. 11 | 2. Redistributions in binary form must reproduce the above copyright notice, this list 12 | of conditions and the following disclaimer in the documentation and/or other materials 13 | provided with the distribution. 14 | 3. Neither the name of the copyright holder nor the names of its contributors may be used 15 | to endorse or promote products derived from this software without specific prior written 16 | permission. 17 | -------------------------------------------------------------------------------------------------------- 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 20 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 21 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 22 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 23 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 24 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 25 | OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 26 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 27 | OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 28 | ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | -------------------------------------------------------------------------------------------------------- 30 | Notice of Export Control Law 31 | -------------------------------------------------------------------------------------------------------- 32 | TINIUX may be subject to applicable export control laws and regulations, which might 33 | include those applicable to TINIUX of U.S. and the country in which you are located. 34 | Import, export and usage of TINIUX in any manner by you shall be in compliance with such 35 | applicable export control laws and regulations. 36 | ***********************************************************************************************************/ 37 | 38 | #ifndef __FIT_TYPE_H_ 39 | #define __FIT_TYPE_H_ 40 | 41 | #ifdef __cplusplus 42 | extern "C" { 43 | #endif 44 | 45 | typedef unsigned char uOS8_t; 46 | typedef char sOS8_t; 47 | typedef unsigned short uOS16_t; 48 | typedef signed short sOS16_t; 49 | typedef unsigned int uOS32_t; 50 | typedef signed int sOS32_t; 51 | 52 | 53 | typedef uOS32_t uOSStack_t; 54 | typedef sOS32_t sOSBase_t; 55 | typedef uOS32_t uOSBase_t; 56 | typedef uOS32_t uOSTick_t; 57 | 58 | #define FITSTACK_GROWTH ( -1 ) 59 | #define FITBYTE_ALIGNMENT ( 8 ) 60 | 61 | 62 | #ifdef __cplusplus 63 | } 64 | #endif 65 | 66 | #endif //__FIT_TYPE_H_ 67 | -------------------------------------------------------------------------------- /CPU/MCS51/SDCC/8051/FitType.h: -------------------------------------------------------------------------------- 1 | /********************************************************************************************************** 2 | TINIUX - A tiny and efficient embedded real time operating system (RTOS) 3 | Copyright (C) SenseRate.com All rights reserved. 4 | http://www.tiniux.org -- Documentation, latest information, license and contact details. 5 | http://www.tiniux.com -- Commercial support, development, porting, licensing and training services. 6 | -------------------------------------------------------------------------------------------------------- 7 | Redistribution and use in source and binary forms, with or without modification, 8 | are permitted provided that the following conditions are met: 9 | 1. Redistributions of source code must retain the above copyright notice, this list of 10 | conditions and the following disclaimer. 11 | 2. Redistributions in binary form must reproduce the above copyright notice, this list 12 | of conditions and the following disclaimer in the documentation and/or other materials 13 | provided with the distribution. 14 | 3. Neither the name of the copyright holder nor the names of its contributors may be used 15 | to endorse or promote products derived from this software without specific prior written 16 | permission. 17 | -------------------------------------------------------------------------------------------------------- 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 20 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 21 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 22 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 23 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 24 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 25 | OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 26 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 27 | OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 28 | ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | -------------------------------------------------------------------------------------------------------- 30 | Notice of Export Control Law 31 | -------------------------------------------------------------------------------------------------------- 32 | TINIUX may be subject to applicable export control laws and regulations, which might 33 | include those applicable to TINIUX of U.S. and the country in which you are located. 34 | Import, export and usage of TINIUX in any manner by you shall be in compliance with such 35 | applicable export control laws and regulations. 36 | ***********************************************************************************************************/ 37 | 38 | #ifndef __FIT_TYPE_H_ 39 | #define __FIT_TYPE_H_ 40 | 41 | #ifdef __cplusplus 42 | extern "C" { 43 | #endif 44 | 45 | /* Type definitions. */ 46 | 47 | typedef unsigned char uOS8_t; 48 | typedef char sOS8_t; 49 | typedef unsigned short uOS16_t; 50 | typedef signed short sOS16_t; 51 | typedef unsigned int uOS32_t; 52 | typedef signed int sOS32_t; 53 | 54 | 55 | typedef uOS8_t uOSStack_t; 56 | typedef sOS8_t sOSBase_t; 57 | typedef uOS8_t uOSBase_t; 58 | typedef uOS16_t uOSTick_t; 59 | 60 | #define FITSTACK_GROWTH ( 1 ) 61 | #define FITBYTE_ALIGNMENT ( 1 ) 62 | 63 | #ifdef __cplusplus 64 | } 65 | #endif 66 | 67 | #endif //__FIT_TYPE_H_ 68 | -------------------------------------------------------------------------------- /CPU/MCS51/SDCC/8052/FitType.h: -------------------------------------------------------------------------------- 1 | /********************************************************************************************************** 2 | TINIUX - A tiny and efficient embedded real time operating system (RTOS) 3 | Copyright (C) SenseRate.com All rights reserved. 4 | http://www.tiniux.org -- Documentation, latest information, license and contact details. 5 | http://www.tiniux.com -- Commercial support, development, porting, licensing and training services. 6 | -------------------------------------------------------------------------------------------------------- 7 | Redistribution and use in source and binary forms, with or without modification, 8 | are permitted provided that the following conditions are met: 9 | 1. Redistributions of source code must retain the above copyright notice, this list of 10 | conditions and the following disclaimer. 11 | 2. Redistributions in binary form must reproduce the above copyright notice, this list 12 | of conditions and the following disclaimer in the documentation and/or other materials 13 | provided with the distribution. 14 | 3. Neither the name of the copyright holder nor the names of its contributors may be used 15 | to endorse or promote products derived from this software without specific prior written 16 | permission. 17 | -------------------------------------------------------------------------------------------------------- 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 20 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 21 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 22 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 23 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 24 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 25 | OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 26 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 27 | OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 28 | ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | -------------------------------------------------------------------------------------------------------- 30 | Notice of Export Control Law 31 | -------------------------------------------------------------------------------------------------------- 32 | TINIUX may be subject to applicable export control laws and regulations, which might 33 | include those applicable to TINIUX of U.S. and the country in which you are located. 34 | Import, export and usage of TINIUX in any manner by you shall be in compliance with such 35 | applicable export control laws and regulations. 36 | ***********************************************************************************************************/ 37 | 38 | #ifndef __FIT_TYPE_H_ 39 | #define __FIT_TYPE_H_ 40 | 41 | #ifdef __cplusplus 42 | extern "C" { 43 | #endif 44 | 45 | /* Type definitions. */ 46 | 47 | typedef unsigned char uOS8_t; 48 | typedef char sOS8_t; 49 | typedef unsigned short uOS16_t; 50 | typedef signed short sOS16_t; 51 | typedef unsigned int uOS32_t; 52 | typedef signed int sOS32_t; 53 | 54 | 55 | typedef uOS8_t uOSStack_t; 56 | typedef sOS8_t sOSBase_t; 57 | typedef uOS8_t uOSBase_t; 58 | typedef uOS16_t uOSTick_t; 59 | 60 | #define FITSTACK_GROWTH ( 1 ) 61 | #define FITBYTE_ALIGNMENT ( 1 ) 62 | 63 | #ifdef __cplusplus 64 | } 65 | #endif 66 | 67 | #endif //__FIT_TYPE_H_ 68 | -------------------------------------------------------------------------------- /CPU/ARM/IAR/Cortex_M0/FitCPU.h: -------------------------------------------------------------------------------- 1 | /********************************************************************************************************** 2 | TINIUX - A tiny and efficient embedded real time operating system (RTOS) 3 | Copyright (C) SenseRate.com All rights reserved. 4 | http://www.tiniux.org -- Documentation, latest information, license and contact details. 5 | http://www.tiniux.com -- Commercial support, development, porting, licensing and training services. 6 | -------------------------------------------------------------------------------------------------------- 7 | Redistribution and use in source and binary forms, with or without modification, 8 | are permitted provided that the following conditions are met: 9 | 1. Redistributions of source code must retain the above copyright notice, this list of 10 | conditions and the following disclaimer. 11 | 2. Redistributions in binary form must reproduce the above copyright notice, this list 12 | of conditions and the following disclaimer in the documentation and/or other materials 13 | provided with the distribution. 14 | 3. Neither the name of the copyright holder nor the names of its contributors may be used 15 | to endorse or promote products derived from this software without specific prior written 16 | permission. 17 | -------------------------------------------------------------------------------------------------------- 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 20 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 21 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 22 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 23 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 24 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 25 | OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 26 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 27 | OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 28 | ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | -------------------------------------------------------------------------------------------------------- 30 | Notice of Export Control Law 31 | -------------------------------------------------------------------------------------------------------- 32 | TINIUX may be subject to applicable export control laws and regulations, which might 33 | include those applicable to TINIUX of U.S. and the country in which you are located. 34 | Import, export and usage of TINIUX in any manner by you shall be in compliance with such 35 | applicable export control laws and regulations. 36 | ***********************************************************************************************************/ 37 | 38 | #ifndef __FIT_CPU_H_ 39 | #define __FIT_CPU_H_ 40 | 41 | #include "OSType.h" 42 | 43 | #ifdef __cplusplus 44 | extern "C" { 45 | #endif 46 | 47 | /* Scheduler utilities. */ 48 | extern void FitSchedule( void ); 49 | #define FitNVIC_INT_CTRL ( ( volatile uOS32_t *) 0xe000ed04 ) 50 | #define FitNVIC_PENDSVSET 0x10000000 51 | #define FitScheduleFromISR( b ) if( b ) FitSchedule() 52 | 53 | extern void FitIntLock( void ); 54 | extern void FitIntUnlock( void ); 55 | extern uOS32_t FitIntMask( void ); 56 | extern void FitIntUnmask( uOS32_t ulMask ); 57 | extern uOS32_t FitGetIPSR( void ); 58 | 59 | #define FitIntMaskFromISR() FitIntMask() 60 | #define FitIntUnmaskFromISR(x) FitIntUnmask( x ) 61 | 62 | /* Determine whether we are in thread mode or handler mode. */ 63 | #define FitIsInsideISR() ( ( uOSBool_t ) ( FitGetIPSR() != ( uOSBase_t )0 ) ) 64 | 65 | uOSStack_t *FitInitializeStack( uOSStack_t *pxTopOfStack, OSTaskFunction_t TaskFunction, void *pvParameters ); 66 | sOSBase_t FitStartScheduler( void ); 67 | 68 | void FitPendSVHandler( void ); 69 | void FitOSTickISR( void ); 70 | void FitSVCHandler( void ); 71 | 72 | #ifdef __cplusplus 73 | } 74 | #endif 75 | 76 | #endif //__FIT_CPU_H_ 77 | -------------------------------------------------------------------------------- /CPU/ARM/KEIL/Cortex_M0/FitCPU.h: -------------------------------------------------------------------------------- 1 | /********************************************************************************************************** 2 | TINIUX - A tiny and efficient embedded real time operating system (RTOS) 3 | Copyright (C) SenseRate.com All rights reserved. 4 | http://www.tiniux.org -- Documentation, latest information, license and contact details. 5 | http://www.tiniux.com -- Commercial support, development, porting, licensing and training services. 6 | -------------------------------------------------------------------------------------------------------- 7 | Redistribution and use in source and binary forms, with or without modification, 8 | are permitted provided that the following conditions are met: 9 | 1. Redistributions of source code must retain the above copyright notice, this list of 10 | conditions and the following disclaimer. 11 | 2. Redistributions in binary form must reproduce the above copyright notice, this list 12 | of conditions and the following disclaimer in the documentation and/or other materials 13 | provided with the distribution. 14 | 3. Neither the name of the copyright holder nor the names of its contributors may be used 15 | to endorse or promote products derived from this software without specific prior written 16 | permission. 17 | -------------------------------------------------------------------------------------------------------- 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 20 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 21 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 22 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 23 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 24 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 25 | OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 26 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 27 | OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 28 | ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | -------------------------------------------------------------------------------------------------------- 30 | Notice of Export Control Law 31 | -------------------------------------------------------------------------------------------------------- 32 | TINIUX may be subject to applicable export control laws and regulations, which might 33 | include those applicable to TINIUX of U.S. and the country in which you are located. 34 | Import, export and usage of TINIUX in any manner by you shall be in compliance with such 35 | applicable export control laws and regulations. 36 | ***********************************************************************************************************/ 37 | 38 | #ifndef __FIT_CPU_H_ 39 | #define __FIT_CPU_H_ 40 | 41 | #include "FitType.h" 42 | 43 | #ifdef __cplusplus 44 | extern "C" { 45 | #endif 46 | 47 | /* Scheduler utilities. */ 48 | extern void FitSchedule( void ); 49 | #define FitNVIC_INT_CTRL_REG ( * ( ( volatile uOS32_t * ) 0xe000ed04 ) ) 50 | #define FitNVIC_PENDSVSET_BIT ( 1UL << 28UL ) 51 | 52 | /* Determine whether we are in thread mode or handler mode. */ 53 | #define FitIsInsideISR() ( ( uOSBool_t ) ( FitGetIPSR() != ( uOSBase_t )0 ) ) 54 | 55 | #define FitScheduleFromISR( b ) if( b ) FitSchedule() 56 | 57 | extern void FitIntLock( void ); 58 | extern void FitIntUnlock( void ); 59 | extern uOS32_t FitIntMask( void ); 60 | extern void FitIntUnmask( uOS32_t ulMask ); 61 | extern uOS32_t FitGetIPSR( void ); 62 | 63 | #define FitIntMaskFromISR() FitIntMask() 64 | #define FitIntUnmaskFromISR(x) FitIntUnmask( x ) 65 | 66 | uOSStack_t *FitInitializeStack( uOSStack_t *pxTopOfStack, OSTaskFunction_t TaskFunction, void *pvParameters ); 67 | sOSBase_t FitStartScheduler( void ); 68 | 69 | void FitPendSVHandler( void ); 70 | void FitOSTickISR( void ); 71 | void FitSVCHandler( void ); 72 | 73 | #ifdef __cplusplus 74 | } 75 | #endif 76 | 77 | #endif //__FIT_CPU_H_ 78 | -------------------------------------------------------------------------------- /CPU/ARM/GCC/Cortex_M0/FitCPU.h: -------------------------------------------------------------------------------- 1 | /********************************************************************************************************** 2 | TINIUX - A tiny and efficient embedded real time operating system (RTOS) 3 | Copyright (C) SenseRate.com All rights reserved. 4 | http://www.tiniux.org -- Documentation, latest information, license and contact details. 5 | http://www.tiniux.com -- Commercial support, development, porting, licensing and training services. 6 | -------------------------------------------------------------------------------------------------------- 7 | Redistribution and use in source and binary forms, with or without modification, 8 | are permitted provided that the following conditions are met: 9 | 1. Redistributions of source code must retain the above copyright notice, this list of 10 | conditions and the following disclaimer. 11 | 2. Redistributions in binary form must reproduce the above copyright notice, this list 12 | of conditions and the following disclaimer in the documentation and/or other materials 13 | provided with the distribution. 14 | 3. Neither the name of the copyright holder nor the names of its contributors may be used 15 | to endorse or promote products derived from this software without specific prior written 16 | permission. 17 | -------------------------------------------------------------------------------------------------------- 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 20 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 21 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 22 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 23 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 24 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 25 | OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 26 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 27 | OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 28 | ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | -------------------------------------------------------------------------------------------------------- 30 | Notice of Export Control Law 31 | -------------------------------------------------------------------------------------------------------- 32 | TINIUX may be subject to applicable export control laws and regulations, which might 33 | include those applicable to TINIUX of U.S. and the country in which you are located. 34 | Import, export and usage of TINIUX in any manner by you shall be in compliance with such 35 | applicable export control laws and regulations. 36 | ***********************************************************************************************************/ 37 | 38 | #ifndef __FIT_CPU_H_ 39 | #define __FIT_CPU_H_ 40 | 41 | #include "FitType.h" 42 | 43 | #ifdef __cplusplus 44 | extern "C" { 45 | #endif 46 | 47 | 48 | /* Scheduler utilities. */ 49 | extern void FitSchedule( void ); 50 | #define FitNVIC_INT_CTRL_REG ( * ( ( volatile uOS32_t * ) 0xe000ed04 ) ) 51 | #define FitNVIC_PENDSVSET_BIT ( 1UL << 28UL ) 52 | #define FitScheduleFromISR( b ) if( b ) FitSchedule() 53 | 54 | extern void FitIntLock( void ); 55 | extern void FitIntUnlock( void ); 56 | extern uOS32_t FitIntMask( void ) __attribute__((naked)); 57 | extern void FitIntUnmask( uOS32_t ulMask ) __attribute__((naked)); 58 | 59 | #ifndef FIT_FORCE_INLINE 60 | #define FIT_FORCE_INLINE inline __attribute__(( always_inline)) 61 | #endif 62 | 63 | FIT_FORCE_INLINE uOS32_t FitGetIPSR( void ) 64 | { 65 | uOS32_t ulCurrentInterrupt; 66 | 67 | /* Obtain the number of the currently executing interrupt. */ 68 | __asm volatile 69 | ( 70 | "mrs %0, ipsr" : "=r"( ulCurrentInterrupt ) 71 | ); 72 | 73 | return ulCurrentInterrupt; 74 | } 75 | 76 | /* Determine whether we are in thread mode or handler mode. */ 77 | #define FitIsInsideISR() ( ( uOSBool_t ) ( FitGetIPSR() != ( uOSBase_t )0 ) ) 78 | 79 | #define FitIntMaskFromISR() FitIntMask() 80 | #define FitIntUnmaskFromISR(x) FitIntUnmask( x ) 81 | 82 | uOSStack_t *FitInitializeStack( uOSStack_t *pxTopOfStack, OSTaskFunction_t TaskFunction, void *pvParameters ); 83 | sOSBase_t FitStartScheduler( void ); 84 | 85 | void FitPendSVHandler( void ) __attribute__ (( naked )); 86 | void FitOSTickISR( void ); 87 | void FitSVCHandler( void ) __attribute__ (( naked )); 88 | 89 | #ifdef __cplusplus 90 | } 91 | #endif 92 | 93 | #endif //__FIT_CPU_H_ 94 | -------------------------------------------------------------------------------- /Kernel/OSMutex.h: -------------------------------------------------------------------------------- 1 | /********************************************************************************************************** 2 | TINIUX - A tiny and efficient embedded real time operating system (RTOS) 3 | Copyright (C) SenseRate.com All rights reserved. 4 | http://www.tiniux.org -- Documentation, latest information, license and contact details. 5 | http://www.tiniux.com -- Commercial support, development, porting, licensing and training services. 6 | -------------------------------------------------------------------------------------------------------- 7 | Redistribution and use in source and binary forms, with or without modification, 8 | are permitted provided that the following conditions are met: 9 | 1. Redistributions of source code must retain the above copyright notice, this list of 10 | conditions and the following disclaimer. 11 | 2. Redistributions in binary form must reproduce the above copyright notice, this list 12 | of conditions and the following disclaimer in the documentation and/or other materials 13 | provided with the distribution. 14 | 3. Neither the name of the copyright holder nor the names of its contributors may be used 15 | to endorse or promote products derived from this software without specific prior written 16 | permission. 17 | -------------------------------------------------------------------------------------------------------- 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 20 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 21 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 22 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 23 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 24 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 25 | OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 26 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 27 | OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 28 | ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | -------------------------------------------------------------------------------------------------------- 30 | Notice of Export Control Law 31 | -------------------------------------------------------------------------------------------------------- 32 | TINIUX may be subject to applicable export control laws and regulations, which might 33 | include those applicable to TINIUX of U.S. and the country in which you are located. 34 | Import, export and usage of TINIUX in any manner by you shall be in compliance with such 35 | applicable export control laws and regulations. 36 | ***********************************************************************************************************/ 37 | 38 | #ifndef __OS_MUTEX_H_ 39 | #define __OS_MUTEX_H_ 40 | 41 | #include "OSType.h" 42 | 43 | #ifdef __cplusplus 44 | extern "C" { 45 | #endif 46 | 47 | #if ( OS_MUTEX_ON!=0 ) 48 | 49 | typedef struct tOSMutex 50 | { 51 | char pcMutexName[ OSNAME_MAX_LEN ]; 52 | sOS8_t * MutexHolderHandle; 53 | 54 | tOSList_t tTaskListEventMutexV; // Mutex Unlock TaskList; 55 | tOSList_t tTaskListEventMutexP; // Mutex Lock TaskList; 56 | 57 | volatile uOSBase_t uxCurNum; 58 | uOSBase_t uxMaxNum; 59 | 60 | uOSBase_t uxMutexLocked; // Mutex lock count 61 | 62 | volatile sOSBase_t xMutexPLock; // Record the number of task which lock from the mutex while it was locked. 63 | volatile sOSBase_t xMutexVLock; // Record the number of task which unlock to the mutex while it was locked. 64 | 65 | sOSBase_t xID; 66 | } tOSMutex_t; 67 | 68 | typedef tOSMutex_t* OSMutexHandle_t; 69 | 70 | OSMutexHandle_t OSMutexCreate( void ) TINIUX_FUNCTION; 71 | #if ( OS_MEMFREE_ON != 0 ) 72 | void OSMutexDelete( OSMutexHandle_t MutexHandle ) TINIUX_FUNCTION; 73 | #endif /* OS_MEMFREE_ON */ 74 | 75 | sOSBase_t OSMutexSetID(OSMutexHandle_t MutexHandle, sOSBase_t xID) TINIUX_FUNCTION; 76 | sOSBase_t OSMutexGetID(OSMutexHandle_t const MutexHandle) TINIUX_FUNCTION; 77 | 78 | uOSBool_t OSMutexLock( OSMutexHandle_t MutexHandle, uOSTick_t uxTicksToWait) TINIUX_FUNCTION; 79 | uOSBool_t OSMutexUnlock( OSMutexHandle_t MutexHandle) TINIUX_FUNCTION; 80 | 81 | #endif //( OS_MUTEX_ON!=0 ) 82 | 83 | #ifdef __cplusplus 84 | } 85 | #endif 86 | 87 | #endif //__OS_MUTEX_H_ 88 | -------------------------------------------------------------------------------- /CPU/ARM/KEIL/Cortex_M3/FitCPU.h: -------------------------------------------------------------------------------- 1 | /********************************************************************************************************** 2 | TINIUX - A tiny and efficient embedded real time operating system (RTOS) 3 | Copyright (C) SenseRate.com All rights reserved. 4 | http://www.tiniux.org -- Documentation, latest information, license and contact details. 5 | http://www.tiniux.com -- Commercial support, development, porting, licensing and training services. 6 | -------------------------------------------------------------------------------------------------------- 7 | Redistribution and use in source and binary forms, with or without modification, 8 | are permitted provided that the following conditions are met: 9 | 1. Redistributions of source code must retain the above copyright notice, this list of 10 | conditions and the following disclaimer. 11 | 2. Redistributions in binary form must reproduce the above copyright notice, this list 12 | of conditions and the following disclaimer in the documentation and/or other materials 13 | provided with the distribution. 14 | 3. Neither the name of the copyright holder nor the names of its contributors may be used 15 | to endorse or promote products derived from this software without specific prior written 16 | permission. 17 | -------------------------------------------------------------------------------------------------------- 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 20 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 21 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 22 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 23 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 24 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 25 | OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 26 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 27 | OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 28 | ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | -------------------------------------------------------------------------------------------------------- 30 | Notice of Export Control Law 31 | -------------------------------------------------------------------------------------------------------- 32 | TINIUX may be subject to applicable export control laws and regulations, which might 33 | include those applicable to TINIUX of U.S. and the country in which you are located. 34 | Import, export and usage of TINIUX in any manner by you shall be in compliance with such 35 | applicable export control laws and regulations. 36 | ***********************************************************************************************************/ 37 | 38 | #ifndef __FIT_CPU_H_ 39 | #define __FIT_CPU_H_ 40 | 41 | #include "OSType.h" 42 | 43 | #ifdef __cplusplus 44 | extern "C" { 45 | #endif 46 | 47 | #ifndef FIT_FORCE_INLINE 48 | #define FIT_FORCE_INLINE __forceinline 49 | #endif 50 | 51 | extern uOS32_t FitIntMask( void ); 52 | extern void FitIntUnmask( uOS32_t ulNewMask ); 53 | extern void FitIntLock( void ); 54 | extern void FitIntUnlock( void ); 55 | extern void FitSchedule( void ); 56 | extern uOS32_t FitGetIPSR( void ); 57 | 58 | #define FitNVIC_INT_CTRL_REG ( * ( ( volatile uOS32_t * ) 0xe000ed04 ) ) 59 | #define FitNVIC_PENDSVSET_BIT ( 1UL << 28UL ) 60 | 61 | /* Determine whether we are in thread mode or handler mode. */ 62 | #define FitIsInsideISR() ( ( uOSBool_t ) ( FitGetIPSR() != ( uOSBase_t )0 ) ) 63 | 64 | #define FitScheduleFromISR( b ) if( b ) FitSchedule() 65 | 66 | #define FitIntMaskFromISR() FitIntMask() 67 | #define FitIntUnmaskFromISR( x ) FitIntUnmask( x ) 68 | 69 | #if (OSHIGHEAST_PRIORITY<=32U) 70 | #define FITQUICK_GET_PRIORITY ( 1U ) 71 | #define FitGET_HIGHEST_PRIORITY( uxTopPriority, guxReadyPriorities ) uxTopPriority = ( 31 - __clz( ( guxReadyPriorities ) ) ) 72 | #endif 73 | 74 | uOSStack_t *FitInitializeStack( uOSStack_t *pxTopOfStack, OSTaskFunction_t TaskFunction, void *pvParameters ); 75 | uOSBase_t FitStartScheduler( void ); 76 | 77 | void FitPendSVHandler( void ); 78 | void FitOSTickISR( void ); 79 | void FitSVCHandler( void ); 80 | 81 | #if ( OS_LOWPOWER_ON!=0 ) 82 | /* Tickless idle/low power functionality. */ 83 | #ifndef FitLowPowerIdle 84 | extern void FitTicklessIdle( uOSTick_t uxLowPowerTicks ); 85 | #define FitLowPowerIdle( uxLowPowerTicks ) FitTicklessIdle( uxLowPowerTicks ) 86 | #endif 87 | #endif 88 | 89 | #ifdef __cplusplus 90 | } 91 | #endif 92 | 93 | #endif //__FIT_CPU_H_ 94 | -------------------------------------------------------------------------------- /CPU/ARM/IAR/Cortex_M3/FitCPU.h: -------------------------------------------------------------------------------- 1 | /********************************************************************************************************** 2 | TINIUX - A tiny and efficient embedded real time operating system (RTOS) 3 | Copyright (C) SenseRate.com All rights reserved. 4 | http://www.tiniux.org -- Documentation, latest information, license and contact details. 5 | http://www.tiniux.com -- Commercial support, development, porting, licensing and training services. 6 | -------------------------------------------------------------------------------------------------------- 7 | Redistribution and use in source and binary forms, with or without modification, 8 | are permitted provided that the following conditions are met: 9 | 1. Redistributions of source code must retain the above copyright notice, this list of 10 | conditions and the following disclaimer. 11 | 2. Redistributions in binary form must reproduce the above copyright notice, this list 12 | of conditions and the following disclaimer in the documentation and/or other materials 13 | provided with the distribution. 14 | 3. Neither the name of the copyright holder nor the names of its contributors may be used 15 | to endorse or promote products derived from this software without specific prior written 16 | permission. 17 | -------------------------------------------------------------------------------------------------------- 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 20 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 21 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 22 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 23 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 24 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 25 | OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 26 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 27 | OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 28 | ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | -------------------------------------------------------------------------------------------------------- 30 | Notice of Export Control Law 31 | -------------------------------------------------------------------------------------------------------- 32 | TINIUX may be subject to applicable export control laws and regulations, which might 33 | include those applicable to TINIUX of U.S. and the country in which you are located. 34 | Import, export and usage of TINIUX in any manner by you shall be in compliance with such 35 | applicable export control laws and regulations. 36 | ***********************************************************************************************************/ 37 | 38 | #ifndef __FIT_CPU_H_ 39 | #define __FIT_CPU_H_ 40 | 41 | #include "OSType.h" 42 | 43 | #ifdef __cplusplus 44 | extern "C" { 45 | #endif 46 | 47 | /* Scheduler utilities. */ 48 | extern void FitSchedule( void ); 49 | #define FitNVIC_INT_CTRL_REG ( * ( ( volatile uOS32_t * ) 0xe000ed04UL ) ) 50 | #define FitNVIC_PENDSVSET_BIT ( 1UL << 28UL ) 51 | #define FitScheduleFromISR( b ) if( b ) FitSchedule() 52 | /*-----------------------------------------------------------*/ 53 | 54 | #include 55 | #if (OSHIGHEAST_PRIORITY<=32U) 56 | #define FITQUICK_GET_PRIORITY ( 1U ) 57 | #define FitGET_HIGHEST_PRIORITY( uxTopPriority, uxReadyPriorities ) uxTopPriority = ( 31 - __CLZ( ( uxReadyPriorities ) ) ) 58 | #endif 59 | 60 | extern void FitIntLock( void ); 61 | extern void FitIntUnlock( void ); 62 | extern uOS32_t FitIntMask( void ); 63 | extern void FitIntUnmask( uOS32_t ulNewMask ); 64 | extern uOS32_t FitGetIPSR( void ); 65 | 66 | /*-----------------------------------------------------------*/ 67 | 68 | #define FitIntMaskFromISR() FitIntMask() 69 | #define FitIntUnmaskFromISR( x ) FitIntUnmask( x ) 70 | 71 | /* Determine whether we are in thread mode or handler mode. */ 72 | #define FitIsInsideISR() ( ( uOSBool_t ) ( FitGetIPSR() != ( uOSBase_t )0 ) ) 73 | 74 | uOSStack_t *FitInitializeStack( uOSStack_t *pxTopOfStack, OSTaskFunction_t TaskFunction, void *pvParameters ); 75 | sOSBase_t FitStartScheduler( void ); 76 | 77 | void FitPendSVHandler( void ); 78 | void FitOSTickISR( void ); 79 | void FitSVCHandler( void ); 80 | 81 | #if ( OS_LOWPOWER_ON!=0 ) 82 | /* Tickless idle/low power functionality. */ 83 | #ifndef FitLowPowerIdle 84 | extern void FitTicklessIdle( uOSTick_t uxLowPowerTicks ); 85 | #define FitLowPowerIdle( uxLowPowerTicks ) FitTicklessIdle( uxLowPowerTicks ) 86 | #endif 87 | #endif 88 | 89 | #ifdef __cplusplus 90 | } 91 | #endif 92 | 93 | #endif //__FIT_CPU_H_ 94 | -------------------------------------------------------------------------------- /CPU/MCS51/SDCC/8052/FitCPU.h: -------------------------------------------------------------------------------- 1 | /********************************************************************************************************** 2 | TINIUX - A tiny and efficient embedded real time operating system (RTOS) 3 | Copyright (C) SenseRate.com All rights reserved. 4 | http://www.tiniux.org -- Documentation, latest information, license and contact details. 5 | http://www.tiniux.com -- Commercial support, development, porting, licensing and training services. 6 | -------------------------------------------------------------------------------------------------------- 7 | Redistribution and use in source and binary forms, with or without modification, 8 | are permitted provided that the following conditions are met: 9 | 1. Redistributions of source code must retain the above copyright notice, this list of 10 | conditions and the following disclaimer. 11 | 2. Redistributions in binary form must reproduce the above copyright notice, this list 12 | of conditions and the following disclaimer in the documentation and/or other materials 13 | provided with the distribution. 14 | 3. Neither the name of the copyright holder nor the names of its contributors may be used 15 | to endorse or promote products derived from this software without specific prior written 16 | permission. 17 | -------------------------------------------------------------------------------------------------------- 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 20 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 21 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 22 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 23 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 24 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 25 | OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 26 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 27 | OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 28 | ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | -------------------------------------------------------------------------------------------------------- 30 | Notice of Export Control Law 31 | -------------------------------------------------------------------------------------------------------- 32 | TINIUX may be subject to applicable export control laws and regulations, which might 33 | include those applicable to TINIUX of U.S. and the country in which you are located. 34 | Import, export and usage of TINIUX in any manner by you shall be in compliance with such 35 | applicable export control laws and regulations. 36 | ***********************************************************************************************************/ 37 | 38 | #ifndef __FIT_CPU_H_ 39 | #define __FIT_CPU_H_ 40 | 41 | #include "FitType.h" 42 | 43 | #ifdef __cplusplus 44 | extern "C" { 45 | #endif 46 | 47 | 48 | /*-----------------------------------------------------------*/ 49 | 50 | /* Critical section management. */ 51 | 52 | #define FitIntLock() __asm \ 53 | push ACC \ 54 | push IE \ 55 | __endasm; \ 56 | EA = 0; 57 | 58 | #define FitIntUnlock() __asm \ 59 | pop ACC \ 60 | __endasm; \ 61 | ACC &= 0x80; \ 62 | IE |= ACC; \ 63 | __asm \ 64 | pop ACC \ 65 | __endasm; 66 | 67 | #define FitIntMask() EA = 0; 68 | #define FitIntUnmask() EA = 1; 69 | 70 | #define FitIntMaskFromISR() EA = 0; 71 | #define FitIntUnmaskFromISR( x ) EA = 1; ( void ) x; 72 | 73 | #define FitIsInsideISR() 0; 74 | 75 | /*-----------------------------------------------------------*/ 76 | 77 | /* Task utilities. */ 78 | void FitSchedule( void ) __naked; 79 | #define FitScheduleFromISR( b ) if( b ) FitSchedule() 80 | /*-----------------------------------------------------------*/ 81 | 82 | #define FitNOP() __asm \ 83 | nop \ 84 | __endasm; 85 | 86 | /*-----------------------------------------------------------*/ 87 | 88 | uOSStack_t *FitInitializeStack( uOSStack_t *pxTopOfStack, OSTaskFunction_t TaskFunction, void *pvParameters ); 89 | sOSBase_t FitStartScheduler( void ); 90 | void FitOSTickISR( void ) __interrupt 5 __naked; 91 | 92 | #ifdef __cplusplus 93 | } 94 | #endif 95 | 96 | #endif //__FIT_CPU_H_ 97 | -------------------------------------------------------------------------------- /CPU/MCS51/SDCC/8051/FitCPU.h: -------------------------------------------------------------------------------- 1 | /********************************************************************************************************** 2 | TINIUX - A tiny and efficient embedded real time operating system (RTOS) 3 | Copyright (C) SenseRate.com All rights reserved. 4 | http://www.tiniux.org -- Documentation, latest information, license and contact details. 5 | http://www.tiniux.com -- Commercial support, development, porting, licensing and training services. 6 | -------------------------------------------------------------------------------------------------------- 7 | Redistribution and use in source and binary forms, with or without modification, 8 | are permitted provided that the following conditions are met: 9 | 1. Redistributions of source code must retain the above copyright notice, this list of 10 | conditions and the following disclaimer. 11 | 2. Redistributions in binary form must reproduce the above copyright notice, this list 12 | of conditions and the following disclaimer in the documentation and/or other materials 13 | provided with the distribution. 14 | 3. Neither the name of the copyright holder nor the names of its contributors may be used 15 | to endorse or promote products derived from this software without specific prior written 16 | permission. 17 | -------------------------------------------------------------------------------------------------------- 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 20 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 21 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 22 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 23 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 24 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 25 | OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 26 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 27 | OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 28 | ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | -------------------------------------------------------------------------------------------------------- 30 | Notice of Export Control Law 31 | -------------------------------------------------------------------------------------------------------- 32 | TINIUX may be subject to applicable export control laws and regulations, which might 33 | include those applicable to TINIUX of U.S. and the country in which you are located. 34 | Import, export and usage of TINIUX in any manner by you shall be in compliance with such 35 | applicable export control laws and regulations. 36 | ***********************************************************************************************************/ 37 | 38 | #ifndef __FIT_CPU_H_ 39 | #define __FIT_CPU_H_ 40 | 41 | #include "FitType.h" 42 | 43 | #ifdef __cplusplus 44 | extern "C" { 45 | #endif 46 | 47 | 48 | /*-----------------------------------------------------------*/ 49 | 50 | /* Critical section management. */ 51 | 52 | #define FitIntLock() __asm \ 53 | push ACC \ 54 | push IE \ 55 | __endasm; \ 56 | EA = 0; 57 | 58 | #define FitIntUnlock() __asm \ 59 | pop ACC \ 60 | __endasm; \ 61 | ACC &= 0x80; \ 62 | IE |= ACC; \ 63 | __asm \ 64 | pop ACC \ 65 | __endasm; 66 | 67 | #define FitIntMask() EA = 0; 68 | #define FitIntUnmask() EA = 1; 69 | 70 | #define FitIntMaskFromISR() EA = 0; 71 | #define FitIntUnmaskFromISR( x ) EA = 1; ( void ) x; 72 | 73 | #define FitIsInsideISR() 0; 74 | 75 | /*-----------------------------------------------------------*/ 76 | 77 | /* Task utilities. */ 78 | void FitSchedule( void ) __naked; 79 | #define FitScheduleFromISR( b ) if( b ) FitSchedule() 80 | /*-----------------------------------------------------------*/ 81 | 82 | #define FitNOP() __asm \ 83 | nop \ 84 | __endasm; 85 | 86 | /*-----------------------------------------------------------*/ 87 | 88 | uOSStack_t *FitInitializeStack( uOSStack_t *pxTopOfStack, OSTaskFunction_t TaskFunction, void *pvParameters ); 89 | sOSBase_t FitStartScheduler( void ); 90 | void FitOSTickISR( void ) __interrupt 1 __naked; 91 | 92 | #ifdef __cplusplus 93 | } 94 | #endif 95 | 96 | #endif //__FIT_CPU_H_ 97 | -------------------------------------------------------------------------------- /Preset/MCS51/8052/OSPreset.h: -------------------------------------------------------------------------------- 1 | /********************************************************************************************************** 2 | TINIUX - A tiny and efficient embedded real time operating system (RTOS) 3 | Copyright (C) SenseRate.com All rights reserved. 4 | http://www.tiniux.org -- Documentation, latest information, license and contact details. 5 | http://www.tiniux.com -- Commercial support, development, porting, licensing and training services. 6 | -------------------------------------------------------------------------------------------------------- 7 | Redistribution and use in source and binary forms, with or without modification, 8 | are permitted provided that the following conditions are met: 9 | 1. Redistributions of source code must retain the above copyright notice, this list of 10 | conditions and the following disclaimer. 11 | 2. Redistributions in binary form must reproduce the above copyright notice, this list 12 | of conditions and the following disclaimer in the documentation and/or other materials 13 | provided with the distribution. 14 | 3. Neither the name of the copyright holder nor the names of its contributors may be used 15 | to endorse or promote products derived from this software without specific prior written 16 | permission. 17 | -------------------------------------------------------------------------------------------------------- 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 20 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 21 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 22 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 23 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 24 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 25 | OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 26 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 27 | OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 28 | ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | -------------------------------------------------------------------------------------------------------- 30 | Notice of Export Control Law 31 | -------------------------------------------------------------------------------------------------------- 32 | TINIUX may be subject to applicable export control laws and regulations, which might 33 | include those applicable to TINIUX of U.S. and the country in which you are located. 34 | Import, export and usage of TINIUX in any manner by you shall be in compliance with such 35 | applicable export control laws and regulations. 36 | ***********************************************************************************************************/ 37 | 38 | // !!!注:应用程序可以根据需要调整Tiniux系统API接口函数及相关功能模块的开关 !!! 39 | 40 | #ifndef __OS_PRESET_H_ 41 | #define __OS_PRESET_H_ 42 | 43 | #include 44 | /*----------------------------------------------------------- 45 | * Application specific definitions. 46 | * 47 | * These definitions should be adjusted for your particular hardware and 48 | * application requirements. 49 | * 50 | *----------------------------------------------------------*/ 51 | 52 | #define SETOS_CPU_CLOCK_HZ ( ( unsigned long ) 98000000 ) //定义CPU运行主频 (如72000000) 53 | #define SETOS_TICK_RATE_HZ ( 1000 ) //定义TINIUX系统中ticks频率 54 | 55 | #define SETOS_MINIMAL_STACK_SIZE ( ( unsigned short ) 100 ) //任务运行时的Stack空间,51架构下系统中所有任务运行时均使用此大小的stack空间 56 | #define SETOS_TOTAL_HEAP_SIZE ( 1024*2 ) //定义系统占用的Heap空间 57 | #define SETOS_ENABLE_MEMFREE ( 0 ) //是否允许释放内存,允许后可以在系统运行时删除Task MsgQ Semaphone Mutex Timer等 58 | #define SETOS_LOWPOWER_MODE ( 0 ) //是否开启低功耗模式 59 | #define SETOS_MAX_NAME_LEN ( 8 ) //定义任务、信号量、消息队列等变量中的名称长度 60 | #define SETOS_MAX_PRIORITIES ( 4 ) //定义任务最大优先级 61 | #define SETOS_TASK_SIGNAL_ON ( 1 ) //是否启动轻量级的任务同步信号,功能类似Semaphore MsgQ,内存占用要小于Semaphore MsgQ 62 | #define SETOS_USE_SEMAPHORE ( 0 ) //是否启用系统信号量功能 0关闭 1启用 63 | #define SETOS_USE_MUTEX ( 0 ) //是否启用互斥信号量功能 0关闭 1启用 64 | #define SETOS_USE_MSGQ ( 0 ) //是否启用系统消息队列功能 0关闭 1启用 65 | #define SETOS_MSGQ_MAX_MSGNUM ( 5 ) //定义消息队列中消息的门限值 66 | #define SETOS_USE_TIMER ( 0 ) //是否使用系统软件定时器 67 | #define SETOS_USE_QUICK_SCHEDULE ( 1 ) //是否启动快速调度算法 68 | #define SETOS_TIME_SLICE_ON ( 1 ) //是否启用时间片轮转(time slice)调度机制 69 | #define SETOS_PEND_FOREVER_VALUE ( 0xFFFFU ) //定义信号量及消息队列中永久等待的数值 70 | 71 | #endif /* __OS_PRESET_H_ */ 72 | 73 | -------------------------------------------------------------------------------- /Preset/MCS51/8051/OSPreset.h: -------------------------------------------------------------------------------- 1 | /********************************************************************************************************** 2 | TINIUX - A tiny and efficient embedded real time operating system (RTOS) 3 | Copyright (C) SenseRate.com All rights reserved. 4 | http://www.tiniux.org -- Documentation, latest information, license and contact details. 5 | http://www.tiniux.com -- Commercial support, development, porting, licensing and training services. 6 | -------------------------------------------------------------------------------------------------------- 7 | Redistribution and use in source and binary forms, with or without modification, 8 | are permitted provided that the following conditions are met: 9 | 1. Redistributions of source code must retain the above copyright notice, this list of 10 | conditions and the following disclaimer. 11 | 2. Redistributions in binary form must reproduce the above copyright notice, this list 12 | of conditions and the following disclaimer in the documentation and/or other materials 13 | provided with the distribution. 14 | 3. Neither the name of the copyright holder nor the names of its contributors may be used 15 | to endorse or promote products derived from this software without specific prior written 16 | permission. 17 | -------------------------------------------------------------------------------------------------------- 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 20 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 21 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 22 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 23 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 24 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 25 | OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 26 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 27 | OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 28 | ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | -------------------------------------------------------------------------------------------------------- 30 | Notice of Export Control Law 31 | -------------------------------------------------------------------------------------------------------- 32 | TINIUX may be subject to applicable export control laws and regulations, which might 33 | include those applicable to TINIUX of U.S. and the country in which you are located. 34 | Import, export and usage of TINIUX in any manner by you shall be in compliance with such 35 | applicable export control laws and regulations. 36 | ***********************************************************************************************************/ 37 | 38 | // !!!注:应用程序可以根据需要调整Tiniux系统API接口函数及相关功能模块的开关 !!! 39 | 40 | #ifndef __OS_PRESET_H_ 41 | #define __OS_PRESET_H_ 42 | 43 | #include 44 | /*----------------------------------------------------------- 45 | * Application specific definitions. 46 | * 47 | * These definitions should be adjusted for your particular hardware and 48 | * application requirements. 49 | * 50 | *----------------------------------------------------------*/ 51 | 52 | #define SETOS_CPU_CLOCK_HZ ( ( unsigned long ) 24000000 ) //定义CPU运行主频 (如72000000) 53 | #define SETOS_TICK_RATE_HZ ( 1000 ) //定义TINIUX系统中ticks频率 54 | 55 | #define SETOS_MINIMAL_STACK_SIZE ( ( unsigned short ) 100 ) //任务运行时的Stack空间,51架构下系统中所有任务运行时均使用此大小的stack空间 56 | #define SETOS_TOTAL_HEAP_SIZE ( 1024*2 ) //定义系统占用的Heap空间 57 | #define SETOS_ENABLE_MEMFREE ( 0 ) //是否允许释放内存,允许后可以在系统运行时删除Task MsgQ Semaphone Mutex Timer等 58 | #define SETOS_LOWPOWER_MODE ( 0 ) //是否开启低功耗模式 59 | #define SETOS_MAX_NAME_LEN ( 8 ) //定义任务、信号量、消息队列等变量中的名称长度 60 | #define SETOS_MAX_PRIORITIES ( 4 ) //定义任务最大优先级 61 | #define SETOS_TASK_SIGNAL_ON ( 1 ) //是否启动轻量级的任务同步信号,功能类似Semaphore MsgQ,内存占用要小于Semaphore MsgQ 62 | #define SETOS_USE_SEMAPHORE ( 0 ) //是否启用系统信号量功能 0关闭 1启用 63 | #define SETOS_USE_MUTEX ( 0 ) //是否启用互斥信号量功能 0关闭 1启用 64 | #define SETOS_USE_MSGQ ( 0 ) //是否启用系统消息队列功能 0关闭 1启用 65 | #define SETOS_MSGQ_MAX_MSGNUM ( 5 ) //定义消息队列中消息的门限值 66 | #define SETOS_USE_TIMER ( 0 ) //是否使用系统软件定时器 67 | #define SETOS_USE_QUICK_SCHEDULE ( 0 ) //是否启动快速调度算法 68 | #define SETOS_TIME_SLICE_ON ( 1 ) //是否启用时间片轮转(time slice)调度机制 69 | #define SETOS_PEND_FOREVER_VALUE ( 0xFFFFU ) //定义信号量及消息队列中永久等待的数值 70 | 71 | #endif /* __OS_PRESET_H_ */ 72 | 73 | -------------------------------------------------------------------------------- /Kernel/OSSem.h: -------------------------------------------------------------------------------- 1 | /********************************************************************************************************** 2 | TINIUX - A tiny and efficient embedded real time operating system (RTOS) 3 | Copyright (C) SenseRate.com All rights reserved. 4 | http://www.tiniux.org -- Documentation, latest information, license and contact details. 5 | http://www.tiniux.com -- Commercial support, development, porting, licensing and training services. 6 | -------------------------------------------------------------------------------------------------------- 7 | Redistribution and use in source and binary forms, with or without modification, 8 | are permitted provided that the following conditions are met: 9 | 1. Redistributions of source code must retain the above copyright notice, this list of 10 | conditions and the following disclaimer. 11 | 2. Redistributions in binary form must reproduce the above copyright notice, this list 12 | of conditions and the following disclaimer in the documentation and/or other materials 13 | provided with the distribution. 14 | 3. Neither the name of the copyright holder nor the names of its contributors may be used 15 | to endorse or promote products derived from this software without specific prior written 16 | permission. 17 | -------------------------------------------------------------------------------------------------------- 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 20 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 21 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 22 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 23 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 24 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 25 | OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 26 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 27 | OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 28 | ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | -------------------------------------------------------------------------------------------------------- 30 | Notice of Export Control Law 31 | -------------------------------------------------------------------------------------------------------- 32 | TINIUX may be subject to applicable export control laws and regulations, which might 33 | include those applicable to TINIUX of U.S. and the country in which you are located. 34 | Import, export and usage of TINIUX in any manner by you shall be in compliance with such 35 | applicable export control laws and regulations. 36 | ***********************************************************************************************************/ 37 | 38 | #ifndef __OS_SEMAPHORE_H_ 39 | #define __OS_SEMAPHORE_H_ 40 | 41 | #include "OSType.h" 42 | 43 | #ifdef __cplusplus 44 | extern "C" { 45 | #endif 46 | 47 | #if ( OS_SEMAPHORE_ON!=0 ) 48 | 49 | // 参考链接:https://blog.csdn.net/sinat_25771299/article/details/50761593 50 | // Post 发送信号量,信号量+1 51 | // Pend 请求信号量,信号量-1,若减一之前信号量为0,则堵塞 52 | typedef struct tOSSem 53 | { 54 | // 信号量的名字 55 | char pcSemName[ OSNAME_MAX_LEN ]; 56 | // 正在使用信号量的任务链表 57 | tOSList_t tTaskListEventSemV; //Semaphore Post TaskList; 58 | // 等待使用信号量的任务链表(堵塞) 59 | tOSList_t tTaskListEventSemP; //Semaphore Pend TaskList; 60 | // 当前信号量的值 61 | volatile uOSBase_t uxCurNum; 62 | // 信号量最大数值 63 | uOSBase_t uxMaxNum; 64 | 65 | volatile sOSBase_t xSemPLock; // Record the number of task which pend from the semaphore while it was locked. 66 | volatile sOSBase_t xSemVLock; // Record the number of task which post to the semaphore while it was locked. 67 | 68 | sOSBase_t xID; 69 | } tOSSem_t; 70 | 71 | typedef tOSSem_t* OSSemHandle_t; 72 | // 若uxInitialCount==0,该信号量为互斥信号量; 73 | // 若uxInitialCount>1,该信号量为普通信号量。 74 | OSSemHandle_t OSSemCreate( const uOSBase_t uxInitialCount ) TINIUX_FUNCTION; 75 | OSSemHandle_t OSSemCreateCount( const uOSBase_t uxMaxNum, const uOSBase_t uxInitialCount ) TINIUX_FUNCTION; 76 | 77 | #if ( OS_MEMFREE_ON != 0 ) 78 | void OSSemDelete(OSSemHandle_t SemHandle) TINIUX_FUNCTION; 79 | #endif /* OS_MEMFREE_ON */ 80 | 81 | sOSBase_t OSSemSetID(OSSemHandle_t SemHandle, sOSBase_t xID) TINIUX_FUNCTION; 82 | sOSBase_t OSSemGetID(OSSemHandle_t const SemHandle) TINIUX_FUNCTION; 83 | 84 | uOSBool_t OSSemPend( OSSemHandle_t SemHandle, uOSTick_t uxTicksToWait) TINIUX_FUNCTION; 85 | 86 | uOSBool_t OSSemPost( OSSemHandle_t SemHandle) TINIUX_FUNCTION; 87 | uOSBool_t OSSemPostFromISR( OSSemHandle_t SemHandle ) TINIUX_FUNCTION; 88 | 89 | #endif //(OS_SEMAPHORE_ON!=0) 90 | 91 | #ifdef __cplusplus 92 | } 93 | #endif 94 | 95 | #endif //__OS_SEMAPHORE_H_ 96 | -------------------------------------------------------------------------------- /Kernel/OSMemory.h: -------------------------------------------------------------------------------- 1 | /********************************************************************************************************** 2 | TINIUX - A tiny and efficient embedded real time operating system (RTOS) 3 | Copyright (C) SenseRate.com All rights reserved. 4 | http://www.tiniux.org -- Documentation, latest information, license and contact details. 5 | http://www.tiniux.com -- Commercial support, development, porting, licensing and training services. 6 | -------------------------------------------------------------------------------------------------------- 7 | Redistribution and use in source and binary forms, with or without modification, 8 | are permitted provided that the following conditions are met: 9 | 1. Redistributions of source code must retain the above copyright notice, this list of 10 | conditions and the following disclaimer. 11 | 2. Redistributions in binary form must reproduce the above copyright notice, this list 12 | of conditions and the following disclaimer in the documentation and/or other materials 13 | provided with the distribution. 14 | 3. Neither the name of the copyright holder nor the names of its contributors may be used 15 | to endorse or promote products derived from this software without specific prior written 16 | permission. 17 | -------------------------------------------------------------------------------------------------------- 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 20 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 21 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 22 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 23 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 24 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 25 | OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 26 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 27 | OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 28 | ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | -------------------------------------------------------------------------------------------------------- 30 | Notice of Export Control Law 31 | -------------------------------------------------------------------------------------------------------- 32 | TINIUX may be subject to applicable export control laws and regulations, which might 33 | include those applicable to TINIUX of U.S. and the country in which you are located. 34 | Import, export and usage of TINIUX in any manner by you shall be in compliance with such 35 | applicable export control laws and regulations. 36 | ***********************************************************************************************************/ 37 | 38 | #ifndef __OS_MEMORY_H_ 39 | #define __OS_MEMORY_H_ 40 | 41 | #include "OSType.h" 42 | 43 | #ifdef __cplusplus 44 | extern "C" { 45 | #endif 46 | 47 | #define OSMEM_SIZE OSTOTAL_HEAP_SIZE 48 | 49 | /** OSMEM_SIZE would have to be aligned, but using 64000 here instead of 50 | * 65535 leaves some room for alignment. */ 51 | //因为内存管理自身的相关操作也需要占用内存,这句话读起来好像有点拗口啊。 52 | //在内存管理时,我们为内存块设置了若干个信息记录表(表的数量与内存块的 53 | //数量是一一对应的),信息记录表用于记录该内存块的使用情况,例如该内存块 54 | //的前一个相邻内存块位置,后一个相邻内存块位置,以及该内存块是否已经被 55 | //分配使用等等。冗余的1535个位置即为内存块记录信息使用,若系统中分配的 56 | //内存块较多,则会占用的较多,一般情况下,1535的大小足够内存信息记录表使用了。 57 | 58 | #if OSMEM_SIZE > 64000L 59 | typedef uOS32_t uOSMemSize_t; 60 | #else 61 | typedef uOS16_t uOSMemSize_t; 62 | #endif /* OSMEM_SIZE > 64000 */ 63 | 64 | uOSBase_t OSMemInit(void); 65 | void *OSMemMalloc(uOSMemSize_t size); 66 | void *OSMemCalloc(uOSMemSize_t count, uOSMemSize_t size); 67 | 68 | //OS_MEMFREE_ON 是否允许系统释放内存 69 | #if ( OS_MEMFREE_ON != 0 ) 70 | void *OSMemTrim(void *pMem, uOSMemSize_t size); 71 | void OSMemFree(void *pMem); 72 | #endif /* OS_MEMFREE_ON */ 73 | 74 | 75 | /** Calculate memory size for an aligned buffer - returns the next highest 76 | * multiple of OSMEM_ALIGNMENT (e.g. OSMEM_ALIGN_SIZE(3) and 77 | * OSMEM_ALIGN_SIZE(4) will both yield 4 for OSMEM_ALIGNMENT == 4). */ 78 | 79 | //详见链接:https://blog.csdn.net/itworld123/article/details/83902675 80 | #ifndef OSMEM_ALIGN_SIZE 81 | #define OSMEM_ALIGN_SIZE(size) (((size) + OSMEM_ALIGNMENT - 1) & ~(OSMEM_ALIGNMENT-1)) 82 | #endif 83 | 84 | /** Calculate safe memory size for an aligned buffer when using an unaligned 85 | * type as storage. This includes a safety-margin on (OSMEM_ALIGNMENT - 1) at the 86 | * start (e.g. if buffer is UINT16[] and actual data will be UINT32*) */ 87 | #ifndef OSMEM_ALIGN_BUFFER 88 | #define OSMEM_ALIGN_BUFFER(size) (((size) + OSMEM_ALIGNMENT - 1)) 89 | #endif 90 | 91 | /** Align a memory pointer to the alignment defined by OSMEM_ALIGNMENT 92 | * so that ADDR % OSMEM_ALIGNMENT == 0 */ 93 | 94 | //对齐内存地址 95 | #ifndef OSMEM_ALIGN_ADDR 96 | #define OSMEM_ALIGN_ADDR(addr) ((void *)(((uOS32_t)(addr) + OSMEM_ALIGNMENT - 1) & ~(uOS32_t)(OSMEM_ALIGNMENT-1))) 97 | #endif 98 | 99 | #ifdef __cplusplus 100 | } 101 | #endif 102 | 103 | #endif //__OS_MEMORY_H_ 104 | -------------------------------------------------------------------------------- /Kernel/OSSchedule.h: -------------------------------------------------------------------------------- 1 | /********************************************************************************************************** 2 | TINIUX - A tiny and efficient embedded real time operating system (RTOS) 3 | Copyright (C) SenseRate.com All rights reserved. 4 | http://www.tiniux.org -- Documentation, latest information, license and contact details. 5 | http://www.tiniux.com -- Commercial support, development, porting, licensing and training services. 6 | -------------------------------------------------------------------------------------------------------- 7 | Redistribution and use in source and binary forms, with or without modification, 8 | are permitted provided that the following conditions are met: 9 | 1. Redistributions of source code must retain the above copyright notice, this list of 10 | conditions and the following disclaimer. 11 | 2. Redistributions in binary form must reproduce the above copyright notice, this list 12 | of conditions and the following disclaimer in the documentation and/or other materials 13 | provided with the distribution. 14 | 3. Neither the name of the copyright holder nor the names of its contributors may be used 15 | to endorse or promote products derived from this software without specific prior written 16 | permission. 17 | -------------------------------------------------------------------------------------------------------- 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 20 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 21 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 22 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 23 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 24 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 25 | OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 26 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 27 | OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 28 | ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | -------------------------------------------------------------------------------------------------------- 30 | Notice of Export Control Law 31 | -------------------------------------------------------------------------------------------------------- 32 | TINIUX may be subject to applicable export control laws and regulations, which might 33 | include those applicable to TINIUX of U.S. and the country in which you are located. 34 | Import, export and usage of TINIUX in any manner by you shall be in compliance with such 35 | applicable export control laws and regulations. 36 | ***********************************************************************************************************/ 37 | 38 | #ifndef __OS_SCHEDULE_H_ 39 | #define __OS_SCHEDULE_H_ 40 | 41 | #include "OSType.h" 42 | 43 | #ifdef __cplusplus 44 | extern "C" { 45 | #endif 46 | 47 | #define SCHEDULER_LOCKED ( ( sOSBase_t ) 0 ) 48 | #define SCHEDULER_NOT_STARTED ( ( sOSBase_t ) 1 ) 49 | #define SCHEDULER_RUNNING ( ( sOSBase_t ) 2 ) 50 | 51 | #define OSIntLock() FitIntLock() 52 | #define OSIntUnlock() FitIntUnlock() 53 | 54 | #define OSIntMaskFromISR() FitIntMaskFromISR() 55 | #define OSIntUnmaskFromISR( x ) FitIntUnmaskFromISR( x ) 56 | 57 | #define OSIntMask() FitIntMask() 58 | #define OSIntUnmask( x ) FitIntUnmask( x ) 59 | 60 | #define OSSchedule() FitSchedule() 61 | #define OSScheduleFromISR( b ) FitScheduleFromISR( b ) 62 | 63 | #define OSIsInsideISR() FitIsInsideISR() 64 | 65 | uOSBase_t OSInit( void ) TINIUX_FUNCTION; 66 | uOSBase_t OSStart( void ) TINIUX_FUNCTION; 67 | 68 | uOSBase_t OSScheduleInit( void ) TINIUX_FUNCTION; 69 | void OSScheduleLock( void ) TINIUX_FUNCTION; 70 | uOSBool_t OSScheduleUnlock( void ) TINIUX_FUNCTION; 71 | uOSBool_t OSScheduleIsLocked( void ) TINIUX_FUNCTION; 72 | 73 | sOSBase_t OSScheduleGetState( void ) TINIUX_FUNCTION; 74 | void OSNeedSchedule( void ) TINIUX_FUNCTION; 75 | 76 | uOSBool_t OSIncrementTickCount( void ) TINIUX_FUNCTION; 77 | uOSTick_t OSGetTickCount( void ) TINIUX_FUNCTION; 78 | uOSTick_t OSGetTickCountFromISR( void ) TINIUX_FUNCTION; 79 | 80 | void OSSetTimeOutState( tOSTimeOut_t * const ptTimeOut ) TINIUX_FUNCTION; 81 | uOSBool_t OSGetTimeOutState( tOSTimeOut_t * const ptTimeOut, uOSTick_t * const puxTicksToWait ) TINIUX_FUNCTION; 82 | 83 | 84 | #if ( OS_LOWPOWER_ON!=0 ) 85 | void OSFixTickCount( const uOSTick_t uxTicksToFix ) TINIUX_FUNCTION; 86 | uOSBool_t OSEnableLowPowerIdle( void ) TINIUX_FUNCTION; 87 | uOSTick_t OSGetBlockTickCount( void ) TINIUX_FUNCTION; 88 | #endif //OS_LOWPOWER_ON 89 | void OSUpdateUnblockTime( void ) TINIUX_FUNCTION; 90 | 91 | void OSSetReadyPriority(uOSBase_t uxPriority) TINIUX_FUNCTION; 92 | void OSResetReadyPriority(uOSBase_t uxPriority) TINIUX_FUNCTION; 93 | uOSBase_t OSGetTopReadyPriority( void ) TINIUX_FUNCTION; 94 | 95 | #ifdef __cplusplus 96 | } 97 | #endif 98 | 99 | #endif //__OS_SCHEDULE_H_ 100 | -------------------------------------------------------------------------------- /CPU/ARM/GCC/Cortex_M3/FitCPU.h: -------------------------------------------------------------------------------- 1 | /********************************************************************************************************** 2 | TINIUX - A tiny and efficient embedded real time operating system (RTOS) 3 | Copyright (C) SenseRate.com All rights reserved. 4 | http://www.tiniux.org -- Documentation, latest information, license and contact details. 5 | http://www.tiniux.com -- Commercial support, development, porting, licensing and training services. 6 | -------------------------------------------------------------------------------------------------------- 7 | Redistribution and use in source and binary forms, with or without modification, 8 | are permitted provided that the following conditions are met: 9 | 1. Redistributions of source code must retain the above copyright notice, this list of 10 | conditions and the following disclaimer. 11 | 2. Redistributions in binary form must reproduce the above copyright notice, this list 12 | of conditions and the following disclaimer in the documentation and/or other materials 13 | provided with the distribution. 14 | 3. Neither the name of the copyright holder nor the names of its contributors may be used 15 | to endorse or promote products derived from this software without specific prior written 16 | permission. 17 | -------------------------------------------------------------------------------------------------------- 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 20 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 21 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 22 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 23 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 24 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 25 | OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 26 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 27 | OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 28 | ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | -------------------------------------------------------------------------------------------------------- 30 | Notice of Export Control Law 31 | -------------------------------------------------------------------------------------------------------- 32 | TINIUX may be subject to applicable export control laws and regulations, which might 33 | include those applicable to TINIUX of U.S. and the country in which you are located. 34 | Import, export and usage of TINIUX in any manner by you shall be in compliance with such 35 | applicable export control laws and regulations. 36 | ***********************************************************************************************************/ 37 | 38 | #ifndef __FIT_CPU_H_ 39 | #define __FIT_CPU_H_ 40 | 41 | #include "OSType.h" 42 | 43 | #ifdef __cplusplus 44 | extern "C" { 45 | #endif 46 | 47 | extern uOS32_t FitIntMask( void ); 48 | extern void FitIntUnmask( uOS32_t ulNewMask ); 49 | extern void FitIntLock( void ); 50 | extern void FitIntUnlock( void ); 51 | extern void FitSchedule( void ); 52 | 53 | #ifndef FIT_FORCE_INLINE 54 | #define FIT_FORCE_INLINE inline __attribute__(( always_inline)) 55 | #endif 56 | 57 | FIT_FORCE_INLINE uOS32_t FitGetIPSR( void ) 58 | { 59 | uOS32_t ulCurrentInterrupt; 60 | 61 | /* Obtain the number of the currently executing interrupt. */ 62 | __asm volatile 63 | ( 64 | "mrs %0, ipsr" : "=r"( ulCurrentInterrupt ) 65 | ); 66 | 67 | return ulCurrentInterrupt; 68 | } 69 | 70 | /* Determine whether we are in thread mode or handler mode. */ 71 | #define FitIsInsideISR() ( ( uOSBool_t ) ( FitGetIPSR() != ( uOSBase_t )0 ) ) 72 | 73 | #define FitNVIC_INT_CTRL_REG ( * ( ( volatile uOS32_t * ) 0xe000ed04 ) ) 74 | #define FitNVIC_PENDSVSET_BIT ( 1UL << 28UL ) 75 | #define FitScheduleFromISR( b ) if( b ) FitSchedule() 76 | 77 | /* Generic helper function. */ 78 | static FIT_FORCE_INLINE uOS8_t ucFitCountLeadingZeros( uint32_t ulBitmap ) 79 | { 80 | uOS8_t ucReturn; 81 | 82 | __asm volatile ( "clz %0, %1" : "=r" ( ucReturn ) : "r" ( ulBitmap ) ); 83 | return ucReturn; 84 | } 85 | 86 | #if (OSHIGHEAST_PRIORITY<=32U) 87 | #define FITQUICK_GET_PRIORITY ( 1U ) 88 | #define FitGET_HIGHEST_PRIORITY( uxTopPriority, guxReadyPriorities ) uxTopPriority = ( 31 - ucFitCountLeadingZeros( ( guxReadyPriorities ) ) ) 89 | #endif 90 | 91 | #define FitIntMaskFromISR() FitIntMask() 92 | #define FitIntUnmaskFromISR( x ) FitIntUnmask( x ) 93 | 94 | uOSStack_t *FitInitializeStack( uOSStack_t *pxTopOfStack, OSTaskFunction_t TaskFunction, void *pvParameters ); 95 | uOSBase_t FitStartScheduler( void ); 96 | 97 | void FitPendSVHandler( void ) __attribute__ (( naked )); 98 | void FitOSTickISR( void ); 99 | void FitSVCHandler( void ) __attribute__ (( naked )); 100 | 101 | #if ( OS_LOWPOWER_ON!=0 ) 102 | /* Tickless idle/low power functionality. */ 103 | #ifndef FitLowPowerIdle 104 | extern void FitTicklessIdle( uOSTick_t uxLowPowerTicks ); 105 | #define FitLowPowerIdle( uxLowPowerTicks ) FitTicklessIdle( uxLowPowerTicks ) 106 | #endif 107 | #endif 108 | 109 | #ifdef __cplusplus 110 | } 111 | #endif 112 | 113 | #endif //__FIT_CPU_H_ 114 | -------------------------------------------------------------------------------- /CPU/ARM/IAR/Cortex_M3/FitAsm.s: -------------------------------------------------------------------------------- 1 | /********************************************************************************************************** 2 | TINIUX - A tiny and efficient embedded real time operating system (RTOS) 3 | Copyright (C) SenseRate.com All rights reserved. 4 | http://www.tiniux.org -- Documentation, latest information, license and contact details. 5 | http://www.tiniux.com -- Commercial support, development, porting, licensing and training services. 6 | -------------------------------------------------------------------------------------------------------- 7 | Redistribution and use in source and binary forms, with or without modification, 8 | are permitted provided that the following conditions are met: 9 | 1. Redistributions of source code must retain the above copyright notice, this list of 10 | conditions and the following disclaimer. 11 | 2. Redistributions in binary form must reproduce the above copyright notice, this list 12 | of conditions and the following disclaimer in the documentation and/or other materials 13 | provided with the distribution. 14 | 3. Neither the name of the copyright holder nor the names of its contributors may be used 15 | to endorse or promote products derived from this software without specific prior written 16 | permission. 17 | -------------------------------------------------------------------------------------------------------- 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 20 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 21 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 22 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 23 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 24 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 25 | OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 26 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 27 | OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 28 | ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | -------------------------------------------------------------------------------------------------------- 30 | Notice of Export Control Law 31 | -------------------------------------------------------------------------------------------------------- 32 | TINIUX may be subject to applicable export control laws and regulations, which might 33 | include those applicable to TINIUX of U.S. and the country in which you are located. 34 | Import, export and usage of TINIUX in any manner by you shall be in compliance with such 35 | applicable export control laws and regulations. 36 | ***********************************************************************************************************/ 37 | 38 | #include 39 | 40 | RSEG CODE:CODE(2) 41 | thumb 42 | 43 | EXTERN gptCurrentTCB 44 | EXTERN OSTaskSwitchContext 45 | 46 | PUBLIC FitPendSVHandler 47 | PUBLIC FitIntMask 48 | PUBLIC FitIntUnmask 49 | PUBLIC FitSVCHandler 50 | PUBLIC FitStartFirstTask 51 | PUBLIC FitGetIPSR 52 | 53 | 54 | /*-----------------------------------------------------------*/ 55 | 56 | FitPendSVHandler: 57 | mrs r0, psp 58 | isb 59 | ldr r3, =gptCurrentTCB /* Get the location of the current TCB. */ 60 | ldr r2, [r3] 61 | 62 | stmdb r0!, {r4-r11} /* Save the remaining registers. */ 63 | str r0, [r2] /* Save the new top of stack into the first member of the TCB. */ 64 | 65 | stmdb sp!, {r3, r14} 66 | mov r0, #OSMAX_HWINT_PRI 67 | msr basepri, r0 68 | dsb 69 | isb 70 | bl OSTaskSwitchContext 71 | mov r0, #0 72 | msr basepri, r0 73 | ldmia sp!, {r3, r14} 74 | 75 | ldr r1, [r3] 76 | ldr r0, [r1] /* The first item in gptCurrentTCB is the task top of stack. */ 77 | ldmia r0!, {r4-r11} /* Pop the registers. */ 78 | msr psp, r0 79 | isb 80 | bx r14 81 | 82 | /*-----------------------------------------------------------*/ 83 | 84 | FitIntMask: 85 | mrs r0, basepri 86 | mov r1, #OSMAX_HWINT_PRI 87 | msr basepri, r1 88 | bx r14 89 | 90 | /*-----------------------------------------------------------*/ 91 | 92 | FitIntUnmask: 93 | msr basepri, r0 94 | bx r14 95 | 96 | /*-----------------------------------------------------------*/ 97 | 98 | FitSVCHandler: 99 | /* Get the location of the current TCB. */ 100 | ldr r3, =gptCurrentTCB 101 | ldr r1, [r3] 102 | ldr r0, [r1] 103 | /* Pop the core registers. */ 104 | ldmia r0!, {r4-r11} 105 | msr psp, r0 106 | isb 107 | mov r0, #0 108 | msr basepri, r0 109 | orr r14, r14, #13 110 | bx r14 111 | 112 | /*-----------------------------------------------------------*/ 113 | 114 | FitStartFirstTask: 115 | /* Use the NVIC offset register to locate the stack. */ 116 | ldr r0, =0xE000ED08 117 | ldr r0, [r0] 118 | ldr r0, [r0] 119 | /* Set the msp back to the start of the stack. */ 120 | msr msp, r0 121 | /* Call SVC to start the first task, ensuring interrupts are enabled. */ 122 | cpsie i 123 | cpsie f 124 | dsb 125 | isb 126 | svc 0 127 | 128 | FitGetIPSR: 129 | /* Get IPSR value. */ 130 | mrs r0, IPSR 131 | bx r14 132 | 133 | END 134 | -------------------------------------------------------------------------------- /CPU/ARM/IAR/Cortex_M4/FitCPU.h: -------------------------------------------------------------------------------- 1 | /********************************************************************************************************** 2 | TINIUX - A tiny and efficient embedded real time operating system (RTOS) 3 | Copyright (C) SenseRate.com All rights reserved. 4 | http://www.tiniux.org -- Documentation, latest information, license and contact details. 5 | http://www.tiniux.com -- Commercial support, development, porting, licensing and training services. 6 | -------------------------------------------------------------------------------------------------------- 7 | Redistribution and use in source and binary forms, with or without modification, 8 | are permitted provided that the following conditions are met: 9 | 1. Redistributions of source code must retain the above copyright notice, this list of 10 | conditions and the following disclaimer. 11 | 2. Redistributions in binary form must reproduce the above copyright notice, this list 12 | of conditions and the following disclaimer in the documentation and/or other materials 13 | provided with the distribution. 14 | 3. Neither the name of the copyright holder nor the names of its contributors may be used 15 | to endorse or promote products derived from this software without specific prior written 16 | permission. 17 | -------------------------------------------------------------------------------------------------------- 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 20 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 21 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 22 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 23 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 24 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 25 | OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 26 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 27 | OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 28 | ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | -------------------------------------------------------------------------------------------------------- 30 | Notice of Export Control Law 31 | -------------------------------------------------------------------------------------------------------- 32 | TINIUX may be subject to applicable export control laws and regulations, which might 33 | include those applicable to TINIUX of U.S. and the country in which you are located. 34 | Import, export and usage of TINIUX in any manner by you shall be in compliance with such 35 | applicable export control laws and regulations. 36 | ***********************************************************************************************************/ 37 | 38 | #ifndef __FIT_CPU_H_ 39 | #define __FIT_CPU_H_ 40 | 41 | #include "OSType.h" 42 | 43 | #ifdef __cplusplus 44 | extern "C" { 45 | #endif 46 | /* Scheduler utilities. */ 47 | #define FitSchedule() \ 48 | { \ 49 | /* Set a PendSV to request a context switch. */ \ 50 | FitNVIC_INT_CTRL_REG = FitNVIC_PENDSVSET_BIT; \ 51 | __DSB(); \ 52 | __ISB(); \ 53 | } 54 | 55 | #define FitNVIC_INT_CTRL_REG ( * ( ( volatile uOS32_t * ) 0xe000ed04 ) ) 56 | #define FitNVIC_PENDSVSET_BIT ( 1UL << 28UL ) 57 | #define FitScheduleFromISR( b ) if( b ) FitSchedule() 58 | /*-----------------------------------------------------------*/ 59 | 60 | #include 61 | 62 | #if (OSHIGHEAST_PRIORITY<=32U) 63 | #define FITQUICK_GET_PRIORITY ( 1U ) 64 | #define FitGET_HIGHEST_PRIORITY( uxTopPriority, uxReadyPriorities ) uxTopPriority = ( 31 - __CLZ( ( uxReadyPriorities ) ) ) 65 | #endif 66 | 67 | extern void FitIntLock( void ); 68 | extern void FitIntUnlock( void ); 69 | extern uOS32_t FitGetIPSR( void ); 70 | 71 | #define FitDISABLE_INTERRUPTS() \ 72 | { \ 73 | __set_BASEPRI( OSMAX_HWINT_PRI ); \ 74 | __DSB(); \ 75 | __ISB(); \ 76 | } 77 | 78 | #define FitIntMask() __get_BASEPRI(); FitDISABLE_INTERRUPTS() 79 | #define FitIntUnmask( x ) __set_BASEPRI( x ) 80 | 81 | #define FitIntMaskFromISR() __get_BASEPRI(); FitDISABLE_INTERRUPTS() 82 | #define FitIntUnmaskFromISR( x ) __set_BASEPRI( x ) 83 | 84 | /* Determine whether we are in thread mode or handler mode. */ 85 | #define FitIsInsideISR() ( ( uOSBool_t ) ( FitGetIPSR() != ( uOSBase_t )0 ) ) 86 | 87 | uOSStack_t *FitInitializeStack( uOSStack_t *pxTopOfStack, OSTaskFunction_t TaskFunction, void *pvParameters ); 88 | sOSBase_t FitStartScheduler( void ); 89 | 90 | void FitPendSVHandler( void ); 91 | void FitOSTickISR( void ); 92 | void FitSVCHandler( void ); 93 | 94 | #if ( OS_LOWPOWER_ON!=0 ) 95 | /* Tickless idle/low power functionality. */ 96 | #ifndef FitLowPowerIdle 97 | extern void FitTicklessIdle( uOSTick_t uxLowPowerTicks ); 98 | #define FitLowPowerIdle( uxLowPowerTicks ) FitTicklessIdle( uxLowPowerTicks ) 99 | #endif 100 | #endif 101 | 102 | #ifdef __cplusplus 103 | } 104 | #endif 105 | 106 | #endif //__FIT_CPU_H_ 107 | -------------------------------------------------------------------------------- /CPU/ARM/IAR/Cortex_M7/FitCPU.h: -------------------------------------------------------------------------------- 1 | /********************************************************************************************************** 2 | TINIUX - A tiny and efficient embedded real time operating system (RTOS) 3 | Copyright (C) SenseRate.com All rights reserved. 4 | http://www.tiniux.org -- Documentation, latest information, license and contact details. 5 | http://www.tiniux.com -- Commercial support, development, porting, licensing and training services. 6 | -------------------------------------------------------------------------------------------------------- 7 | Redistribution and use in source and binary forms, with or without modification, 8 | are permitted provided that the following conditions are met: 9 | 1. Redistributions of source code must retain the above copyright notice, this list of 10 | conditions and the following disclaimer. 11 | 2. Redistributions in binary form must reproduce the above copyright notice, this list 12 | of conditions and the following disclaimer in the documentation and/or other materials 13 | provided with the distribution. 14 | 3. Neither the name of the copyright holder nor the names of its contributors may be used 15 | to endorse or promote products derived from this software without specific prior written 16 | permission. 17 | -------------------------------------------------------------------------------------------------------- 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 20 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 21 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 22 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 23 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 24 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 25 | OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 26 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 27 | OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 28 | ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | -------------------------------------------------------------------------------------------------------- 30 | Notice of Export Control Law 31 | -------------------------------------------------------------------------------------------------------- 32 | TINIUX may be subject to applicable export control laws and regulations, which might 33 | include those applicable to TINIUX of U.S. and the country in which you are located. 34 | Import, export and usage of TINIUX in any manner by you shall be in compliance with such 35 | applicable export control laws and regulations. 36 | ***********************************************************************************************************/ 37 | 38 | #ifndef __FIT_CPU_H_ 39 | #define __FIT_CPU_H_ 40 | 41 | #include "OSType.h" 42 | 43 | #ifdef __cplusplus 44 | extern "C" { 45 | #endif 46 | 47 | /* Scheduler utilities. */ 48 | #define FitSchedule() \ 49 | { \ 50 | /* Set a PendSV to request a context switch. */ \ 51 | FitNVIC_INT_CTRL_REG = FitNVIC_PENDSVSET_BIT; \ 52 | __DSB(); \ 53 | __ISB(); \ 54 | } 55 | 56 | #define FitNVIC_INT_CTRL_REG ( * ( ( volatile uOS32_t * ) 0xe000ed04 ) ) 57 | #define FitNVIC_PENDSVSET_BIT ( 1UL << 28UL ) 58 | #define FitScheduleFromISR( b ) if( b ) FitSchedule() 59 | /*-----------------------------------------------------------*/ 60 | 61 | #include 62 | #if (OSHIGHEAST_PRIORITY<=32U) 63 | #define FITQUICK_GET_PRIORITY ( 1U ) 64 | #define FitGET_HIGHEST_PRIORITY( uxTopPriority, uxReadyPriorities ) uxTopPriority = ( 31 - __CLZ( ( uxReadyPriorities ) ) ) 65 | #endif 66 | 67 | #define FitDISABLE_INTERRUPTS() \ 68 | { \ 69 | /* Errata work around. */ \ 70 | __disable_interrupt(); \ 71 | __set_BASEPRI( OSMAX_HWINT_PRI ); \ 72 | __DSB(); \ 73 | __ISB(); \ 74 | __enable_interrupt(); \ 75 | } 76 | 77 | extern void FitIntLock( void ); 78 | extern void FitIntUnlock( void ); 79 | extern uOS32_t FitGetIPSR( void ); 80 | 81 | /* Determine whether we are in thread mode or handler mode. */ 82 | #define FitIsInsideISR() ( ( uOSBool_t ) ( FitGetIPSR() != ( uOSBase_t )0 ) ) 83 | 84 | #define FitIntMask() __get_BASEPRI(); FitDISABLE_INTERRUPTS() 85 | #define FitIntUnmask( x ) __set_BASEPRI( x ) 86 | 87 | #define FitIntMaskFromISR() __get_BASEPRI(); FitDISABLE_INTERRUPTS() 88 | #define FitIntUnmaskFromISR( x ) __set_BASEPRI( x ) 89 | 90 | uOSStack_t *FitInitializeStack( uOSStack_t *pxTopOfStack, OSTaskFunction_t TaskFunction, void *pvParameters ); 91 | sOSBase_t FitStartScheduler( void ); 92 | 93 | void FitPendSVHandler( void ); 94 | void FitOSTickISR( void ); 95 | void FitSVCHandler( void ); 96 | 97 | #if ( OS_LOWPOWER_ON!=0 ) 98 | /* Tickless idle/low power functionality. */ 99 | #ifndef FitLowPowerIdle 100 | extern void FitTicklessIdle( uOSTick_t uxLowPowerTicks ); 101 | #define FitLowPowerIdle( uxLowPowerTicks ) FitTicklessIdle( uxLowPowerTicks ) 102 | #endif 103 | #endif 104 | 105 | #ifdef __cplusplus 106 | } 107 | #endif 108 | 109 | #endif //__FIT_CPU_H_ 110 | -------------------------------------------------------------------------------- /Kernel/OSTimer.h: -------------------------------------------------------------------------------- 1 | /********************************************************************************************************** 2 | TINIUX - A tiny and efficient embedded real time operating system (RTOS) 3 | Copyright (C) SenseRate.com All rights reserved. 4 | http://www.tiniux.org -- Documentation, latest information, license and contact details. 5 | http://www.tiniux.com -- Commercial support, development, porting, licensing and training services. 6 | -------------------------------------------------------------------------------------------------------- 7 | Redistribution and use in source and binary forms, with or without modification, 8 | are permitted provided that the following conditions are met: 9 | 1. Redistributions of source code must retain the above copyright notice, this list of 10 | conditions and the following disclaimer. 11 | 2. Redistributions in binary form must reproduce the above copyright notice, this list 12 | of conditions and the following disclaimer in the documentation and/or other materials 13 | provided with the distribution. 14 | 3. Neither the name of the copyright holder nor the names of its contributors may be used 15 | to endorse or promote products derived from this software without specific prior written 16 | permission. 17 | -------------------------------------------------------------------------------------------------------- 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 20 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 21 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 22 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 23 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 24 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 25 | OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 26 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 27 | OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 28 | ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | -------------------------------------------------------------------------------------------------------- 30 | Notice of Export Control Law 31 | -------------------------------------------------------------------------------------------------------- 32 | TINIUX may be subject to applicable export control laws and regulations, which might 33 | include those applicable to TINIUX of U.S. and the country in which you are located. 34 | Import, export and usage of TINIUX in any manner by you shall be in compliance with such 35 | applicable export control laws and regulations. 36 | ***********************************************************************************************************/ 37 | 38 | #ifndef __OS_TIMER_H_ 39 | #define __OS_TIMER_H_ 40 | 41 | #include "OSType.h" 42 | 43 | #ifdef __cplusplus 44 | extern "C" { 45 | #endif 46 | 47 | #if ( OS_MSGQ_ON!=0 ) 48 | #if ( OS_TIMER_ON!=0 ) 49 | 50 | typedef struct tOSTimer 51 | { 52 | tOSListItem_t tTimerListItem; 53 | uOSTick_t uxTimerTicks; 54 | uOS16_t bPeriod; 55 | OSTimerFunction_t pxTimerFunction; /* << The callback function to execute. */ 56 | void * pvParameter; /* << The value that will be used as the callback functions first parameter. */ 57 | sOS8_t pcTimerName[OSNAME_MAX_LEN];/* name of the timer*/ 58 | sOSBase_t xID; 59 | }tOSTimer_t; 60 | 61 | typedef tOSTimer_t* OSTimerHandle_t; 62 | 63 | typedef struct tTimerCmdMsg 64 | { 65 | sOSBase_t xCmdMsgType; /*<< The command message type being sent to the timer moniter task. */ 66 | uOSTick_t uxTicks; /*<< An optional value used by a timer commands, for example, when changing the period of a timer. */ 67 | tOSTimer_t * ptTimer; /*<< The timer to which the command will be applied. */ 68 | } tOSTimerCmdMsg_t; 69 | 70 | uOSBase_t OSTimerInit( void ) TINIUX_FUNCTION; 71 | 72 | OSTimerHandle_t OSTimerCreate(const uOSTick_t uxTimerTicks, const uOS16_t uiIsPeriod, const OSTimerFunction_t Function, void* pvParameter, sOS8_t* pcName) TINIUX_FUNCTION; 73 | #if ( OS_MEMFREE_ON != 0 ) 74 | uOSBool_t OSTimerDelete(OSTimerHandle_t TimerHandle) TINIUX_FUNCTION; 75 | #endif /* OS_MEMFREE_ON */ 76 | 77 | uOSBool_t OSTimerDeleteFromISR(OSTimerHandle_t TimerHandle) TINIUX_FUNCTION; 78 | sOSBase_t OSTimerSetID(OSTimerHandle_t TimerHandle, sOSBase_t xID) TINIUX_FUNCTION; 79 | sOSBase_t OSTimerGetID(OSTimerHandle_t const TimerHandle) TINIUX_FUNCTION; 80 | 81 | uOSBool_t OSTimerSetTicks(OSTimerHandle_t const TimerHandle, const uOSTick_t uxTimerTicks) TINIUX_FUNCTION; 82 | uOSBool_t OSTimerSetTicksFromISR(OSTimerHandle_t const TimerHandle, const uOSTick_t uxTimerTicks) TINIUX_FUNCTION; 83 | uOSBool_t OSTimerSetPeriod(OSTimerHandle_t const TimerHandle, const uOSTick_t uxTimerPeriod) TINIUX_FUNCTION; 84 | uOSBool_t OSTimerSetPeriodFromISR(OSTimerHandle_t const TimerHandle, const uOSTick_t uxTimerPeriod) TINIUX_FUNCTION; 85 | uOSBool_t OSTimerStart(OSTimerHandle_t const TimerHandle) TINIUX_FUNCTION; 86 | uOSBool_t OSTimerStartFromISR(OSTimerHandle_t const TimerHandle) TINIUX_FUNCTION; 87 | uOSBool_t OSTimerStop(OSTimerHandle_t const TimerHandle) TINIUX_FUNCTION; 88 | uOSBool_t OSTimerStopFromISR(OSTimerHandle_t const TimerHandle) TINIUX_FUNCTION; 89 | 90 | uOSBool_t OSTimerCreateMoniteTask( void ) TINIUX_FUNCTION; 91 | 92 | #endif //( OS_TIMER_ON!=0 ) 93 | #endif//( OS_MSGQ_ON!=0 ) 94 | 95 | #ifdef __cplusplus 96 | } 97 | #endif 98 | 99 | #endif //__OS_TIMER_H_ 100 | -------------------------------------------------------------------------------- /CPU/ARM/IAR/Cortex_M4/FitAsm.s: -------------------------------------------------------------------------------- 1 | /********************************************************************************************************** 2 | TINIUX - A tiny and efficient embedded real time operating system (RTOS) 3 | Copyright (C) SenseRate.com All rights reserved. 4 | http://www.tiniux.org -- Documentation, latest information, license and contact details. 5 | http://www.tiniux.com -- Commercial support, development, porting, licensing and training services. 6 | -------------------------------------------------------------------------------------------------------- 7 | Redistribution and use in source and binary forms, with or without modification, 8 | are permitted provided that the following conditions are met: 9 | 1. Redistributions of source code must retain the above copyright notice, this list of 10 | conditions and the following disclaimer. 11 | 2. Redistributions in binary form must reproduce the above copyright notice, this list 12 | of conditions and the following disclaimer in the documentation and/or other materials 13 | provided with the distribution. 14 | 3. Neither the name of the copyright holder nor the names of its contributors may be used 15 | to endorse or promote products derived from this software without specific prior written 16 | permission. 17 | -------------------------------------------------------------------------------------------------------- 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 20 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 21 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 22 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 23 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 24 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 25 | OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 26 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 27 | OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 28 | ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | -------------------------------------------------------------------------------------------------------- 30 | Notice of Export Control Law 31 | -------------------------------------------------------------------------------------------------------- 32 | TINIUX may be subject to applicable export control laws and regulations, which might 33 | include those applicable to TINIUX of U.S. and the country in which you are located. 34 | Import, export and usage of TINIUX in any manner by you shall be in compliance with such 35 | applicable export control laws and regulations. 36 | ***********************************************************************************************************/ 37 | 38 | #include 39 | 40 | RSEG CODE:CODE(2) 41 | thumb 42 | 43 | EXTERN gptCurrentTCB 44 | EXTERN OSTaskSwitchContext 45 | 46 | PUBLIC FitPendSVHandler 47 | PUBLIC FitSVCHandler 48 | PUBLIC FitStartFirstTask 49 | PUBLIC FitEnableVFP 50 | PUBLIC FitGetIPSR 51 | 52 | /*-----------------------------------------------------------*/ 53 | 54 | FitPendSVHandler: 55 | mrs r0, psp 56 | isb 57 | /* Get the location of the current TCB. */ 58 | ldr r3, =gptCurrentTCB 59 | ldr r2, [r3] 60 | 61 | /* Is the task using the FPU context? If so, push high vfp registers. */ 62 | tst r14, #0x10 63 | it eq 64 | vstmdbeq r0!, {s16-s31} 65 | 66 | /* Save the core registers. */ 67 | stmdb r0!, {r4-r11, r14} 68 | 69 | /* Save the new top of stack into the first member of the TCB. */ 70 | str r0, [r2] 71 | 72 | stmdb sp!, {r3} 73 | mov r0, #OSMAX_HWINT_PRI 74 | msr basepri, r0 75 | dsb 76 | isb 77 | bl OSTaskSwitchContext 78 | mov r0, #0 79 | msr basepri, r0 80 | ldmia sp!, {r3} 81 | 82 | /* The first item in gptCurrentTCB is the task top of stack. */ 83 | ldr r1, [r3] 84 | ldr r0, [r1] 85 | 86 | /* Pop the core registers. */ 87 | ldmia r0!, {r4-r11, r14} 88 | 89 | /* Is the task using the FPU context? If so, pop the high vfp registers 90 | too. */ 91 | tst r14, #0x10 92 | it eq 93 | vldmiaeq r0!, {s16-s31} 94 | 95 | msr psp, r0 96 | isb 97 | #ifdef WORKAROUND_PMU_CM001 /* XMC4000 specific errata */ 98 | #if WORKAROUND_PMU_CM001 == 1 99 | push { r14 } 100 | pop { pc } 101 | #endif 102 | #endif 103 | 104 | bx r14 105 | 106 | 107 | /*-----------------------------------------------------------*/ 108 | 109 | FitSVCHandler: 110 | /* Get the location of the current TCB. */ 111 | ldr r3, =gptCurrentTCB 112 | ldr r1, [r3] 113 | ldr r0, [r1] 114 | /* Pop the core registers. */ 115 | ldmia r0!, {r4-r11, r14} 116 | msr psp, r0 117 | isb 118 | mov r0, #0 119 | msr basepri, r0 120 | bx r14 121 | 122 | /*-----------------------------------------------------------*/ 123 | 124 | FitStartFirstTask: 125 | /* Use the NVIC offset register to locate the stack. */ 126 | ldr r0, =0xE000ED08 127 | ldr r0, [r0] 128 | ldr r0, [r0] 129 | /* Set the msp back to the start of the stack. */ 130 | msr msp, r0 131 | /* Call SVC to start the first task. */ 132 | cpsie i 133 | cpsie f 134 | dsb 135 | isb 136 | svc 0 137 | 138 | /*-----------------------------------------------------------*/ 139 | 140 | FitEnableVFP: 141 | /* The FPU enable bits are in the CPACR. */ 142 | ldr.w r0, =0xE000ED88 143 | ldr r1, [r0] 144 | 145 | /* Enable CP10 and CP11 coprocessors, then save back. */ 146 | orr r1, r1, #( 0xf << 20 ) 147 | str r1, [r0] 148 | bx r14 149 | 150 | FitGetIPSR: 151 | /* Get IPSR value. */ 152 | mrs r0, IPSR 153 | bx r14 154 | 155 | 156 | END 157 | 158 | -------------------------------------------------------------------------------- /CPU/ARM/IAR/Cortex_M7/FitAsm.s: -------------------------------------------------------------------------------- 1 | /********************************************************************************************************** 2 | TINIUX - A tiny and efficient embedded real time operating system (RTOS) 3 | Copyright (C) SenseRate.com All rights reserved. 4 | http://www.tiniux.org -- Documentation, latest information, license and contact details. 5 | http://www.tiniux.com -- Commercial support, development, porting, licensing and training services. 6 | -------------------------------------------------------------------------------------------------------- 7 | Redistribution and use in source and binary forms, with or without modification, 8 | are permitted provided that the following conditions are met: 9 | 1. Redistributions of source code must retain the above copyright notice, this list of 10 | conditions and the following disclaimer. 11 | 2. Redistributions in binary form must reproduce the above copyright notice, this list 12 | of conditions and the following disclaimer in the documentation and/or other materials 13 | provided with the distribution. 14 | 3. Neither the name of the copyright holder nor the names of its contributors may be used 15 | to endorse or promote products derived from this software without specific prior written 16 | permission. 17 | -------------------------------------------------------------------------------------------------------- 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 20 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 21 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 22 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 23 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 24 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 25 | OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 26 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 27 | OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 28 | ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | -------------------------------------------------------------------------------------------------------- 30 | Notice of Export Control Law 31 | -------------------------------------------------------------------------------------------------------- 32 | TINIUX may be subject to applicable export control laws and regulations, which might 33 | include those applicable to TINIUX of U.S. and the country in which you are located. 34 | Import, export and usage of TINIUX in any manner by you shall be in compliance with such 35 | applicable export control laws and regulations. 36 | ***********************************************************************************************************/ 37 | 38 | #include 39 | 40 | RSEG CODE:CODE(2) 41 | thumb 42 | 43 | EXTERN gptCurrentTCB 44 | EXTERN OSTaskSwitchContext 45 | 46 | PUBLIC FitPendSVHandler 47 | PUBLIC FitSVCHandler 48 | PUBLIC FitStartFirstTask 49 | PUBLIC FitEnableVFP 50 | PUBLIC FitGetIPSR 51 | 52 | /*-----------------------------------------------------------*/ 53 | 54 | FitPendSVHandler: 55 | mrs r0, psp 56 | isb 57 | /* Get the location of the current TCB. */ 58 | ldr r3, =gptCurrentTCB 59 | ldr r2, [r3] 60 | 61 | /* Is the task using the FPU context? If so, push high vfp registers. */ 62 | tst r14, #0x10 63 | it eq 64 | vstmdbeq r0!, {s16-s31} 65 | 66 | /* Save the core registers. */ 67 | stmdb r0!, {r4-r11, r14} 68 | 69 | /* Save the new top of stack into the first member of the TCB. */ 70 | str r0, [r2] 71 | 72 | stmdb sp!, {r3} 73 | mov r0, #OSMAX_HWINT_PRI 74 | cpsid i 75 | msr basepri, r0 76 | dsb 77 | isb 78 | cpsie i 79 | bl OSTaskSwitchContext 80 | mov r0, #0 81 | msr basepri, r0 82 | ldmia sp!, {r3} 83 | 84 | /* The first item in gptCurrentTCB is the task top of stack. */ 85 | ldr r1, [r3] 86 | ldr r0, [r1] 87 | 88 | /* Pop the core registers. */ 89 | ldmia r0!, {r4-r11, r14} 90 | 91 | /* Is the task using the FPU context? If so, pop the high vfp registers 92 | too. */ 93 | tst r14, #0x10 94 | it eq 95 | vldmiaeq r0!, {s16-s31} 96 | 97 | msr psp, r0 98 | isb 99 | #ifdef WORKAROUND_PMU_CM001 /* XMC4000 specific errata */ 100 | #if WORKAROUND_PMU_CM001 == 1 101 | push { r14 } 102 | pop { pc } 103 | #endif 104 | #endif 105 | 106 | bx r14 107 | 108 | 109 | /*-----------------------------------------------------------*/ 110 | 111 | FitSVCHandler: 112 | /* Get the location of the current TCB. */ 113 | ldr r3, =gptCurrentTCB 114 | ldr r1, [r3] 115 | ldr r0, [r1] 116 | /* Pop the core registers. */ 117 | ldmia r0!, {r4-r11, r14} 118 | msr psp, r0 119 | isb 120 | mov r0, #0 121 | msr basepri, r0 122 | bx r14 123 | 124 | /*-----------------------------------------------------------*/ 125 | 126 | FitStartFirstTask: 127 | /* Use the NVIC offset register to locate the stack. */ 128 | ldr r0, =0xE000ED08 129 | ldr r0, [r0] 130 | ldr r0, [r0] 131 | /* Set the msp back to the start of the stack. */ 132 | msr msp, r0 133 | /* Call SVC to start the first task. */ 134 | cpsie i 135 | cpsie f 136 | dsb 137 | isb 138 | svc 0 139 | 140 | /*-----------------------------------------------------------*/ 141 | 142 | FitEnableVFP: 143 | /* The FPU enable bits are in the CPACR. */ 144 | ldr.w r0, =0xE000ED88 145 | ldr r1, [r0] 146 | 147 | /* Enable CP10 and CP11 coprocessors, then save back. */ 148 | orr r1, r1, #( 0xf << 20 ) 149 | str r1, [r0] 150 | bx r14 151 | 152 | FitGetIPSR: 153 | /* Get IPSR value. */ 154 | mrs r0, IPSR 155 | bx r14 156 | 157 | END 158 | 159 | -------------------------------------------------------------------------------- /Kernel/OSMsgQ.h: -------------------------------------------------------------------------------- 1 | /********************************************************************************************************** 2 | TINIUX - A tiny and efficient embedded real time operating system (RTOS) 3 | Copyright (C) SenseRate.com All rights reserved. 4 | http://www.tiniux.org -- Documentation, latest information, license and contact details. 5 | http://www.tiniux.com -- Commercial support, development, porting, licensing and training services. 6 | -------------------------------------------------------------------------------------------------------- 7 | Redistribution and use in source and binary forms, with or without modification, 8 | are permitted provided that the following conditions are met: 9 | 1. Redistributions of source code must retain the above copyright notice, this list of 10 | conditions and the following disclaimer. 11 | 2. Redistributions in binary form must reproduce the above copyright notice, this list 12 | of conditions and the following disclaimer in the documentation and/or other materials 13 | provided with the distribution. 14 | 3. Neither the name of the copyright holder nor the names of its contributors may be used 15 | to endorse or promote products derived from this software without specific prior written 16 | permission. 17 | -------------------------------------------------------------------------------------------------------- 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 20 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 21 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 22 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 23 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 24 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 25 | OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 26 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 27 | OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 28 | ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | -------------------------------------------------------------------------------------------------------- 30 | Notice of Export Control Law 31 | -------------------------------------------------------------------------------------------------------- 32 | TINIUX may be subject to applicable export control laws and regulations, which might 33 | include those applicable to TINIUX of U.S. and the country in which you are located. 34 | Import, export and usage of TINIUX in any manner by you shall be in compliance with such 35 | applicable export control laws and regulations. 36 | ***********************************************************************************************************/ 37 | 38 | #ifndef __OS_MSGQ_H_ 39 | #define __OS_MSGQ_H_ 40 | 41 | #include "OSType.h" 42 | 43 | #ifdef __cplusplus 44 | extern "C" { 45 | #endif 46 | 47 | #if ( OS_MSGQ_ON!=0 ) 48 | 49 | typedef struct tOSMsgQ 50 | { 51 | char pcMsgQName[ OSNAME_MAX_LEN ]; 52 | 53 | sOS8_t * pcHead; 54 | sOS8_t * pcTail; 55 | sOS8_t * pcWriteTo; 56 | sOS8_t * pcReadFrom; 57 | 58 | tOSList_t tTaskListEventMsgQV; // MsgQ Send TaskList; 59 | tOSList_t tTaskListEventMsgQP; // MsgQ Recv TaskList; 60 | 61 | volatile uOSBase_t uxCurNum; 62 | uOSBase_t uxMaxNum; 63 | uOSBase_t uxItemSize; 64 | 65 | volatile sOSBase_t xMsgQPLock; // Record the number of task which received msg from the MsgQ while it was locked. 66 | volatile sOSBase_t xMsgQVLock; // Record the number of task which send msg to the MsgQ while it was locked. 67 | 68 | sOSBase_t xID; 69 | } tOSMsgQ_t; 70 | 71 | typedef tOSMsgQ_t* OSMsgQHandle_t; 72 | 73 | OSMsgQHandle_t OSMsgQCreate( const uOSBase_t uxQueueLength, const uOSBase_t uxItemSize ) TINIUX_FUNCTION; 74 | #if ( OS_MEMFREE_ON != 0 ) 75 | void OSMsgQDelete( OSMsgQHandle_t MsgQHandle ) TINIUX_FUNCTION; 76 | #endif /* OS_MEMFREE_ON */ 77 | 78 | sOSBase_t OSMsgQSetID(OSMsgQHandle_t MsgQHandle, sOSBase_t xID) TINIUX_FUNCTION; 79 | sOSBase_t OSMsgQGetID(OSMsgQHandle_t const MsgQHandle) TINIUX_FUNCTION; 80 | 81 | uOSBool_t OSMsgQSend( OSMsgQHandle_t MsgQHandle, const void * const pvItemToQueue, uOSTick_t uxTicksToWait) TINIUX_FUNCTION; 82 | uOSBool_t OSMsgQOverwrite( OSMsgQHandle_t MsgQHandle, const void * const pvItemToQueue) TINIUX_FUNCTION; 83 | 84 | uOSBool_t OSMsgQSendFromISR( OSMsgQHandle_t MsgQHandle, const void * const pvItemToQueue) TINIUX_FUNCTION; 85 | uOSBool_t OSMsgQOverwriteFromISR( OSMsgQHandle_t MsgQHandle, const void * const pvItemToQueue) TINIUX_FUNCTION; 86 | 87 | uOSBool_t OSMsgQSendToHead( OSMsgQHandle_t MsgQHandle, const void * const pvItemToQueue, uOSTick_t uxTicksToWait) TINIUX_FUNCTION; 88 | uOSBool_t OSMsgQSendToHeadFromISR( OSMsgQHandle_t MsgQHandle, const void * const pvItemToQueue) TINIUX_FUNCTION; 89 | 90 | uOSBool_t OSMsgQPeek( OSMsgQHandle_t MsgQHandle, void * const pvBuffer, uOSTick_t uxTicksToWait) TINIUX_FUNCTION; 91 | uOSBool_t OSMsgQReceive( OSMsgQHandle_t MsgQHandle, void * const pvBuffer, uOSTick_t uxTicksToWait) TINIUX_FUNCTION; 92 | 93 | uOSBool_t OSMsgQPeekFromISR( OSMsgQHandle_t MsgQHandle, void * const pvBuffer ) TINIUX_FUNCTION; 94 | uOSBool_t OSMsgQReceiveFromISR( OSMsgQHandle_t MsgQHandle, void * const pvBuffer) TINIUX_FUNCTION; 95 | 96 | uOSBase_t OSMsgQGetSpaceNum( const OSMsgQHandle_t MsgQHandle ) TINIUX_FUNCTION; 97 | uOSBase_t OSMsgQGetMsgNum( const OSMsgQHandle_t MsgQHandle ) TINIUX_FUNCTION; 98 | 99 | sOSBase_t OSMsgQReset( OSMsgQHandle_t MsgQHandle, uOSBool_t bNewQueue ) TINIUX_FUNCTION; 100 | 101 | #if ( OS_TIMER_ON!=0 ) 102 | void OSMsgQWait( OSMsgQHandle_t MsgQHandle, uOSTick_t uxTicksToWait, uOSBool_t bNeedSuspend ) TINIUX_FUNCTION; 103 | #endif /* ( OS_TIMER_ON!=0 ) */ 104 | 105 | #endif //( OS_MSGQ_ON!=0 ) 106 | 107 | #ifdef __cplusplus 108 | } 109 | #endif 110 | 111 | #endif /* __OS_MSGQ_H_ */ 112 | 113 | -------------------------------------------------------------------------------- /Preset/ARM/Cortex_M0/OSPreset.h: -------------------------------------------------------------------------------- 1 | /********************************************************************************************************** 2 | TINIUX - A tiny and efficient embedded real time operating system (RTOS) 3 | Copyright (C) SenseRate.com All rights reserved. 4 | http://www.tiniux.org -- Documentation, latest information, license and contact details. 5 | http://www.tiniux.com -- Commercial support, development, porting, licensing and training services. 6 | -------------------------------------------------------------------------------------------------------- 7 | Redistribution and use in source and binary forms, with or without modification, 8 | are permitted provided that the following conditions are met: 9 | 1. Redistributions of source code must retain the above copyright notice, this list of 10 | conditions and the following disclaimer. 11 | 2. Redistributions in binary form must reproduce the above copyright notice, this list 12 | of conditions and the following disclaimer in the documentation and/or other materials 13 | provided with the distribution. 14 | 3. Neither the name of the copyright holder nor the names of its contributors may be used 15 | to endorse or promote products derived from this software without specific prior written 16 | permission. 17 | -------------------------------------------------------------------------------------------------------- 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 20 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 21 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 22 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 23 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 24 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 25 | OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 26 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 27 | OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 28 | ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | -------------------------------------------------------------------------------------------------------- 30 | Notice of Export Control Law 31 | -------------------------------------------------------------------------------------------------------- 32 | TINIUX may be subject to applicable export control laws and regulations, which might 33 | include those applicable to TINIUX of U.S. and the country in which you are located. 34 | Import, export and usage of TINIUX in any manner by you shall be in compliance with such 35 | applicable export control laws and regulations. 36 | ***********************************************************************************************************/ 37 | 38 | // !!!注:应用程序可以根据需要调整Tiniux系统API接口函数及相关功能模块的开关 !!! 39 | 40 | #ifndef __OS_PRESET_H_ 41 | #define __OS_PRESET_H_ 42 | 43 | /*----------------------------------------------------------- 44 | * Application specific definitions. 45 | * 46 | * These definitions should be adjusted for your particular hardware and 47 | * application requirements. 48 | * 49 | *----------------------------------------------------------*/ 50 | 51 | /* Ensure stdint is only used by the compiler, and not the assembler. */ 52 | #if defined(__ICCARM__) || defined(__CC_ARM) || defined(__GNUC__) 53 | #include 54 | extern uint32_t SystemCoreClock; 55 | #endif 56 | 57 | #define SETOS_CPU_CLOCK_HZ ( SystemCoreClock ) //定义CPU运行主频 (如72000000) 58 | #define SETOS_TICK_RATE_HZ ( 1000 ) //定义TINIUX系统中ticks频率 59 | 60 | #define SETOS_MINIMAL_STACK_SIZE ( 48 ) //定义任务占用的最小Stack空间 61 | #define SETOS_TOTAL_HEAP_SIZE ( 1024*2 ) //定义系统占用的Heap空间 62 | #define SETOS_ENABLE_MEMFREE ( 0 ) //是否允许释放内存,允许后可以在系统运行时删除Task MsgQ Semaphone Mutex Timer等 63 | #define SETOS_LOWPOWER_MODE ( 0 ) //是否开启低功耗模式 64 | #define SETOS_MAX_NAME_LEN ( 4 ) //定义任务、信号量、消息队列等变量中的名称长度 65 | #define SETOS_MAX_PRIORITIES ( 4 ) //定义任务最大优先级 66 | #define SETOS_TASK_SIGNAL_ON ( 1 ) //是否启动轻量级的任务同步信号,功能类似Semaphore MsgQ,内存占用要小于Semaphore MsgQ 67 | #define SETOS_USE_SEMAPHORE ( 1 ) //是否启用系统信号量功能 0关闭 1启用 68 | #define SETOS_USE_MUTEX ( 1 ) //是否启用互斥信号量功能 0关闭 1启用 69 | #define SETOS_USE_MSGQ ( 1 ) //是否启用系统消息队列功能 0关闭 1启用 70 | #define SETOS_MSGQ_MAX_MSGNUM ( 2 ) //定义消息队列中消息的门限值 71 | #define SETOS_USE_TIMER ( 1 ) //是否使用系统软件定时器 72 | #define SETOS_USE_QUICK_SCHEDULE ( 1 ) //是否启动快速调度算法 73 | #define SETOS_TIME_SLICE_ON ( 1 ) //是否启用时间片轮转(time slice)调度机制 74 | #define SETOS_PEND_FOREVER_VALUE ( 0xFFFFFFFFUL )//定义信号量及消息队列中永久等待的数值 75 | 76 | /* Cortex-M specific definitions. */ 77 | #ifdef __NVIC_PRIO_BITS 78 | /* __BVIC_PRIO_BITS will be specified when CMSIS is being used. */ 79 | #define SETHW_PRIO_BITS __NVIC_PRIO_BITS 80 | #else 81 | #define SETHW_PRIO_BITS ( 4 ) /* 15 priority levels */ 82 | #endif 83 | 84 | /* The highest interrupt priority that can be used by any interrupt service 85 | routine that makes calls to interrupt safe TINIUX API functions. DO NOT CALL 86 | INTERRUPT SAFE TINIUX API FUNCTIONS FROM ANY INTERRUPT THAT HAS A HIGHER 87 | PRIORITY THAN THIS! (higher priorities are lower numeric values. */ 88 | /* !!!! OSMAX_HWINT_PRI must not be set to zero !!!!*/ 89 | #define OSMAX_HWINT_PRI ( 0x5 << (8 - SETHW_PRIO_BITS) ) /* equivalent to 0x50, or priority 5. */ 90 | /* This is the value being used as per the ST library which permits 16 91 | priority values, 0 to 15. This must correspond to the OSMIN_HWINT_PRI 92 | setting. Here 15 corresponds to the lowest NVIC value of 255. */ 93 | #define OSMIN_HWINT_PRI ( 0xF << (8 - SETHW_PRIO_BITS) ) /* equivalent to 0xF0, or priority 15. */ 94 | 95 | #define FitSVCHandler SVC_Handler 96 | #define FitPendSVHandler PendSV_Handler 97 | #define FitOSTickISR SysTick_Handler 98 | 99 | #endif /* __OS_PRESET_H_ */ 100 | 101 | -------------------------------------------------------------------------------- /Preset/ARM/Cortex_M3/OSPreset.h: -------------------------------------------------------------------------------- 1 | /********************************************************************************************************** 2 | TINIUX - A tiny and efficient embedded real time operating system (RTOS) 3 | Copyright (C) SenseRate.com All rights reserved. 4 | http://www.tiniux.org -- Documentation, latest information, license and contact details. 5 | http://www.tiniux.com -- Commercial support, development, porting, licensing and training services. 6 | -------------------------------------------------------------------------------------------------------- 7 | Redistribution and use in source and binary forms, with or without modification, 8 | are permitted provided that the following conditions are met: 9 | 1. Redistributions of source code must retain the above copyright notice, this list of 10 | conditions and the following disclaimer. 11 | 2. Redistributions in binary form must reproduce the above copyright notice, this list 12 | of conditions and the following disclaimer in the documentation and/or other materials 13 | provided with the distribution. 14 | 3. Neither the name of the copyright holder nor the names of its contributors may be used 15 | to endorse or promote products derived from this software without specific prior written 16 | permission. 17 | -------------------------------------------------------------------------------------------------------- 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 20 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 21 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 22 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 23 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 24 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 25 | OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 26 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 27 | OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 28 | ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | -------------------------------------------------------------------------------------------------------- 30 | Notice of Export Control Law 31 | -------------------------------------------------------------------------------------------------------- 32 | TINIUX may be subject to applicable export control laws and regulations, which might 33 | include those applicable to TINIUX of U.S. and the country in which you are located. 34 | Import, export and usage of TINIUX in any manner by you shall be in compliance with such 35 | applicable export control laws and regulations. 36 | ***********************************************************************************************************/ 37 | 38 | // !!!注:应用程序可以根据需要调整Tiniux系统API接口函数及相关功能模块的开关 !!! 39 | 40 | #ifndef __OS_PRESET_H_ 41 | #define __OS_PRESET_H_ 42 | 43 | /*----------------------------------------------------------- 44 | * Application specific definitions. 45 | * 46 | * These definitions should be adjusted for your particular hardware and 47 | * application requirements. 48 | * 49 | *----------------------------------------------------------*/ 50 | 51 | /* Ensure stdint is only used by the compiler, and not the assembler. */ 52 | #if defined(__ICCARM__) || defined(__CC_ARM) || defined(__GNUC__) 53 | #include 54 | extern uint32_t SystemCoreClock; 55 | #endif 56 | 57 | #define SETOS_CPU_CLOCK_HZ ( SystemCoreClock ) //定义CPU运行主频 (如72000000) 58 | #define SETOS_TICK_RATE_HZ ( 1000 ) //定义TINIUX系统中ticks频率 59 | 60 | #define SETOS_MINIMAL_STACK_SIZE ( 64 ) //定义任务占用的最小Stack空间 61 | #define SETOS_TOTAL_HEAP_SIZE ( 1024*3 ) //定义系统占用的Heap空间 62 | #define SETOS_ENABLE_MEMFREE ( 1 ) //是否允许释放内存,允许后可以在系统运行时删除Task MsgQ Semaphone Mutex Timer等 63 | #define SETOS_LOWPOWER_MODE ( 1 ) //是否开启低功耗模式 64 | #define SETOS_MAX_NAME_LEN ( 8 ) //定义任务、信号量、消息队列等变量中的名称长度 65 | #define SETOS_MAX_PRIORITIES ( 8 ) //定义任务最大优先级 66 | #define SETOS_TASK_SIGNAL_ON ( 1 ) //是否启动轻量级的任务同步信号,功能类似Semaphore MsgQ,内存占用要小于Semaphore MsgQ 67 | #define SETOS_USE_SEMAPHORE ( 1 ) //是否启用系统信号量功能 0关闭 1启用 68 | #define SETOS_USE_MUTEX ( 1 ) //是否启用互斥信号量功能 0关闭 1启用 69 | #define SETOS_USE_MSGQ ( 1 ) //是否启用系统消息队列功能 0关闭 1启用 70 | #define SETOS_MSGQ_MAX_MSGNUM ( 5 ) //定义消息队列中消息的门限值 71 | #define SETOS_USE_TIMER ( 1 ) //是否使用系统软件定时器 72 | #define SETOS_USE_QUICK_SCHEDULE ( 1 ) //是否启动快速调度算法 73 | #define SETOS_TIME_SLICE_ON ( 1 ) //是否启用时间片轮转(time slice)调度机制 74 | #define SETOS_PEND_FOREVER_VALUE ( 0xFFFFFFFFUL )//定义信号量及消息队列中永久等待的数值 75 | 76 | /* Cortex-M specific definitions. */ 77 | #ifdef __NVIC_PRIO_BITS 78 | /* __BVIC_PRIO_BITS will be specified when CMSIS is being used. */ 79 | #define SETHW_PRIO_BITS __NVIC_PRIO_BITS 80 | #else 81 | #define SETHW_PRIO_BITS ( 4 ) /* 15 priority levels */ 82 | #endif 83 | 84 | /* The highest interrupt priority that can be used by any interrupt service 85 | routine that makes calls to interrupt safe TINIUX API functions. DO NOT CALL 86 | INTERRUPT SAFE TINIUX API FUNCTIONS FROM ANY INTERRUPT THAT HAS A HIGHER 87 | PRIORITY THAN THIS! (higher priorities are lower numeric values. */ 88 | /* !!!! OSMAX_HWINT_PRI must not be set to zero !!!!*/ 89 | #define OSMAX_HWINT_PRI ( 0x5 << (8 - SETHW_PRIO_BITS) ) /* equivalent to 0x50, or priority 5. */ 90 | /* This is the value being used as per the ST library which permits 16 91 | priority values, 0 to 15. This must correspond to the OSMIN_HWINT_PRI 92 | setting. Here 15 corresponds to the lowest NVIC value of 255. */ 93 | #define OSMIN_HWINT_PRI ( 0xF << (8 - SETHW_PRIO_BITS) ) /* equivalent to 0xF0, or priority 15. */ 94 | 95 | #define FitSVCHandler SVC_Handler 96 | #define FitPendSVHandler PendSV_Handler 97 | #define FitOSTickISR SysTick_Handler 98 | 99 | #endif /* __OS_PRESET_H_ */ 100 | 101 | -------------------------------------------------------------------------------- /Preset/ARM/Cortex_M4/OSPreset.h: -------------------------------------------------------------------------------- 1 | /********************************************************************************************************** 2 | TINIUX - A tiny and efficient embedded real time operating system (RTOS) 3 | Copyright (C) SenseRate.com All rights reserved. 4 | http://www.tiniux.org -- Documentation, latest information, license and contact details. 5 | http://www.tiniux.com -- Commercial support, development, porting, licensing and training services. 6 | -------------------------------------------------------------------------------------------------------- 7 | Redistribution and use in source and binary forms, with or without modification, 8 | are permitted provided that the following conditions are met: 9 | 1. Redistributions of source code must retain the above copyright notice, this list of 10 | conditions and the following disclaimer. 11 | 2. Redistributions in binary form must reproduce the above copyright notice, this list 12 | of conditions and the following disclaimer in the documentation and/or other materials 13 | provided with the distribution. 14 | 3. Neither the name of the copyright holder nor the names of its contributors may be used 15 | to endorse or promote products derived from this software without specific prior written 16 | permission. 17 | -------------------------------------------------------------------------------------------------------- 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 20 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 21 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 22 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 23 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 24 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 25 | OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 26 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 27 | OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 28 | ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | -------------------------------------------------------------------------------------------------------- 30 | Notice of Export Control Law 31 | -------------------------------------------------------------------------------------------------------- 32 | TINIUX may be subject to applicable export control laws and regulations, which might 33 | include those applicable to TINIUX of U.S. and the country in which you are located. 34 | Import, export and usage of TINIUX in any manner by you shall be in compliance with such 35 | applicable export control laws and regulations. 36 | ***********************************************************************************************************/ 37 | 38 | // !!!注:应用程序可以根据需要调整Tiniux系统API接口函数及相关功能模块的开关 !!! 39 | 40 | #ifndef __OS_PRESET_H_ 41 | #define __OS_PRESET_H_ 42 | 43 | /*----------------------------------------------------------- 44 | * Application specific definitions. 45 | * 46 | * These definitions should be adjusted for your particular hardware and 47 | * application requirements. 48 | * 49 | *----------------------------------------------------------*/ 50 | 51 | /* Ensure stdint is only used by the compiler, and not the assembler. */ 52 | #if defined(__ICCARM__) || defined(__CC_ARM) || defined(__GNUC__) 53 | #include 54 | extern uint32_t SystemCoreClock; 55 | #endif 56 | 57 | #define SETOS_CPU_CLOCK_HZ ( SystemCoreClock ) //定义CPU运行主频 (如72000000) 58 | #define SETOS_TICK_RATE_HZ ( 1000 ) //定义TINIUX系统中ticks频率 59 | 60 | #define SETOS_MINIMAL_STACK_SIZE ( 72 ) //定义任务占用的最小Stack空间 61 | #define SETOS_TOTAL_HEAP_SIZE ( 1024*4 ) //定义系统占用的Heap空间 62 | #define SETOS_ENABLE_MEMFREE ( 1 ) //是否允许释放内存,允许后可以在系统运行时删除Task MsgQ Semaphone Mutex Timer等 63 | #define SETOS_LOWPOWER_MODE ( 1 ) //是否开启低功耗模式 64 | #define SETOS_MAX_NAME_LEN ( 10 ) //定义任务、信号量、消息队列等变量中的名称长度 65 | #define SETOS_MAX_PRIORITIES ( 8 ) //定义任务最大优先级 66 | #define SETOS_TASK_SIGNAL_ON ( 1 ) //是否启动轻量级的任务同步信号,功能类似Semaphore MsgQ,内存占用要小于Semaphore MsgQ 67 | #define SETOS_USE_SEMAPHORE ( 1 ) //是否启用系统信号量功能 0关闭 1启用 68 | #define SETOS_USE_MUTEX ( 1 ) //是否启用互斥信号量功能 0关闭 1启用 69 | #define SETOS_USE_MSGQ ( 1 ) //是否启用系统消息队列功能 0关闭 1启用 70 | #define SETOS_MSGQ_MAX_MSGNUM ( 5 ) //定义消息队列中消息的门限值 71 | #define SETOS_USE_TIMER ( 1 ) //是否使用系统软件定时器 72 | #define SETOS_USE_QUICK_SCHEDULE ( 1 ) //是否启动快速调度算法 73 | #define SETOS_TIME_SLICE_ON ( 1 ) //是否启用时间片轮转(time slice)调度机制 74 | #define SETOS_PEND_FOREVER_VALUE ( 0xFFFFFFFFUL )//定义信号量及消息队列中永久等待的数值 75 | 76 | /* Cortex-M specific definitions. */ 77 | #ifdef __NVIC_PRIO_BITS 78 | /* __BVIC_PRIO_BITS will be specified when CMSIS is being used. */ 79 | #define SETHW_PRIO_BITS __NVIC_PRIO_BITS 80 | #else 81 | #define SETHW_PRIO_BITS ( 4 ) /* 15 priority levels */ 82 | #endif 83 | 84 | /* The highest interrupt priority that can be used by any interrupt service 85 | routine that makes calls to interrupt safe TINIUX API functions. DO NOT CALL 86 | INTERRUPT SAFE TINIUX API FUNCTIONS FROM ANY INTERRUPT THAT HAS A HIGHER 87 | PRIORITY THAN THIS! (higher priorities are lower numeric values. */ 88 | /* !!!! OSMAX_HWINT_PRI must not be set to zero !!!!*/ 89 | #define OSMAX_HWINT_PRI ( 0x5 << (8 - SETHW_PRIO_BITS) ) /* equivalent to 0x50, or priority 5. */ 90 | /* This is the value being used as per the ST library which permits 16 91 | priority values, 0 to 15. This must correspond to the OSMIN_HWINT_PRI 92 | setting. Here 15 corresponds to the lowest NVIC value of 255. */ 93 | #define OSMIN_HWINT_PRI ( 0xF << (8 - SETHW_PRIO_BITS) ) /* equivalent to 0xF0, or priority 15. */ 94 | 95 | #define FitSVCHandler SVC_Handler 96 | #define FitPendSVHandler PendSV_Handler 97 | #define FitOSTickISR SysTick_Handler 98 | 99 | #endif /* __OS_PRESET_H_ */ 100 | 101 | -------------------------------------------------------------------------------- /Preset/ARM/Cortex_M7/OSPreset.h: -------------------------------------------------------------------------------- 1 | /********************************************************************************************************** 2 | TINIUX - A tiny and efficient embedded real time operating system (RTOS) 3 | Copyright (C) SenseRate.com All rights reserved. 4 | http://www.tiniux.org -- Documentation, latest information, license and contact details. 5 | http://www.tiniux.com -- Commercial support, development, porting, licensing and training services. 6 | -------------------------------------------------------------------------------------------------------- 7 | Redistribution and use in source and binary forms, with or without modification, 8 | are permitted provided that the following conditions are met: 9 | 1. Redistributions of source code must retain the above copyright notice, this list of 10 | conditions and the following disclaimer. 11 | 2. Redistributions in binary form must reproduce the above copyright notice, this list 12 | of conditions and the following disclaimer in the documentation and/or other materials 13 | provided with the distribution. 14 | 3. Neither the name of the copyright holder nor the names of its contributors may be used 15 | to endorse or promote products derived from this software without specific prior written 16 | permission. 17 | -------------------------------------------------------------------------------------------------------- 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 20 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 21 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 22 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 23 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 24 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 25 | OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 26 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 27 | OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 28 | ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | -------------------------------------------------------------------------------------------------------- 30 | Notice of Export Control Law 31 | -------------------------------------------------------------------------------------------------------- 32 | TINIUX may be subject to applicable export control laws and regulations, which might 33 | include those applicable to TINIUX of U.S. and the country in which you are located. 34 | Import, export and usage of TINIUX in any manner by you shall be in compliance with such 35 | applicable export control laws and regulations. 36 | ***********************************************************************************************************/ 37 | 38 | // !!!注:应用程序可以根据需要调整Tiniux系统API接口函数及相关功能模块的开关 !!! 39 | 40 | #ifndef __OS_PRESET_H_ 41 | #define __OS_PRESET_H_ 42 | 43 | /*----------------------------------------------------------- 44 | * Application specific definitions. 45 | * 46 | * These definitions should be adjusted for your particular hardware and 47 | * application requirements. 48 | * 49 | *----------------------------------------------------------*/ 50 | 51 | /* Ensure stdint is only used by the compiler, and not the assembler. */ 52 | #if defined(__ICCARM__) || defined(__CC_ARM) || defined(__GNUC__) 53 | #include 54 | extern uint32_t SystemCoreClock; 55 | #endif 56 | 57 | #define SETOS_CPU_CLOCK_HZ ( SystemCoreClock ) //定义CPU运行主频 (如72000000) 58 | #define SETOS_TICK_RATE_HZ ( 1000 ) //定义TINIUX系统中ticks频率 59 | 60 | #define SETOS_MINIMAL_STACK_SIZE ( 80 ) //定义任务占用的最小Stack空间 61 | #define SETOS_TOTAL_HEAP_SIZE ( 1024*5 ) //定义系统占用的Heap空间 62 | #define SETOS_ENABLE_MEMFREE ( 1 ) //是否允许释放内存,允许后可以在系统运行时删除Task MsgQ Semaphone Mutex Timer等 63 | #define SETOS_LOWPOWER_MODE ( 1 ) //是否开启低功耗模式 64 | #define SETOS_MAX_NAME_LEN ( 10 ) //定义任务、信号量、消息队列等变量中的名称长度 65 | #define SETOS_MAX_PRIORITIES ( 8 ) //定义任务最大优先级 66 | #define SETOS_TASK_SIGNAL_ON ( 1 ) //是否启动轻量级的任务同步信号,功能类似Semaphore MsgQ,内存占用要小于Semaphore MsgQ 67 | #define SETOS_USE_SEMAPHORE ( 1 ) //是否启用系统信号量功能 0关闭 1启用 68 | #define SETOS_USE_MUTEX ( 1 ) //是否启用互斥信号量功能 0关闭 1启用 69 | #define SETOS_USE_MSGQ ( 1 ) //是否启用系统消息队列功能 0关闭 1启用 70 | #define SETOS_MSGQ_MAX_MSGNUM ( 5 ) //定义消息队列中消息的门限值 71 | #define SETOS_USE_TIMER ( 1 ) //是否使用系统软件定时器 72 | #define SETOS_USE_QUICK_SCHEDULE ( 1 ) //是否启动快速调度算法 73 | #define SETOS_TIME_SLICE_ON ( 1 ) //是否启用时间片轮转(time slice)调度机制 74 | #define SETOS_PEND_FOREVER_VALUE ( 0xFFFFFFFFUL )//定义信号量及消息队列中永久等待的数值 75 | 76 | /* Cortex-M specific definitions. */ 77 | #ifdef __NVIC_PRIO_BITS 78 | /* __BVIC_PRIO_BITS will be specified when CMSIS is being used. */ 79 | #define SETHW_PRIO_BITS __NVIC_PRIO_BITS 80 | #else 81 | #define SETHW_PRIO_BITS ( 4 ) /* 15 priority levels */ 82 | #endif 83 | 84 | /* The highest interrupt priority that can be used by any interrupt service 85 | routine that makes calls to interrupt safe TINIUX API functions. DO NOT CALL 86 | INTERRUPT SAFE TINIUX API FUNCTIONS FROM ANY INTERRUPT THAT HAS A HIGHER 87 | PRIORITY THAN THIS! (higher priorities are lower numeric values. */ 88 | /* !!!! OSMAX_HWINT_PRI must not be set to zero !!!!*/ 89 | #define OSMAX_HWINT_PRI ( 0x5 << (8 - SETHW_PRIO_BITS) ) /* equivalent to 0x50, or priority 5. */ 90 | /* This is the value being used as per the ST library which permits 16 91 | priority values, 0 to 15. This must correspond to the OSMIN_HWINT_PRI 92 | setting. Here 15 corresponds to the lowest NVIC value of 255. */ 93 | #define OSMIN_HWINT_PRI ( 0xF << (8 - SETHW_PRIO_BITS) ) /* equivalent to 0xF0, or priority 15. */ 94 | 95 | #define FitSVCHandler SVC_Handler 96 | #define FitPendSVHandler PendSV_Handler 97 | #define FitOSTickISR SysTick_Handler 98 | 99 | #endif /* __OS_PRESET_H_ */ 100 | 101 | -------------------------------------------------------------------------------- /CPU/ARM/IAR/Cortex_M0/FitAsm.s: -------------------------------------------------------------------------------- 1 | /********************************************************************************************************** 2 | TINIUX - A tiny and efficient embedded real time operating system (RTOS) 3 | Copyright (C) SenseRate.com All rights reserved. 4 | http://www.tiniux.org -- Documentation, latest information, license and contact details. 5 | http://www.tiniux.com -- Commercial support, development, porting, licensing and training services. 6 | -------------------------------------------------------------------------------------------------------- 7 | Redistribution and use in source and binary forms, with or without modification, 8 | are permitted provided that the following conditions are met: 9 | 1. Redistributions of source code must retain the above copyright notice, this list of 10 | conditions and the following disclaimer. 11 | 2. Redistributions in binary form must reproduce the above copyright notice, this list 12 | of conditions and the following disclaimer in the documentation and/or other materials 13 | provided with the distribution. 14 | 3. Neither the name of the copyright holder nor the names of its contributors may be used 15 | to endorse or promote products derived from this software without specific prior written 16 | permission. 17 | -------------------------------------------------------------------------------------------------------- 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 20 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 21 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 22 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 23 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 24 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 25 | OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 26 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 27 | OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 28 | ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | -------------------------------------------------------------------------------------------------------- 30 | Notice of Export Control Law 31 | -------------------------------------------------------------------------------------------------------- 32 | TINIUX may be subject to applicable export control laws and regulations, which might 33 | include those applicable to TINIUX of U.S. and the country in which you are located. 34 | Import, export and usage of TINIUX in any manner by you shall be in compliance with such 35 | applicable export control laws and regulations. 36 | ***********************************************************************************************************/ 37 | 38 | #include 39 | 40 | RSEG CODE:CODE(2) 41 | thumb 42 | 43 | EXTERN FitYieldFromISR 44 | EXTERN gptCurrentTCB 45 | EXTERN OSTaskSwitchContext 46 | 47 | PUBLIC vSetMSP 48 | PUBLIC FitPendSVHandler 49 | PUBLIC FitSVCHandler 50 | PUBLIC FitStartFirstTask 51 | PUBLIC FitIntMask 52 | PUBLIC FitIntUnmask 53 | PUBLIC FitGetIPSR 54 | 55 | /*-----------------------------------------------------------*/ 56 | 57 | vSetMSP: 58 | msr msp, r0 59 | bx lr 60 | 61 | /*-----------------------------------------------------------*/ 62 | 63 | FitPendSVHandler: 64 | mrs r0, psp 65 | 66 | ldr r3, =gptCurrentTCB /* Get the location of the current TCB. */ 67 | ldr r2, [r3] 68 | 69 | subs r0, r0, #32 /* Make space for the remaining low registers. */ 70 | str r0, [r2] /* Save the new top of stack. */ 71 | stmia r0!, {r4-r7} /* Store the low registers that are not saved automatically. */ 72 | mov r4, r8 /* Store the high registers. */ 73 | mov r5, r9 74 | mov r6, r10 75 | mov r7, r11 76 | stmia r0!, {r4-r7} 77 | 78 | push {r3, r14} 79 | cpsid i 80 | bl OSTaskSwitchContext 81 | cpsie i 82 | pop {r2, r3} /* lr goes in r3. r2 now holds tcb pointer. */ 83 | 84 | ldr r1, [r2] 85 | ldr r0, [r1] /* The first item in gptCurrentTCB is the task top of stack. */ 86 | adds r0, r0, #16 /* Move to the high registers. */ 87 | ldmia r0!, {r4-r7} /* Pop the high registers. */ 88 | mov r8, r4 89 | mov r9, r5 90 | mov r10, r6 91 | mov r11, r7 92 | 93 | msr psp, r0 /* Remember the new top of stack for the task. */ 94 | 95 | subs r0, r0, #32 /* Go back for the low registers that are not automatically restored. */ 96 | ldmia r0!, {r4-r7} /* Pop low registers. */ 97 | 98 | bx r3 99 | 100 | /*-----------------------------------------------------------*/ 101 | 102 | FitSVCHandler; 103 | /* This function is no longer used, but retained for backward 104 | compatibility. */ 105 | bx lr 106 | 107 | /*-----------------------------------------------------------*/ 108 | 109 | FitStartFirstTask: 110 | /* The MSP stack is not reset as, unlike on M3/4 parts, there is no vector 111 | table offset register that can be used to locate the initial stack value. 112 | Not all M0 parts have the application vector table at address 0. */ 113 | 114 | ldr r3, =gptCurrentTCB /* Obtain location of gptCurrentTCB. */ 115 | ldr r1, [r3] 116 | ldr r0, [r1] /* The first item in gptCurrentTCB is the task top of stack. */ 117 | adds r0, #32 /* Discard everything up to r0. */ 118 | msr psp, r0 /* This is now the new top of stack to use in the task. */ 119 | movs r0, #2 /* Switch to the psp stack. */ 120 | msr CONTROL, r0 121 | isb 122 | pop {r0-r5} /* Pop the registers that are saved automatically. */ 123 | mov lr, r5 /* lr is now in r5. */ 124 | cpsie i /* The first task has its context and interrupts can be enabled. */ 125 | pop {pc} /* Finally, pop the PC to jump to the user defined task code. */ 126 | 127 | /*-----------------------------------------------------------*/ 128 | 129 | FitIntMask: 130 | mrs r0, PRIMASK 131 | cpsid i 132 | bx lr 133 | 134 | /*-----------------------------------------------------------*/ 135 | 136 | FitIntUnmask: 137 | msr PRIMASK, r0 138 | bx lr 139 | 140 | FitGetIPSR: 141 | /* Get IPSR value. */ 142 | mrs r0, IPSR 143 | bx lr 144 | 145 | END 146 | -------------------------------------------------------------------------------- /CPU/ARM/KEIL/Cortex_M7/FitCPU.h: -------------------------------------------------------------------------------- 1 | /********************************************************************************************************** 2 | TINIUX - A tiny and efficient embedded real time operating system (RTOS) 3 | Copyright (C) SenseRate.com All rights reserved. 4 | http://www.tiniux.org -- Documentation, latest information, license and contact details. 5 | http://www.tiniux.com -- Commercial support, development, porting, licensing and training services. 6 | -------------------------------------------------------------------------------------------------------- 7 | Redistribution and use in source and binary forms, with or without modification, 8 | are permitted provided that the following conditions are met: 9 | 1. Redistributions of source code must retain the above copyright notice, this list of 10 | conditions and the following disclaimer. 11 | 2. Redistributions in binary form must reproduce the above copyright notice, this list 12 | of conditions and the following disclaimer in the documentation and/or other materials 13 | provided with the distribution. 14 | 3. Neither the name of the copyright holder nor the names of its contributors may be used 15 | to endorse or promote products derived from this software without specific prior written 16 | permission. 17 | -------------------------------------------------------------------------------------------------------- 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 20 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 21 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 22 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 23 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 24 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 25 | OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 26 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 27 | OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 28 | ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | -------------------------------------------------------------------------------------------------------- 30 | Notice of Export Control Law 31 | -------------------------------------------------------------------------------------------------------- 32 | TINIUX may be subject to applicable export control laws and regulations, which might 33 | include those applicable to TINIUX of U.S. and the country in which you are located. 34 | Import, export and usage of TINIUX in any manner by you shall be in compliance with such 35 | applicable export control laws and regulations. 36 | ***********************************************************************************************************/ 37 | 38 | #ifndef __FIT_CPU_H_ 39 | #define __FIT_CPU_H_ 40 | 41 | #include "OSType.h" 42 | 43 | #ifdef __cplusplus 44 | extern "C" { 45 | #endif 46 | 47 | /* Constants used with memory barrier intrinsics. */ 48 | #define FitSY_FULL_READ_WRITE ( 15 ) 49 | 50 | /*-----------------------------------------------------------*/ 51 | 52 | /* Scheduler utilities. */ 53 | #define FitSchedule() \ 54 | { \ 55 | /* Set a PendSV to request a context switch. */ \ 56 | FitNVIC_INT_CTRL_REG = FitNVIC_PENDSVSET_BIT; \ 57 | \ 58 | /* Barriers are normally not required but do ensure the code is completely \ 59 | within the specified behaviour for the architecture. */ \ 60 | __dsb( FitSY_FULL_READ_WRITE ); \ 61 | __isb( FitSY_FULL_READ_WRITE ); \ 62 | } 63 | /*-----------------------------------------------------------*/ 64 | 65 | #define FitNVIC_INT_CTRL_REG ( * ( ( volatile uOS32_t * ) 0xe000ed04 ) ) 66 | #define FitNVIC_PENDSVSET_BIT ( 1UL << 28UL ) 67 | 68 | /* Determine whether we are in thread mode or handler mode. */ 69 | #define FitIsInsideISR() ( ( uOSBool_t ) ( FitGetIPSR() != ( uOSBase_t )0 ) ) 70 | 71 | #define FitScheduleFromISR( b ) if( b ) FitSchedule() 72 | 73 | extern void FitIntLock( void ); 74 | extern void FitIntUnlock( void ); 75 | extern uOS32_t FitGetIPSR( void ); 76 | 77 | #define FitIntMask() FitRaiseBasePRI() 78 | #define FitIntUnmask( x ) FitSetBasePRI( x ) 79 | 80 | #define FitIntMaskFromISR() FitIntMask() 81 | #define FitIntUnmaskFromISR( x ) FitIntUnmask( x ) 82 | 83 | #if (OSHIGHEAST_PRIORITY<=32U) 84 | #define FITQUICK_GET_PRIORITY ( 1U ) 85 | #define FitGET_HIGHEST_PRIORITY( uxTopPriority, uxReadyPriorities ) uxTopPriority = ( 31 - __clz( ( uxReadyPriorities ) ) ) 86 | #endif 87 | 88 | #ifndef FIT_FORCE_INLINE 89 | #define FIT_FORCE_INLINE __forceinline 90 | #endif 91 | 92 | /*-----------------------------------------------------------*/ 93 | 94 | static FIT_FORCE_INLINE void FitSetBasePRI( uOS32_t ulBASEPRI ) 95 | { 96 | __asm 97 | { 98 | /* Barrier instructions are not used as this function is only used to 99 | lower the BASEPRI value. */ 100 | msr basepri, ulBASEPRI 101 | } 102 | } 103 | 104 | /*-----------------------------------------------------------*/ 105 | 106 | static FIT_FORCE_INLINE uOS32_t FitRaiseBasePRI( void ) 107 | { 108 | uOS32_t ulReturn, ulNewBASEPRI = OSMAX_HWINT_PRI; 109 | 110 | __asm 111 | { 112 | /* Set BASEPRI to the max syscall priority to effect a lock 113 | section. */ 114 | mrs ulReturn, basepri 115 | cpsid i 116 | msr basepri, ulNewBASEPRI 117 | dsb 118 | isb 119 | cpsie i 120 | } 121 | 122 | return ulReturn; 123 | } 124 | 125 | uOSStack_t *FitInitializeStack( uOSStack_t *pxTopOfStack, 126 | OSTaskFunction_t TaskFunction, void *pvParameters ); 127 | uOSBase_t FitStartScheduler( void ); 128 | 129 | void FitPendSVHandler( void ); 130 | void FitOSTickISR( void ); 131 | void FitSVCHandler( void ); 132 | 133 | #if ( OS_LOWPOWER_ON!=0 ) 134 | /* Tickless idle/low power functionality. */ 135 | #ifndef FitLowPowerIdle 136 | extern void FitTicklessIdle( uOSTick_t uxLowPowerTicks ); 137 | #define FitLowPowerIdle( uxLowPowerTicks ) FitTicklessIdle( uxLowPowerTicks ) 138 | #endif 139 | #endif 140 | 141 | #ifdef __cplusplus 142 | } 143 | #endif 144 | 145 | #endif //__FIT_CPU_H_ 146 | -------------------------------------------------------------------------------- /Kernel/OSList.h: -------------------------------------------------------------------------------- 1 | /********************************************************************************************************** 2 | TINIUX - A tiny and efficient embedded real time operating system (RTOS) 3 | Copyright (C) SenseRate.com All rights reserved. 4 | http://www.tiniux.org -- Documentation, latest information, license and contact details. 5 | http://www.tiniux.com -- Commercial support, development, porting, licensing and training services. 6 | -------------------------------------------------------------------------------------------------------- 7 | Redistribution and use in source and binary forms, with or without modification, 8 | are permitted provided that the following conditions are met: 9 | 1. Redistributions of source code must retain the above copyright notice, this list of 10 | conditions and the following disclaimer. 11 | 2. Redistributions in binary form must reproduce the above copyright notice, this list 12 | of conditions and the following disclaimer in the documentation and/or other materials 13 | provided with the distribution. 14 | 3. Neither the name of the copyright holder nor the names of its contributors may be used 15 | to endorse or promote products derived from this software without specific prior written 16 | permission. 17 | -------------------------------------------------------------------------------------------------------- 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 20 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 21 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 22 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 23 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 24 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 25 | OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 26 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 27 | OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 28 | ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | -------------------------------------------------------------------------------------------------------- 30 | Notice of Export Control Law 31 | -------------------------------------------------------------------------------------------------------- 32 | TINIUX may be subject to applicable export control laws and regulations, which might 33 | include those applicable to TINIUX of U.S. and the country in which you are located. 34 | Import, export and usage of TINIUX in any manner by you shall be in compliance with such 35 | applicable export control laws and regulations. 36 | ***********************************************************************************************************/ 37 | 38 | #ifndef __OS_LIST_H_ 39 | #define __OS_LIST_H_ 40 | 41 | #include "OSType.h" 42 | 43 | #ifdef __cplusplus 44 | extern "C" { 45 | #endif 46 | 47 | struct OSListItem 48 | { 49 | // 记录节点顺序 50 | volatile uOSTick_t uxItemValue; 51 | // 指向下一个节点 52 | struct OSListItem * volatile ptNext; 53 | // 指向前一个节点 54 | struct OSListItem * volatile ptPrevious; 55 | // 节点的内容 56 | void * pvHolder; 57 | // 节点所属的链表 58 | void * volatile pvList; 59 | }; 60 | typedef struct OSListItem tOSListItem_t; 61 | 62 | //带有哨兵节点的循环双向链表 63 | typedef struct OSList 64 | { 65 | // 节点的个数 66 | volatile uOSBase_t uxNumberOfItems; 67 | // 当前节点 68 | tOSListItem_t * volatile ptIndex; 69 | // 哨兵节点,始终位于首节点的前面,尾节点的后面 70 | tOSListItem_t tNilItem; 71 | } tOSList_t; 72 | 73 | #define OSListItemSetHolder( ptListItem, pxHolder ) ( ( ptListItem )->pvHolder = ( void * ) ( pxHolder ) ) 74 | #define OSListItemGetHolder( ptListItem ) ( ( ptListItem )->pvHolder ) 75 | #define OSListItemSetValue( ptListItem, xValue ) ( ( ptListItem )->uxItemValue = ( xValue ) ) 76 | #define OSListItemGetValue( ptListItem ) ( ( ptListItem )->uxItemValue ) 77 | #define OSListItemGetNextItem( ptListItem ) ( ( ptListItem )->ptNext ) 78 | #define OSListItemGetList( ptListItem ) ( ( ptListItem )->pvList ) 79 | 80 | #define OSlistGetHeadItemValue( ptList ) ( ( ( ptList )->tNilItem ).ptNext->uxItemValue ) 81 | #define OSListGetHeadItem( ptList ) ( ( ( ptList )->tNilItem ).ptNext ) 82 | #define OSListGetEndMarkerItem( ptList ) ( ( tOSListItem_t const * ) ( &( ( ptList )->tNilItem ) ) ) 83 | #define OSListIsEmpty( ptList ) ( ( uOSBool_t ) ( ( ptList )->uxNumberOfItems == ( uOSBase_t ) 0 ) ) 84 | #define OSListGetLength( ptList ) ( ( ptList )->uxNumberOfItems ) 85 | // 返回下一个节点的内容 86 | #define OSListGetNextItemHolder(ptList, pxHolder) \ 87 | { \ 88 | tOSList_t * const ptConstList = ( ptList ); \ \ 89 | // 将当前节点移到下一个节点,若下一个节点为哨兵节点,则在移动一位。 90 | // 返回下一个节点的内容。 91 | ( ptConstList )->ptIndex = ( ptConstList )->ptIndex->ptNext; \ 92 | if( ( void * ) ( ptConstList )->ptIndex == ( void * ) &( ( ptConstList )->tNilItem ) ) \ 93 | { \ 94 | ( ptConstList )->ptIndex = ( ptConstList )->ptIndex->ptNext; \ 95 | } \ 96 | ( pxHolder ) = ( ptConstList )->ptIndex->pvHolder; \ 97 | } 98 | 99 | #define OSListGetHeadItemHolder( ptList ) ( (&( ( ptList )->tNilItem ))->ptNext->pvHolder ) 100 | #define OSListContainListItem( ptList, ptListItem ) ( ( uOSBool_t ) ( ( ptListItem )->pvList == ( void * ) ( ptList ) ) ) 101 | #define OSListIsInitialised( ptList ) ( ( uOSBool_t ) ( ( ptList )->tNilItem.uxItemValue == OSPEND_FOREVER_VALUE ) ) 102 | 103 | void OSListItemInitialise( tOSListItem_t * const ptListItem ); 104 | 105 | void OSListInit( tOSList_t * const ptList ); 106 | void OSListInsertItem( tOSList_t * const ptList, tOSListItem_t * const ptNewListItem ); 107 | void OSListInsertItemToEnd( tOSList_t * const ptList, tOSListItem_t * const ptNewListItem ); 108 | uOSBase_t OSListRemoveItem( tOSListItem_t * const ptItemToRemove ); 109 | 110 | #ifdef __cplusplus 111 | } 112 | #endif 113 | 114 | #endif //__OS_LIST_H_ 115 | -------------------------------------------------------------------------------- /CPU/ARM/KEIL/Cortex_M4/FitCPU.h: -------------------------------------------------------------------------------- 1 | /********************************************************************************************************** 2 | TINIUX - A tiny and efficient embedded real time operating system (RTOS) 3 | Copyright (C) SenseRate.com All rights reserved. 4 | http://www.tiniux.org -- Documentation, latest information, license and contact details. 5 | http://www.tiniux.com -- Commercial support, development, porting, licensing and training services. 6 | -------------------------------------------------------------------------------------------------------- 7 | Redistribution and use in source and binary forms, with or without modification, 8 | are permitted provided that the following conditions are met: 9 | 1. Redistributions of source code must retain the above copyright notice, this list of 10 | conditions and the following disclaimer. 11 | 2. Redistributions in binary form must reproduce the above copyright notice, this list 12 | of conditions and the following disclaimer in the documentation and/or other materials 13 | provided with the distribution. 14 | 3. Neither the name of the copyright holder nor the names of its contributors may be used 15 | to endorse or promote products derived from this software without specific prior written 16 | permission. 17 | -------------------------------------------------------------------------------------------------------- 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 20 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 21 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 22 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 23 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 24 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 25 | OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 26 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 27 | OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 28 | ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | -------------------------------------------------------------------------------------------------------- 30 | Notice of Export Control Law 31 | -------------------------------------------------------------------------------------------------------- 32 | TINIUX may be subject to applicable export control laws and regulations, which might 33 | include those applicable to TINIUX of U.S. and the country in which you are located. 34 | Import, export and usage of TINIUX in any manner by you shall be in compliance with such 35 | applicable export control laws and regulations. 36 | ***********************************************************************************************************/ 37 | 38 | #ifndef __FIT_CPU_H_ 39 | #define __FIT_CPU_H_ 40 | 41 | #include "OSType.h" 42 | 43 | #ifdef __cplusplus 44 | extern "C" { 45 | #endif 46 | 47 | /* Constants used with memory barrier intrinsics. */ 48 | #define FitSY_FULL_READ_WRITE ( 15 ) 49 | 50 | /* Scheduler utilities. */ 51 | #define FitSchedule() \ 52 | { \ 53 | /* Set a PendSV to request a context switch. */ \ 54 | FitNVIC_INT_CTRL_REG = FitNVIC_PENDSVSET_BIT; \ 55 | \ 56 | /* Barriers are normally not required but do ensure the code is completely \ 57 | within the specified behaviour for the architecture. */ \ 58 | __dsb( FitSY_FULL_READ_WRITE ); \ 59 | __isb( FitSY_FULL_READ_WRITE ); \ 60 | } 61 | /*-----------------------------------------------------------*/ 62 | 63 | #define FitNVIC_INT_CTRL_REG ( * ( ( volatile uOS32_t * ) 0xe000ed04 ) ) 64 | #define FitNVIC_PENDSVSET_BIT ( 1UL << 28UL ) 65 | 66 | /* Determine whether we are in thread mode or handler mode. */ 67 | #define FitIsInsideISR() ( ( uOSBool_t ) ( FitGetIPSR() != ( uOSBase_t )0 ) ) 68 | 69 | #define FitScheduleFromISR( b ) if( b ) FitSchedule() 70 | 71 | extern void FitIntLock( void ); 72 | extern void FitIntUnlock( void ); 73 | extern uOS32_t FitGetIPSR( void ); 74 | 75 | #define FitIntMask() FitRaiseBasePRI() 76 | #define FitIntUnmask( x ) FitSetBasePRI( x ) 77 | 78 | #define FitIntMaskFromISR() FitIntMask() 79 | #define FitIntUnmaskFromISR( x ) FitIntUnmask( x ) 80 | 81 | #if (OSHIGHEAST_PRIORITY<=32U) 82 | #define FITQUICK_GET_PRIORITY ( 1U ) 83 | #define FitGET_HIGHEST_PRIORITY( uxTopPriority, uxReadyPriorities ) uxTopPriority = ( 31 - __clz( ( uxReadyPriorities ) ) ) 84 | #endif 85 | 86 | #ifndef FIT_FORCE_INLINE 87 | #define FIT_FORCE_INLINE __forceinline 88 | #endif 89 | 90 | /*-----------------------------------------------------------*/ 91 | 92 | static FIT_FORCE_INLINE void FitSetBasePRI( uOS32_t ulBASEPRI ) 93 | { 94 | __asm 95 | { 96 | /* Barrier instructions are not used as this function is only used to 97 | lower the BASEPRI value. */ 98 | msr basepri, ulBASEPRI 99 | } 100 | } 101 | /*-----------------------------------------------------------*/ 102 | 103 | static FIT_FORCE_INLINE void FitClearBASEPRIFromISR( void ) 104 | { 105 | __asm 106 | { 107 | /* Set BASEPRI to 0 so no interrupts are masked. This function is only 108 | used to lower the mask in an interrupt, so memory barriers are not 109 | used. */ 110 | msr basepri, #0 111 | } 112 | } 113 | 114 | /*-----------------------------------------------------------*/ 115 | 116 | static FIT_FORCE_INLINE uOS32_t FitRaiseBasePRI( void ) 117 | { 118 | uOS32_t ulReturn, ulNewBASEPRI = OSMAX_HWINT_PRI; 119 | 120 | __asm 121 | { 122 | /* Set BASEPRI to the max syscall priority to effect a lock 123 | section. */ 124 | mrs ulReturn, basepri 125 | msr basepri, ulNewBASEPRI 126 | dsb 127 | isb 128 | } 129 | 130 | return ulReturn; 131 | } 132 | 133 | uOSStack_t *FitInitializeStack( uOSStack_t * pxTopOfStack, 134 | OSTaskFunction_t TaskFunction, 135 | void * pvParameters ); 136 | uOSBase_t FitStartScheduler( void ); 137 | 138 | void FitPendSVHandler( void ); 139 | void FitOSTickISR( void ); 140 | void FitSVCHandler( void ); 141 | 142 | #if ( OS_LOWPOWER_ON!=0 ) 143 | /* Tickless idle/low power functionality. */ 144 | #ifndef FitLowPowerIdle 145 | extern void FitTicklessIdle( uOSTick_t uxLowPowerTicks ); 146 | #define FitLowPowerIdle( uxLowPowerTicks ) FitTicklessIdle( uxLowPowerTicks ) 147 | #endif 148 | #endif 149 | 150 | #ifdef __cplusplus 151 | } 152 | #endif 153 | 154 | #endif //__FIT_CPU_H_ 155 | -------------------------------------------------------------------------------- /CPU/ARM/GCC/Cortex_M4/FitCPU.h: -------------------------------------------------------------------------------- 1 | /********************************************************************************************************** 2 | TINIUX - A tiny and efficient embedded real time operating system (RTOS) 3 | Copyright (C) SenseRate.com All rights reserved. 4 | http://www.tiniux.org -- Documentation, latest information, license and contact details. 5 | http://www.tiniux.com -- Commercial support, development, porting, licensing and training services. 6 | -------------------------------------------------------------------------------------------------------- 7 | Redistribution and use in source and binary forms, with or without modification, 8 | are permitted provided that the following conditions are met: 9 | 1. Redistributions of source code must retain the above copyright notice, this list of 10 | conditions and the following disclaimer. 11 | 2. Redistributions in binary form must reproduce the above copyright notice, this list 12 | of conditions and the following disclaimer in the documentation and/or other materials 13 | provided with the distribution. 14 | 3. Neither the name of the copyright holder nor the names of its contributors may be used 15 | to endorse or promote products derived from this software without specific prior written 16 | permission. 17 | -------------------------------------------------------------------------------------------------------- 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 20 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 21 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 22 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 23 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 24 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 25 | OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 26 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 27 | OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 28 | ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | -------------------------------------------------------------------------------------------------------- 30 | Notice of Export Control Law 31 | -------------------------------------------------------------------------------------------------------- 32 | TINIUX may be subject to applicable export control laws and regulations, which might 33 | include those applicable to TINIUX of U.S. and the country in which you are located. 34 | Import, export and usage of TINIUX in any manner by you shall be in compliance with such 35 | applicable export control laws and regulations. 36 | ***********************************************************************************************************/ 37 | 38 | #ifndef __FIT_CPU_H_ 39 | #define __FIT_CPU_H_ 40 | 41 | #include "OSType.h" 42 | 43 | #ifdef __cplusplus 44 | extern "C" { 45 | #endif 46 | 47 | /* Constants used with memory barrier intrinsics. */ 48 | #define FitSY_FULL_READ_WRITE ( 15 ) 49 | 50 | /* Scheduler utilities. */ 51 | #define FitSchedule() \ 52 | { \ 53 | /* Set a PendSV to request a context switch. */ \ 54 | FitNVIC_INT_CTRL_REG = FitNVIC_PENDSVSET_BIT; \ 55 | \ 56 | /* Barriers are normally not required but do ensure the code is completely \ 57 | within the specified behaviour for the architecture. */ \ 58 | __asm volatile( "dsb" ); \ 59 | __asm volatile( "isb" ); \ 60 | } 61 | /*-----------------------------------------------------------*/ 62 | 63 | #define FitNVIC_INT_CTRL_REG ( * ( ( volatile uOS32_t * ) 0xe000ed04 ) ) 64 | #define FitNVIC_PENDSVSET_BIT ( 1UL << 28UL ) 65 | #define FitScheduleFromISR( b ) if( b ) FitSchedule() 66 | 67 | 68 | /* Critical section management. */ 69 | extern void FitIntLock( void ); 70 | extern void FitIntUnlock( void ); 71 | 72 | #define FitIntMask() FitRaiseBasePRI() 73 | #define FitIntUnmask( x ) FitSetBasePRI( x ) 74 | 75 | #define FitIntMaskFromISR() FitIntMask() 76 | #define FitIntUnmaskFromISR( x ) FitIntUnmask( x ) 77 | 78 | 79 | #ifndef FIT_FORCE_INLINE 80 | #define FIT_FORCE_INLINE inline __attribute__(( always_inline)) 81 | #endif 82 | 83 | #if (OSHIGHEAST_PRIORITY<=32U) 84 | #define FITQUICK_GET_PRIORITY ( 1U ) 85 | /* Generic helper function. */ 86 | static FIT_FORCE_INLINE uOS8_t FitCountLeadingZeros( uint32_t ulBitmap ) 87 | { 88 | uOS8_t ucReturn; 89 | 90 | __asm volatile ( "clz %0, %1" : "=r" ( ucReturn ) : "r" ( ulBitmap ) ); 91 | return ucReturn; 92 | } 93 | #define FitGET_HIGHEST_PRIORITY( uxTopPriority, uxReadyPriorities ) uxTopPriority = ( 31 - FitCountLeadingZeros( ( uxReadyPriorities ) ) ) 94 | #endif 95 | 96 | FIT_FORCE_INLINE uOS32_t FitGetIPSR( void ) 97 | { 98 | uOS32_t ulCurrentInterrupt; 99 | 100 | /* Obtain the number of the currently executing interrupt. */ 101 | __asm volatile 102 | ( 103 | "mrs %0, ipsr" : "=r"( ulCurrentInterrupt ) 104 | ); 105 | 106 | return ulCurrentInterrupt; 107 | } 108 | 109 | /* Determine whether we are in thread mode or handler mode. */ 110 | #define FitIsInsideISR() ( ( uOSBool_t ) ( FitGetIPSR() != ( uOSBase_t )0 ) ) 111 | 112 | /*-----------------------------------------------------------*/ 113 | 114 | static FIT_FORCE_INLINE void FitSetBasePRI( uOS32_t ulBASEPRI ) 115 | { 116 | __asm volatile 117 | ( 118 | " msr basepri, %0 " :: "r" ( ulBASEPRI ) 119 | ); 120 | } 121 | 122 | /*-----------------------------------------------------------*/ 123 | 124 | static FIT_FORCE_INLINE uOS32_t FitRaiseBasePRI( void ) 125 | { 126 | uOS32_t ulOriginalBASEPRI, ulNewBASEPRI; 127 | 128 | __asm volatile 129 | ( 130 | " mrs %0, basepri \n" \ 131 | " mov %1, %2 \n" \ 132 | " msr basepri, %1 \n" \ 133 | " isb \n" \ 134 | " dsb \n" \ 135 | :"=r" (ulOriginalBASEPRI), "=r" (ulNewBASEPRI) : "i" ( OSMAX_HWINT_PRI ) 136 | ); 137 | 138 | /* This return will not be reached but is necessary to prevent compiler 139 | warnings. */ 140 | return ulOriginalBASEPRI; 141 | } 142 | 143 | uOSStack_t *FitInitializeStack( uOSStack_t *pxTopOfStack, OSTaskFunction_t TaskFunction, void *pvParameters ); 144 | uOSBase_t FitStartScheduler( void ); 145 | 146 | void FitPendSVHandler( void ) __attribute__ (( naked )); 147 | void FitOSTickISR( void ); 148 | void FitSVCHandler( void ) __attribute__ (( naked )); 149 | 150 | #if ( OS_LOWPOWER_ON!=0 ) 151 | /* Tickless idle/low power functionality. */ 152 | #ifndef FitLowPowerIdle 153 | extern void FitTicklessIdle( uOSTick_t uxLowPowerTicks ); 154 | #define FitLowPowerIdle( uxLowPowerTicks ) FitTicklessIdle( uxLowPowerTicks ) 155 | #endif 156 | #endif 157 | 158 | #ifdef __cplusplus 159 | } 160 | #endif 161 | 162 | #endif //__FIT_CPU_H_ 163 | --------------------------------------------------------------------------------