nrfxlib API 0.1.0
Loading...
Searching...
No Matches
nrf_modem_os.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2018 Nordic Semiconductor ASA
3 *
4 * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
5 */
6
15#ifndef NRF_MODEM_OS_H__
16#define NRF_MODEM_OS_H__
17
18#include <stdint.h>
19#include <stddef.h>
20#include <stdbool.h>
21
22#ifdef __cplusplus
23extern "C" {
24#endif
25
27#define NRF_MODEM_OS_NO_WAIT 0
29#define NRF_MODEM_OS_FOREVER -1
31#define NRF_MODEM_OS_NUM_SEM_REQUIRED 7
33#define NRF_MODEM_OS_NUM_MUTEX_REQUIRED 1
34
41};
42
47
55
62void *nrf_modem_os_shm_tx_alloc(size_t bytes);
63
70
77void *nrf_modem_os_alloc(size_t bytes);
78
84void nrf_modem_os_free(void *mem);
85
91void nrf_modem_os_busywait(int32_t usec);
92
112int32_t nrf_modem_os_timedwait(uint32_t context, int32_t *timeout);
113
124void nrf_modem_os_event_notify(uint32_t context);
125
132int nrf_modem_os_sleep(uint32_t timeout);
133
139void nrf_modem_os_errno_set(int errno_val);
140
148
162int nrf_modem_os_sem_init(void **sem, unsigned int initial_count, unsigned int limit);
163
171void nrf_modem_os_sem_give(void *sem);
172
186int nrf_modem_os_sem_take(void *sem, int timeout);
187
194unsigned int nrf_modem_os_sem_count_get(void *sem);
195
207int nrf_modem_os_mutex_init(void **mutex);
208
220int nrf_modem_os_mutex_lock(void *mutex, int timeout);
221
232
240void nrf_modem_os_log(int level, const char *fmt, ...);
241
250void nrf_modem_os_logdump(int level, const char *str, const void *data, size_t len);
251
252#ifdef __cplusplus
253}
254#endif
255
256#endif /* NRF_MODEM_OS_H__ */
int nrf_modem_os_mutex_init(void **mutex)
Initialize a mutex.
void nrf_modem_os_busywait(int32_t usec)
Busy wait.
void nrf_modem_os_free(void *mem)
Free a memory buffer in the library heap.
void nrf_modem_os_shm_tx_free(void *mem)
Free a shared memory buffer in the TX area.
void nrf_modem_os_logdump(int level, const char *str, const void *data, size_t len)
Logging procedure for dumping hex representation of object.
void * nrf_modem_os_shm_tx_alloc(size_t bytes)
Allocate a buffer on the TX area of shared memory.
void nrf_modem_os_log(int level, const char *fmt,...)
Generic logging procedure.
void nrf_modem_os_event_notify(uint32_t context)
Notify the application that an event has occurred.
int nrf_modem_os_sem_init(void **sem, unsigned int initial_count, unsigned int limit)
Initialize a semaphore.
bool nrf_modem_os_is_in_isr(void)
Check if executing in interrupt context.
void nrf_modem_os_sem_give(void *sem)
Give a semaphore.
void * nrf_modem_os_alloc(size_t bytes)
Allocate a buffer on the library heap.
unsigned int nrf_modem_os_sem_count_get(void *sem)
Get a semaphore's count.
int nrf_modem_os_mutex_unlock(void *mutex)
Unlock a mutex.
void nrf_modem_os_init(void)
Initialize the glue layer.
void nrf_modem_os_errno_set(int errno_val)
Set errno.
log_level
Definition: nrf_modem_os.h:35
@ NRF_MODEM_LOG_LEVEL_ERR
Definition: nrf_modem_os.h:37
@ NRF_MODEM_LOG_LEVEL_WRN
Definition: nrf_modem_os.h:38
@ NRF_MODEM_LOG_LEVEL_NONE
Definition: nrf_modem_os.h:36
@ NRF_MODEM_LOG_LEVEL_INF
Definition: nrf_modem_os.h:39
@ NRF_MODEM_LOG_LEVEL_DBG
Definition: nrf_modem_os.h:40
void nrf_modem_os_shutdown(void)
Deinitialize the glue layer.
int nrf_modem_os_mutex_lock(void *mutex, int timeout)
Lock a mutex.
int32_t nrf_modem_os_timedwait(uint32_t context, int32_t *timeout)
Put a thread to sleep for a specific time or until an event occurs.
int nrf_modem_os_sleep(uint32_t timeout)
Put a thread to sleep for a specific amount of time.
int nrf_modem_os_sem_take(void *sem, int timeout)
Take a semaphore.