Contiki-NG
nrf-def.h
Go to the documentation of this file.
1
/*
2
* Copyright (C) 2020 Yago Fontoura do Rosario <yago.rosario@hotmail.com.br>
3
* All rights reserved.
4
*
5
* Redistribution and use in source and binary forms, with or without
6
* modification, are permitted provided that the following conditions
7
* are met:
8
* 1. Redistributions of source code must retain the above copyright
9
* notice, this list of conditions and the following disclaimer.
10
* 2. Redistributions in binary form must reproduce the above copyright
11
* notice, this list of conditions and the following disclaimer in the
12
* documentation and/or other materials provided with the distribution.
13
* 3. Neither the name of the copyright holder nor the names of its
14
* contributors may be used to endorse or promote products derived
15
* from this software without specific prior written permission.
16
*
17
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
20
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
21
* COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
22
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
26
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
28
* OF THE POSSIBILITY OF SUCH DAMAGE.
29
*/
30
/*---------------------------------------------------------------------------*/
31
/**
32
* \addtogroup nrf
33
* @{
34
*
35
* \file
36
* Header with defines common to all nrf platforms
37
* \author
38
* Yago Fontoura do Rosario <yago.rosario@hotmail.com.br>
39
*/
40
/*---------------------------------------------------------------------------*/
41
#ifndef NRF_DEF_H_
42
#define NRF_DEF_H_
43
/*---------------------------------------------------------------------------*/
44
#include "
arm-def.h
"
45
/*---------------------------------------------------------------------------*/
46
#include "nrf.h"
47
/*---------------------------------------------------------------------------*/
48
/* Include CPU Specific defines */
49
#ifdef CPU_DEF_PATH
50
#include CPU_DEF_PATH
51
#else
52
#error "CPU_DEF_PATH undefined"
53
#endif
/* BOARD_CONF_PATH */
54
/*---------------------------------------------------------------------------*/
55
/* Path to headers with implementation of mutexes, atomic and memory barriers */
56
#define MUTEX_CONF_ARCH_HEADER_PATH "mutex-cortex.h"
57
#define ATOMIC_CONF_ARCH_HEADER_PATH "atomic-cortex.h"
58
#define MEMORY_BARRIER_CONF_ARCH_HEADER_PATH "memory-barrier-cortex.h"
59
/*---------------------------------------------------------------------------*/
60
/* Do the math in 32bits to save precision.
61
* Round to nearest integer rather than truncate. */
62
#define US_TO_RTIMERTICKS(US) ((US) >= 0 ? \
63
(((int32_t)(US)*(RTIMER_ARCH_SECOND)+500000) / 1000000L) : \
64
((int32_t)(US)*(RTIMER_ARCH_SECOND)-500000) / 1000000L)
65
66
#define RTIMERTICKS_TO_US(T) ((T) >= 0 ? \
67
(((int32_t)(T) * 1000000L + ((RTIMER_ARCH_SECOND) / 2)) / (RTIMER_ARCH_SECOND)) : \
68
((int32_t)(T) * 1000000L - ((RTIMER_ARCH_SECOND) / 2)) / (RTIMER_ARCH_SECOND))
69
70
/* A 64-bit version because the 32-bit one cannot handle T >= 4295 ticks.
71
Intended only for positive values of T. */
72
#define RTIMERTICKS_TO_US_64(T) ((uint32_t)(((uint64_t)(T) * 1000000 + ((RTIMER_ARCH_SECOND) / 2)) / (RTIMER_ARCH_SECOND)))
73
/*---------------------------------------------------------------------------*/
74
#define RADIO_PHY_OVERHEAD 3
75
#define RADIO_BYTE_AIR_TIME 32
76
#define RADIO_SHR_LEN 5
/* Synch word + SFD */
77
#define RADIO_DELAY_BEFORE_TX \
78
((unsigned)US_TO_RTIMERTICKS(RADIO_SHR_LEN * RADIO_BYTE_AIR_TIME))
79
#define RADIO_DELAY_BEFORE_RX ((unsigned)US_TO_RTIMERTICKS(250))
80
#define RADIO_DELAY_BEFORE_DETECT 0
81
/*---------------------------------------------------------------------------*/
82
#define RTIMER_ARCH_SECOND 62500
83
/*---------------------------------------------------------------------------*/
84
#define GPIO_HAL_CONF_ARCH_HDR_PATH "gpio-hal-arch.h"
85
#define GPIO_HAL_CONF_ARCH_SW_TOGGLE 0
86
/*---------------------------------------------------------------------------*/
87
#ifndef TSCH_CONF_HW_FRAME_FILTERING
88
#define TSCH_CONF_HW_FRAME_FILTERING 0
89
#endif
/* TSCH_CONF_HW_FRAME_FILTERING */
90
91
#ifndef TSCH_CONF_RADIO_ON_DURING_TIMESLOT
92
#define TSCH_CONF_RADIO_ON_DURING_TIMESLOT 1
93
#endif
/* TSCH_CONF_RADIO_ON_DURING_TIMESLOT */
94
95
#ifndef TSCH_CONF_RESYNC_WITH_SFD_TIMESTAMPS
96
#define TSCH_CONF_RESYNC_WITH_SFD_TIMESTAMPS 1
97
#endif
/* TSCH_CONF_RESYNC_WITH_SFD_TIMESTAMPS */
98
99
#ifndef TSCH_CONF_TIMESYNC_REMOVE_JITTER
100
#define TSCH_CONF_TIMESYNC_REMOVE_JITTER 0
101
#endif
/* TSCH_CONF_TIMESYNC_REMOVE_JITTER */
102
/*---------------------------------------------------------------------------*/
103
#define CSMA_CONF_SEND_SOFT_ACK 1
104
/*---------------------------------------------------------------------------*/
105
#endif
/* NRF_DEF_H_ */
106
/*---------------------------------------------------------------------------*/
107
/**
108
* @}
109
*/
arm-def.h
Compiler and data type definitions for all ARM-based CPUs.
arch
cpu
nrf
nrf-def.h
Generated on Wed Jul 12 2023 12:33:24 for Contiki-NG by
1.9.4