PAL
A Platform Abstraction Layer connects the mbed-client with the underlying platform.
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 
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 
125 
131 
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 
176 
184 
194 
206 palStatus_t pal_plat_osMutexWait(palMutexID_t mutexID, uint32_t millisec);
207 
215 
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 
257 
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 
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 
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
palStatus_t pal_plat_osPoolFree(palMemoryPoolID_t memoryPoolID, void *block)
Definition: pal_plat_rtos.c:795
palStatus_t pal_plat_osSemaphoreDelete(palSemaphoreID_t *semaphoreID)
Definition: pal_plat_rtos.c:686
uintptr_t palSemaphoreID_t
Definition: pal_rtos.h:37
void pal_plat_osReboot(void)
Definition: pal_plat_rtos.c:181
Definition: pal_rtos.h:67
uint64_t pal_plat_osKernelSysTick64(void)
palStatus_t pal_plat_osTimerStart(palTimerID_t timerID, uint32_t millisec)
Definition: pal_plat_rtos.c:411
void * pal_plat_osThreadGetLocalStore()
Definition: pal_plat_rtos.c:357
uint64_t pal_plat_osKernelSysTickMicroSec(uint64_t microseconds)
Definition: pal_plat_rtos.c:240
palStatus_t pal_plat_osSemaphoreCreate(uint32_t count, palSemaphoreID_t *semaphoreID)
Definition: pal_plat_rtos.c:603
palStatus_t pal_plat_osSemaphoreWait(palSemaphoreID_t semaphoreID, uint32_t millisec, int32_t *countersAvailable)
Definition: pal_plat_rtos.c:638
enum palTimerType palTimerType_t
Timers types supported in PAL.
palStatus_t pal_plat_osTimerCreate(palTimerFuncPtr function, void *funcArgument, palTimerType_t timerType, palTimerID_t *timerID)
Definition: pal_plat_rtos.c:374
void pal_plat_RTOSDestroy(void)
Definition: pal_plat_rtos.c:206
void * pal_plat_osPoolCAlloc(palMemoryPoolID_t memoryPoolID)
Definition: pal_plat_rtos.c:779
int32_t pal_plat_osAtomicIncrement(int32_t *valuePtr, int32_t increment)
Definition: pal_plat_rtos.c:965
palStatus_t pal_plat_osMessageQueueDestroy(palMessageQID_t *messageQID)
Definition: pal_plat_rtos.c:947
void(* palTimerFuncPtr)(void const *funcArgument)
PAL timer function prototype.
Definition: pal_rtos.h:48
#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
palStatus_t pal_plat_osMutexRelease(palMutexID_t mutexID)
Definition: pal_plat_rtos.c:551
palStatus_t pal_plat_osMessagePut(palMessageQID_t messageQID, uint32_t info, uint32_t timeout)
Definition: pal_plat_rtos.c:886
uintptr_t palMutexID_t
Definition: pal_rtos.h:36
void(* palThreadFuncPtr)(void const *funcArgument)
PAL thread function prototype.
Definition: pal_rtos.h:51
palStatus_t pal_plat_osTimerStop(palTimerID_t timerID)
Definition: pal_plat_rtos.c:436
uintptr_t palMessageQID_t
Definition: pal_rtos.h:39
palStatus_t pal_plat_osDelay(uint32_t milliseconds)
Definition: pal_plat_rtos.c:218
palStatus_t pal_plat_osMutexDelete(palMutexID_t *mutexID)
Definition: pal_plat_rtos.c:576
palStatus_t pal_plat_osPoolDestroy(palMemoryPoolID_t *memoryPoolID)
Definition: pal_plat_rtos.c:820
palStatus_t pal_plat_osMutexCreate(palMutexID_t *mutexID)
Definition: pal_plat_rtos.c:489
enum pal_osPriority palThreadPriority_t
Available priorities in PAL implementation, each priority can appear only once.
palStatus_t pal_plat_osMessageQueueCreate(uint32_t messageQSize, palMessageQID_t *messageQID)
Definition: pal_plat_rtos.c:837
palThreadID_t pal_plat_osThreadGetId()
Definition: pal_plat_rtos.c:315
palStatus_t pal_plat_RTOSInitialize(void *opaqueContext)
Definition: pal_plat_rtos.c:186
uint32_t pal_plat_osKernelSysTick()
Definition: pal_plat_rtos.c:233
uintptr_t palMemoryPoolID_t
Definition: pal_rtos.h:38
uintptr_t palTimerID_t
Definition: pal_rtos.h:35
palStatus_t pal_plat_osSemaphoreRelease(palSemaphoreID_t semaphoreID)
Definition: pal_plat_rtos.c:661
palStatus_t pal_plat_osMutexWait(palMutexID_t mutexID, uint32_t millisec)
Definition: pal_plat_rtos.c:525
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
void * pal_plat_osPoolAlloc(palMemoryPoolID_t memoryPoolID)
Definition: pal_plat_rtos.c:763
uintptr_t palThreadID_t
Primitives IDs types declarations.
Definition: pal_rtos.h:34
palStatus_t pal_plat_osMessageGet(palMessageQID_t messageQID, uint32_t timeout, uint32_t *messageValue)
Definition: pal_plat_rtos.c:911
uint64_t pal_plat_osKernelSysMilliSecTick(uint64_t sysTicks)
Definition: pal_plat_rtos.c:247
uint64_t pal_plat_osKernelSysTickFrequency(void)
Definition: pal_plat_rtos.c:253
int32_t palStatus_t
Definition: pal_types.h:31
palStatus_t pal_plat_osThreadTerminate(palThreadID_t *threadID)
Definition: pal_plat_rtos.c:322
palStatus_t pal_plat_osTimerDelete(palTimerID_t *timerID)
Definition: pal_plat_rtos.c:461
palStatus_t pal_plat_osPoolCreate(uint32_t blockSize, uint32_t blockCount, palMemoryPoolID_t *memoryPoolID)
Definition: pal_plat_rtos.c:713