PAL A Platform Abstraction Layer connects the mbed-client with the underlying platform.

- Main Page
- Data Structures
- Files

- File List
- Globals

pal_plat_rtos.h
Go to the documentation of this file.
1 /*
2 * Copyright (c) 2016 ARM Limited. All rights reserved.
3 * SPDX-License-Identifier: Apache-2.0
4 * Licensed under the Apache License, Version 2.0 (the License); you may
5 * not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an AS IS BASIS, WITHOUT
12 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17
18 #ifndef _PAL_PLAT_RTOS_H
19 #define _PAL_PLAT_RTOS_H
20
21 #ifdef __cplusplus
22 extern "C" {
23 #endif
24
25 #include "pal_rtos.h"
26 #include "pal_configuration.h"
27 #include "pal_types.h"
28
29 #if PAL_UNIQUE_THREAD_PRIORITY
30
45 extern uint8_t g_palThreadPriorities[PAL_MAX_NUMBER_OF_THREADS];
46
47 #define PRIORYT_INDEX_OFFSET 3
48 #endif //PAL_UNIQUE_THREAD_PRIORITY
49
52 void pal_plat_osReboot(void);
53
59 palStatus_t pal_plat_RTOSInitialize(void* opaqueContext);
60
63 void pal_plat_RTOSDestroy(void);
64
72 uint32_t pal_plat_osKernelSysTick();
73
80 uint64_t pal_plat_osKernelSysTick64(void); // optional API - not part of original CMSIS API.
81
85 uint64_t pal_plat_osKernelSysTickMicroSec(uint64_t microseconds);
86
93 uint64_t pal_plat_osKernelSysMilliSecTick(uint64_t sysTicks);
94
98 uint64_t pal_plat_osKernelSysTickFrequency(void);
99
116 palStatus_t pal_plat_osThreadCreate(palThreadFuncPtr function, void* funcArgument, palThreadPriority_t priority, uint32_t stackSize, uint32_t* stackPtr, palThreadLocalStore_t* store, palThreadID_t* threadID);
117
124 palStatus_t pal_plat_osThreadTerminate(palThreadID_t* threadID);
125
130 palThreadID_t pal_plat_osThreadGetId();
131
135 void* pal_plat_osThreadGetLocalStore();
136
143 palStatus_t pal_plat_osDelay(uint32_t milliseconds);
144
158 palStatus_t pal_plat_osTimerCreate(palTimerFuncPtr function, void* funcArgument, palTimerType_t timerType, palTimerID_t* timerID);
159
167 palStatus_t pal_plat_osTimerStart(palTimerID_t timerID, uint32_t millisec);
168
175 palStatus_t pal_plat_osTimerStop(palTimerID_t timerID);
176
183 palStatus_t pal_plat_osTimerDelete(palTimerID_t* timerID);
184
193 palStatus_t pal_plat_osMutexCreate(palMutexID_t* mutexID);
194
206 palStatus_t pal_plat_osMutexWait(palMutexID_t mutexID, uint32_t millisec);
207
214 palStatus_t pal_plat_osMutexRelease(palMutexID_t mutexID);
215
226 palStatus_t pal_plat_osMutexDelete(palMutexID_t* mutexID);
227
237 palStatus_t pal_plat_osSemaphoreCreate(uint32_t count, palSemaphoreID_t* semaphoreID);
238
248 palStatus_t pal_plat_osSemaphoreWait(palSemaphoreID_t semaphoreID, uint32_t millisec, int32_t* countersAvailable);
249
256 palStatus_t pal_plat_osSemaphoreRelease(palSemaphoreID_t semaphoreID);
257
267 palStatus_t pal_plat_osSemaphoreDelete(palSemaphoreID_t* semaphoreID);
268
279 palStatus_t pal_plat_osPoolCreate(uint32_t blockSize, uint32_t blockCount, palMemoryPoolID_t* memoryPoolID);
280
287 void* pal_plat_osPoolAlloc(palMemoryPoolID_t memoryPoolID);
288
295 void* pal_plat_osPoolCAlloc(palMemoryPoolID_t memoryPoolID);
296
304 palStatus_t pal_plat_osPoolFree(palMemoryPoolID_t memoryPoolID, void* block);
305
312 palStatus_t pal_plat_osPoolDestroy(palMemoryPoolID_t* memoryPoolID);
313
323 palStatus_t pal_plat_osMessageQueueCreate(uint32_t messageQSize, palMessageQID_t* messageQID);
324
333 palStatus_t pal_plat_osMessagePut(palMessageQID_t messageQID, uint32_t info, uint32_t timeout);
334
346 palStatus_t pal_plat_osMessageGet(palMessageQID_t messageQID, uint32_t timeout, uint32_t* messageValue);
347
354 palStatus_t pal_plat_osMessageQueueDestroy(palMessageQID_t* messageQID);
355
363 int32_t pal_plat_osAtomicIncrement(int32_t* valuePtr, int32_t increment);
364
365 #ifdef DEBUG
366 #include "stdio.h"
367 #define pal_plat_printf(ARGS...) printf(ARGS)
368 #define pal_plat_vprintf(FORMAT,LIST) vprintf(FORMAT,LIST)
369
370 #endif
371 #ifdef __cplusplus
372 }
373 #endif
374 #endif //_PAL_COMMON_H
pal_plat_osPoolFree
palStatus_t pal_plat_osPoolFree(palMemoryPoolID_t memoryPoolID, void *block)
Definition: pal_plat_rtos.c:795
pal_plat_osSemaphoreDelete
palStatus_t pal_plat_osSemaphoreDelete(palSemaphoreID_t *semaphoreID)
Definition: pal_plat_rtos.c:686
palSemaphoreID_t
uintptr_t palSemaphoreID_t
Definition: pal_rtos.h:37
pal_plat_osReboot
void pal_plat_osReboot(void)
Definition: pal_plat_rtos.c:181
pal_threadLocalStore
Definition: pal_rtos.h:67
pal_plat_osKernelSysTick64
uint64_t pal_plat_osKernelSysTick64(void)
pal_plat_osTimerStart
palStatus_t pal_plat_osTimerStart(palTimerID_t timerID, uint32_t millisec)
Definition: pal_plat_rtos.c:411
pal_plat_osThreadGetLocalStore
void * pal_plat_osThreadGetLocalStore()
Definition: pal_plat_rtos.c:357
pal_plat_osKernelSysTickMicroSec
uint64_t pal_plat_osKernelSysTickMicroSec(uint64_t microseconds)
Definition: pal_plat_rtos.c:240
pal_plat_osSemaphoreCreate
palStatus_t pal_plat_osSemaphoreCreate(uint32_t count, palSemaphoreID_t *semaphoreID)
Definition: pal_plat_rtos.c:603
pal_plat_osSemaphoreWait
palStatus_t pal_plat_osSemaphoreWait(palSemaphoreID_t semaphoreID, uint32_t millisec, int32_t *countersAvailable)
Definition: pal_plat_rtos.c:638
palTimerType_t
enum palTimerType palTimerType_t
Timers types supported in PAL.
pal_plat_osTimerCreate
palStatus_t pal_plat_osTimerCreate(palTimerFuncPtr function, void *funcArgument, palTimerType_t timerType, palTimerID_t *timerID)
Definition: pal_plat_rtos.c:374
pal_plat_RTOSDestroy
void pal_plat_RTOSDestroy(void)
Definition: pal_plat_rtos.c:206
pal_plat_osPoolCAlloc
void * pal_plat_osPoolCAlloc(palMemoryPoolID_t memoryPoolID)
Definition: pal_plat_rtos.c:779
pal_plat_osAtomicIncrement
int32_t pal_plat_osAtomicIncrement(int32_t *valuePtr, int32_t increment)
Definition: pal_plat_rtos.c:965
pal_configuration.h
pal_plat_osMessageQueueDestroy
palStatus_t pal_plat_osMessageQueueDestroy(palMessageQID_t *messageQID)
Definition: pal_plat_rtos.c:947
palTimerFuncPtr
void(* palTimerFuncPtr)(void const *funcArgument)
PAL timer function prototype.
Definition: pal_rtos.h:48
PAL_MAX_NUMBER_OF_THREADS
#define PAL_MAX_NUMBER_OF_THREADS
number of valid priorities limits the number of threads- if priorities are added this value should be...
Definition: pal_configuration.h:34
pal_rtos.h
pal_plat_osMutexRelease
palStatus_t pal_plat_osMutexRelease(palMutexID_t mutexID)
Definition: pal_plat_rtos.c:551
pal_plat_osMessagePut
palStatus_t pal_plat_osMessagePut(palMessageQID_t messageQID, uint32_t info, uint32_t timeout)
Definition: pal_plat_rtos.c:886
palMutexID_t
uintptr_t palMutexID_t
Definition: pal_rtos.h:36
palThreadFuncPtr
void(* palThreadFuncPtr)(void const *funcArgument)
PAL thread function prototype.
Definition: pal_rtos.h:51
pal_plat_osTimerStop
palStatus_t pal_plat_osTimerStop(palTimerID_t timerID)
Definition: pal_plat_rtos.c:436
palMessageQID_t
uintptr_t palMessageQID_t
Definition: pal_rtos.h:39
pal_plat_osDelay
palStatus_t pal_plat_osDelay(uint32_t milliseconds)
Definition: pal_plat_rtos.c:218
pal_plat_osMutexDelete
palStatus_t pal_plat_osMutexDelete(palMutexID_t *mutexID)
Definition: pal_plat_rtos.c:576
pal_plat_osPoolDestroy
palStatus_t pal_plat_osPoolDestroy(palMemoryPoolID_t *memoryPoolID)
Definition: pal_plat_rtos.c:820
pal_plat_osMutexCreate
palStatus_t pal_plat_osMutexCreate(palMutexID_t *mutexID)
Definition: pal_plat_rtos.c:489
pal_types.h
palThreadPriority_t
enum pal_osPriority palThreadPriority_t
Available priorities in PAL implementation, each priority can appear only once.
pal_plat_osMessageQueueCreate
palStatus_t pal_plat_osMessageQueueCreate(uint32_t messageQSize, palMessageQID_t *messageQID)
Definition: pal_plat_rtos.c:837
pal_plat_osThreadGetId
palThreadID_t pal_plat_osThreadGetId()
Definition: pal_plat_rtos.c:315
pal_plat_RTOSInitialize
palStatus_t pal_plat_RTOSInitialize(void *opaqueContext)
Definition: pal_plat_rtos.c:186
pal_plat_osKernelSysTick
uint32_t pal_plat_osKernelSysTick()
Definition: pal_plat_rtos.c:233
palMemoryPoolID_t
uintptr_t palMemoryPoolID_t
Definition: pal_rtos.h:38
palTimerID_t
uintptr_t palTimerID_t
Definition: pal_rtos.h:35
pal_plat_osSemaphoreRelease
palStatus_t pal_plat_osSemaphoreRelease(palSemaphoreID_t semaphoreID)
Definition: pal_plat_rtos.c:661
pal_plat_osMutexWait
palStatus_t pal_plat_osMutexWait(palMutexID_t mutexID, uint32_t millisec)
Definition: pal_plat_rtos.c:525
pal_plat_osThreadCreate
palStatus_t pal_plat_osThreadCreate(palThreadFuncPtr function, void *funcArgument, palThreadPriority_t priority, uint32_t stackSize, uint32_t *stackPtr, palThreadLocalStore_t *store, palThreadID_t *threadID)
Definition: pal_plat_rtos.c:258
pal_plat_osPoolAlloc
void * pal_plat_osPoolAlloc(palMemoryPoolID_t memoryPoolID)
Definition: pal_plat_rtos.c:763
palThreadID_t
uintptr_t palThreadID_t
Primitives IDs types declarations.
Definition: pal_rtos.h:34
pal_plat_osMessageGet
palStatus_t pal_plat_osMessageGet(palMessageQID_t messageQID, uint32_t timeout, uint32_t *messageValue)
Definition: pal_plat_rtos.c:911
pal_plat_osKernelSysMilliSecTick
uint64_t pal_plat_osKernelSysMilliSecTick(uint64_t sysTicks)
Definition: pal_plat_rtos.c:247
pal_plat_osKernelSysTickFrequency
uint64_t pal_plat_osKernelSysTickFrequency(void)
Definition: pal_plat_rtos.c:253
palStatus_t
int32_t palStatus_t
Definition: pal_types.h:31
pal_plat_osThreadTerminate
palStatus_t pal_plat_osThreadTerminate(palThreadID_t *threadID)
Definition: pal_plat_rtos.c:322
pal_plat_osTimerDelete
palStatus_t pal_plat_osTimerDelete(palTimerID_t *timerID)
Definition: pal_plat_rtos.c:461
pal_plat_osPoolCreate
palStatus_t pal_plat_osPoolCreate(uint32_t blockSize, uint32_t blockCount, palMemoryPoolID_t *memoryPoolID)
Definition: pal_plat_rtos.c:713