Contiki-NG
cc2538-def.h
1 /*
2  * Copyright (c) 2017, George Oikonomou - http://www.spd.gr
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  *
9  * 1. Redistributions of source code must retain the above copyright
10  * notice, this list of conditions and the following disclaimer.
11  * 2. Redistributions in binary form must reproduce the above copyright
12  * notice, this list of conditions and the following disclaimer in the
13  * documentation and/or other materials provided with the distribution.
14  * 3. Neither the name of the copyright holder nor the names of its
15  * contributors may be used to endorse or promote products derived
16  * from this software without specific prior written permission.
17  *
18  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
21  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
22  * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
23  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
24  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
27  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
29  * OF THE POSSIBILITY OF SUCH DAMAGE.
30  */
31 /*---------------------------------------------------------------------------*/
32 #ifndef CC2538_DEF_H_
33 #define CC2538_DEF_H_
34 /*---------------------------------------------------------------------------*/
35 #include "cm3/cm3-def.h"
36 /*---------------------------------------------------------------------------*/
37 #define RTIMER_ARCH_SECOND 32768
38 /*---------------------------------------------------------------------------*/
39 /* 352us from calling transmit() until the SFD byte has been sent */
40 #define RADIO_DELAY_BEFORE_TX ((unsigned)US_TO_RTIMERTICKS(352))
41 /* 192us as in datasheet but ACKs are not always received, so adjusted to 250us */
42 #define RADIO_DELAY_BEFORE_RX ((unsigned)US_TO_RTIMERTICKS(250))
43 #define RADIO_DELAY_BEFORE_DETECT 0
44 #ifndef TSCH_CONF_BASE_DRIFT_PPM
45 /* The drift compared to "true" 10ms slots.
46  * Enable adaptive sync to enable compensation for this.
47  * Slot length 10000 usec
48  * 328 ticks
49  * Tick duration 30.517578125 usec
50  * Real slot duration 10009.765625 usec
51  * Target - real duration = -9.765625 usec
52  * TSCH_CONF_BASE_DRIFT_PPM -977
53  */
54 #define TSCH_CONF_BASE_DRIFT_PPM -977
55 #endif
56 
57 #if MAC_CONF_WITH_TSCH
58 #define TSCH_CONF_HW_FRAME_FILTERING 0
59 #endif /* MAC_CONF_WITH_TSCH */
60 /*---------------------------------------------------------------------------*/
61 #define SPI_CONF_CONTROLLER_COUNT 2
62 /*---------------------------------------------------------------------------*/
63 /* Path to CMSIS header */
64 #define CMSIS_CONF_HEADER_PATH "cc2538_cm3.h"
65 
66 /* Path to headers with implementation of mutexes and memory barriers */
67 #define MUTEX_CONF_ARCH_HEADER_PATH "mutex-cortex.h"
68 #define MEMORY_BARRIER_CONF_ARCH_HEADER_PATH "memory-barrier-cortex.h"
69 
70 #define GPIO_HAL_CONF_ARCH_HDR_PATH "dev/gpio-hal-arch.h"
71 /*---------------------------------------------------------------------------*/
72 #endif /* CC2538_DEF_H_ */
73 /*---------------------------------------------------------------------------*/
Compiler and data type definitions for all CM3-based CPUs.