From dfc6ee611ae854fbbfaaba70622801a9c9b09e5c Mon Sep 17 00:00:00 2001 From: Edvard Pettersen Date: Thu, 19 Jul 2018 16:44:39 +0200 Subject: [PATCH] Doxygen alignment, and fixed missing TRNG objects --- arch/cpu/cc13xx-cc26xx/Makefile.cc13xx-cc26xx | 20 +- .../cc13x0-cc26x0/cc13x0-cc26x0.icf | 86 +++ .../cc13x0-cc26x0/cc13xx-cc26xx-def.h | 105 ---- .../cc13x2-cc26x2/cc13x2-cc26x2.icf | 91 +++ arch/cpu/cc13xx-cc26xx/cc13xx-cc26xx-conf.h | 4 +- .../{cc13x2-cc26x2 => }/cc13xx-cc26xx-def.h | 43 +- arch/cpu/cc13xx-cc26xx/dev/clock-arch.c | 132 ++-- arch/cpu/cc13xx-cc26xx/dev/dbg-arch.c | 38 +- arch/cpu/cc13xx-cc26xx/dev/gpio-hal-arch.c | 39 +- arch/cpu/cc13xx-cc26xx/dev/gpio-hal-arch.h | 22 +- arch/cpu/cc13xx-cc26xx/dev/int-master-arch.c | 22 +- .../dev/{random-arch.c => random.c} | 50 +- arch/cpu/cc13xx-cc26xx/dev/rtimer-arch.c | 5 +- .../dev/startup_cc13xx_cc26xx_gcc.c | 220 +++---- .../dev/startup_cc13xx_cc26xx_iar.c | 306 ++++++++++ arch/cpu/cc13xx-cc26xx/dev/ti-lib-rom.h | 194 ------ arch/cpu/cc13xx-cc26xx/dev/ti-lib.h | 578 ------------------ arch/cpu/cc13xx-cc26xx/dev/trng-arch.c | 94 +++ arch/cpu/cc13xx-cc26xx/dev/trng-arch.h | 75 +++ .../{dev/rf-ble-addr.c => rf/ble-addr.c} | 2 +- .../{dev/rf-ble-addr.h => rf/ble-addr.h} | 0 .../rf-ble-beacond.c => rf/ble-beacond.c} | 6 +- .../rf-ble-beacond.h => rf/ble-beacond.h} | 0 .../{dev/rf-data-queue.c => rf/data-queue.c} | 2 +- .../{dev/rf-data-queue.h => rf/data-queue.h} | 0 .../{dev/rf-15-4g.h => rf/dot-15-4g.h} | 0 .../{dev/rf-ieee-addr.c => rf/ieee-addr.c} | 2 +- .../{dev/rf-ieee-addr.h => rf/ieee-addr.h} | 0 .../{dev/rf-ieee-mode.c => rf/ieee-mode.c} | 8 +- .../{dev/rf-prop-mode.c => rf/prop-mode.c} | 0 .../cc13xx-cc26xx/{dev/rf-core.h => rf/rf.h} | 0 .../{dev/rf-sched.c => rf/sched.c} | 6 +- .../{dev/rf-sched.h => rf/sched.h} | 2 - .../cc13xx-cc26xx/Makefile.cc13xx-cc26xx | 1 + .../simplelink/cc13xx-cc26xx}/batmon-sensor.c | 26 +- .../simplelink/cc13xx-cc26xx}/batmon-sensor.h | 0 .../launchpad/cc1310/CC1310_LAUNCHXL.c | 23 + .../launchpad/cc1310/CC1310_LAUNCHXL.h | 10 + .../launchpad/cc1312r1/CC1312R1_LAUNCHXL.c | 23 + .../launchpad/cc1312r1/CC1312R1_LAUNCHXL.h | 10 + .../launchpad/cc1350/CC1350_LAUNCHXL.c | 23 + .../launchpad/cc1350/CC1350_LAUNCHXL.h | 10 + .../launchpad/cc1352p-2/CC1352P_2_LAUNCHXL.c | 23 + .../launchpad/cc1352p-2/CC1352P_2_LAUNCHXL.h | 10 + .../launchpad/cc1352p-4/CC1352P_4_LAUNCHXL.c | 23 + .../launchpad/cc1352p-4/CC1352P_4_LAUNCHXL.h | 10 + .../launchpad/cc1352p1/CC1352P1_LAUNCHXL.c | 23 + .../launchpad/cc1352p1/CC1352P1_LAUNCHXL.h | 10 + .../launchpad/cc1352r1/CC1352R1_LAUNCHXL.c | 23 + .../launchpad/cc1352r1/CC1352R1_LAUNCHXL.h | 10 + .../launchpad/cc2650/CC2650_LAUNCHXL.c | 23 + .../launchpad/cc2650/CC2650_LAUNCHXL.h | 10 + .../launchpad/cc26x2r1/CC26X2R1_LAUNCHXL.c | 23 + .../launchpad/cc26x2r1/CC26X2R1_LAUNCHXL.h | 10 + .../simplelink/cc13xx-cc26xx/platform.c | 21 +- .../sensortag/cc1350/CC1350STK.c | 23 + .../sensortag/cc1350/CC1350STK.h | 10 + .../sensortag/cc2650/CC2650STK.c | 23 + .../sensortag/cc2650/CC2650STK.h | 10 + .../cc13xx-cc26xx/srf06/cc13x0/CC1350DK_7XD.c | 23 + .../cc13xx-cc26xx/srf06/cc13x0/CC1350DK_7XD.h | 10 + .../cc13xx-cc26xx/srf06/cc26x0/CC2650DK_7ID.c | 23 + .../cc13xx-cc26xx/srf06/cc26x0/CC2650DK_7ID.h | 10 + 63 files changed, 1455 insertions(+), 1174 deletions(-) create mode 100644 arch/cpu/cc13xx-cc26xx/cc13x0-cc26x0/cc13x0-cc26x0.icf delete mode 100644 arch/cpu/cc13xx-cc26xx/cc13x0-cc26x0/cc13xx-cc26xx-def.h create mode 100644 arch/cpu/cc13xx-cc26xx/cc13x2-cc26x2/cc13x2-cc26x2.icf rename arch/cpu/cc13xx-cc26xx/{cc13x2-cc26x2 => }/cc13xx-cc26xx-def.h (78%) rename arch/cpu/cc13xx-cc26xx/dev/{random-arch.c => random.c} (67%) create mode 100644 arch/cpu/cc13xx-cc26xx/dev/startup_cc13xx_cc26xx_iar.c delete mode 100644 arch/cpu/cc13xx-cc26xx/dev/ti-lib-rom.h delete mode 100644 arch/cpu/cc13xx-cc26xx/dev/ti-lib.h create mode 100644 arch/cpu/cc13xx-cc26xx/dev/trng-arch.c create mode 100644 arch/cpu/cc13xx-cc26xx/dev/trng-arch.h rename arch/cpu/cc13xx-cc26xx/{dev/rf-ble-addr.c => rf/ble-addr.c} (99%) rename arch/cpu/cc13xx-cc26xx/{dev/rf-ble-addr.h => rf/ble-addr.h} (100%) rename arch/cpu/cc13xx-cc26xx/{dev/rf-ble-beacond.c => rf/ble-beacond.c} (99%) rename arch/cpu/cc13xx-cc26xx/{dev/rf-ble-beacond.h => rf/ble-beacond.h} (100%) rename arch/cpu/cc13xx-cc26xx/{dev/rf-data-queue.c => rf/data-queue.c} (99%) rename arch/cpu/cc13xx-cc26xx/{dev/rf-data-queue.h => rf/data-queue.h} (100%) rename arch/cpu/cc13xx-cc26xx/{dev/rf-15-4g.h => rf/dot-15-4g.h} (100%) rename arch/cpu/cc13xx-cc26xx/{dev/rf-ieee-addr.c => rf/ieee-addr.c} (99%) rename arch/cpu/cc13xx-cc26xx/{dev/rf-ieee-addr.h => rf/ieee-addr.h} (100%) rename arch/cpu/cc13xx-cc26xx/{dev/rf-ieee-mode.c => rf/ieee-mode.c} (99%) rename arch/cpu/cc13xx-cc26xx/{dev/rf-prop-mode.c => rf/prop-mode.c} (100%) rename arch/cpu/cc13xx-cc26xx/{dev/rf-core.h => rf/rf.h} (100%) rename arch/cpu/cc13xx-cc26xx/{dev/rf-sched.c => rf/sched.c} (99%) rename arch/cpu/cc13xx-cc26xx/{dev/rf-sched.h => rf/sched.h} (99%) rename arch/{cpu/cc13xx-cc26xx/dev => platform/simplelink/cc13xx-cc26xx}/batmon-sensor.c (88%) rename arch/{cpu/cc13xx-cc26xx/dev => platform/simplelink/cc13xx-cc26xx}/batmon-sensor.h (100%) diff --git a/arch/cpu/cc13xx-cc26xx/Makefile.cc13xx-cc26xx b/arch/cpu/cc13xx-cc26xx/Makefile.cc13xx-cc26xx index 558ad4655..6605ea849 100644 --- a/arch/cpu/cc13xx-cc26xx/Makefile.cc13xx-cc26xx +++ b/arch/cpu/cc13xx-cc26xx/Makefile.cc13xx-cc26xx @@ -67,23 +67,23 @@ EXTERNALDIRS += $(SDK_DEVICE) EXTERNALDIRS += $(SDK_DEVICE)/startup_files ### CPU-dependent source files -CONTIKI_CPU_SOURCEFILES += rtimer-arch.c clock-arch.c +CONTIKI_CPU_SOURCEFILES += rtimer-arch.c clock-arch.c CONTIKI_CPU_SOURCEFILES += watchdog-arch.c dbg-arch.c -CONTIKI_CPU_SOURCEFILES += uart0-arch.c slip-arch.c -CONTIKI_CPU_SOURCEFILES += batmon-sensor.c gpio-hal-arch.c -CONTIKI_CPU_SOURCEFILES += int-master-arch.c +CONTIKI_CPU_SOURCEFILES += uart0-arch.c slip-arch.c +CONTIKI_CPU_SOURCEFILES += gpio-hal-arch.c int-master-arch.c +CONTIKI_CPU_SOURCEFILES += random.c trng-arch.c ### RF source files -CONTIKI_CPU_SOURCEFILES += rf-sched.c rf-data-queue.c -CONTIKI_CPU_SOURCEFILES += rf-ieee-addr.c rf-ble-addr.c -CONTIKI_CPU_SOURCEFILES += rf-ble-beacond.c +CONTIKI_CPU_SOURCEFILES += sched.c data-queue.c +CONTIKI_CPU_SOURCEFILES += ieee-addr.c ble-addr.c +CONTIKI_CPU_SOURCEFILES += ble-beacond.c ifeq ($(SUPPORTS_PROP_MODE),1) -CONTIKI_CPU_SOURCEFILES += rf-prop-mode.c prop-settings.c +CONTIKI_CPU_SOURCEFILES += prop-mode.c prop-settings.c endif ifeq ($(SUPPORTS_IEEE_MODE),1) -CONTIKI_CPU_SOURCEFILES += rf-ieee-mode.c ieee-settings.c +CONTIKI_CPU_SOURCEFILES += ieee-mode.c ieee-settings.c endif ifeq ($(SUPPORTS_BLE_BEACON),1) @@ -95,7 +95,7 @@ MODULES += os/lib/dbg-io ### CPU-dependent directories CONTIKI_CPU_DIRS += . dev $(SUBFAMILY) -CONTIKI_CPU_DIRS += rf-settings rf-settings/$(DEVICE_FAMILY_LC) +CONTIKI_CPU_DIRS += rf rf-settings rf-settings/$(DEVICE_FAMILY_LC) CONTIKI_SOURCEFILES += $(CONTIKI_CPU_SOURCEFILES) $(DEBUG_IO_SOURCEFILES) diff --git a/arch/cpu/cc13xx-cc26xx/cc13x0-cc26x0/cc13x0-cc26x0.icf b/arch/cpu/cc13xx-cc26xx/cc13x0-cc26x0/cc13x0-cc26x0.icf new file mode 100644 index 000000000..5dee82c93 --- /dev/null +++ b/arch/cpu/cc13xx-cc26xx/cc13x0-cc26x0/cc13x0-cc26x0.icf @@ -0,0 +1,86 @@ +/* + * Copyright (c) 2017, Texas Instruments Incorporated + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of Texas Instruments Incorporated nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +define symbol STACK_SIZE = 0x800; /* 2048 bytes */ +define symbol HEAP_SIZE = 0x100; /* 256 bytes */ + +define symbol __intvec_start__ = 0x00000000; + +/*-Memory Regions-*/ +define symbol ROM_start__ = 0x00000000; +define symbol ROM_end__ = 0x0001FFFF; +define symbol RAM_start__ = 0x20000000; +define symbol RAM_end__ = 0x20004FFF; + +/* Define a memory region that covers the entire 4 GB addressable space */ +define memory mem with size = 4G; + +/* Define a region for the on-chip flash */ +define region FLASH_region = mem:[from ROM_start__ to ROM_end__]; + +/* Define a region for the on-chip SRAM */ +define region RAM_region = mem:[from RAM_start__ to RAM_end__]; + +/* Place the interrupt vectors at the start of flash */ +place at address mem:__intvec_start__ { readonly section .intvec }; +keep { section .intvec }; + +/* Place the CCA area at the end of flash */ +place at end of FLASH_region { readonly section .ccfg }; +keep { section .ccfg }; + +/* Place remaining 'read only' in Flash */ +place in FLASH_region { readonly }; + +/* Place all read/write items into RAM */ +place in RAM_region { readwrite }; +initialize by copy { readwrite }; + +/* + * Define CSTACK block to contain .stack section. This enables the IAR IDE + * to properly show the stack content during debug. Place stack at end of + * retention RAM, do not initialize (initializing the stack will destroy the + * return address from the initialization code, causing the processor to branch + * to zero and fault) + */ +define block CSTACK with alignment = 8, size = STACK_SIZE { section .stack }; +place at end of RAM_region { block CSTACK }; +do not initialize { section .stack, section .noinit }; + +/* Export stack top symbol. Used by startup file */ +define exported symbol STACK_TOP = RAM_end__ + 1; + +/* Primary Heap configuration */ +define block HEAP with alignment = 8, size = HEAP_SIZE { }; + +/* Place heap just before CSTACK */ +place in RAM_region { block HEAP }; diff --git a/arch/cpu/cc13xx-cc26xx/cc13x0-cc26x0/cc13xx-cc26xx-def.h b/arch/cpu/cc13xx-cc26xx/cc13x0-cc26x0/cc13xx-cc26xx-def.h deleted file mode 100644 index bca8365c7..000000000 --- a/arch/cpu/cc13xx-cc26xx/cc13x0-cc26x0/cc13xx-cc26xx-def.h +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Copyright (c) 2017, George Oikonomou - http://www.spd.gr - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the copyright holder nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*---------------------------------------------------------------------------*/ -#ifndef CC13XX_CC26XX_DEF_H_ -#define CC13XX_CC26XX_DEF_H_ -/*---------------------------------------------------------------------------*/ -#include -/*---------------------------------------------------------------------------*/ -/* TSCH related defines */ - -/* Delay between GO signal and SFD */ -#define RADIO_DELAY_BEFORE_TX ((unsigned)US_TO_RTIMERTICKS(81)) -/* Delay between GO signal and start listening. - * This value is so small because the radio is constantly on within each timeslot. */ -#define RADIO_DELAY_BEFORE_RX ((unsigned)US_TO_RTIMERTICKS(15)) -/* Delay between the SFD finishes arriving and it is detected in software. */ -#define RADIO_DELAY_BEFORE_DETECT ((unsigned)US_TO_RTIMERTICKS(352)) - -/* Timer conversion; radio is running at 4 MHz */ -#define RAT_SECOND 4000000u -#define RAT_TO_RTIMER(X) ((uint32_t)(((uint64_t)(X) * (RTIMER_SECOND / 256)) / (RAT_SECOND / 256))) -#define USEC_TO_RAT(X) ((X) * 4) - -#if (RTIMER_SECOND % 256) || (RAT_SECOND % 256) -# error RAT_TO_RTIMER macro must be fixed! -#endif - -/* The PHY header (preamble + SFD, 4+1 bytes) duration is equivalent to 10 symbols */ -#define RADIO_IEEE_802154_PHY_HEADER_DURATION_USEC 160 - -/* Do not turn off TSCH within a timeslot: not enough time */ -#define TSCH_CONF_RADIO_ON_DURING_TIMESLOT 1 - -/* Disable TSCH frame filtering */ -#define TSCH_CONF_HW_FRAME_FILTERING 0 - -/* Use hardware timestamps */ -#ifndef TSCH_CONF_RESYNC_WITH_SFD_TIMESTAMPS -#define TSCH_CONF_RESYNC_WITH_SFD_TIMESTAMPS 1 -#define TSCH_CONF_TIMESYNC_REMOVE_JITTER 0 -#endif - -#ifndef TSCH_CONF_BASE_DRIFT_PPM -/* The drift compared to "true" 10ms slots. - * Enable adaptive sync to enable compensation for this. - * Slot length 10000 usec - * 328 ticks - * Tick duration 30.517578125 usec - * Real slot duration 10009.765625 usec - * Target - real duration = -9.765625 usec - * TSCH_CONF_BASE_DRIFT_PPM -977 - */ -#define TSCH_CONF_BASE_DRIFT_PPM -977 -#endif - -/* 10 times per second */ -#ifndef TSCH_CONF_CHANNEL_SCAN_DURATION -#define TSCH_CONF_CHANNEL_SCAN_DURATION (CLOCK_SECOND / 10) -#endif - -/* Slightly reduce the TSCH guard time (from 2200 usec to 1800 usec) to make sure - * the CC26xx radio has sufficient time to start up. */ -#ifndef TSCH_CONF_RX_WAIT -#define TSCH_CONF_RX_WAIT 1800 -#endif -/*---------------------------------------------------------------------------*/ -#define RTIMER_ARCH_SECOND 65536 -/*---------------------------------------------------------------------------*/ -/* Path to CMSIS header */ -#define CMSIS_CONF_HEADER_PATH "cc13x0-cc26x0-cm3.h" - -/* Path to headers with implementation of mutexes and memory barriers */ -#define MUTEX_CONF_ARCH_HEADER_PATH "mutex-cortex.h" -#define MEMORY_BARRIER_CONF_ARCH_HEADER_PATH "memory-barrier-cortex.h" -/*---------------------------------------------------------------------------*/ -#endif /* CC13XX_CC26XX_DEF_H_ */ -/*---------------------------------------------------------------------------*/ diff --git a/arch/cpu/cc13xx-cc26xx/cc13x2-cc26x2/cc13x2-cc26x2.icf b/arch/cpu/cc13xx-cc26xx/cc13x2-cc26x2/cc13x2-cc26x2.icf new file mode 100644 index 000000000..32316f445 --- /dev/null +++ b/arch/cpu/cc13xx-cc26xx/cc13x2-cc26x2/cc13x2-cc26x2.icf @@ -0,0 +1,91 @@ +/* + * Copyright (c) 2017, Texas Instruments Incorporated + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of Texas Instruments Incorporated nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +define symbol STACK_SIZE = 0x800; /* 2048 bytes */ +define symbol HEAP_SIZE = 0x100; /* 256 bytes */ + +define symbol __intvec_start__ = 0x00000000; + +/*-Memory Regions-*/ +define symbol ROM_start__ = 0x00000000; +define symbol ROM_end__ = 0x00057FFF; +define symbol RAM_start__ = 0x20000000; +define symbol RAM_end__ = 0x20013FFF; +define symbol GPRAM_start__ = 0x11000000; +define symbol GPRAM_end__ = 0x11001FFF; + +/* Define a memory region that covers the entire 4 GB addressable space */ +define memory mem with size = 4G; + +/* Define a region for the on-chip flash */ +define region FLASH_region = mem:[from ROM_start__ to ROM_end__]; + +/* Define a region for the on-chip SRAM */ +define region RAM_region = mem:[from RAM_start__ to RAM_end__]; + +/* Define a region for the on-chip GPRAM */ +define region GPRAM_region = mem:[from GPRAM_start__ to GPRAM_end__]; + +/* Place the interrupt vectors at the start of flash */ +place at address mem:__intvec_start__ { readonly section .intvec }; +keep { section .intvec }; + +/* Place the CCA area at the end of flash */ +place at end of FLASH_region { readonly section .ccfg }; +keep { section .ccfg }; + +/* Place remaining 'read only' in Flash */ +place in FLASH_region { readonly }; + +/* Place all read/write items into RAM */ +place in RAM_region { readwrite }; +initialize by copy { readwrite }; + +/* + * Define CSTACK block to contain .stack section. This enables the IAR IDE + * to properly show the stack content during debug. Place stack at end of + * retention RAM, do not initialize (initializing the stack will destroy the + * return address from the initialization code, causing the processor to branch + * to zero and fault) + */ +define block CSTACK with alignment = 8, size = STACK_SIZE { section .stack }; +place at end of RAM_region { block CSTACK }; +do not initialize { section .stack, section .noinit }; + +/* Export stack top symbol. Used by startup file */ +define exported symbol STACK_TOP = RAM_end__ + 1; + +/* Primary Heap configuration */ +define block HEAP with alignment = 8, size = HEAP_SIZE { }; + +/* Place heap just before CSTACK */ +place in RAM_region { block HEAP }; diff --git a/arch/cpu/cc13xx-cc26xx/cc13xx-cc26xx-conf.h b/arch/cpu/cc13xx-cc26xx/cc13xx-cc26xx-conf.h index 09c93bdf5..45b10e17d 100644 --- a/arch/cpu/cc13xx-cc26xx/cc13xx-cc26xx-conf.h +++ b/arch/cpu/cc13xx-cc26xx/cc13xx-cc26xx-conf.h @@ -43,7 +43,7 @@ /*---------------------------------------------------------------------------*/ #include "cc13xx-cc26xx-def.h" -#include "rf-core.h" +#include "rf/rf.h" /*---------------------------------------------------------------------------*/ /** * \name GPIO HAL configuration. @@ -68,7 +68,7 @@ #ifndef RF_CONF_FAST_RADIO_STARTUP # define RF_FAST_RADIO_STARTUP (MAC_CONF_WITH_TSCH) #else -# define RF_FAST_RADIO_STARTUP 0 +# define RF_FAST_RADIO_STARTUP RF_CONF_FAST_RADIO_STARTUP #endif /* diff --git a/arch/cpu/cc13xx-cc26xx/cc13x2-cc26x2/cc13xx-cc26xx-def.h b/arch/cpu/cc13xx-cc26xx/cc13xx-cc26xx-def.h similarity index 78% rename from arch/cpu/cc13xx-cc26xx/cc13x2-cc26x2/cc13xx-cc26xx-def.h rename to arch/cpu/cc13xx-cc26xx/cc13xx-cc26xx-def.h index 507db4470..0f941b058 100644 --- a/arch/cpu/cc13xx-cc26xx/cc13x2-cc26x2/cc13xx-cc26xx-def.h +++ b/arch/cpu/cc13xx-cc26xx/cc13xx-cc26xx-def.h @@ -1,11 +1,10 @@ /* - * Copyright (c) 2017, George Oikonomou - http://www.spd.gr + * Copyright (c) 2018, Texas Instruments Incorporated - http://www.ti.com/ * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: - * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright @@ -28,11 +27,32 @@ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED * OF THE POSSIBILITY OF SUCH DAMAGE. */ +/** + * \addtogroup cc13xx-cc26xx-cpu + * @{ + * + * \file + * Header with configuration defines for the Contiki system. + * \author + * Edvard Pettersen + */ /*---------------------------------------------------------------------------*/ #ifndef CC13XX_CC26XX_DEF_H_ #define CC13XX_CC26XX_DEF_H_ /*---------------------------------------------------------------------------*/ -#include +#include +/*---------------------------------------------------------------------------*/ +#if (DeviceFamily_PARENT == DeviceFamily_PARENT_CC13X0_CC26X0) +# include +#elif (DeviceFamily_PARENT == DeviceFamily_PARENT_CC13X2_CC26X2) +# include +#endif +/*---------------------------------------------------------------------------*/ +#include +/*---------------------------------------------------------------------------*/ +#define RTIMER_ARCH_SECOND 65536 +/*---------------------------------------------------------------------------*/ +#define INT_MASTER_CONF_STATUS_DATATYPE uintptr_t /*---------------------------------------------------------------------------*/ /* TSCH related defines */ @@ -44,7 +64,6 @@ /* Delay between the SFD finishes arriving and it is detected in software. */ #define RADIO_DELAY_BEFORE_DETECT ((unsigned)US_TO_RTIMERTICKS(352)) -/* Timer conversion; radio is running at 4 MHz */ /* Timer conversion; radio is running at 4 MHz */ #define RAT_SECOND 4000000u #define RAT_TO_RTIMER(X) ((uint32_t)(((uint64_t)(X) * (RTIMER_SECOND / 256)) / (RAT_SECOND / 256))) @@ -54,8 +73,6 @@ # error RAT_TO_RTIMER macro must be fixed! #endif -#define USEC_TO_RADIO(X) ((X) * 4) - /* The PHY header (preamble + SFD, 4+1 bytes) duration is equivalent to 10 symbols */ #define RADIO_IEEE_802154_PHY_HEADER_DURATION_USEC 160 @@ -72,7 +89,8 @@ #endif #ifndef TSCH_CONF_BASE_DRIFT_PPM -/* The drift compared to "true" 10ms slots. +/* + * The drift compared to "true" 10ms slots. * Enable adaptive sync to enable compensation for this. * Slot length 10000 usec * 328 ticks @@ -95,14 +113,17 @@ #define TSCH_CONF_RX_WAIT 1800 #endif /*---------------------------------------------------------------------------*/ -#define RTIMER_ARCH_SECOND 65536 -/*---------------------------------------------------------------------------*/ /* Path to CMSIS header */ -#define CMSIS_CONF_HEADER_PATH "cc13x2-cc26x2-cm4.h" - +#if (DeviceFamily_PARENT == DeviceFamily_PARENT_CC13X0_CC26X0) +# define CMSIS_CONF_HEADER_PATH "cc13x0-cc26x0-cm3.h" +#elif (DeviceFamily_PARENT == DeviceFamily_PARENT_CC13X2_CC26X2) +# define CMSIS_CONF_HEADER_PATH "cc13x2-cc26x2-cm4.h" +#endif +/*---------------------------------------------------------------------------*/ /* Path to headers with implementation of mutexes and memory barriers */ #define MUTEX_CONF_ARCH_HEADER_PATH "mutex-cortex.h" #define MEMORY_BARRIER_CONF_ARCH_HEADER_PATH "memory-barrier-cortex.h" /*---------------------------------------------------------------------------*/ #endif /* CC13XX_CC26XX_DEF_H_ */ /*---------------------------------------------------------------------------*/ +/** @} */ diff --git a/arch/cpu/cc13xx-cc26xx/dev/clock-arch.c b/arch/cpu/cc13xx-cc26xx/dev/clock-arch.c index e39d54f4c..3396240e8 100644 --- a/arch/cpu/cc13xx-cc26xx/dev/clock-arch.c +++ b/arch/cpu/cc13xx-cc26xx/dev/clock-arch.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Texas Instruments Incorporated - http://www.ti.com/ + * Copyright (c) 2018, Texas Instruments Incorporated - http://www.ti.com/ * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -27,114 +27,110 @@ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED * OF THE POSSIBILITY OF SUCH DAMAGE. */ -/*---------------------------------------------------------------------------*/ /** - * \addtogroup cc26xx-clocks + * \addtogroup cc13xx-cc26xx-cpu * @{ * - * \defgroup cc26xx-software-clock Software Clock + * \defgroup cc13xx-cc26xx-clock CC13xx/CC26xx clock library * - * Implementation of the clock module for the CC26xx and CC13xx. - * - * The software clock uses the facilities provided by the AON RTC driver * @{ - * * \file - * Software clock implementation for the TI CC13xx/CC26xx + * Implementation of the clock libary for CC13xx/CC26xx. + * \author + * Edvard Pettersen */ /*---------------------------------------------------------------------------*/ +#include "contiki.h" +#include "sys/etimer.h" +/*---------------------------------------------------------------------------*/ #include #include DeviceFamily_constructPath(driverlib/aon_rtc.h) #include DeviceFamily_constructPath(driverlib/cpu.h) #include DeviceFamily_constructPath(driverlib/interrupt.h) #include DeviceFamily_constructPath(driverlib/prcm.h) #include DeviceFamily_constructPath(driverlib/timer.h) + #include +#include #include - -#include "contiki.h" - -#define DPL_CLOCK_TICK_PERIOD_US ClockP_getSystemTickPeriod() -#define CLOCK_TICKS_SECOND ((uint32_t)1000000 / (CLOCK_SECOND) / (DPL_CLOCK_TICK_PERIOD_US)) - /*---------------------------------------------------------------------------*/ -static volatile uint64_t count; -static ClockP_Struct etimerClock; -static void clock_update(void); -/*---------------------------------------------------------------------------*/ -void -clock_init(void) -{ - count = 0; - ClockP_Params params; - ClockP_Params_init(¶ms); - params.period = CLOCK_TICKS_SECOND; - params.startFlag = true; - ClockP_construct(&etimerClock, (ClockP_Fxn)&clock_update, CLOCK_TICKS_SECOND, ¶ms); -} -/*---------------------------------------------------------------------------*/ -clock_time_t -clock_time(void) -{ - uint64_t count_read; - { - const uintptr_t key = HwiP_disable(); - count_read = count; - HwiP_restore(key); - } - - return (clock_time_t)(count_read & 0xFFFFFFFF); -} +static volatile clock_time_t count; +static ClockP_Struct etimer_clock; /*---------------------------------------------------------------------------*/ static void -clock_update(void) +clock_update_cb(void) { - { - const uintptr_t key = HwiP_disable(); - count += 1; - HwiP_restore(key); - } + const uintptr_t key = HwiP_disable(); + count += 1; + HwiP_restore(key); + /* Notify the etimer system. */ if (etimer_pending()) { etimer_request_poll(); } } /*---------------------------------------------------------------------------*/ +static inline clock_time_t +get_count(void) +{ + clock_time_t count_read; + + const uintptr_t key = HwiP_disable(); + count_read = count; + HwiP_restore(key); + + return count_read; +} +/*---------------------------------------------------------------------------*/ +void +clock_init(void) +{ + /* ClockP_getSystemTickPeriod() returns ticks per us. */ + const uint32_t clockp_ticks_second = + (uint32_t)(1000 * 1000) / (CLOCK_SECOND) / ClockP_getSystemTickPeriod(); + + count = 0; + + ClockP_Params params; + ClockP_Params_init(¶ms); + + params.period = clockp_ticks_second; + params.startFlag = true; + + ClockP_construct(&etimer_clock, (ClockP_Fxn)&clock_update_cb, + clockp_ticks_second, ¶ms); +} +/*---------------------------------------------------------------------------*/ +clock_time_t +clock_time(void) +{ + return get_count(); +} +/*---------------------------------------------------------------------------*/ unsigned long clock_seconds(void) { - uint64_t count_read; - { - const uintptr_t key = HwiP_disable(); - count_read = count; - HwiP_restore(key); - } - - return (unsigned long)count_read / CLOCK_SECOND; + return (unsigned long)get_count() / CLOCK_SECOND; } /*---------------------------------------------------------------------------*/ void clock_wait(clock_time_t i) { - const clock_time_t start = clock_time(); - while(clock_time() - start < (clock_time_t)i); + clock_time_t start; + + start = clock_time(); + while(clock_time() - start < i); } /*---------------------------------------------------------------------------*/ void -clock_delay_usec(uint16_t len) +clock_delay_usec(uint16_t usec) { - // See driverlib/cpu.h - const uint32_t cpu_clock_mhz = 48; - // Code in flash, cache disabled: 7 cycles per loop - const uint32_t cycles_per_loop = 7; - // ui32Count = [delay in us] * [CPU clock in MHz] / [cycles per loop] - const uint32_t count = (uint32_t)len * cpu_clock_mhz / cycles_per_loop; - CPUdelay(count); + ClockP_usleep(usec); } /*---------------------------------------------------------------------------*/ /** - * \brief Obsolete delay function but we implement it here since some code - * still uses it + * \brief Obsolete delay function but we implement it here since some code + * still uses it. */ void clock_delay(unsigned int i) diff --git a/arch/cpu/cc13xx-cc26xx/dev/dbg-arch.c b/arch/cpu/cc13xx-cc26xx/dev/dbg-arch.c index a12a877ed..1c9ec68cc 100644 --- a/arch/cpu/cc13xx-cc26xx/dev/dbg-arch.c +++ b/arch/cpu/cc13xx-cc26xx/dev/dbg-arch.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Texas Instruments Incorporated - http://www.ti.com/ + * Copyright (c) 2018, Texas Instruments Incorporated - http://www.ti.com/ * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -27,21 +27,35 @@ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED * OF THE POSSIBILITY OF SUCH DAMAGE. */ +/** + * \addtogroup cc13xx-cc26xx-platform + * @{ + * + * \file + * Implementation of the dbg module for CC13xx/CC26xx, used by stdio. + * The dbg module is implemented by writing to UART0. + * \author + * Edvard Pettersen + */ /*---------------------------------------------------------------------------*/ +#include "contiki.h" #include "sys/cc.h" /*---------------------------------------------------------------------------*/ +#include "uart0-arch.h" +/*---------------------------------------------------------------------------*/ #include #include #include /*---------------------------------------------------------------------------*/ -#include "uart0-arch.h" -/*---------------------------------------------------------------------------*/ int dbg_putchar(int c) { - const unsigned char ch = (unsigned char)c; + unsigned char ch; + int num_bytes; - const int num_bytes = (int)uart0_write(&ch, 1); + ch = (unsigned char)c; + + num_bytes = (int)uart0_write(&ch, 1); return (num_bytes > 0) ? num_bytes : 0; @@ -50,17 +64,21 @@ dbg_putchar(int c) unsigned int dbg_send_bytes(const unsigned char *seq, unsigned int len) { - const size_t seq_len = strlen((const char *)seq); + size_t seq_len; + size_t max_len; + int num_bytes; - const size_t max_len = MIN(seq_len, (size_t)len); + seq_len = strlen((const char *)seq); + max_len = MIN(seq_len, (size_t)len); if (max_len == 0) { return 0; } - const int num_bytes = (int)uart0_write(seq, max_len); + num_bytes = (int)uart0_write(seq, max_len); return (num_bytes > 0) - ? num_bytes - : 0; + ? num_bytes + : 0; } /*---------------------------------------------------------------------------*/ +/** @} */ diff --git a/arch/cpu/cc13xx-cc26xx/dev/gpio-hal-arch.c b/arch/cpu/cc13xx-cc26xx/dev/gpio-hal-arch.c index 38ebe4a0c..c88549149 100644 --- a/arch/cpu/cc13xx-cc26xx/dev/gpio-hal-arch.c +++ b/arch/cpu/cc13xx-cc26xx/dev/gpio-hal-arch.c @@ -1,11 +1,10 @@ /* - * Copyright (c) 2017, George Oikonomou - http://www.spd.gr + * Copyright (c) 2018, Texas Instruments Incorporated - http://www.ti.com/ * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: - * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright @@ -28,31 +27,30 @@ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED * OF THE POSSIBILITY OF SUCH DAMAGE. */ -/*---------------------------------------------------------------------------*/ /** - * \addtogroup cc26xx-gpio-hal + * \addtogroup cc13xx-cc26xx-gpio-hal * @{ * * \file - * Implementation file for the CC13xx/CC26xx GPIO HAL functions + * Implementation of the GPIO HAL module for CC13xx/CC26xx. The GPIO + * HAL module is implemented by using the PINCC26XX module, except + * for multi-dio functions which use the GPIO driverlib module. + * \author + * Edvard Pettersen */ /*---------------------------------------------------------------------------*/ #include "contiki.h" #include "dev/gpio-hal.h" - +/*---------------------------------------------------------------------------*/ #include #include DeviceFamily_constructPath(driverlib/gpio.h) #include #include - +/*---------------------------------------------------------------------------*/ #include /*---------------------------------------------------------------------------*/ -static PIN_Config pin_config[] = -{ - PIN_TERMINATE -}; - +static PIN_Config pin_config[] = { PIN_TERMINATE }; static PIN_State pin_state; static PIN_Handle pin_handle; /*---------------------------------------------------------------------------*/ @@ -65,10 +63,12 @@ from_hal_cfg(gpio_hal_pin_cfg_t cfg, PIN_Config *pin_cfg, PIN_Config *pin_mask) if (cfg & GPIO_HAL_PIN_BM_INPUT) { *pin_mask |= PIN_BM_INPUT_MODE; + /* Hysteresis config */ if ((cfg & GPIO_HAL_PIN_BM_INPUT_HYSTERESIS) == GPIO_HAL_PIN_CFG_INPUT_HYSTERESIS) { *pin_cfg |= PIN_HYSTERESIS; } + /* Pulling config */ switch (cfg & GPIO_HAL_PIN_BM_INPUT_PULLING) { case GPIO_HAL_PIN_CFG_INPUT_NOPULL: *pin_cfg |= PIN_NOPULL; break; case GPIO_HAL_PIN_CFG_INPUT_PULLUP: *pin_cfg |= PIN_PULLUP; break; @@ -80,16 +80,19 @@ from_hal_cfg(gpio_hal_pin_cfg_t cfg, PIN_Config *pin_cfg, PIN_Config *pin_mask) if (cfg & GPIO_HAL_PIN_BM_OUTPUT) { *pin_mask |= PIN_BM_OUTPUT_MODE; + /* Output buffer type config */ switch (cfg & GPIO_HAL_PIN_BM_OUTPUT_BUF) { case GPIO_HAL_PIN_CFG_OUTPUT_PUSHPULL: *pin_cfg |= PIN_PUSHPULL; break; case GPIO_HAL_PIN_CFG_OUTPUT_OPENDRAIN: *pin_cfg |= PIN_OPENDRAIN; break; case GPIO_HAL_PIN_CFG_OUTPUT_OPENSOURCE: *pin_cfg |= PIN_OPENSOURCE; break; } + /* Slew control config */ if ((cfg & GPIO_HAL_PIN_BM_OUTPUT_SLEWCTRL) == GPIO_HAL_PIN_CFG_OUTPUT_SLEWCTRL) { *pin_cfg |= PIN_SLEWCTRL; } + /* Drive strength config */ switch (cfg & GPIO_HAL_PIN_BM_OUTPUT_DRVSTR) { case GPIO_HAL_PIN_CFG_OUTPUT_DRVSTR_MIN: *pin_cfg |= PIN_DRVSTR_MIN; break; case GPIO_HAL_PIN_CFG_OUTPUT_DRVSTR_MED: *pin_cfg |= PIN_DRVSTR_MED; break; @@ -101,7 +104,8 @@ from_hal_cfg(gpio_hal_pin_cfg_t cfg, PIN_Config *pin_cfg, PIN_Config *pin_mask) if (cfg & GPIO_HAL_PIN_BM_INT) { *pin_mask |= PIN_BM_IRQ; - switch (cfg & GPIO_HAL_PIN_BM_OUTPUT_BUF) { + /* Interrupt edge config */ + switch (cfg & GPIO_HAL_PIN_BM_INT) { case GPIO_HAL_PIN_CFG_INT_DISABLE: *pin_cfg |= PIN_IRQ_DIS; break; case GPIO_HAL_PIN_CFG_INT_FALLING: *pin_cfg |= PIN_IRQ_NEGEDGE; break; case GPIO_HAL_PIN_CFG_INT_RISING: *pin_cfg |= PIN_IRQ_POSEDGE; break; @@ -115,10 +119,12 @@ to_hal_cfg(PIN_Config pin_cfg, gpio_hal_pin_cfg_t *cfg) { /* Input config */ if (pin_cfg & PIN_BM_INPUT_MODE) { + /* Hysteresis config */ if ((pin_cfg & PIN_BM_HYSTERESIS) == PIN_HYSTERESIS) { *cfg |= GPIO_HAL_PIN_BM_INPUT_HYSTERESIS; } + /* Pulling config */ switch (pin_cfg & PIN_BM_PULLING) { case PIN_NOPULL: *cfg |= GPIO_HAL_PIN_CFG_INPUT_NOPULL; break; case PIN_PULLUP: *cfg |= GPIO_HAL_PIN_CFG_INPUT_PULLUP; break; @@ -128,16 +134,19 @@ to_hal_cfg(PIN_Config pin_cfg, gpio_hal_pin_cfg_t *cfg) /* Output config */ if (pin_cfg & PIN_BM_OUTPUT_MODE) { + /* Output buffer type config */ switch (pin_cfg & PIN_BM_OUTPUT_BUF) { case PIN_PUSHPULL: *cfg |= GPIO_HAL_PIN_CFG_OUTPUT_PUSHPULL; break; case PIN_OPENDRAIN: *cfg |= GPIO_HAL_PIN_CFG_OUTPUT_OPENDRAIN; break; case PIN_OPENSOURCE: *cfg |= GPIO_HAL_PIN_CFG_OUTPUT_OPENSOURCE; break; } + /* Slew control config */ if ((pin_cfg & PIN_BM_SLEWCTRL) == PIN_SLEWCTRL) { *cfg |= GPIO_HAL_PIN_CFG_OUTPUT_SLEWCTRL; } + /* Drive strength config */ switch (pin_cfg & PIN_BM_DRVSTR) { case PIN_DRVSTR_MIN: *cfg |= GPIO_HAL_PIN_CFG_OUTPUT_DRVSTR_MIN; break; case PIN_DRVSTR_MED: *cfg |= GPIO_HAL_PIN_CFG_OUTPUT_DRVSTR_MED; break; @@ -147,6 +156,7 @@ to_hal_cfg(PIN_Config pin_cfg, gpio_hal_pin_cfg_t *cfg) /* Interrupt config */ if (pin_cfg & PIN_BM_IRQ) { + /* Interrupt edge config */ switch (pin_cfg & PIN_BM_IRQ) { case PIN_IRQ_DIS: *cfg |= GPIO_HAL_PIN_CFG_INT_DISABLE; break; case PIN_IRQ_NEGEDGE: *cfg |= GPIO_HAL_PIN_CFG_INT_FALLING; break; @@ -162,6 +172,7 @@ gpio_int_cb(PIN_Handle handle, PIN_Id pin_id) /* Unused args */ (void)handle; + /* Notify the GPIO HAL driver */ gpio_hal_event_handler(gpio_hal_pin_to_mask(pin_id)); } @@ -204,7 +215,7 @@ gpio_hal_arch_pin_cfg_set(gpio_hal_pin_t pin, gpio_hal_pin_cfg_t cfg) { PIN_add(pin_handle, PIN_getConfig(pin)); - /* Clear settings that we are about to change, keep everything else */ + /* Clear settings that we are about to change, keep everything else. */ PIN_Config pin_cfg = 0; PIN_Config pin_mask = 0; diff --git a/arch/cpu/cc13xx-cc26xx/dev/gpio-hal-arch.h b/arch/cpu/cc13xx-cc26xx/dev/gpio-hal-arch.h index d175ec301..3ca169a82 100644 --- a/arch/cpu/cc13xx-cc26xx/dev/gpio-hal-arch.h +++ b/arch/cpu/cc13xx-cc26xx/dev/gpio-hal-arch.h @@ -1,11 +1,10 @@ /* - * Copyright (c) 2017, George Oikonomou - http://www.spd.gr + * Copyright (c) 2018, Texas Instruments Incorporated - http://www.ti.com/ * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: - * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright @@ -28,36 +27,31 @@ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED * OF THE POSSIBILITY OF SUCH DAMAGE. */ -/*---------------------------------------------------------------------------*/ /** - * \addtogroup cc26xx + * \addtogroup cc13xx-cc26xx-cpu * @{ * - * \defgroup cc26xx-gpio-hal CC13xx/CC26xx GPIO HAL implementation + * \defgroup cc13xx-cc26xx-gpio-hal CC13xx/CC26xx GPIO HAL implementation * * @{ * * \file - * Header file for the CC13xx/CC26xx GPIO HAL functions - * + * Header file for the CC13xx/CC26xx GPIO HAL functions. + * \author + * Edvard Pettersen * \note - * Do not include this header directly + * Do not include this header directly. */ /*---------------------------------------------------------------------------*/ #ifndef GPIO_HAL_ARCH_H_ #define GPIO_HAL_ARCH_H_ /*---------------------------------------------------------------------------*/ #include "contiki.h" - +/*---------------------------------------------------------------------------*/ #include -#include DeviceFamily_constructPath(driverlib/ioc.h) #include DeviceFamily_constructPath(driverlib/gpio.h) -#include #include - -#include -#include /*---------------------------------------------------------------------------*/ #define gpio_hal_arch_pin_set_input(p) PINCC26XX_setOutputEnable(p, false) #define gpio_hal_arch_pin_set_output(p) PINCC26XX_setOutputEnable(p, true) diff --git a/arch/cpu/cc13xx-cc26xx/dev/int-master-arch.c b/arch/cpu/cc13xx-cc26xx/dev/int-master-arch.c index c06cc364f..2c72992e6 100644 --- a/arch/cpu/cc13xx-cc26xx/dev/int-master-arch.c +++ b/arch/cpu/cc13xx-cc26xx/dev/int-master-arch.c @@ -1,11 +1,10 @@ /* - * Copyright (c) 2017, George Oikonomou - http://www.spd.gr + * Copyright (c) 2018, Texas Instruments Incorporated - http://www.ti.com/ * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: - * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright @@ -28,23 +27,23 @@ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED * OF THE POSSIBILITY OF SUCH DAMAGE. */ -/*---------------------------------------------------------------------------*/ /** - * \addtogroup cc26xx + * \addtogroup cc13xx-cc26xx-cpu * @{ * - * \defgroup cc26xx-interrupts CC13xx-CC26xx master interrupt manipulation + * \defgroup cc13xx-cc26xx-int-master CC13xx/CC26xx master interrupt manipulation * - * Master interrupt manipulation routines for the CC13xx and CC26xx CPUs + * Master interrupt manipulation routines for CC13xx/CC26xx. * * @{ * * \file - * Master interrupt manipulation implementation for the TI CC13xx/CC26xx + * Master interrupt manipulation implementation for CC13xx/CC26xx. + * \author + * Edvard Pettersen */ /*---------------------------------------------------------------------------*/ #include "contiki.h" - #include "sys/int-master.h" /*---------------------------------------------------------------------------*/ #include @@ -52,6 +51,9 @@ #include /*---------------------------------------------------------------------------*/ +#include +#include +/*---------------------------------------------------------------------------*/ void int_master_enable(void) { @@ -61,13 +63,13 @@ int_master_enable(void) int_master_status_t int_master_read_and_disable(void) { - return HwiP_disable(); + return (int_master_status_t)HwiP_disable(); } /*---------------------------------------------------------------------------*/ void int_master_status_set(int_master_status_t status) { - HwiP_restore(status); + HwiP_restore((uintptr_t)status); } /*---------------------------------------------------------------------------*/ bool diff --git a/arch/cpu/cc13xx-cc26xx/dev/random-arch.c b/arch/cpu/cc13xx-cc26xx/dev/random.c similarity index 67% rename from arch/cpu/cc13xx-cc26xx/dev/random-arch.c rename to arch/cpu/cc13xx-cc26xx/dev/random.c index 87962e501..3232a06d2 100644 --- a/arch/cpu/cc13xx-cc26xx/dev/random-arch.c +++ b/arch/cpu/cc13xx-cc26xx/dev/random.c @@ -28,38 +28,66 @@ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED * OF THE POSSIBILITY OF SUCH DAMAGE. */ -/*---------------------------------------------------------------------------*/ /** - * \addtogroup cc26xx-trng + * \addtogroup cc13xx-cc26xx-prng * @{ * - * \file + * Implementation based on Bob Jenkins' small noncryptographic PRNG. + * http://burtleburtle.net/bob/rand/smallprng.html * - * This file overrides os/lib/random.c and calls SoC-specific RNG functions + * \file + * This file overrides os/lib/random.c. + * \author + * Edvard Pettersen */ /*---------------------------------------------------------------------------*/ #include /*---------------------------------------------------------------------------*/ -#include +#include +/*---------------------------------------------------------------------------*/ +typedef struct { + uint32_t a; + uint32_t b; + uint32_t c; + uint32_t d; +} ranctx_t; + +static ranctx_t ranctx; +/*---------------------------------------------------------------------------*/ +#define rot32(x, k) (((x) << (k)) | ((x) >> (32 - (k)))) /*---------------------------------------------------------------------------*/ /** - * \brief Generates a new random number using the hardware TRNG. - * \return The random number. + * \brief Generates a new random number using the PRNG. + * \return The random number. */ unsigned short random_rand(void) { - return (unsigned short)soc_trng_rand_synchronous() & 0xFFFF; + uint32_t e; + + e = ranctx.a - rot32(ranctx.b, 27); + ranctx.a = ranctx.b ^ rot32(ranctx.c, 17); + ranctx.b = ranctx.c + ranctx.d; + ranctx.c = ranctx.d + e; + ranctx.d = e + ranctx.a; + + return (unsigned short)ranctx.d; } /*---------------------------------------------------------------------------*/ /** - * \brief Function required by the API - * \param seed Ignored. + * \brief Function required by the API + * \param seed Ignored. */ void random_init(unsigned short seed) { - soc_trng_init(); + uint32_t i; + + ranctx.a = 0xf1ea5eed; + ranctx.b = ranctx.c = ranctx.d = (uint32_t)seed; + for(i = 0; i < 20; ++i) { + (void)random_rand(); + } } /*---------------------------------------------------------------------------*/ /** diff --git a/arch/cpu/cc13xx-cc26xx/dev/rtimer-arch.c b/arch/cpu/cc13xx-cc26xx/dev/rtimer-arch.c index 05e8b51f3..345ea80bb 100644 --- a/arch/cpu/cc13xx-cc26xx/dev/rtimer-arch.c +++ b/arch/cpu/cc13xx-cc26xx/dev/rtimer-arch.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Texas Instruments Incorporated - http://www.ti.com/ + * Copyright (c) 2018, Texas Instruments Incorporated - http://www.ti.com/ * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -27,9 +27,8 @@ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED * OF THE POSSIBILITY OF SUCH DAMAGE. */ -/*---------------------------------------------------------------------------*/ /** - * \addtogroup cc26xx-rtimer + * \addtogroup cc13xx-cc26xx-rtimer * @{ * * \file diff --git a/arch/cpu/cc13xx-cc26xx/dev/startup_cc13xx_cc26xx_gcc.c b/arch/cpu/cc13xx-cc26xx/dev/startup_cc13xx_cc26xx_gcc.c index 869414920..1618f6d71 100644 --- a/arch/cpu/cc13xx-cc26xx/dev/startup_cc13xx_cc26xx_gcc.c +++ b/arch/cpu/cc13xx-cc26xx/dev/startup_cc13xx_cc26xx_gcc.c @@ -89,23 +89,23 @@ extern unsigned long _stack_end; __attribute__ ((section(".resetVecs"))) __attribute__ ((used)) static void (* const resetVectors[16])(void) = { - (void (*)(void))((uint32_t)&_stack_end), - // The initial stack pointer - resetISR, // The reset handler - nmiISR, // The NMI handler - faultISR, // The hard fault handler - defaultHandler, // The MPU fault handler - busFaultHandler, // The bus fault handler - defaultHandler, // The usage fault handler - 0, // Reserved - 0, // Reserved - 0, // Reserved - 0, // Reserved - defaultHandler, // SVCall handler - defaultHandler, // Debug monitor handler - 0, // Reserved - defaultHandler, // The PendSV handler - defaultHandler // The SysTick handler + (void (*)(void))((uint32_t)&_stack_end), + // The initial stack pointer + resetISR, // The reset handler + nmiISR, // The NMI handler + faultISR, // The hard fault handler + defaultHandler, // The MPU fault handler + busFaultHandler, // The bus fault handler + defaultHandler, // The usage fault handler + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + defaultHandler, // SVCall handler + defaultHandler, // Debug monitor handler + 0, // Reserved + defaultHandler, // The PendSV handler + defaultHandler // The SysTick handler }; //***************************************************************************** // @@ -113,15 +113,15 @@ static void (* const resetVectors[16])(void) = // be called during startup to initialize global objects. // //***************************************************************************** -extern void (*__init_array_start []) (void); -extern void (*__init_array_end []) (void); +extern void (*__init_array_start[])(void); +extern void (*__init_array_end[])(void); //***************************************************************************** // // The following global variable is required for C++ support. // //***************************************************************************** -void * __dso_handle = (void *) &__dso_handle; +void *__dso_handle = (void *)&__dso_handle; //***************************************************************************** // @@ -130,8 +130,11 @@ void * __dso_handle = (void *) &__dso_handle; // for the "data" segment resides immediately following the "text" segment. // //***************************************************************************** -extern uint32_t __bss_start__, __bss_end__; -extern uint32_t __data_load__, __data_start__, __data_end__; +extern uint32_t __bss_start__; +extern uint32_t __bss_end__; +extern uint32_t __data_load__; +extern uint32_t __data_start__; +extern uint32_t __data_end__; // //***************************************************************************** @@ -144,51 +147,51 @@ extern uint32_t __data_load__, __data_start__, __data_end__; // void localProgramStart(void) { - uint32_t * bs; - uint32_t * be; - uint32_t * dl; - uint32_t * ds; - uint32_t * de; - uint32_t count; - uint32_t i; + uint32_t *bs; + uint32_t *be; + uint32_t *dl; + uint32_t *ds; + uint32_t *de; + uint32_t count; + uint32_t i; #if defined (__ARM_ARCH_7EM__) && defined(__VFP_FP__) && !defined(__SOFTFP__) - volatile uint32_t * pui32Cpacr = (uint32_t *) 0xE000ED88; + volatile uint32_t *pui32Cpacr = (uint32_t *)0xE000ED88; - /* Enable Coprocessor Access Control (CPAC) */ - *pui32Cpacr |= (0xF << 20); + /* Enable Coprocessor Access Control (CPAC) */ + *pui32Cpacr |= (0xF << 20); #endif - IntMasterDisable(); + IntMasterDisable(); - /* Final trim of device */ - SetupTrimDevice(); + /* Final trim of device */ + SetupTrimDevice(); - /* initiailize .bss to zero */ - bs = & __bss_start__; - be = & __bss_end__; - while (bs < be) { - *bs = 0; - bs++; + /* initiailize .bss to zero */ + bs = &__bss_start__; + be = &__bss_end__; + while(bs < be) { + *bs = 0; + bs++; + } + + /* relocate the .data section */ + dl = &__data_load__; + ds = &__data_start__; + de = &__data_end__; + if(dl != ds) { + while(ds < de) { + *ds = *dl; + dl++; + ds++; } + } - /* relocate the .data section */ - dl = & __data_load__; - ds = & __data_start__; - de = & __data_end__; - if (dl != ds) { - while (ds < de) { - *ds = *dl; - dl++; - ds++; - } - } - - /* Run any constructors */ - count = (uint32_t)(__init_array_end - __init_array_start); - for (i = 0; i < count; i++) { - __init_array_start[i](); - } + /* Run any constructors */ + count = (uint32_t)(__init_array_end - __init_array_start); + for(i = 0; i < count; i++) { + __init_array_start[i](); + } /* Call the application's entry point. */ main(); @@ -209,13 +212,14 @@ void localProgramStart(void) //***************************************************************************** void __attribute__((naked)) resetISR(void) { - __asm__ __volatile__ ( - " movw r0, #:lower16:resetVectors\n" - " movt r0, #:upper16:resetVectors\n" - " ldr r0, [r0]\n" - " mov sp, r0\n" - " bl localProgramStart" - ); + __asm__ __volatile__ + ( + "movw r0, #:lower16:resetVectors \n" + "movt r0, #:upper16:resetVectors \n" + "ldr r0, [r0] \n" + "mov sp, r0 \n" + "bl localProgramStart \n" + ); } //***************************************************************************** @@ -228,35 +232,10 @@ void __attribute__((naked)) resetISR(void) static void nmiISR(void) { - /* Enter an infinite loop. */ - while(1) - { - } -} - -volatile int x__; - -void debugHardfault(uint32_t *sp) -{ - volatile uint32_t r0; - volatile uint32_t r1; - volatile uint32_t r2; - volatile uint32_t r3; - volatile uint32_t r12; - volatile uint32_t lr; - volatile uint32_t pc; - volatile uint32_t psr; - - (void)(r0 = sp[0]); - (void)(r1 = sp[1]); - (void)(r2 = sp[2]); - (void)(r3 = sp[3]); - (void)(r12 = sp[4]); - (void)(lr = sp[5]); - (void)(pc = sp[6]); - (void)(psr = sp[7]); - - while(1); + /* Enter an infinite loop. */ + while(1) + { + } } //***************************************************************************** @@ -266,16 +245,40 @@ void debugHardfault(uint32_t *sp) // for examination by a debugger. // //***************************************************************************** +void +debugHardfault(uint32_t *sp) +{ + volatile uint32_t r0; + volatile uint32_t r1; + volatile uint32_t r2; + volatile uint32_t r3; + volatile uint32_t r12; + volatile uint32_t lr; + volatile uint32_t pc; + volatile uint32_t psr; + + (void)(r0 = sp[0]); + (void)(r1 = sp[1]); + (void)(r2 = sp[2]); + (void)(r3 = sp[3]); + (void)(r12 = sp[4]); + (void)(lr = sp[5]); + (void)(pc = sp[6]); + (void)(psr = sp[7]); + + while(1); +} + static void faultISR(void) { - __asm volatile + __asm__ __volatile__ ( - "tst lr, #4 \n" - "ite eq \n" - "mrseq r0, msp \n" - "mrsne r0, psp \n" - "b debugHardfault \n" + "tst lr, #4 \n" + "ite eq \n" + "mrseq r0, msp \n" + "mrsne r0, psp \n" + "b debugHardfault \n" ); } @@ -286,15 +289,16 @@ faultISR(void) // for examination by a debugger. // //***************************************************************************** +volatile int x__; static void busFaultHandler(void) { x__ = 0; - /* Enter an infinite loop. */ - while(1) - { - } + /* Enter an infinite loop. */ + while(1) + { + } } //***************************************************************************** @@ -307,10 +311,10 @@ busFaultHandler(void) static void defaultHandler(void) { - /* Enter an infinite loop. */ - while(1) - { - } + /* Enter an infinite loop. */ + while(1) + { + } } //***************************************************************************** diff --git a/arch/cpu/cc13xx-cc26xx/dev/startup_cc13xx_cc26xx_iar.c b/arch/cpu/cc13xx-cc26xx/dev/startup_cc13xx_cc26xx_iar.c new file mode 100644 index 000000000..9279ea523 --- /dev/null +++ b/arch/cpu/cc13xx-cc26xx/dev/startup_cc13xx_cc26xx_iar.c @@ -0,0 +1,306 @@ +/* + * Copyright (c) 2017, Texas Instruments Incorporated + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of Texas Instruments Incorporated nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +//***************************************************************************** +// +// Check if compiler is IAR +// +//***************************************************************************** +#if !(defined(__IAR_SYSTEMS_ICC__)) +#error "startup_cc13xx_cc26xx_iar.c: Unsupported compiler!" +#endif + + +// We need intrinsic functions for IAR (if used in source code) +#include +#include +#include DeviceFamily_constructPath(inc/hw_types.h) +#include DeviceFamily_constructPath(driverlib/setup.h) +#include DeviceFamily_constructPath(driverlib/interrupt.h) + + +//***************************************************************************** +// +//! Forward declaration of the reset ISR and the default fault handlers. +// +//***************************************************************************** +static void nmiISR( void ); +static void faultISR( void ); +static void intDefaultHandler( void ); +extern int main( void ); + +extern void MPUFaultIntHandler( void ); +extern void BusFaultIntHandler( void ); +extern void UsageFaultIntHandler( void ); +extern void SVCallIntHandler( void ); +extern void DebugMonIntHandler( void ); +extern void PendSVIntHandler( void ); +extern void SysTickIntHandler( void ); +extern void GPIOIntHandler( void ); +extern void I2CIntHandler( void ); +extern void RFCCPE1IntHandler( void ); +extern void AONRTCIntHandler( void ); +extern void UART0IntHandler( void ); +extern void AUXSWEvent0IntHandler( void ); +extern void SSI0IntHandler( void ); +extern void SSI1IntHandler( void ); +extern void RFCCPE0IntHandler( void ); +extern void RFCHardwareIntHandler( void ); +extern void RFCCmdAckIntHandler( void ); +extern void I2SIntHandler( void ); +extern void AUXSWEvent1IntHandler( void ); +extern void WatchdogIntHandler( void ); +extern void Timer0AIntHandler( void ); +extern void Timer0BIntHandler( void ); +extern void Timer1AIntHandler( void ); +extern void Timer1BIntHandler( void ); +extern void Timer2AIntHandler( void ); +extern void Timer2BIntHandler( void ); +extern void Timer3AIntHandler( void ); +extern void Timer3BIntHandler( void ); +extern void CryptoIntHandler( void ); +extern void uDMAIntHandler( void ); +extern void uDMAErrIntHandler( void ); +extern void FlashIntHandler( void ); +extern void SWEvent0IntHandler( void ); +extern void AUXCombEventIntHandler( void ); +extern void AONProgIntHandler( void ); +extern void DynProgIntHandler( void ); +extern void AUXCompAIntHandler( void ); +extern void AUXADCIntHandler( void ); +extern void TRNGIntHandler( void ); + +// Default interrupt handlers +#pragma weak MPUFaultIntHandler = intDefaultHandler +#pragma weak BusFaultIntHandler = intDefaultHandler +#pragma weak UsageFaultIntHandler = intDefaultHandler +#pragma weak SVCallIntHandler = intDefaultHandler +#pragma weak DebugMonIntHandler = intDefaultHandler +#pragma weak PendSVIntHandler = intDefaultHandler +#pragma weak SysTickIntHandler = intDefaultHandler +#pragma weak GPIOIntHandler = intDefaultHandler +#pragma weak I2CIntHandler = intDefaultHandler +#pragma weak RFCCPE1IntHandler = intDefaultHandler +#pragma weak AONRTCIntHandler = intDefaultHandler +#pragma weak UART0IntHandler = intDefaultHandler +#pragma weak AUXSWEvent0IntHandler = intDefaultHandler +#pragma weak SSI0IntHandler = intDefaultHandler +#pragma weak SSI1IntHandler = intDefaultHandler +#pragma weak RFCCPE0IntHandler = intDefaultHandler +#pragma weak RFCHardwareIntHandler = intDefaultHandler +#pragma weak RFCCmdAckIntHandler = intDefaultHandler +#pragma weak I2SIntHandler = intDefaultHandler +#pragma weak AUXSWEvent1IntHandler = intDefaultHandler +#pragma weak WatchdogIntHandler = intDefaultHandler +#pragma weak Timer0AIntHandler = intDefaultHandler +#pragma weak Timer0BIntHandler = intDefaultHandler +#pragma weak Timer1AIntHandler = intDefaultHandler +#pragma weak Timer1BIntHandler = intDefaultHandler +#pragma weak Timer2AIntHandler = intDefaultHandler +#pragma weak Timer2BIntHandler = intDefaultHandler +#pragma weak Timer3AIntHandler = intDefaultHandler +#pragma weak Timer3BIntHandler = intDefaultHandler +#pragma weak CryptoIntHandler = intDefaultHandler +#pragma weak uDMAIntHandler = intDefaultHandler +#pragma weak uDMAErrIntHandler = intDefaultHandler +#pragma weak FlashIntHandler = intDefaultHandler +#pragma weak SWEvent0IntHandler = intDefaultHandler +#pragma weak AUXCombEventIntHandler = intDefaultHandler +#pragma weak AONProgIntHandler = intDefaultHandler +#pragma weak DynProgIntHandler = intDefaultHandler +#pragma weak AUXCompAIntHandler = intDefaultHandler +#pragma weak AUXADCIntHandler = intDefaultHandler +#pragma weak TRNGIntHandler = intDefaultHandler + +//***************************************************************************** +// +//! The entry point for the application startup code. +// +//***************************************************************************** +extern void __iar_program_start(void); + +//***************************************************************************** +// +//! Get stack start (highest address) symbol from linker file. +// +//***************************************************************************** +extern const void* STACK_TOP; + +// It is required to place something in the CSTACK segment to get the stack +// check feature in IAR to work as expected +__root static void* dummy_stack @ ".stack"; + + +//***************************************************************************** +// +//! The vector table. Note that the proper constructs must be placed on this to +//! ensure that it ends up at physical address 0x0000.0000 or at the start of +//! the program if located at a start address other than 0. +// +//***************************************************************************** +__root void (* const __vector_table[])(void) @ ".intvec" = +{ + (void (*)(void))&STACK_TOP, // 0 The initial stack pointer + __iar_program_start, // 1 The reset handler + nmiISR, // 2 The NMI handler + faultISR, // 3 The hard fault handler + MPUFaultIntHandler, // 4 The MPU fault handler + BusFaultIntHandler, // 5 The bus fault handler + UsageFaultIntHandler, // 6 The usage fault handler + 0, // 7 Reserved + 0, // 8 Reserved + 0, // 9 Reserved + 0, // 10 Reserved + SVCallIntHandler, // 11 SVCall handler + DebugMonIntHandler, // 12 Debug monitor handler + 0, // 13 Reserved + PendSVIntHandler, // 14 The PendSV handler + SysTickIntHandler, // 15 The SysTick handler + //--- External interrupts --- + GPIOIntHandler, // 16 AON edge detect + I2CIntHandler, // 17 I2C + RFCCPE1IntHandler, // 18 RF Core Command & Packet Engine 1 + intDefaultHandler, // 19 Reserved + AONRTCIntHandler, // 20 AON RTC + UART0IntHandler, // 21 UART0 Rx and Tx + AUXSWEvent0IntHandler, // 22 AUX software event 0 + SSI0IntHandler, // 23 SSI0 Rx and Tx + SSI1IntHandler, // 24 SSI1 Rx and Tx + RFCCPE0IntHandler, // 25 RF Core Command & Packet Engine 0 + RFCHardwareIntHandler, // 26 RF Core Hardware + RFCCmdAckIntHandler, // 27 RF Core Command Acknowledge + I2SIntHandler, // 28 I2S + AUXSWEvent1IntHandler, // 29 AUX software event 1 + WatchdogIntHandler, // 30 Watchdog timer + Timer0AIntHandler, // 31 Timer 0 subtimer A + Timer0BIntHandler, // 32 Timer 0 subtimer B + Timer1AIntHandler, // 33 Timer 1 subtimer A + Timer1BIntHandler, // 34 Timer 1 subtimer B + Timer2AIntHandler, // 35 Timer 2 subtimer A + Timer2BIntHandler, // 36 Timer 2 subtimer B + Timer3AIntHandler, // 37 Timer 3 subtimer A + Timer3BIntHandler, // 38 Timer 3 subtimer B + CryptoIntHandler, // 39 Crypto Core Result available + uDMAIntHandler, // 40 uDMA Software + uDMAErrIntHandler, // 41 uDMA Error + FlashIntHandler, // 42 Flash controller + SWEvent0IntHandler, // 43 Software Event 0 + AUXCombEventIntHandler, // 44 AUX combined event + AONProgIntHandler, // 45 AON programmable 0 + DynProgIntHandler, // 46 Dynamic Programmable interrupt + // source (Default: PRCM) + AUXCompAIntHandler, // 47 AUX Comparator A + AUXADCIntHandler, // 48 AUX ADC new sample or ADC DMA + // done, ADC underflow, ADC overflow + TRNGIntHandler // 49 TRNG event +}; + + +//***************************************************************************** +// +// This function is called by __iar_program_start() early in the boot sequence. +// Copy the first 16 vectors from the read-only/reset table to the runtime +// RAM table. Fill the remaining vectors with a stub. This vector table will +// be updated at runtime. +// +//***************************************************************************** +int __low_level_init(void) +{ + IntMasterDisable(); + + // + // Final trim of device + // + SetupTrimDevice(); + + /*==================================*/ + /* Choose if segment initialization */ + /* should be done or not. */ + /* Return: 0 to omit seg_init */ + /* 1 to run seg_init */ + /*==================================*/ + return 1; +} + +//***************************************************************************** +// +//! This is the code that gets called when the processor receives a NMI. This +//! simply enters an infinite loop, preserving the system state for examination +//! by a debugger. +// +//***************************************************************************** +static void +nmiISR(void) +{ + // + // Enter an infinite loop. + // + while(1) + { + } +} + +//***************************************************************************** +// +//! This is the code that gets called when the processor receives a fault +//! interrupt. This simply enters an infinite loop, preserving the system state +//! for examination by a debugger. +// +//***************************************************************************** +static void +faultISR(void) +{ + // + // Enter an infinite loop. + // + while(1) + { + } +} + +//***************************************************************************** +// +//! This is the code that gets called when the processor receives an unexpected +//! interrupt. This simply enters an infinite loop, preserving the system state +//! for examination by a debugger. +// +//***************************************************************************** +static void +intDefaultHandler(void) +{ + // + // Go into an infinite loop. + // + while(1) + { + } +} diff --git a/arch/cpu/cc13xx-cc26xx/dev/ti-lib-rom.h b/arch/cpu/cc13xx-cc26xx/dev/ti-lib-rom.h deleted file mode 100644 index cd019ce01..000000000 --- a/arch/cpu/cc13xx-cc26xx/dev/ti-lib-rom.h +++ /dev/null @@ -1,194 +0,0 @@ -/* - * Copyright (c) 2016, Texas Instruments Incorporated - http://www.ti.com/ - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the copyright holder nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup cc26xx-ti-lib - * @{ - * - * \file - * Header file with CC13xxware/CC26xxware ROM API. - */ -/*---------------------------------------------------------------------------*/ -#ifndef TI_LIB_ROM_H_ -#define TI_LIB_ROM_H_ -/*---------------------------------------------------------------------------*/ -/* rom.h */ -#include -#include DeviceFamily_constructPath(driverlib/rom.h) - -/* AON API */ -#define ti_lib_rom_aon_event_mcu_wake_up_set ROM_AONEventMcuWakeUpSet -#define ti_lib_rom_aon_event_mcu_wake_up_get ROM_AONEventMcuWakeUpGet -#define ti_lib_rom_aon_event_aux_wake_up_set ROM_AONEventAuxWakeUpSet -#define ti_lib_rom_aon_event_aux_wake_up_get ROM_AONEventAuxWakeUpGet -#define ti_lib_rom_aon_event_mcu_set ROM_AONEventMcuSet -#define ti_lib_rom_aon_event_mcu_get ROM_AONEventMcuGet - -/* AON_WUC API */ -#define ti_lib_rom_aon_wuc_aux_reset ROM_AONWUCAuxReset -#define ti_lib_rom_aon_wuc_recharge_ctrl_config_set ROM_AONWUCRechargeCtrlConfigSet -#define ti_lib_rom_aon_wuc_osc_config ROM_AONWUCOscConfig - -/* AUX_TDC API */ -#define ti_lib_rom_aux_tdc_config_set ROM_AUXTDCConfigSet -#define ti_lib_rom_aux_tdc_measurement_done ROM_AUXTDCMeasurementDone - -/* AUX_WUC API */ -#define ti_lib_rom_aux_wuc_clock_enable ROM_AUXWUCClockEnable -#define ti_lib_rom_aux_wuc_clock_disable ROM_AUXWUCClockDisable -#define ti_lib_rom_aux_wuc_clock_status ROM_AUXWUCClockStatus -#define ti_lib_rom_aux_wuc_power_ctrl ROM_AUXWUCPowerCtrl - -/* FLASH API */ -#define ti_lib_rom_flash_power_mode_get ROM_FlashPowerModeGet -#define ti_lib_rom_flash_protection_set ROM_FlashProtectionSet -#define ti_lib_rom_flash_protection_get ROM_FlashProtectionGet -#define ti_lib_rom_flash_protection_save ROM_FlashProtectionSave -#define ti_lib_rom_flash_efuse_read_row ROM_FlashEfuseReadRow -#define ti_lib_rom_flash_disable_sectors_for_write ROM_FlashDisableSectorsForWrite - -/* I2C API */ -#define ti_lib_rom_i2c_master_init_exp_clk ROM_I2CMasterInitExpClk -#define ti_lib_rom_i2c_master_err ROM_I2CMasterErr - -/* INTERRUPT API */ -#define ti_lib_rom_int_priority_grouping_set ROM_IntPriorityGroupingSet -#define ti_lib_rom_int_priority_grouping_get ROM_IntPriorityGroupingGet -#define ti_lib_rom_int_priority_set ROM_IntPrioritySet -#define ti_lib_rom_int_priority_get ROM_IntPriorityGet -#define ti_lib_rom_int_enable ROM_IntEnable -#define ti_lib_rom_int_disable ROM_IntDisable -#define ti_lib_rom_int_pend_set ROM_IntPendSet -#define ti_lib_rom_int_pend_get ROM_IntPendGet -#define ti_lib_rom_int_pend_clear ROM_IntPendClear - -/* IOC API */ -#define ti_lib_rom_ioc_port_configure_set ROM_IOCPortConfigureSet -#define ti_lib_rom_ioc_port_configure_get ROM_IOCPortConfigureGet -#define ti_lib_rom_ioc_io_shutdown_set ROM_IOCIOShutdownSet -#define ti_lib_rom_ioc_io_mode_set ROM_IOCIOModeSet -#define ti_lib_rom_ioc_io_int_set ROM_IOCIOIntSet -#define ti_lib_rom_ioc_io_port_pull_set ROM_IOCIOPortPullSet -#define ti_lib_rom_ioc_io_hyst_set ROM_IOCIOHystSet -#define ti_lib_rom_ioc_io_input_set ROM_IOCIOInputSet -#define ti_lib_rom_ioc_io_slew_ctrl_set ROM_IOCIOSlewCtrlSet -#define ti_lib_rom_ioc_io_drv_strength_set ROM_IOCIODrvStrengthSet -#define ti_lib_rom_ioc_io_port_id_set ROM_IOCIOPortIdSet -#define ti_lib_rom_ioc_int_enable ROM_IOCIntEnable -#define ti_lib_rom_ioc_int_disable ROM_IOCIntDisable -#define ti_lib_rom_ioc_pin_type_gpio_input ROM_IOCPinTypeGpioInput -#define ti_lib_rom_ioc_pin_type_gpio_output ROM_IOCPinTypeGpioOutput -#define ti_lib_rom_ioc_pin_type_uart ROM_IOCPinTypeUart -#define ti_lib_rom_ioc_pin_type_ssi_master ROM_IOCPinTypeSsiMaster -#define ti_lib_rom_ioc_pin_type_ssi_slave ROM_IOCPinTypeSsiSlave -#define ti_lib_rom_ioc_pin_type_i2c ROM_IOCPinTypeI2c -#define ti_lib_rom_ioc_pin_type_aux ROM_IOCPinTypeAux - -/* PRCM API */ -#define ti_lib_rom_prcm_inf_clock_configure_set ROM_PRCMInfClockConfigureSet -#define ti_lib_rom_prcm_inf_clock_configure_get ROM_PRCMInfClockConfigureGet -#define ti_lib_rom_prcm_audio_clock_config_set ROM_PRCMAudioClockConfigSet -#define ti_lib_rom_prcm_power_domain_on ROM_PRCMPowerDomainOn -#define ti_lib_rom_prcm_power_domain_off ROM_PRCMPowerDomainOff -#define ti_lib_rom_prcm_peripheral_run_enable ROM_PRCMPeripheralRunEnable -#define ti_lib_rom_prcm_peripheral_run_disable ROM_PRCMPeripheralRunDisable -#define ti_lib_rom_prcm_peripheral_sleep_enable ROM_PRCMPeripheralSleepEnable -#define ti_lib_rom_prcm_peripheral_sleep_disable ROM_PRCMPeripheralSleepDisable -#define ti_lib_rom_prcm_peripheral_deep_sleep_enable ROM_PRCMPeripheralDeepSleepEnable -#define ti_lib_rom_prcm_peripheral_deep_sleep_disable ROM_PRCMPeripheralDeepSleepDisable -#define ti_lib_rom_prcm_power_domain_status ROM_PRCMPowerDomainStatus -#define ti_lib_rom_prcm_deep_sleep ROM_PRCMDeepSleep - -/* SMPH API */ -#define ti_lib_rom_smph_acquire ROM_SMPHAcquire - -/* SSI API */ -#define ti_lib_rom_ssi_config_set_exp_clk ROM_SSIConfigSetExpClk -#define ti_lib_rom_ssi_data_put ROM_SSIDataPut -#define ti_lib_rom_ssi_data_put_non_blocking ROM_SSIDataPutNonBlocking -#define ti_lib_rom_ssi_data_get ROM_SSIDataGet -#define ti_lib_rom_ssi_data_get_non_blocking ROM_SSIDataGetNonBlocking - -/* TIMER API */ -#define ti_lib_rom_timer_configure ROM_TimerConfigure -#define ti_lib_rom_timer_level_control ROM_TimerLevelControl -#define ti_lib_rom_timer_stall_control ROM_TimerStallControl -#define ti_lib_rom_timer_wait_on_trigger_control ROM_TimerWaitOnTriggerControl - -/* TRNG API */ -#define ti_lib_rom_trng_number_get ROM_TRNGNumberGet - -/* UART API */ -#define ti_lib_rom_uart_fifo_level_get ROM_UARTFIFOLevelGet -#define ti_lib_rom_uart_config_set_exp_clk ROM_UARTConfigSetExpClk -#define ti_lib_rom_uart_config_get_exp_clk ROM_UARTConfigGetExpClk -#define ti_lib_rom_uart_disable ROM_UARTDisable -#define ti_lib_rom_uart_char_get_non_blocking ROM_UARTCharGetNonBlocking -#define ti_lib_rom_uart_char_get ROM_UARTCharGet -#define ti_lib_rom_uart_char_put_non_blocking ROM_UARTCharPutNonBlocking -#define ti_lib_rom_uart_char_put ROM_UARTCharPut - -/* UDMA API */ -#define ti_lib_rom_udma_channel_attribute_enable ROM_uDMAChannelAttributeEnable -#define ti_lib_rom_udma_channel_attribute_disable ROM_uDMAChannelAttributeDisable -#define ti_lib_rom_udma_channel_attribute_get ROM_uDMAChannelAttributeGet -#define ti_lib_rom_udma_channel_control_set ROM_uDMAChannelControlSet -#define ti_lib_rom_udma_channel_transfer_set ROM_uDMAChannelTransferSet -#define ti_lib_rom_udma_channel_scatter_gather_set ROM_uDMAChannelScatterGatherSet -#define ti_lib_rom_udma_channel_size_get ROM_uDMAChannelSizeGet -#define ti_lib_rom_udma_channel_mode_get ROM_uDMAChannelModeGet - -/* VIMS API */ -#define ti_lib_rom_vims_configure ROM_VIMSConfigure -#define ti_lib_rom_vims_mode_set ROM_VIMSModeSet - -/* HAPI */ -#define ti_lib_hapi_crc32(a, b, c) HapiCrc32(a, b, c) -#define ti_lib_hapi_get_flash_size() HapiGetFlashSize() -#define ti_lib_hapi_get_chip_id() HapiGetChipId() -#define ti_lib_hapi_sector_erase(a) HapiSectorErase(a) -#define ti_lib_hapi_program_flash(a, b, c) HapiProgramFlash(a, b, c) -#define ti_lib_hapi_reset_device() HapiResetDevice() -#define ti_lib_hapi_fletcher32(a, b, c) HapiFletcher32(a, b, c) -#define ti_lib_hapi_min_value(a, b) HapiMinValue(a,b) -#define ti_lib_hapi_max_value(a, b) HapiMaxValue(a,b) -#define ti_lib_hapi_mean_value(a, b) HapiMeanValue(a,b) -#define ti_lib_hapi_stand_deviation_value(a, b) HapiStandDeviationValue(a,b) -#define ti_lib_hapi_hf_source_safe_switch() HapiHFSourceSafeSwitch() -#define ti_lib_hapi_select_comp_a_input(a) HapiSelectCompAInput(a) -#define ti_lib_hapi_select_comp_a_ref(a) HapiSelectCompARef(a) -#define ti_lib_hapi_select_adc_comp_b_input(a) HapiSelectADCCompBInput(a) -#define ti_lib_hapi_select_comp_b_ref(a) HapiSelectCompBRef(a) -/*---------------------------------------------------------------------------*/ -#endif /* TI_LIB_ROM_H_ */ -/*---------------------------------------------------------------------------*/ -/** - * @} - */ diff --git a/arch/cpu/cc13xx-cc26xx/dev/ti-lib.h b/arch/cpu/cc13xx-cc26xx/dev/ti-lib.h deleted file mode 100644 index 022a6543f..000000000 --- a/arch/cpu/cc13xx-cc26xx/dev/ti-lib.h +++ /dev/null @@ -1,578 +0,0 @@ -/* - * Copyright (c) 2014, Texas Instruments Incorporated - http://www.ti.com/ - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the copyright holder nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/** - * \addtogroup cc26xx - * @{ - * - * \defgroup cc26xx-ti-lib TI CC26xxware/CC13xxware Glue - * - * Glue file which renames TI CC26xxware functions. Thus, for example, - * PowerCtrlIOFreezeDisable() becomes power_ctrl_io_freeze_disable() - * - * This is not strictly required and a call to the former will work perfectly - * correctly. However, in using those macros, we make the core of the Contiki - * port match the naming convention. - * - * Since all functions are prefixed with ti_lib, it also becomes clear to the - * reader that this is a call to TI driverlib's sources and not a call to a - * function inside Contiki - * - * @{ - * - * \file - * Header file with macros which rename TI CC26xxware functions. - */ -#ifndef TI_LIB_H_ -#define TI_LIB_H -/*---------------------------------------------------------------------------*/ -/* For DeviceFamily_constructPath() */ -#include -/*---------------------------------------------------------------------------*/ -/* Include ROM API */ -#include "ti-lib-rom.h" -/*---------------------------------------------------------------------------*/ -/* aon_batmon.h */ -#include DeviceFamily_constructPath(driverlib/aon_batmon.h) - -#define ti_lib_aon_batmon_enable(...) AONBatMonEnable(__VA_ARGS__) -#define ti_lib_aon_batmon_disable(...) AONBatMonDisable(__VA_ARGS__) -#define ti_lib_aon_batmon_temperature_get_deg_c(...) AONBatMonTemperatureGetDegC(__VA_ARGS__) -#define ti_lib_aon_batmon_battery_voltage_get(...) AONBatMonBatteryVoltageGet(__VA_ARGS__) -#define ti_lib_aon_batmon_new_battery_measure_ready(...) AONBatMonNewBatteryMeasureReady(__VA_ARGS__) -#define ti_lib_aon_batmon_new_temp_measure_ready(...) AONBatMonNewTempMeasureReady(__VA_ARGS__) -/*---------------------------------------------------------------------------*/ -/* aon_event.h */ -#include DeviceFamily_constructPath(driverlib/aon_event.h) - -#define ti_lib_aon_event_mcu_wake_up_set(...) AONEventMcuWakeUpSet(__VA_ARGS__) -#define ti_lib_aon_event_mcu_wake_up_get(...) AONEventMcuWakeUpGet(__VA_ARGS__) -#define ti_lib_aon_event_aux_wake_up_set(...) AONEventAuxWakeUpSet(__VA_ARGS__) -#define ti_lib_aon_event_aux_wake_up_get(...) AONEventAuxWakeUpGet(__VA_ARGS__) -#define ti_lib_aon_event_mcu_set(...) AONEventMcuSet(__VA_ARGS__) -#define ti_lib_aon_event_mcu_get(...) AONEventMcuGet(__VA_ARGS__) -#define ti_lib_aon_event_rtc_set(...) AONEventRtcSet(__VA_ARGS__) -#define ti_lib_aon_event_rtc_get(...) AONEventRtcGet(__VA_ARGS__) -/*---------------------------------------------------------------------------*/ -/* aon_ioc.h */ -#include DeviceFamily_constructPath(driverlib/aon_ioc.h) - -#define ti_lib_aon_ioc_drive_strength_set(...) AONIOCDriveStrengthSet(__VA_ARGS__) -#define ti_lib_aon_ioc_drive_strength_get(...) AONIOCDriveStrengthGet(__VA_ARGS__) -#define ti_lib_aon_ioc_freeze_enable(...) AONIOCFreezeEnable(__VA_ARGS__) -#define ti_lib_aon_ioc_freeze_disable(...) AONIOCFreezeDisable(__VA_ARGS__) -#define ti_lib_aon_ioc_32_khz_output_disable(...) AONIOC32kHzOutputDisable(__VA_ARGS__) -#define ti_lib_aon_ioc_32_khz_output_enable(...) AONIOC32kHzOutputEnable(__VA_ARGS__) -/*---------------------------------------------------------------------------*/ -/* aon_rtc.h */ -#include DeviceFamily_constructPath(driverlib/aon_rtc.h) - -#define ti_lib_aon_rtc_enable(...) AONRTCEnable(__VA_ARGS__) -#define ti_lib_aon_rtc_disable(...) AONRTCDisable(__VA_ARGS__) -#define ti_lib_aon_rtc_active(...) AONRTCActive(__VA_ARGS__) -#define ti_lib_aon_rtc_channel_active(...) AONRTCChannelActive(__VA_ARGS__) -#define ti_lib_aon_rtc_reset(...) AONRTCReset(__VA_ARGS__) -#define ti_lib_aon_rtc_delay_config(...) AONRTCDelayConfig(__VA_ARGS__) -#define ti_lib_aon_rtc_combined_event_config(...) AONRTCCombinedEventConfig(__VA_ARGS__) -#define ti_lib_aon_rtc_event_clear(...) AONRTCEventClear(__VA_ARGS__) -#define ti_lib_aon_rtc_event_get(...) AONRTCEventGet(__VA_ARGS__) -#define ti_lib_aon_rtc_sec_get(...) AONRTCSecGet(__VA_ARGS__) -#define ti_lib_aon_rtc_fraction_get(...) AONRTCFractionGet(__VA_ARGS__) -#define ti_lib_aon_rtc_sub_sec_incr_get(...) AONRTCSubSecIncrGet(__VA_ARGS__) -#define ti_lib_aon_rtc_mode_ch1_set(...) AONRTCModeCh1Set(__VA_ARGS__) -#define ti_lib_aon_rtc_mode_ch1_get(...) AONRTCModeCh1Get(__VA_ARGS__) -#define ti_lib_aon_rtc_mode_ch2_set(...) AONRTCModeCh2Set(__VA_ARGS__) -#define ti_lib_aon_rtc_mode_ch2_get(...) AONRTCModeCh2Get(__VA_ARGS__) -#define ti_lib_aon_rtc_channel_enable(...) AONRTCChannelEnable(__VA_ARGS__) -#define ti_lib_aon_rtc_channel_disable(...) AONRTCChannelDisable(__VA_ARGS__) -#define ti_lib_aon_rtc_compare_value_set(...) AONRTCCompareValueSet(__VA_ARGS__) -#define ti_lib_aon_rtc_compare_value_get(...) AONRTCCompareValueGet(__VA_ARGS__) -#define ti_lib_aon_rtc_current_compare_value_get(...) AONRTCCurrentCompareValueGet(__VA_ARGS__) -#define ti_lib_aon_rtc_current_64_bit_value_get(...) AONRTCCurrent64BitValueGet(__VA_ARGS__) -#define ti_lib_aon_rtc_inc_value_ch2_set(...) AONRTCIncValueCh2Set(__VA_ARGS__) -#define ti_lib_aon_rtc_inc_value_ch2_get(...) AONRTCIncValueCh2Get(__VA_ARGS__) -#define ti_lib_aon_rtc_capture_value_ch1_get(...) AONRTCCaptureValueCh1Get(__VA_ARGS__) -/*---------------------------------------------------------------------------*/ -#if DeviceFamily_PARENT == DeviceFamily_PARENT_CC13X0_CC26X0 -/* aon_wuc.h */ -#include DeviceFamily_constructPath(driverlib/aon_wuc.h) - -#define ti_lib_aon_wuc_mcu_wake_up_config(...) AONWUCMcuWakeUpConfig(__VA_ARGS__) -#define ti_lib_aon_wuc_mcu_power_down_config(...) AONWUCMcuPowerDownConfig(__VA_ARGS__) -#define ti_lib_aon_wuc_mcu_power_off_config(...) AONWUCMcuPowerOffConfig(__VA_ARGS__) -#define ti_lib_aon_wuc_mcu_sram_config(...) AONWUCMcuSRamConfig(__VA_ARGS__) -#define ti_lib_aon_wuc_aux_clock_config_get(...) AONWUCAuxClockConfigGet(__VA_ARGS__) -#define ti_lib_aon_wuc_aux_power_down_config(...) AONWUCAuxPowerDownConfig(__VA_ARGS__) -#define ti_lib_aon_wuc_aux_wake_up_config(...) AONWUCAuxWakeUpConfig(__VA_ARGS__) -#define ti_lib_aon_wuc_aux_sram_config(...) AONWUCAuxSRamConfig(__VA_ARGS__) -#define ti_lib_aon_wuc_aux_wakeup_event(...) AONWUCAuxWakeupEvent(__VA_ARGS__) -#define ti_lib_aon_wuc_aux_image_valid(...) AONWUCAuxImageValid(__VA_ARGS__) -#define ti_lib_aon_wuc_aux_image_invalid(...) AONWUCAuxImageInvalid(__VA_ARGS__) -#define ti_lib_aon_wuc_aux_reset(...) AONWUCAuxReset(__VA_ARGS__) -#define ti_lib_aon_wuc_power_status_get(...) AONWUCPowerStatusGet(__VA_ARGS__) -#define ti_lib_aon_wuc_shut_down_enable(...) AONWUCShutDownEnable(__VA_ARGS__) -#define ti_lib_aon_wuc_domain_power_down_enable(...) AONWUCDomainPowerDownEnable(__VA_ARGS__) -#define ti_lib_aon_wuc_domain_power_down_disable(...) AONWUCDomainPowerDownDisable(__VA_ARGS__) -#define ti_lib_aon_wuc_mcu_reset_status_get(...) AONWUCMcuResetStatusGet(__VA_ARGS__) -#define ti_lib_aon_wuc_mcu_reset_clear(...) AONWUCMcuResetClear(__VA_ARGS__) -#define ti_lib_aon_wuc_recharge_ctrl_config_set(...) AONWUCRechargeCtrlConfigSet(__VA_ARGS__) -#define ti_lib_aon_wuc_recharge_ctrl_config_get(...) AONWUCRechargeCtrlConfigGet(__VA_ARGS__) -#define ti_lib_aon_wuc_osc_config(...) AONWUCOscConfig(__VA_ARGS__) -#define ti_lib_aon_wuc_jtag_power_off(...) AONWUCJtagPowerOff(__VA_ARGS__) - -#endif /* DeviceFamily_PARENT == DeviceFamily_PARENT_CC13X0_CC26X0 */ -/*---------------------------------------------------------------------------*/ -/* aux_adc.h */ -#include DeviceFamily_constructPath(driverlib/aux_adc.h) - -#define ti_lib_aux_adc_disable(...) AUXADCDisable(__VA_ARGS__) -#define ti_lib_aux_adc_enable_async(...) AUXADCEnableAsync(__VA_ARGS__) -#define ti_lib_aux_adc_enable_sync(...) AUXADCEnableSync(__VA_ARGS__) -#define ti_lib_aux_adc_disable_input_scaling(...) AUXADCDisableInputScaling(__VA_ARGS__) -#define ti_lib_aux_adc_flush_fifo(...) AUXADCFlushFifo(__VA_ARGS__) -#define ti_lib_aux_adc_gen_manual_trigger(...) AUXADCGenManualTrigger(__VA_ARGS__) -#define ti_lib_aux_adc_get_fifo_status(...) AUXADCGetFifoStatus(__VA_ARGS__) -#define ti_lib_aux_adc_read_fifo(...) AUXADCReadFifo(__VA_ARGS__) -#define ti_lib_aux_adc_pop_fifo(...) AUXADCPopFifo(__VA_ARGS__) -#define ti_lib_aux_adc_select_input(...) AUXADCSelectInput(__VA_ARGS__) -#define ti_lib_aux_adc_get_adjustment_gain(...) AUXADCGetAdjustmentGain(__VA_ARGS__) -#define ti_lib_aux_adc_get_adjustment_offset(...) AUXADCGetAdjustmentOffset(__VA_ARGS__) -#define ti_lib_aux_adc_value_to_microvolts(...) AUXADCValueToMicrovolts(__VA_ARGS__) -#define ti_lib_aux_adc_microvolts_to_value(...) AUXADCMicrovoltsToValue(__VA_ARGS__) -#define ti_lib_aux_adc_adjust_value_for_gain_and_offset(...) AUXADCAdjustValueForGainAndOffset(__VA_ARGS__) -#define ti_lib_aux_adc_unadjust_value_for_gain_and_offset(...) AUXADCUnadjustValueForGainAndOffset(__VA_ARGS__) -/*---------------------------------------------------------------------------*/ -#if DeviceFamily_PARENT == DeviceFamily_PARENT_CC13X0_CC26X0 -/* aux_wuc.h */ -#include DeviceFamily_constructPath(driverlib/aux_wuc.h) - -#define ti_lib_aux_wuc_clock_enable(...) AUXWUCClockEnable(__VA_ARGS__) -#define ti_lib_aux_wuc_clock_disable(...) AUXWUCClockDisable(__VA_ARGS__) -#define ti_lib_aux_wuc_clock_status(...) AUXWUCClockStatus(__VA_ARGS__) -#define ti_lib_aux_wuc_clock_freq_req(...) AUXWUCClockFreqReq(__VA_ARGS__) -#define ti_lib_aux_wuc_power_ctrl(...) AUXWUCPowerCtrl(__VA_ARGS__) -#define ti_lib_aux_wuc_freeze_enable(...) AUXWUCFreezeEnable(__VA_ARGS__) -#define ti_lib_aux_wuc_freeze_disable(...) AUXWUCFreezeDisable(__VA_ARGS__) - -#endif /* DeviceFamily_PARENT == DeviceFamily_PARENT_CC13X0_CC26X0 */ -/*---------------------------------------------------------------------------*/ -/* cpu.h */ -#include DeviceFamily_constructPath(driverlib/cpu.h) - -#define ti_lib_cpu_cpsid(...) CPUcpsid(__VA_ARGS__) -#define ti_lib_cpu_cpsie(...) CPUcpsie(__VA_ARGS__) -#define ti_lib_cpu_primask(...) CPUprimask(__VA_ARGS__) -#define ti_lib_cpu_wfi(...) CPUwfi(__VA_ARGS__) -#define ti_lib_cpu_wfe(...) CPUwfe(__VA_ARGS__) -#define ti_lib_cpu_sev(...) CPUsev(__VA_ARGS__) -#define ti_lib_cpu_base_pri_get(...) CPUbasepriGet(__VA_ARGS__) -#define ti_lib_cpu_base_pri_set(...) CPUbasepriSet(__VA_ARGS__) -#define ti_lib_cpu_delay(...) CPUdelay(__VA_ARGS__) -/*---------------------------------------------------------------------------*/ -/* chipinfo.h */ -#include DeviceFamily_constructPath(driverlib/chipinfo.h) - -#define ti_lib_chipinfo_get_supported_protocol_bv(...) ChipInfo_GetSupportedProtocol_BV(__VA_ARGS__) -#define ti_lib_chipinfo_supports_ble(...) ChipInfo_SupportsBLE(__VA_ARGS__) -#define ti_lib_chipinfo_supports_ieee_802_15_4(...) ChipInfo_SupportsIEEE_802_15_4(__VA_ARGS__) -#define ti_lib_chipinfo_supports_proprietary(...) ChipInfo_SupportsPROPRIETARY(__VA_ARGS__) -#define ti_lib_chipinfo_get_package_type(...) ChipInfo_GetPackageType(__VA_ARGS__) -#define ti_lib_chipinfo_package_type_is_4x4(...) ChipInfo_PackageTypeIs4x4(__VA_ARGS__) -#define ti_lib_chipinfo_package_type_is_5x5(...) ChipInfo_PackageTypeIs5x5(__VA_ARGS__) -#define ti_lib_chipinfo_package_type_is_7x7(...) ChipInfo_PackageTypeIs7x7(__VA_ARGS__) -#define ti_lib_chipinfo_get_device_id_hw_rev_code(...) ChipInfo_GetDeviceIdHwRevCode(__VA_ARGS__) -#define ti_lib_chipinfo_get_chip_type(...) ChipInfo_GetChipType(__VA_ARGS__) -#define ti_lib_chipinfo_get_chip_family(...) ChipInfo_GetChipFamily(__VA_ARGS__) -#define ti_lib_chipinfo_chip_family_is_cc13x0(...) ChipInfo_ChipFamilyIs_CC13x0(__VA_ARGS__) -#define ti_lib_chipinfo_chip_family_is_cc26x0(...) ChipInfo_ChipFamilyIs_CC26x0(__VA_ARGS__) -#define ti_lib_chipinfo_chip_family_is_cc26x0r2(...) ChipInfo_ChipFamilyIs_CC26x0R2(__VA_ARGS__) -#define ti_lib_chipinfo_chip_family_is_cc26x1(...) ChipInfo_ChipFamilyIs_CC26x1(__VA_ARGS__) -#define ti_lib_chipinfo_chip_family_is_cc13x2_cc26x2(...) ChipInfo_ChipFamilyIs_CC13x2_CC26x2(__VA_ARGS__) -#define ti_lib_chipinfo_get_hw_revision(...) ChipInfo_GetHwRevision(__VA_ARGS__) -#define ti_lib_chipinfo_hw_revision_is_1_0(...) ChipInfo_HwRevisionIs_1_0(__VA_ARGS__) -#define ti_lib_chipinfo_hw_revision_is_gteq_2_0(...) ChipInfo_HwRevisionIs_GTEQ_2_0(__VA_ARGS__) -#define ti_lib_chipinfo_hw_revision_is_2_0(...) ChipInfo_HwRevisionIs_2_0(__VA_ARGS__) -#define ti_lib_chipinfo_hw_revision_is_2_1(...) ChipInfo_HwRevisionIs_2_1(__VA_ARGS__) -#define ti_lib_chipinfo_hw_revision_is_2_2(...) ChipInfo_HwRevisionIs_2_2(__VA_ARGS__) -#define ti_lib_chipinfo_hw_revision_is_gteq_2_2(...) ChipInfo_HwRevisionIs_GTEQ_2_2( __VA_ARGS__ ) -/*---------------------------------------------------------------------------*/ -/* ddi.h */ -#include DeviceFamily_constructPath(driverlib/ddi.h) - -#define ti_lib_aux_adi_ddi_safe_write(...) AuxAdiDdiSafeWrite(__VA_ARGS__) -#define ti_lib_aux_adi_ddi_safe_read(...) AuxAdiDdiSafeRead(__VA_ARGS__) -#define ti_lib_ddi_32_reg_write(...) DDI32RegWrite(__VA_ARGS__) -#define ti_lib_ddi_32_reg_read(...) DDI32RegRead(__VA_ARGS__) -#define ti_lib_ddi_32_bits_set(...) DDI32BitsSet(__VA_ARGS__) -#define ti_lib_ddi_32_bits_clear(...) DDI32BitsClear(__VA_ARGS__) -#define ti_lib_ddi_8_set_val_bit(...) DDI8SetValBit(__VA_ARGS__) -#define ti_lib_ddi_16_set_val_bit(...) DDI16SetValBit(__VA_ARGS__) -#define ti_lib_ddi_16_bit_write(...) DDI16BitWrite(__VA_ARGS__) -#define ti_lib_ddi_16_bit_field_write(...) DDI16BitfieldWrite(__VA_ARGS__) -#define ti_lib_ddi_16_bit_read(...) DDI16BitRead(__VA_ARGS__) -#define ti_lib_ddi_16_bitfield_read(...) DDI16BitfieldRead(__VA_ARGS__) -/*---------------------------------------------------------------------------*/ -/* gpio.h */ -#include DeviceFamily_constructPath(driverlib/gpio.h) - -#define ti_lib_gpio_read_dio(...) GPIO_readDio(__VA_ARGS__) -#define ti_lib_gpio_read_multi_dio(...) GPIO_readMultiDio(__VA_ARGS__) -#define ti_lib_gpio_write_dio(...) GPIO_writeDio(__VA_ARGS__) -#define ti_lib_gpio_write_multi_dio(...) GPIO_writeMultiDio(__VA_ARGS__) -#define ti_lib_gpio_set_dio(...) GPIO_setDio(__VA_ARGS__) -#define ti_lib_gpio_set_multi_dio(...) GPIO_setMultiDio(__VA_ARGS__) -#define ti_lib_gpio_clear_dio(...) GPIO_clearDio(__VA_ARGS__) -#define ti_lib_gpio_clear_multi_dio(...) GPIO_clearMultiDio(__VA_ARGS__) -#define ti_lib_gpio_toggle_dio(...) GPIO_toggleDio(__VA_ARGS__) -#define ti_lib_gpio_toggle_multi_dio(...) GPIO_toggleMultiDio(__VA_ARGS__) -#define ti_lib_gpio_get_output_enable_dio(...) GPIO_getOutputEnableDio(__VA_ARGS__) -#define ti_lib_gpio_get_output_enable_multi_dio(...) GPIO_getOutputEnableMultiDio(__VA_ARGS__) -#define ti_lib_gpio_set_output_enable_dio(...) GPIO_setOutputEnableDio(__VA_ARGS__) -#define ti_lib_gpio_set_output_enable_multi_dio(...) GPIO_setOutputEnableMultiDio(__VA_ARGS__) -#define ti_lib_gpio_get_event_dio(...) GPIO_getEventDio(__VA_ARGS__) -#define ti_lib_gpio_get_event_multi_dio(...) GPIO_getEventMultiDio(__VA_ARGS__) -#define ti_lib_gpio_clear_event_dio(...) GPIO_clearEventDio(__VA_ARGS__) -#define ti_lib_gpio_clear_event_multi_dio(...) GPIO_clearEventMultiDio(__VA_ARGS__) -/*---------------------------------------------------------------------------*/ -/* i2c.h */ -#include DeviceFamily_constructPath(driverlib/i2c.h) - -#define ti_lib_i2c_int_register(...) I2CIntRegister(__VA_ARGS__) -#define ti_lib_i2c_int_unregister(...) I2CIntUnregister(__VA_ARGS__) -#define ti_lib_i2c_master_bus_busy(...) I2CMasterBusBusy(__VA_ARGS__) -#define ti_lib_i2c_master_busy(...) I2CMasterBusy(__VA_ARGS__) -#define ti_lib_i2c_master_control(...) I2CMasterControl(__VA_ARGS__) -#define ti_lib_i2c_master_data_get(...) I2CMasterDataGet(__VA_ARGS__) -#define ti_lib_i2c_master_data_put(...) I2CMasterDataPut(__VA_ARGS__) -#define ti_lib_i2c_master_disable(...) I2CMasterDisable(__VA_ARGS__) -#define ti_lib_i2c_master_enable(...) I2CMasterEnable(__VA_ARGS__) -#define ti_lib_i2c_master_err(...) I2CMasterErr(__VA_ARGS__) -#define ti_lib_i2c_master_init_exp_clk(...) I2CMasterInitExpClk(__VA_ARGS__) -#define ti_lib_i2c_master_int_clear(...) I2CMasterIntClear(__VA_ARGS__) -#define ti_lib_i2c_master_int_disable(...) I2CMasterIntDisable(__VA_ARGS__) -#define ti_lib_i2c_master_int_enable(...) I2CMasterIntEnable(__VA_ARGS__) -#define ti_lib_i2c_master_int_status(...) I2CMasterIntStatus(__VA_ARGS__) -#define ti_lib_i2c_master_slave_addr_set(...) I2CMasterSlaveAddrSet(__VA_ARGS__) -#define ti_lib_i2c_slave_data_get(...) I2CSlaveDataGet(__VA_ARGS__) -#define ti_lib_i2c_slave_data_put(...) I2CSlaveDataPut(__VA_ARGS__) -#define ti_lib_i2c_slave_disable(...) I2CSlaveDisable(__VA_ARGS__) -#define ti_lib_i2c_slave_enable(...) I2CSlaveEnable(__VA_ARGS__) -#define ti_lib_i2c_slave_init(...) I2CSlaveInit(__VA_ARGS__) -#define ti_lib_i2c_slave_address_set(...) I2CSlaveAddressSet(__VA_ARGS__) -#define ti_lib_i2c_slave_int_clear(...) I2CSlaveIntClear(__VA_ARGS__) -#define ti_lib_i2c_slave_int_disable(...) I2CSlaveIntDisable(__VA_ARGS__) -#define ti_lib_i2c_slave_int_enable(...) I2CSlaveIntEnable(__VA_ARGS__) -#define ti_lib_i2c_slave_int_status(...) I2CSlaveIntStatus(__VA_ARGS__) -#define ti_lib_i2c_slave_status(...) I2CSlaveStatus(__VA_ARGS__) -/*---------------------------------------------------------------------------*/ -/* interrupt.h */ -#include DeviceFamily_constructPath(driverlib/interrupt.h) - -#define ti_lib_int_master_enable(...) IntMasterEnable(__VA_ARGS__) -#define ti_lib_int_master_disable(...) IntMasterDisable(__VA_ARGS__) -#define ti_lib_int_register(...) IntRegister(__VA_ARGS__); -#define ti_lib_int_unregsiter(...) IntUnregister(__VA_ARGS__) -#define ti_lib_int_priority_grouping_set(...) IntPriorityGroupingSet(__VA_ARGS__) -#define ti_lib_int_priority_grouping_get(...) IntPriorityGroupingGet(__VA_ARGS__) -#define ti_lib_int_priority_set(...) IntPrioritySet(__VA_ARGS__) -#define ti_lib_int_priority_get(...) IntPriorityGet(__VA_ARGS__) -#define ti_lib_int_enable(...) IntEnable(__VA_ARGS__) -#define ti_lib_int_disable(...) IntDisable(__VA_ARGS__) -#define ti_lib_int_pend_set(...) IntPendSet(__VA_ARGS__) -#define ti_lib_int_pend_get(...) IntPendGet(__VA_ARGS__) -#define ti_lib_int_pend_clear(...) IntPendClear(__VA_ARGS__) -#define ti_lib_int_mask_set(...) IntPriorityMaskSet(__VA_ARGS__) -#define ti_lib_int_mask_get(...) IntPriorityMaskGet(__VA_ARGS__) -/*---------------------------------------------------------------------------*/ -/* ioc.h */ -#include DeviceFamily_constructPath(driverlib/ioc.h) - -#define ti_lib_ioc_port_configure_set(...) IOCPortConfigureSet(__VA_ARGS__) -#define ti_lib_ioc_port_configure_get(...) IOCPortConfigureGet(__VA_ARGS__) -#define ti_lib_ioc_io_shutdown_set(...) IOCIOShutdownSet(__VA_ARGS__) -#define ti_lib_ioc_io_mode_set(...) IOCIOModeSet(__VA_ARGS__) -#define ti_lib_ioc_io_port_pull_set(...) IOCIOPortPullSet(__VA_ARGS__) -#define ti_lib_ioc_io_hyst_set(...) IOCIOHystSet(__VA_ARGS__) -#define ti_lib_ioc_io_input_set(...) IOCIOInputSet(__VA_ARGS__) -#define ti_lib_ioc_io_slew_ctrl_set(...) IOCIOSlewCtrlSet(__VA_ARGS__) -#define ti_lib_ioc_io_drv_strength_set(...) IOCIODrvStrengthSet(__VA_ARGS__) -#define ti_lib_ioc_io_port_id_set(...) IOCIOPortIdSet(__VA_ARGS__) -#define ti_lib_ioc_io_int_set(...) IOCIOIntSet(__VA_ARGS__) -#define ti_lib_ioc_int_register(...) IOCIntRegister(__VA_ARGS__); -#define ti_lib_ioc_int_unregister(...) IOCIntUnregister(__VA_ARGS__) -#define ti_lib_ioc_int_enable(...) IOCIntEnable(__VA_ARGS__) -#define ti_lib_ioc_int_disable(...) IOCIntDisable(__VA_ARGS__) -#define ti_lib_ioc_int_clear(...) IOCIntClear(__VA_ARGS__) -#define ti_lib_ioc_int_status(...) IOCIntStatus(__VA_ARGS__) -#define ti_lib_ioc_pin_type_gpio_input(...) IOCPinTypeGpioInput(__VA_ARGS__) -#define ti_lib_ioc_pin_type_gpio_output(...) IOCPinTypeGpioOutput(__VA_ARGS__) -#define ti_lib_ioc_pin_type_uart(...) IOCPinTypeUart(__VA_ARGS__) -#define ti_lib_ioc_pin_type_ssi_master(...) IOCPinTypeSsiMaster(__VA_ARGS__) -#define ti_lib_ioc_pin_type_ssi_slave(...) IOCPinTypeSsiSlave(__VA_ARGS__) -#define ti_lib_ioc_pin_type_i2c(...) IOCPinTypeI2c(__VA_ARGS__) -#define ti_lib_ioc_pin_type_aux(...) IOCPinTypeAux(__VA_ARGS__) -#define ti_lib_ioc_pin_type_spis(...) IOCPinTypeSpis(__VA_ARGS__) -/*---------------------------------------------------------------------------*/ -/* osc.h */ -#include DeviceFamily_constructPath(driverlib/osc.h) - -#define ti_lib_osc_xhf_power_mode_set(...) OSCXHfPowerModeSet(__VA_ARGS__) -#define ti_lib_osc_clock_loss_event_enable(...) OSCClockLossEventEnable(__VA_ARGS__) -#define ti_lib_osc_clock_loss_event_disable(...) OSCClockLossEventDisable(__VA_ARGS__) -#define ti_lib_osc_clock_source_set(...) OSCClockSourceSet(__VA_ARGS__) -#define ti_lib_osc_clock_source_get(...) OSCClockSourceGet(__VA_ARGS__) -#define ti_lib_osc_hf_source_ready(...) OSCHfSourceReady(__VA_ARGS__) -#define ti_lib_osc_hf_source_switch(...) OSCHfSourceSwitch(__VA_ARGS__) -#define ti_lib_osc_hf_get_startup_time(...) OSCHF_GetStartupTime(__VA_ARGS__) -#define ti_lib_osc_hf_turn_on_xosc(...) OSCHF_TurnOnXosc(__VA_ARGS__) -#define ti_lib_osc_hf_attempt_to_switch_to_xosc(...) OSCHF_AttemptToSwitchToXosc(__VA_ARGS__) -#define ti_lib_osc_hf_debug_get_crystal_amplitude(...) OSCHF_DebugGetCrystalAmplitude(__VA_ARGS__) -#define ti_lib_osc_hf_debug_get_expected_average_crystal_amplitude(...) \ - OSCHF_DebugGetExpectedAverageCrystalAmplitude(__VA_ARGS__) -#define ti_lib_osc_hposc_relative_frequency_offset_get(...) OSC_HPOSCRelativeFrequencyOffsetGet(__VA_ARGS__) -#define ti_lib_osc_hposc_relative_frequency_offset_to_rf_core_format_convert(...) \ - OSC_HPOSCRelativeFrequencyOffsetToRFCoreFormatConvert(__VA_ARGS__) -#define ti_lib_osc_hf_switch_to_rc_osc_turn_off_xosc(...) OSCHF_SwitchToRcOscTurnOffXosc(__VA_ARGS__) -/*---------------------------------------------------------------------------*/ -/* prcm.h */ -#include DeviceFamily_constructPath(driverlib/prcm.h) - -#define ti_lib_prcm_inf_clock_configure_set(...) PRCMInfClockConfigureSet(__VA_ARGS__) -#define ti_lib_prcm_inf_clock_configure_get(...) PRCMInfClockConfigureGet(__VA_ARGS__) -#define ti_lib_prcm_mcu_power_off(...) PRCMMcuPowerOff(__VA_ARGS__) -#define ti_lib_prcm_mcu_power_off_cancel(...) PRCMMcuPowerOffCancel(__VA_ARGS__) -#define ti_lib_prcm_mcu_uldo_configure(...) PRCMMcuUldoConfigure(__VA_ARGS__) -#define ti_lib_prcm_audio_clock_enable(...) PRCMAudioClockEnable(__VA_ARGS__) -#define ti_lib_prcm_audio_clock_disable(...) PRCMAudioClockDisable(__VA_ARGS__) -#define ti_lib_prcm_audio_clock_config_set(...) PRCMAudioClockConfigSet(__VA_ARGS__) -#define ti_lib_prcm_load_set(...) PRCMLoadSet(__VA_ARGS__) -#define ti_lib_prcm_load_get(...) PRCMLoadGet(__VA_ARGS__) -#define ti_lib_prcm_domain_enable(...) PRCMDomainEnable(__VA_ARGS__) -#define ti_lib_prcm_domain_disable(...) PRCMDomainDisable(__VA_ARGS__) -#define ti_lib_prcm_power_domain_on(...) PRCMPowerDomainOn(__VA_ARGS__) -#define ti_lib_prcm_power_domain_off(...) PRCMPowerDomainOff(__VA_ARGS__) -#define ti_lib_prcm_rf_power_down_when_idle(...) PRCMRfPowerDownWhenIdle(__VA_ARGS__) -#define ti_lib_prcm_peripheral_run_enable(...) PRCMPeripheralRunEnable(__VA_ARGS__) -#define ti_lib_prcm_peripheral_run_disable(...) PRCMPeripheralRunDisable(__VA_ARGS__) -#define ti_lib_prcm_peripheral_sleep_enable(...) PRCMPeripheralSleepEnable(__VA_ARGS__) -#define ti_lib_prcm_peripheral_sleep_disable(...) PRCMPeripheralSleepDisable(__VA_ARGS__) -#define ti_lib_prcm_peripheral_deep_sleep_enable(...) PRCMPeripheralDeepSleepEnable(__VA_ARGS__) -#define ti_lib_prcm_peripheral_deep_sleep_disable(...) PRCMPeripheralDeepSleepDisable(__VA_ARGS__) -#define ti_lib_prcm_power_domain_status(...) PRCMPowerDomainStatus(__VA_ARGS__) -#define ti_lib_prcm_rf_ready(...) PRCMRfReady(__VA_ARGS__) -#define ti_lib_prcm_sleep(...) PRCMSleep(__VA_ARGS__) -#define ti_lib_prcm_deep_sleep(...) PRCMDeepSleep(__VA_ARGS__) -#define ti_lib_prcm_cache_retention_enable(...) PRCMCacheRetentionEnable(__VA_ARGS__) -#define ti_lib_prcm_cache_retention_disable(...) PRCMCacheRetentionDisable(__VA_ARGS__) -/*---------------------------------------------------------------------------*/ -/* sys_ctrl.h */ -#include DeviceFamily_constructPath(driverlib/pwr_ctrl.h) - -#define ti_lib_pwr_ctrl_state_set(...) PowerCtrlStateSet(__VA_ARGS__) -#define ti_lib_pwr_ctrl_source_set(...) PowerCtrlSourceSet(__VA_ARGS__) -#define ti_lib_pwr_ctrl_source_get(...) PowerCtrlSourceGet(__VA_ARGS__) -#define ti_lib_pwr_ctrl_reset_source_get(...) PowerCtrlResetSourceGet(__VA_ARGS__) -#define ti_lib_pwr_ctrl_reset_source_clear(...) PowerCtrlResetSourceClear(__VA_ARGS__) -#define ti_lib_pwr_ctrl_io_freeze_enable(...) PowerCtrlIOFreezeEnable(__VA_ARGS__) -#define ti_lib_pwr_ctrl_io_freeze_disable(...) PowerCtrlIOFreezeDisable(__VA_ARGS__) -/*---------------------------------------------------------------------------*/ -/* rfc.h */ -#include DeviceFamily_constructPath(driverlib/rfc.h) - -#define ti_lib_rfc_rtrim(...) RFCRTrim(__VA_ARGS__) -#define ti_lib_rfc_adi3vco_ldo_voltage_mode(...) RFCAdi3VcoLdoVoltageMode(__VA_ARGS__) -/*---------------------------------------------------------------------------*/ -/* sys_ctrl.h */ -#include DeviceFamily_constructPath(driverlib/sys_ctrl.h) - -#define ti_lib_sys_ctrl_power_everything(...) SysCtrlPowerEverything(__VA_ARGS__) -#define ti_lib_sys_ctrl_powerdown(...) SysCtrlPowerdown(__VA_ARGS__) -#define ti_lib_sys_ctrl_standby(...) SysCtrlStandby(__VA_ARGS__) -#define ti_lib_sys_ctrl_shutdown(...) SysCtrlShutdown(__VA_ARGS__) -#define ti_lib_sys_ctrl_clock_get(...) SysCtrlClockGet(__VA_ARGS__) -#define ti_lib_sys_ctrl_aon_sync(...) SysCtrlAonSync(__VA_ARGS__) -#define ti_lib_sys_ctrl_aon_update(...) SysCtrlAonUpdate(__VA_ARGS__) -#define ti_lib_sys_ctrl_set_recharge_before_power_down(...) SysCtrlSetRechargeBeforePowerDown(__VA_ARGS__) -#define ti_lib_sys_ctrl_adjust_recharge_after_power_down(...) SysCtrlAdjustRechargeAfterPowerDown(__VA_ARGS__) -#define ti_lib_sys_ctrl_dcdc_voltage_conditional_control(...) SysCtrl_DCDC_VoltageConditionalControl(__VA_ARGS__) -#define ti_lib_sys_ctrl_reset_source_get(...) SysCtrlResetSourceGet(__VA_ARGS__) -#define ti_lib_sys_ctrl_system_reset(...) SysCtrlSystemReset(__VA_ARGS__) -/*---------------------------------------------------------------------------*/ -/* ssi.h */ -#include DeviceFamily_constructPath(driverlib/ssi.h) - -#define ti_lib_ssi_config_set_exp_clk(...) SSIConfigSetExpClk(__VA_ARGS__) -#define ti_lib_ssi_enable(...) SSIEnable(__VA_ARGS__) -#define ti_lib_ssi_disable(...) SSIDisable(__VA_ARGS__) -#define ti_lib_ssi_data_put(...) SSIDataPut(__VA_ARGS__) -#define ti_lib_ssi_data_put_non_blocking(...) SSIDataPutNonBlocking(__VA_ARGS__) -#define ti_lib_ssi_data_get(...) SSIDataGet(__VA_ARGS__) -#define ti_lib_ssi_data_get_non_blocking(...) SSIDataGetNonBlocking(__VA_ARGS__) -#define ti_lib_ssi_busy(...) SSIBusy(__VA_ARGS__) -#define ti_lib_ssi_status(...) SSIStatus(__VA_ARGS__) -#define ti_lib_ssi_int_register(...) SSIIntRegister(__VA_ARGS__) -#define ti_lib_ssi_int_unregister(...) SSIIntUnregister(__VA_ARGS__) -#define ti_lib_ssi_int_enable(...) SSIIntEnable(__VA_ARGS__) -#define ti_lib_ssi_int_disable(...) SSIIntDisable(__VA_ARGS__) -#define ti_lib_ssi_int_clear(...) SSIIntClear(__VA_ARGS__) -#define ti_lib_ssi_int_status(...) SSIIntStatus(__VA_ARGS__) -#define ti_lib_ssi_dma_enable(...) SSIDMAEnable(__VA_ARGS__) -#define ti_lib_ssi_dma_disable(...) SSIDMADisable(__VA_ARGS__) -/*---------------------------------------------------------------------------*/ -/* systick.h */ -#include DeviceFamily_constructPath(driverlib/systick.h) - -#define ti_lib_systick_enable(...) SysTickEnable(__VA_ARGS__) -#define ti_lib_systick_disable(...) SysTickDisable(__VA_ARGS__) -#define ti_lib_systick_int_register(...) SysTickIntRegister(__VA_ARGS__) -#define ti_lib_systick_int_unregister(...) SysTickIntUnregister(__VA_ARGS__) -#define ti_lib_systick_int_enable(...) SysTickIntEnable(__VA_ARGS__) -#define ti_lib_systick_int_disable(...) SysTickIntDisable(__VA_ARGS__) -#define ti_lib_systick_period_set(...) SysTickPeriodSet(__VA_ARGS__) -#define ti_lib_systick_period_get(...) SysTickPeriodGet(__VA_ARGS__) -#define ti_lib_systick_value_get(...) SysTickValueGet(__VA_ARGS__) -/*---------------------------------------------------------------------------*/ -/* timer.h */ -#include DeviceFamily_constructPath(driverlib/timer.h) - -#define ti_lib_timer_enable(...) TimerEnable(__VA_ARGS__) -#define ti_lib_timer_disable(...) TimerDisable(__VA_ARGS__) -#define ti_lib_timer_configure(...) TimerConfigure(__VA_ARGS__) -#define ti_lib_timer_level_control(...) TimerLevelControl(__VA_ARGS__) -#define ti_lib_timer_event_control(...) TimerEventControl(__VA_ARGS__) -#define ti_lib_timer_stall_control(...) TimerStallControl(__VA_ARGS__) -#define ti_lib_timer_wait_on_trigger_control(...) TimerWaitOnTriggerControl(__VA_ARGS__) -#define ti_lib_timer_rtc_enable(...) TimerRtcEnable(__VA_ARGS__) -#define ti_lib_timer_rtc_disable(...) TimerRtcDisable(__VA_ARGS__) -#define ti_lib_timer_prescale_set(...) TimerPrescaleSet(__VA_ARGS__) -#define ti_lib_timer_prescale_get(...) TimerPrescaleGet(__VA_ARGS__) -#define ti_lib_timer_prescale_match_set(...) TimerPrescaleMatchSet(__VA_ARGS__) -#define ti_lib_timer_prescale_match_get(...) TimerPrescaleMatchGet(__VA_ARGS__) -#define ti_lib_timer_load_set(...) TimerLoadSet(__VA_ARGS__) -#define ti_lib_timer_load_get(...) TimerLoadGet(__VA_ARGS__) -#define ti_lib_timer_value_get(...) TimerValueGet(__VA_ARGS__) -#define ti_lib_timer_match_set(...) TimerMatchSet(__VA_ARGS__) -#define ti_lib_timer_match_get(...) TimerMatchGet(__VA_ARGS__) -#define ti_lib_timer_int_register(...) TimerIntRegister(__VA_ARGS__) -#define ti_lib_timer_int_unregister(...) TimerIntUnregister(__VA_ARGS__) -#define ti_lib_timer_int_enable(...) TimerIntEnable(__VA_ARGS__) -#define ti_lib_timer_int_disable(...) TimerIntDisable(__VA_ARGS__) -#define ti_lib_timer_int_status(...) TimerIntStatus(__VA_ARGS__) -#define ti_lib_timer_int_clear(...) TimerIntClear(__VA_ARGS__) -#define ti_lib_timer_synchronize(...) TimerSynchronize(__VA_ARGS__) -#define ti_lib_timer_ccp_combine_enable(...) TimerCcpCombineEnable(__VA_ARGS__) -#define ti_lib_timer_ccp_combine_disable(...) TimerCcpCombineDisable(__VA_ARGS__) -#define ti_lib_timer_match_update_mode(...) TimerMatchUpdateMode(__VA_ARGS__) -#define ti_lib_timer_interval_load_mode(...) TimerIntervalLoadMode(__VA_ARGS__) -/*---------------------------------------------------------------------------*/ -/* trng.h */ -#include DeviceFamily_constructPath(driverlib/trng.h) - -#define ti_lib_trng_configure(...) TRNGConfigure(__VA_ARGS__) -#define ti_lib_trng_enable(...) TRNGEnable(__VA_ARGS__) -#define ti_lib_trng_disable(...) TRNGDisable(__VA_ARGS__) -#define ti_lib_trng_number_get(...) TRNGNumberGet(__VA_ARGS__) -#define ti_lib_trng_status_get(...) TRNGStatusGet(__VA_ARGS__) -#define ti_lib_trng_reset(...) TRNGReset(__VA_ARGS__) -#define ti_lib_trng_int_enable(...) TRNGIntEnable(__VA_ARGS__) -#define ti_lib_trng_int_disable(...) TRNGIntDisable(__VA_ARGS__) -#define ti_lib_trng_int_status(...) TRNGIntStatus(__VA_ARGS__) -#define ti_lib_trng_int_clear(...) TRNGIntClear(__VA_ARGS__) -#define ti_lib_trng_int_register(...) TRNGIntRegister(__VA_ARGS__) -#define ti_lib_trng_int_unregister(...) TRNGIntUnregister(__VA_ARGS__) -/*---------------------------------------------------------------------------*/ -/* uart.h */ -#include DeviceFamily_constructPath(driverlib/uart.h) - -#define ti_lib_uart_parity_mode_set(...) UARTParityModeSet(__VA_ARGS__) -#define ti_lib_uart_parity_mode_get(...) UARTParityModeGet(__VA_ARGS__) -#define ti_lib_uart_fifo_level_set(...) UARTFIFOLevelSet(__VA_ARGS__) -#define ti_lib_uart_fifo_level_get(...) UARTFIFOLevelGet(__VA_ARGS__) -#define ti_lib_uart_config_set_exp_clk(...) UARTConfigSetExpClk(__VA_ARGS__) -#define ti_lib_uart_config_get_exp_clk(...) UARTConfigGetExpClk(__VA_ARGS__) -#define ti_lib_uart_enable(...) UARTEnable(__VA_ARGS__) -#define ti_lib_uart_disable(...) UARTDisable(__VA_ARGS__) -#define ti_lib_uart_fifo_enable(...) UARTFIFOEnable(__VA_ARGS__) -#define ti_lib_uart_fifo_disable(...) UARTFIFODisable(__VA_ARGS__) -#define ti_lib_uart_chars_avail(...) UARTCharsAvail(__VA_ARGS__) -#define ti_lib_uart_space_avail(...) UARTSpaceAvail(__VA_ARGS__) -#define ti_lib_uart_char_get_non_blocking(...) UARTCharGetNonBlocking(__VA_ARGS__) -#define ti_lib_uart_char_get(...) UARTCharGet(__VA_ARGS__) -#define ti_lib_uart_char_put_non_blocking(...) UARTCharPutNonBlocking(__VA_ARGS__) -#define ti_lib_uart_char_put(...) UARTCharPut(__VA_ARGS__) -#define ti_lib_uart_break_ctl(...) UARTBreakCtl(__VA_ARGS__) -#define ti_lib_uart_busy(...) UARTBusy(__VA_ARGS__) -#define ti_lib_uart_int_register(...) UARTIntRegister(__VA_ARGS__) -#define ti_lib_uart_int_unregister(...) UARTIntUnregister(__VA_ARGS__) -#define ti_lib_uart_int_enable(...) UARTIntEnable(__VA_ARGS__) -#define ti_lib_uart_int_disable(...) UARTIntDisable(__VA_ARGS__) -#define ti_lib_uart_int_status(...) UARTIntStatus(__VA_ARGS__) -#define ti_lib_uart_int_clear(...) UARTIntClear(__VA_ARGS__) -#define ti_lib_uart_dma_enable(...) UARTDMAEnable(__VA_ARGS__) -#define ti_lib_uart_dma_disable(...) UARTDMADisable(__VA_ARGS__) -#define ti_lib_uart_rx_error_get(...) UARTRxErrorGet(__VA_ARGS__) -#define ti_lib_uart_rx_error_clear(...) UARTRxErrorClear(__VA_ARGS__) -#define ti_lib_uart_hw_flow_control_en(...) UARTHwFlowControlEnable(__VA_ARGS__) -#define ti_lib_uart_hw_flow_control_dis(...) UARTHwFlowControlDisable(__VA_ARGS__) -/*---------------------------------------------------------------------------*/ -/* vims.h */ -#include DeviceFamily_constructPath(driverlib/vims.h) - -#define ti_lib_vims_configure(...) VIMSConfigure(__VA_ARGS__) -#define ti_lib_vims_mode_set(...) VIMSModeSet(__VA_ARGS__) -#define ti_lib_vims_mode_get(...) VIMSModeGet(__VA_ARGS__) -/*---------------------------------------------------------------------------*/ -/* watchdog.h */ -#include DeviceFamily_constructPath(driverlib/watchdog.h) - -#define ti_lib_watchdog_running(...) WatchdogRunning(__VA_ARGS__) -#define ti_lib_watchdog_enable(...) WatchdogEnable(__VA_ARGS__) -#define ti_lib_watchdog_reset_enable(...) WatchdogResetEnable(__VA_ARGS__) -#define ti_lib_watchdog_reset_disable(...) WatchdogResetDisable(__VA_ARGS__) -#define ti_lib_watchdog_lock(...) WatchdogLock(__VA_ARGS__) -#define ti_lib_watchdog_unlock(...) WatchdogUnlock(__VA_ARGS__) -#define ti_lib_watchdog_lock_state(...) WatchdogLockState(__VA_ARGS__) -#define ti_lib_watchdog_reload_set(...) WatchdogReloadSet(__VA_ARGS__) -#define ti_lib_watchdog_reload_get(...) WatchdogReloadGet(__VA_ARGS__) -#define ti_lib_watchdog_value_get(...) WatchdogValueGet(__VA_ARGS__) -#define ti_lib_watchdog_int_register(...) WatchdogIntRegister(__VA_ARGS__) -#define ti_lib_watchdog_int_unregister(...) WatchdogIntUnregister(__VA_ARGS__) -#define ti_lib_watchdog_int_enable(...) WatchdogIntEnable(__VA_ARGS__) -#define ti_lib_watchdog_int_status(...) WatchdogIntStatus(__VA_ARGS__) -#define ti_lib_watchdog_int_clear(...) WatchdogIntClear(__VA_ARGS__) -#define ti_lib_watchdog_int_type_set(...) WatchdogIntTypeSet(__VA_ARGS__) -#define ti_lib_watchdog_stall_enable(...) WatchdogStallEnable(__VA_ARGS__) -#define ti_lib_watchdog_stall_disable(...) WatchdogStallDisable(__VA_ARGS__) -/*---------------------------------------------------------------------------*/ -#endif /* TI_LIB_H_ */ -/*---------------------------------------------------------------------------*/ -/** - * @} - * @} - */ diff --git a/arch/cpu/cc13xx-cc26xx/dev/trng-arch.c b/arch/cpu/cc13xx-cc26xx/dev/trng-arch.c new file mode 100644 index 000000000..cb32232e0 --- /dev/null +++ b/arch/cpu/cc13xx-cc26xx/dev/trng-arch.c @@ -0,0 +1,94 @@ +/* + * Copyright (c) 2018, Texas Instruments Incorporated - http://www.ti.com/ + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of the copyright holder nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + */ +/** + * \addtogroup cc13xx-cc26xx-trng + * @{ + * + * \file + * Implementation of True Random Number Generator for CC13xx/CC26xx. + * \author + * Edvard Pettersen + */ +/*---------------------------------------------------------------------------*/ +#include "contiki.h" + +#include "trng-arch.h" +/*---------------------------------------------------------------------------*/ +#include +#include +/*---------------------------------------------------------------------------*/ +/* + * Very dirty workaround because of the pre-compiled TI drivers library for + * CC13xx/CC26x0 is missing the CryptoKey object file. + */ +#include +#if (DeviceFamily_PARENT == DeviceFamily_PARENT_CC13X0_CC26X0) +# include +#endif +/*---------------------------------------------------------------------------*/ +#include +#include +/*---------------------------------------------------------------------------*/ +void +trng_init(void) +{ + TRNG_init(); +} +/*---------------------------------------------------------------------------*/ +bool +trng_rand(uint8_t *entropy_buf, size_t entropy_len, uint32_t timeout_us) +{ + TRNG_Params trng_params; + TRNG_Handle trng_handle; + CryptoKey entropy_key; + int_fast16_t result; + + TRNG_Params_init(&trng_params); + trng_params.returnBehavior = TRNG_RETURN_BEHAVIOR_BLOCKING; + if(timeout_us != TRNG_WAIT_FOREVER) { + trng_params.timeout = timeout_us; + } + + trng_handle = TRNG_open(0, &trng_params); + if (!trng_handle) { + return false; + } + + CryptoKeyPlaintext_initBlankKey(&entropy_key, entropy_buf, entropy_len); + + result = TRNG_generateEntropy(trng_handle, &entropy_key); + + TRNG_close(trng_handle); + + return (result == TRNG_STATUS_SUCCESS); +} +/*---------------------------------------------------------------------------*/ +/** @} */ diff --git a/arch/cpu/cc13xx-cc26xx/dev/trng-arch.h b/arch/cpu/cc13xx-cc26xx/dev/trng-arch.h new file mode 100644 index 000000000..1b6c7f3a4 --- /dev/null +++ b/arch/cpu/cc13xx-cc26xx/dev/trng-arch.h @@ -0,0 +1,75 @@ +/* + * Copyright (c) 2018, Texas Instruments Incorporated - http://www.ti.com/ + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of the copyright holder nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + */ +/** + * \addtogroup cc13xx-cc26xx-cpu + * @{ + * + * \defgroup cc13xx-cc26xx-trng True Random Number Generator for CC13xx/CC26xx. + * @{ + * + * \file + * Header file of True Random Number Generator for CC13xx/CC26xx. + * \author + * Edvard Pettersen + */ +/*---------------------------------------------------------------------------*/ +#ifndef TRNG_ARCH_H_ +#define TRNG_ARCH_H_ +/*---------------------------------------------------------------------------*/ +#include +/*---------------------------------------------------------------------------*/ +#include +#include +/*---------------------------------------------------------------------------*/ +#define TRNG_WAIT_FOREVER (~(uint32_t)0) +/*---------------------------------------------------------------------------*/ +/** + * \breif Initialize the TRNG module. + */ +void trng_init(void); + +/** + * \brief Generates a stream of true random numbers. This is + * a blocking function call with a specified timeout. + * \param entropy_buf Buffer to store a stream of entropy. + * \param entropy_len Length of the entropy buffer. + * \param timeout_us How long to wait until timing out the operation. A + * timeout of TRNG_WAIT_FOREVER blocks forever. + * \return true if successful; else, false. + */ +bool trng_rand(uint8_t *entropy_buf, size_t entropy_len, uint32_t timeout_us); +/*---------------------------------------------------------------------------*/ +#endif /* TRNG_ARCH_H_ */ +/*---------------------------------------------------------------------------*/ +/** + * @} + * @} + */ diff --git a/arch/cpu/cc13xx-cc26xx/dev/rf-ble-addr.c b/arch/cpu/cc13xx-cc26xx/rf/ble-addr.c similarity index 99% rename from arch/cpu/cc13xx-cc26xx/dev/rf-ble-addr.c rename to arch/cpu/cc13xx-cc26xx/rf/ble-addr.c index a76261c66..db01506ad 100644 --- a/arch/cpu/cc13xx-cc26xx/dev/rf-ble-addr.c +++ b/arch/cpu/cc13xx-cc26xx/rf/ble-addr.c @@ -40,7 +40,7 @@ #include "dev/ble-hal.h" #include "net/linkaddr.h" -#include "rf-ble-addr.h" +#include "rf/ble-addr.h" /*---------------------------------------------------------------------------*/ #include #include DeviceFamily_constructPath(inc/hw_memmap.h) diff --git a/arch/cpu/cc13xx-cc26xx/dev/rf-ble-addr.h b/arch/cpu/cc13xx-cc26xx/rf/ble-addr.h similarity index 100% rename from arch/cpu/cc13xx-cc26xx/dev/rf-ble-addr.h rename to arch/cpu/cc13xx-cc26xx/rf/ble-addr.h diff --git a/arch/cpu/cc13xx-cc26xx/dev/rf-ble-beacond.c b/arch/cpu/cc13xx-cc26xx/rf/ble-beacond.c similarity index 99% rename from arch/cpu/cc13xx-cc26xx/dev/rf-ble-beacond.c rename to arch/cpu/cc13xx-cc26xx/rf/ble-beacond.c index 7aa38198a..ea56af9e5 100644 --- a/arch/cpu/cc13xx-cc26xx/dev/rf-ble-beacond.c +++ b/arch/cpu/cc13xx-cc26xx/rf/ble-beacond.c @@ -52,9 +52,9 @@ #include /*---------------------------------------------------------------------------*/ -#include "rf-ble-addr.h" -#include "rf-ble-beacond.h" -#include "rf-core.h" +#include "rf/rf.h" +#include "rf/ble-addr.h" +#include "rf/ble-beacond.h" #include "rf-settings.h" /*---------------------------------------------------------------------------*/ #include diff --git a/arch/cpu/cc13xx-cc26xx/dev/rf-ble-beacond.h b/arch/cpu/cc13xx-cc26xx/rf/ble-beacond.h similarity index 100% rename from arch/cpu/cc13xx-cc26xx/dev/rf-ble-beacond.h rename to arch/cpu/cc13xx-cc26xx/rf/ble-beacond.h diff --git a/arch/cpu/cc13xx-cc26xx/dev/rf-data-queue.c b/arch/cpu/cc13xx-cc26xx/rf/data-queue.c similarity index 99% rename from arch/cpu/cc13xx-cc26xx/dev/rf-data-queue.c rename to arch/cpu/cc13xx-cc26xx/rf/data-queue.c index 32bab1242..96f1be9c1 100644 --- a/arch/cpu/cc13xx-cc26xx/dev/rf-data-queue.c +++ b/arch/cpu/cc13xx-cc26xx/rf/data-queue.c @@ -39,7 +39,7 @@ #include "contiki.h" #include "sys/cc.h" -#include "rf-data-queue.h" +#include "rf/data-queue.h" /*---------------------------------------------------------------------------*/ #include #include DeviceFamily_constructPath(driverlib/rf_mailbox.h) diff --git a/arch/cpu/cc13xx-cc26xx/dev/rf-data-queue.h b/arch/cpu/cc13xx-cc26xx/rf/data-queue.h similarity index 100% rename from arch/cpu/cc13xx-cc26xx/dev/rf-data-queue.h rename to arch/cpu/cc13xx-cc26xx/rf/data-queue.h diff --git a/arch/cpu/cc13xx-cc26xx/dev/rf-15-4g.h b/arch/cpu/cc13xx-cc26xx/rf/dot-15-4g.h similarity index 100% rename from arch/cpu/cc13xx-cc26xx/dev/rf-15-4g.h rename to arch/cpu/cc13xx-cc26xx/rf/dot-15-4g.h diff --git a/arch/cpu/cc13xx-cc26xx/dev/rf-ieee-addr.c b/arch/cpu/cc13xx-cc26xx/rf/ieee-addr.c similarity index 99% rename from arch/cpu/cc13xx-cc26xx/dev/rf-ieee-addr.c rename to arch/cpu/cc13xx-cc26xx/rf/ieee-addr.c index eddee8947..25aacc63b 100644 --- a/arch/cpu/cc13xx-cc26xx/dev/rf-ieee-addr.c +++ b/arch/cpu/cc13xx-cc26xx/rf/ieee-addr.c @@ -40,7 +40,7 @@ #include "contiki.h" #include "net/linkaddr.h" -#include "rf-ieee-addr.h" +#include "rf/ieee-addr.h" /*---------------------------------------------------------------------------*/ #include #include DeviceFamily_constructPath(inc/hw_memmap.h) diff --git a/arch/cpu/cc13xx-cc26xx/dev/rf-ieee-addr.h b/arch/cpu/cc13xx-cc26xx/rf/ieee-addr.h similarity index 100% rename from arch/cpu/cc13xx-cc26xx/dev/rf-ieee-addr.h rename to arch/cpu/cc13xx-cc26xx/rf/ieee-addr.h diff --git a/arch/cpu/cc13xx-cc26xx/dev/rf-ieee-mode.c b/arch/cpu/cc13xx-cc26xx/rf/ieee-mode.c similarity index 99% rename from arch/cpu/cc13xx-cc26xx/dev/rf-ieee-mode.c rename to arch/cpu/cc13xx-cc26xx/rf/ieee-mode.c index ce7d8b42c..4ab38acb8 100644 --- a/arch/cpu/cc13xx-cc26xx/dev/rf-ieee-mode.c +++ b/arch/cpu/cc13xx-cc26xx/rf/ieee-mode.c @@ -66,10 +66,10 @@ #include /*---------------------------------------------------------------------------*/ /* SimpleLink Platform RF dev */ -#include "rf-data-queue.h" -#include "rf-core.h" -#include "rf-sched.h" -#include "rf-15-4g.h" +#include "rf/rf.h" +#include "rf/data-queue.h" +#include "rf/dot-15-4g.h" +#include "rf/sched.h" #include "ieee-settings.h" /*---------------------------------------------------------------------------*/ #include diff --git a/arch/cpu/cc13xx-cc26xx/dev/rf-prop-mode.c b/arch/cpu/cc13xx-cc26xx/rf/prop-mode.c similarity index 100% rename from arch/cpu/cc13xx-cc26xx/dev/rf-prop-mode.c rename to arch/cpu/cc13xx-cc26xx/rf/prop-mode.c diff --git a/arch/cpu/cc13xx-cc26xx/dev/rf-core.h b/arch/cpu/cc13xx-cc26xx/rf/rf.h similarity index 100% rename from arch/cpu/cc13xx-cc26xx/dev/rf-core.h rename to arch/cpu/cc13xx-cc26xx/rf/rf.h diff --git a/arch/cpu/cc13xx-cc26xx/dev/rf-sched.c b/arch/cpu/cc13xx-cc26xx/rf/sched.c similarity index 99% rename from arch/cpu/cc13xx-cc26xx/dev/rf-sched.c rename to arch/cpu/cc13xx-cc26xx/rf/sched.c index a258dc54b..476c9d56c 100644 --- a/arch/cpu/cc13xx-cc26xx/dev/rf-sched.c +++ b/arch/cpu/cc13xx-cc26xx/rf/sched.c @@ -52,9 +52,9 @@ #include /*---------------------------------------------------------------------------*/ -#include "rf-core.h" -#include "rf-sched.h" -#include "rf-data-queue.h" +#include "rf/rf.h" +#include "rf/sched.h" +#include "rf/data-queue.h" #include "rf-settings.h" /*---------------------------------------------------------------------------*/ #include diff --git a/arch/cpu/cc13xx-cc26xx/dev/rf-sched.h b/arch/cpu/cc13xx-cc26xx/rf/sched.h similarity index 99% rename from arch/cpu/cc13xx-cc26xx/dev/rf-sched.h rename to arch/cpu/cc13xx-cc26xx/rf/sched.h index 32f6f0a6b..6ba452702 100644 --- a/arch/cpu/cc13xx-cc26xx/dev/rf-sched.h +++ b/arch/cpu/cc13xx-cc26xx/rf/sched.h @@ -40,8 +40,6 @@ /*---------------------------------------------------------------------------*/ #include "contiki.h" #include "sys/process.h" - -#include "rf-ble-beacond.h" /*---------------------------------------------------------------------------*/ #include /*---------------------------------------------------------------------------*/ diff --git a/arch/platform/simplelink/cc13xx-cc26xx/Makefile.cc13xx-cc26xx b/arch/platform/simplelink/cc13xx-cc26xx/Makefile.cc13xx-cc26xx index b9e315e80..e691b0768 100644 --- a/arch/platform/simplelink/cc13xx-cc26xx/Makefile.cc13xx-cc26xx +++ b/arch/platform/simplelink/cc13xx-cc26xx/Makefile.cc13xx-cc26xx @@ -46,6 +46,7 @@ ifdef NODEID endif CONTIKI_TARGET_SOURCEFILES += platform.c +CONTIKI_TARGET_SOURCEFILES += batmon-sensor.c CONTIKI_TARGET_SOURCEFILES += $(BOARD_SOURCEFILES) CONTIKI_SOURCEFILES += $(CONTIKI_TARGET_SOURCEFILES) diff --git a/arch/cpu/cc13xx-cc26xx/dev/batmon-sensor.c b/arch/platform/simplelink/cc13xx-cc26xx/batmon-sensor.c similarity index 88% rename from arch/cpu/cc13xx-cc26xx/dev/batmon-sensor.c rename to arch/platform/simplelink/cc13xx-cc26xx/batmon-sensor.c index 423a9fbcc..557c9d018 100644 --- a/arch/cpu/cc13xx-cc26xx/dev/batmon-sensor.c +++ b/arch/platform/simplelink/cc13xx-cc26xx/batmon-sensor.c @@ -38,10 +38,12 @@ /*---------------------------------------------------------------------------*/ #include "contiki.h" #include "lib/sensors.h" + #include "batmon-sensor.h" - -#include "ti-lib.h" - +/*---------------------------------------------------------------------------*/ +#include +#include DeviceFamily_constructPath(driverlib/aon_batmon.h) +/*---------------------------------------------------------------------------*/ #include #include /*---------------------------------------------------------------------------*/ @@ -71,15 +73,13 @@ value(int type) return 0; } - if(type == BATMON_SENSOR_TYPE_TEMP) { - return (int)ti_lib_aon_batmon_temperature_get_deg_c(); - } else if(type == BATMON_SENSOR_TYPE_VOLT) { - return (int)ti_lib_aon_batmon_battery_voltage_get(); - } else { + switch(type) { + case BATMON_SENSOR_TYPE_TEMP: return (int)AONBatMonTemperatureGetDegC(); + case BATMON_SENSOR_TYPE_VOLT: return (int)AONBatMonBatteryVoltageGet(); + default: PRINTF("Invalid type\n"); + return 0; } - - return 0; } /*---------------------------------------------------------------------------*/ /** @@ -97,15 +97,15 @@ configure(int type, int enable) { switch(type) { case SENSORS_HW_INIT: - ti_lib_aon_batmon_enable(); + AONBatMonEnable(); enabled = SENSOR_STATUS_ENABLED; break; case SENSORS_ACTIVE: if(enable) { - ti_lib_aon_batmon_enable(); + AONBatMonEnable(); enabled = SENSOR_STATUS_ENABLED; } else { - ti_lib_aon_batmon_disable(); + AONBatMonDisable(); enabled = SENSOR_STATUS_DISABLED; } break; diff --git a/arch/cpu/cc13xx-cc26xx/dev/batmon-sensor.h b/arch/platform/simplelink/cc13xx-cc26xx/batmon-sensor.h similarity index 100% rename from arch/cpu/cc13xx-cc26xx/dev/batmon-sensor.h rename to arch/platform/simplelink/cc13xx-cc26xx/batmon-sensor.h diff --git a/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1310/CC1310_LAUNCHXL.c b/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1310/CC1310_LAUNCHXL.c index df5454f5d..b9f3adfb1 100644 --- a/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1310/CC1310_LAUNCHXL.c +++ b/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1310/CC1310_LAUNCHXL.c @@ -779,6 +779,29 @@ const uint_least8_t SPI_count = CC1310_LAUNCHXL_SPICOUNT; #endif /* TI_SPI_CONF_ENABLE */ + +/* + * =============================== TRNG =============================== + */ +#include +#include + +TRNGCC26X0_Object trngCC26X0Object[CC1310_LAUNCHXL_TRNGCOUNT]; + +const TRNGCC26X0_HWAttrs trngCC26X0HWAttrs[CC1310_LAUNCHXL_TRNGCOUNT] = { + { + .swiPriority = 0, + .intPriority = ~0, + } +}; + +const TRNG_Config TRNG_config[] = { + { &trngCC26X0Object[0], &trngCC26X0HWAttrs[0] }, +}; + +const uint8_t TRNG_count = CC1310_LAUNCHXL_TRNGCOUNT; + + /* * =============================== UART =============================== */ diff --git a/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1310/CC1310_LAUNCHXL.h b/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1310/CC1310_LAUNCHXL.h index 51ff78942..12b3bb084 100644 --- a/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1310/CC1310_LAUNCHXL.h +++ b/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1310/CC1310_LAUNCHXL.h @@ -333,6 +333,16 @@ typedef enum CC1310_LAUNCHXL_SPIName { CC1310_LAUNCHXL_SPICOUNT } CC1310_LAUNCHXL_SPIName; +/*! + * @def CC1310_LAUNCHXL_TRNGName + * @brief Enum of TRNGs + */ +typedef enum CC1310_LAUNCHXL_TRNGName { + CC1310_LAUNCHXL_TRNG0 = 0, + + CC1310_LAUNCHXL_TRNGCOUNT +} CC1310_LAUNCHXL_TRNGName; + /*! * @def CC1310_LAUNCHXL_UARTName * @brief Enum of UARTs diff --git a/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1312r1/CC1312R1_LAUNCHXL.c b/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1312r1/CC1312R1_LAUNCHXL.c index 20372347e..24db2296f 100644 --- a/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1312r1/CC1312R1_LAUNCHXL.c +++ b/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1312r1/CC1312R1_LAUNCHXL.c @@ -900,6 +900,29 @@ const uint_least8_t SPI_count = CC1312R1_LAUNCHXL_SPICOUNT; #endif /* TI_SPI_CONF_ENABLE */ + +/* + * =============================== TRNG =============================== + */ +#include +#include + +TRNGCC26X2_Object trngCC26X2Object[CC1312R1_LAUNCHXL_TRNGCOUNT]; + +const TRNGCC26X2_HWAttrs trngCC26X2HWAttrs[CC1312R1_LAUNCHXL_TRNGCOUNT] = { + { + .swiPriority = 0, + .intPriority = ~0, + } +}; + +const TRNG_Config TRNG_config[] = { + { &trngCC26X2Object[0], &trngCC26X2HWAttrs[0] }, +}; + +const uint8_t TRNG_count = CC1312R1_LAUNCHXL_TRNGCOUNT; + + /* * =============================== UART =============================== */ diff --git a/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1312r1/CC1312R1_LAUNCHXL.h b/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1312r1/CC1312R1_LAUNCHXL.h index c70e28755..d54a18e89 100644 --- a/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1312r1/CC1312R1_LAUNCHXL.h +++ b/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1312r1/CC1312R1_LAUNCHXL.h @@ -392,6 +392,16 @@ typedef enum CC1312R1_LAUNCHXL_SPIName { CC1312R1_LAUNCHXL_SPICOUNT } CC1312R1_LAUNCHXL_SPIName; +/*! + * @def CC1312R1_LAUNCHXL_TRNGName + * @brief Enum of TRNGs + */ +typedef enum CC1312R1_LAUNCHXL_TRNGName { + CC1312R1_LAUNCHXL_TRNG0 = 0, + + CC1312R1_LAUNCHXL_TRNGCOUNT +} CC1312R1_LAUNCHXL_TRNGName; + /*! * @def CC1312R1_LAUNCHXL_UARTName * @brief Enum of UARTs diff --git a/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1350/CC1350_LAUNCHXL.c b/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1350/CC1350_LAUNCHXL.c index 1fbff5e6d..61efd4e92 100644 --- a/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1350/CC1350_LAUNCHXL.c +++ b/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1350/CC1350_LAUNCHXL.c @@ -792,6 +792,29 @@ const uint_least8_t SPI_count = CC1350_LAUNCHXL_SPICOUNT; #endif /* TI_SPI_CONF_ENABLE */ + +/* + * =============================== TRNG =============================== + */ +#include +#include + +TRNGCC26X0_Object trngCC26X0Object[CC1350_LAUNCHXL_TRNGCOUNT]; + +const TRNGCC26X0_HWAttrs trngCC26X0HWAttrs[CC1350_LAUNCHXL_TRNGCOUNT] = { + { + .swiPriority = 0, + .intPriority = ~0, + } +}; + +const TRNG_Config TRNG_config[] = { + { &trngCC26X0Object[0], &trngCC26X0HWAttrs[0] }, +}; + +const uint8_t TRNG_count = CC1350_LAUNCHXL_TRNGCOUNT; + + /* * =============================== UART =============================== */ diff --git a/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1350/CC1350_LAUNCHXL.h b/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1350/CC1350_LAUNCHXL.h index 88ffb333b..a54fa9365 100644 --- a/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1350/CC1350_LAUNCHXL.h +++ b/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1350/CC1350_LAUNCHXL.h @@ -336,6 +336,16 @@ typedef enum CC1350_LAUNCHXL_SPIName { CC1350_LAUNCHXL_SPICOUNT } CC1350_LAUNCHXL_SPIName; +/*! + * @def CC1350_LAUNCHXL_TRNGName + * @brief Enum of TRNGs + */ +typedef enum CC1350_LAUNCHXL_TRNGName { + CC1350_LAUNCHXL_TRNG0 = 0, + + CC1350_LAUNCHXL_TRNGCOUNT +} CC1350_LAUNCHXL_TRNGName; + /*! * @def CC1350_LAUNCHXL_UARTName * @brief Enum of UARTs diff --git a/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1352p-2/CC1352P_2_LAUNCHXL.c b/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1352p-2/CC1352P_2_LAUNCHXL.c index 973f712ac..ea178974b 100644 --- a/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1352p-2/CC1352P_2_LAUNCHXL.c +++ b/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1352p-2/CC1352P_2_LAUNCHXL.c @@ -884,6 +884,29 @@ const uint_least8_t SPI_count = CC1352P_2_LAUNCHXL_SPICOUNT; #endif /* TI_SPI_CONF_ENABLE */ + +/* + * =============================== TRNG =============================== + */ +#include +#include + +TRNGCC26X2_Object trngCC26X2Object[CC1352P_2_LAUNCHXL_TRNGCOUNT]; + +const TRNGCC26X2_HWAttrs trngCC26X2HWAttrs[CC1352P_2_LAUNCHXL_TRNGCOUNT] = { + { + .swiPriority = 0, + .intPriority = ~0, + } +}; + +const TRNG_Config TRNG_config[] = { + { &trngCC26X2Object[0], &trngCC26X2HWAttrs[0] }, +}; + +const uint8_t TRNG_count = CC1352P_2_LAUNCHXL_TRNGCOUNT; + + /* * =============================== UART =============================== */ diff --git a/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1352p-2/CC1352P_2_LAUNCHXL.h b/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1352p-2/CC1352P_2_LAUNCHXL.h index f71a15aa6..7c83f2935 100644 --- a/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1352p-2/CC1352P_2_LAUNCHXL.h +++ b/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1352p-2/CC1352P_2_LAUNCHXL.h @@ -400,6 +400,16 @@ typedef enum CC1352P_2_LAUNCHXL_SPIName { CC1352P_2_LAUNCHXL_SPICOUNT } CC1352P_2_LAUNCHXL_SPIName; +/*! + * @def CC1352p_2_LAUNCHXL_TRNGName + * @brief Enum of TRNGs + */ +typedef enum CC1352p_2_LAUNCHXL_TRNGName { + CC1352p_2_LAUNCHXL_TRNG0 = 0, + + CC1352p_2_LAUNCHXL_TRNGCOUNT +} CC1352p_2_LAUNCHXL_TRNGName; + /*! * @def CC1352P_2_LAUNCHXL_UARTName * @brief Enum of UARTs diff --git a/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1352p-4/CC1352P_4_LAUNCHXL.c b/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1352p-4/CC1352P_4_LAUNCHXL.c index 007bcfeab..9a2ae3505 100644 --- a/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1352p-4/CC1352P_4_LAUNCHXL.c +++ b/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1352p-4/CC1352P_4_LAUNCHXL.c @@ -884,6 +884,29 @@ const uint_least8_t SPI_count = CC1352P_4_LAUNCHXL_SPICOUNT; #endif /* TI_SPI_CONF_ENABLE */ + +/* + * =============================== TRNG =============================== + */ +#include +#include + +TRNGCC26X2_Object trngCC26X2Object[CC1352P_4_LAUNCHXL_TRNGCOUNT]; + +const TRNGCC26X2_HWAttrs trngCC26X2HWAttrs[CC1352P_4_LAUNCHXL_TRNGCOUNT] = { + { + .swiPriority = 0, + .intPriority = ~0, + } +}; + +const TRNG_Config TRNG_config[] = { + { &trngCC26X2Object[0], &trngCC26X2HWAttrs[0] }, +}; + +const uint8_t TRNG_count = CC1352P_4_LAUNCHXL_TRNGCOUNT; + + /* * =============================== UART =============================== */ diff --git a/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1352p-4/CC1352P_4_LAUNCHXL.h b/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1352p-4/CC1352P_4_LAUNCHXL.h index bee9657ea..a125dcd6a 100644 --- a/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1352p-4/CC1352P_4_LAUNCHXL.h +++ b/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1352p-4/CC1352P_4_LAUNCHXL.h @@ -400,6 +400,16 @@ typedef enum CC1352P_4_LAUNCHXL_SPIName { CC1352P_4_LAUNCHXL_SPICOUNT } CC1352P_4_LAUNCHXL_SPIName; +/*! + * @def CC1352P_4_LAUNCHXL_TRNGName + * @brief Enum of TRNGs + */ +typedef enum CC1352P_4_LAUNCHXL_TRNGName { + CC1352P_4_LAUNCHXL_TRNG0 = 0, + + CC1352P_4_LAUNCHXL_TRNGCOUNT +} CC1352P_4_LAUNCHXL_TRNGName; + /*! * @def CC1352P_4_LAUNCHXL_UARTName * @brief Enum of UARTs diff --git a/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1352p1/CC1352P1_LAUNCHXL.c b/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1352p1/CC1352P1_LAUNCHXL.c index 8ec044737..4a6e7b5e8 100644 --- a/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1352p1/CC1352P1_LAUNCHXL.c +++ b/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1352p1/CC1352P1_LAUNCHXL.c @@ -884,6 +884,29 @@ const uint_least8_t SPI_count = CC1352P1_LAUNCHXL_SPICOUNT; #endif /* TI_SPI_CONF_ENABLE */ + +/* + * =============================== TRNG =============================== + */ +#include +#include + +TRNGCC26X2_Object trngCC26X2Object[CC1352P1_LAUNCHXL_TRNGCOUNT]; + +const TRNGCC26X2_HWAttrs trngCC26X2HWAttrs[CC1352P1_LAUNCHXL_TRNGCOUNT] = { + { + .swiPriority = 0, + .intPriority = ~0, + } +}; + +const TRNG_Config TRNG_config[] = { + { &trngCC26X2Object[0], &trngCC26X2HWAttrs[0] }, +}; + +const uint8_t TRNG_count = CC1352P1_LAUNCHXL_TRNGCOUNT; + + /* * =============================== UART =============================== */ diff --git a/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1352p1/CC1352P1_LAUNCHXL.h b/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1352p1/CC1352P1_LAUNCHXL.h index af3478bac..dd91ea72d 100644 --- a/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1352p1/CC1352P1_LAUNCHXL.h +++ b/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1352p1/CC1352P1_LAUNCHXL.h @@ -404,6 +404,16 @@ typedef enum CC1352P1_LAUNCHXL_SPIName { CC1352P1_LAUNCHXL_SPICOUNT } CC1352P1_LAUNCHXL_SPIName; +/*! + * @def CC1352P1_LAUNCHXL_TRNGName + * @brief Enum of TRNGs + */ +typedef enum CC1352P1_LAUNCHXL_TRNGName { + CC1352P1_LAUNCHXL_TRNG0 = 0, + + CC1352P1_LAUNCHXL_TRNGCOUNT +} CC1352P1_LAUNCHXL_TRNGName; + /*! * @def CC1352P1_LAUNCHXL_UARTName * @brief Enum of UARTs diff --git a/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1352r1/CC1352R1_LAUNCHXL.c b/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1352r1/CC1352R1_LAUNCHXL.c index 5ed8d3167..e84f74cbe 100644 --- a/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1352r1/CC1352R1_LAUNCHXL.c +++ b/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1352r1/CC1352R1_LAUNCHXL.c @@ -903,6 +903,29 @@ const uint_least8_t SPI_count = CC1352R1_LAUNCHXL_SPICOUNT; #endif /* TI_SPI_CONF_ENABLE */ + +/* + * =============================== TRNG =============================== + */ +#include +#include + +TRNGCC26X2_Object trngCC26X2Object[CC1352R1_LAUNCHXL_TRNGCOUNT]; + +const TRNGCC26X2_HWAttrs trngCC26X2HWAttrs[CC1352R1_LAUNCHXL_TRNGCOUNT] = { + { + .swiPriority = 0, + .intPriority = ~0, + } +}; + +const TRNG_Config TRNG_config[] = { + { &trngCC26X2Object[0], &trngCC26X2HWAttrs[0] }, +}; + +const uint8_t TRNG_count = CC1352R1_LAUNCHXL_TRNGCOUNT; + + /* * =============================== UART =============================== */ diff --git a/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1352r1/CC1352R1_LAUNCHXL.h b/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1352r1/CC1352R1_LAUNCHXL.h index 3dcd63af5..3a4949f87 100644 --- a/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1352r1/CC1352R1_LAUNCHXL.h +++ b/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1352r1/CC1352R1_LAUNCHXL.h @@ -396,6 +396,16 @@ typedef enum CC1352R1_LAUNCHXL_SPIName { CC1352R1_LAUNCHXL_SPICOUNT } CC1352R1_LAUNCHXL_SPIName; +/*! + * @def CC1352R1_LAUNCHXL_TRNGName + * @brief Enum of TRNGs + */ +typedef enum CC1352R1_LAUNCHXL_TRNGName { + CC1352R1_LAUNCHXL_TRNG0 = 0, + + CC1352R1_LAUNCHXL_TRNGCOUNT +} CC1352R1_LAUNCHXL_TRNGName; + /*! * @def CC1352R1_LAUNCHXL_UARTName * @brief Enum of UARTs diff --git a/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc2650/CC2650_LAUNCHXL.c b/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc2650/CC2650_LAUNCHXL.c index b6c799ad2..1d63a60a3 100644 --- a/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc2650/CC2650_LAUNCHXL.c +++ b/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc2650/CC2650_LAUNCHXL.c @@ -778,6 +778,29 @@ const uint_least8_t SPI_count = CC2650_LAUNCHXL_SPICOUNT; #endif /* TI_SPI_CONF_ENABLE */ + +/* + * =============================== TRNG =============================== + */ +#include +#include + +TRNGCC26X0_Object trngCC26X0Object[CC2650_LAUNCHXL_TRNGCOUNT]; + +const TRNGCC26X0_HWAttrs trngCC26X0HWAttrs[CC2650_LAUNCHXL_TRNGCOUNT] = { + { + .swiPriority = 0, + .intPriority = ~0, + } +}; + +const TRNG_Config TRNG_config[] = { + { &trngCC26X0Object[0], &trngCC26X0HWAttrs[0] }, +}; + +const uint8_t TRNG_count = CC2650_LAUNCHXL_TRNGCOUNT; + + /* * =============================== UART =============================== */ diff --git a/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc2650/CC2650_LAUNCHXL.h b/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc2650/CC2650_LAUNCHXL.h index 89244b0f6..9f0fd81f9 100644 --- a/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc2650/CC2650_LAUNCHXL.h +++ b/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc2650/CC2650_LAUNCHXL.h @@ -333,6 +333,16 @@ typedef enum CC2650_LAUNCHXL_SPIName { CC2650_LAUNCHXL_SPICOUNT } CC2650_LAUNCHXL_SPIName; +/*! + * @def CC2650_LAUNCHXL_TRNGName + * @brief Enum of TRNGs + */ +typedef enum CC2650_LAUNCHXL_TRNGName { + CC2650_LAUNCHXL_TRNG0 = 0, + + CC2650_LAUNCHXL_TRNGCOUNT +} CC2650_LAUNCHXL_TRNGName; + /*! * @def CC2650_LAUNCHXL_UARTName * @brief Enum of UARTs diff --git a/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc26x2r1/CC26X2R1_LAUNCHXL.c b/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc26x2r1/CC26X2R1_LAUNCHXL.c index b7879f5a8..47a6ef8da 100644 --- a/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc26x2r1/CC26X2R1_LAUNCHXL.c +++ b/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc26x2r1/CC26X2R1_LAUNCHXL.c @@ -901,6 +901,29 @@ const uint_least8_t SPI_count = CC26X2R1_LAUNCHXL_SPICOUNT; #endif /* TI_SPI_CONF_ENABLE */ + +/* + * =============================== TRNG =============================== + */ +#include +#include + +TRNGCC26X2_Object trngCC26X2Object[CC26X2R1_LAUNCHXL_TRNGCOUNT]; + +const TRNGCC26X2_HWAttrs trngCC26X2HWAttrs[CC26X2R1_LAUNCHXL_TRNGCOUNT] = { + { + .swiPriority = 0, + .intPriority = ~0, + } +}; + +const TRNG_Config TRNG_config[] = { + { &trngCC26X2Object[0], &trngCC26X2HWAttrs[0] }, +}; + +const uint8_t TRNG_count = CC26X2R1_LAUNCHXL_TRNGCOUNT; + + /* * =============================== UART =============================== */ diff --git a/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc26x2r1/CC26X2R1_LAUNCHXL.h b/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc26x2r1/CC26X2R1_LAUNCHXL.h index 155fff3f9..998a8ffa6 100644 --- a/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc26x2r1/CC26X2R1_LAUNCHXL.h +++ b/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc26x2r1/CC26X2R1_LAUNCHXL.h @@ -398,6 +398,16 @@ typedef enum CC26X2R1_LAUNCHXL_SPIName { CC26X2R1_LAUNCHXL_SPICOUNT } CC26X2R1_LAUNCHXL_SPIName; +/*! + * @def CC26X2R1_LAUNCHXL_TRNGName + * @brief Enum of TRNGs + */ +typedef enum CC26X2R1_LAUNCHXL_TRNGName { + CC26X2R1_LAUNCHXL_TRNG0 = 0, + + CC26X2R1_LAUNCHXL_TRNGCOUNT +} CC26X2R1_LAUNCHXL_TRNGName; + /*! * @def CC26X2R1_LAUNCHXL_UARTName * @brief Enum of UARTs diff --git a/arch/platform/simplelink/cc13xx-cc26xx/platform.c b/arch/platform/simplelink/cc13xx-cc26xx/platform.c index 64317dc02..a591fefa0 100644 --- a/arch/platform/simplelink/cc13xx-cc26xx/platform.c +++ b/arch/platform/simplelink/cc13xx-cc26xx/platform.c @@ -38,7 +38,6 @@ * Edvard Pettersen */ /*---------------------------------------------------------------------------*/ -/* Contiki API */ #include "contiki.h" #include "contiki-net.h" #include "sys/clock.h" @@ -53,7 +52,6 @@ #include "lib/random.h" #include "lib/sensors.h" /*---------------------------------------------------------------------------*/ -/* Simplelink SDK includes */ #include #include @@ -71,14 +69,13 @@ #include #include /*---------------------------------------------------------------------------*/ -/* Arch driver implementations */ -#include "button-sensor.h" #include "board-peripherals.h" #include "uart0-arch.h" +#include "trng-arch.h" /*---------------------------------------------------------------------------*/ -#include "rf-core.h" -#include "rf-ieee-addr.h" -#include "rf-ble-beacond.h" +#include "rf/rf.h" +#include "rf/ble-beacond.h" +#include "rf/ieee-addr.h" /*---------------------------------------------------------------------------*/ #include #include @@ -200,7 +197,15 @@ platform_init_stage_two(void) uart0_set_callback(serial_line_input_byte); #endif - random_init(0x1234); + /* Use TRNG to seed PRNG. If TRNG fails, use a hard-coded seed. */ + unsigned short trn = 0; + trng_init(); + bool result = trng_rand((uint8_t*)&trn, sizeof(trn), TRNG_WAIT_FOREVER); + if (!result) { + /* Default to some hard-coded seed. */ + trn = 0x1234; + } + random_init(trn); /* Populate linkaddr_node_addr */ ieee_addr_cpy_to(linkaddr_node_addr.u8, LINKADDR_SIZE); diff --git a/arch/platform/simplelink/cc13xx-cc26xx/sensortag/cc1350/CC1350STK.c b/arch/platform/simplelink/cc13xx-cc26xx/sensortag/cc1350/CC1350STK.c index f1d8bf53d..c5a7558c7 100644 --- a/arch/platform/simplelink/cc13xx-cc26xx/sensortag/cc1350/CC1350STK.c +++ b/arch/platform/simplelink/cc13xx-cc26xx/sensortag/cc1350/CC1350STK.c @@ -611,6 +611,29 @@ const uint_least8_t SPI_count = CC1350STK_SPICOUNT; #endif /* TI_SPI_CONF_ENABLE */ + +/* + * =============================== TRNG =============================== + */ +#include +#include + +TRNGCC26X0_Object trngCC26X0Object[CC1350STK_TRNGCOUNT]; + +const TRNGCC26X0_HWAttrs trngCC26X0HWAttrs[CC1350STK_TRNGCOUNT] = { + { + .swiPriority = 0, + .intPriority = ~0, + } +}; + +const TRNG_Config TRNG_config[] = { + { &trngCC26X0Object[0], &trngCC26X0HWAttrs[0] }, +}; + +const uint8_t TRNG_count = CC1350STK_TRNGCOUNT; + + /* * =============================== UART =============================== */ diff --git a/arch/platform/simplelink/cc13xx-cc26xx/sensortag/cc1350/CC1350STK.h b/arch/platform/simplelink/cc13xx-cc26xx/sensortag/cc1350/CC1350STK.h index ea857a185..2a6f4bde9 100644 --- a/arch/platform/simplelink/cc13xx-cc26xx/sensortag/cc1350/CC1350STK.h +++ b/arch/platform/simplelink/cc13xx-cc26xx/sensortag/cc1350/CC1350STK.h @@ -299,6 +299,16 @@ typedef enum CC1350STK_SPIName { CC1350STK_SPICOUNT } CC1350STK_SPIName; +/*! + * @def CC1350STK_TRNGName + * @brief Enum of TRNGs + */ +typedef enum CC1350STK_TRNGName { + CC1350STK_TRNG0 = 0, + + CC1350STK_TRNGCOUNT +} CC1350STK_TRNGName; + /*! * @def CC1350STK_UARTName * @brief Enum of UARTs diff --git a/arch/platform/simplelink/cc13xx-cc26xx/sensortag/cc2650/CC2650STK.c b/arch/platform/simplelink/cc13xx-cc26xx/sensortag/cc2650/CC2650STK.c index d070170c9..b267075e5 100644 --- a/arch/platform/simplelink/cc13xx-cc26xx/sensortag/cc2650/CC2650STK.c +++ b/arch/platform/simplelink/cc13xx-cc26xx/sensortag/cc2650/CC2650STK.c @@ -612,6 +612,29 @@ const uint_least8_t SPI_count = CC2650STK_SPICOUNT; #endif /* TI_SPI_CONF_ENABLE */ + +/* + * =============================== TRNG =============================== + */ +#include +#include + +TRNGCC26X0_Object trngCC26X0Object[CC2650STK_TRNGCOUNT]; + +const TRNGCC26X0_HWAttrs trngCC26X0HWAttrs[CC2650STK_TRNGCOUNT] = { + { + .swiPriority = 0, + .intPriority = ~0, + } +}; + +const TRNG_Config TRNG_config[] = { + { &trngCC26X0Object[0], &trngCC26X0HWAttrs[0] }, +}; + +const uint8_t TRNG_count = CC2650STK_TRNGCOUNT; + + /* * =============================== UART =============================== */ diff --git a/arch/platform/simplelink/cc13xx-cc26xx/sensortag/cc2650/CC2650STK.h b/arch/platform/simplelink/cc13xx-cc26xx/sensortag/cc2650/CC2650STK.h index 0264ae110..8ec745f45 100644 --- a/arch/platform/simplelink/cc13xx-cc26xx/sensortag/cc2650/CC2650STK.h +++ b/arch/platform/simplelink/cc13xx-cc26xx/sensortag/cc2650/CC2650STK.h @@ -300,6 +300,16 @@ typedef enum CC2650STK_SPIName { CC2650STK_SPICOUNT } CC2650STK_SPIName; +/*! + * @def CC2650STK_TRNGName + * @brief Enum of TRNGs + */ +typedef enum CC2650STK_TRNGName { + CC2650STK_TRNG0 = 0, + + CC2650STK_TRNGCOUNT +} CC2650STK_TRNGName; + /*! * @def CC2650STK_UARTName * @brief Enum of UARTs diff --git a/arch/platform/simplelink/cc13xx-cc26xx/srf06/cc13x0/CC1350DK_7XD.c b/arch/platform/simplelink/cc13xx-cc26xx/srf06/cc13x0/CC1350DK_7XD.c index 3214b385a..8e05f6574 100644 --- a/arch/platform/simplelink/cc13xx-cc26xx/srf06/cc13x0/CC1350DK_7XD.c +++ b/arch/platform/simplelink/cc13xx-cc26xx/srf06/cc13x0/CC1350DK_7XD.c @@ -677,6 +677,29 @@ const uint_least8_t SPI_count = CC1350DK_7XD_SPICOUNT; #endif /* TI_SPI_CONF_ENABLE */ + +/* + * =============================== TRNG =============================== + */ +#include +#include + +TRNGCC26X0_Object trngCC26X0Object[CC1350DK_7XD_TRNGCOUNT]; + +const TRNGCC26X0_HWAttrs trngCC26X0HWAttrs[CC1350DK_7XD_TRNGCOUNT] = { + { + .swiPriority = 0, + .intPriority = ~0, + } +}; + +const TRNG_Config TRNG_config[] = { + { &trngCC26X0Object[0], &trngCC26X0HWAttrs[0] }, +}; + +const uint8_t TRNG_count = CC1350DK_7XD_TRNGCOUNT; + + /* * =============================== UART =============================== */ diff --git a/arch/platform/simplelink/cc13xx-cc26xx/srf06/cc13x0/CC1350DK_7XD.h b/arch/platform/simplelink/cc13xx-cc26xx/srf06/cc13x0/CC1350DK_7XD.h index f90681dbf..72b19a036 100644 --- a/arch/platform/simplelink/cc13xx-cc26xx/srf06/cc13x0/CC1350DK_7XD.h +++ b/arch/platform/simplelink/cc13xx-cc26xx/srf06/cc13x0/CC1350DK_7XD.h @@ -338,6 +338,16 @@ typedef enum CC1350DK_7XD_SPIName { CC1350DK_7XD_SPICOUNT } CC1350DK_7XD_SPIName; +/*! + * @def CC1350DK_7XD_TRNGName + * @brief Enum of TRNGs + */ +typedef enum CC1350DK_7XD_TRNGName { + CC1350DK_7XD_TRNG0 = 0, + + CC1350DK_7XD_TRNGCOUNT +} CC1350DK_7XD_TRNGName; + /*! * @def CC1350DK_7XD_UARTName * @brief Enum of UARTs diff --git a/arch/platform/simplelink/cc13xx-cc26xx/srf06/cc26x0/CC2650DK_7ID.c b/arch/platform/simplelink/cc13xx-cc26xx/srf06/cc26x0/CC2650DK_7ID.c index 52e27a7a7..431b0005c 100644 --- a/arch/platform/simplelink/cc13xx-cc26xx/srf06/cc26x0/CC2650DK_7ID.c +++ b/arch/platform/simplelink/cc13xx-cc26xx/srf06/cc26x0/CC2650DK_7ID.c @@ -678,6 +678,29 @@ const uint_least8_t SPI_count = CC2650DK_7ID_SPICOUNT; #endif /* TI_SPI_CONF_ENABLE */ + +/* + * =============================== TRNG =============================== + */ +#include +#include + +TRNGCC26X0_Object trngCC26X0Object[CC2650DK_7ID_TRNGCOUNT]; + +const TRNGCC26X0_HWAttrs trngCC26X0HWAttrs[CC2650DK_7ID_TRNGCOUNT] = { + { + .swiPriority = 0, + .intPriority = ~0, + } +}; + +const TRNG_Config TRNG_config[] = { + { &trngCC26X0Object[0], &trngCC26X0HWAttrs[0] }, +}; + +const uint8_t TRNG_count = CC2650DK_7ID_TRNGCOUNT; + + /* * =============================== UART =============================== */ diff --git a/arch/platform/simplelink/cc13xx-cc26xx/srf06/cc26x0/CC2650DK_7ID.h b/arch/platform/simplelink/cc13xx-cc26xx/srf06/cc26x0/CC2650DK_7ID.h index bde1ff107..7901fbed1 100644 --- a/arch/platform/simplelink/cc13xx-cc26xx/srf06/cc26x0/CC2650DK_7ID.h +++ b/arch/platform/simplelink/cc13xx-cc26xx/srf06/cc26x0/CC2650DK_7ID.h @@ -323,6 +323,16 @@ typedef enum CC2650DK_7ID_SDName { CC2650DK_7ID_SDCOUNT } CC2650DK_7ID_SDName; +/*! + * @def CC2650DK_7ID_TRNGName + * @brief Enum of TRNGs + */ +typedef enum CC2650DK_7ID_TRNGName { + CC2650DK_7ID_TRNG0 = 0, + + CC2650DK_7ID_TRNGCOUNT +} CC2650DK_7ID_TRNGName; + /*! * @def CC2650DK_7ID_SPIName * @brief Enum of SPI names