nrfxlib API 0.1.0
Loading...
Searching...
No Matches
osal.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2018-2021 T2 Software, Inc. All rights reserved.
3 *
4 * SPDX-License-Identifier: LicenseRef-T2-LC3
5 */
6
7#ifndef __OSAL_H__
8#define __OSAL_H__
9
10#ifdef __cplusplus
11extern "C" {
12#endif
13
14#include "stddef.h"
15#include "osal_types.h"
16
19#define OSAL_STATUS_SUCCESS ( 0)
20#define OSAL_STATUS_INVALID_PARAMETER (-1)
21#define OSAL_STATUS_OUT_OF_MEMORY (-2)
22#define OSAL_STATUS_INTERNAL_ERROR (-3)
23
26#define OSAL_TIMEOUT_INFINITE (0xFFFFFFFF)
27
30typedef void *OSAL_Mutex_t;
31
34typedef void *OSAL_Timer_t;
35
38typedef void *OSAL_Thread_t;
39
42typedef void *OSAL_Event_t;
43
46typedef enum
47{
51
54typedef void(*OSAL_Timer_Function_t)(OSAL_Timer_t TimerHandle, void *CallbackData);
55
58typedef void(*OSAL_Thread_Function_t)(OSAL_Thread_t ThreadHandle, void *Data);
59
66void *OSAL_Malloc(size_t Size);
67
73void OSAL_Free(void *Ptr);
74
83void *OSAL_Memset(void *Ptr, int Value, size_t Num);
84
93void *OSAL_Memcpy(void *Dst, const void *Src, size_t Num);
94
105int OSAL_Memcmp(const void *Ptr1, const void *Ptr2, size_t Num);
106
114
120
129bool_t OSAL_Wait_Mutex(OSAL_Mutex_t Mutex, unsigned long Timeout);
130
136
147OSAL_Timer_t OSAL_Create_Timer(uint32_t Delay, bool_t Start, OSAL_Timer_Type_t Type, OSAL_Timer_Function_t TimerFunction, void *Data);
148
156
162
171OSAL_Thread_t OSAL_Create_Thread(uint32_t StackSize, OSAL_Thread_Function_t ThreadFunction, void *Data);
172
178
189int OSAL_Wait_Event(OSAL_Event_t Event, uint32_t Flags, uint32_t *FlagsSet, bool_t Reset, int Timeout);
190
198int OSAL_Set_Event(OSAL_Event_t Event, uint32_t Flags);
199
207int OSAL_Reset_Event(OSAL_Event_t Event, uint32_t Flags);
208
214
219void OSAL_OutputMessage(const char *DebugString, ...);
220
226void OSAL_OutputMessageInit(char *bufPtr, uint16_t size);
227
232
241int OSAL_DumpData(unsigned int dataLength, const unsigned char *dataPtr, int size);
242
243#if defined LC3_CYCLES_PER_BLOCK && __arc__
251void OSAL_CycleCountStart(uint8_t blockNumber);
252
260void OSAL_CycleCountEnd(uint8_t blockNumber);
261#endif
262
263
264#ifdef __cplusplus
265};
266#endif
267
268#endif // __OSAL_H__
void OSAL_Close_Timer(OSAL_Timer_t Timer)
Frees a timer.
bool_t OSAL_Wait_Mutex(OSAL_Mutex_t Mutex, unsigned long Timeout)
Waits for ownership of a mutex.
void OSAL_Free(void *Ptr)
Frees heap memory.
OSAL_Timer_Type_t
OSAL timer types.
Definition: osal.h:47
@ OSAL_TIMER_PERIODIC
Definition: osal.h:48
@ OSAL_TIMER_ONE_SHOT
Definition: osal.h:49
int OSAL_Memcmp(const void *Ptr1, const void *Ptr2, size_t Num)
Compares data between two buffers.
void * OSAL_Malloc(size_t Size)
Allocates heap memory.
void * OSAL_Event_t
OSAL event handle.
Definition: osal.h:42
void * OSAL_Thread_t
OSAL thread handle.
Definition: osal.h:38
OSAL_Timer_t OSAL_Create_Timer(uint32_t Delay, bool_t Start, OSAL_Timer_Type_t Type, OSAL_Timer_Function_t TimerFunction, void *Data)
Creates a timer.
void OSAL_Release_Mutex(OSAL_Mutex_t Mutex)
Releases ownership of a mutex.
void(* OSAL_Timer_Function_t)(OSAL_Timer_t TimerHandle, void *CallbackData)
Timer function type.
Definition: osal.h:54
void OSAL_OutputMessageInit(char *bufPtr, uint16_t size)
Initializes output message buffer for OSAL_OutputMessage.
void * OSAL_Timer_t
OSAL timer handle.
Definition: osal.h:34
void OSAL_OutputMessageFlush(void)
Sends data in debug output buffer.
void OSAL_OutputMessage(const char *DebugString,...)
Outputs Message to Console.
int OSAL_Set_Event(OSAL_Event_t Event, uint32_t Flags)
Sets an event.
void(* OSAL_Thread_Function_t)(OSAL_Thread_t ThreadHandle, void *Data)
Thread function type.
Definition: osal.h:58
void * OSAL_Memcpy(void *Dst, const void *Src, size_t Num)
Copies data from one buffer to another.
int OSAL_Start_Timer(OSAL_Timer_t Timer)
Starts a timer.
void * OSAL_Mutex_t
OSAL mutex handle.
Definition: osal.h:30
OSAL_Mutex_t OSAL_Create_Mutex(bool_t Owned)
Creates a mutex.
void OSAL_Close_Event(OSAL_Event_t Event)
Frees an event.
void * OSAL_Memset(void *Ptr, int Value, size_t Num)
Sets buffer entries to a value.
int OSAL_Wait_Event(OSAL_Event_t Event, uint32_t Flags, uint32_t *FlagsSet, bool_t Reset, int Timeout)
Waits for one or more event bits to be set.
OSAL_Event_t OSAL_Create_Event(void)
Creates an event.
OSAL_Thread_t OSAL_Create_Thread(uint32_t StackSize, OSAL_Thread_Function_t ThreadFunction, void *Data)
Creates a thread.
int OSAL_DumpData(unsigned int dataLength, const unsigned char *dataPtr, int size)
Outputs a Dump of the supplied Data.
void OSAL_Close_Mutex(OSAL_Mutex_t Mutex)
Destroys a mutex.
int OSAL_Reset_Event(OSAL_Event_t Event, uint32_t Flags)
Resets an event.
int bool_t
Defines the OSAL boolean value.
Definition: osal_types.h:25