From 3061ecca3d0fdfb87dabbf5f63c9e06c2a30f53a Mon Sep 17 00:00:00 2001 From: Trygve Laugstøl Date: Thu, 23 Aug 2018 17:08:59 +0200 Subject: o Initial import. --- .../api/HAL/nrf52_soc/hal_nrf52_exceptions.h | 90 +++++++++++++++++ .../802_15_4/api/HAL/nrf52_soc/hal_nrf52_rtc.h | 107 +++++++++++++++++++++ .../802_15_4/api/HAL/nrf52_soc/hal_nrf52_timer.h | 75 +++++++++++++++ 3 files changed, 272 insertions(+) create mode 100644 thirdparty/nRF5_SDK_15.0.0_a53641a/components/802_15_4/api/HAL/nrf52_soc/hal_nrf52_exceptions.h create mode 100644 thirdparty/nRF5_SDK_15.0.0_a53641a/components/802_15_4/api/HAL/nrf52_soc/hal_nrf52_rtc.h create mode 100644 thirdparty/nRF5_SDK_15.0.0_a53641a/components/802_15_4/api/HAL/nrf52_soc/hal_nrf52_timer.h (limited to 'thirdparty/nRF5_SDK_15.0.0_a53641a/components/802_15_4/api/HAL/nrf52_soc') diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/802_15_4/api/HAL/nrf52_soc/hal_nrf52_exceptions.h b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/802_15_4/api/HAL/nrf52_soc/hal_nrf52_exceptions.h new file mode 100644 index 0000000..1599034 --- /dev/null +++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/802_15_4/api/HAL/nrf52_soc/hal_nrf52_exceptions.h @@ -0,0 +1,90 @@ +/** + * Copyright (c) 2016 - 2018 Nordic Semiconductor ASA and Luxoft Global Operations Gmbh. + * + * 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, except as embedded into a Nordic + * Semiconductor ASA integrated circuit in a product or a software update for + * such product, 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 Nordic Semiconductor ASA nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * + * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS + * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA 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 HAL_EXCEPTIONS_H_INCLUDED +#define HAL_EXCEPTIONS_H_INCLUDED + +#include + +/** + * @defgroup hal_15_4_nrf52 Chip-specific library interface + * @ingroup hal_15_4 + * + * @defgroup hal_nrf52_exceptions HAL exceptions + * @ingroup hal_15_4_nrf52 + * @{ + */ + +/** @brief Size of stack dump in 4-byte words.*/ +#define HAL_EXCEPTIONS_DUMP_SIZE 16 +/** @brief Defines where to put a '\n' in stack dump. + * + * This value defines power of 2 items in one row. + * E.g. 3 gives 2 ^ 3 = 8 items in a row.*/ +#define HAL_EXCEPTIONS_ITEMS_IN_LINE 3 + +/** @brief This structure holds values of fault status registers.*/ +typedef struct +{ + uint32_t CFSR; /*!< Configurable Fault Status Register.*/ + uint32_t HFSR; /*!< HardFault Status Register.*/ + uint32_t DFSR; /*!< Debug Fault Status Register.*/ + uint32_t AFSR; /*!< Auxiliary Fault Status Register.*/ +} hal_exceptions_status_registers_t; + +/** @brief This structure is put into dump monitor port and holds values of said + * registers when exception has happen.*/ +typedef struct +{ + uint32_t R0; /**< Register R0 (Argument 1 / word result).*/ + uint32_t R1; /**< Register R1 (Argument 2 / double-word result).*/ + uint32_t R2; /**< Register R2 (Argument 3).*/ + uint32_t R3; /**< Register R3 (Argument 4).*/ + uint32_t R12; /**< Register R12 (Scratch register (corruptible)).*/ + uint32_t LR; /**< Link register (R14).*/ + uint32_t PC; /**< Program counter (R15).*/ + uint32_t PSR; /**< Combined processor status register.*/ + uint32_t* FP; /**< Value of register, which may be used as Frame Pointer.*/ +} hal_exceptions_dump_t; + +/** @} */ + +#endif // HAL_EXCEPTIONS_H_INCLUDED diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/802_15_4/api/HAL/nrf52_soc/hal_nrf52_rtc.h b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/802_15_4/api/HAL/nrf52_soc/hal_nrf52_rtc.h new file mode 100644 index 0000000..1729834 --- /dev/null +++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/802_15_4/api/HAL/nrf52_soc/hal_nrf52_rtc.h @@ -0,0 +1,107 @@ +/** + * Copyright (c) 2016 - 2018 Nordic Semiconductor ASA and Luxoft Global Operations Gmbh. + * + * 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, except as embedded into a Nordic + * Semiconductor ASA integrated circuit in a product or a software update for + * such product, 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 Nordic Semiconductor ASA nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * + * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS + * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA 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 HAL_NRF52_RTC_H_INCLUDED +#define HAL_NRF52_RTC_H_INCLUDED + +#include "nordic_common.h" +#include "nrf_drv_config.h" +#include "nrf_drv_common.h" +#include "nrf_drv_rtc.h" +#include "nrf_rtc.h" + +/** + * @defgroup hal_nrf52_rtc HAL RTC + * @ingroup hal_15_4_nrf52 + * @{ + */ + +// RTC counter bitlenght +#define LAGEST_PRESCALER_VALUE 4096 +// RTC counter bitlenght +#define RTC_CNT_BITLENGHT 24 +// Longest sleep time, ms +#define LONGEST_SLEEP_TIME ((( 1UL << RTC_CNT_BITLENGHT ) \ + /(RTC_INPUT_FREQ/LAGEST_PRESCALER_VALUE)) * 1000UL ) + +// Shortest sleep time, ms +#define SHORTEST_SLEEP_TIME 1 + +/**@brief Function for initialize low frequency clock + */ +void rtc_lfclk_start(void); + + +/** @brief Function initialization and configuration of RTC driver instance. + * + * @param[in] sleep_time_ms after this time compare event will be triggered + */ +void rtc_start(uint32_t sleep_time_ms); + +/** @brief Stop RTC + */ +void rtc_stop(void); + +/** @brief Get RTC counter + * + * @retval uint32_t Contents of RTC counter register. + */ +uint32_t rtc_cnt_get(void); + +/** @brief Get time elapsed since cnt_ticks + * + * @param[in] cnt_ticks Number of rtc-ticks + * + * @retval uint32_t Time since cnt_ticks, ms + */ +uint64_t get_rtc_time_since(uint32_t cnt_ticks); + +/** @brief Check if rtc compare interrupt was triggered after calling + * rtc_start function + * + * @retval bool true - compare interrupt was triggered + * false - it wasn't + */ +bool is_rtc_comp_irq_triggerd(void); + +/** @} */ + +#endif /* HAL_NRF52_RTC_H_INCLUDED */ diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/802_15_4/api/HAL/nrf52_soc/hal_nrf52_timer.h b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/802_15_4/api/HAL/nrf52_soc/hal_nrf52_timer.h new file mode 100644 index 0000000..a008244 --- /dev/null +++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/802_15_4/api/HAL/nrf52_soc/hal_nrf52_timer.h @@ -0,0 +1,75 @@ +/** + * Copyright (c) 2016 - 2018 Nordic Semiconductor ASA and Luxoft Global Operations Gmbh. + * + * 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, except as embedded into a Nordic + * Semiconductor ASA integrated circuit in a product or a software update for + * such product, 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 Nordic Semiconductor ASA nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * + * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS + * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA 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 HAL_NRF52_TIMER_INCLUDED +#define HAL_NRF52_TIMER_INCLUDED + +/** + * @defgroup hal_nrf52_timer HAL timer - additional features + * @ingroup hal_15_4_nrf52 + * @{ + */ + +/**@brief Pause hardware timer. + */ +void hal_timer_pause(void); + + +/**@brief Resume hardware timer. + */ +void hal_timer_resume(void); + + +/**@brief Set a new system time + * + * @param[in] time_us time to set. + */ +void hal_time_adjust(uint64_t time_us); + + +/**@brief Uninit hardwware timer + */ +void hal_timer_uninit(void); + +/** @} */ + + +#endif /* HAL_NRF52_TIMER_INCLUDED */ -- cgit v1.2.3