Toggle navigation
Documentation
The friendly Operating System for the Internet of Things
Loading...
Searching...
No Matches
board_info.h
Go to the documentation of this file.
1
/*
2
* SPDX-FileCopyrightText: 2017 HAW Hamburg
3
* SPDX-FileCopyrightText: 2020 Inria
4
* SPDX-License-Identifier: LGPL-2.1-only
5
*/
6
7
#pragma once
8
22
23
#include <stdint.h>
24
#include <string.h>
25
26
#include "board.h"
27
#include "periph_conf.h"
28
#include "
timex.h
"
29
30
#if defined __has_include
31
# if __has_include ("openwsn_defs.h")
32
# include "openwsn_defs.h"
33
# endif
34
#endif
35
36
#ifdef __cplusplus
37
extern
"C"
{
38
#endif
39
44
#define INTERRUPT_DECLARATION() unsigned irq_state;
45
#define DISABLE_INTERRUPTS() irq_state = irq_disable();
46
#define ENABLE_INTERRUPTS() irq_restore(irq_state);
47
#define SCHEDULER_WAKEUP()
/* unused by RIOT */
48
#define SCHEDULER_ENABLE_INTERRUPT()
/* unused by RIOT */
50
55
/* Always 32bit when using ztimer */
56
#if RTT_MAX_VALUE == UINT32_MAX || !((RTT_MAX_VALUE + 1) & (RTT_MAX_VALUE)) || \
57
IS_USED(MODULE_OPENWSN_SCTIMER_ZTIMER)
58
#define PORT_TIMER_WIDTH uint32_t
59
#define PORT_RADIOTIMER_WIDTH uint32_t
60
#else
61
#error "RTT_MAX_VALUE not supported"
62
#endif
63
64
#if __SIZEOF_POINTER__ == 2
65
#define PORT_SIGNED_INT_WIDTH int16_t
66
#else
67
#define PORT_SIGNED_INT_WIDTH int32_t
68
#endif
69
70
#define SCTIMER_FREQUENCY (32768U)
71
72
/* 32 ticks @32768Hz */
73
#define PORT_TICS_PER_MS (SCTIMER_FREQUENCY / MS_PER_SEC)
74
/* 30 us per tick @32768Hz */
75
#define PORT_US_PER_TICK (US_PER_SEC / SCTIMER_FREQUENCY)
77
92
/* standard slot duration is 10ms but code execution time for most OpenWSN
93
supported BOARDS takes longer than 10ms, so use the default 20ms upstream
94
slot */
95
#ifndef SLOTDURATION
96
#define SLOTDURATION 20
/* in milliseconds */
97
#endif
98
99
#if SLOTDURATION == 20
100
#ifndef PORT_TsSlotDuration
/* 655 ticks at @32768Hz */
101
#define PORT_TsSlotDuration ((SCTIMER_FREQUENCY * SLOTDURATION) / MS_PER_SEC)
102
#endif
103
104
/* Execution speed related parameters */
105
#ifndef PORT_maxTxDataPrepare
106
#define PORT_maxTxDataPrepare (3355 / PORT_US_PER_TICK )
/* ~110 ticks at @32768Hz */
107
#endif
108
#ifndef PORT_maxRxAckPrepare
109
#define PORT_maxRxAckPrepare (610 / PORT_US_PER_TICK )
/* ~20 ticks at @32768Hz */
110
#endif
111
#ifndef PORT_maxRxDataPrepare
112
#define PORT_maxRxDataPrepare (1000 / PORT_US_PER_TICK )
/* ~33 ticks at@32768Hz */
113
#endif
114
#ifndef PORT_maxTxAckPrepare
115
#define PORT_maxTxAckPrepare (1525 / PORT_US_PER_TICK )
/* ~50 ticks at@32768Hz */
116
#endif
117
118
/* Radio speed related parameters */
119
#ifndef PORT_delayTx
120
#define PORT_delayTx (300 / PORT_US_PER_TICK )
/* ~10 ticks at@32768Hz */
121
#endif
122
#ifndef PORT_delayRx
123
#define PORT_delayRx (0 / PORT_US_PER_TICK )
/* ~0 ticks at@32768Hz */
124
#endif
125
#else
126
#error "Only 20ms slot duration is currently supported"
127
#endif
/* SLOTDURATION == 20 */
129
137
#define SYNC_ACCURACY (1)
/* ticks */
139
140
#ifdef __cplusplus
141
}
142
#endif
timex.h
Utility library for comparing and computing timestamps.
Generated on Sat Oct 3 2026 14:10:59 by
1.13.2