Dependents:   Nucleo

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers os_port_none.h Source File

os_port_none.h

Go to the documentation of this file.
00001 /**
00002  * @file os_port_none.h
00003  * @brief RTOS-less environment
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_NONE_H
00028 #define _OS_PORT_NONE_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 #ifndef osEnterIsr
00052    #define osEnterIsr()
00053 #endif
00054 
00055 //Leave interrupt service routine
00056 #ifndef osExitIsr
00057    #define osExitIsr(flag) (void) flag
00058 #endif
00059 
00060 
00061 /**
00062  * @brief Task object
00063  **/
00064 
00065 typedef void OsTask;
00066 
00067 
00068 /**
00069  * @brief Event object
00070  **/
00071 
00072 typedef uint_t OsEvent;
00073 
00074 
00075 /**
00076  * @brief Semaphore object
00077  **/
00078 
00079 typedef uint_t OsSemaphore;
00080 
00081 
00082 /**
00083  * @brief Mutex object
00084  **/
00085 
00086 typedef uint_t OsMutex;
00087 
00088 
00089 /**
00090  * @brief Task routine
00091  **/
00092 
00093 typedef void (*OsTaskCode)(void *params);
00094 
00095 //Tick count
00096 extern systime_t systemTicks;
00097 
00098 //Kernel management
00099 void osInitKernel(void);
00100 void osStartKernel(void);
00101 
00102 //Task management
00103 OsTask *osCreateTask(const char_t *name, OsTaskCode taskCode,
00104    void *params, size_t stackSize, int_t priority);
00105 
00106 void osDeleteTask(OsTask *task);
00107 void osDelayTask(systime_t delay);
00108 void osSwitchTask(void);
00109 void osSuspendAllTasks(void);
00110 void osResumeAllTasks(void);
00111 
00112 //Event management
00113 bool_t osCreateEvent(OsEvent *event);
00114 void osDeleteEvent(OsEvent *event);
00115 void osSetEvent(OsEvent *event);
00116 void osResetEvent(OsEvent *event);
00117 bool_t osWaitForEvent(OsEvent *event, systime_t timeout);
00118 bool_t osSetEventFromIsr(OsEvent *event);
00119 
00120 //Semaphore management
00121 bool_t osCreateSemaphore(OsSemaphore *semaphore, uint_t count);
00122 void osDeleteSemaphore(OsSemaphore *semaphore);
00123 bool_t osWaitForSemaphore(OsSemaphore *semaphore, systime_t timeout);
00124 void osReleaseSemaphore(OsSemaphore *semaphore);
00125 
00126 //Mutex management
00127 bool_t osCreateMutex(OsMutex *mutex);
00128 void osDeleteMutex(OsMutex *mutex);
00129 void osAcquireMutex(OsMutex *mutex);
00130 void osReleaseMutex(OsMutex *mutex);
00131 
00132 //System time
00133 systime_t osGetSystemTime(void);
00134 
00135 //Memory management
00136 void *osAllocMem(size_t size);
00137 void osFreeMem(void *p);
00138 
00139 #endif
00140