mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-01-17 05:32:45 +01:00
pkg/uwb-core: use mynewt-core pkg
This commit is contained in:
parent
7b2debcbd8
commit
eb74b3ace6
@ -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,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 Decawave Porting Layer mutex RIOT wrapper
|
||||
*
|
||||
* @author Francisco Molina <francois-xavier.molina@inria.fr>
|
||||
* @}
|
||||
*/
|
||||
|
||||
#include "mutex.h"
|
||||
#include "dpl/dpl_mutex.h"
|
||||
|
||||
dpl_error_t dpl_mutex_init(struct dpl_mutex *mu)
|
||||
{
|
||||
if (!mu) {
|
||||
return DPL_INVALID_PARAM;
|
||||
}
|
||||
mutex_init(&mu->mutex);
|
||||
return DPL_OK;
|
||||
}
|
||||
|
||||
dpl_error_t dpl_mutex_release(struct dpl_mutex *mu)
|
||||
{
|
||||
if (!mu) {
|
||||
return DPL_INVALID_PARAM;
|
||||
}
|
||||
|
||||
mutex_unlock(&mu->mutex);
|
||||
return DPL_OK;
|
||||
}
|
||||
|
||||
dpl_error_t dpl_mutex_pend(struct dpl_mutex *mu, uint32_t timeout)
|
||||
{
|
||||
int rc = DPL_OK;
|
||||
|
||||
if (!mu) {
|
||||
return DPL_INVALID_PARAM;
|
||||
}
|
||||
|
||||
if (!timeout) {
|
||||
rc = mutex_trylock(&mu->mutex);
|
||||
}
|
||||
else {
|
||||
/* TODO: no timeout equivalent */
|
||||
mutex_lock(&mu->mutex);
|
||||
}
|
||||
return rc;
|
||||
}
|
@ -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;
|
||||
}
|
@ -1,68 +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 tasks RIOT wrapper
|
||||
*
|
||||
* @author Francisco Molina <francois-xavier.molina@inria.fr>
|
||||
* @}
|
||||
*/
|
||||
|
||||
#include "dpl/dpl_error.h"
|
||||
#include "dpl/dpl_tasks.h"
|
||||
#include "thread.h"
|
||||
|
||||
#ifndef LOG_LEVEL
|
||||
#define LOG_LEVEL LOG_INFO
|
||||
#endif
|
||||
#include "log.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
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)
|
||||
{
|
||||
(void) sanity_itvl;
|
||||
|
||||
LOG_INFO("dpl: starting thread %s\n", name);
|
||||
|
||||
kernel_pid_t pid = thread_create(stack_bottom, (int) stack_size,
|
||||
prio, THREAD_CREATE_STACKTEST,
|
||||
func, arg, name);
|
||||
|
||||
t->pid = pid;
|
||||
|
||||
return (pid) ? DPL_ERROR : DPL_OK;;
|
||||
}
|
||||
|
||||
int dpl_task_remove(struct dpl_task *t)
|
||||
{
|
||||
thread_zombify();
|
||||
return thread_kill_zombie(t->pid);
|
||||
}
|
||||
|
||||
uint8_t dpl_task_count(void)
|
||||
{
|
||||
return sched_num_threads;
|
||||
}
|
||||
|
||||
void dpl_task_yield(void)
|
||||
{
|
||||
thread_yield();
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
@ -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,48 +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 System logging header for uwb-core
|
||||
*
|
||||
* @author Francisco Molina <francois-xavier.molina@inria.fr>
|
||||
* @}
|
||||
*/
|
||||
|
||||
#ifndef LOG_DPL_LOG_H
|
||||
#define LOG_DPL_LOG_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "log.h"
|
||||
|
||||
/**
|
||||
* @name Logging convenience defines wrappers
|
||||
* @{
|
||||
*/
|
||||
#define LOG_WARN(...) LOG(LOG_WARNING, __VA_ARGS__)
|
||||
#define LOG_CRITICAL(...) LOG(LOG_ERROR, __VA_ARGS__)
|
||||
#define log_register(__X, __Y, __Z, __A, __B) {}
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* @brief Empty log structure
|
||||
*/
|
||||
struct log {
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* LOG_DPL_LOG_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,52 +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_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
|
||||
|
||||
/**
|
||||
* @brief Device structure.
|
||||
*/
|
||||
struct os_dev {
|
||||
netdev_ieee802154_t netdev; /**< Netdev parent struct */
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Unused define, void cast
|
||||
*/
|
||||
#define OS_DEV_SETHANDLERS(__dev, __open, __close) \
|
||||
(void) __dev; \
|
||||
(void) __open; \
|
||||
(void) __close;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* OS_OS_DEV_H */
|
@ -1,33 +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 STATS_STATS_H
|
||||
#define STATS_STATS_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* empty header */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* STATS_STATS_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 */
|
@ -1,38 +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 sysinit abstraction layer for RIOT adaption
|
||||
*
|
||||
* @author Francisco Molina <francois-xavier.molina@inria.fr>
|
||||
* @}
|
||||
*/
|
||||
|
||||
#ifndef SYSINIT_SYSINIT_H
|
||||
#define SYSINIT_SYSINIT_H
|
||||
|
||||
#include "assert.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief DPL assert macro
|
||||
*/
|
||||
#define SYSINIT_PANIC_ASSERT(rc) assert(rc);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* SYSINIT_SYSINIT_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.
Loading…
Reference in New Issue
Block a user