Contiki-NG
cc13xx-cc26xx-def.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2018, Texas Instruments Incorporated - http://www.ti.com/
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  * \addtogroup cc13xx-cc26xx-cpu
32  * @{
33  *
34  * \file
35  * Header with configuration defines for the Contiki system.
36  * \author
37  * Edvard Pettersen <e.pettersen@ti.com>
38  */
39 /*---------------------------------------------------------------------------*/
40 #ifndef CC13XX_CC26XX_DEF_H_
41 #define CC13XX_CC26XX_DEF_H_
42 /*---------------------------------------------------------------------------*/
43 #include <ti/devices/DeviceFamily.h>
44 /*---------------------------------------------------------------------------*/
45 #if (DeviceFamily_PARENT == DeviceFamily_PARENT_CC13X0_CC26X0)
46 #include <cm3/cm3-def.h>
47 #elif (DeviceFamily_PARENT == DeviceFamily_PARENT_CC13X2_CC26X2)
48 #include <cm4/cm4-def.h>
49 #endif
50 /*---------------------------------------------------------------------------*/
51 #include <stddef.h>
52 #include <stdint.h>
53 /*---------------------------------------------------------------------------*/
54 #define RTIMER_ARCH_SECOND 65536
55 /*---------------------------------------------------------------------------*/
56 #define INT_MASTER_CONF_STATUS_DATATYPE uintptr_t
57 /*---------------------------------------------------------------------------*/
58 /* TSCH related defines */
59 
60 /* 1 len byte, 2 bytes CRC */
61 #define RADIO_PHY_OVERHEAD 3
62 /* 250kbps data rate. One byte = 32us */
63 #define RADIO_BYTE_AIR_TIME 32
64 /* Delay between GO signal and SFD */
65 #define RADIO_DELAY_BEFORE_TX ((unsigned)US_TO_RTIMERTICKS(81))
66 /* Delay between GO signal and start listening.
67  * This value is so small because the radio is constantly on within each timeslot. */
68 #define RADIO_DELAY_BEFORE_RX ((unsigned)US_TO_RTIMERTICKS(15))
69 /* Delay between the SFD finishes arriving and it is detected in software. */
70 #define RADIO_DELAY_BEFORE_DETECT ((unsigned)US_TO_RTIMERTICKS(352))
71 
72 /* Timer conversion; radio is running at 4 MHz */
73 #define RAT_SECOND 4000000u
74 #define RAT_TO_RTIMER(x) ((uint32_t)(((uint64_t)(x)*(RTIMER_SECOND / 256)) / (RAT_SECOND / 256)))
75 #define USEC_TO_RAT(x) ((x) * 4)
76 
77 #if (RTIMER_SECOND % 256) || (RAT_SECOND % 256)
78 #error RAT_TO_RTIMER macro must be fixed!
79 #endif
80 
81 /* The PHY header (preamble + SFD, 4+1 bytes) duration is equivalent to 10 symbols */
82 #define RADIO_IEEE_802154_PHY_HEADER_DURATION_USEC 160
83 
84 /* Do not turn off TSCH within a timeslot: not enough time */
85 #define TSCH_CONF_RADIO_ON_DURING_TIMESLOT 1
86 
87 /* Disable TSCH frame filtering */
88 #define TSCH_CONF_HW_FRAME_FILTERING 0
89 
90 /* Use hardware timestamps */
91 #ifndef TSCH_CONF_RESYNC_WITH_SFD_TIMESTAMPS
92 #define TSCH_CONF_RESYNC_WITH_SFD_TIMESTAMPS 1
93 #define TSCH_CONF_TIMESYNC_REMOVE_JITTER 0
94 #endif
95 
96 #ifndef TSCH_CONF_BASE_DRIFT_PPM
97 /*
98  * The drift compared to "true" 10ms slots.
99  * Enable adaptive sync to enable compensation for this.
100  * Slot length 10000 usec
101  * 328 ticks
102  * Tick duration 30.517578125 usec
103  * Real slot duration 10009.765625 usec
104  * Target - real duration = -9.765625 usec
105  * TSCH_CONF_BASE_DRIFT_PPM -977
106  */
107 #define TSCH_CONF_BASE_DRIFT_PPM -977
108 #endif
109 
110 /* 10 times per second */
111 #ifndef TSCH_CONF_CHANNEL_SCAN_DURATION
112 #define TSCH_CONF_CHANNEL_SCAN_DURATION (CLOCK_SECOND / 10)
113 #endif
114 
115 /* Slightly reduce the TSCH guard time (from 2200 usec to 1800 usec) to make sure
116  * the CC26xx radio has sufficient time to start up. */
117 #ifndef TSCH_CONF_RX_WAIT
118 #define TSCH_CONF_RX_WAIT 1800
119 #endif
120 /*---------------------------------------------------------------------------*/
121 /* Path to CMSIS header */
122 #if (DeviceFamily_PARENT == DeviceFamily_PARENT_CC13X0_CC26X0)
123 #define CMSIS_CONF_HEADER_PATH "cc13x0-cc26x0-cm3.h"
124 #elif (DeviceFamily_PARENT == DeviceFamily_PARENT_CC13X2_CC26X2)
125 #define CMSIS_CONF_HEADER_PATH "cc13x2-cc26x2-cm4.h"
126 #endif
127 /*---------------------------------------------------------------------------*/
128 /* Path to headers with implementation of mutexes and memory barriers */
129 #define MUTEX_CONF_ARCH_HEADER_PATH "mutex-cortex.h"
130 #define MEMORY_BARRIER_CONF_ARCH_HEADER_PATH "memory-barrier-cortex.h"
131 /*---------------------------------------------------------------------------*/
132 #endif /* CC13XX_CC26XX_DEF_H_ */
133 /*---------------------------------------------------------------------------*/
134 /** @} */
Compiler and data type definitions for all CM3-based CPUs.
Compiler and data type definitions for all CM4-based CPUs.