Webserver+3d print
Embed:
(wiki syntax)
Show/hide line numbers
os_port_ucos3.h
Go to the documentation of this file.
00001 /** 00002 * @file os_port_ucos3.h 00003 * @brief RTOS abstraction layer (Micrium uC/OS-III) 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_UCOS3_H 00028 #define _OS_PORT_UCOS3_H 00029 00030 //Dependencies 00031 #include "os.h" 00032 00033 //Task priority (normal) 00034 #ifndef OS_TASK_PRIORITY_NORMAL 00035 #define OS_TASK_PRIORITY_NORMAL (OS_CFG_PRIO_MAX - 2) 00036 #endif 00037 00038 //Task priority (high) 00039 #ifndef OS_TASK_PRIORITY_HIGH 00040 #define OS_TASK_PRIORITY_HIGH (OS_CFG_PRIO_MAX - 3) 00041 #endif 00042 00043 //Maximum number of tasks that can be dynamically created 00044 #ifndef OS_PORT_MAX_TASKS 00045 #define OS_PORT_MAX_TASKS 16 00046 #elif (OS_PORT_MAX_TASKS < 1) 00047 #error OS_PORT_MAX_TASKS parameter is not valid 00048 #endif 00049 00050 //Milliseconds to system ticks 00051 #ifndef OS_MS_TO_SYSTICKS 00052 #define OS_MS_TO_SYSTICKS(n) (n) 00053 #endif 00054 00055 //System ticks to milliseconds 00056 #ifndef OS_SYSTICKS_TO_MS 00057 #define OS_SYSTICKS_TO_MS(n) (n) 00058 #endif 00059 00060 //Enter interrupt service routine 00061 #define osEnterIsr() OSIntEnter() 00062 00063 //Leave interrupt service routine 00064 #define osExitIsr(flag) OSIntExit() 00065 00066 00067 /** 00068 * @brief Task object 00069 **/ 00070 00071 typedef OS_TCB OsTask; 00072 00073 00074 /** 00075 * @brief Event object 00076 **/ 00077 00078 typedef OS_FLAG_GRP OsEvent; 00079 00080 00081 /** 00082 * @brief Semaphore object 00083 **/ 00084 00085 typedef OS_SEM OsSemaphore; 00086 00087 00088 /** 00089 * @brief Mutex object 00090 **/ 00091 00092 typedef OS_MUTEX OsMutex; 00093 00094 00095 /** 00096 * @brief Task routine 00097 **/ 00098 00099 typedef void (*OsTaskCode)(void *params); 00100 00101 00102 //Kernel management 00103 void osInitKernel(void); 00104 void osStartKernel(void); 00105 00106 //Task management 00107 bool_t osCreateStaticTask(OsTask *task, const char_t *name, OsTaskCode taskCode, 00108 void *params, void *stack, size_t stackSize, int_t priority); 00109 00110 OsTask *osCreateTask(const char_t *name, OsTaskCode taskCode, 00111 void *params, size_t stackSize, int_t priority); 00112 00113 void osDeleteTask(OsTask *task); 00114 void osDelayTask(systime_t delay); 00115 void osSwitchTask(void); 00116 void osSuspendAllTasks(void); 00117 void osResumeAllTasks(void); 00118 00119 //Event management 00120 bool_t osCreateEvent(OsEvent *event); 00121 void osDeleteEvent(OsEvent *event); 00122 void osSetEvent(OsEvent *event); 00123 void osResetEvent(OsEvent *event); 00124 bool_t osWaitForEvent(OsEvent *event, systime_t timeout); 00125 bool_t osSetEventFromIsr(OsEvent *event); 00126 00127 //Semaphore management 00128 bool_t osCreateSemaphore(OsSemaphore *semaphore, uint_t count); 00129 void osDeleteSemaphore(OsSemaphore *semaphore); 00130 bool_t osWaitForSemaphore(OsSemaphore *semaphore, systime_t timeout); 00131 void osReleaseSemaphore(OsSemaphore *semaphore); 00132 00133 //Mutex management 00134 bool_t osCreateMutex(OsMutex *mutex); 00135 void osDeleteMutex(OsMutex *mutex); 00136 void osAcquireMutex(OsMutex *mutex); 00137 void osReleaseMutex(OsMutex *mutex); 00138 00139 //System time 00140 systime_t osGetSystemTime(void); 00141 00142 //Memory management 00143 void *osAllocMem(size_t size); 00144 void osFreeMem(void *p); 00145 00146 //Undefine conflicting definitions 00147 #undef TRACE_LEVEL_OFF 00148 #undef TRACE_LEVEL_INFO 00149 00150 #endif 00151
Generated on Tue Jul 12 2022 17:10:15 by
