Toggle navigation
Documentation
The friendly Operating System for the Internet of Things
board_info.h
Go to the documentation of this file.
1
/*
2
* Copyright (C) 2017 Hamburg University of Applied Sciences
3
* 2020 Inria
4
*
5
* This file is subject to the terms and conditions of the GNU Lesser
6
* General Public License v2.1. See the file LICENSE in the top level
7
* directory for more details.
8
*/
9
24
#ifndef BOARD_INFO_H
25
#define BOARD_INFO_H
26
27
#include <stdint.h>
28
#include <string.h>
29
30
#include "board.h"
31
#include "periph_conf.h"
32
#include "
timex.h
"
33
34
#if defined __has_include
35
# if __has_include ("openwsn_defs.h")
36
# include "openwsn_defs.h"
37
# endif
38
#endif
39
40
#ifdef __cplusplus
41
extern
"C"
{
42
#endif
43
48
#define INTERRUPT_DECLARATION() unsigned irq_state;
49
#define DISABLE_INTERRUPTS() irq_state = irq_disable();
50
#define ENABLE_INTERRUPTS() irq_restore(irq_state);
51
#define SCHEDULER_WAKEUP()
/* unused by RIOT */
52
#define SCHEDULER_ENABLE_INTERRUPT()
/* unused by RIOT */
53
60
/* Always 32bit when using ztimer */
61
#if RTT_MAX_VALUE == UINT32_MAX || !((RTT_MAX_VALUE + 1) & (RTT_MAX_VALUE)) || \
62
IS_USED(MODULE_OPENWSN_SCTIMER_ZTIMER)
63
#define PORT_TIMER_WIDTH uint32_t
64
#define PORT_RADIOTIMER_WIDTH uint32_t
65
#else
66
#error "RTT_MAX_VALUE not supported"
67
#endif
68
69
#if __SIZEOF_POINTER__ == 2
70
#define PORT_SIGNED_INT_WIDTH int16_t
71
#else
72
#define PORT_SIGNED_INT_WIDTH int32_t
73
#endif
74
75
#define SCTIMER_FREQUENCY (32768U)
76
77
/* 32 ticks @32768Hz */
78
#define PORT_TICS_PER_MS (SCTIMER_FREQUENCY / MS_PER_SEC)
79
/* 30 us per tick @32768Hz */
80
#define PORT_US_PER_TICK (US_PER_SEC / SCTIMER_FREQUENCY)
81
97
/* standard slot duration is 10ms but code execution time for most OpenWSN
98
supported BOARDS takes longer than 10ms, so use the default 20ms upstream
99
slot */
100
#ifndef SLOTDURATION
101
#define SLOTDURATION 20
/* in milliseconds */
102
#endif
103
104
#if SLOTDURATION == 20
105
#ifndef PORT_TsSlotDuration
/* 655 ticks at @32768Hz */
106
#define PORT_TsSlotDuration ((SCTIMER_FREQUENCY * SLOTDURATION) / MS_PER_SEC)
107
#endif
108
109
/* Execution speed related parameters */
110
#ifndef PORT_maxTxDataPrepare
111
#define PORT_maxTxDataPrepare (3355 / PORT_US_PER_TICK )
/* ~110 ticks at @32768Hz */
112
#endif
113
#ifndef PORT_maxRxAckPrepare
114
#define PORT_maxRxAckPrepare (610 / PORT_US_PER_TICK )
/* ~20 ticks at @32768Hz */
115
#endif
116
#ifndef PORT_maxRxDataPrepare
117
#define PORT_maxRxDataPrepare (1000 / PORT_US_PER_TICK )
/* ~33 ticks at@32768Hz */
118
#endif
119
#ifndef PORT_maxTxAckPrepare
120
#define PORT_maxTxAckPrepare (1525 / PORT_US_PER_TICK )
/* ~50 ticks at@32768Hz */
121
#endif
122
123
/* Radio speed related parameters */
124
#ifndef PORT_delayTx
125
#define PORT_delayTx (300 / PORT_US_PER_TICK )
/* ~10 ticks at@32768Hz */
126
#endif
127
#ifndef PORT_delayRx
128
#define PORT_delayRx (0 / PORT_US_PER_TICK )
/* ~0 ticks at@32768Hz */
129
#endif
130
#else
131
#error "Only 20ms slot duration is currently supported"
132
#endif
133
/* SLOTDURATION == 20 */
134
142
#define SYNC_ACCURACY (1)
/* ticks */
143
145
#ifdef __cplusplus
146
}
147
#endif
148
149
#endif
/* BOARD_INFO_H */
timex.h
Utility library for comparing and computing timestamps.
Generated on Tue Nov 24 2020 19:46:51 by
1.8.17