Webserver+3d print

Dependents:   Nucleo

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers os_port_windows.h Source File

os_port_windows.h

Go to the documentation of this file.
00001 /**
00002  * @file os_port_windows.h
00003  * @brief RTOS abstraction layer (Windows)
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_WINDOWS_H
00028 #define _OS_PORT_WINDOWS_H
00029 
00030 //Task priority (normal)
00031 #ifndef OS_TASK_PRIORITY_NORMAL
00032    #define OS_TASK_PRIORITY_NORMAL 0
00033 #endif
00034 
00035 //Task priority (high)
00036 #ifndef OS_TASK_PRIORITY_HIGH
00037    #define OS_TASK_PRIORITY_HIGH 0
00038 #endif
00039 
00040 //Milliseconds to system ticks
00041 #ifndef OS_MS_TO_SYSTICKS
00042    #define OS_MS_TO_SYSTICKS(n) (n)
00043 #endif
00044 
00045 //System ticks to milliseconds
00046 #ifndef OS_SYSTICKS_TO_MS
00047    #define OS_SYSTICKS_TO_MS(n) (n)
00048 #endif
00049 
00050 //Enter interrupt service routine
00051 #define osEnterIsr()
00052 
00053 //Leave interrupt service routine
00054 #define osExitIsr(flag)
00055 
00056 
00057 /**
00058  * @brief Task object
00059  **/
00060 
00061 typedef void OsTask;
00062 
00063 
00064 /**
00065  * @brief Event object
00066  **/
00067 
00068 typedef struct
00069 {
00070    void *handle;
00071 } OsEvent;
00072 
00073 
00074 /**
00075  * @brief Semaphore object
00076  **/
00077 
00078 typedef struct
00079 {
00080    void *handle;
00081 } OsSemaphore;
00082 
00083 
00084 /**
00085  * @brief Mutex object
00086  **/
00087 
00088 typedef struct
00089 {
00090    void *handle;
00091 } OsMutex;
00092 
00093 
00094 /**
00095  * @brief Task routine
00096  **/
00097 
00098 typedef void (*OsTaskCode)(void *params);
00099 
00100 
00101 //Kernel management
00102 void osInitKernel(void);
00103 void osStartKernel(void);
00104 
00105 //Task management
00106 OsTask *osCreateTask(const char_t *name, OsTaskCode taskCode,
00107    void *params, size_t stackSize, int_t priority);
00108 
00109 void osDeleteTask(OsTask *task);
00110 void osDelayTask(systime_t delay);
00111 void osSwitchTask(void);
00112 void osSuspendAllTasks(void);
00113 void osResumeAllTasks(void);
00114 
00115 //Event management
00116 bool_t osCreateEvent(OsEvent *event);
00117 void osDeleteEvent(OsEvent *event);
00118 void osSetEvent(OsEvent *event);
00119 void osResetEvent(OsEvent *event);
00120 bool_t osWaitForEvent(OsEvent *event, systime_t timeout);
00121 bool_t osSetEventFromIsr(OsEvent *event);
00122 
00123 //Semaphore management
00124 bool_t osCreateSemaphore(OsSemaphore *semaphore, uint_t count);
00125 void osDeleteSemaphore(OsSemaphore *semaphore);
00126 bool_t osWaitForSemaphore(OsSemaphore *semaphore, systime_t timeout);
00127 void osReleaseSemaphore(OsSemaphore *semaphore);
00128 
00129 //Mutex management
00130 bool_t osCreateMutex(OsMutex *mutex);
00131 void osDeleteMutex(OsMutex *mutex);
00132 void osAcquireMutex(OsMutex *mutex);
00133 void osReleaseMutex(OsMutex *mutex);
00134 
00135 //System time
00136 systime_t osGetSystemTime(void);
00137 
00138 //Memory management
00139 void *osAllocMem(size_t size);
00140 void osFreeMem(void *p);
00141 
00142 //Miscellaneous definitions
00143 #define strlwr _strlwr
00144 #define strcasecmp _stricmp
00145 #define strncasecmp _strnicmp
00146 #define strtok_r(str, delim, p) strtok(str, delim)
00147 
00148 #endif
00149