mikroSDK Reference Manual
os_port_none.h
Go to the documentation of this file.
1
29#ifndef _OS_PORT_NONE_H
30#define _OS_PORT_NONE_H
31
32//Use dynamic memory allocation for tasks
33#define OS_STATIC_TASK_SUPPORT DISABLED
34
35//Invalid task identifier
36#define OS_INVALID_TASK_ID 0
37//Self task identifier
38#define OS_SELF_TASK_ID 0
39
40//Task priority (normal)
41#ifndef OS_TASK_PRIORITY_NORMAL
42 #define OS_TASK_PRIORITY_NORMAL 0
43#endif
44
45//Task priority (high)
46#ifndef OS_TASK_PRIORITY_HIGH
47 #define OS_TASK_PRIORITY_HIGH 0
48#endif
49
50//Milliseconds to system ticks
51#ifndef OS_MS_TO_SYSTICKS
52 #define OS_MS_TO_SYSTICKS(n) (n)
53#endif
54
55//System ticks to milliseconds
56#ifndef OS_SYSTICKS_TO_MS
57 #define OS_SYSTICKS_TO_MS(n) (n)
58#endif
59
60//Retrieve 64-bit system time (not implemented)
61#ifndef osGetSystemTime64
62 #define osGetSystemTime64() osGetSystemTime()
63#endif
64
65//Task prologue
66#define osEnterTask()
67//Task epilogue
68#define osExitTask()
69
70//Interrupt service routine prologue
71#ifndef osEnterIsr
72 #define osEnterIsr()
73#endif
74
75//Interrupt service routine epilogue
76#ifndef osExitIsr
77 #define osExitIsr(flag) (void) flag
78#endif
79
80//C++ guard
81#ifdef __cplusplus
82extern "C" {
83#endif
84
85
90typedef uint32_t systime_t;
91
92
97typedef uint_t OsTaskId;
98
99
104typedef uint_t OsEvent;
105
106
111typedef uint_t OsSemaphore;
112
113
118typedef uint_t OsMutex;
119
120
125typedef void (*OsTaskCode)(void *param);
126
127//Tick count
128extern volatile systime_t systemTicks;
129
130//Kernel management
131void osInitKernel(void);
132void osStartKernel(void);
133
134//Task management
135OsTaskId osCreateTask(const char_t *name, OsTaskCode taskCode,
136 void *param, size_t stackSize, int_t priority);
137
138void osDeleteTask(OsTaskId taskId);
139void osDelayTask(systime_t delay);
140void osSwitchTask(void);
141void osSuspendAllTasks(void);
142void osResumeAllTasks(void);
143
144//Event management
145bool_t osCreateEvent(OsEvent *event);
146void osDeleteEvent(OsEvent *event);
147void osSetEvent(OsEvent *event);
148void osResetEvent(OsEvent *event);
149bool_t osWaitForEvent(OsEvent *event, systime_t timeout);
150bool_t osSetEventFromIsr(OsEvent *event);
151
152//Semaphore management
153bool_t osCreateSemaphore(OsSemaphore *semaphore, uint_t count);
154void osDeleteSemaphore(OsSemaphore *semaphore);
155bool_t osWaitForSemaphore(OsSemaphore *semaphore, systime_t timeout);
156void osReleaseSemaphore(OsSemaphore *semaphore);
157
158//Mutex management
159bool_t osCreateMutex(OsMutex *mutex);
160void osDeleteMutex(OsMutex *mutex);
161void osAcquireMutex(OsMutex *mutex);
162void osReleaseMutex(OsMutex *mutex);
163
164//System time
165systime_t osGetSystemTime(void);
166
167//Memory management
168void *osAllocMem(size_t size);
169void osFreeMem(void *p);
170
171//C++ guard
172#ifdef __cplusplus
173}
174#endif
175
176#endif
uint_t OsMutex
Mutex object.
Definition os_port_none.h:118
uint_t OsEvent
Event object.
Definition os_port_none.h:104
void(* OsTaskCode)(void *param)
Task routine.
Definition os_port_none.h:125
uint_t OsSemaphore
Semaphore object.
Definition os_port_none.h:111
uint_t OsTaskId
Task identifier.
Definition os_port_none.h:97
uint32_t systime_t
System time.
Definition os_port_none.h:90