mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
Merge pull request #16348 from fjmolinas/pr_pkg_mynewt_core
pkg/mynewt-core: initial commit
This commit is contained in:
commit
fe22ba428d
@ -28,6 +28,7 @@ USEMODULE += uwb-core_twr_ds_ext
|
||||
USEMODULE += shell
|
||||
USEMODULE += shell_commands
|
||||
USEMODULE += ps
|
||||
USEMODULE += ztimer_usec
|
||||
|
||||
# Set the device role: 0x0 for tag, 0x4 for an anchor
|
||||
DW1000_ROLE ?= 0x00
|
||||
|
@ -29,7 +29,6 @@
|
||||
|
||||
#include "shell_commands.h"
|
||||
#include "shell.h"
|
||||
#include "xtimer.h"
|
||||
|
||||
static struct dpl_callout _rng_req_callout;
|
||||
static uint8_t _ranging_enabled_flag;
|
||||
@ -46,7 +45,7 @@ static int _range_cli_cmd(int argc, char **argv)
|
||||
|
||||
if (!strcmp(argv[1], "start")) {
|
||||
printf("Start ranging\n");
|
||||
dpl_callout_reset(&_rng_req_callout, RANGE_REQUEST_T_US);
|
||||
dpl_callout_reset(&_rng_req_callout, RANGE_REQUEST_T_MS);
|
||||
_ranging_enabled_flag = 1;
|
||||
}
|
||||
else if (!strcmp(argv[1], "stop")) {
|
||||
@ -150,12 +149,12 @@ static void _slot_complete_cb(struct dpl_event *ev)
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief An event callback to send range request every RANGE_REQUEST_T_US.
|
||||
* @brief An event callback to send range request every RANGE_REQUEST_T_MS.
|
||||
* On every request it will switch the used ranging algorithm.
|
||||
*/
|
||||
static void uwb_ev_cb(struct dpl_event *ev)
|
||||
{
|
||||
struct uwb_rng_instance *rng = (struct uwb_rng_instance *)ev->arg;
|
||||
struct uwb_rng_instance *rng = (struct uwb_rng_instance *)ev->ev.arg;
|
||||
struct uwb_dev *inst = rng->dev_inst;
|
||||
|
||||
if (inst->role & UWB_ROLE_ANCHOR) {
|
||||
@ -195,7 +194,7 @@ static void uwb_ev_cb(struct dpl_event *ev)
|
||||
|
||||
/* reset the callback if ranging is enabled */
|
||||
if (_ranging_enabled_flag) {
|
||||
dpl_callout_reset(&_rng_req_callout, RANGE_REQUEST_T_US);
|
||||
dpl_callout_reset(&_rng_req_callout, RANGE_REQUEST_T_MS);
|
||||
}
|
||||
}
|
||||
|
||||
@ -211,7 +210,7 @@ void init_ranging(void)
|
||||
_uwb_mac_cbs.inst_ptr = rng;
|
||||
uwb_mac_append_interface(udev, &_uwb_mac_cbs);
|
||||
|
||||
uint32_t utime = xtimer_now_usec();
|
||||
uint32_t utime = ztimer_now(ZTIMER_USEC);
|
||||
|
||||
printf("{\"utime\": %" PRIu32 ",\"exec\": \"%s\"}\n", utime, __FILE__);
|
||||
printf("{\"device_id\"=\"%" PRIx32 "\"", udev->device_id);
|
||||
@ -235,7 +234,7 @@ void init_ranging(void)
|
||||
|
||||
dpl_callout_init(&_rng_req_callout, dpl_eventq_dflt_get(),
|
||||
uwb_ev_cb, rng);
|
||||
dpl_callout_reset(&_rng_req_callout, RANGE_REQUEST_T_US);
|
||||
dpl_callout_reset(&_rng_req_callout, RANGE_REQUEST_T_MS);
|
||||
dpl_event_init(&_slot_event, _slot_complete_cb, rng);
|
||||
|
||||
/* Apply config */
|
||||
|
@ -37,8 +37,8 @@ extern "C" {
|
||||
/**
|
||||
* @brief Range request period
|
||||
*/
|
||||
#ifndef RANGE_REQUEST_T_US
|
||||
#define RANGE_REQUEST_T_US (40 * US_PER_MS)
|
||||
#ifndef RANGE_REQUEST_T_MS
|
||||
#define RANGE_REQUEST_T_MS (40)
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
46
pkg/mynewt-core/Makefile
Normal file
46
pkg/mynewt-core/Makefile
Normal file
@ -0,0 +1,46 @@
|
||||
PKG_NAME=mynewt-core
|
||||
PKG_URL=https://github.com/apache/mynewt-core.git
|
||||
PKG_VERSION=de203365f207dda658657a7525253e02f68503a1
|
||||
PKG_LICENSE=Apache-2.0
|
||||
|
||||
include $(RIOTBASE)/pkg/pkg.mk
|
||||
|
||||
CFLAGS += -Wno-unused-parameter
|
||||
CFLAGS += -Wno-unused-but-set-variable
|
||||
CFLAGS += -Wno-sign-compare
|
||||
|
||||
MYNEWT_CORE_MODULES := mynewt-core_os \
|
||||
mynewt-core_util \
|
||||
mynewt-core_nrf5x_hal \
|
||||
#
|
||||
|
||||
MYNEWT_CORE_PATH_util = util/mem/src
|
||||
MYNEWT_CORE_PATH_os = kernel/os/src
|
||||
|
||||
ifneq (,$(filter nrf52,$(CPU)))
|
||||
MYNEWT_CORE_PATH_nrf5x_hal = hw/mcu/nordic/nrf52xxx/src/
|
||||
endif
|
||||
ifneq (,$(filter nrf51,$(CPU)))
|
||||
MYNEWT_CORE_PATH_nrf5x_hal = hw/mcu/nordic/nrf51xxx/src/
|
||||
endif
|
||||
|
||||
.PHONY: rm_riot_provided_headers
|
||||
|
||||
all: $(filter $(MYNEWT_CORE_MODULES),$(USEMODULE))
|
||||
@true
|
||||
|
||||
mynewt-core_%: rm_riot_provided_headers
|
||||
"$(MAKE)" -C $(PKG_SOURCE_DIR)/$(MYNEWT_CORE_PATH_$*) -f $(RIOTPKG)/$(PKG_NAME)/$@.mk MODULE=$@
|
||||
|
||||
# The following mynewt-core headers are provided by RIOT, remove them from
|
||||
# mynewt-core include paths to avoid header conflicts
|
||||
MYNEWT_CORE_HAL_HEADERS = hal_gpio.h hal_spi.h
|
||||
MYNEWT_CORE_OS_HEADERS = os.h mynewt.h os_dev.h os_eventq.h os_time.h
|
||||
MYNEWT_CORE_HAL_HEADERS_PATH = hw/hal/include/hal
|
||||
MYNEWT_CORE_OS_HEADERS_PATH = kernel/os/include/os/os_time
|
||||
|
||||
rm_riot_provided_headers:
|
||||
$(Q)for i in $(MYNEWT_CORE_OS_HEADERS); \
|
||||
do rm -f "$(PKG_SOURCE_DIR)/$(MYNEWT_CORE_OS_HEADERS_PATH)/$$i"; done
|
||||
$(Q)for i in $(MYNEWT_CORE_HAL_HEADERS); \
|
||||
do rm -f "$(PKG_SOURCE_DIR)/$(MYNEWT_CORE_HAL_HEADERS_PATH)/$$i"; done
|
17
pkg/mynewt-core/Makefile.dep
Normal file
17
pkg/mynewt-core/Makefile.dep
Normal file
@ -0,0 +1,17 @@
|
||||
USEMODULE += event_callback
|
||||
USEMODULE += sema
|
||||
USEMODULE += ztimer
|
||||
USEMODULE += ztimer_msec
|
||||
|
||||
USEMODULE += mynewt-core
|
||||
|
||||
DEFAULT_MODULE += auto_init_mynewt-core
|
||||
|
||||
# MyNewt `os_hw_is_in_critical` function needs to know whether ISR are masked
|
||||
# of if the function is being called in ISR context. There is no such function
|
||||
# in RIOT except for arm (__get_PRIMASK), therefore unless a similar function
|
||||
# is provided for other arch, this port is currently only enabled for those arch.
|
||||
# Note: that this should not be a hindrance since nimble only works on nordic
|
||||
# and uwb-core breakouts are all arm.
|
||||
FEATURES_REQUIRED += arch_arm
|
||||
FEATURES_BLACKLIST += arch_arm7
|
16
pkg/mynewt-core/Makefile.include
Normal file
16
pkg/mynewt-core/Makefile.include
Normal file
@ -0,0 +1,16 @@
|
||||
INCLUDES += -I$(RIOTPKG)/mynewt-core/include \
|
||||
-I$(PKGDIRBASE)/mynewt-core/kernel/os/include \
|
||||
-I$(PKGDIRBASE)/mynewt-core/hw/hal/include \
|
||||
-I$(PKGDIRBASE)/mynewt-core/util/mem/include \
|
||||
-I$(PKGDIRBASE)/mynewt-core/sys/stats/stub/include \
|
||||
#
|
||||
|
||||
DIRS += $(RIOTPKG)/mynewt-core/contrib \
|
||||
#
|
||||
|
||||
ifneq (,$(filter nrf5%,$(CPU)))
|
||||
# OS_CPUTIME is set to 32.767 Hz
|
||||
CFLAGS += -DMYNEWT_VAL_OS_CPUTIME_FREQ=32768
|
||||
else
|
||||
CFLAGS += -DMYNEWT_VAL_OS_CPUTIME_FREQ=CONFIG_ZTIMER_MSEC_BASE_FREQ
|
||||
endif
|
12
pkg/mynewt-core/contrib/Makefile
Normal file
12
pkg/mynewt-core/contrib/Makefile
Normal file
@ -0,0 +1,12 @@
|
||||
MODULE = mynewt-core
|
||||
|
||||
# exclude submodule sources from *.c wildcard source selection
|
||||
SRC := $(filter-out nrf5x_isr.c cputime.c,$(wildcard *.c))
|
||||
|
||||
ifneq (,$(filter nrf%,$(CPU)))
|
||||
SRC += nrf5x_isr.c
|
||||
else
|
||||
SRC += cputime.c
|
||||
endif
|
||||
|
||||
include $(RIOTBASE)/Makefile.base
|
58
pkg/mynewt-core/contrib/callout.c
Normal file
58
pkg/mynewt-core/contrib/callout.c
Normal file
@ -0,0 +1,58 @@
|
||||
/*
|
||||
* Copyright (C) 2020 Inria
|
||||
*
|
||||
* This file is subject to the terms and conditions of the GNU Lesser
|
||||
* General Public License v2.1. See the file LICENSE in the top level
|
||||
* directory for more details.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @ingroup pkg_mynewt_core
|
||||
* @{
|
||||
*
|
||||
* @file
|
||||
* @brief mynewt-core callout
|
||||
*
|
||||
* @author Francisco Molina <francois-xavier.molina@inria.fr>
|
||||
* @}
|
||||
*/
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
#include "ztimer.h"
|
||||
#include "os/os.h"
|
||||
#include "os/os_callout.h"
|
||||
|
||||
static void _os_callout_timer_cb(void* arg)
|
||||
{
|
||||
struct os_callout *c = (struct os_callout *) arg;
|
||||
assert(c);
|
||||
|
||||
/* post the event if there is a queue, otherwise call the callback
|
||||
here */
|
||||
if (c->c_evq) {
|
||||
os_eventq_put(c->c_evq, &c->c_ev);
|
||||
} else {
|
||||
c->c_ev.e.callback(&c->c_ev);
|
||||
}
|
||||
}
|
||||
|
||||
void os_callout_init(struct os_callout *c, struct os_eventq *q,
|
||||
os_event_fn *e_cb, void *e_arg)
|
||||
{
|
||||
os_event_init(&c->c_ev, e_cb, e_arg);
|
||||
c->c_evq = q;
|
||||
c->timer.callback = _os_callout_timer_cb;
|
||||
c->timer.arg = (void*) c;
|
||||
}
|
||||
|
||||
int os_callout_reset(struct os_callout *c, os_time_t ticks)
|
||||
{
|
||||
ztimer_set(ZTIMER_MSEC, &c->timer, ticks);
|
||||
return OS_OK;
|
||||
}
|
||||
|
||||
void os_callout_stop(struct os_callout *c)
|
||||
{
|
||||
ztimer_remove(ZTIMER_MSEC, &(c->timer));
|
||||
}
|
34
pkg/mynewt-core/contrib/core.c
Normal file
34
pkg/mynewt-core/contrib/core.c
Normal file
@ -0,0 +1,34 @@
|
||||
/*
|
||||
* Copyright (C) 2021 Inria
|
||||
*
|
||||
* This file is subject to the terms and conditions of the GNU Lesser
|
||||
* General Public License v2.1. See the file LICENSE in the top level
|
||||
* directory for more details.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @ingroup pkg_mynewt_core
|
||||
* @{
|
||||
*
|
||||
* @file
|
||||
* @brief mynewt-core bootstrapping functions
|
||||
*
|
||||
* @author Francisco Molina <francois-xavier.molina@inria.fr>
|
||||
* @}
|
||||
*/
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
#include "os/os_cputime.h"
|
||||
#include "hal/hal_timer.h"
|
||||
|
||||
void mynewt_core_init(void)
|
||||
{
|
||||
#if (MYNEWT_VAL_OS_CPUTIME_TIMER_NUM >= 0) && (defined(CPU_NRF51) || defined(CPU_NRF52))
|
||||
int rc = hal_timer_init(5, NULL);
|
||||
assert(rc == 0);
|
||||
rc = os_cputime_init(MYNEWT_VAL_OS_CPUTIME_FREQ);
|
||||
assert(rc == 0);
|
||||
(void) rc;
|
||||
#endif
|
||||
}
|
77
pkg/mynewt-core/contrib/cputime.c
Normal file
77
pkg/mynewt-core/contrib/cputime.c
Normal file
@ -0,0 +1,77 @@
|
||||
/*
|
||||
* Copyright (C) 2020 Inria
|
||||
*
|
||||
* This file is subject to the terms and conditions of the GNU Lesser
|
||||
* General Public License v2.1. See the file LICENSE in the top level
|
||||
* directory for more details.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @ingroup pkg_mynewt_core
|
||||
* @{
|
||||
*
|
||||
* @file
|
||||
* @brief cputime implementation for non nrf5x BOARDs
|
||||
*
|
||||
* @author Francisco Molina <francois-xavier.molina@inria.fr>
|
||||
* @}
|
||||
*/
|
||||
|
||||
#include "os/os_cputime.h"
|
||||
#include "ztimer.h"
|
||||
#include "hal/hal_timer.h"
|
||||
|
||||
uint32_t os_cputime_get32(void)
|
||||
{
|
||||
return ztimer_now(ZTIMER_MSEC_BASE);
|
||||
}
|
||||
|
||||
void os_cputime_delay_ticks(uint32_t ticks)
|
||||
{
|
||||
ztimer_sleep(ZTIMER_MSEC_BASE, ticks);
|
||||
}
|
||||
|
||||
void os_cputime_delay_usecs(uint32_t usecs)
|
||||
{
|
||||
ztimer_sleep(ZTIMER_MSEC_BASE, os_cputime_usecs_to_ticks(usecs));
|
||||
}
|
||||
|
||||
int os_cputime_init(uint32_t clock_freq)
|
||||
{
|
||||
(void)clock_freq;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void os_cputime_timer_init(struct hal_timer *timer, hal_timer_cb fp,
|
||||
void *arg)
|
||||
{
|
||||
timer->timer.callback = fp;
|
||||
timer->timer.arg = arg;
|
||||
}
|
||||
|
||||
int os_cputime_timer_start(struct hal_timer *timer, uint32_t cputime)
|
||||
{
|
||||
uint32_t now = ztimer_now(ZTIMER_MSEC_BASE);
|
||||
|
||||
/* taken from mynewt-core 'hal_timer' implementations, this will
|
||||
only work with timeouts at most 2**32-1 away, so it will have the same
|
||||
limitations as their implementation does */
|
||||
if ((int32_t)(cputime - now) <= 0) {
|
||||
ztimer_set(ZTIMER_MSEC_BASE, &timer->timer, 0);
|
||||
}
|
||||
else {
|
||||
ztimer_set(ZTIMER_MSEC_BASE, &timer->timer, cputime - now);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int os_cputime_timer_relative(struct hal_timer *timer, uint32_t usecs)
|
||||
{
|
||||
ztimer_set(ZTIMER_MSEC_BASE, &timer->timer, os_cputime_usecs_to_ticks(usecs));
|
||||
return 0;
|
||||
}
|
||||
|
||||
void os_cputime_timer_stop(struct hal_timer *timer)
|
||||
{
|
||||
ztimer_remove(ZTIMER_MSEC_BASE, &timer->timer);
|
||||
}
|
@ -7,7 +7,7 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* @ingroup pkg_uwb_core
|
||||
* @ingroup pkg_mynewt_core
|
||||
* @{
|
||||
*
|
||||
* @file
|
||||
@ -17,34 +17,33 @@
|
||||
* @}
|
||||
*/
|
||||
|
||||
#include "mutex.h"
|
||||
#include "dpl/dpl_mutex.h"
|
||||
#include "os/os_mutex.h"
|
||||
|
||||
dpl_error_t dpl_mutex_init(struct dpl_mutex *mu)
|
||||
os_error_t os_mutex_init(struct os_mutex *mu)
|
||||
{
|
||||
if (!mu) {
|
||||
return DPL_INVALID_PARAM;
|
||||
return OS_INVALID_PARM;
|
||||
}
|
||||
mutex_init(&mu->mutex);
|
||||
return DPL_OK;
|
||||
return OS_OK;
|
||||
}
|
||||
|
||||
dpl_error_t dpl_mutex_release(struct dpl_mutex *mu)
|
||||
os_error_t os_mutex_release(struct os_mutex *mu)
|
||||
{
|
||||
if (!mu) {
|
||||
return DPL_INVALID_PARAM;
|
||||
return OS_INVALID_PARM;
|
||||
}
|
||||
|
||||
mutex_unlock(&mu->mutex);
|
||||
return DPL_OK;
|
||||
return OS_OK;
|
||||
}
|
||||
|
||||
dpl_error_t dpl_mutex_pend(struct dpl_mutex *mu, uint32_t timeout)
|
||||
os_error_t os_mutex_pend(struct os_mutex *mu, uint32_t timeout)
|
||||
{
|
||||
int rc = DPL_OK;
|
||||
int rc = OS_OK;
|
||||
|
||||
if (!mu) {
|
||||
return DPL_INVALID_PARAM;
|
||||
return OS_INVALID_PARM;
|
||||
}
|
||||
|
||||
if (!timeout) {
|
56
pkg/mynewt-core/contrib/nrf5x_isr.c
Normal file
56
pkg/mynewt-core/contrib/nrf5x_isr.c
Normal file
@ -0,0 +1,56 @@
|
||||
/*
|
||||
* Copyright (C) 2021 Freie Universität Berlin
|
||||
*
|
||||
* This file is subject to the terms and conditions of the GNU Lesser
|
||||
* General Public License v2.1. See the file LICENSE in the top level
|
||||
* directory for more details.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @ingroup pkg_mynewt_core
|
||||
* @{
|
||||
*
|
||||
* @file
|
||||
* @brief mynewt-core isr mapping
|
||||
*
|
||||
* @author Hauke Petersen <hauke.petersen@fu-berlin.de>
|
||||
* @}
|
||||
*/
|
||||
|
||||
|
||||
#include "mcu/mcu.h"
|
||||
#include "cpu.h"
|
||||
|
||||
static void (*radio_isr_addr)(void);
|
||||
static void (*rng_isr_addr)(void);
|
||||
static void (*rtc0_isr_addr)(void);
|
||||
|
||||
void isr_radio(void)
|
||||
{
|
||||
radio_isr_addr();
|
||||
}
|
||||
|
||||
void isr_rng(void)
|
||||
{
|
||||
rng_isr_addr();
|
||||
}
|
||||
|
||||
void isr_rtc0(void)
|
||||
{
|
||||
rtc0_isr_addr();
|
||||
}
|
||||
|
||||
void nrf5x_hw_set_isr(int irqn, void (*addr)(void))
|
||||
{
|
||||
switch (irqn) {
|
||||
case RADIO_IRQn:
|
||||
radio_isr_addr = addr;
|
||||
break;
|
||||
case RNG_IRQn:
|
||||
rng_isr_addr = addr;
|
||||
break;
|
||||
case RTC0_IRQn:
|
||||
rtc0_isr_addr = addr;
|
||||
break;
|
||||
}
|
||||
}
|
41
pkg/mynewt-core/contrib/sem.c
Normal file
41
pkg/mynewt-core/contrib/sem.c
Normal file
@ -0,0 +1,41 @@
|
||||
/*
|
||||
* Copyright (C) 2020 Inria
|
||||
*
|
||||
* This file is subject to the terms and conditions of the GNU Lesser
|
||||
* General Public License v2.1. See the file LICENSE in the top level
|
||||
* directory for more details.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @ingroup pkg_mynewt_core
|
||||
* @{
|
||||
*
|
||||
* @file
|
||||
* @brief Decawave Porting Layer semaphore RIOT wrapper
|
||||
*
|
||||
* @author Francisco Molina <francois-xavier.molina@inria.fr>
|
||||
* @}
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "irq.h"
|
||||
#include "os/os_sem.h"
|
||||
|
||||
os_error_t os_sem_init(struct os_sem *sem, uint16_t tokens)
|
||||
{
|
||||
sema_create(&sem->sema, tokens);
|
||||
return OS_OK;
|
||||
}
|
||||
|
||||
os_error_t os_sem_release(struct os_sem *sem)
|
||||
{
|
||||
int ret = sema_post(&sem->sema);
|
||||
return (ret) ? OS_ERROR : OS_OK;
|
||||
}
|
||||
|
||||
os_error_t os_sem_pend(struct os_sem *sem, os_time_t timeout)
|
||||
{
|
||||
int ret = sema_wait_timed_ztimer(&sem->sema, ZTIMER_MSEC, timeout);
|
||||
return (ret) ? OS_ERROR : OS_OK;
|
||||
}
|
@ -7,7 +7,7 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* @ingroup pkg_uwb_core
|
||||
* @ingroup pkg_mynewt_core
|
||||
* @{
|
||||
*
|
||||
* @file
|
||||
@ -17,8 +17,8 @@
|
||||
* @}
|
||||
*/
|
||||
|
||||
#include "dpl/dpl_error.h"
|
||||
#include "dpl/dpl_tasks.h"
|
||||
#include "os/os_error.h"
|
||||
#include "os/os_task.h"
|
||||
#include "thread.h"
|
||||
|
||||
#ifndef LOG_LEVEL
|
||||
@ -30,13 +30,13 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
int dpl_task_init(struct dpl_task *t, const char *name, dpl_task_func_t func,
|
||||
void *arg, uint8_t prio, dpl_time_t sanity_itvl,
|
||||
dpl_stack_t *stack_bottom, uint16_t stack_size)
|
||||
int os_task_init(struct os_task *t, const char *name, os_task_func_t func,
|
||||
void *arg, uint8_t prio, os_time_t sanity_itvl,
|
||||
os_stack_t *stack_bottom, uint16_t stack_size)
|
||||
{
|
||||
(void) sanity_itvl;
|
||||
|
||||
LOG_INFO("dpl: starting thread %s\n", name);
|
||||
LOG_INFO("[mynewt-core]: starting thread %s\n", name);
|
||||
|
||||
kernel_pid_t pid = thread_create(stack_bottom, (int) stack_size,
|
||||
prio, THREAD_CREATE_STACKTEST,
|
||||
@ -44,21 +44,21 @@ int dpl_task_init(struct dpl_task *t, const char *name, dpl_task_func_t func,
|
||||
|
||||
t->pid = pid;
|
||||
|
||||
return (pid) ? DPL_ERROR : DPL_OK;;
|
||||
return (pid) ? OS_ERROR : OS_OK;;
|
||||
}
|
||||
|
||||
int dpl_task_remove(struct dpl_task *t)
|
||||
int os_task_remove(struct os_task *t)
|
||||
{
|
||||
thread_zombify();
|
||||
return thread_kill_zombie(t->pid);
|
||||
}
|
||||
|
||||
uint8_t dpl_task_count(void)
|
||||
uint8_t os_task_count(void)
|
||||
{
|
||||
return sched_num_threads;
|
||||
}
|
||||
|
||||
void dpl_task_yield(void)
|
||||
void os_task_yield(void)
|
||||
{
|
||||
thread_yield();
|
||||
}
|
12
pkg/mynewt-core/doc.txt
Normal file
12
pkg/mynewt-core/doc.txt
Normal file
@ -0,0 +1,12 @@
|
||||
/**
|
||||
* @defgroup pkg_mynewt_core mynewt-core
|
||||
* @ingroup pkg
|
||||
* @brief Apache MyNewt package for MyNewt based packages: uwb-core, nimble
|
||||
* @see https://github.com/apache/mynewt-core
|
||||
*/
|
||||
|
||||
# Apache MyNewt mynewt-core Package
|
||||
|
||||
Packages like @ref pkg_uwb_core and @ref nimble where developed with MyNewt
|
||||
as their default OS. Some of the features provided by that OS are not abstracted.
|
||||
For those cases and to avoid header re-definitions mynewt-core is pulled in.
|
@ -7,18 +7,18 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* @ingroup pkg_uwb_core
|
||||
* @ingroup pkg_mynewt_core
|
||||
* @{
|
||||
*
|
||||
* @file
|
||||
* @brief System logging header for uwb-core
|
||||
* @brief System logging header for mynewt-core
|
||||
*
|
||||
* @author Francisco Molina <francois-xavier.molina@inria.fr>
|
||||
* @}
|
||||
*/
|
||||
|
||||
#ifndef LOG_DPL_LOG_H
|
||||
#define LOG_DPL_LOG_H
|
||||
#ifndef LOG_LOG_H
|
||||
#define LOG_LOG_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
@ -45,4 +45,4 @@ struct log {
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* LOG_DPL_LOG_H */
|
||||
#endif /* LOG_LOG_H */
|
61
pkg/mynewt-core/include/mcu/mcu.h
Normal file
61
pkg/mynewt-core/include/mcu/mcu.h
Normal file
@ -0,0 +1,61 @@
|
||||
/*
|
||||
* Copyright (C) 2020 Inria
|
||||
*
|
||||
* This file is subject to the terms and conditions of the GNU Lesser
|
||||
* General Public License v2.1. See the file LICENSE in the top level
|
||||
* directory for more details.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @ingroup pkg_mynewt_core
|
||||
* @{
|
||||
*
|
||||
* @file
|
||||
* @brief Abstraction layer for RIOT adaption
|
||||
*
|
||||
* @author Francisco Molina <francois-xavier.molina@inria.fr>
|
||||
* @}
|
||||
*/
|
||||
|
||||
#ifndef MCU_MCU_H
|
||||
#define MCU_MCU_H
|
||||
|
||||
#include "cpu.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Set nrf5x radio ISR callback
|
||||
*
|
||||
* @param[in] irqn IRQ number
|
||||
* @param[in] addr the ISR callback
|
||||
*/
|
||||
void nrf5x_hw_set_isr(int irqn, void (*addr)(void));
|
||||
|
||||
/**
|
||||
* @name Entering and exiting critical section defines
|
||||
* @{
|
||||
*/
|
||||
#define __HAL_DISABLE_INTERRUPTS(x) \
|
||||
do { \
|
||||
x = irq_disable(); \
|
||||
} while (0);
|
||||
|
||||
#define __HAL_ENABLE_INTERRUPTS(x) \
|
||||
do { \
|
||||
if (x) { \
|
||||
irq_restore(x); \
|
||||
} \
|
||||
else { \
|
||||
irq_enable(); \
|
||||
} \
|
||||
} while (0);
|
||||
/** @} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* MCU_MCU_H */
|
@ -7,27 +7,30 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* @ingroup pkg_uwb_core
|
||||
* @ingroup pkg_mynewt_core
|
||||
* @{
|
||||
*
|
||||
* @file
|
||||
* @brief Abstraction layer for RIOT adaption
|
||||
* @brief mynewt-core header
|
||||
*
|
||||
* @author Francisco Molina <francois-xavier.molina@inria.fr>
|
||||
* @}
|
||||
*/
|
||||
|
||||
#ifndef STATS_STATS_H
|
||||
#define STATS_STATS_H
|
||||
#ifndef OS_MYNEWT_H
|
||||
#define OS_MYNEWT_H
|
||||
|
||||
#include <stdlib.h>
|
||||
#include "syscfg/syscfg.h"
|
||||
#include "sysinit/sysinit.h"
|
||||
#include "os/os.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* empty header */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* STATS_STATS_H */
|
||||
#endif /* OS_MYNEWT_H */
|
146
pkg/mynewt-core/include/os/os.h
Normal file
146
pkg/mynewt-core/include/os/os.h
Normal file
@ -0,0 +1,146 @@
|
||||
/**
|
||||
* Apache Mynewt
|
||||
* Copyright 2015-2021 The Apache Software Foundation
|
||||
*
|
||||
* This product includes software developed at
|
||||
* The Apache Software Foundation (http://www.apache.org/).
|
||||
*
|
||||
* Portions of this software were developed at
|
||||
* Runtime Inc, copyright 2015.
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @ingroup pkg_mynewt_core
|
||||
* @{
|
||||
*
|
||||
* @file
|
||||
* @brief mynewt-core error types
|
||||
*
|
||||
* @}
|
||||
*/
|
||||
|
||||
#ifndef OS_OS_H
|
||||
#define OS_OS_H
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include "irq.h"
|
||||
#include "os/os_types.h"
|
||||
#include "os/os_error.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @name MyNewt os/%.h required macros
|
||||
* @{
|
||||
*
|
||||
* PLEASE NOTE: Following macro definitions where copied directly from
|
||||
* apache/mynewt-core and are under the copyright specified in
|
||||
* the header.
|
||||
*
|
||||
*/
|
||||
#ifndef min
|
||||
#define min(a, b) ((a)<(b)?(a):(b))
|
||||
#endif
|
||||
|
||||
#ifndef max
|
||||
#define max(a, b) ((a)>(b)?(a):(b))
|
||||
#endif
|
||||
|
||||
#define OS_ALIGN(__n, __a) ( \
|
||||
(((__n) & ((__a) - 1)) == 0) ? \
|
||||
(__n) : \
|
||||
((__n) + ((__a) - ((__n) & ((__a) - 1)))) \
|
||||
)
|
||||
#define OS_ALIGNMENT (4)
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* @brief CPU status register
|
||||
*/
|
||||
typedef uint32_t os_sr_t;
|
||||
|
||||
/**
|
||||
* @name Entering and exiting critical section defines
|
||||
* @{
|
||||
*/
|
||||
#define OS_ENTER_CRITICAL(_sr) (_sr = os_hw_enter_critical())
|
||||
#define OS_EXIT_CRITICAL(_sr) (os_hw_exit_critical(_sr))
|
||||
#define OS_ASSERT_CRITICAL() assert(os_hw_is_in_critical())
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* @brief Disable ISRs
|
||||
*
|
||||
* @return current isr context
|
||||
*/
|
||||
static inline uint32_t os_hw_enter_critical(void)
|
||||
{
|
||||
uint32_t ctx = irq_disable();
|
||||
return ctx;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Restores ISR context
|
||||
*
|
||||
* @param[in] ctx ISR context to restore.
|
||||
*/
|
||||
static inline void os_hw_exit_critical(uint32_t ctx)
|
||||
{
|
||||
irq_restore((unsigned)ctx);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Check if is in critical section
|
||||
*
|
||||
* @return true, if in critical section, false otherwise
|
||||
*/
|
||||
static inline bool os_hw_is_in_critical(void)
|
||||
{
|
||||
return (irq_is_in() || __get_PRIMASK());
|
||||
}
|
||||
|
||||
/* Mynewt components (not abstracted in NPL or DPL) */
|
||||
#include "os/endian.h"
|
||||
#include "os/os_callout.h"
|
||||
#include "os/os_cputime.h"
|
||||
#include "os/os_dev.h"
|
||||
#include "os/os_eventq.h"
|
||||
#include "os/os_mbuf.h"
|
||||
#include "os/os_mempool.h"
|
||||
#include "os/os_mutex.h"
|
||||
#include "os/os_sem.h"
|
||||
#include "os/os_task.h"
|
||||
#include "os/os_time.h"
|
||||
#include "os/os_trace_api.h"
|
||||
#include "os/queue.h"
|
||||
|
||||
#if IS_USED(MODULE_NIMBLE)
|
||||
#include "nimble/nimble_npl.h"
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* OS_OS_H */
|
@ -7,7 +7,7 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* @ingroup pkg_uwb_core
|
||||
* @ingroup pkg_mynewt_core
|
||||
* @{
|
||||
*
|
||||
* @file
|
||||
@ -19,13 +19,6 @@
|
||||
#ifndef OS_OS_DEV_H
|
||||
#define OS_OS_DEV_H
|
||||
|
||||
#include "dpl/dpl.h"
|
||||
#include "dpl/queue.h"
|
||||
|
||||
#include "net/ieee802154.h"
|
||||
#include "net/netdev.h"
|
||||
#include "net/netdev/ieee802154.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
@ -34,7 +27,6 @@ extern "C" {
|
||||
* @brief Device structure.
|
||||
*/
|
||||
struct os_dev {
|
||||
netdev_ieee802154_t netdev; /**< Netdev parent struct */
|
||||
};
|
||||
|
||||
/**
|
236
pkg/mynewt-core/include/os/os_eventq.h
Normal file
236
pkg/mynewt-core/include/os/os_eventq.h
Normal file
@ -0,0 +1,236 @@
|
||||
/*
|
||||
* Copyright (C) 2020 Inria
|
||||
*
|
||||
* This file is subject to the terms and conditions of the GNU Lesser
|
||||
* General Public License v2.1. See the file LICENSE in the top level
|
||||
* directory for more details.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @ingroup pkg_mynewt_core
|
||||
* @{
|
||||
*
|
||||
* @file
|
||||
* @brief mynewt-core event and event queue abstraction
|
||||
*
|
||||
* @author Francisco Molina <francois-xavier.molina@inria.fr>
|
||||
* @}
|
||||
*/
|
||||
|
||||
#ifndef OS_OS_EVENTQ_H
|
||||
#define OS_OS_EVENTQ_H
|
||||
|
||||
#include <os/os_types.h>
|
||||
|
||||
#include "event/callback.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Event wrapper
|
||||
*/
|
||||
struct os_event
|
||||
{
|
||||
event_callback_t e; /**< the event callback */
|
||||
void *arg; /**< the event argument */
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Event queue wrapper
|
||||
*/
|
||||
struct os_eventq
|
||||
{
|
||||
event_queue_t q; /**< the event queue */
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Event callback function
|
||||
*/
|
||||
typedef void os_event_fn(struct os_event *ev);
|
||||
|
||||
/**
|
||||
* @brief Init a event
|
||||
*
|
||||
* @param[in] ev pointer to event to set
|
||||
* @param[in] fn event callback function
|
||||
* @param[in] arg event argument
|
||||
*/
|
||||
static inline void os_event_init(struct os_event *ev, os_event_fn * fn,
|
||||
void *arg)
|
||||
{
|
||||
/*
|
||||
* Need to clear list_node manually since init function below does not do
|
||||
* this.
|
||||
*/
|
||||
ev->e.super.list_node.next = NULL;
|
||||
event_callback_init(&ev->e, (void(*)(void *))fn, ev);
|
||||
ev->arg = arg;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Check if event is in queue
|
||||
*
|
||||
* @param[in] ev event to check
|
||||
*
|
||||
* @return true if event is queues, false otherwise
|
||||
*/
|
||||
static inline bool os_event_is_queued(struct os_event *ev)
|
||||
{
|
||||
return (ev->e.super.list_node.next != NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Returns event argument
|
||||
*
|
||||
* @param[in] ev event
|
||||
*/
|
||||
static inline void *os_event_get_arg(struct os_event *ev)
|
||||
{
|
||||
return ev->arg;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Set the event argument
|
||||
*
|
||||
* @param[in] ev event
|
||||
* @param[in] arg arg to set event
|
||||
*/
|
||||
static inline void os_event_set_arg(struct os_event *ev, void *arg)
|
||||
{
|
||||
ev->arg = arg;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Runs an event
|
||||
*
|
||||
* @param[in] ev event to run
|
||||
*/
|
||||
static inline void os_event_run(struct os_event *ev)
|
||||
{
|
||||
ev->e.super.handler(&ev->e.super);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Initialize the event queue
|
||||
*
|
||||
* @param[in] evq The event queue to initialize
|
||||
*/
|
||||
static inline void os_eventq_init(struct os_eventq *evq)
|
||||
{
|
||||
event_queue_init_detached(&evq->q);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Check whether the event queue is initialized.
|
||||
*
|
||||
* @param[in] evq the event queue to check
|
||||
*/
|
||||
static inline int os_eventq_inited(struct os_eventq *evq)
|
||||
{
|
||||
return evq->q.waiter != NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Deinitialize an event queue
|
||||
*
|
||||
* @note Not supported in RIOT
|
||||
*
|
||||
* @param[in] evq the event queue to deinit
|
||||
*/
|
||||
static inline void os_eventq_deinit(struct os_eventq *evq)
|
||||
{
|
||||
(void) evq;
|
||||
/* Can't deinit an eventq in RIOT */
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get next event from event queue
|
||||
*
|
||||
* @param[in] evq the event queue to pull an event from
|
||||
* @param[in] tmo timeout, OS_WAIT_FOREVER to block, 0 to return immediately
|
||||
*
|
||||
* @return the event from the queue
|
||||
*/
|
||||
static inline struct os_event * os_eventq_get(struct os_eventq *evq, os_time_t tmo)
|
||||
{
|
||||
if (evq->q.waiter == NULL) {
|
||||
event_queue_claim(&evq->q);
|
||||
}
|
||||
|
||||
if (tmo == 0) {
|
||||
return (struct os_event *)event_get(&evq->q);
|
||||
} else if (tmo == OS_WAIT_FOREVER) {
|
||||
return (struct os_event *)event_wait(&evq->q);
|
||||
} else {
|
||||
return (struct os_event *)event_wait_timeout_ztimer(&evq->q,
|
||||
ZTIMER_MSEC,
|
||||
(uint32_t)tmo);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get next event from event queue, non-blocking
|
||||
*
|
||||
* @return event from the queue, or NULL if none available.
|
||||
*/
|
||||
static inline struct os_event * os_eventq_get_no_wait(struct os_eventq *evq)
|
||||
{
|
||||
if (evq->q.waiter == NULL) {
|
||||
event_queue_claim(&evq->q);
|
||||
}
|
||||
|
||||
return (struct os_event *) event_get(&evq->q);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Put an event on the event queue.
|
||||
*
|
||||
* @param[in] evq event queue
|
||||
* @param[in] ev event to put in queue
|
||||
*/
|
||||
static inline void os_eventq_put(struct os_eventq *evq, struct os_event *ev)
|
||||
{
|
||||
event_post(&evq->q, &ev->e.super);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Remove an event from the queue.
|
||||
*
|
||||
* @param[in] evq event queue to remove the event from
|
||||
* @param[in] ev event to remove from the queue
|
||||
*/
|
||||
static inline void os_eventq_remove(struct os_eventq *evq, struct os_event *ev)
|
||||
{
|
||||
event_cancel(&evq->q, &ev->e.super);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Gets and runs an event from the queue callback.
|
||||
*
|
||||
* @param[in] evq The event queue to pull the item off.
|
||||
*/
|
||||
static inline void os_eventq_run(struct os_eventq *evq)
|
||||
{
|
||||
struct os_event *ev = os_eventq_get(evq, OS_WAIT_FOREVER);
|
||||
os_event_run(ev);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Check if queue is empty
|
||||
*
|
||||
* @param[in] evq the event queue to check
|
||||
*
|
||||
* @return true if empty, false otherwise
|
||||
*/
|
||||
static inline bool os_eventq_is_empty(struct os_eventq *evq)
|
||||
{
|
||||
return clist_count(&(evq->q.event_list)) == 0;
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* OS_OS_EVENTQ_H */
|
116
pkg/mynewt-core/include/os/os_time.h
Normal file
116
pkg/mynewt-core/include/os/os_time.h
Normal file
@ -0,0 +1,116 @@
|
||||
/*
|
||||
* Copyright (C) 2020 Inria
|
||||
*
|
||||
* This file is subject to the terms and conditions of the GNU Lesser
|
||||
* General Public License v2.1. See the file LICENSE in the top level
|
||||
* directory for more details.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @ingroup pkg_mynewt_core
|
||||
* @{
|
||||
*
|
||||
* @file
|
||||
* @brief mynewt-core time abstraction
|
||||
*
|
||||
* @author Francisco Molina <francois-xavier.molina@inria.fr>
|
||||
* @}
|
||||
*/
|
||||
|
||||
#ifndef OS_OS_TIME_H
|
||||
#define OS_OS_TIME_H
|
||||
|
||||
#include "os/os_error.h"
|
||||
#include "ztimer.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Ticks per seconds, ztimer_msec is used as system timer
|
||||
*/
|
||||
#define OS_TICKS_PER_SEC (MS_PER_SEC)
|
||||
|
||||
/**
|
||||
* @brief Returns the low 32 bits of cputime.
|
||||
*
|
||||
* @return uint32_t The lower 32 bits of cputime
|
||||
*/
|
||||
static inline os_time_t os_time_get(void)
|
||||
{
|
||||
return ztimer_now(ZTIMER_MSEC);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Converts the given number of milliseconds into cputime ticks.
|
||||
*
|
||||
* @param[in] ms The number of milliseconds to convert to ticks
|
||||
* @param[out] out_ticks The number of ticks corresponding to 'ms'
|
||||
*
|
||||
* @return os_error_t OS_OK - no error
|
||||
*/
|
||||
static inline os_error_t os_time_ms_to_ticks(uint32_t ms, os_time_t *out_ticks)
|
||||
{
|
||||
*out_ticks = ms;
|
||||
return OS_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Convert the given number of ticks into milliseconds.
|
||||
*
|
||||
* @param[in] ticks The number of ticks to convert to milliseconds.
|
||||
* @param[out] out_ms The converted milliseconds from 'ticks'
|
||||
*
|
||||
* @return os_error_t OS_OK - no error
|
||||
*/
|
||||
static inline os_error_t os_time_ticks_to_ms(os_time_t ticks, uint32_t *out_ms)
|
||||
{
|
||||
*out_ms = ticks;
|
||||
return OS_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Converts the given number of milliseconds into cputime ticks.
|
||||
*
|
||||
* @param[in] ms The number of milliseconds to convert to ticks
|
||||
*
|
||||
* @return uint32_t The number of ticks corresponding to 'ms'
|
||||
*/
|
||||
static inline os_time_t os_time_ms_to_ticks32(uint32_t ms)
|
||||
{
|
||||
return ms;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Convert the given number of ticks into milliseconds.
|
||||
*
|
||||
* @param[in] ticks The number of ticks to convert to milliseconds.
|
||||
*
|
||||
* @return uint32_t The number of milliseconds corresponding to 'ticks'
|
||||
*/
|
||||
static inline os_time_t os_time_ticks_to_ms32(os_time_t ticks)
|
||||
{
|
||||
return ticks;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Wait until the number of ticks has elapsed, BLOICKING.
|
||||
*
|
||||
* @param[in] ticks The number of ticks to wait.
|
||||
*/
|
||||
static inline void os_time_delay(os_time_t ticks)
|
||||
{
|
||||
if (irq_is_in()) {
|
||||
ztimer_spin(ZTIMER_MSEC, ticks);
|
||||
}
|
||||
else {
|
||||
ztimer_sleep(ZTIMER_MSEC, ticks);
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* OS_OS_TIME_H */
|
59
pkg/mynewt-core/include/os/os_types.h
Normal file
59
pkg/mynewt-core/include/os/os_types.h
Normal file
@ -0,0 +1,59 @@
|
||||
/*
|
||||
* Copyright (C) 2020 Inria
|
||||
*
|
||||
* This file is subject to the terms and conditions of the GNU Lesser
|
||||
* General Public License v2.1. See the file LICENSE in the top level
|
||||
* directory for more details.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @ingroup pkg_mynewt_core
|
||||
* @{
|
||||
*
|
||||
* @file
|
||||
* @brief mynewt-core types
|
||||
*
|
||||
* @author Francisco Molina <francois-xavier.molina@inria.fr>
|
||||
* @}
|
||||
*/
|
||||
|
||||
#ifndef OS_OS_TYPES_H
|
||||
#define OS_OS_TYPES_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @name Error codes not abstracted in mynewt-core/kernel/os
|
||||
* @{
|
||||
*/
|
||||
#define SYS_EINVAL (-2)
|
||||
#define SYS_ENOMEM (-1)
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* @name Macro to wait forever on events and mutexes
|
||||
* @{
|
||||
*/
|
||||
#define OS_TIMEOUT_NEVER (UINT32_MAX)
|
||||
#define OS_WAIT_FOREVER (OS_TIMEOUT_NEVER)
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* @brief time type
|
||||
*/
|
||||
typedef uint32_t os_time_t;
|
||||
|
||||
/**
|
||||
* @brief stack buffer type
|
||||
*/
|
||||
typedef char os_stack_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* OS_OS_TYPES_H */
|
122
pkg/mynewt-core/include/syscfg/syscfg.h
Normal file
122
pkg/mynewt-core/include/syscfg/syscfg.h
Normal file
@ -0,0 +1,122 @@
|
||||
/**
|
||||
* Apache Mynewt
|
||||
* Copyright 2015-2021 The Apache Software Foundation
|
||||
*
|
||||
* This product includes software developed at
|
||||
* The Apache Software Foundation (http://www.apache.org/).
|
||||
*
|
||||
* Portions of this software were developed at
|
||||
* Runtime Inc, copyright 2015.
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @ingroup pkg_mynewt_core
|
||||
* @{
|
||||
*
|
||||
* @file
|
||||
* @brief mynewt-core system configurations
|
||||
*
|
||||
* @}
|
||||
*/
|
||||
|
||||
#ifndef SYSCFG_SYSCFG_H
|
||||
#define SYSCFG_SYSCFG_H
|
||||
|
||||
#include "kernel_defines.h"
|
||||
|
||||
/**
|
||||
* @name MyNewt header inclusion macro definitions
|
||||
* @{
|
||||
*
|
||||
* PLEASE NOTE: Following macro definitions where copied directly from
|
||||
* apache/mynewt-core and are under the copyright specified in
|
||||
* the header.
|
||||
*
|
||||
* This macro exists to ensure code includes this header when needed. If code
|
||||
* checks the existence of a setting directly via ifdef without including this
|
||||
* header, the setting macro will silently evaluate to 0. In contrast, an
|
||||
* attempt to use these macros without including this header will result in a
|
||||
* compiler error.
|
||||
*/
|
||||
#define MYNEWT_VAL(_name) MYNEWT_VAL_ ## _name
|
||||
#define MYNEWT_VAL_CHOICE(_name, _val) MYNEWT_VAL_ ## _name ## __ ## _val
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* @brief TIMER 5 (RTC_DEV0) will be mynewt-core OS_CPUTIME timer
|
||||
*/
|
||||
#ifndef MYNEWT_VAL_OS_CPUTIME_TIMER_NUM
|
||||
#define MYNEWT_VAL_OS_CPUTIME_TIMER_NUM (5)
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Enable TIMER 5 (RTC_DEV0)
|
||||
*/
|
||||
#ifndef MYNEWT_VAL_TIMER_5
|
||||
#define MYNEWT_VAL_TIMER_5 (1)
|
||||
#endif
|
||||
|
||||
#if IS_USED(MODULE_NIMBLE)
|
||||
/*** @mynewt-nimble */
|
||||
#undef MYNEWT_VAL
|
||||
#undef MYNEWT_VAL_CHOICE
|
||||
#include "npl_sycfg.h"
|
||||
#endif
|
||||
|
||||
#if IS_USED(MODULE_UWB_CORE)
|
||||
/*** @decawave-mynewt-core/hw/drivers/uwb */
|
||||
#include "dpl_syscfg/syscfg_uwb.h"
|
||||
|
||||
/*** @decawave-mynewt-core/lib/twr_ds */
|
||||
#include "dpl_syscfg/syscfg_twr_ds.h"
|
||||
|
||||
/*** @decawave-mynewt-core/lib/twr_ds_ext */
|
||||
#include "dpl_syscfg/syscfg_twr_ds_ext.h"
|
||||
|
||||
/*** @decawave-mynewt-core/lib/twr_ss */
|
||||
#include "dpl_syscfg/syscfg_twr_ss.h"
|
||||
|
||||
/*** @decawave-mynewt-core/lib/twr_ss_ack */
|
||||
#include "dpl_syscfg/syscfg_twr_ss_ack.h"
|
||||
|
||||
/*** @decawave-mynewt-core/lib/twr_ss_ext */
|
||||
#include "dpl_syscfg/syscfg_twr_ss_ext.h"
|
||||
|
||||
/*** @decawave-mynewt-core/lib/uwb_rng */
|
||||
#include "dpl_syscfg/syscfg_uwb_rng.h"
|
||||
|
||||
/*** @decawave-mynewt-core/sys/uwbcfg */
|
||||
#include "dpl_syscfg/syscfg_uwbcfg.h"
|
||||
#endif
|
||||
|
||||
#if IS_USED(MODULE_UWB_DW1000)
|
||||
/*** @decawave-uwb-dw1000/hw/drivers/uwb/uwb_dw1000 */
|
||||
#include "syscfg_uwb_dw1000.h"
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* SYSCFG_SYSCFG_H */
|
@ -7,7 +7,7 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* @ingroup pkg_uwb_core
|
||||
* @ingroup pkg_mynewt_core
|
||||
* @{
|
||||
*
|
||||
* @file
|
||||
@ -27,10 +27,15 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief DPL assert macro
|
||||
* @brief assert macro
|
||||
*/
|
||||
#define SYSINIT_PANIC_ASSERT(rc) assert(rc);
|
||||
|
||||
/**
|
||||
* @brief empty definition
|
||||
*/
|
||||
#define SYSINIT_ASSERT_ACTIVE()
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
5
pkg/mynewt-core/mynewt-core_nrf5x_hal.mk
Normal file
5
pkg/mynewt-core/mynewt-core_nrf5x_hal.mk
Normal file
@ -0,0 +1,5 @@
|
||||
MODULE = mynewt-core_nrf5x_hal
|
||||
|
||||
SRC := hal_timer.c
|
||||
|
||||
include $(RIOTBASE)/Makefile.base
|
15
pkg/mynewt-core/mynewt-core_os.mk
Normal file
15
pkg/mynewt-core/mynewt-core_os.mk
Normal file
@ -0,0 +1,15 @@
|
||||
MODULE = mynewt-core_os
|
||||
|
||||
SRC := \
|
||||
endian.c \
|
||||
os_mbuf.c \
|
||||
os_mempool.c \
|
||||
os_msys.c \
|
||||
os_cputime_pwr2.c \
|
||||
#
|
||||
|
||||
ifneq (,$(filter nrf%,$(CPU)))
|
||||
SRC += os_cputime.c
|
||||
endif
|
||||
|
||||
include $(RIOTBASE)/Makefile.base
|
5
pkg/mynewt-core/mynewt-core_util.mk
Normal file
5
pkg/mynewt-core/mynewt-core_util.mk
Normal file
@ -0,0 +1,5 @@
|
||||
MODULE = mynewt-core_util
|
||||
|
||||
SRC := mem.c
|
||||
|
||||
include $(RIOTBASE)/Makefile.base
|
Binary file not shown.
BIN
pkg/mynewt-core/patches/0002-kernel-os-src-riot-patches.patch
Normal file
BIN
pkg/mynewt-core/patches/0002-kernel-os-src-riot-patches.patch
Normal file
Binary file not shown.
BIN
pkg/mynewt-core/patches/0003-hw-hal-patch-hal_timer.patch
Normal file
BIN
pkg/mynewt-core/patches/0003-hw-hal-patch-hal_timer.patch
Normal file
Binary file not shown.
@ -30,12 +30,12 @@ SUBMODS := $(filter-out $(IGNORE),$(filter nimble_%,$(USEMODULE)))
|
||||
|
||||
all: $(SUBMODS)
|
||||
|
||||
# blue code and RIOT port modules
|
||||
# glue code and RIOT port modules
|
||||
nimble_riot_contrib:
|
||||
$(QQ)"$(MAKE)" -C $(TDIR)/contrib/
|
||||
|
||||
nimble_porting_nimble:
|
||||
$(QQ)"$(MAKE)" -C $(PDIR)/porting/nimble/src/ -f $(RIOTBASE)/Makefile.base MODULE=$@
|
||||
$(QQ)"$(MAKE)" -C $(PDIR)/porting/nimble/src/ -f $(RIOTPKG)/$(PKG_NAME)/nimble.porting.mk MODULE=$@
|
||||
|
||||
nimble_npl_riot:
|
||||
$(QQ)"$(MAKE)" -C $(PDIR)/porting/npl/riot/src/ -f $(RIOTBASE)/Makefile.base MODULE=$@
|
||||
|
@ -11,7 +11,20 @@ USEMODULE += nimble_riot_contrib
|
||||
|
||||
# RIOT port
|
||||
USEMODULE += nimble_porting_nimble
|
||||
USEMODULE += nimble_npl_riot
|
||||
|
||||
# NOTE: this dependency depends on inclusion order, for it to work properly
|
||||
# mynewt-core should be selected as nimble backend as early as possible,
|
||||
# i.e. at the application level.
|
||||
ifneq (,$(filter mynewt-core,$(USEPKG)))
|
||||
USEMODULE += mynewt-core_os
|
||||
USEMODULE += mynewt-core_util
|
||||
USEMODULE += mynewt-core_nrf5x_hal
|
||||
else
|
||||
# uwb-% requires mynewt-core so is incompatible with nimble_npl_riot
|
||||
ifeq (,$(filter uwb%,$(USEPKG)))
|
||||
USEMODULE += nimble_npl_riot
|
||||
endif
|
||||
endif
|
||||
|
||||
# if nothing else is specified, we build the host and controller
|
||||
ifeq (,$(filter nimble_host nimble_controller,$(USEMODULE)))
|
||||
|
@ -7,7 +7,12 @@ INCLUDES += -I$(RIOTPKG)/nimble/contrib/include
|
||||
INCLUDES += $(NIMIBASE)/nimble/include
|
||||
|
||||
# include the RIOT NPL headers
|
||||
INCLUDES += $(NIMIBASE)/porting/npl/riot/include
|
||||
ifneq (,$(filter nimble_npl_riot,$(USEMODULE)))
|
||||
INCLUDES += $(NIMIBASE)/porting/npl/riot/include
|
||||
else
|
||||
INCLUDES += $(NIMIBASE)/porting/npl/riot/include/npl_syscfg
|
||||
INCLUDES += -I$(RIOTPKG)/nimble/npl/include
|
||||
endif
|
||||
INCLUDES += $(NIMIBASE)/porting/nimble/include
|
||||
|
||||
# include nimble controller headers
|
||||
@ -15,8 +20,9 @@ ifneq (,$(filter nimble_controller,$(USEMODULE)))
|
||||
INCLUDES += $(NIMIBASE)/nimble/controller/include
|
||||
# set environment
|
||||
CFLAGS += -DNIMBLE_CFG_CONTROLLER=1
|
||||
CFLAGS += -DMYNEWT_VAL_OS_CPUTIME_FREQ=32768
|
||||
|
||||
ifneq (,$(filter nimble_npl_riot,$(USEMODULE)))
|
||||
CFLAGS += -DMYNEWT_VAL_OS_CPUTIME_FREQ=32768
|
||||
endif
|
||||
ifneq (,$(filter nimble_drivers_nrf5x,$(USEMODULE)))
|
||||
INCLUDES += $(NIMIBASE)/nimble/drivers/$(CPU_FAM)/include
|
||||
endif
|
||||
|
5
pkg/nimble/nimble.porting.mk
Normal file
5
pkg/nimble/nimble.porting.mk
Normal file
@ -0,0 +1,5 @@
|
||||
ifneq (,$(filter mynewt-core,$(USEMODULE)))
|
||||
SRC = nimble_port.c
|
||||
endif
|
||||
|
||||
include $(RIOTBASE)/Makefile.base
|
571
pkg/nimble/npl/include/nimble/nimble_npl_os.h
Normal file
571
pkg/nimble/npl/include/nimble/nimble_npl_os.h
Normal file
@ -0,0 +1,571 @@
|
||||
/*
|
||||
* Copyright (C) 2020 Inria
|
||||
*
|
||||
* This file is subject to the terms and conditions of the GNU Lesser
|
||||
* General Public License v2.1. See the file LICENSE in the top level
|
||||
* directory for more details.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @ingroup pkg_nimble
|
||||
* @{
|
||||
*
|
||||
* @file
|
||||
* @brief Mynewt-Nimble Porting layer wrappers
|
||||
*
|
||||
* @author Hauke Petersen <hauke.petersen@fu-berlin.de>
|
||||
* @}
|
||||
*/
|
||||
|
||||
#ifndef NIMBLE_NIMBLE_NPL_OS_H
|
||||
#define NIMBLE_NIMBLE_NPL_OS_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include "os/os.h"
|
||||
#include "mcu/mcu.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @name BLE NPL layer macros
|
||||
* @{
|
||||
*/
|
||||
#define BLE_NPL_OS_ALIGNMENT (OS_ALIGNMENT)
|
||||
#define BLE_NPL_TIME_FOREVER (OS_WAIT_FOREVER)
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* @brief time type
|
||||
*/
|
||||
typedef uint32_t ble_npl_time_t;
|
||||
/**
|
||||
* @brief time type
|
||||
*/
|
||||
typedef int32_t ble_npl_stime_t;
|
||||
|
||||
/**
|
||||
* @brief ble_npl event wrapper
|
||||
*/
|
||||
struct ble_npl_event {
|
||||
struct os_event ev; /**< the event */
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief ble_npl event queue wrapper
|
||||
*/
|
||||
struct ble_npl_eventq {
|
||||
struct os_eventq evq; /**< the event queue */
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief ble_npl callout wrapper
|
||||
*/
|
||||
struct ble_npl_callout {
|
||||
uint32_t ticks; /**< the callout set timeout */
|
||||
struct os_callout co; /**< the callout */
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief ble_npl mutex wrapper
|
||||
*/
|
||||
struct ble_npl_mutex {
|
||||
struct os_mutex mu; /**< mutex */
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief ble_npl semaphore wrapper
|
||||
*/
|
||||
struct ble_npl_sem {
|
||||
struct os_sem sem; /**< semaphore */
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Not used in RIOT
|
||||
*
|
||||
* @return Always true
|
||||
*/
|
||||
static inline bool ble_npl_os_started(void)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Init a event
|
||||
*
|
||||
* @param[in] ev pointer to event to set
|
||||
* @param[in] fn event callback function
|
||||
* @param[in] arg event argument
|
||||
*/
|
||||
static inline void ble_npl_event_init(struct ble_npl_event *ev, ble_npl_event_fn *fn,
|
||||
void *arg)
|
||||
{
|
||||
os_event_init(&ev->ev, (os_event_fn *)fn, arg);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Check if event is in queue
|
||||
*
|
||||
* @param[in] ev event to check
|
||||
*
|
||||
* @return true if event is queues, false otherwise
|
||||
*/
|
||||
static inline bool ble_npl_event_is_queued(struct ble_npl_event *ev)
|
||||
{
|
||||
return os_event_is_queued(&ev->ev);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Runs an event
|
||||
*
|
||||
* @param[in] ev event to run
|
||||
*/
|
||||
static inline void *ble_npl_event_get_arg(struct ble_npl_event *ev)
|
||||
{
|
||||
return os_event_get_arg(&ev->ev);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Set the vent arg
|
||||
*
|
||||
* @param[in] ev event
|
||||
* @param[in] arg arg to set event
|
||||
*/
|
||||
static inline void ble_npl_event_set_arg(struct ble_npl_event *ev, void *arg)
|
||||
{
|
||||
os_event_set_arg(&ev->ev, arg);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Runs an event
|
||||
*
|
||||
* @param[in] ev event to run
|
||||
*/
|
||||
static inline void ble_npl_event_run(struct ble_npl_event *ev)
|
||||
{
|
||||
os_event_run(&ev->ev);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Initialize the event queue
|
||||
*
|
||||
* @param[in] evq The event queue to initialize
|
||||
*/
|
||||
static inline void ble_npl_eventq_init(struct ble_npl_eventq *evq)
|
||||
{
|
||||
os_eventq_init(&evq->evq);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Check whether the event queue is initialized.
|
||||
*
|
||||
* @param[in] evq the event queue to check
|
||||
*/
|
||||
static inline int ble_npl_eventq_inited(struct ble_npl_eventq *evq)
|
||||
{
|
||||
return os_eventq_inited(&evq->evq);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Deinitialize an event queue
|
||||
*
|
||||
* @note Not supported in RIOT
|
||||
*
|
||||
* @param[in] evq the event queue to deinit
|
||||
*/
|
||||
static inline void ble_npl_eventq_deinit(struct ble_npl_eventq *evq)
|
||||
{
|
||||
(void)evq;
|
||||
/* Can't deinit an eventq in RIOT */
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get next event from event queue, blocking.
|
||||
*
|
||||
* @param[in] evq the event queue to pull an event from
|
||||
* @param[in] tmo timeout, NPL_TIME_FOREVER to block, 0 to return immediately
|
||||
*
|
||||
* @return the event from the queue
|
||||
*/
|
||||
static inline struct ble_npl_event *ble_npl_eventq_get(struct ble_npl_eventq *evq,
|
||||
ble_npl_time_t tmo)
|
||||
{
|
||||
return (struct ble_npl_event *)os_eventq_get(&evq->evq, tmo);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get next event from event queue, non-blocking
|
||||
*
|
||||
* @param[in] evq the event queue to pull an event from
|
||||
*
|
||||
* @return event from the queue, or NULL if none available.
|
||||
*/
|
||||
static inline struct ble_npl_event *ble_npl_eventq_get_no_wait(struct ble_npl_eventq *evq)
|
||||
{
|
||||
return (struct ble_npl_event *)os_eventq_get_no_wait(&evq->evq);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Put an event on the event queue.
|
||||
*
|
||||
* @param[in] evq event queue
|
||||
* @param[in] ev event to put in queue
|
||||
*/
|
||||
static inline void ble_npl_eventq_put(struct ble_npl_eventq *evq, struct ble_npl_event *ev)
|
||||
{
|
||||
os_eventq_put(&evq->evq, &ev->ev);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Remove an event from the queue.
|
||||
*
|
||||
* @param[in] evq event queue to remove the event from
|
||||
* @param[in] ev event to remove from the queue
|
||||
*/
|
||||
static inline void ble_npl_eventq_remove(struct ble_npl_eventq *evq, struct ble_npl_event *ev)
|
||||
{
|
||||
os_eventq_remove(&evq->evq, &ev->ev);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Gets and runs an event from the queue callback.
|
||||
*
|
||||
* @param[in] evq The event queue to pull the item off.
|
||||
*/
|
||||
static inline void ble_npl_eventq_run(struct ble_npl_eventq *evq)
|
||||
{
|
||||
os_eventq_run(&evq->evq);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Check if queue is empty
|
||||
*
|
||||
* @param[in] evq the event queue to check
|
||||
*
|
||||
* @return true if empty, false otherwise
|
||||
*/
|
||||
static inline bool ble_npl_eventq_is_empty(struct ble_npl_eventq *evq)
|
||||
{
|
||||
return os_eventq_is_empty(&evq->evq);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Initializes a mutex object.
|
||||
*
|
||||
* @param[out] mu pre-allocated mutex structure, must not be NULL.
|
||||
*/
|
||||
static inline ble_npl_error_t ble_npl_mutex_init(struct ble_npl_mutex *mu)
|
||||
{
|
||||
return (ble_npl_error_t)os_mutex_init(&mu->mu);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Pend (wait) for a mutex.
|
||||
*
|
||||
* @param[in] mu Pointer to mutex.
|
||||
* @param[in] timeout Timeout, in os ticks.
|
||||
* A timeout of 0 means do not wait if not available.
|
||||
* A timeout of OS_TIMEOUT_NEVER means wait forever.
|
||||
*
|
||||
* @return ble_npl_error_t
|
||||
* BLE_NPL_INVALID_PARM mutex passed in was NULL
|
||||
* BLE_NPL_OK no error
|
||||
*/
|
||||
static inline ble_npl_error_t ble_npl_mutex_pend(struct ble_npl_mutex *mu, ble_npl_time_t timeout)
|
||||
{
|
||||
return (ble_npl_error_t)os_mutex_pend(&mu->mu, timeout);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief Release a mutex.
|
||||
*
|
||||
* @return ble_npl_error_t
|
||||
* BLE_NPL_INVALID_PARM mutex was NULL
|
||||
* BLE_NPL_OK no error
|
||||
*/
|
||||
static inline ble_npl_error_t ble_npl_mutex_release(struct ble_npl_mutex *mu)
|
||||
{
|
||||
return (ble_npl_error_t)os_mutex_release(&mu->mu);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Initialize a semaphore
|
||||
*
|
||||
* @param[in] sem pointer to semaphore
|
||||
* @param[in] tokens # of tokens the semaphore should contain initially.
|
||||
*
|
||||
* @return ble_npl_error_t
|
||||
* BLE_NPL_INVALID_PARM Semaphore passed in was NULL.
|
||||
* BLE_NPL_OK no error.
|
||||
*/
|
||||
static inline ble_npl_error_t ble_npl_sem_init(struct ble_npl_sem *sem, uint16_t tokens)
|
||||
{
|
||||
return (ble_npl_error_t)os_sem_init(&sem->sem, tokens);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Pend (wait) for a semaphore.
|
||||
*
|
||||
* @param[in] sem pointer to semaphore.
|
||||
* @param[in] timeout timeout, in os ticks.
|
||||
* A timeout of 0 means do not wait if not available.
|
||||
* A timeout of BLE_NPL_TIMEOUT_NEVER means wait forever.
|
||||
*
|
||||
*
|
||||
* @return ble_npl_error_t
|
||||
* BLE_NPL_INVALID_PARM semaphore passed in was NULL.
|
||||
* BLE_NPL_TIMEOUT semaphore was owned by another task and timeout=0
|
||||
* BLE_NPL_OK no error
|
||||
*/
|
||||
static inline ble_npl_error_t ble_npl_sem_pend(struct ble_npl_sem *sem, ble_npl_time_t timeout)
|
||||
{
|
||||
return (ble_npl_error_t)os_sem_pend(&sem->sem, timeout);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Release a semaphore.
|
||||
*
|
||||
* @param[in] sem pointer to the semaphore to be released
|
||||
*
|
||||
* @return ble_npl_error_t
|
||||
* BLE_NPL_INVALID_PARM semaphore passed in was NULL.
|
||||
* BLE_NPL_OK no error
|
||||
*/
|
||||
static inline ble_npl_error_t ble_npl_sem_release(struct ble_npl_sem *sem)
|
||||
{
|
||||
return (ble_npl_error_t)os_sem_release(&sem->sem);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get current semaphore's count
|
||||
*/
|
||||
static inline uint16_t ble_npl_sem_get_count(struct ble_npl_sem *sem)
|
||||
{
|
||||
return os_sem_get_count(&sem->sem);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Initialize a callout.
|
||||
*
|
||||
* Callouts are used to schedule events in the future onto an event
|
||||
* queue. Callout timers are scheduled using the ble_npl_callout_reset()
|
||||
* function. When the timer expires, an event is posted to the event
|
||||
* queue specified in ble_npl_callout_init(). The event argument given here
|
||||
* is posted in the ev_arg field of that event.
|
||||
*
|
||||
* @param[out] c callout to initialize
|
||||
* @param[in] q event queue to queue event in
|
||||
* @param[in] e_cb callback function
|
||||
* @param[in] e_arg callback function argument
|
||||
*/
|
||||
static inline void ble_npl_callout_init(struct ble_npl_callout *c, struct ble_npl_eventq *q,
|
||||
ble_npl_event_fn *e_cb, void *e_arg)
|
||||
{
|
||||
os_callout_init(&c->co, &q->evq, (os_event_fn *)e_cb, e_arg);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Reset the callout to fire off in 'ticks' ticks.
|
||||
*
|
||||
* @param[in] c callout to reset
|
||||
* @param[in] ticks number of ticks to wait before posting an event
|
||||
*
|
||||
* @return 0 on success, non-zero on failure
|
||||
*/
|
||||
static inline ble_npl_error_t ble_npl_callout_reset(struct ble_npl_callout *c, ble_npl_time_t ticks)
|
||||
{
|
||||
uint32_t state = os_hw_enter_critical();
|
||||
|
||||
c->ticks = ztimer_now(ZTIMER_MSEC) + ticks;
|
||||
os_callout_reset(&c->co, ticks);
|
||||
os_hw_exit_critical(state);
|
||||
return BLE_NPL_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Stops the callout from firing.
|
||||
*
|
||||
* @param[in] c the callout to stop
|
||||
*/
|
||||
static inline void ble_npl_callout_stop(struct ble_npl_callout *c)
|
||||
{
|
||||
os_callout_stop(&c->co);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Check if callout is active
|
||||
*
|
||||
* @param[in] c the callout to check
|
||||
*
|
||||
* @return true if active, false otherwise
|
||||
*/
|
||||
static inline bool ble_npl_callout_is_active(struct ble_npl_callout *c)
|
||||
{
|
||||
return ztimer_is_set(ZTIMER_MSEC, &c->co.timer);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get the callout set ticks
|
||||
*
|
||||
* @param[in] co the callout to check
|
||||
*/
|
||||
static inline ble_npl_time_t ble_npl_callout_get_ticks(struct ble_npl_callout *co)
|
||||
{
|
||||
return co->ticks;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get the remaining ticks for callout expire
|
||||
*
|
||||
* @param[in] co the callout to check
|
||||
* @param[in] time ignored
|
||||
*
|
||||
* @return remaining ticks
|
||||
*/
|
||||
static inline ble_npl_time_t ble_npl_callout_remaining_ticks(struct ble_npl_callout *co,
|
||||
ble_npl_time_t time)
|
||||
{
|
||||
(void)time;
|
||||
ztimer_now_t now = ztimer_now(ZTIMER_MSEC);
|
||||
return (ble_npl_time_t)(co->ticks - now);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Set the callout event argument
|
||||
*
|
||||
* @param[in] co the callout
|
||||
* @param[in] arg callback function argument
|
||||
*/
|
||||
static inline void ble_npl_callout_set_arg(struct ble_npl_callout *co, void *arg)
|
||||
{
|
||||
co->co.c_ev.arg = arg;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Returns the low 32 bits of cputime.
|
||||
*
|
||||
* @return uint32_t The lower 32 bits of cputime
|
||||
*/
|
||||
static inline ble_npl_time_t ble_npl_time_get(void)
|
||||
{
|
||||
return os_time_get();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Converts the given number of milliseconds into cputime ticks.
|
||||
*
|
||||
* @param[in] ms The number of milliseconds to convert to ticks
|
||||
* @param[out] out_ticks The number of ticks corresponding to 'ms'
|
||||
*
|
||||
* @return ble_npl_error_t BLE_NPL_OK - no error
|
||||
*/
|
||||
static inline ble_npl_error_t ble_npl_time_ms_to_ticks(uint32_t ms, ble_npl_time_t *out_ticks)
|
||||
{
|
||||
return (ble_npl_error_t)os_time_ms_to_ticks(ms, out_ticks);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Convert the given number of ticks into milliseconds.
|
||||
*
|
||||
* @param[in] ticks The number of ticks to convert to milliseconds.
|
||||
* @param[out] out_ms The converted milliseconds from 'ticks'
|
||||
*
|
||||
* @return ble_npl_error_t BLE_NPL_OK - no error
|
||||
*/
|
||||
static inline ble_npl_error_t ble_npl_time_ticks_to_ms(ble_npl_time_t ticks, uint32_t *out_ms)
|
||||
{
|
||||
return (ble_npl_error_t)os_time_ticks_to_ms(ticks, out_ms);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Converts the given number of milliseconds into cputime ticks.
|
||||
*
|
||||
* @param[in] ms The number of milliseconds to convert to ticks
|
||||
*
|
||||
* @return uint32_t The number of ticks corresponding to 'ms'
|
||||
*/
|
||||
static inline ble_npl_time_t ble_npl_time_ms_to_ticks32(uint32_t ms)
|
||||
{
|
||||
return os_time_ms_to_ticks32(ms);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Convert the given number of ticks into milliseconds.
|
||||
*
|
||||
* @param[in] ticks The number of ticks to convert to milliseconds.
|
||||
*
|
||||
* @return uint32_t The number of milliseconds corresponding to 'ticks'
|
||||
*/
|
||||
static inline ble_npl_time_t ble_npl_time_ticks_to_ms32(ble_npl_time_t ticks)
|
||||
{
|
||||
return os_time_ticks_to_ms32(ticks);
|
||||
}
|
||||
/**
|
||||
* @brief Wait until the number of ticks has elapsed, BLOICKING.
|
||||
*
|
||||
* @param[in] ticks The number of ticks to wait.
|
||||
*/
|
||||
static inline void ble_npl_time_delay(ble_npl_time_t ticks)
|
||||
{
|
||||
return os_time_delay(ticks);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Disable ISRs
|
||||
*
|
||||
* @return current isr context
|
||||
*/
|
||||
static inline uint32_t ble_npl_hw_enter_critical(void)
|
||||
{
|
||||
return os_hw_enter_critical();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Restores ISR context
|
||||
*
|
||||
* @param[in] ctx ISR context to restore.
|
||||
*/
|
||||
static inline void ble_npl_hw_exit_critical(uint32_t ctx)
|
||||
{
|
||||
os_hw_exit_critical(ctx);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Check if is in critical section
|
||||
*
|
||||
* @return true, if in critical section, false otherwise
|
||||
*/
|
||||
static inline bool ble_npl_hw_is_in_critical(void)
|
||||
{
|
||||
return os_hw_is_in_critical();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Return current thread PID
|
||||
*
|
||||
* @return PID
|
||||
*/
|
||||
static inline void *ble_npl_get_current_task_id(void)
|
||||
{
|
||||
return (void *)(uint32_t)thread_getpid();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Set nrf5x radio ISR callback
|
||||
*
|
||||
* @param[in] irqn IRQ number
|
||||
* @param[in] addr the ISR callback
|
||||
*/
|
||||
static inline void ble_npl_hw_set_isr(int irqn, void (*addr)(void))
|
||||
{
|
||||
nrf5x_hw_set_isr(irqn, addr);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* NIMBLE_NIMBLE_NPL_OS_H */
|
Binary file not shown.
Binary file not shown.
@ -1,10 +1,11 @@
|
||||
PKG_NAME=uwb-core
|
||||
PKG_URL=https://github.com/Decawave/uwb-core
|
||||
PKG_VERSION=8ffba63755a932a89d841872ce5bdf35b9c78777
|
||||
PKG_VERSION=66f468659ec3353cf7fd6f2bd14f3a6cef397f4e
|
||||
PKG_LICENSE=Apache-2.0
|
||||
|
||||
include $(RIOTBASE)/pkg/pkg.mk
|
||||
|
||||
CFLAGS += -Wno-enum-compare
|
||||
CFLAGS += -Wno-implicit-int
|
||||
CFLAGS += -Wno-int-conversion
|
||||
CFLAGS += -Wno-strict-prototypes
|
||||
|
@ -3,9 +3,6 @@ USEMODULE += uwb-core_contrib
|
||||
|
||||
DEFAULT_MODULE += auto_init_uwb-core
|
||||
|
||||
USEMODULE += sema
|
||||
USEMODULE += event_callback
|
||||
USEMODULE += xtimer
|
||||
USEMODULE += fmt
|
||||
|
||||
FEATURES_REQUIRED += periph_gpio_irq
|
||||
@ -25,12 +22,17 @@ ifneq (,$(filter uwb-core_uwbcfg,$(USEMODULE)))
|
||||
USEMODULE += uwb-core_config
|
||||
endif
|
||||
|
||||
ifneq (,$(filter uwb-core_dpl,$(USEMODULE)))
|
||||
USEPKG += mynewt-core
|
||||
USEMODULE += mynewt-core_os
|
||||
ifneq (,$(filter nrf%,$(CPU)))
|
||||
USEMODULE += mynewt-core_nrf5x_hal
|
||||
endif
|
||||
endif
|
||||
|
||||
# Some stdlib functions used by the pkg are not in avr-gcc
|
||||
FEATURES_BLACKLIST += arch_avr8
|
||||
# uwb-core has specific compilation sources when compiling kernel
|
||||
# libraries these introduce additional compilation issues that have not
|
||||
# been addressed in this port
|
||||
FEATURES_BLACKLIST += arch_native
|
||||
|
||||
# LLVM ARM shows issues with missing definitions for stdatomic
|
||||
TOOLCHAINS_BLACKLIST += llvm
|
||||
|
@ -14,9 +14,7 @@ INCLUDES += -I$(PKGDIRBASE)/uwb-core/hw/drivers/uwb/include/ \
|
||||
-I$(RIOTPKG)/uwb-core/include \
|
||||
#
|
||||
|
||||
DIRS += $(RIOTPKG)/uwb-core/dpl \
|
||||
$(RIOTPKG)/uwb-core/contrib \
|
||||
#
|
||||
PSEUDOMODULES += uwb-core_dpl
|
||||
|
||||
# A cflag to indicate in pkg code that we are building for RIOT
|
||||
CFLAGS += -DRIOT
|
||||
DIRS += $(RIOTPKG)/uwb-core/contrib \
|
||||
#
|
||||
|
@ -17,13 +17,14 @@
|
||||
* @}
|
||||
*/
|
||||
|
||||
#include <stdatomic.h>
|
||||
|
||||
#include "thread.h"
|
||||
#include "event.h"
|
||||
#include "event/callback.h"
|
||||
#include "uwb_core.h"
|
||||
|
||||
#include "os/os_cputime.h"
|
||||
#include "hal/hal_timer.h"
|
||||
|
||||
#ifndef UWB_CORE_STACKSIZE
|
||||
#define UWB_CORE_STACKSIZE (THREAD_STACKSIZE_LARGE)
|
||||
#endif
|
||||
@ -35,11 +36,10 @@ static char _stack_uwb_core[UWB_CORE_STACKSIZE];
|
||||
|
||||
static event_queue_t _queue;
|
||||
|
||||
atomic_uint dpl_in_critical = 0;
|
||||
|
||||
static void *_uwb_core_thread(void *arg)
|
||||
{
|
||||
(void)arg;
|
||||
|
||||
event_queue_init(&_queue);
|
||||
event_loop(&_queue);
|
||||
/* never reached */
|
||||
|
@ -45,35 +45,35 @@ void uwb_core_init(void)
|
||||
uwb_dw1000_set_buffs(&dev, _dw1000_tx_buffer, _dw1000_rx_buffer);
|
||||
/* setup dw1000 device */
|
||||
uwb_dw1000_setup(&dev, (void *) &dw1000_params[0]);
|
||||
/* this will start a thread handling dw1000 device*/
|
||||
/* this will start a thread handling dw1000 device */
|
||||
uwb_dw1000_config_and_start(&dev);
|
||||
|
||||
/* init uwb pkg's */
|
||||
if (IS_USED(MODULE_UWB_CORE_RNG)) {
|
||||
extern void uwb_rng_pkg_init(void);
|
||||
uwb_rng_pkg_init();
|
||||
}
|
||||
#if IS_USED(MODULE_UWB_CORE_RNG)
|
||||
extern void uwb_rng_pkg_init(void);
|
||||
uwb_rng_pkg_init();
|
||||
#endif
|
||||
|
||||
/* uwb configuration module */
|
||||
if (IS_USED(MODULE_UWB_CORE_UWBCFG)) {
|
||||
extern int uwbcfg_pkg_init(void);
|
||||
uwbcfg_pkg_init();
|
||||
}
|
||||
#if IS_USED(MODULE_UWB_CORE_UWBCFG)
|
||||
extern int uwbcfg_pkg_init(void);
|
||||
uwbcfg_pkg_init();
|
||||
#endif
|
||||
|
||||
/* ranging algorithms */
|
||||
if (IS_USED(MODULE_UWB_CORE_RNG)) {
|
||||
twr_ss_pkg_init();
|
||||
}
|
||||
if (IS_USED(MODULE_UWB_CORE_RNG)) {
|
||||
twr_ss_ack_pkg_init();
|
||||
}
|
||||
if (IS_USED(MODULE_UWB_CORE_RNG)) {
|
||||
twr_ss_ext_pkg_init();
|
||||
}
|
||||
if (IS_USED(MODULE_UWB_CORE_RNG)) {
|
||||
twr_ds_pkg_init();
|
||||
}
|
||||
if (IS_USED(MODULE_UWB_CORE_RNG)) {
|
||||
twr_ds_ext_pkg_init();
|
||||
}
|
||||
#if IS_USED(MODULE_UWB_CORE_TWR_SS)
|
||||
twr_ss_pkg_init();
|
||||
#endif
|
||||
#if IS_USED(MODULE_UWB_CORE_TWR_SS_ACK)
|
||||
twr_ss_ack_pkg_init();
|
||||
#endif
|
||||
#if IS_USED(MODULE_UWB_CORE_TWR_SS_EXT)
|
||||
twr_ss_ext_pkg_init();
|
||||
#endif
|
||||
#if IS_USED(MODULE_UWB_CORE_TWR_DS)
|
||||
twr_ds_pkg_init();
|
||||
#endif
|
||||
#if IS_USED(MODULE_UWB_CORE_TWR_DS_EXT)
|
||||
twr_ds_ext_pkg_init();
|
||||
#endif
|
||||
}
|
||||
|
@ -1,3 +0,0 @@
|
||||
MODULE = uwb-core_dpl
|
||||
|
||||
include $(RIOTBASE)/Makefile.base
|
@ -1,58 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2020 Inria
|
||||
*
|
||||
* This file is subject to the terms and conditions of the GNU Lesser
|
||||
* General Public License v2.1. See the file LICENSE in the top level
|
||||
* directory for more details.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @ingroup pkg_uwb_core
|
||||
* @{
|
||||
*
|
||||
* @file
|
||||
* @brief uwb-core DPL (Decawave Porting Layer) callout
|
||||
*
|
||||
* @author Francisco Molina <francois-xavier.molina@inria.fr>
|
||||
* @}
|
||||
*/
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
#include "xtimer.h"
|
||||
#include "dpl/dpl_callout.h"
|
||||
|
||||
static void _dpl_callout_timer_cb(void* arg)
|
||||
{
|
||||
struct dpl_callout *c = (struct dpl_callout *) arg;
|
||||
assert(c);
|
||||
|
||||
/* post the event if there is a queue, otherwise call the callback
|
||||
here */
|
||||
if (c->c_q) {
|
||||
dpl_eventq_put(c->c_q, &c->c_e);
|
||||
} else {
|
||||
c->c_e.e.callback(&c->c_e);
|
||||
}
|
||||
}
|
||||
|
||||
void dpl_callout_init(struct dpl_callout *c, struct dpl_eventq *q,
|
||||
dpl_event_fn *e_cb, void *e_arg)
|
||||
{
|
||||
dpl_event_init(&c->c_e, e_cb, e_arg);
|
||||
c->c_q = q;
|
||||
c->timer.callback = _dpl_callout_timer_cb;
|
||||
c->timer.arg = (void*) c;
|
||||
}
|
||||
|
||||
dpl_error_t dpl_callout_reset(struct dpl_callout *c, dpl_time_t ticks)
|
||||
{
|
||||
xtimer_ticks32_t val = {.ticks32 = ticks};
|
||||
xtimer_set(&(c->timer), xtimer_usec_from_ticks(val));
|
||||
return DPL_OK;
|
||||
}
|
||||
|
||||
void dpl_callout_stop(struct dpl_callout *c)
|
||||
{
|
||||
xtimer_remove(&(c->timer));
|
||||
}
|
@ -1,60 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2020 Inria
|
||||
*
|
||||
* This file is subject to the terms and conditions of the GNU Lesser
|
||||
* General Public License v2.1. See the file LICENSE in the top level
|
||||
* directory for more details.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @ingroup pkg_uwb_core
|
||||
* @{
|
||||
*
|
||||
* @file
|
||||
* @brief Decawave Porting Layer semaphore RIOT wrapper
|
||||
*
|
||||
* @author Francisco Molina <francois-xavier.molina@inria.fr>
|
||||
* @}
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "irq.h"
|
||||
#include "dpl/dpl_sem.h"
|
||||
|
||||
dpl_error_t dpl_sem_init(struct dpl_sem *sem, uint16_t tokens)
|
||||
{
|
||||
if (!sem) {
|
||||
return DPL_INVALID_PARAM;
|
||||
}
|
||||
|
||||
sema_create(&sem->sema, tokens);
|
||||
return DPL_OK;
|
||||
}
|
||||
|
||||
dpl_error_t dpl_sem_release(struct dpl_sem *sem)
|
||||
{
|
||||
int ret;
|
||||
|
||||
if (!sem) {
|
||||
return DPL_INVALID_PARAM;
|
||||
}
|
||||
|
||||
ret = sema_post(&sem->sema);
|
||||
|
||||
return (ret) ? DPL_ERROR : DPL_OK;
|
||||
}
|
||||
|
||||
uint16_t dpl_sem_get_count(struct dpl_sem *sem)
|
||||
{
|
||||
unsigned state = irq_disable();
|
||||
unsigned int value = sem->sema.value;
|
||||
irq_restore(state);
|
||||
return value;
|
||||
}
|
||||
|
||||
dpl_error_t dpl_sem_pend(struct dpl_sem *sem, dpl_time_t timeout)
|
||||
{
|
||||
int ret = sema_wait_timed(&sem->sema, timeout);
|
||||
return (ret) ? DPL_ERROR : DPL_OK;
|
||||
}
|
@ -32,7 +32,6 @@
|
||||
#include "dpl/dpl_tasks.h"
|
||||
#include "dpl/dpl_time.h"
|
||||
#include "kernel_defines.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
@ -23,23 +23,17 @@
|
||||
#ifndef DPL_DPL_CALLOUT_H
|
||||
#define DPL_DPL_CALLOUT_H
|
||||
|
||||
#include "xtimer.h"
|
||||
|
||||
#include "dpl/dpl_types.h"
|
||||
#include "dpl/dpl_eventq.h"
|
||||
#include "dpl/dpl_error.h"
|
||||
#include "os/os_callout.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief callout structure
|
||||
* @brief dpl callout wrapper
|
||||
*/
|
||||
struct dpl_callout {
|
||||
xtimer_t timer; /**< timer */
|
||||
struct dpl_event c_e; /**< callout event */
|
||||
struct dpl_eventq *c_q; /**< callout event queue */
|
||||
struct os_callout co; /**< the callout */
|
||||
};
|
||||
|
||||
/**
|
||||
@ -56,8 +50,11 @@ struct dpl_callout {
|
||||
* @param[in] e_cb callback function
|
||||
* @param[in] e_arg callback function argument
|
||||
*/
|
||||
void dpl_callout_init(struct dpl_callout *c, struct dpl_eventq *q,
|
||||
dpl_event_fn *e_cb, void *e_arg);
|
||||
static inline void dpl_callout_init(struct dpl_callout *c, struct dpl_eventq *q,
|
||||
dpl_event_fn *e_cb, void *e_arg)
|
||||
{
|
||||
os_callout_init(&c->co, &q->evq, (os_event_fn *) e_cb, e_arg);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Reset the callout to fire off in 'ticks' ticks.
|
||||
@ -67,14 +64,20 @@ void dpl_callout_init(struct dpl_callout *c, struct dpl_eventq *q,
|
||||
*
|
||||
* @return 0 on success, non-zero on failure
|
||||
*/
|
||||
dpl_error_t dpl_callout_reset(struct dpl_callout *c, dpl_time_t ticks);
|
||||
static inline dpl_error_t dpl_callout_reset(struct dpl_callout *c, dpl_time_t ticks)
|
||||
{
|
||||
return (dpl_error_t) os_callout_reset(&c->co, ticks);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Stops the callout from firing.
|
||||
*
|
||||
* @param[in] c the callout to stop
|
||||
*/
|
||||
void dpl_callout_stop(struct dpl_callout *c);
|
||||
static inline void dpl_callout_stop(struct dpl_callout *c)
|
||||
{
|
||||
os_callout_stop(&c->co);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -24,10 +24,7 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include "xtimer.h"
|
||||
#include "hal/hal_timer.h"
|
||||
#include "os/os_cputime.h"
|
||||
|
||||
/**
|
||||
* Returns the low 32 bits of cputime.
|
||||
@ -36,7 +33,7 @@ extern "C" {
|
||||
*/
|
||||
static inline uint32_t dpl_cputime_get32(void)
|
||||
{
|
||||
return xtimer_now().ticks32;
|
||||
return os_cputime_get32();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -48,7 +45,7 @@ static inline uint32_t dpl_cputime_get32(void)
|
||||
*/
|
||||
static inline uint32_t dpl_cputime_usecs_to_ticks(uint32_t usecs)
|
||||
{
|
||||
return xtimer_ticks_from_usec(usecs).ticks32;
|
||||
return os_cputime_usecs_to_ticks(usecs);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -60,8 +57,7 @@ static inline uint32_t dpl_cputime_usecs_to_ticks(uint32_t usecs)
|
||||
*/
|
||||
static inline uint32_t dpl_cputime_ticks_to_usecs(uint32_t ticks)
|
||||
{
|
||||
xtimer_ticks32_t val = {.ticks32 = ticks};
|
||||
return xtimer_usec_from_ticks(val);
|
||||
return os_cputime_ticks_to_usecs(ticks);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -71,8 +67,7 @@ static inline uint32_t dpl_cputime_ticks_to_usecs(uint32_t ticks)
|
||||
*/
|
||||
static inline void dpl_cputime_delay_ticks(uint32_t ticks)
|
||||
{
|
||||
xtimer_ticks32_t val = {.ticks32 = ticks};
|
||||
xtimer_tsleep32((xtimer_ticks32_t) val);
|
||||
os_cputime_delay_ticks(ticks);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -82,7 +77,7 @@ static inline void dpl_cputime_delay_ticks(uint32_t ticks)
|
||||
*/
|
||||
static inline void dpl_cputime_delay_usecs(uint32_t usecs)
|
||||
{
|
||||
xtimer_usleep(usecs);
|
||||
os_cputime_delay_usecs(usecs);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -95,8 +90,7 @@ static inline void dpl_cputime_delay_usecs(uint32_t usecs)
|
||||
static inline void dpl_cputime_timer_init(struct hal_timer *timer, hal_timer_cb fp,
|
||||
void *arg)
|
||||
{
|
||||
timer->timer.callback = fp;
|
||||
timer->timer.arg = arg;
|
||||
os_cputime_timer_init(timer, fp, arg);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -107,15 +101,14 @@ static inline void dpl_cputime_timer_init(struct hal_timer *timer, hal_timer_cb
|
||||
*
|
||||
* @param timer Pointer to timer to start. Cannot be NULL.
|
||||
* @param cputime The cputime at which the timer should expire.
|
||||
*
|
||||
*time
|
||||
* @return int 0 on success; EINVAL if timer already started or timer struct
|
||||
* invalid
|
||||
*
|
||||
*/
|
||||
static inline int dpl_cputime_timer_start(struct hal_timer *timer, uint32_t cputime)
|
||||
{
|
||||
xtimer_set(&timer->timer, xtimer_now_usec() + cputime);
|
||||
return 0;
|
||||
return os_cputime_timer_start(timer, cputime);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -132,13 +125,7 @@ static inline int dpl_cputime_timer_start(struct hal_timer *timer, uint32_t cput
|
||||
*/
|
||||
static inline int dpl_cputime_timer_relative(struct hal_timer *timer, uint32_t usecs)
|
||||
{
|
||||
uint32_t now = xtimer_now_usec();
|
||||
if (now > usecs) {
|
||||
xtimer_set(&timer->timer, now);
|
||||
} else {
|
||||
xtimer_set(&timer->timer, 0);
|
||||
}
|
||||
return 0;
|
||||
return os_cputime_timer_relative(timer, usecs);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -152,7 +139,7 @@ static inline int dpl_cputime_timer_relative(struct hal_timer *timer, uint32_t u
|
||||
*/
|
||||
static inline void dpl_cputime_timer_stop(struct hal_timer *timer)
|
||||
{
|
||||
xtimer_remove(&timer->timer);
|
||||
os_cputime_timer_stop(timer);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@ -24,29 +24,31 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "os/os_error.h"
|
||||
|
||||
/**
|
||||
* @brief DPL error types
|
||||
*/
|
||||
enum dpl_error {
|
||||
DPL_OK = 0,
|
||||
DPL_ENOMEM = 1,
|
||||
DPL_EINVAL = 2,
|
||||
DPL_INVALID_PARAM = 3,
|
||||
DPL_MEM_NOT_ALIGNED = 4,
|
||||
DPL_BAD_MUTEX = 5,
|
||||
DPL_TIMEOUT = 6,
|
||||
DPL_ERR_IN_ISR = 7,
|
||||
DPL_ERR_PRIV = 8,
|
||||
DPL_OS_NOT_STARTED = 9,
|
||||
DPL_ENOENT = 10,
|
||||
DPL_EBUSY = 11,
|
||||
DPL_ERROR = 12,
|
||||
DPL_OK = OS_OK,
|
||||
DPL_ENOMEM = OS_ENOMEM,
|
||||
DPL_EINVAL = OS_EINVAL,
|
||||
DPL_INVALID_PARAM = OS_INVALID_PARM,
|
||||
DPL_MEM_NOT_ALIGNED = OS_MEM_NOT_ALIGNED,
|
||||
DPL_BAD_MUTEX = OS_BAD_MUTEX,
|
||||
DPL_TIMEOUT = OS_TIMEOUT,
|
||||
DPL_ERR_IN_ISR = OS_ERR_IN_ISR,
|
||||
DPL_ERR_PRIV = OS_ERR_PRIV,
|
||||
DPL_OS_NOT_STARTED = OS_NOT_STARTED,
|
||||
DPL_ENOENT = OS_ENOENT,
|
||||
DPL_EBUSY = OS_EBUSY,
|
||||
DPL_ERROR = OS_ERROR ,
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief dep error type
|
||||
* @brief dpl error type
|
||||
*/
|
||||
typedef enum dpl_error dpl_error_t;
|
||||
typedef os_error_t dpl_error_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -22,8 +22,8 @@
|
||||
|
||||
#include <dpl/dpl_types.h>
|
||||
|
||||
#include "os/os_eventq.h"
|
||||
#include "uwb_core.h"
|
||||
#include "event/callback.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
@ -32,18 +32,15 @@ extern "C" {
|
||||
/**
|
||||
* @brief dpl event wrapper
|
||||
*/
|
||||
struct dpl_event
|
||||
{
|
||||
event_callback_t e; /**< the event callback */
|
||||
void *arg; /**< the event argument */
|
||||
struct dpl_event {
|
||||
struct os_event ev; /**< the envent */
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief dpl event queue wrapper
|
||||
*/
|
||||
struct dpl_eventq
|
||||
{
|
||||
event_queue_t q; /**< the event queue */
|
||||
struct dpl_eventq {
|
||||
struct os_eventq evq; /**< the event queue */
|
||||
};
|
||||
|
||||
/**
|
||||
@ -61,13 +58,7 @@ typedef void dpl_event_fn(struct dpl_event *ev);
|
||||
static inline void dpl_event_init(struct dpl_event *ev, dpl_event_fn * fn,
|
||||
void *arg)
|
||||
{
|
||||
/*
|
||||
* Need to clear list_node manually since init function below does not do
|
||||
* this.
|
||||
*/
|
||||
ev->e.super.list_node.next = NULL;
|
||||
event_callback_init(&ev->e, (void(*)(void *))fn, ev);
|
||||
ev->arg = arg;
|
||||
os_event_init(&ev->ev, (os_event_fn*) fn, arg);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -79,7 +70,7 @@ static inline void dpl_event_init(struct dpl_event *ev, dpl_event_fn * fn,
|
||||
*/
|
||||
static inline bool dpl_event_is_queued(struct dpl_event *ev)
|
||||
{
|
||||
return (ev->e.super.list_node.next != NULL);
|
||||
return os_event_is_queued(&ev->ev);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -89,7 +80,7 @@ static inline bool dpl_event_is_queued(struct dpl_event *ev)
|
||||
*/
|
||||
static inline void *dpl_event_get_arg(struct dpl_event *ev)
|
||||
{
|
||||
return ev->arg;
|
||||
return os_event_get_arg(&ev->ev);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -100,7 +91,7 @@ static inline void *dpl_event_get_arg(struct dpl_event *ev)
|
||||
*/
|
||||
static inline void dpl_event_set_arg(struct dpl_event *ev, void *arg)
|
||||
{
|
||||
ev->arg = arg;
|
||||
os_event_set_arg(&ev->ev, arg);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -110,7 +101,7 @@ static inline void dpl_event_set_arg(struct dpl_event *ev, void *arg)
|
||||
*/
|
||||
static inline void dpl_event_run(struct dpl_event *ev)
|
||||
{
|
||||
ev->e.super.handler(&ev->e.super);
|
||||
os_event_run(&ev->ev);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -120,7 +111,7 @@ static inline void dpl_event_run(struct dpl_event *ev)
|
||||
*/
|
||||
static inline void dpl_eventq_init(struct dpl_eventq *evq)
|
||||
{
|
||||
event_queue_init_detached(&evq->q);
|
||||
os_eventq_init(&evq->evq);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -130,7 +121,7 @@ static inline void dpl_eventq_init(struct dpl_eventq *evq)
|
||||
*/
|
||||
static inline int dpl_eventq_inited(struct dpl_eventq *evq)
|
||||
{
|
||||
return evq->q.waiter != NULL;
|
||||
return os_eventq_inited(&evq->evq);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -155,11 +146,7 @@ static inline void dpl_eventq_deinit(struct dpl_eventq *evq)
|
||||
*/
|
||||
static inline struct dpl_event * dpl_eventq_get(struct dpl_eventq *evq)
|
||||
{
|
||||
if (evq->q.waiter == NULL) {
|
||||
event_queue_claim(&evq->q);
|
||||
}
|
||||
|
||||
return (struct dpl_event *) event_wait(&evq->q);
|
||||
return (struct dpl_event *) os_eventq_get(&evq->evq, DPL_WAIT_FOREVER);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -169,11 +156,7 @@ static inline struct dpl_event * dpl_eventq_get(struct dpl_eventq *evq)
|
||||
*/
|
||||
static inline struct dpl_event * dpl_eventq_get_no_wait(struct dpl_eventq *evq)
|
||||
{
|
||||
if (evq->q.waiter == NULL) {
|
||||
event_queue_claim(&evq->q);
|
||||
}
|
||||
|
||||
return (struct dpl_event *) event_get(&evq->q);
|
||||
return (struct dpl_event *) os_eventq_get_no_wait(&evq->evq);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -184,7 +167,7 @@ static inline struct dpl_event * dpl_eventq_get_no_wait(struct dpl_eventq *evq)
|
||||
*/
|
||||
static inline void dpl_eventq_put(struct dpl_eventq *evq, struct dpl_event *ev)
|
||||
{
|
||||
event_post(&evq->q, &ev->e.super);
|
||||
os_eventq_put(&evq->evq, &ev->ev);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -195,7 +178,7 @@ static inline void dpl_eventq_put(struct dpl_eventq *evq, struct dpl_event *ev)
|
||||
*/
|
||||
static inline void dpl_eventq_remove(struct dpl_eventq *evq, struct dpl_event *ev)
|
||||
{
|
||||
event_cancel(&evq->q, &ev->e.super);
|
||||
os_eventq_remove(&evq->evq, &ev->ev);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -205,8 +188,7 @@ static inline void dpl_eventq_remove(struct dpl_eventq *evq, struct dpl_event *e
|
||||
*/
|
||||
static inline void dpl_eventq_run(struct dpl_eventq *evq)
|
||||
{
|
||||
struct dpl_event *ev = dpl_eventq_get(evq);
|
||||
dpl_event_run(ev);
|
||||
os_eventq_run(&evq->evq);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -218,7 +200,7 @@ static inline void dpl_eventq_run(struct dpl_eventq *evq)
|
||||
*/
|
||||
static inline bool dpl_eventq_is_empty(struct dpl_eventq *evq)
|
||||
{
|
||||
return clist_count(&(evq->q.event_list)) == 0;
|
||||
return os_eventq_is_empty(&evq->evq);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -231,7 +213,7 @@ static inline bool dpl_eventq_is_empty(struct dpl_eventq *evq)
|
||||
*/
|
||||
static inline struct dpl_eventq * dpl_eventq_dflt_get(void)
|
||||
{
|
||||
return (struct dpl_eventq*) uwb_core_get_eventq();
|
||||
return (struct dpl_eventq *) uwb_core_get_eventq();
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@ -20,10 +20,7 @@
|
||||
#ifndef DPL_DPL_MUTEX_H
|
||||
#define DPL_DPL_MUTEX_H
|
||||
|
||||
#include "dpl_types.h"
|
||||
#include "dpl_error.h"
|
||||
|
||||
#include "mutex.h"
|
||||
#include "os/os_mutex.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
@ -33,7 +30,7 @@ extern "C" {
|
||||
* @brief dpl mutex wrapper
|
||||
*/
|
||||
struct dpl_mutex {
|
||||
mutex_t mutex; /**< the mutex */
|
||||
struct os_mutex mu; /**< the mutex */
|
||||
};
|
||||
|
||||
/**
|
||||
@ -41,7 +38,10 @@ struct dpl_mutex {
|
||||
*
|
||||
* @param[out] mu pre-allocated mutex structure, must not be NULL.
|
||||
*/
|
||||
dpl_error_t dpl_mutex_init(struct dpl_mutex *mu);
|
||||
static inline dpl_error_t dpl_mutex_init(struct dpl_mutex *mu)
|
||||
{
|
||||
return (dpl_error_t) os_mutex_init(&mu->mu);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Pend (wait) for a mutex.
|
||||
@ -55,7 +55,10 @@ dpl_error_t dpl_mutex_init(struct dpl_mutex *mu);
|
||||
* DPL_INVALID_PARM mutex passed in was NULL
|
||||
* DPL_OK no error
|
||||
*/
|
||||
dpl_error_t dpl_mutex_pend(struct dpl_mutex *mu, dpl_time_t timeout);
|
||||
static inline dpl_error_t dpl_mutex_pend(struct dpl_mutex *mu, dpl_time_t timeout)
|
||||
{
|
||||
return (dpl_error_t) os_mutex_pend(&mu->mu, timeout);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
@ -65,7 +68,10 @@ dpl_error_t dpl_mutex_pend(struct dpl_mutex *mu, dpl_time_t timeout);
|
||||
* DPL_INVALID_PARM mutex was NULL
|
||||
* DPL_OK no error
|
||||
*/
|
||||
dpl_error_t dpl_mutex_release(struct dpl_mutex *mu);
|
||||
static inline dpl_error_t dpl_mutex_release(struct dpl_mutex *mu)
|
||||
{
|
||||
return (dpl_error_t) os_mutex_release(&mu->mu);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -11,7 +11,7 @@
|
||||
* @{
|
||||
*
|
||||
* @file
|
||||
* @brief uwb-core DPL (Decawave Porting Layer) error types
|
||||
* @brief uwb-core DPL (Decawave Porting Layer) os abstraction layer
|
||||
*
|
||||
* @author Francisco Molina <francois-xavier.molina@inria.fr>
|
||||
* @}
|
||||
@ -20,12 +20,7 @@
|
||||
#ifndef DPL_DPL_OS_H
|
||||
#define DPL_DPL_OS_H
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdint.h>
|
||||
#include <stdatomic.h>
|
||||
|
||||
#include "irq.h"
|
||||
#include "dpl/dpl_types.h"
|
||||
#include "os/os.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
@ -35,20 +30,15 @@ extern "C" {
|
||||
* @name Entering and exiting critical section defines
|
||||
* @{
|
||||
*/
|
||||
#define DPL_ENTER_CRITICAL(_sr) (_sr = dpl_hw_enter_critical())
|
||||
#define DPL_EXIT_CRITICAL(_sr) (dpl_hw_exit_critical(_sr))
|
||||
#define DPL_ASSERT_CRITICAL() assert(dpl_hw_is_in_critical())
|
||||
#define DPL_ENTER_CRITICAL(_sr) (_sr = os_hw_enter_critical())
|
||||
#define DPL_EXIT_CRITICAL(_sr) (os_hw_exit_critical(_sr))
|
||||
#define DPL_ASSERT_CRITICAL() assert(os_hw_is_in_critical())
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* @brief variable to check if ISR are disabled
|
||||
*/
|
||||
extern atomic_uint dpl_in_critical;
|
||||
|
||||
/**
|
||||
* @brief CPU status register
|
||||
*/
|
||||
typedef uint32_t dpl_sr_t;
|
||||
typedef os_sr_t dpl_sr_t;
|
||||
|
||||
/**
|
||||
* @brief Disable ISRs
|
||||
@ -57,10 +47,7 @@ typedef uint32_t dpl_sr_t;
|
||||
*/
|
||||
static inline uint32_t dpl_hw_enter_critical(void)
|
||||
{
|
||||
uint32_t ctx = irq_disable();
|
||||
unsigned int count = atomic_load(&dpl_in_critical);
|
||||
atomic_store(&dpl_in_critical, count + 1);
|
||||
return ctx;
|
||||
return os_hw_enter_critical();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -70,9 +57,7 @@ static inline uint32_t dpl_hw_enter_critical(void)
|
||||
*/
|
||||
static inline void dpl_hw_exit_critical(uint32_t ctx)
|
||||
{
|
||||
unsigned int count = atomic_load(&dpl_in_critical);
|
||||
atomic_store(&dpl_in_critical, count - 1);
|
||||
irq_restore((unsigned)ctx);
|
||||
os_hw_exit_critical(ctx);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -82,12 +67,7 @@ static inline void dpl_hw_exit_critical(uint32_t ctx)
|
||||
*/
|
||||
static inline bool dpl_hw_is_in_critical(void)
|
||||
{
|
||||
/*
|
||||
* XXX Currently RIOT does not support an API for finding out if interrupts
|
||||
* are currently disabled, hence in a critical section in this context.
|
||||
* So for now, we use this global variable to keep this state for us.
|
||||
*/
|
||||
return (atomic_load(&dpl_in_critical) > 0);
|
||||
return os_hw_is_in_critical();
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@ -22,10 +22,7 @@
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include "dpl_types.h"
|
||||
#include "dpl_error.h"
|
||||
|
||||
#include "sema.h"
|
||||
#include "os/os_sem.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
@ -35,7 +32,7 @@ extern "C" {
|
||||
* @brief dpl semaphore wrapper
|
||||
*/
|
||||
struct dpl_sem {
|
||||
sema_t sema; /**< the semaphore */
|
||||
struct os_sem sem; /**< the semaphore */
|
||||
};
|
||||
|
||||
/**
|
||||
@ -48,7 +45,10 @@ struct dpl_sem {
|
||||
* DPL_INVALID_PARM Semaphore passed in was NULL.
|
||||
* DPL_OK no error.
|
||||
*/
|
||||
dpl_error_t dpl_sem_init(struct dpl_sem *sem, uint16_t tokens);
|
||||
static inline dpl_error_t dpl_sem_init(struct dpl_sem *sem, uint16_t tokens)
|
||||
{
|
||||
return (dpl_error_t) os_sem_init(&sem->sem, tokens);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Pend (wait) for a semaphore.
|
||||
@ -64,7 +64,10 @@ dpl_error_t dpl_sem_init(struct dpl_sem *sem, uint16_t tokens);
|
||||
* DPL_TIMEOUT semaphore was owned by another task and timeout=0
|
||||
* DPL_OK no error
|
||||
*/
|
||||
dpl_error_t dpl_sem_pend(struct dpl_sem *sem, dpl_time_t timeout);
|
||||
static inline dpl_error_t dpl_sem_pend(struct dpl_sem *sem, dpl_time_t timeout)
|
||||
{
|
||||
return (dpl_error_t) os_sem_pend(&sem->sem, timeout);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Release a semaphore.
|
||||
@ -75,12 +78,18 @@ dpl_error_t dpl_sem_pend(struct dpl_sem *sem, dpl_time_t timeout);
|
||||
* DPL_INVALID_PARM semaphore passed in was NULL.
|
||||
* DPL_OK no error
|
||||
*/
|
||||
dpl_error_t dpl_sem_release(struct dpl_sem *sem);
|
||||
static inline dpl_error_t dpl_sem_release(struct dpl_sem *sem)
|
||||
{
|
||||
return (dpl_error_t) os_sem_release(&sem->sem);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get current semaphore's count
|
||||
*/
|
||||
uint16_t dpl_sem_get_count(struct dpl_sem *sem);
|
||||
static inline int16_t dpl_sem_get_count(struct dpl_sem *sem)
|
||||
{
|
||||
return os_sem_get_count(&sem->sem);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -20,10 +20,7 @@
|
||||
#ifndef DPL_DPL_TASKS_H
|
||||
#define DPL_DPL_TASKS_H
|
||||
|
||||
#include "dpl_types.h"
|
||||
|
||||
#include "sched.h"
|
||||
#include "thread.h"
|
||||
#include "os/os_task.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
@ -33,13 +30,13 @@ extern "C" {
|
||||
* @brief dpl task wrapper
|
||||
*/
|
||||
struct dpl_task {
|
||||
kernel_pid_t pid; /**< the process id */
|
||||
struct os_task t; /**< os task */
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief dpl task function
|
||||
*/
|
||||
typedef thread_task_func_t dpl_task_func_t;
|
||||
typedef os_task_func_t dpl_task_func_t;
|
||||
|
||||
/**
|
||||
* @brief Initialize a task.
|
||||
@ -60,28 +57,39 @@ typedef thread_task_func_t dpl_task_func_t;
|
||||
*
|
||||
* @return 0 on success, non-zero on failure.
|
||||
*/
|
||||
int dpl_task_init(struct dpl_task *t, const char *name, dpl_task_func_t func,
|
||||
static inline int dpl_task_init(struct dpl_task *t, const char *name, dpl_task_func_t func,
|
||||
void *arg, uint8_t prio, dpl_time_t sanity_itvl,
|
||||
dpl_stack_t *stack_bottom, uint16_t stack_size);
|
||||
|
||||
dpl_stack_t *stack_bottom, uint16_t stack_size)
|
||||
{
|
||||
return os_task_init(&t->t, name, func, arg, prio, sanity_itvl, stack_bottom, stack_size);
|
||||
}
|
||||
/**
|
||||
* @brief removes specified task
|
||||
*
|
||||
* NOTE: This interface is currently experimental and not ready for common use
|
||||
*/
|
||||
int dpl_task_remove(struct dpl_task *t);
|
||||
static inline int dpl_task_remove(struct dpl_task *t)
|
||||
{
|
||||
return os_task_remove(&t->t);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Return the number of tasks initialized.
|
||||
*
|
||||
* @return number of tasks initialized
|
||||
*/
|
||||
uint8_t dpl_task_count(void);
|
||||
static inline uint8_t dpl_task_count(void)
|
||||
{
|
||||
return os_task_count();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Lets current thread yield.
|
||||
*/
|
||||
void dpl_task_yield(void);
|
||||
static inline void dpl_task_yield(void)
|
||||
{
|
||||
return os_task_yield();
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -20,17 +20,12 @@
|
||||
#ifndef DPL_DPL_TIME_H
|
||||
#define DPL_DPL_TIME_H
|
||||
|
||||
#include "xtimer.h"
|
||||
#include "os/os_time.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief DPL ticks per seconds
|
||||
*/
|
||||
#define DPL_TICKS_PER_SEC (XTIMER_HZ)
|
||||
|
||||
/**
|
||||
* @brief Returns the low 32 bits of cputime.
|
||||
*
|
||||
@ -38,7 +33,7 @@ extern "C" {
|
||||
*/
|
||||
static inline dpl_time_t dpl_time_get(void)
|
||||
{
|
||||
return xtimer_now().ticks32;
|
||||
return os_time_get();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -51,8 +46,7 @@ static inline dpl_time_t dpl_time_get(void)
|
||||
*/
|
||||
static inline dpl_error_t dpl_time_ms_to_ticks(uint32_t ms, dpl_time_t *out_ticks)
|
||||
{
|
||||
*out_ticks = xtimer_ticks_from_usec(ms * US_PER_MS).ticks32;
|
||||
return DPL_OK;
|
||||
return (dpl_error_t) os_time_ms_to_ticks(ms, out_ticks);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -65,9 +59,7 @@ static inline dpl_error_t dpl_time_ms_to_ticks(uint32_t ms, dpl_time_t *out_tick
|
||||
*/
|
||||
static inline dpl_error_t dpl_time_ticks_to_ms(dpl_time_t ticks, uint32_t *out_ms)
|
||||
{
|
||||
xtimer_ticks32_t val = {.ticks32 = ticks};
|
||||
*out_ms = xtimer_usec_from_ticks(val) * US_PER_MS;
|
||||
return DPL_OK;
|
||||
return (dpl_error_t) os_time_ticks_to_ms(ticks, out_ms);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -79,7 +71,7 @@ static inline dpl_error_t dpl_time_ticks_to_ms(dpl_time_t ticks, uint32_t *out_
|
||||
*/
|
||||
static inline dpl_time_t dpl_time_ms_to_ticks32(uint32_t ms)
|
||||
{
|
||||
return xtimer_ticks_from_usec(ms * US_PER_MS).ticks32;
|
||||
return os_time_ms_to_ticks32(ms);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -91,8 +83,7 @@ static inline dpl_time_t dpl_time_ms_to_ticks32(uint32_t ms)
|
||||
*/
|
||||
static inline dpl_time_t dpl_time_ticks_to_ms32(dpl_time_t ticks)
|
||||
{
|
||||
xtimer_ticks32_t val = {.ticks32 = ticks};
|
||||
return xtimer_usec_from_ticks(val) * US_PER_MS;
|
||||
return os_time_ticks_to_ms32(ticks);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -102,8 +93,7 @@ static inline dpl_time_t dpl_time_ticks_to_ms32(dpl_time_t ticks)
|
||||
*/
|
||||
static inline void dpl_time_delay(dpl_time_t ticks)
|
||||
{
|
||||
xtimer_ticks32_t val = {.ticks32 = ticks};
|
||||
xtimer_tsleep32((xtimer_ticks32_t) val);
|
||||
return os_time_delay(ticks);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@ -23,6 +23,8 @@
|
||||
#include <stdint.h>
|
||||
#include <math.h>
|
||||
|
||||
#include "os/os_types.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
@ -38,26 +40,26 @@ extern "C" {
|
||||
* @name Macro to wait forever on events and mutexes
|
||||
* @{
|
||||
*/
|
||||
#define DPL_TIMEOUT_NEVER (UINT32_MAX)
|
||||
#define DPL_WAIT_FOREVER (DPL_TIMEOUT_NEVER)
|
||||
#define DPL_TIMEOUT_NEVER (OS_TIMEOUT_NEVER)
|
||||
#define DPL_WAIT_FOREVER (OS_WAIT_FOREVER)
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* @name Decawave porting layer (DPL) stack alignment requirement
|
||||
* @{
|
||||
*/
|
||||
#define DPL_STACK_ALIGNMENT (4)
|
||||
#define DPL_STACK_ALIGNMENT (OS_ALIGNMENT)
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* @brief dpl time type
|
||||
*/
|
||||
typedef uint32_t dpl_time_t;
|
||||
typedef os_time_t dpl_time_t;
|
||||
|
||||
/**
|
||||
* @brief dpl stack buffer type
|
||||
*/
|
||||
typedef char dpl_stack_t;
|
||||
typedef os_stack_t dpl_stack_t;
|
||||
|
||||
/**
|
||||
* @brief dpl float 32 type
|
||||
|
@ -17,17 +17,17 @@
|
||||
* @}
|
||||
*/
|
||||
|
||||
#ifndef MCU_MCU_H
|
||||
#define MCU_MCU_H
|
||||
#ifndef DPL_QUEUE_H
|
||||
#define DPL_QUEUE_H
|
||||
|
||||
#include "os/os_queue.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* empty header */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* MCU_MCU_H */
|
||||
#endif /* DPL_QUEUE_H */
|
@ -18,8 +18,8 @@
|
||||
* @}
|
||||
*/
|
||||
|
||||
#ifndef SYSCFG_SYSCFG_TWR_DS_H
|
||||
#define SYSCFG_SYSCFG_TWR_DS_H
|
||||
#ifndef DPL_SYSCFG_SYSCFG_TWR_DS_H
|
||||
#define DPL_SYSCFG_SYSCFG_TWR_DS_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
@ -50,4 +50,4 @@ extern "C" {
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* SYSCFG_SYSCFG_TWR_DS_H */
|
||||
#endif /* DPL_SYSCFG_SYSCFG_TWR_DS_H */
|
@ -18,8 +18,8 @@
|
||||
* @}
|
||||
*/
|
||||
|
||||
#ifndef SYSCFG_SYSCFG_TWR_DS_EXT_H
|
||||
#define SYSCFG_SYSCFG_TWR_DS_EXT_H
|
||||
#ifndef DPL_SYSCFG_SYSCFG_TWR_DS_EXT_H
|
||||
#define DPL_SYSCFG_SYSCFG_TWR_DS_EXT_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
@ -50,4 +50,4 @@ extern "C" {
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* SYSCFG_SYSCFG_TWR_DS_EXT_H */
|
||||
#endif /* DPL_SYSCFG_SYSCFG_TWR_DS_EXT_H */
|
@ -18,8 +18,8 @@
|
||||
* @}
|
||||
*/
|
||||
|
||||
#ifndef SYSCFG_SYSCFG_TWR_SS_H
|
||||
#define SYSCFG_SYSCFG_TWR_SS_H
|
||||
#ifndef DPL_SYSCFG_SYSCFG_TWR_SS_H
|
||||
#define DPL_SYSCFG_SYSCFG_TWR_SS_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
@ -50,4 +50,4 @@ extern "C" {
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* SYSCFG_SYSCFG_TWR_SS_H */
|
||||
#endif /* DPL_SYSCFG_SYSCFG_TWR_SS_H */
|
@ -18,8 +18,8 @@
|
||||
* @}
|
||||
*/
|
||||
|
||||
#ifndef SYSCFG_SYSCFG_TWR_SS_ACK_H
|
||||
#define SYSCFG_SYSCFG_TWR_SS_ACK_H
|
||||
#ifndef DPL_SYSCFG_SYSCFG_TWR_SS_ACK_H
|
||||
#define DPL_SYSCFG_SYSCFG_TWR_SS_ACK_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
@ -50,4 +50,4 @@ extern "C" {
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* SYSCFG_SYSCFG_TWR_SS_ACK_H */
|
||||
#endif /* DPL_SYSCFG_SYSCFG_TWR_SS_ACK_H */
|
@ -18,8 +18,8 @@
|
||||
* @}
|
||||
*/
|
||||
|
||||
#ifndef SYSCFG_SYSCFG_TWR_SS_EXT_H
|
||||
#define SYSCFG_SYSCFG_TWR_SS_EXT_H
|
||||
#ifndef DPL_SYSCFG_SYSCFG_TWR_SS_EXT_H
|
||||
#define DPL_SYSCFG_SYSCFG_TWR_SS_EXT_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
@ -50,4 +50,4 @@ extern "C" {
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* SYSCFG_SYSCFG_TWR_SS_EXT_H */
|
||||
#endif /* DPL_SYSCFG_SYSCFG_TWR_SS_EXT_H */
|
@ -18,8 +18,8 @@
|
||||
* @}
|
||||
*/
|
||||
|
||||
#ifndef SYSCFG_SYSCFG_UWB_H
|
||||
#define SYSCFG_SYSCFG_UWB_H
|
||||
#ifndef DPL_SYSCFG_SYSCFG_UWB_H
|
||||
#define DPL_SYSCFG_SYSCFG_UWB_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
@ -50,7 +50,7 @@ extern "C" {
|
||||
* @brief Enable init messages showing each package has been initialised
|
||||
*/
|
||||
#ifndef MYNEWT_VAL_UWB_PKG_INIT_LOG
|
||||
#define MYNEWT_VAL_UWB_PKG_INIT_LOG (1)
|
||||
#define MYNEWT_VAL_UWB_PKG_INIT_LOG (0)
|
||||
#endif
|
||||
|
||||
/**
|
||||
@ -141,4 +141,4 @@ extern "C" {
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* SYSCFG_SYSCFG_UWB_H */
|
||||
#endif /* DPL_SYSCFG_SYSCFG_UWB_H */
|
@ -18,8 +18,8 @@
|
||||
* @}
|
||||
*/
|
||||
|
||||
#ifndef SYSCFG_SYSCFG_UWB_RNG_H
|
||||
#define SYSCFG_SYSCFG_UWB_RNG_H
|
||||
#ifndef DPL_SYSCFG_SYSCFG_UWB_RNG_H
|
||||
#define DPL_SYSCFG_SYSCFG_UWB_RNG_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
@ -64,4 +64,4 @@ extern "C" {
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* SYSCFG_SYSCFG_UWB_RNG_H */
|
||||
#endif /* DPL_SYSCFG_SYSCFG_UWB_RNG_H */
|
@ -18,8 +18,8 @@
|
||||
* @}
|
||||
*/
|
||||
|
||||
#ifndef SYSCFG_SYSCFG_UWBCFG_H
|
||||
#define SYSCFG_SYSCFG_UWBCFG_H
|
||||
#ifndef DPL_SYSCFG_SYSCFG_UWBCFG_H
|
||||
#define DPL_SYSCFG_SYSCFG_UWBCFG_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
@ -238,4 +238,4 @@ extern "C" {
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* SYSCFG_SYSCFG_UWBCFG_H */
|
||||
#endif /* DPL_SYSCFG_SYSCFG_UWBCFG_H */
|
@ -1,30 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2020 Inria
|
||||
*
|
||||
* This file is subject to the terms and conditions of the GNU Lesser
|
||||
* General Public License v2.1. See the file LICENSE in the top level
|
||||
* directory for more details.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @ingroup pkg_uwb_core
|
||||
* @{
|
||||
*
|
||||
* @file
|
||||
* @brief Abstraction layer for RIOT adaption
|
||||
*
|
||||
* @author Francisco Molina <francois-xavier.molina@inria.fr>
|
||||
* @}
|
||||
*/
|
||||
#ifndef OS_OS_H
|
||||
#define OS_OS_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* OS_OS_H */
|
@ -1,75 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2020 Inria
|
||||
*
|
||||
* This file is subject to the terms and conditions of the GNU Lesser
|
||||
* General Public License v2.1. See the file LICENSE in the top level
|
||||
* directory for more details.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @ingroup pkg_uwb_core
|
||||
* @{
|
||||
*
|
||||
* @file
|
||||
* @brief uwb-core system configurations
|
||||
*
|
||||
* @author Francisco Molina <francois-xavier.molina@inria.fr>
|
||||
* @}
|
||||
*/
|
||||
|
||||
#ifndef SYSCFG_SYSCFG_H
|
||||
#define SYSCFG_SYSCFG_H
|
||||
|
||||
#include "kernel_defines.h"
|
||||
|
||||
/**
|
||||
* @name MyNewt header inclusion macro definitions
|
||||
* @{
|
||||
*
|
||||
* This macro exists to ensure code includes this header when needed. If code
|
||||
* checks the existence of a setting directly via ifdef without including this
|
||||
* header, the setting macro will silently evaluate to 0. In contrast, an
|
||||
* attempt to use these macros without including this header will result in a
|
||||
* compiler error.
|
||||
*/
|
||||
#define MYNEWT_VAL(_name) MYNEWT_VAL_ ## _name
|
||||
#define MYNEWT_VAL_CHOICE(_name, _val) MYNEWT_VAL_ ## _name ## __ ## _val
|
||||
/** @} */
|
||||
|
||||
|
||||
/*** @decawave-uwb-core/hw/drivers/uwb */
|
||||
#include "syscfg_uwb.h"
|
||||
|
||||
/*** @decawave-uwb-core/lib/twr_ds */
|
||||
#include "syscfg_twr_ds.h"
|
||||
|
||||
/*** @decawave-uwb-core/lib/twr_ds_ext */
|
||||
#include "syscfg_twr_ds_ext.h"
|
||||
|
||||
/*** @decawave-uwb-core/lib/twr_ss */
|
||||
#include "syscfg_twr_ss.h"
|
||||
|
||||
/*** @decawave-uwb-core/lib/twr_ss_ack */
|
||||
#include "syscfg_twr_ss_ack.h"
|
||||
|
||||
/*** @decawave-uwb-core/lib/twr_ss_ext */
|
||||
#include "syscfg_twr_ss_ext.h"
|
||||
|
||||
/*** @decawave-uwb-core/lib/uwb_rng */
|
||||
#include "syscfg_uwb_rng.h"
|
||||
|
||||
/*** @decawave-uwb-core/sys/uwbcfg */
|
||||
#include "syscfg_uwbcfg.h"
|
||||
|
||||
/*** @decawave-uwb-dw1000/hw/drivers/uwb/uwb_dw1000 */
|
||||
#include "syscfg_uwb_dw1000.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* SYSCFG_SYSCFG_H */
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
pkg/uwb-core/patches/0004-porting-dpl-add-riot-files.patch
Normal file
BIN
pkg/uwb-core/patches/0004-porting-dpl-add-riot-files.patch
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,10 +1,11 @@
|
||||
PKG_NAME=uwb-dw1000
|
||||
PKG_URL=https://github.com/Decawave/uwb-dw1000/
|
||||
PKG_VERSION=6eaa85e6d429450d19a6ddeb2de05303016c0dd2
|
||||
PKG_VERSION=d44078a96349b7a40e9c2393ea83ca4c2d53ab92
|
||||
PKG_LICENSE=Apache-2.0
|
||||
|
||||
include $(RIOTBASE)/pkg/pkg.mk
|
||||
|
||||
CFLAGS += -Wno-enum-compare
|
||||
CFLAGS += -Wno-address-of-packed-member
|
||||
CFLAGS += -Wno-enum-conversion
|
||||
CFLAGS += -Wno-maybe-uninitialized
|
||||
|
@ -1,13 +1,10 @@
|
||||
USEMODULE += uwb-dw1000_hal
|
||||
DEFAULT_MODULE += auto_init_uwb-dw1000
|
||||
|
||||
USEMODULE += xtimer
|
||||
USEPKG += mynewt-core
|
||||
|
||||
FEATURES_REQUIRED += periph_gpio_irq
|
||||
FEATURES_REQUIRED += periph_spi
|
||||
|
||||
# Some of the pkg operation would overflow on 16bit
|
||||
FEATURES_REQUIRED += arch_32bit
|
||||
|
||||
# LLVM ARM shows issues with missing definitions for stdatomic
|
||||
TOOLCHAINS_BLACKLIST += llvm
|
||||
|
@ -1,45 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2020 Inria
|
||||
*
|
||||
* This file is subject to the terms and conditions of the GNU Lesser
|
||||
* General Public License v2.1. See the file LICENSE in the top level
|
||||
* directory for more details.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @ingroup pkg_uwb_dw1000
|
||||
* @{
|
||||
*
|
||||
* @file
|
||||
* @brief Timer abstraction layer RIOT adaption
|
||||
*
|
||||
* @author Francisco Molina <francois-xavier.molina@inria.fr>
|
||||
* @}
|
||||
*/
|
||||
|
||||
#ifndef HAL_HAL_TIMER_H
|
||||
#define HAL_HAL_TIMER_H
|
||||
|
||||
#include "xtimer.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief HAL timer callback
|
||||
*/
|
||||
typedef xtimer_callback_t hal_timer_cb;
|
||||
|
||||
/**
|
||||
* @brief The HAL timer structure.
|
||||
*/
|
||||
struct hal_timer {
|
||||
xtimer_t timer; /**< the timer */
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* HAL_HAL_TIMER_H */
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -123,6 +123,11 @@ void auto_init(void)
|
||||
extern void openwsn_bootstrap(void);
|
||||
openwsn_bootstrap();
|
||||
}
|
||||
if (IS_USED(MODULE_AUTO_INIT_MYNEWT_CORE)) {
|
||||
LOG_DEBUG("Bootstrapping mynewt-core.\n");
|
||||
extern void mynewt_core_init(void);
|
||||
mynewt_core_init();
|
||||
}
|
||||
if (IS_USED(MODULE_AUTO_INIT_UWB_CORE)) {
|
||||
LOG_DEBUG("Bootstrapping uwb core.\n");
|
||||
extern void uwb_core_init(void);
|
||||
|
Loading…
Reference in New Issue
Block a user