Mistake on this page? Email us
pal_plat_rtos.h
Go to the documentation of this file.
1 /*******************************************************************************
2  * Copyright 2016, 2017 ARM Ltd.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may 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,
12  * WITHOUT 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.h"
26 
27 
37 void pal_plat_osReboot(void);
38 
42 
49 palStatus_t pal_plat_RTOSInitialize(void* opaqueContext);
50 
54 
64 uint64_t pal_plat_osKernelSysTick(void);
65 
71 uint64_t pal_plat_osKernelSysTickMicroSec(uint64_t microseconds);
72 
79 
91 palStatus_t pal_plat_osThreadCreate(palThreadFuncPtr function, void* funcArgument, palThreadPriority_t priority, uint32_t stackSize, palThreadID_t* threadID);
92 
101 
106 
113 palStatus_t pal_plat_osDelay(uint32_t milliseconds);
114 
128 palStatus_t pal_plat_osTimerCreate(palTimerFuncPtr function, void* funcArgument, palTimerType_t timerType, palTimerID_t* timerID);
129 
138 palStatus_t pal_plat_osTimerStart(palTimerID_t timerID, uint32_t millisec);
139 
147 
156 
167 
179 palStatus_t pal_plat_osMutexWait(palMutexID_t mutexID, uint32_t millisec);
180 
188 
200 
210 palStatus_t pal_plat_osSemaphoreCreate(uint32_t count, palSemaphoreID_t* semaphoreID);
211 
221 palStatus_t pal_plat_osSemaphoreWait(palSemaphoreID_t semaphoreID, uint32_t millisec, int32_t* countersAvailable);
222 
230 
241 
242 
250 int32_t pal_plat_osAtomicIncrement(int32_t* valuePtr, int32_t increment);
251 
258 void *pal_plat_malloc(size_t len);
259 
266 void pal_plat_free(void * buffer);
267 
268 
277 palStatus_t pal_plat_osGetRoTFromHW(uint8_t *keyBuf, size_t keyLenBytes);
278 
286 palStatus_t pal_plat_osSetRtcTime(uint64_t rtcSetTime);
287 
295 palStatus_t pal_plat_osGetRtcTime(uint64_t *rtcGetTime);
296 
297 
304 
305 
312 
313 #ifdef __cplusplus
314 }
315 #endif
316 #endif //_PAL_PLAT_RTOS_H
palStatus_t pal_plat_osSemaphoreDelete(palSemaphoreID_t *semaphoreID)
Delete a semaphore object.
PAL. This file contains the general API to initiate and destroy the PAL component. This is part of the PAL service API.
palStatus_t pal_plat_rtcDeInit(void)
This function deinitializes the realt-time clock (RTC) module.
uintptr_t palSemaphoreID_t
Definition: pal_rtos.h:52
void pal_plat_osReboot(void)
Initiate a system reboot.
palStatus_t pal_plat_osTimerStart(palTimerID_t timerID, uint32_t millisec)
Start or restart a timer.
uint64_t pal_plat_osKernelSysTickMicroSec(uint64_t microseconds)
Convert the value from microseconds to kernel system ticks.
palStatus_t pal_plat_osSemaphoreCreate(uint32_t count, palSemaphoreID_t *semaphoreID)
Create and initialize a semaphore object.
palStatus_t pal_plat_osSemaphoreWait(palSemaphoreID_t semaphoreID, uint32_t millisec, int32_t *countersAvailable)
Wait until a semaphore token becomes available.
palStatus_t pal_plat_osGetRoTFromHW(uint8_t *keyBuf, size_t keyLenBytes)
Retrieve platform Root of Trust (RoT) certificate.
enum palTimerType palTimerType_t
Timer types supported in PAL.
palStatus_t pal_plat_osTimerCreate(palTimerFuncPtr function, void *funcArgument, palTimerType_t timerType, palTimerID_t *timerID)
Create a timer.
int32_t pal_plat_osAtomicIncrement(int32_t *valuePtr, int32_t increment)
Perform an atomic increment for a signed 32-bit value.
void(* palTimerFuncPtr)(void const *funcArgument)
PAL timer function prototype.
Definition: pal_rtos.h:64
void pal_plat_free(void *buffer)
Free memory back to the OS heap.
palStatus_t pal_plat_osMutexRelease(palMutexID_t mutexID)
Release a mutex that was obtained by osMutexWait.
uintptr_t palMutexID_t
Definition: pal_rtos.h:51
void(* palThreadFuncPtr)(void const *funcArgument)
PAL thread function prototype.
Definition: pal_rtos.h:67
palStatus_t pal_plat_osTimerStop(palTimerID_t timerID)
Stop a timer.
palStatus_t pal_plat_osThreadCreate(palThreadFuncPtr function, void *funcArgument, palThreadPriority_t priority, uint32_t stackSize, palThreadID_t *threadID)
Create and run the thread.
palStatus_t pal_plat_osDelay(uint32_t milliseconds)
Wait for a specified period of time in milliseconds.
palStatus_t pal_plat_RTOSDestroy(void)
De-initialize thread objects.
palStatus_t pal_plat_osMutexDelete(palMutexID_t *mutexID)
Delete a mutex object.
void pal_plat_osApplicationReboot(void)
Application provided implementation to replace default pal_osReboot() functionality.
void * pal_plat_malloc(size_t len)
Perform allocation from the heap according to the OS specification.
palStatus_t pal_plat_osMutexCreate(palMutexID_t *mutexID)
Create and initialize a mutex object.
palStatus_t pal_plat_osSetRtcTime(uint64_t rtcSetTime)
This function calls the platform layer and sets the new real-time clock (RTC) to the hardware...
enum pal_osPriority palThreadPriority_t
Thread priority levels for PAL threads - each thread must have a different priority.
palStatus_t pal_plat_RTOSInitialize(void *opaqueContext)
Initialize all data structures (semaphores, mutexes, memory pools, message queues) at system initiali...
palStatus_t pal_plat_osGetRtcTime(uint64_t *rtcGetTime)
This function gets the real-time clock (RTC) from the platform.
uintptr_t palTimerID_t
Definition: pal_rtos.h:50
palStatus_t pal_plat_rtcInit(void)
This function initializes the real-time clock (RTC) module.
palStatus_t pal_plat_osSemaphoreRelease(palSemaphoreID_t semaphoreID)
Release a semaphore token.
palStatus_t pal_plat_osMutexWait(palMutexID_t mutexID, uint32_t millisec)
Wait until a mutex becomes available.
palThreadID_t pal_plat_osThreadGetId(void)
Get the ID of the current thread.
uintptr_t palThreadID_t
Primitive ID type declarations.
Definition: pal_rtos.h:49
uint64_t pal_plat_osKernelSysTickFrequency(void)
Get the system tick frequency.
int32_t palStatus_t
Definition: pal_types.h:49
uint64_t pal_plat_osKernelSysTick(void)
Get the RTOS kernel system timer counter.
palStatus_t pal_plat_osThreadTerminate(palThreadID_t *threadID)
Terminate and free allocated data for the thread.
palStatus_t pal_plat_osTimerDelete(palTimerID_t *timerID)
Delete the timer object.