[nrf528xx] align SDK components to version 16.0 (#4390)

This commit is contained in:
Duda, Lukasz
2019-12-10 10:16:46 -08:00
committed by Jonathan Hui
parent a08a9ceee3
commit 232b73477a
60 changed files with 624 additions and 161 deletions
@@ -62,6 +62,7 @@ COMMONCPPFLAGS
-I$(top_srcdir)/third_party/NordicSemiconductor/libraries/app_error \
-I$(top_srcdir)/third_party/NordicSemiconductor/libraries/atfifo \
-I$(top_srcdir)/third_party/NordicSemiconductor/libraries/atomic \
-I$(top_srcdir)/third_party/NordicSemiconductor/libraries/block_dev \
-I$(top_srcdir)/third_party/NordicSemiconductor/libraries/delay \
-I$(top_srcdir)/third_party/NordicSemiconductor/libraries/utf_converter \
-I$(top_srcdir)/third_party/NordicSemiconductor/nrfx \
@@ -64,6 +64,7 @@ COMMONCPPFLAGS
-I$(top_srcdir)/third_party/NordicSemiconductor/libraries/app_error \
-I$(top_srcdir)/third_party/NordicSemiconductor/libraries/atfifo \
-I$(top_srcdir)/third_party/NordicSemiconductor/libraries/atomic \
-I$(top_srcdir)/third_party/NordicSemiconductor/libraries/block_dev \
-I$(top_srcdir)/third_party/NordicSemiconductor/libraries/delay \
-I$(top_srcdir)/third_party/NordicSemiconductor/libraries/usb \
-I$(top_srcdir)/third_party/NordicSemiconductor/libraries/usb/config \
@@ -64,6 +64,7 @@ COMMONCPPFLAGS
-I$(top_srcdir)/third_party/NordicSemiconductor/libraries/app_error \
-I$(top_srcdir)/third_party/NordicSemiconductor/libraries/atfifo \
-I$(top_srcdir)/third_party/NordicSemiconductor/libraries/atomic \
-I$(top_srcdir)/third_party/NordicSemiconductor/libraries/block_dev \
-I$(top_srcdir)/third_party/NordicSemiconductor/libraries/delay \
-I$(top_srcdir)/third_party/NordicSemiconductor/libraries/usb \
-I$(top_srcdir)/third_party/NordicSemiconductor/libraries/usb/config \
+3 -1
View File
@@ -81,6 +81,7 @@ COMMONCPPFLAGS
-I$(top_srcdir)/third_party/NordicSemiconductor/libraries/app_error \
-I$(top_srcdir)/third_party/NordicSemiconductor/libraries/atfifo \
-I$(top_srcdir)/third_party/NordicSemiconductor/libraries/atomic \
-I$(top_srcdir)/third_party/NordicSemiconductor/libraries/block_dev \
-I$(top_srcdir)/third_party/NordicSemiconductor/libraries/delay \
-I$(top_srcdir)/third_party/NordicSemiconductor/libraries/usb \
-I$(top_srcdir)/third_party/NordicSemiconductor/libraries/usb/config \
@@ -318,7 +319,7 @@ noinst_HEADERS
$(top_srcdir)/third_party/NordicSemiconductor/cmsis/core_cmSimd.h \
$(top_srcdir)/third_party/NordicSemiconductor/dependencies/app_util_platform.h \
$(top_srcdir)/third_party/NordicSemiconductor/dependencies/app_util.h \
$(top_srcdir)/third_party/NordicSemiconductor/dependencies/apply_old_config.h \
$(top_srcdir)/third_party/NordicSemiconductor/dependencies/legacy/apply_old_config.h \
$(top_srcdir)/third_party/NordicSemiconductor/dependencies/nordic_common.h \
$(top_srcdir)/third_party/NordicSemiconductor/dependencies/nrf_assert.h \
$(top_srcdir)/third_party/NordicSemiconductor/dependencies/nrf_error.h \
@@ -400,6 +401,7 @@ noinst_HEADERS
$(top_srcdir)/third_party/NordicSemiconductor/libraries/atfifo/nrf_atfifo.h \
$(top_srcdir)/third_party/NordicSemiconductor/libraries/atomic/nrf_atomic_internal.h \
$(top_srcdir)/third_party/NordicSemiconductor/libraries/atomic/nrf_atomic.h \
$(top_srcdir)/third_party/NordicSemiconductor/libraries/block_dev/nrf_block_dev.h \
$(top_srcdir)/third_party/NordicSemiconductor/libraries/delay/nrf_delay.h \
$(top_srcdir)/third_party/NordicSemiconductor/libraries/usb/app_usbd_class_base.h \
$(top_srcdir)/third_party/NordicSemiconductor/libraries/usb/app_usbd_core.h \
+7 -7
View File
@@ -1,15 +1,15 @@
Description:
This folder consists of selected components from the nRF5 SDK, that are used
in process of building the OpenThread's nRF52840 platform.
in process of building the OpenThread's nRF528xx platform.
Directory consists of following folders:
- /cmsis - Core Peripheral Access Layer Headers files
- /dependencies - Dependencies for drivers and libraries from nrf5 SDK
- /drivers - Drivers for the nRF52840 that are used in the platform
- /libraries - Libraries for the nRF52840 chip
- /dependencies - Dependencies for drivers and libraries from nRF5 SDK
- /drivers - Drivers for the nRF528xx platform
- /libraries - Libraries for the nRF528xx platform
- /nrfx - Standalone drivers for peripherals present in Nordic SoCs (https://github.com/NordicSemiconductor/nrfx)
- /segger_rtt - Library for the RTT communication
- /segger_rtt - Configuration files for RTT communication
- /softdevice - SoftDevice s140 headers
The following changes comparing to the nRF5 SDK 15.2 have been incorporated:
- modified nrf_log_ctrl.h file in order to remove unused backend logging functions
The following changes comparing to the nRF5 SDK 16.0 have been incorporated:
- modified nrf_log module files in order to remove unused backend logging functions
+18 -2
View File
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2012 - 2018, Nordic Semiconductor ASA
* Copyright (c) 2012 - 2019, Nordic Semiconductor ASA
*
* All rights reserved.
*
@@ -129,6 +129,15 @@ extern uint32_t __etext;
*/
/* lint -restore */
#if defined(MBR_PRESENT) || defined(SOFTDEVICE_PRESENT)
#include "nrf_mbr.h"
#define BOOTLOADER_ADDRESS ((*(uint32_t *)MBR_BOOTLOADER_ADDR) == 0xFFFFFFFF ? *MBR_UICR_BOOTLOADER_ADDR : *(uint32_t *)MBR_BOOTLOADER_ADDR) /**< The currently configured start address of the bootloader. If 0xFFFFFFFF, no bootloader start address is configured. */
#define MBR_PARAMS_PAGE_ADDRESS ((*(uint32_t *)MBR_PARAM_PAGE_ADDR) == 0xFFFFFFFF ? *MBR_UICR_PARAM_PAGE_ADDR : *(uint32_t *)MBR_PARAM_PAGE_ADDR) /**< The currently configured address of the MBR params page. If 0xFFFFFFFF, no MBR params page address is configured. */
#else
#define BOOTLOADER_ADDRESS (NRF_UICR->NRFFW[0]) /**< Check UICR, just in case. */
#define MBR_PARAMS_PAGE_ADDRESS (NRF_UICR->NRFFW[1]) /**< Check UICR, just in case. */
#endif
enum
{
UNIT_0_625_MS = 625, /**< Number of microseconds in 0.625 milliseconds. */
@@ -203,9 +212,14 @@ enum
#ifndef __LINT__
#ifdef __GNUC__
#ifdef __cplusplus
#define STATIC_ASSERT_SIMPLE(EXPR) extern char (*_do_assert(void)) [sizeof(char[1 - 2*!(EXPR)])]
#define STATIC_ASSERT_MSG(EXPR, MSG) extern char (*_do_assert(void)) [sizeof(char[1 - 2*!(EXPR)])]
#else
#define STATIC_ASSERT_SIMPLE(EXPR) _Static_assert(EXPR, "unspecified message")
#define STATIC_ASSERT_MSG(EXPR, MSG) _Static_assert(EXPR, MSG)
#endif
#endif
#ifdef __CC_ARM
#define STATIC_ASSERT_SIMPLE(EXPR) extern char (*_do_assert(void)) [sizeof(char[1 - 2*!(EXPR)])]
@@ -775,7 +789,8 @@ typedef struct
* @return All arguments processed by given macro
*/
#define MACRO_MAP_FOR(...) MACRO_MAP_FOR_(__VA_ARGS__)
#define MACRO_MAP_FOR_N_LIST 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15
#define MACRO_MAP_FOR_N_LIST 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, \
19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32
#define MACRO_MAP_FOR_(...) MACRO_MAP_FOR_N(NUM_VA_ARGS_LESS_1(__VA_ARGS__), __VA_ARGS__)
/**
@@ -1177,6 +1192,7 @@ static __INLINE uint8_t uint16_big_encode(uint16_t value, uint8_t * p_encoded_da
*
* @param[in] value Value to be encoded.
* @param[out] p_encoded_data Buffer where the encoded data will be written.
* The address pointed to must be word alligned.
*
* @return Number of bytes written.
*/
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2014 - 2018, Nordic Semiconductor ASA
* Copyright (c) 2014 - 2019, Nordic Semiconductor ASA
*
* All rights reserved.
*
@@ -71,7 +71,7 @@ void app_util_critical_region_enter(uint8_t *p_nested)
/* return value can be safely ignored */
(void) sd_nvic_critical_region_enter(p_nested);
#else
(void)p_nested;
UNUSED_PARAMETER(p_nested);
app_util_disable_irq();
#endif
}
@@ -86,8 +86,8 @@ void app_util_critical_region_exit(uint8_t nested)
/* return value can be safely ignored */
(void) sd_nvic_critical_region_exit(nested);
#else
UNUSED_PARAMETER(nested);
app_util_enable_irq();
(void)nested;
#endif
}
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2014 - 2018, Nordic Semiconductor ASA
* Copyright (c) 2014 - 2019, Nordic Semiconductor ASA
*
* All rights reserved.
*
@@ -68,6 +68,7 @@ extern "C" {
#define _PRIO_APP_HIGH 1
#define _PRIO_APP_MID 1
#define _PRIO_SD_LOW 2
#define _PRIO_APP_LOW_MID 3
#define _PRIO_APP_LOW 3
#define _PRIO_APP_LOWEST 3
#define _PRIO_THREAD 4
@@ -77,7 +78,7 @@ extern "C" {
#define _PRIO_APP_HIGH 2
#define _PRIO_APP_MID 3
#define _PRIO_SD_LOW 4
#define _PRIO_SD_LOWEST 5
#define _PRIO_APP_LOW_MID 5
#define _PRIO_APP_LOW 6
#define _PRIO_APP_LOWEST 7
#define _PRIO_THREAD 15
@@ -101,6 +102,7 @@ typedef enum
#else
APP_IRQ_PRIORITY_MID = _PRIO_APP_MID,
#endif
APP_IRQ_PRIORITY_LOW_MID = _PRIO_APP_LOW_MID,
APP_IRQ_PRIORITY_LOW = _PRIO_APP_LOW,
APP_IRQ_PRIORITY_LOWEST = _PRIO_APP_LOWEST,
APP_IRQ_PRIORITY_THREAD = _PRIO_THREAD /**< "Interrupt level" when running in Thread Mode. */
@@ -1,30 +1,30 @@
/**
* Copyright (c) 2017 - 2018, Nordic Semiconductor ASA
*
* Copyright (c) 2017 - 2019, Nordic Semiconductor ASA
*
* 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
@@ -35,7 +35,7 @@
* 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.
*
*
*/
@@ -76,10 +76,16 @@
//------------------------------------------------------------------------------
// CLOCK
#if defined(CLOCK_ENABLED)
#if defined(NRF_CLOCK_ENABLED)
#if defined(CLOCK_CONFIG_LF_CAL_ENABLED) && defined(CLOCK_CONFIG_LF_SRC)
#if (CLOCK_CONFIG_LF_SRC == CLOCK_LFCLKSRC_SRC_RC)
#define NRFX_CLOCK_CONFIG_LF_CAL_ENABLED 1
#endif
#endif
#undef NRFX_CLOCK_ENABLED
#define NRFX_CLOCK_ENABLED CLOCK_ENABLED
#define NRFX_CLOCK_ENABLED NRF_CLOCK_ENABLED
#if defined(CLOCK_CONFIG_LF_SRC)
#undef NRFX_CLOCK_CONFIG_LF_SRC
@@ -107,7 +113,7 @@
#define NRFX_CLOCK_CONFIG_DEBUG_COLOR CLOCK_CONFIG_DEBUG_COLOR
#endif
#endif // defined(CLOCK_ENABLED)
#endif // defined(NRF_CLOCK_ENABLED)
//------------------------------------------------------------------------------
// COMP
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2008 - 2018, Nordic Semiconductor ASA
* Copyright (c) 2008 - 2019, Nordic Semiconductor ASA
*
* All rights reserved.
*
+1 -1
View File
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2006 - 2018, Nordic Semiconductor ASA
* Copyright (c) 2006 - 2019, Nordic Semiconductor ASA
*
* All rights reserved.
*
+10 -10
View File
@@ -1,30 +1,30 @@
/**
* Copyright (c) 2016 - 2018, Nordic Semiconductor ASA
*
* Copyright (c) 2016 - 2019, Nordic Semiconductor ASA
*
* 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
@@ -35,7 +35,7 @@
* 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 NRF_SECTION_H__
#define NRF_SECTION_H__
+10 -10
View File
@@ -1,30 +1,30 @@
/**
* Copyright (c) 2017 - 2018, Nordic Semiconductor ASA
*
* Copyright (c) 2017 - 2019, Nordic Semiconductor ASA
*
* 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
@@ -35,7 +35,7 @@
* 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 NRFX_CONFIG_H__
+10 -10
View File
@@ -1,30 +1,30 @@
/**
* Copyright (c) 2017 - 2019, Nordic Semiconductor ASA
*
*
* 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
@@ -35,7 +35,7 @@
* 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 NRFX_GLUE_H__
@@ -54,7 +54,7 @@ extern "C" {
* the needs of the host environment into which @em nrfx is integrated.
*/
#include <apply_old_config.h>
#include <legacy/apply_old_config.h>
#include <soc/nrfx_irqs.h>
+10 -10
View File
@@ -1,30 +1,30 @@
/**
* Copyright (c) 2017 - 2018, Nordic Semiconductor ASA
*
* Copyright (c) 2017 - 2019, Nordic Semiconductor ASA
*
* 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
@@ -35,7 +35,7 @@
* 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 NRFX_LOG_H__
+1 -1
View File
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2013 - 2018, Nordic Semiconductor ASA
* Copyright (c) 2013 - 2019, Nordic Semiconductor ASA
*
* All rights reserved.
*
+16 -7
View File
@@ -36,24 +36,33 @@
#define APP_USBD_PID 0xCAFE
#endif
// <o> APP_USBD_DEVICE_VER_MAJOR - Device version, major part <0-99>
// <o> APP_USBD_DEVICE_VER_MAJOR - Major device version <0-99>
// <i> Device version, will be converted automatically to BCD notation. Use just decimal values.
// <i> Major device version, will be converted automatically to BCD notation. Use just decimal values.
#ifndef APP_USBD_DEVICE_VER_MAJOR
#define APP_USBD_DEVICE_VER_MAJOR 1
#endif
// <o> APP_USBD_DEVICE_VER_MINOR - Device version, minor part <0-99>
// <o> APP_USBD_DEVICE_VER_MINOR - Minor device version <0-9>
// <i> Device version, will be converted automatically to BCD notation. Use just decimal values.
// <i> Minor device version, will be converted automatically to BCD notation. Use just decimal values.
#ifndef APP_USBD_DEVICE_VER_MINOR
#define APP_USBD_DEVICE_VER_MINOR 0
#endif
// <o> APP_USBD_DEVICE_VER_SUB - Sub-minor device version <0-9>
// <i> Sub-minor device version, will be converted automatically to BCD notation. Use just decimal values.
#ifndef APP_USBD_DEVICE_VER_SUB
#define APP_USBD_DEVICE_VER_SUB 0
#endif
// <q> APP_USBD_CONFIG_SELF_POWERED - Self powered
@@ -559,10 +568,10 @@
// </h>
//==========================================================
// <e> CLOCK_ENABLED - nrf_drv_clock - CLOCK peripheral driver
// <e> NRF_CLOCK_ENABLED - nrf_drv_clock - CLOCK peripheral driver
//==========================================================
#ifndef CLOCK_ENABLED
#define CLOCK_ENABLED 1
#ifndef NRF_CLOCK_ENABLED
#define NRF_CLOCK_ENABLED 1
#endif
// <o> CLOCK_CONFIG_XTAL_FREQ - HF XTAL Frequency
+2 -1
View File
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2013 - 2018, Nordic Semiconductor ASA
* Copyright (c) 2013 - 2019, Nordic Semiconductor ASA
*
* All rights reserved.
*
@@ -93,6 +93,7 @@ extern "C" {
#define NRF_ERROR_GAZELLE_ERR_BASE (0x8300) /**< Base address for Gazelle related errors. */
#define NRF_ERROR_BLE_IPSP_ERR_BASE (0x8400) /**< Base address for BLE IPSP related errors. */
#define NRF_ERROR_CRYPTO_ERR_BASE (0x8500) /**< Base address for crypto related errors. */
#define NRF_ERROR_FDS_ERR_BASE (0x8600) /**< Base address for FDS related errors. */
/** @} */
+10 -1
View File
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2013 - 2018, Nordic Semiconductor ASA
* Copyright (c) 2013 - 2019, Nordic Semiconductor ASA
*
* All rights reserved.
*
@@ -190,6 +190,15 @@ do \
#define VERIFY_MODULE_INITIALIZED_VOID() VERIFY_TRUE_VOID((MODULE_INITIALIZED))
/**@brief Macro for verifying that the module is initialized. It will cause the exterior function to
* return false if not.
*
* @note MODULE_INITIALIZED must be defined in each module using this macro. MODULE_INITIALIZED
* should be true if the module is initialized, false if not.
*/
#define VERIFY_MODULE_INITIALIZED_BOOL() VERIFY_TRUE((MODULE_INITIALIZED), false)
/**@brief Macro for verifying that the module is initialized. It will cause the exterior function to
* return if not.
*
+1 -1
View File
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2013 - 2018, Nordic Semiconductor ASA
* Copyright (c) 2013 - 2019, Nordic Semiconductor ASA
*
* All rights reserved.
*
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2015 - 2018, Nordic Semiconductor ASA
* Copyright (c) 2015 - 2019, Nordic Semiconductor ASA
*
* All rights reserved.
*
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2016 - 2018, Nordic Semiconductor ASA
* Copyright (c) 2016 - 2019, Nordic Semiconductor ASA
*
* All rights reserved.
*
@@ -41,6 +41,8 @@
#include <nordic_common.h>
#include "nrf_drv_clock.h"
#if NRF_MODULE_ENABLED(NRF_CLOCK)
#ifdef SOFTDEVICE_PRESENT
#include "nrf_sdh.h"
#include "nrf_sdh_soc.h"
@@ -599,3 +601,5 @@ NRF_SDH_STATE_OBSERVER(m_sd_state_observer, CLOCK_CONFIG_STATE_OBSERVER_PRIO) =
#undef NRF_CLOCK_LFCLK_RC
#undef NRF_CLOCK_LFCLK_Xtal
#undef NRF_CLOCK_LFCLK_Synth
#endif // NRF_MODULE_ENABLED(NRF_CLOCK)
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2016 - 2018, Nordic Semiconductor ASA
* Copyright (c) 2016 - 2019, Nordic Semiconductor ASA
*
* All rights reserved.
*
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2015 - 2018, Nordic Semiconductor ASA
* Copyright (c) 2015 - 2019, Nordic Semiconductor ASA
*
* All rights reserved.
*
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2017 - 2018, Nordic Semiconductor ASA
* Copyright (c) 2017 - 2019, Nordic Semiconductor ASA
*
* All rights reserved.
*
@@ -67,11 +67,12 @@ bool nrf_drv_power_init_check(void)
ret_code_t nrf_drv_power_init(nrf_drv_power_config_t const * p_config)
{
#ifdef SOFTDEVICE_PRESENT
if (m_initialized)
{
return NRF_ERROR_MODULE_ALREADY_INITIALIZED;
}
#ifdef SOFTDEVICE_PRESENT
if (nrf_sdh_is_enabled())
{
return NRF_ERROR_INVALID_STATE;
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2017 - 2018, Nordic Semiconductor ASA
* Copyright (c) 2017 - 2019, Nordic Semiconductor ASA
*
* All rights reserved.
*
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2016 - 2018, Nordic Semiconductor ASA
* Copyright (c) 2016 - 2019, Nordic Semiconductor ASA
*
* All rights reserved.
*
+39 -1
View File
@@ -1,4 +1,42 @@
/*$$$LICENCE_NORDIC_STANDARD<2016>$$$*/
/**
* Copyright (c) 2016 - 2019, Nordic Semiconductor ASA
*
* 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 NRF_DRV_USBD_H__
#define NRF_DRV_USBD_H__
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2011 - 2018, Nordic Semiconductor ASA
* Copyright (c) 2011 - 2019, Nordic Semiconductor ASA
*
* All rights reserved.
*
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2011 - 2018, Nordic Semiconductor ASA
* Copyright (c) 2011 - 2019, Nordic Semiconductor ASA
*
* All rights reserved.
*
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2011 - 2018, Nordic Semiconductor ASA
* Copyright (c) 2011 - 2019, Nordic Semiconductor ASA
*
* All rights reserved.
*
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2018, Nordic Semiconductor ASA
* Copyright (c) 2018 - 2019, Nordic Semiconductor ASA
*
* All rights reserved.
*
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2016 - 2018, Nordic Semiconductor ASA
* Copyright (c) 2016 - 2019, Nordic Semiconductor ASA
*
* All rights reserved.
*
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2016 - 2018, Nordic Semiconductor ASA
* Copyright (c) 2016 - 2019, Nordic Semiconductor ASA
*
* All rights reserved.
*
@@ -0,0 +1,352 @@
/**
* Copyright (c) 2016 - 2019, Nordic Semiconductor ASA
*
* 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 NRF_BLOCK_DEV_H__
#define NRF_BLOCK_DEV_H__
#ifdef __cplusplus
extern "C" {
#endif
#include "sdk_common.h"
#include "nrf_assert.h"
#include <stddef.h>
/**@file
*
* @defgroup nrf_block_dev Block device
* @{
* @ingroup app_common
*
* @brief This module implements unified block device API. It could used as a middle layer between
* filesystems and memories.
*/
/**
* @brief Block device request descriptor item.
*/
typedef struct {
uint32_t blk_id; //!< Block ID
uint32_t blk_count; //!< Block count
void * p_buff; //!< Data buffer
} nrf_block_req_t;
/**
* @brief Helper macro to create block device read/write request item
*
* @param name Instance name
* @param block_start Block number start
* @param block_count Number of blocks
* @param buff Buffer to read/write
*/
#define NRF_BLOCK_DEV_REQUEST(name, block_start, block_count, buff) \
nrf_block_req_t name = { \
.blk_id = block_start, \
.blk_count = block_count, \
.p_buff = buff, \
}
/**
* @brief Block device events.
*
* Events are propagated when event handler is defined (@ref nrf_blk_dev_init)
*
*/
typedef enum {
NRF_BLOCK_DEV_EVT_INIT, /**< Passed to event handler when init is done*/
NRF_BLOCK_DEV_EVT_UNINIT, /**< Passed to event handler when uninit is done*/
NRF_BLOCK_DEV_EVT_BLK_READ_DONE, /**< Passed to event handler block read operation is done*/
NRF_BLOCK_DEV_EVT_BLK_WRITE_DONE, /**< Passed to event handler block write operation is done*/
} nrf_block_dev_event_type_t;
typedef enum {
NRF_BLOCK_DEV_RESULT_SUCCESS = 0, /**< Operation completed succsefully*/
NRF_BLOCK_DEV_RESULT_IO_ERROR, /**< I/O error*/
NRF_BLOCK_DEV_RESULT_TIMEOUT, /**< Device timeout*/
} nrf_block_dev_result_t;
/**
* @brief Block device event
* */
typedef struct {
nrf_block_dev_event_type_t ev_type; //!< Event type
nrf_block_dev_result_t result; //!< Operation status
nrf_block_req_t const * p_blk_req; //!< Block request
void const * p_context; //!< Event context
} nrf_block_dev_event_t;
struct nrf_block_dev_s;
/**
* @brief Block device event handler.
*
* @param[in] p_blk_dev Block device handle
* @param[in] p_event Block device event
*/
typedef void (* nrf_block_dev_ev_handler)(struct nrf_block_dev_s const * p_blk_dev,
nrf_block_dev_event_t const * p_event);
/**
* @brief Block device geometry
*/
typedef struct {
uint32_t blk_count; //!< Block count
uint32_t blk_size; //!< Block size
} nrf_block_dev_geometry_t;
/**
* @brief Block device information strings
*/
typedef struct {
const char * p_vendor; //!< Vendor string
const char * p_product; //!< Product string
const char * p_revision; //!< Revision string
} nrf_block_dev_info_strings_t;
/**
* @brief Block device information config
*
* @param vendor Vendor string
* @param product Product string
* @param revision Revision string
* */
#define NFR_BLOCK_DEV_INFO_CONFIG(vendor, product, revision) ( { \
.p_vendor = vendor, \
.p_product = product, \
.p_revision = revision, \
})
/**
* @brief Empty info string initializer
* */
#define NFR_BLOCK_DEV_INFO_CONFIG_EMPTY \
NFR_BLOCK_DEV_INFO_CONFIG(NULL, NULL, NULL)
/**
* @brief Block device IOCTL requests
*/
typedef enum {
NRF_BLOCK_DEV_IOCTL_REQ_CACHE_FLUSH = 0, /**< Cache flush IOCTL request*/
NRF_BLOCK_DEV_IOCTL_REQ_INFO_STRINGS, /**< Get info strings IOCTL request*/
} nrf_block_dev_ioctl_req_t;
/**
* @brief Helper macro to get block device address from specific instance
*
* @param instance Block device instance
* @param member Block device member name
* */
#define NRF_BLOCKDEV_BASE_ADDR(instance, member) &(instance).member
/**
* @brief Block device API
* */
typedef struct nrf_block_dev_s {
struct nrf_block_dev_ops_s {
/**
* @brief @ref nrf_blk_dev_init
*/
ret_code_t (*init)(struct nrf_block_dev_s const * p_blk_dev,
nrf_block_dev_ev_handler ev_handler,
void const * p_context);
/**
* @brief @ref nrf_blk_dev_uninit
*/
ret_code_t (*uninit)(struct nrf_block_dev_s const * p_blk_dev);
/**
* @brief @ref nrf_blk_dev_read_req
*/
ret_code_t (*read_req)(struct nrf_block_dev_s const * p_blk_dev,
nrf_block_req_t const * p_blk);
/**
* @brief @ref nrf_blk_dev_write_req
*/
ret_code_t (*write_req)(struct nrf_block_dev_s const * p_blk_dev,
nrf_block_req_t const * p_blk);
/**
* @brief @ref nrf_blk_dev_ioctl
*/
ret_code_t (*ioctl)(struct nrf_block_dev_s const * p_blk_dev,
nrf_block_dev_ioctl_req_t req,
void * p_data);
/**
* @brief @ref nrf_blk_dev_geometry
*/
nrf_block_dev_geometry_t const * (*geometry)(struct nrf_block_dev_s const * p_blk_dev);
} const * p_ops;
} nrf_block_dev_t;
/**
* @brief Internals of @ref nrf_block_dev_t
* */
typedef struct nrf_block_dev_ops_s nrf_block_dev_ops_t;
/**
* @brief Initializes a block device.
*
* @param[in] p_blk_dev Block device handle
* @param[in] ev_handler Event handler (pass NULL to work in synchronous mode)
* @param[in] p_context Context passed to event handler
*
* @return Standard error code
*/
static inline ret_code_t nrf_blk_dev_init(nrf_block_dev_t const * p_blk_dev,
nrf_block_dev_ev_handler ev_handler,
void const * p_context)
{
ASSERT(p_blk_dev->p_ops->init);
return p_blk_dev->p_ops->init(p_blk_dev, ev_handler, p_context);
}
/**
* @brief Un-initializes a block device.
*
* @param[in] p_blk_dev Block device handle
*
* @return Standard error code
*/
static inline ret_code_t nrf_blk_dev_uninit(nrf_block_dev_t const * p_blk_dev)
{
ASSERT(p_blk_dev->p_ops->uninit);
return p_blk_dev->p_ops->uninit(p_blk_dev);
}
/**
* @brief Block read request.
*
* In synchronous mode this function will execute the read operation
* and wait for its completion. In asynchronous mode the function will only request
* the operation and return immediately. Then, the @ref NRF_BLOCK_DEV_EVT_BLK_READ_DONE
* event will signal that operation has been completed and the specified buffer contains
* valid data.
*
* @param[in] p_blk_dev Block device handle
* @param[in] p_blk Block device request
*
* @return Standard error code
*/
static inline ret_code_t nrf_blk_dev_read_req(nrf_block_dev_t const * p_blk_dev,
nrf_block_req_t const * p_blk)
{
ASSERT(p_blk_dev->p_ops->read_req);
ASSERT(p_blk_dev->p_ops->geometry);
if (p_blk->blk_id >= p_blk_dev->p_ops->geometry(p_blk_dev)->blk_count)
{
return NRF_ERROR_INVALID_PARAM;
}
return p_blk_dev->p_ops->read_req(p_blk_dev, p_blk);
}
/**
* @brief Block write request.
*
* In synchronous mode this function will execute the write operation
* and wait for its completion. In asynchronous mode the function will only request
* the operation and return immediately. Then, the @ref NRF_BLOCK_DEV_EVT_BLK_WRITE_DONE
* event will signal that operation has been completed and the specified buffer
* can be freed.
*
* @param[in] p_blk_dev Block device handle
* @param[in] p_blk Block device request
*
* @return Standard error code
*/
static inline ret_code_t nrf_blk_dev_write_req(nrf_block_dev_t const * p_blk_dev,
nrf_block_req_t const * p_blk)
{
ASSERT(p_blk_dev->p_ops->write_req);
ASSERT(p_blk_dev->p_ops->geometry);
if (p_blk->blk_id >= p_blk_dev->p_ops->geometry(p_blk_dev)->blk_count)
{
return NRF_ERROR_INVALID_PARAM;
}
return p_blk_dev->p_ops->write_req(p_blk_dev, p_blk);
}
/**
* @brief IO control function.
*
* @param[in] p_blk_dev Block device handle
* @param[in] req Block device ioctl request
* @param[in] p_data Block device ioctl data
*
* @return Standard error code
* */
static inline ret_code_t nrf_blk_dev_ioctl(nrf_block_dev_t const * p_blk_dev,
nrf_block_dev_ioctl_req_t req,
void * p_data)
{
ASSERT(p_blk_dev->p_ops->ioctl);
return p_blk_dev->p_ops->ioctl(p_blk_dev, req, p_data);
}
/**
* @brief Return a geometry of a block device.
*
* @param[in] p_blk_dev Block device handle
*
* @return Block size and count @ref nrf_block_dev_geometry_t
*/
static inline nrf_block_dev_geometry_t const *
nrf_blk_dev_geometry(nrf_block_dev_t const * p_blk_dev)
{
ASSERT(p_blk_dev->p_ops->geometry);
return p_blk_dev->p_ops->geometry(p_blk_dev);
}
/** @} */
#ifdef __cplusplus
}
#endif
#endif /* NRF_BLOCK_DEV_H__ */
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2011 - 2018, Nordic Semiconductor ASA
* Copyright (c) 2011 - 2019, Nordic Semiconductor ASA
*
* All rights reserved.
*
+1 -1
View File
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2016 - 2018, Nordic Semiconductor ASA
* Copyright (c) 2016 - 2019, Nordic Semiconductor ASA
*
* All rights reserved.
*
+1 -1
View File
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2017 - 2018, Nordic Semiconductor ASA
* Copyright (c) 2017 - 2019, Nordic Semiconductor ASA
*
* All rights reserved.
*
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2017 - 2018, Nordic Semiconductor ASA
* Copyright (c) 2017 - 2019, Nordic Semiconductor ASA
*
* All rights reserved.
*
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2016 - 2018, Nordic Semiconductor ASA
* Copyright (c) 2016 - 2019, Nordic Semiconductor ASA
*
* All rights reserved.
*
@@ -95,7 +95,7 @@ NRF_LOG_MODULE_REGISTER();
#define APP_USBD_CORE_DEVICE_DESCRIPTOR { \
.bLength = sizeof(app_usbd_descriptor_device_t), /* descriptor size */ \
.bDescriptorType = APP_USBD_DESCRIPTOR_DEVICE, /* descriptor type */ \
.bcdUSB = APP_USBD_BCD_VER_MAKE(2,0), /* USB BCD version: 2.0 */ \
.bcdUSB = APP_USBD_BCD_VER_MAKE(2,0,0), /* USB BCD version: 2.0 */ \
.bDeviceClass = 0, /* device class: 0 - specified by interface */ \
.bDeviceSubClass = 0, /* device subclass: 0 - specified by interface */ \
.bDeviceProtocol = 0, /* device protocol: 0 - specified by interface */ \
@@ -104,7 +104,8 @@ NRF_LOG_MODULE_REGISTER();
.idProduct = APP_USBD_PID, /* Product ID*/ \
.bcdDevice = APP_USBD_BCD_VER_MAKE( /* Device version BCD */ \
APP_USBD_DEVICE_VER_MAJOR, \
APP_USBD_DEVICE_VER_MINOR), \
APP_USBD_DEVICE_VER_MINOR, \
APP_USBD_DEVICE_VER_SUB), \
.iManufacturer = APP_USBD_STRING_ID_MANUFACTURER, /* String ID: manufacturer */ \
.iProduct = APP_USBD_STRING_ID_PRODUCT, /* String ID: product */ \
.iSerialNumber = APP_USBD_STRING_ID_SERIAL, /* String ID: serial */ \
@@ -508,7 +509,7 @@ static ret_code_t setup_endpoint_req_std(app_usbd_setup_evt_t const * p_setup_ev
nrf_drv_usbd_ep_t ep_addr = (nrf_drv_usbd_ep_t)(p_setup_ev->setup.wIndex.lb);
app_usbd_state_t usb_state = usbd_core_state_get();
switch (p_setup_ev->setup.bmRequest)
switch (p_setup_ev->setup.bRequest)
{
case APP_USBD_SETUP_STDREQ_GET_STATUS:
{
@@ -589,7 +590,7 @@ static ret_code_t setup_interface_req_std_handle(
if (app_usbd_setup_req_dir(p_setup_ev->setup.bmRequestType) == APP_USBD_SETUP_REQDIR_IN)
{
switch (p_setup_ev->setup.bmRequest)
switch (p_setup_ev->setup.bRequest)
{
case APP_USBD_SETUP_STDREQ_GET_STATUS:
{
@@ -617,7 +618,7 @@ static ret_code_t setup_interface_req_std_handle(
}
else /* APP_USBD_SETUP_REQDIR_OUT */
{
switch (p_setup_ev->setup.bmRequest)
switch (p_setup_ev->setup.bRequest)
{
case APP_USBD_SETUP_STDREQ_SET_INTERFACE:
{
@@ -679,12 +680,22 @@ static ret_code_t setup_device_req_get_descriptor(app_usbd_class_inst_t const *
{
case APP_USBD_DESCRIPTOR_DEVICE:
{
if(p_setup_ev->setup.wLength.w == 0)
{
return NRF_SUCCESS;
}
return app_usbd_core_setup_rsp(&(p_setup_ev->setup),
&m_device_dsc,
sizeof(m_device_dsc));
}
case APP_USBD_DESCRIPTOR_CONFIGURATION:
{
if(p_setup_ev->setup.wLength.w == 0)
{
return NRF_SUCCESS;
}
/* The size equals the size of configuration descriptor and all classes descriptors */
const size_t size = MIN(
sizeof(app_usbd_descriptor_configuration_t),
@@ -756,6 +767,11 @@ static ret_code_t setup_device_req_get_descriptor(app_usbd_class_inst_t const *
}
case APP_USBD_DESCRIPTOR_STRING:
{
if(p_setup_ev->setup.wLength.w == 0)
{
return NRF_SUCCESS;
}
app_usbd_string_desc_idx_t id =
(app_usbd_string_desc_idx_t)(p_setup_ev->setup.wValue.lb);
uint16_t langid = p_setup_ev->setup.wIndex.w;
@@ -853,7 +869,7 @@ static ret_code_t setup_device_req_std_handler(app_usbd_class_inst_t const * con
if (app_usbd_setup_req_dir(p_setup_ev->setup.bmRequestType) == APP_USBD_SETUP_REQDIR_IN)
{
switch (p_setup_ev->setup.bmRequest)
switch (p_setup_ev->setup.bRequest)
{
case APP_USBD_SETUP_STDREQ_GET_STATUS:
{
@@ -875,7 +891,7 @@ static ret_code_t setup_device_req_std_handler(app_usbd_class_inst_t const * con
}
else /* APP_USBD_SETUP_REQDIR_OUT */
{
switch (p_setup_ev->setup.bmRequest)
switch (p_setup_ev->setup.bRequest)
{
case APP_USBD_SETUP_STDREQ_SET_ADDRESS:
{
@@ -940,7 +956,7 @@ static inline ret_code_t app_usbd_core_setup_req_handler(app_usbd_class_inst_t c
NRF_LOG_DEBUG("SETUP: t: 0x%.2x r: 0x%.2x",
setup_ev.setup.bmRequestType,
setup_ev.setup.bmRequest);
setup_ev.setup.bRequest);
if (usb_core_ep0_handler_check())
{
NRF_LOG_WARNING("Previous setup not finished!");
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2016 - 2018, Nordic Semiconductor ASA
* Copyright (c) 2016 - 2019, Nordic Semiconductor ASA
*
* All rights reserved.
*
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2017 - 2018, Nordic Semiconductor ASA
* Copyright (c) 2017 - 2019, Nordic Semiconductor ASA
*
* All rights reserved.
*
@@ -85,7 +85,7 @@ ANON_UNIONS_ENABLE;
* @brief Descriptor types.
*
* Descriptor types used in two situations:
* - when processing @ref APP_USBD_SETUP_STDREQ_GET_DESCRIPTOR SETUP request,
* - When processing @ref APP_USBD_SETUP_STDREQ_GET_DESCRIPTOR SETUP request,
* the required descriptor type may be placed in wValue in HighByte.
* - As a descriptor identifier itself inside descriptor stream.
*
@@ -118,9 +118,9 @@ typedef enum
* Cannot be accessed by GetDescriptor or SetDescriptor
*/
APP_USBD_DESCRIPTOR_DEVICE_QUALIFIER = 6, /**< @note Not supported - used only in HighSpeed capable devices. */
APP_USBD_DESCRIPTOR_OTHER_SPEED_CONFIGURATION = 7, /**< @note Not supported - our USB implementation supports only one speed. */
APP_USBD_DESCRIPTOR_OTHER_SPEED_CONFIGURATION = 7, /**< @note Not supported - USB library supports only one speed. */
APP_USBD_DESCRIPTOR_INTERFACE_POWER = 8, /**< @note Not supported */
APP_USBD_DESCRIPTOR_OTG = 9, /**< @note Not supported - Our USB have not OTG functionality */
APP_USBD_DESCRIPTOR_OTG = 9, /**< @note Not supported - USB library does not have OTG functionality */
APP_USBD_DESCRIPTOR_DEBUG = 10, /**< Debug channel descriptor if available, can be only reached by GetDescriptor */
APP_USBD_DESCRIPTOR_INTERFACE_ASSOCIATION = 11, /**<
* Descriptor used to describe that two or more interfaces are associated to the same function.
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2016 - 2018, Nordic Semiconductor ASA
* Copyright (c) 2016 - 2019, Nordic Semiconductor ASA
*
* All rights reserved.
*
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2017 - 2018, Nordic Semiconductor ASA
* Copyright (c) 2017 - 2019, Nordic Semiconductor ASA
*
* All rights reserved.
*
@@ -110,7 +110,7 @@ static ret_code_t setup_req_std_in(app_usbd_class_inst_t const * p_inst,
/* Only Get Descriptor standard IN request is supported by DFU class */
if ((app_usbd_setup_req_rec(p_setup_ev->setup.bmRequestType) == APP_USBD_SETUP_REQREC_INTERFACE)
&&
(p_setup_ev->setup.bmRequest == APP_USBD_SETUP_STDREQ_GET_DESCRIPTOR))
(p_setup_ev->setup.bRequest == APP_USBD_SETUP_STDREQ_GET_DESCRIPTOR))
{
size_t dsc_len = 0;
size_t max_size;
@@ -146,7 +146,7 @@ static ret_code_t setup_req_std_out(app_usbd_class_inst_t const * p_inst,
app_usbd_setup_evt_t const * p_setup_ev)
{
switch (p_setup_ev->setup.bmRequest)
switch (p_setup_ev->setup.bRequest)
{
default:
break;
@@ -185,7 +185,7 @@ static ret_code_t setup_req_class_in(app_usbd_class_inst_t const * p_inst,
{
app_usbd_nrf_dfu_trigger_t const * p_dfu = nrf_dfu_trigger_get(p_inst);
switch (p_setup_ev->setup.bmRequest)
switch (p_setup_ev->setup.bRequest)
{
case APP_USBD_NRF_DFU_TRIGGER_REQ_NORDIC_INFO:
if (p_setup_ev->setup.wLength.w != sizeof(app_usbd_nrf_dfu_trigger_nordic_info_t))
@@ -224,7 +224,7 @@ static ret_code_t setup_req_class_out(app_usbd_class_inst_t const * p_inst,
app_usbd_nrf_dfu_trigger_t const * p_dfu = nrf_dfu_trigger_get(p_inst);
app_usbd_nrf_dfu_trigger_ctx_t * p_dfu_ctx = nrf_dfu_trigger_ctx_get(p_dfu);
switch (p_setup_ev->setup.bmRequest)
switch (p_setup_ev->setup.bRequest)
{
case APP_USBD_NRF_DFU_TRIGGER_REQ_DETACH:
{
@@ -370,4 +370,5 @@ const app_usbd_class_methods_t app_usbd_nrf_dfu_trigger_class_methods = {
.feed_descriptors = nrf_dfu_trigger_feed_descriptors,
};
#endif /* NRF_MODULE_ENABLED(APP_USBD_NRF_DFU_TRIGGER) */
#endif //NRF_MODULE_ENABLED(APP_USBD_NRF_DFU_TRIGGER)
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2017 - 2018, Nordic Semiconductor ASA
* Copyright (c) 2017 - 2019, Nordic Semiconductor ASA
*
* All rights reserved.
*
@@ -44,6 +44,7 @@
#include <stdbool.h>
#include "nrf_drv_usbd.h"
#include "nrf_block_dev.h"
#include "app_usbd_class_base.h"
#include "app_usbd.h"
#include "app_usbd_core.h"
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2017 - 2018, Nordic Semiconductor ASA
* Copyright (c) 2017 - 2019, Nordic Semiconductor ASA
*
* All rights reserved.
*
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2017 - 2018, Nordic Semiconductor ASA
* Copyright (c) 2017 - 2019, Nordic Semiconductor ASA
*
* All rights reserved.
*
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2016 - 2018, Nordic Semiconductor ASA
* Copyright (c) 2016 - 2019, Nordic Semiconductor ASA
*
* All rights reserved.
*
@@ -276,7 +276,7 @@ typedef union {
*/
typedef struct {
uint8_t bmRequestType; //!< Setup type bitfield
uint8_t bmRequest; //!< One of @ref app_usbd_setup_stdrequest_t values or class dependent one.
uint8_t bRequest; //!< One of @ref app_usbd_setup_stdrequest_t values or class dependent one.
app_usbd_setup_w_t wValue; //!< byte 2, 3
app_usbd_setup_w_t wIndex; //!< byte 4, 5
app_usbd_setup_w_t wLength; //!< byte 6, 7
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2018, Nordic Semiconductor ASA
* Copyright (c) 2018 - 2019, Nordic Semiconductor ASA
*
* All rights reserved.
*
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2018, Nordic Semiconductor ASA
* Copyright (c) 2018 - 2019, Nordic Semiconductor ASA
*
* All rights reserved.
*
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2016 - 2018, Nordic Semiconductor ASA
* Copyright (c) 2016 - 2019, Nordic Semiconductor ASA
*
* All rights reserved.
*
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2016 - 2018, Nordic Semiconductor ASA
* Copyright (c) 2016 - 2019, Nordic Semiconductor ASA
*
* All rights reserved.
*
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2016 - 2018, Nordic Semiconductor ASA
* Copyright (c) 2016 - 2019, Nordic Semiconductor ASA
*
* All rights reserved.
*
@@ -75,16 +75,17 @@ extern "C" {
* @brief Change given decimal version values to 4 digits in BCD notation.
*
* USB specification uses 4 digits BCD version notation in many descriptors.
* This macro changes 2 values to 4 BCD digits (one 16 bit value)
* This macro changes 3 values to 4 BCD digits (one 16 bit value)
* that describes version in USB standard.
*
* @param[in] major Major version.
* @param[in] minor Minor version.
* @param[in] sub Sub-minor version.
*
* @return Calculated 16 bit value with BCD representation of the version.
*/
#define APP_USBD_BCD_VER_MAKE(major, minor) \
((APP_USBD_BCD_2_MAKE(major) << 8) | APP_USBD_BCD_2_MAKE(minor))
#define APP_USBD_BCD_VER_MAKE(major, minor, sub) \
((APP_USBD_BCD_2_MAKE(major) << 8) | (minor) << 4 | (sub))
/**
* @brief Combine endpoint address and its interval.
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2016 - 2018, Nordic Semiconductor ASA
* Copyright (c) 2016 - 2019, Nordic Semiconductor ASA
*
* All rights reserved.
*
@@ -181,7 +181,7 @@ static ret_code_t setup_req_std_in(app_usbd_class_inst_t const * p_inst,
/* Only Get Descriptor standard IN request is supported by CDC class */
if ((app_usbd_setup_req_rec(p_setup_ev->setup.bmRequestType) == APP_USBD_SETUP_REQREC_INTERFACE)
&&
(p_setup_ev->setup.bmRequest == APP_USBD_SETUP_STDREQ_GET_DESCRIPTOR))
(p_setup_ev->setup.bRequest == APP_USBD_SETUP_STDREQ_GET_DESCRIPTOR))
{
size_t dsc_len = 0;
size_t max_size;
@@ -218,7 +218,7 @@ static ret_code_t setup_req_std_out(app_usbd_class_inst_t const * p_inst,
app_usbd_setup_evt_t const * p_setup_ev)
{
switch (p_setup_ev->setup.bmRequest)
switch (p_setup_ev->setup.bRequest)
{
default:
break;
@@ -241,7 +241,7 @@ static ret_code_t setup_req_class_in(app_usbd_class_inst_t const * p_inst,
app_usbd_cdc_acm_t const * p_cdc_acm = cdc_acm_get(p_inst);
app_usbd_cdc_acm_ctx_t * p_cdc_acm_ctx = cdc_acm_ctx_get(p_cdc_acm);
switch (p_setup_ev->setup.bmRequest)
switch (p_setup_ev->setup.bRequest)
{
case APP_USBD_CDC_REQ_GET_LINE_CODING:
{
@@ -317,7 +317,7 @@ static ret_code_t cdc_acm_req_out_datastage(app_usbd_class_inst_t const * p_inst
app_usbd_cdc_acm_t const * p_cdc_acm = cdc_acm_get(p_inst);
app_usbd_cdc_acm_ctx_t * p_cdc_acm_ctx = cdc_acm_ctx_get(p_cdc_acm);
p_cdc_acm_ctx->request.type = p_setup_ev->setup.bmRequest;
p_cdc_acm_ctx->request.type = p_setup_ev->setup.bRequest;
p_cdc_acm_ctx->request.len = p_setup_ev->setup.wLength.w;
/*Request setup data*/
@@ -377,7 +377,7 @@ static ret_code_t setup_req_class_out(app_usbd_class_inst_t const * p_inst,
app_usbd_cdc_acm_t const * p_cdc_acm = cdc_acm_get(p_inst);
app_usbd_cdc_acm_ctx_t * p_cdc_acm_ctx = cdc_acm_ctx_get(p_cdc_acm);
switch (p_setup_ev->setup.bmRequest)
switch (p_setup_ev->setup.bRequest)
{
case APP_USBD_CDC_REQ_SET_LINE_CODING:
{
@@ -1158,7 +1158,7 @@ ret_code_t app_usbd_cdc_acm_serial_state_notify(app_usbd_cdc_acm_t const *
notify->cdc_notify.bmRequestType = app_usbd_setup_req_val(APP_USBD_SETUP_REQREC_INTERFACE,
APP_USBD_SETUP_REQTYPE_CLASS,
APP_USBD_SETUP_REQDIR_IN);
notify->cdc_notify.bmRequest = APP_USBD_CDC_NOTIF_SERIAL_STATE;
notify->cdc_notify.bRequest = APP_USBD_CDC_NOTIF_SERIAL_STATE;
notify->cdc_notify.wValue = 0;
notify->cdc_notify.wIndex = 0;
notify->cdc_notify.wLength = sizeof(notify->serial_state);
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2017 - 2018, Nordic Semiconductor ASA
* Copyright (c) 2017 - 2019, Nordic Semiconductor ASA
*
* All rights reserved.
*
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2016 - 2018, Nordic Semiconductor ASA
* Copyright (c) 2016 - 2019, Nordic Semiconductor ASA
*
* All rights reserved.
*
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2016 - 2018, Nordic Semiconductor ASA
* Copyright (c) 2016 - 2019, Nordic Semiconductor ASA
*
* All rights reserved.
*
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2016 - 2018, Nordic Semiconductor ASA
* Copyright (c) 2016 - 2019, Nordic Semiconductor ASA
*
* All rights reserved.
*
@@ -313,7 +313,7 @@ typedef enum {
* */
typedef struct {
uint8_t bmRequestType; //!< Request type.
uint8_t bmRequest; //!< Request ID @ref app_usbd_cdc_req_id_t.
uint8_t bRequest; //!< Request ID @ref app_usbd_cdc_req_id_t.
uint16_t wValue; //!< Value field.
uint16_t wIndex; //!< Index field.
uint16_t wLength; //!< Length of payload following.
@@ -342,11 +342,11 @@ typedef enum {
* @brief Possible values of @ref app_usbd_cdc_line_coding_t::bParityType.
*/
typedef enum {
APP_USBD_CDC_LINE_PARITY_NONE = 0, /**< No parity. */
APP_USBD_CDC_LINE_PARITY_ODD = 1, /**< Odd parity. */
APP_USBD_CDC_LINE_PARITY_EVEN = 2, /**< Even parity. */
APP_USBD_CDC_LINE_PARITY_MARK = 3, /**< Parity forced to 0 (space).*/
APP_USBD_CDC_LINE_PARITY_SPACE = 4, /**< Parity forced to 1 (mark). */
APP_USBD_CDC_LINE_PARITY_NONE = 0, /**< No parity. */
APP_USBD_CDC_LINE_PARITY_ODD = 1, /**< Odd parity. */
APP_USBD_CDC_LINE_PARITY_EVEN = 2, /**< Even parity. */
APP_USBD_CDC_LINE_PARITY_MARK = 3, /**< Parity forced to 0 (mark). */
APP_USBD_CDC_LINE_PARITY_SPACE = 4, /**< Parity forced to 1 (space). */
} app_usbd_cdc_line_parity_t;
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2017 - 2018, Nordic Semiconductor ASA
* Copyright (c) 2017 - 2019, Nordic Semiconductor ASA
*
* All rights reserved.
*
@@ -37,10 +37,6 @@
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#include "nordic_common.h"
#if NRF_MODULE_ENABLED(APP_USBD_NRF_DFU_TRIGGER)
#include "nrf_dfu_trigger_usb.h"
#include "app_usbd.h"
#include "app_usbd_nrf_dfu_trigger.h"
@@ -53,11 +49,19 @@
#include "nrf_log.h"
NRF_LOG_MODULE_REGISTER();
#ifndef BSP_SELF_PINRESET_PIN
#error "This module is intended to be used with boards that have the GP pin shortened with the RESET pin."
#endif
/**
* @brief Enable power USB detection.
*
* Configure if the example supports USB port connection.
*/
#ifndef USBD_POWER_DETECTION
#define USBD_POWER_DETECTION true
#endif
#define DFU_FLASH_PAGE_SIZE (NRF_FICR->CODEPAGESIZE)
#define DFU_FLASH_PAGE_COUNT (NRF_FICR->CODESIZE)
@@ -237,6 +241,3 @@ ret_code_t nrf_dfu_trigger_usb_init(void)
return ret;
}
#endif /* NRF_MODULE_ENABLED(APP_USBD_NRF_DFU_TRIGGER) */
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2017 - 2018, Nordic Semiconductor ASA
* Copyright (c) 2017 - 2019, Nordic Semiconductor ASA
*
* All rights reserved.
*