mirror of
https://github.com/espressif/openthread.git
synced 2026-10-24 08:13:54 +00:00
[nrf528xx] separate transport from platform (#4673)
Transport-related functions for nrf528xx platform are moved to separated library.
This commit is contained in:
@@ -60,7 +60,6 @@ NRF52811_MBEDTLS_CPPFLAGS += -DMBEDTLS_USER_CONFIG_FILE='\"nrf52811-mbedtls-conf
|
||||
NRF52811_MBEDTLS_CPPFLAGS += -I$(AbsTopSourceDir)/third_party/mbedtls
|
||||
NRF52811_MBEDTLS_CPPFLAGS += -I$(AbsTopSourceDir)/third_party/mbedtls/repo/include
|
||||
NRF52811_MBEDTLS_CPPFLAGS += -I$(AbsTopSourceDir)/third_party/mbedtls/repo/include/mbedtls
|
||||
NRF52811_MBEDTLS_CPPFLAGS += -I$(AbsTopSourceDir)/third_party/NordicSemiconductor/libraries/crypto
|
||||
NRF52811_MBEDTLS_CPPFLAGS += -I$(AbsTopSourceDir)/third_party/NordicSemiconductor/libraries/nrf_security/mbedtls_plat_config
|
||||
NRF52811_MBEDTLS_CPPFLAGS += -I$(AbsTopSourceDir)/third_party/NordicSemiconductor/nrfx/mdk
|
||||
NRF52811_MBEDTLS_CPPFLAGS += -I$(AbsTopSourceDir)/third_party/NordicSemiconductor/cmsis
|
||||
|
||||
@@ -61,7 +61,6 @@ NRF52833_MBEDTLS_CPPFLAGS += -DMBEDTLS_USER_CONFIG_FILE='\"nrf52833-mbedtls-conf
|
||||
NRF52833_MBEDTLS_CPPFLAGS += -I$(AbsTopSourceDir)/third_party/mbedtls
|
||||
NRF52833_MBEDTLS_CPPFLAGS += -I$(AbsTopSourceDir)/third_party/mbedtls/repo/include
|
||||
NRF52833_MBEDTLS_CPPFLAGS += -I$(AbsTopSourceDir)/third_party/mbedtls/repo/include/mbedtls
|
||||
NRF52833_MBEDTLS_CPPFLAGS += -I$(AbsTopSourceDir)/third_party/NordicSemiconductor/libraries/crypto
|
||||
NRF52833_MBEDTLS_CPPFLAGS += -I$(AbsTopSourceDir)/third_party/NordicSemiconductor/libraries/nrf_security/mbedtls_plat_config
|
||||
NRF52833_MBEDTLS_CPPFLAGS += -I$(AbsTopSourceDir)/third_party/NordicSemiconductor/nrfx/mdk
|
||||
NRF52833_MBEDTLS_CPPFLAGS += -I$(AbsTopSourceDir)/third_party/NordicSemiconductor/cmsis
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
#
|
||||
|
||||
# Use automake includes since we cannot use SUBDIRS feature due to cleanup
|
||||
# errors - few targets may use the same source file but dependency file is
|
||||
# errors - few targets may use the same source file but dependency file is
|
||||
# created only once which leads to errors when auto-generated Makefile tries
|
||||
# to remove .Po files that were already removed
|
||||
|
||||
|
||||
@@ -31,6 +31,7 @@ include $(abs_top_nlbuild_autotools_dir)/automake/pre.am
|
||||
lib_LIBRARIES = \
|
||||
libopenthread-nrf52811.a \
|
||||
libopenthread-nrf52811-sdk.a \
|
||||
libopenthread-nrf52811-transport.a \
|
||||
$(NULL)
|
||||
|
||||
# Do not enable -pedantic-errors for nRF52811 driver library
|
||||
@@ -49,9 +50,9 @@ COMMONCPPFLAGS
|
||||
-I$(top_srcdir)/include \
|
||||
-I$(top_srcdir)/examples/platforms \
|
||||
-I$(top_srcdir)/examples/platforms/nrf528xx/src \
|
||||
-I$(top_srcdir)/examples/platforms/nrf528xx/src/transport \
|
||||
-I$(top_srcdir)/src/core \
|
||||
-I$(top_srcdir)/third_party/NordicSemiconductor/drivers/radio \
|
||||
-I$(top_srcdir)/third_party/NordicSemiconductor/drivers/radio/hal \
|
||||
-I$(top_srcdir)/third_party/NordicSemiconductor/drivers/radio/mac_features \
|
||||
-I$(top_srcdir)/third_party/NordicSemiconductor/drivers/radio/fem/three_pin_gpio \
|
||||
-I$(top_srcdir)/third_party/NordicSemiconductor/drivers/radio/mac_features/ack_generator \
|
||||
@@ -107,10 +108,14 @@ PLATFORM_COMMON_SOURCES
|
||||
src/logging.c \
|
||||
src/misc.c \
|
||||
src/radio.c \
|
||||
src/spi-slave.c \
|
||||
src/system.c \
|
||||
src/temp.c \
|
||||
src/uart.c \
|
||||
$(NULL)
|
||||
|
||||
TRANSPORT_SOURCES = \
|
||||
src/transport/spi-slave.c \
|
||||
src/transport/uart.c \
|
||||
src/transport/transport.c \
|
||||
$(NULL)
|
||||
|
||||
SINGLEPHY_SOURCES = \
|
||||
@@ -145,6 +150,14 @@ libopenthread_nrf52811_sdk_a_SOURCES
|
||||
$(SINGLEPHY_SOURCES) \
|
||||
$(NULL)
|
||||
|
||||
libopenthread_nrf52811_transport_a_CPPFLAGS = \
|
||||
$(COMMONCPPFLAGS) \
|
||||
$(NULL)
|
||||
|
||||
libopenthread_nrf52811_transport_a_SOURCES = \
|
||||
$(TRANSPORT_SOURCES) \
|
||||
$(NULL)
|
||||
|
||||
Dash = -
|
||||
|
||||
libopenthread_nrf52811_a_LIBADD = \
|
||||
@@ -154,4 +167,7 @@ libopenthread_nrf52811_a_LIBADD
|
||||
libopenthread_nrf52811_sdk_a_LIBADD = \
|
||||
$(shell find $(top_builddir)/examples/platforms/utils $(Dash)type f $(Dash)name "*.o")
|
||||
|
||||
libopenthread_nrf52811_transport_a_LIBADD = \
|
||||
$(shell find $(top_builddir)/examples/platforms/utils $(Dash)type f $(Dash)name "*.o")
|
||||
|
||||
include $(abs_top_nlbuild_autotools_dir)/automake/post.am
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
|
||||
LDADD_COMMON += \
|
||||
$(top_builddir)/examples/platforms/nrf528xx/libopenthread-nrf52811.a \
|
||||
$(top_builddir)/examples/platforms/nrf528xx/libopenthread-nrf52811-transport.a \
|
||||
$(top_builddir)/third_party/NordicSemiconductor/libnordicsemi-nrf52811-sdk.a \
|
||||
$(top_builddir)/third_party/NordicSemiconductor/libnordicsemi-nrf52811-radio-driver.a \
|
||||
$(NULL)
|
||||
|
||||
@@ -32,6 +32,7 @@ lib_LIBRARIES
|
||||
libopenthread-nrf52833.a \
|
||||
libopenthread-nrf52833-sdk.a \
|
||||
libopenthread-nrf52833-softdevice-sdk.a \
|
||||
libopenthread-nrf52833-transport.a \
|
||||
$(NULL)
|
||||
|
||||
# Do not enable -pedantic-errors for nRF52833 driver library
|
||||
@@ -50,10 +51,10 @@ COMMONCPPFLAGS
|
||||
-I$(top_srcdir)/include \
|
||||
-I$(top_srcdir)/examples/platforms \
|
||||
-I$(top_srcdir)/examples/platforms/nrf528xx/src \
|
||||
-I$(top_srcdir)/examples/platforms/nrf528xx/src/transport \
|
||||
-I$(top_srcdir)/src/core \
|
||||
-I$(top_srcdir)/third_party/NordicSemiconductor/drivers/radio \
|
||||
-I$(top_srcdir)/third_party/NordicSemiconductor/drivers/radio/fem/three_pin_gpio \
|
||||
-I$(top_srcdir)/third_party/NordicSemiconductor/drivers/radio/hal \
|
||||
-I$(top_srcdir)/third_party/NordicSemiconductor/drivers/radio/mac_features \
|
||||
-I$(top_srcdir)/third_party/NordicSemiconductor/drivers/radio/mac_features/ack_generator \
|
||||
-I$(top_srcdir)/third_party/NordicSemiconductor/drivers/radio/rsch \
|
||||
@@ -116,11 +117,15 @@ PLATFORM_COMMON_SOURCES
|
||||
src/logging.c \
|
||||
src/misc.c \
|
||||
src/radio.c \
|
||||
src/temp.c \
|
||||
src/spi-slave.c \
|
||||
src/system.c \
|
||||
src/uart.c \
|
||||
src/usb-cdc-uart.c \
|
||||
src/temp.c \
|
||||
$(NULL)
|
||||
|
||||
TRANSPORT_SOURCES = \
|
||||
src/transport/spi-slave.c \
|
||||
src/transport/uart.c \
|
||||
src/transport/usb-cdc-uart.c \
|
||||
src/transport/transport.c \
|
||||
$(NULL)
|
||||
|
||||
SINGLEPHY_SOURCES = \
|
||||
@@ -171,6 +176,14 @@ libopenthread_nrf52833_softdevice_sdk_a_SOURCES
|
||||
$(SOFTDEVICE_SOURCES) \
|
||||
$(NULL)
|
||||
|
||||
libopenthread_nrf52833_transport_a_CPPFLAGS = \
|
||||
$(COMMONCPPFLAGS) \
|
||||
$(NULL)
|
||||
|
||||
libopenthread_nrf52833_transport_a_SOURCES = \
|
||||
$(TRANSPORT_SOURCES) \
|
||||
$(NULL)
|
||||
|
||||
Dash = -
|
||||
|
||||
libopenthread_nrf52833_a_LIBADD = \
|
||||
@@ -183,4 +196,7 @@ libopenthread_nrf52833_sdk_a_LIBADD
|
||||
libopenthread_nrf52833_softdevice_sdk_a_LIBADD = \
|
||||
$(shell find $(top_builddir)/examples/platforms/utils $(Dash)type f $(Dash)name "*.o")
|
||||
|
||||
libopenthread_nrf52833_transport_a_LIBADD = \
|
||||
$(shell find $(top_builddir)/examples/platforms/utils $(Dash)type f $(Dash)name "*.o")
|
||||
|
||||
include $(abs_top_nlbuild_autotools_dir)/automake/post.am
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
|
||||
LDADD_COMMON += \
|
||||
$(top_builddir)/examples/platforms/nrf528xx/libopenthread-nrf52833.a \
|
||||
$(top_builddir)/examples/platforms/nrf528xx/libopenthread-nrf52833-transport.a \
|
||||
$(top_builddir)/third_party/NordicSemiconductor/libnordicsemi-nrf52833-sdk.a \
|
||||
$(top_builddir)/third_party/NordicSemiconductor/libnordicsemi-nrf52833-radio-driver.a \
|
||||
$(NULL)
|
||||
|
||||
@@ -32,6 +32,7 @@ lib_LIBRARIES
|
||||
libopenthread-nrf52840.a \
|
||||
libopenthread-nrf52840-sdk.a \
|
||||
libopenthread-nrf52840-softdevice-sdk.a \
|
||||
libopenthread-nrf52840-transport.a \
|
||||
$(NULL)
|
||||
|
||||
# Do not enable -pedantic-errors for nRF52840 driver library
|
||||
@@ -50,10 +51,10 @@ COMMONCPPFLAGS
|
||||
-I$(top_srcdir)/include \
|
||||
-I$(top_srcdir)/examples/platforms \
|
||||
-I$(top_srcdir)/examples/platforms/nrf528xx/src \
|
||||
-I$(top_srcdir)/examples/platforms/nrf528xx/src/transport \
|
||||
-I$(top_srcdir)/src/core \
|
||||
-I$(top_srcdir)/third_party/NordicSemiconductor/drivers/radio \
|
||||
-I$(top_srcdir)/third_party/NordicSemiconductor/drivers/radio/fem/three_pin_gpio \
|
||||
-I$(top_srcdir)/third_party/NordicSemiconductor/drivers/radio/hal \
|
||||
-I$(top_srcdir)/third_party/NordicSemiconductor/drivers/radio/mac_features \
|
||||
-I$(top_srcdir)/third_party/NordicSemiconductor/drivers/radio/mac_features/ack_generator \
|
||||
-I$(top_srcdir)/third_party/NordicSemiconductor/drivers/radio/rsch \
|
||||
@@ -116,11 +117,15 @@ PLATFORM_COMMON_SOURCES
|
||||
src/logging.c \
|
||||
src/misc.c \
|
||||
src/radio.c \
|
||||
src/spi-slave.c \
|
||||
src/system.c \
|
||||
src/temp.c \
|
||||
src/uart.c \
|
||||
src/usb-cdc-uart.c \
|
||||
$(NULL)
|
||||
|
||||
TRANSPORT_SOURCES = \
|
||||
src/transport/spi-slave.c \
|
||||
src/transport/uart.c \
|
||||
src/transport/usb-cdc-uart.c \
|
||||
src/transport/transport.c \
|
||||
$(NULL)
|
||||
|
||||
SINGLEPHY_SOURCES = \
|
||||
@@ -173,6 +178,14 @@ libopenthread_nrf52840_softdevice_sdk_a_SOURCES
|
||||
$(SOFTDEVICE_SOURCES) \
|
||||
$(NULL)
|
||||
|
||||
libopenthread_nrf52840_transport_a_CPPFLAGS = \
|
||||
$(COMMONCPPFLAGS) \
|
||||
$(NULL)
|
||||
|
||||
libopenthread_nrf52840_transport_a_SOURCES = \
|
||||
$(TRANSPORT_SOURCES) \
|
||||
$(NULL)
|
||||
|
||||
Dash = -
|
||||
|
||||
libopenthread_nrf52840_a_LIBADD = \
|
||||
@@ -185,4 +198,7 @@ libopenthread_nrf52840_sdk_a_LIBADD
|
||||
libopenthread_nrf52840_softdevice_sdk_a_LIBADD = \
|
||||
$(shell find $(top_builddir)/examples/platforms/utils $(Dash)type f $(Dash)name "*.o")
|
||||
|
||||
libopenthread_nrf52840_transport_a_LIBADD = \
|
||||
$(shell find $(top_builddir)/examples/platforms/utils $(Dash)type f $(Dash)name "*.o")
|
||||
|
||||
include $(abs_top_nlbuild_autotools_dir)/automake/post.am
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
|
||||
LDADD_COMMON += \
|
||||
$(top_builddir)/examples/platforms/nrf528xx/libopenthread-nrf52840.a \
|
||||
$(top_builddir)/examples/platforms/nrf528xx/libopenthread-nrf52840-transport.a \
|
||||
$(top_builddir)/third_party/NordicSemiconductor/libnordicsemi-nrf52840-sdk.a \
|
||||
$(top_builddir)/third_party/NordicSemiconductor/libnordicsemi-nrf52840-radio-driver.a \
|
||||
$(NULL)
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
/*
|
||||
* Copyright (c) 2020, The OpenThread Authors.
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file
|
||||
* This file includes the platform-specific transport initializers.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef PLATFORM_NRF5_TRANSPORT_H_
|
||||
#define PLATFORM_NRF5_TRANSPORT_H_
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
#include "platform-config.h"
|
||||
|
||||
/**
|
||||
* Initialization of transport.
|
||||
*
|
||||
*/
|
||||
void nrf5TransportInit(bool aPseudoReset);
|
||||
|
||||
/**
|
||||
* Deinitialization of transport.
|
||||
*
|
||||
*/
|
||||
void nrf5TransportDeinit(bool aPseudoReset);
|
||||
|
||||
/**
|
||||
* This function performs transport processing.
|
||||
*
|
||||
*/
|
||||
void nrf5TransportProcess(void);
|
||||
|
||||
#endif
|
||||
@@ -41,34 +41,6 @@
|
||||
|
||||
#include "platform-config.h"
|
||||
|
||||
/**
|
||||
* Initialization of UART driver.
|
||||
*
|
||||
*/
|
||||
void nrf5UartInit(void);
|
||||
|
||||
/**
|
||||
* Deinitialization of UART driver.
|
||||
*
|
||||
*/
|
||||
void nrf5UartDeinit(void);
|
||||
|
||||
/**
|
||||
* Clear pending UART data.
|
||||
*
|
||||
*/
|
||||
void nrf5UartClearPendingData(void);
|
||||
|
||||
/**
|
||||
* This function performs UART driver processing.
|
||||
*
|
||||
*/
|
||||
void nrf5UartProcess(void);
|
||||
|
||||
/**
|
||||
* Initialization of Alarm driver.
|
||||
*
|
||||
*/
|
||||
void nrf5AlarmInit(void);
|
||||
|
||||
/**
|
||||
@@ -119,23 +91,6 @@ void nrf5LogInit(void);
|
||||
*/
|
||||
void nrf5LogDeinit(void);
|
||||
|
||||
/**
|
||||
* Initialization of SPI Slave driver.
|
||||
*
|
||||
*/
|
||||
void nrf5SpiSlaveInit(void);
|
||||
|
||||
/**
|
||||
* Deinitialization of SPI Slave driver.
|
||||
*
|
||||
*/
|
||||
void nrf5SpiSlaveDeinit(void);
|
||||
|
||||
/**
|
||||
* Function for processing SPI Slave driver.
|
||||
*/
|
||||
void nrf5SpiSlaveProcess(void);
|
||||
|
||||
/**
|
||||
* Initialization of Misc module.
|
||||
*
|
||||
|
||||
@@ -39,6 +39,7 @@
|
||||
|
||||
#include "openthread-system.h"
|
||||
#include "platform-fem.h"
|
||||
#include "platform-nrf5-transport.h"
|
||||
#include "platform-nrf5.h"
|
||||
#include <nrf.h>
|
||||
#include <nrf_drv_clock.h>
|
||||
@@ -94,23 +95,11 @@ void otSysInit(int argc, char *argv[])
|
||||
nrf5RandomInit();
|
||||
if (!gPlatformPseudoResetWasRequested)
|
||||
{
|
||||
#if ((UART_AS_SERIAL_TRANSPORT == 1) || (USB_CDC_AS_SERIAL_TRANSPORT == 1))
|
||||
nrf5UartInit();
|
||||
#endif
|
||||
#if NRF52840_XXAA
|
||||
nrf5CryptoInit();
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
#if ((UART_AS_SERIAL_TRANSPORT == 1) || (USB_CDC_AS_SERIAL_TRANSPORT == 1))
|
||||
nrf5UartClearPendingData();
|
||||
#endif
|
||||
}
|
||||
|
||||
#if (SPIS_AS_SERIAL_TRANSPORT == 1)
|
||||
nrf5SpiSlaveInit();
|
||||
#endif
|
||||
nrf5TransportInit(gPlatformPseudoResetWasRequested);
|
||||
nrf5MiscInit();
|
||||
nrf5RadioInit();
|
||||
nrf5TempInit();
|
||||
@@ -127,18 +116,13 @@ void otSysDeinit(void)
|
||||
nrf5TempDeinit();
|
||||
nrf5RadioDeinit();
|
||||
nrf5MiscDeinit();
|
||||
#if (SPIS_AS_SERIAL_TRANSPORT == 1)
|
||||
nrf5SpiSlaveDeinit();
|
||||
#endif
|
||||
if (!gPlatformPseudoResetWasRequested)
|
||||
{
|
||||
#if NRF52840_XXAA
|
||||
nrf5CryptoDeinit();
|
||||
#endif
|
||||
#if ((UART_AS_SERIAL_TRANSPORT == 1) || (USB_CDC_AS_SERIAL_TRANSPORT == 1))
|
||||
nrf5UartDeinit();
|
||||
#endif
|
||||
}
|
||||
nrf5TransportDeinit(gPlatformPseudoResetWasRequested);
|
||||
nrf5RandomDeinit();
|
||||
nrf5AlarmDeinit();
|
||||
#if (OPENTHREAD_CONFIG_LOG_OUTPUT == OPENTHREAD_CONFIG_LOG_OUTPUT_PLATFORM_DEFINED) || \
|
||||
@@ -159,12 +143,7 @@ bool otSysPseudoResetWasRequested(void)
|
||||
void otSysProcessDrivers(otInstance *aInstance)
|
||||
{
|
||||
nrf5RadioProcess(aInstance);
|
||||
#if ((UART_AS_SERIAL_TRANSPORT == 1) || (USB_CDC_AS_SERIAL_TRANSPORT == 1))
|
||||
nrf5UartProcess();
|
||||
#endif
|
||||
#if (SPIS_AS_SERIAL_TRANSPORT == 1)
|
||||
nrf5SpiSlaveProcess();
|
||||
#endif
|
||||
nrf5TransportProcess();
|
||||
nrf5TempProcess();
|
||||
nrf5AlarmProcess(aInstance);
|
||||
}
|
||||
|
||||
+1
-1
@@ -36,10 +36,10 @@
|
||||
#include <utils/code_utils.h>
|
||||
#include <openthread/platform/spi-slave.h>
|
||||
|
||||
#include "platform-nrf5-transport.h"
|
||||
#include <hal/nrf_gpio.h>
|
||||
#include <nrfx.h>
|
||||
#include <nrfx_spis.h>
|
||||
#include <platform-nrf5.h>
|
||||
|
||||
#include "openthread-system.h"
|
||||
|
||||
@@ -0,0 +1,79 @@
|
||||
/*
|
||||
* Copyright (c) 2016, The OpenThread Authors.
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file
|
||||
* This file includes UART/USB and SPI driver initializers.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef TRANSPORT_DRIVERS_H_
|
||||
#define TRANSPORT_DRIVERS_H_
|
||||
|
||||
/**
|
||||
* Initialization of UART driver.
|
||||
*
|
||||
*/
|
||||
void nrf5UartInit(void);
|
||||
|
||||
/**
|
||||
* Deinitialization of UART driver.
|
||||
*
|
||||
*/
|
||||
void nrf5UartDeinit(void);
|
||||
|
||||
/**
|
||||
* Clear pending UART data.
|
||||
*
|
||||
*/
|
||||
void nrf5UartClearPendingData(void);
|
||||
|
||||
/**
|
||||
* This function performs UART driver processing.
|
||||
*
|
||||
*/
|
||||
void nrf5UartProcess(void);
|
||||
|
||||
/**
|
||||
* Initialization of SPI Slave driver.
|
||||
*
|
||||
*/
|
||||
void nrf5SpiSlaveInit(void);
|
||||
|
||||
/**
|
||||
* Deinitialization of SPI Slave driver.
|
||||
*
|
||||
*/
|
||||
void nrf5SpiSlaveDeinit(void);
|
||||
|
||||
/**
|
||||
* Function for processing SPI Slave driver.
|
||||
*/
|
||||
void nrf5SpiSlaveProcess(void);
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,79 @@
|
||||
/*
|
||||
* Copyright (c) 2020, The OpenThread Authors.
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file
|
||||
* This file implements the nrf5 platform transport initialization functions.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "platform-nrf5-transport.h"
|
||||
|
||||
#include "transport-drivers.h"
|
||||
|
||||
void nrf5TransportInit(bool aPseudoReset)
|
||||
{
|
||||
#if ((UART_AS_SERIAL_TRANSPORT == 1) || (USB_CDC_AS_SERIAL_TRANSPORT == 1))
|
||||
if (!aPseudoReset)
|
||||
{
|
||||
nrf5UartInit();
|
||||
}
|
||||
else
|
||||
{
|
||||
nrf5UartClearPendingData();
|
||||
}
|
||||
#endif
|
||||
|
||||
#if (SPIS_AS_SERIAL_TRANSPORT == 1)
|
||||
nrf5SpiSlaveInit();
|
||||
#endif
|
||||
}
|
||||
|
||||
void nrf5TransportDeinit(bool aPseudoReset)
|
||||
{
|
||||
#if ((UART_AS_SERIAL_TRANSPORT == 1) || (USB_CDC_AS_SERIAL_TRANSPORT == 1))
|
||||
if (!aPseudoReset)
|
||||
{
|
||||
nrf5UartDeinit();
|
||||
}
|
||||
#endif
|
||||
|
||||
#if (SPIS_AS_SERIAL_TRANSPORT == 1)
|
||||
nrf5SpiSlaveDeinit();
|
||||
#endif
|
||||
}
|
||||
|
||||
void nrf5TransportProcess(void)
|
||||
{
|
||||
#if ((UART_AS_SERIAL_TRANSPORT == 1) || (USB_CDC_AS_SERIAL_TRANSPORT == 1))
|
||||
nrf5UartProcess();
|
||||
#endif
|
||||
#if (SPIS_AS_SERIAL_TRANSPORT == 1)
|
||||
nrf5SpiSlaveProcess();
|
||||
#endif
|
||||
}
|
||||
+1
-1
@@ -44,7 +44,7 @@
|
||||
|
||||
#include "openthread-system.h"
|
||||
|
||||
#include "platform-nrf5.h"
|
||||
#include "platform-nrf5-transport.h"
|
||||
#include <hal/nrf_gpio.h>
|
||||
#include <hal/nrf_uart.h>
|
||||
#include <nrf_drv_clock.h>
|
||||
+1
-1
@@ -51,7 +51,7 @@
|
||||
#include <openthread/platform/misc.h>
|
||||
#include <openthread/platform/uart.h>
|
||||
|
||||
#include "platform-nrf5.h"
|
||||
#include "platform-nrf5-transport.h"
|
||||
|
||||
#include "app_usbd.h"
|
||||
#include "app_usbd_serial_num.h"
|
||||
-1
@@ -90,7 +90,6 @@ COMMONCPPFLAGS
|
||||
-I$(top_srcdir)/third_party/NordicSemiconductor/drivers/radio \
|
||||
-I$(top_srcdir)/third_party/NordicSemiconductor/drivers/radio/fem \
|
||||
-I$(top_srcdir)/third_party/NordicSemiconductor/drivers/radio/fem/three_pin_gpio \
|
||||
-I$(top_srcdir)/third_party/NordicSemiconductor/drivers/radio/hal \
|
||||
-I$(top_srcdir)/third_party/NordicSemiconductor/drivers/radio/rsch \
|
||||
-I$(top_srcdir)/third_party/NordicSemiconductor/drivers/radio/rsch/raal \
|
||||
-I$(top_srcdir)/third_party/NordicSemiconductor/drivers/radio/rsch/raal/softdevice \
|
||||
|
||||
Reference in New Issue
Block a user