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#define CC2538_PHY_OVERHEAD 3
40#define CC2538_BYTE_AIR_TIME 32
41/* 352us from calling transmit() until the SFD byte has been sent */
42#define CC2538_DELAY_BEFORE_TX ((unsigned)US_TO_RTIMERTICKS(352))
43/* 192us as in datasheet but ACKs are not always received, so adjusted to 250us */
44#define CC2538_DELAY_BEFORE_RX ((unsigned)US_TO_RTIMERTICKS(250))
45#define CC2538_DELAY_BEFORE_DETECT 0
46/* Frame filtering done in software */
47#define TSCH_CONF_HW_FRAME_FILTERING 0
48
49#ifndef TSCH_CONF_BASE_DRIFT_PPM
50/* The drift compared to "true" 10ms slots.
51 * Enable adaptive sync to enable compensation for this.
52 * Slot length 10000 usec
53 * 328 ticks
54 * Tick duration 30.517578125 usec
55 * Real slot duration 10009.765625 usec
56 * Target - real duration = -9.765625 usec
57 * TSCH_CONF_BASE_DRIFT_PPM -977
58 */
59#define TSCH_CONF_BASE_DRIFT_PPM -977
60#endif
61
62/*---------------------------------------------------------------------------*/
63#define SPI_CONF_CONTROLLER_COUNT 2
64/*---------------------------------------------------------------------------*/
65/* Path to CMSIS header */
66#define CMSIS_CONF_HEADER_PATH "cc2538_cm3.h"
67
68/* Path to headers with implementation of mutexes, atomic and memory barriers */
69#define MUTEX_CONF_ARCH_HEADER_PATH "mutex-cortex.h"
70#define ATOMIC_CONF_ARCH_HEADER_PATH "atomic-cortex.h"
71#define MEMORY_BARRIER_CONF_ARCH_HEADER_PATH "memory-barrier-cortex.h"
72/*---------------------------------------------------------------------------*/
73#define GPIO_HAL_CONF_ARCH_HDR_PATH "dev/gpio-hal-arch.h"
74#define GPIO_HAL_CONF_ARCH_SW_TOGGLE 1
75#define GPIO_HAL_CONF_PORT_PIN_NUMBERING 0
76/*---------------------------------------------------------------------------*/
77/**
78 * \name rtimer
79 *
80 * @{
81 */
82#ifndef RTIMER_CONF_GUARD_TIME
83#define RTIMER_CONF_GUARD_TIME (7)
84#endif
85/** @} */
86/*---------------------------------------------------------------------------*/
87#endif /* CC2538_DEF_H_ */
88/*---------------------------------------------------------------------------*/
Compiler and data type definitions for all CM3-based CPUs.