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
* 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 */
59
/* Always 32bit when using ztimer */
60
#if RTT_MAX_VALUE == UINT32_MAX || !((RTT_MAX_VALUE + 1) & (RTT_MAX_VALUE)) || \
61
IS_USED(MODULE_OPENWSN_SCTIMER_ZTIMER)
62
#define PORT_TIMER_WIDTH uint32_t
63
#define PORT_RADIOTIMER_WIDTH uint32_t
64
#else
65
#error "RTT_MAX_VALUE not supported"
66
#endif
67
68
#if __SIZEOF_POINTER__ == 2
69
#define PORT_SIGNED_INT_WIDTH int16_t
70
#else
71
#define PORT_SIGNED_INT_WIDTH int32_t
72
#endif
73
74
#define SCTIMER_FREQUENCY (32768U)
75
76
/* 32 ticks @32768Hz */
77
#define PORT_TICS_PER_MS (SCTIMER_FREQUENCY / MS_PER_SEC)
78
/* 30 us per tick @32768Hz */
79
#define PORT_US_PER_TICK (US_PER_SEC / SCTIMER_FREQUENCY)
96
/* standard slot duration is 10ms but code execution time for most OpenWSN
97
supported BOARDS takes longer than 10ms, so use the default 20ms upstream
98
slot */
99
#ifndef SLOTDURATION
100
#define SLOTDURATION 20
/* in milliseconds */
101
#endif
102
103
#if SLOTDURATION == 20
104
#ifndef PORT_TsSlotDuration
/* 655 ticks at @32768Hz */
105
#define PORT_TsSlotDuration ((SCTIMER_FREQUENCY * SLOTDURATION) / MS_PER_SEC)
106
#endif
107
108
/* Execution speed related parameters */
109
#ifndef PORT_maxTxDataPrepare
110
#define PORT_maxTxDataPrepare (3355 / PORT_US_PER_TICK )
/* ~110 ticks at @32768Hz */
111
#endif
112
#ifndef PORT_maxRxAckPrepare
113
#define PORT_maxRxAckPrepare (610 / PORT_US_PER_TICK )
/* ~20 ticks at @32768Hz */
114
#endif
115
#ifndef PORT_maxRxDataPrepare
116
#define PORT_maxRxDataPrepare (1000 / PORT_US_PER_TICK )
/* ~33 ticks at@32768Hz */
117
#endif
118
#ifndef PORT_maxTxAckPrepare
119
#define PORT_maxTxAckPrepare (1525 / PORT_US_PER_TICK )
/* ~50 ticks at@32768Hz */
120
#endif
121
122
/* Radio speed related parameters */
123
#ifndef PORT_delayTx
124
#define PORT_delayTx (300 / PORT_US_PER_TICK )
/* ~10 ticks at@32768Hz */
125
#endif
126
#ifndef PORT_delayRx
127
#define PORT_delayRx (0 / PORT_US_PER_TICK )
/* ~0 ticks at@32768Hz */
128
#endif
129
#else
130
#error "Only 20ms slot duration is currently supported"
131
#endif
/* SLOTDURATION == 20 */
133
141
#define SYNC_ACCURACY (1)
/* ticks */
144
#ifdef __cplusplus
145
}
146
#endif
147
148
#endif
/* BOARD_INFO_H */
timex.h
Utility library for comparing and computing timestamps.
Generated on Sat Dec 21 2024 20:58:03 by
1.9.8