Webserver+3d print
Embed:
(wiki syntax)
Show/hide line numbers
os_port.h
Go to the documentation of this file.
00001 /** 00002 * @file os_port.h 00003 * @brief RTOS abstraction layer 00004 * 00005 * @section License 00006 * 00007 * Copyright (C) 2010-2017 Oryx Embedded SARL. All rights reserved. 00008 * 00009 * This program is free software; you can redistribute it and/or 00010 * modify it under the terms of the GNU General Public License 00011 * as published by the Free Software Foundation; either version 2 00012 * of the License, or (at your option) any later version. 00013 * 00014 * This program is distributed in the hope that it will be useful, 00015 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00016 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00017 * GNU General Public License for more details. 00018 * 00019 * You should have received a copy of the GNU General Public License 00020 * along with this program; if not, write to the Free Software Foundation, 00021 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 00022 * 00023 * @author Oryx Embedded SARL (www.oryx-embedded.com) 00024 * @version 1.7.6 00025 **/ 00026 00027 #ifndef _OS_PORT_H 00028 #define _OS_PORT_H 00029 00030 //Dependencies 00031 #include "os_port_config.h" 00032 #include "compiler_port.h" 00033 00034 //Compilation flags used to enable/disable features 00035 #define ENABLED 1 00036 #define DISABLED 0 00037 00038 #define PTR_OFFSET(addr, offset) ((void *) ((uint8_t *) (addr) + (offset))) 00039 00040 #define timeCompare(t1, t2) ((int32_t) ((t1) - (t2))) 00041 00042 //Miscellaneous macros 00043 #ifndef FALSE 00044 #define FALSE 0 00045 #endif 00046 00047 #ifndef TRUE 00048 #define TRUE 1 00049 #endif 00050 00051 #ifndef LSB 00052 #define LSB(x) ((x) & 0xFF) 00053 #endif 00054 00055 #ifndef MSB 00056 #define MSB(x) (((x) >> 8) & 0xFF) 00057 #endif 00058 00059 #ifndef MIN 00060 #define MIN(a, b) ((a) < (b) ? (a) : (b)) 00061 #endif 00062 00063 #ifndef MAX 00064 #define MAX(a, b) ((a) > (b) ? (a) : (b)) 00065 #endif 00066 00067 #ifndef arraysize 00068 #define arraysize(a) (sizeof(a) / sizeof(a[0])) 00069 #endif 00070 00071 //Infinite delay 00072 #define INFINITE_DELAY ((uint_t) -1) 00073 //Maximum delay 00074 #define MAX_DELAY (INFINITE_DELAY / 2) 00075 00076 //Invalid handle value 00077 #define OS_INVALID_HANDLE NULL 00078 00079 //No RTOS? 00080 #if defined(USE_NO_RTOS) 00081 #include "os_port_none.h" 00082 //ChibiOS/RT port? 00083 #elif defined(USE_CHIBIOS) 00084 #include "os_port_chibios.h" 00085 //CMSIS-RTOS port? 00086 #elif defined(USE_CMSIS_RTOS) 00087 #include "os_port_cmsis_rtos.h" 00088 //CMSIS-RTOS2 port? 00089 #elif defined(USE_CMSIS_RTOS2) 00090 #include "os_port_cmsis_rtos2.h" 00091 //FreeRTOS port? 00092 #elif defined(USE_FREERTOS) 00093 #include "os_port_freertos.h" 00094 //Keil RTX port? 00095 #elif defined(USE_RTX) 00096 #include "os_port_rtx.h" 00097 //Micrium uC/OS-II port? 00098 #elif defined(USE_UCOS2) 00099 #include "os_port_ucos2.h" 00100 //Micrium uC/OS-III port? 00101 #elif defined(USE_UCOS3) 00102 #include "os_port_ucos3.h" 00103 //Nut/OS port? 00104 #elif defined(USE_NUTOS) 00105 #include "os_port_nutos.h" 00106 //Segger embOS port? 00107 #elif defined(USE_EMBOS) 00108 #include "os_port_embos.h" 00109 //TI SYS/BIOS port? 00110 #elif defined(USE_SYS_BIOS) 00111 #include "os_port_sys_bios.h" 00112 //Windows port? 00113 #elif defined(_WIN32) 00114 #include "os_port_windows.h" 00115 #endif 00116 00117 //Delay routines 00118 #ifndef usleep 00119 #define usleep(delay) {volatile uint32_t n = delay * 4; while(n > 0) n--;} 00120 #endif 00121 00122 #ifndef sleep 00123 #define sleep(delay) {volatile uint32_t n = delay * 4000; while(n > 0) n--;} 00124 #endif 00125 00126 #endif 00127
Generated on Tue Jul 12 2022 17:10:15 by
