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