diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d65f3fdf6..f4f2baa1d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -102,8 +102,7 @@ jobs: - name: Build run: | export PATH=/tmp/${{ matrix.gcc_extract_dir }}/bin:$PATH - script/test qpg6095 - script/test qpg6100 + script/test qpg6105 gcc-arm-none-linux-gnueabihf: name: gcc-arm-none-linux-gnueabihf-${{ matrix.gcc_ver }} diff --git a/CMakeLists.txt b/CMakeLists.txt index 9104e42c6..6a369b432 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -31,8 +31,6 @@ project(ot-qorvo VERSION 0.1.0) set(QORVO_PLATFORM_VALUES "gp712" - "qpg6095" - "qpg6100" "qpg6105" "qpg7015m" ) diff --git a/README.md b/README.md index 3a6bc78ec..b6ea99a12 100644 --- a/README.md +++ b/README.md @@ -7,11 +7,9 @@ # OpenThread on Qorvo Example -This repo contains example platform drivers for [Qorvo GP712][gp712], [Qorvo QPG6095][qpg6095], [Qorvo QPG6100][qpg6100], [Qorvo QPG6105][qpg6105] and [Qorvo QPG7015M][qpg7015m]. +This repo contains example platform drivers for [Qorvo GP712][gp712], [Qorvo QPG6105][qpg6105] and [Qorvo QPG7015M][qpg7015m]. [gp712]: https://www.qorvo.com/products/p/GP712 -[qpg6095]: https://www.qorvo.com/products/p/QPG6095 -[qpg6100]: https://www.qorvo.com/products/p/QPG6100 [qpg6105]: https://www.qorvo.com/products/p/QPG6105 [qpg7015m]: https://www.qorvo.com/products/p/QPG7015M diff --git a/script/build b/script/build index aa27faa1c..2576d8168 100755 --- a/script/build +++ b/script/build @@ -31,7 +31,7 @@ set -euxo pipefail OT_CMAKE_NINJA_TARGET=${OT_CMAKE_NINJA_TARGET:-} -QORVO_PLATFORMS=(gp712 qpg6095 qpg6100 qpg6105 qpg7015m) +QORVO_PLATFORMS=(gp712 qpg6105 qpg7015m) readonly QORVO_PLATFORMS OT_SRCDIR="$(pwd)" @@ -87,7 +87,7 @@ main() OT_CMAKE_NINJA_TARGET=("ot-rcp" "ot-cli-ftd" "ot-cli-mtd") options+=("-DCMAKE_TOOLCHAIN_FILE=src/${platform}/arm-linux-gnueabihf.cmake") ;; - qpg6095 | qpg6100 | qpg6105) + qpg6105) OT_CMAKE_NINJA_TARGET=("ot-cli-ftd" "ot-cli-mtd") options+=("-DCMAKE_TOOLCHAIN_FILE=src/${platform}/arm-none-eabi.cmake") ;; @@ -96,7 +96,7 @@ main() build -DQORVO_PLATFORM="${platform}" "${options[@]}" "${cmdline_options[@]}" case "${platform}" in - qpg6095 | qpg6100 | qpg6105) + qpg6105) find "${builddir}/bin" -type f -executable -not -name '*.*' -not -name "${platform}-*" \ -execdir sh -c 'x="$1"; arm-none-eabi-objcopy -O ihex "$1" "$2-$(basename ${x}).hex"' _ {} "${platform}" \; ;; diff --git a/script/test b/script/test index 255ff6ba2..f294ea7f2 100755 --- a/script/test +++ b/script/test @@ -29,7 +29,7 @@ set -euxo pipefail -QORVO_PLATFORMS=(gp712 qpg6095 qpg6100 qpg6105 qpg7015m) +QORVO_PLATFORMS=(gp712 qpg6105 qpg7015m) readonly QORVO_PLATFORMS OT_BUILDDIR="$(pwd)/build" diff --git a/src/qpg6095/CMakeLists.txt b/src/qpg6095/CMakeLists.txt deleted file mode 100644 index 385e2d88b..000000000 --- a/src/qpg6095/CMakeLists.txt +++ /dev/null @@ -1,146 +0,0 @@ -# -# 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. -# - -target_compile_definitions(ot-config INTERFACE - "MBEDTLS_USER_CONFIG_FILE=\"qpg6095-mbedtls-config.h\"" -) - -list(APPEND OT_PUBLIC_INCLUDES - "${CMAKE_CURRENT_SOURCE_DIR}/crypto" -) -set(OT_PUBLIC_INCLUDES ${OT_PUBLIC_INCLUDES} PARENT_SCOPE) - -if(OT_CFLAGS MATCHES "-pedantic-errors") - string(REPLACE "-pedantic-errors" "" OT_CFLAGS "${OT_CFLAGS}") -endif() - -if(OT_CFLAGS MATCHES "-Wno-c\\+\\+14-compat") - string(REPLACE "-Wno-c++14-compat" "" OT_CFLAGS "${OT_CFLAGS}") -endif() - -add_library(openthread-qpg6095-ftd - alarm.c - diag.c - entropy.c - logging.c - misc.c - platform.c - radio.c - settings.cpp - uart.c -) - -set_target_properties( - openthread-qpg6095-ftd - PROPERTIES - C_STANDARD 99 - CXX_STANDARD 11 -) - -target_link_libraries(openthread-qpg6095-ftd - PRIVATE - -Wl,--start-group - qpg6095-driver-ftd - ${OT_MBEDTLS} - ot-config - -Wl,--end-group - PUBLIC - -T${SDK_DIR}/qpg6095/ld/qpg6095.ld - -nostdlib - -Wl,--gc-sections - -Wl,-Map=$.map,--cref -) - -target_compile_definitions(openthread-qpg6095-ftd - PUBLIC - ${OT_PLATFORM_DEFINES} -) - -target_compile_options(openthread-qpg6095-ftd - PRIVATE - ${OT_CFLAGS} -) - -target_include_directories(openthread-qpg6095-ftd - PRIVATE - ${OT_PUBLIC_INCLUDES} - ${OPENTHREAD_DIR}/examples/platforms -) - - -add_library(openthread-qpg6095-mtd - alarm.c - diag.c - entropy.c - logging.c - misc.c - platform.c - radio.c - settings.cpp - uart.c -) - -set_target_properties( - openthread-qpg6095-mtd - PROPERTIES - C_STANDARD 99 - CXX_STANDARD 11 -) - -target_link_libraries(openthread-qpg6095-mtd - PRIVATE - -Wl,--start-group - qpg6095-driver-mtd - ${OT_MBEDTLS} - ot-config - -Wl,--end-group - PUBLIC - -T${SDK_DIR}/qpg6095/ld/qpg6095.ld - -nostdlib - -Wl,--gc-sections - -Wl,-Map=$.map,--cref -) - -target_compile_definitions(openthread-qpg6095-mtd - PUBLIC - ${OT_PLATFORM_DEFINES} -) - -target_compile_options(openthread-qpg6095-mtd - PRIVATE - ${OT_CFLAGS} -) - -target_include_directories(openthread-qpg6095-mtd - PRIVATE - ${OT_PUBLIC_INCLUDES} - ${OPENTHREAD_DIR}/examples/platforms -) - -target_include_directories(ot-config INTERFACE ${OT_PUBLIC_INCLUDES}) -target_compile_definitions(ot-config INTERFACE ${OT_PLATFORM_DEFINES}) diff --git a/src/qpg6095/alarm.c b/src/qpg6095/alarm.c deleted file mode 100644 index 9bab20321..000000000 --- a/src/qpg6095/alarm.c +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Copyright (c) 2019, 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 OpenThread platform abstraction for the alarm. - * - */ - -#include -#include - -#include "alarm_qorvo.h" -#include -#include -#include - -uint32_t otPlatAlarmMilliGetNow(void) -{ - return qorvoAlarmGetTimeMs(); -} - -static void qorvoAlarmMilliFired(void *aInstance) -{ - otPlatAlarmMilliFired((otInstance *)aInstance); -} - -void otPlatAlarmMilliStartAt(otInstance *aInstance, uint32_t t0, uint32_t dt) -{ - OT_UNUSED_VARIABLE(t0); - - qorvoAlarmStop((qorvoAlarmCallback_t)qorvoAlarmMilliFired, aInstance); - qorvoAlarmMilliStart(dt, qorvoAlarmMilliFired, aInstance); -} - -void otPlatAlarmMilliStop(otInstance *aInstance) -{ - qorvoAlarmStop((qorvoAlarmCallback_t)qorvoAlarmMilliFired, aInstance); -} - -uint32_t otPlatAlarmMicroGetNow(void) -{ - return qorvoAlarmGetTimeUs(); -} - -static void qorvoAlarmMicroFired(void *aInstance) -{ - otPlatAlarmMicroFired((otInstance *)aInstance); -} - -void otPlatAlarmMicroStartAt(otInstance *aInstance, uint32_t t0, uint32_t dt) -{ - OT_UNUSED_VARIABLE(t0); - - qorvoAlarmStop((qorvoAlarmCallback_t)qorvoAlarmMicroFired, aInstance); - qorvoAlarmMicroStart(dt, qorvoAlarmMicroFired, aInstance); -} - -void otPlatAlarmMicroStop(otInstance *aInstance) -{ - qorvoAlarmStop((qorvoAlarmCallback_t)qorvoAlarmMicroFired, aInstance); -} diff --git a/src/qpg6095/alarm_qorvo.h b/src/qpg6095/alarm_qorvo.h deleted file mode 100644 index 88a0dc7f5..000000000 --- a/src/qpg6095/alarm_qorvo.h +++ /dev/null @@ -1,96 +0,0 @@ -/* - * Copyright (c) 2019, 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 declarations of the Alarm functions from the Qorvo library. - * - */ - -#ifndef ALARM_QORVO_H_ -#define ALARM_QORVO_H_ - -#include -#include -#include -#include - -typedef void (*qorvoAlarmCallback_t)(void *); - -/** - * This function initializes the alarm service used by OpenThread. - * - */ -void qorvoAlarmInit(void); - -/** - * This function retrieves the current host time in milliseconds. - * - * @param[out] The current time in ms. - * - */ -uint32_t qorvoAlarmGetTimeMs(void); - -/** - * This function retrieves the current host time in microseconds. - * - * @param[out] The current time in us. - * - */ -uint32_t qorvoAlarmGetTimeUs(void); - -/** - * This function schedules a callback after a relative amount of time. - * - * @param[in] rel_time The relative time in ms. - * @param[in] callback A callback function which will be called. - * @param[in] arg A context pointer which will be passed as an argument to the callback. - * - */ -void qorvoAlarmMilliStart(uint32_t rel_time, qorvoAlarmCallback_t callback, void *arg); - -/** - * This function schedules a callback after a relative amount of time. - * - * @param[in] rel_time The relative time in us. - * @param[in] callback A callback function which will be called. - * @param[in] arg A context pointer which will be passed as an argument to the callback. - * - */ -void qorvoAlarmMicroStart(uint32_t rel_time, qorvoAlarmCallback_t callback, void *arg); - -/** - * This function unschedules the callback. - * - * @param[in] callback A callback function which will be removed from the list. - * @param[in] arg A context pointer which will be passed as an argument to the callback. - * - */ -bool qorvoAlarmStop(qorvoAlarmCallback_t callback, void *arg); - -#endif // ALARM_QORVO_H_ diff --git a/src/qpg6095/arm-none-eabi.cmake b/src/qpg6095/arm-none-eabi.cmake deleted file mode 100644 index de1ed14aa..000000000 --- a/src/qpg6095/arm-none-eabi.cmake +++ /dev/null @@ -1,42 +0,0 @@ -# -# 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. -# - -set(CMAKE_SYSTEM_NAME Generic) -set(CMAKE_SYSTEM_PROCESSOR ARM) - -set(CMAKE_C_COMPILER arm-none-eabi-gcc) -set(CMAKE_CXX_COMPILER arm-none-eabi-g++) -set(CMAKE_ASM_COMPILER arm-none-eabi-as) -set(CMAKE_RANLIB arm-none-eabi-ranlib) - -set(COMMON_C_FLAGS "-mcpu=cortex-m4 -mthumb -fdata-sections -ffunction-sections") - -set(CMAKE_C_FLAGS_INIT "${COMMON_C_FLAGS} -std=gnu99") -set(CMAKE_CXX_FLAGS_INIT "${COMMON_C_FLAGS} -fno-exceptions -fno-rtti") -set(CMAKE_ASM_FLAGS_INIT "${COMMON_C_FLAGS}") -set(CMAKE_EXE_LINKER_FLAGS_INIT "${COMMON_C_FLAGS} -specs=nano.specs -specs=nosys.specs") diff --git a/src/qpg6095/crypto/qpg6095-mbedtls-config.h b/src/qpg6095/crypto/qpg6095-mbedtls-config.h deleted file mode 100644 index 278a2fc89..000000000 --- a/src/qpg6095/crypto/qpg6095-mbedtls-config.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (c) 2019, 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. - */ - -#ifndef QPG6095_MBEDTLS_CONFIG_H -#define QPG6095_MBEDTLS_CONFIG_H -/* enable this to speed up crypto calculations by using a ram patch for bignum.c */ -#define MBEDTLS_BIGNUM_RAMPATCH 0 - -/* enable this in case the QPG6095 runs too slow for the crypto calculations */ -#define MBEDTLS_SLOW_CPU 1 -#define MBEDTLS_COMPUTATION_UNTILL_SEQ_NR 6 - -#if defined(QORVO_MBEDTLS_DEBUG) -#ifndef MBEDTLS_DEBUG_C -#define MBEDTLS_DEBUG_C -#endif // MBEDTLS_DEBUG_C -#else -#ifdef MBEDTLS_DEBUG_C -#undef MBEDTLS_DEBUG_C -#endif // MBEDTLS_DEBUG_C -#endif // QORVO_MBEDTLS_DEBUG - -#include "mbedtls/check_config.h" - -#endif // QPG6095_MBEDTLS_CONFIG_H diff --git a/src/qpg6095/diag.c b/src/qpg6095/diag.c deleted file mode 100644 index e79c2f260..000000000 --- a/src/qpg6095/diag.c +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright (c) 2019, 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. - */ - -#include -#include -#include -#include - -#include -#include -#include - -#if OPENTHREAD_CONFIG_DIAG_ENABLE - -/** - * Diagnostics mode variables. - * - */ -static bool sDiagMode = false; - -void otPlatDiagModeSet(bool aMode) -{ - sDiagMode = aMode; -} - -bool otPlatDiagModeGet() -{ - return sDiagMode; -} - -void otPlatDiagChannelSet(uint8_t aChannel) -{ - OT_UNUSED_VARIABLE(aChannel); -} - -void otPlatDiagTxPowerSet(int8_t aTxPower) -{ - OT_UNUSED_VARIABLE(aTxPower); -} - -void otPlatDiagRadioReceived(otInstance *aInstance, otRadioFrame *aFrame, otError aError) -{ - OT_UNUSED_VARIABLE(aInstance); - OT_UNUSED_VARIABLE(aFrame); - OT_UNUSED_VARIABLE(aError); -} - -void otPlatDiagAlarmCallback(otInstance *aInstance) -{ - OT_UNUSED_VARIABLE(aInstance); -} - -#endif // OPENTHREAD_CONFIG_DIAG_ENABLE diff --git a/src/qpg6095/entropy.c b/src/qpg6095/entropy.c deleted file mode 100644 index e7a989d75..000000000 --- a/src/qpg6095/entropy.c +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (c) 2019, 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 an entropy source. - * - */ - -#include - -#include "assert.h" -#include "random_qorvo.h" -#include -#include - -otError otPlatEntropyGet(uint8_t *aOutput, uint16_t aOutputLength) -{ - otError error = OT_ERROR_NONE; - assert(aOutputLength < 256); - - qorvoRandomGet((uint8_t *)aOutput, (uint8_t)aOutputLength); - return error; -} diff --git a/src/qpg6095/logging.c b/src/qpg6095/logging.c deleted file mode 100644 index b703ecb97..000000000 --- a/src/qpg6095/logging.c +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (c) 2019, 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. - */ - -#include "openthread-core-config.h" - -#include "platform_qorvo.h" - -#include -#include -#include - -#include - -#include "uart_qorvo.h" -#include "utils/code_utils.h" - -#if (OPENTHREAD_CONFIG_LOG_OUTPUT == OPENTHREAD_CONFIG_LOG_OUTPUT_PLATFORM_DEFINED) -void otPlatLog(otLogLevel aLogLevel, otLogRegion aLogRegion, const char *aFormat, ...) -{ - va_list args; - va_start(args, aFormat); - qorvoUartLog(aLogLevel, aLogRegion, aFormat, args); - va_end(args); -} -#endif diff --git a/src/qpg6095/misc.c b/src/qpg6095/misc.c deleted file mode 100644 index 9ecc59d76..000000000 --- a/src/qpg6095/misc.c +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (c) 2019, 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. - */ - -#include "misc_qorvo.h" -#include -#include - -void otPlatReset(otInstance *aInstance) -{ - OT_UNUSED_VARIABLE(aInstance); - qorvoPlatReset(); -} - -otPlatResetReason otPlatGetResetReason(otInstance *aInstance) -{ - OT_UNUSED_VARIABLE(aInstance); - // TODO: Write me! - return OT_PLAT_RESET_REASON_POWER_ON; -} - -void otPlatAssertFail(const char *aFilename, int aLineNumber) -{ - qorvoPlatAssertFail(aFilename, aLineNumber); -} - -void otPlatWakeHost(void) -{ - // TODO: implement an operation to wake the host from sleep state. -} diff --git a/src/qpg6095/misc_qorvo.h b/src/qpg6095/misc_qorvo.h deleted file mode 100644 index 2db398458..000000000 --- a/src/qpg6095/misc_qorvo.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (c) 2019, 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 declarations of the misc functions from the Qorvo library. - * - */ - -#ifndef MISC_QORVO_H_ -#define MISC_QORVO_H_ - -#include -#include - -void qorvoPlatReset(void); -void qorvoPlatAssertFail(const char *aFilename, int aLineNumber); - -#endif // MISC_QORVO_H_ diff --git a/src/qpg6095/openthread-core-qpg6095-config-check.h b/src/qpg6095/openthread-core-qpg6095-config-check.h deleted file mode 100644 index 58eb68fbe..000000000 --- a/src/qpg6095/openthread-core-qpg6095-config-check.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (c) 2019, 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. - */ - -#ifndef OPENTHREAD_CORE_QPG6095_CONFIG_CHECK_H_ -#define OPENTHREAD_CORE_QPG6095_CONFIG_CHECK_H_ - -#if OPENTHREAD_CONFIG_TIME_SYNC_ENABLE -#error "Platform qpg6095 doesn't support configuration option: OPENTHREAD_CONFIG_TIME_SYNC_ENABLE" -#endif - -#if OPENTHREAD_CONFIG_RADIO_915MHZ_OQPSK_SUPPORT -#error "Platform qpg6095 doesn't support configuration option: OPENTHREAD_CONFIG_RADIO_915MHZ_OQPSK_SUPPORT" -#endif - -#endif /* OPENTHREAD_CORE_QPG6095_CONFIG_CHECK_H_ */ diff --git a/src/qpg6095/openthread-core-qpg6095-config.h b/src/qpg6095/openthread-core-qpg6095-config.h deleted file mode 100644 index 44ff1b763..000000000 --- a/src/qpg6095/openthread-core-qpg6095-config.h +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Copyright (c) 2019, 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 qpg6095 compile-time configuration constants for OpenThread. - */ - -#ifndef OPENTHREAD_CORE_QPG6095_CONFIG_H_ -#define OPENTHREAD_CORE_QPG6095_CONFIG_H_ - -/** - * @def OPENTHREAD_CONFIG_PLATFORM_INFO - * - * The platform-specific string to insert into the OpenThread version string. - * - */ -#define OPENTHREAD_CONFIG_PLATFORM_INFO "QPG6095" - -/** - * @def OPENTHREAD_CONFIG_PLATFORM_ASSERT_MANAGEMENT - * - * The assert is managed by platform defined logic when this flag is set. - * - */ -#ifndef OPENTHREAD_CONFIG_PLATFORM_ASSERT_MANAGEMENT -#define OPENTHREAD_CONFIG_PLATFORM_ASSERT_MANAGEMENT 1 -#endif - -/** - * @def OPENTHREAD_CONFIG_DIAG_ENABLE - * - * Define as 1 to enable the diag feature. - * - */ -#ifndef OPENTHREAD_CONFIG_DIAG_ENABLE -#define OPENTHREAD_CONFIG_DIAG_ENABLE 1 -#endif - -/** - * @def OPENTHREAD_CONFIG_HEAP_INTERNAL_SIZE - * - * Configure the available heap size. - * The heap is used by Mbedtls - * - */ -#ifndef OPENTHREAD_CONFIG_HEAP_INTERNAL_SIZE -#define OPENTHREAD_CONFIG_HEAP_INTERNAL_SIZE (2048 * sizeof(void *)) -#endif - -/** - * @def OPENTHREAD_CONFIG_TLS_ENABLE - * - * Define as 1 to enable support for TLS over TCP. - * - */ -#ifndef OPENTHREAD_CONFIG_TLS_ENABLE -#define OPENTHREAD_CONFIG_TLS_ENABLE 0 -#endif - -#endif // OPENTHREAD_CORE_QPG6095_CONFIG_H_ diff --git a/src/qpg6095/platform.c b/src/qpg6095/platform.c deleted file mode 100644 index dcc1d7e68..000000000 --- a/src/qpg6095/platform.c +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Copyright (c) 2019, 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 - * @brief - * This file includes the platform-specific initializers. - */ - -#include "alarm_qorvo.h" -#include "platform_qorvo.h" -#include "radio_qorvo.h" -#include "random_qorvo.h" -#include "uart_qorvo.h" -#include - -#include "utils/uart.h" - -#include "stdio.h" -#include "stdlib.h" - -static otInstance *localInstance = NULL; - -uint8_t qorvoPlatGotoSleepCheck(void) -{ - if (localInstance) - { - return !otTaskletsArePending(localInstance); - } - else - { - return true; - } -} - -void otSysInit(int argc, char *argv[]) -{ - OT_UNUSED_VARIABLE(argc); - OT_UNUSED_VARIABLE(argv); - qorvoPlatInit((qorvoPlatGotoSleepCheckCallback_t)qorvoPlatGotoSleepCheck); - qorvoUartInit(); - qorvoAlarmInit(); - qorvoRandomInit(); - qorvoRadioInit(); -} - -bool otSysPseudoResetWasRequested(void) -{ - return false; -} - -void otSysProcessDrivers(otInstance *aInstance) -{ - if (localInstance == NULL) - { - // local copy in case we need to perform a callback. - localInstance = aInstance; - } - - qorvoPlatMainLoop(!otTaskletsArePending(aInstance)); -} diff --git a/src/qpg6095/platform_qorvo.h b/src/qpg6095/platform_qorvo.h deleted file mode 100644 index 85eb3808f..000000000 --- a/src/qpg6095/platform_qorvo.h +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright (c) 2019, 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 initializers. - * - */ - -#ifndef PLATFORM_QORVO_H_ -#define PLATFORM_QORVO_H_ - -#include -#include - -typedef uint8_t (*qorvoPlatGotoSleepCheckCallback_t)(void); - -/** - * This function initializes the platform. - * - * @param[in] gotoSleepCheckCallback The callback which needs to return if sleep is allowed. - * - */ -void qorvoPlatInit(qorvoPlatGotoSleepCheckCallback_t gotoSleepCheckCallback); - -/** - * This function runs the main loop of the platform once. - * - * @param[in] canGoToSleep Indicates if the platform can got to sleep. - * - */ -void qorvoPlatMainLoop(bool canGoToSleep); - -#endif // PLATFORM_QORVO_H_ diff --git a/src/qpg6095/radio.c b/src/qpg6095/radio.c deleted file mode 100644 index 45991f4e3..000000000 --- a/src/qpg6095/radio.c +++ /dev/null @@ -1,497 +0,0 @@ -/* - * Copyright (c) 2019, 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 OpenThread platform abstraction for radio communication. - * - */ - -#include - -#include -#include - -#include "utils/code_utils.h" - -#include "radio_qorvo.h" - -#define QPG_RECEIVE_SENSITIVITY -100 // dBm - -#define IEEE802154_MIN_LENGTH 5 -#define IEEE802154_MAX_LENGTH 127 -#define IEEE802154_ACK_LENGTH 5 -#define IEEE802154_FRAME_TYPE_MASK 0x7 -#define IEEE802154_FRAME_TYPE_ACK 0x2 -#define IEEE802154_FRAME_PENDING 1 << 4 -#define IEEE802154_ACK_REQUEST 1 << 5 -#define IEEE802154_DSN_OFFSET 2 - -#define QORVO_RSSI_OFFSET 73 -#define QORVO_CRC_BIT_MASK 0x80 -#define QORVO_LQI_BIT_MASK 0x7f - -extern otRadioFrame sTransmitFrame; - -static otRadioState sState; -static otInstance *pQorvoInstance; - -typedef struct otCachedSettings_s -{ - uint16_t panid; -} otCachedSettings_t; - -static otCachedSettings_t otCachedSettings; - -/* Upper layer relies on txpower could be set before receive, but MAC have per-channel config for it. - Store txpower until channel set in Receive(). */ -#define PENDING_TX_POWER_NONE (-1) -static int8_t pendingTxPower = PENDING_TX_POWER_NONE; - -static uint8_t sScanstate = 0; -static int8_t sLastReceivedPower = 127; - -otRadioCaps otPlatRadioGetCaps(otInstance *aInstance) -{ - OT_UNUSED_VARIABLE(aInstance); - - return OT_RADIO_CAPS_ACK_TIMEOUT | OT_RADIO_CAPS_ENERGY_SCAN | OT_RADIO_CAPS_TRANSMIT_RETRIES; -} - -const char *otPlatRadioGetVersionString(otInstance *aInstance) -{ - OT_UNUSED_VARIABLE(aInstance); - - return "OPENTHREAD/Qorvo/0.0"; -} - -int8_t otPlatRadioGetReceiveSensitivity(otInstance *aInstance) -{ - OT_UNUSED_VARIABLE(aInstance); - - return QPG_RECEIVE_SENSITIVITY; -} - -void otPlatRadioGetIeeeEui64(otInstance *aInstance, uint8_t *aIeeeEui64) -{ - OT_UNUSED_VARIABLE(aInstance); - - qorvoRadioGetIeeeEui64(aIeeeEui64); -} - -void otPlatRadioSetPanId(otInstance *aInstance, otPanId aPanId) -{ - OT_UNUSED_VARIABLE(aInstance); - - qorvoRadioSetPanId((uint16_t)aPanId); - otCachedSettings.panid = aPanId; -} - -void otPlatRadioSetExtendedAddress(otInstance *aInstance, const otExtAddress *address) -{ - OT_UNUSED_VARIABLE(aInstance); - - qorvoRadioSetExtendedAddress(address->m8); -} - -void otPlatRadioSetShortAddress(otInstance *aInstance, otShortAddress aShortAddress) -{ - OT_UNUSED_VARIABLE(aInstance); - - qorvoRadioSetShortAddress((uint16_t)aShortAddress); -} - -otError otPlatRadioGetTransmitPower(otInstance *aInstance, int8_t *aPower) -{ - OT_UNUSED_VARIABLE(aInstance); - - otError result; - - if (aPower == NULL) - { - return OT_ERROR_INVALID_ARGS; - } - - if ((sState == OT_RADIO_STATE_DISABLED) || (sScanstate != 0)) - { - *aPower = (pendingTxPower == PENDING_TX_POWER_NONE) ? 0 : pendingTxPower; - return OT_ERROR_NONE; - } - - result = qorvoRadioGetTransmitPower(aPower); - - if (result == OT_ERROR_INVALID_STATE) - { - // Channel was not set, so txpower is ambigious - *aPower = (pendingTxPower == PENDING_TX_POWER_NONE) ? 0 : pendingTxPower; - return OT_ERROR_NONE; - } - - return result; -} - -otError otPlatRadioSetTransmitPower(otInstance *aInstance, int8_t aPower) -{ - OT_UNUSED_VARIABLE(aInstance); - - otError result; - - if ((sState == OT_RADIO_STATE_DISABLED) || (sScanstate != 0)) - { - pendingTxPower = aPower; - return OT_ERROR_NONE; - } - - result = qorvoRadioSetTransmitPower(aPower); - - if (result == OT_ERROR_INVALID_STATE) - { - // Channel was not set, so txpower is ambigious - pendingTxPower = aPower; - result = OT_ERROR_NONE; - } - - return result; -} - -otError otPlatRadioGetCcaEnergyDetectThreshold(otInstance *aInstance, int8_t *aThreshold) -{ - OT_UNUSED_VARIABLE(aInstance); - OT_UNUSED_VARIABLE(aThreshold); - - return OT_ERROR_NOT_IMPLEMENTED; -} - -otError otPlatRadioSetCcaEnergyDetectThreshold(otInstance *aInstance, int8_t aThreshold) -{ - OT_UNUSED_VARIABLE(aInstance); - OT_UNUSED_VARIABLE(aThreshold); - - return OT_ERROR_NOT_IMPLEMENTED; -} - -otError otPlatRadioGetFemLnaGain(otInstance *aInstance, int8_t *aGain) -{ - OT_UNUSED_VARIABLE(aInstance); - OT_UNUSED_VARIABLE(aGain); - - return OT_ERROR_NOT_IMPLEMENTED; -} - -otError otPlatRadioSetFemLnaGain(otInstance *aInstance, int8_t aGain) -{ - OT_UNUSED_VARIABLE(aInstance); - OT_UNUSED_VARIABLE(aGain); - - return OT_ERROR_NOT_IMPLEMENTED; -} - -bool otPlatRadioGetPromiscuous(otInstance *aInstance) -{ - OT_UNUSED_VARIABLE(aInstance); - - return qorvoRadioGetPromiscuous(); -} - -void otPlatRadioSetPromiscuous(otInstance *aInstance, bool aEnable) -{ - OT_UNUSED_VARIABLE(aInstance); - - qorvoRadioSetPromiscuous(aEnable); -} - -uint32_t otPlatRadioGetBusSpeed(otInstance *aInstance) -{ - OT_UNUSED_VARIABLE(aInstance); - - return 0; -} - -otError otPlatRadioEnable(otInstance *aInstance) -{ - pQorvoInstance = aInstance; - memset(&otCachedSettings, 0x00, sizeof(otCachedSettings_t)); - - if (!otPlatRadioIsEnabled(aInstance)) - { - sState = OT_RADIO_STATE_SLEEP; - } - - return OT_ERROR_NONE; -} - -otError otPlatRadioDisable(otInstance *aInstance) -{ - OT_UNUSED_VARIABLE(aInstance); - - otEXPECT(otPlatRadioIsEnabled(aInstance)); - - if (sState == OT_RADIO_STATE_RECEIVE) - { - qorvoRadioSetRxOnWhenIdle(false); - } - - sState = OT_RADIO_STATE_DISABLED; - -exit: - return OT_ERROR_NONE; -} - -bool otPlatRadioIsEnabled(otInstance *aInstance) -{ - OT_UNUSED_VARIABLE(aInstance); - - return (sState != OT_RADIO_STATE_DISABLED); -} - -otError otPlatRadioSleep(otInstance *aInstance) -{ - OT_UNUSED_VARIABLE(aInstance); - - otError error = OT_ERROR_INVALID_STATE; - - if (sState == OT_RADIO_STATE_RECEIVE || sState == OT_RADIO_STATE_SLEEP) - { - qorvoRadioSetRxOnWhenIdle(false); - error = OT_ERROR_NONE; - sState = OT_RADIO_STATE_SLEEP; - } - return error; -} - -otError otPlatRadioReceive(otInstance *aInstance, uint8_t aChannel) -{ - otError error = OT_ERROR_INVALID_STATE; - - pQorvoInstance = aInstance; - - if ((sState != OT_RADIO_STATE_DISABLED) && (sScanstate == 0)) - { - qorvoRadioSetCurrentChannel(aChannel); - if (pendingTxPower != PENDING_TX_POWER_NONE) - { - qorvoRadioSetTransmitPower(pendingTxPower); - pendingTxPower = PENDING_TX_POWER_NONE; - } - error = OT_ERROR_NONE; - } - - if (sState == OT_RADIO_STATE_SLEEP) - { - qorvoRadioSetRxOnWhenIdle(true); - error = OT_ERROR_NONE; - sState = OT_RADIO_STATE_RECEIVE; - } - - return error; -} - -void cbQorvoRadioReceiveDone(otRadioFrame *aFrame, otError aError) -{ - if (aError == OT_ERROR_NONE) - { - sLastReceivedPower = aFrame->mInfo.mRxInfo.mRssi; - } - - otPlatRadioReceiveDone(pQorvoInstance, aFrame, aError); -} - -otRadioFrame *otPlatRadioGetTransmitBuffer(otInstance *aInstance) -{ - OT_UNUSED_VARIABLE(aInstance); - - return &sTransmitFrame; -} - -otError otPlatRadioTransmit(otInstance *aInstance, otRadioFrame *aFrame) -{ - otError err = OT_ERROR_NONE; - - pQorvoInstance = aInstance; - - otEXPECT_ACTION(sState != OT_RADIO_STATE_DISABLED, err = OT_ERROR_INVALID_STATE); - - err = qorvoRadioTransmit(aFrame); - -exit: - return err; -} - -void cbQorvoRadioTransmitDone(otRadioFrame *aFrame, bool aFramePending, otError aError) -{ - // TODO: pass received ACK frame instead of generating one. - otRadioFrame ackFrame; - uint8_t psdu[IEEE802154_ACK_LENGTH]; - - ackFrame.mPsdu = psdu; - ackFrame.mLength = IEEE802154_ACK_LENGTH; - ackFrame.mPsdu[0] = IEEE802154_FRAME_TYPE_ACK; - - if (aFramePending) - { - ackFrame.mPsdu[0] |= IEEE802154_FRAME_PENDING; - } - - ackFrame.mPsdu[1] = 0; - ackFrame.mPsdu[2] = aFrame->mPsdu[IEEE802154_DSN_OFFSET]; - - otPlatRadioTxDone(pQorvoInstance, aFrame, &ackFrame, aError); -} - -int8_t otPlatRadioGetRssi(otInstance *aInstance) -{ - OT_UNUSED_VARIABLE(aInstance); - - return sLastReceivedPower; -} - -otError otPlatRadioEnergyScan(otInstance *aInstance, uint8_t aScanChannel, uint16_t aScanDuration) -{ - OT_UNUSED_VARIABLE(aInstance); - - sScanstate = 1; - return qorvoRadioEnergyScan(aScanChannel, aScanDuration); -} - -void cbQorvoRadioEnergyScanDone(int8_t aEnergyScanMaxRssi) -{ - sScanstate = 0; - otPlatRadioEnergyScanDone(pQorvoInstance, aEnergyScanMaxRssi); -} - -void otPlatRadioEnableSrcMatch(otInstance *aInstance, bool aEnable) -{ - OT_UNUSED_VARIABLE(aInstance); - - qorvoRadioEnableSrcMatch(aEnable); -} - -otError otPlatRadioAddSrcMatchShortEntry(otInstance *aInstance, otShortAddress aShortAddress) -{ - OT_UNUSED_VARIABLE(aInstance); - - return qorvoRadioAddSrcMatchShortEntry((uint16_t)aShortAddress, otCachedSettings.panid); -} - -otError otPlatRadioAddSrcMatchExtEntry(otInstance *aInstance, const otExtAddress *aExtAddress) -{ - OT_UNUSED_VARIABLE(aInstance); - - return qorvoRadioAddSrcMatchExtEntry(aExtAddress->m8, otCachedSettings.panid); -} - -otError otPlatRadioClearSrcMatchShortEntry(otInstance *aInstance, otShortAddress aShortAddress) -{ - OT_UNUSED_VARIABLE(aInstance); - - return qorvoRadioClearSrcMatchShortEntry((uint16_t)aShortAddress, otCachedSettings.panid); -} - -otError otPlatRadioClearSrcMatchExtEntry(otInstance *aInstance, const otExtAddress *aExtAddress) -{ - OT_UNUSED_VARIABLE(aInstance); - - return qorvoRadioClearSrcMatchExtEntry(aExtAddress->m8, otCachedSettings.panid); -} - -void otPlatRadioClearSrcMatchShortEntries(otInstance *aInstance) -{ - OT_UNUSED_VARIABLE(aInstance); - - /* clear both short and extended addresses here */ - qorvoRadioClearSrcMatchEntries(); -} - -void otPlatRadioClearSrcMatchExtEntries(otInstance *aInstance) -{ - OT_UNUSED_VARIABLE(aInstance); - - /* not implemented */ - /* assumes clearing of short and extended entries is done simultaniously by the openthread stack */ -} -uint32_t otPlatRadioGetSupportedChannelMask(otInstance *aInstance) -{ - OT_UNUSED_VARIABLE(aInstance); - - return 0x03fff800; -} - -uint32_t otPlatRadioGetPreferredChannelMask(otInstance *aInstance) -{ - OT_UNUSED_VARIABLE(aInstance); - - return 0x03fff800; -} - -otError otPlatRadioSetCoexEnabled(otInstance *aInstance, bool aEnabled) -{ - OT_UNUSED_VARIABLE(aInstance); - OT_UNUSED_VARIABLE(aEnabled); - - return OT_ERROR_NOT_IMPLEMENTED; -} - -bool otPlatRadioIsCoexEnabled(otInstance *aInstance) -{ - OT_UNUSED_VARIABLE(aInstance); - - return false; -} - -otError otPlatRadioGetCoexMetrics(otInstance *aInstance, otRadioCoexMetrics *aCoexMetrics) -{ - OT_UNUSED_VARIABLE(aInstance); - OT_UNUSED_VARIABLE(aCoexMetrics); - - return OT_ERROR_NOT_IMPLEMENTED; -} - -otError otPlatRadioSetChannelMaxTransmitPower(otInstance *aInstance, uint8_t aChannel, int8_t aMaxPower) -{ - OT_UNUSED_VARIABLE(aInstance); - OT_UNUSED_VARIABLE(aChannel); - OT_UNUSED_VARIABLE(aMaxPower); - - return OT_ERROR_NOT_IMPLEMENTED; -} - -otError otPlatRadioSetRegion(otInstance *aInstance, uint16_t aRegionCode) -{ - OT_UNUSED_VARIABLE(aInstance); - OT_UNUSED_VARIABLE(aRegionCode); - - return OT_ERROR_NOT_IMPLEMENTED; -} - -otError otPlatRadioGetRegion(otInstance *aInstance, uint16_t *aRegionCode) -{ - OT_UNUSED_VARIABLE(aInstance); - OT_UNUSED_VARIABLE(aRegionCode); - - return OT_ERROR_NOT_IMPLEMENTED; -} diff --git a/src/qpg6095/radio_qorvo.h b/src/qpg6095/radio_qorvo.h deleted file mode 100644 index bae778c48..000000000 --- a/src/qpg6095/radio_qorvo.h +++ /dev/null @@ -1,367 +0,0 @@ -/* - * Copyright (c) 2019, 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 declarations of the radio functions from the Qorvo library. - * - */ - -#ifndef RADIO_QORVO_H_ -#define RADIO_QORVO_H_ - -#include -#include - -#include -#include - -/** - * This function initializes the radio. - * - */ -void qorvoRadioInit(void); - -/** - * This function resets the radio. - * - */ -void qorvoRadioReset(void); - -/** - * This function processes event to/from the radio. - * - */ -void qorvoRadioProcess(void); - -/** - * This function starts an ED scan. - * - * @param[in] aScanChannel The channel which needs to be scanned. - * @param[in] aScanDuration The amount of time in ms which needs to be scanned. - * - */ -otError qorvoRadioEnergyScan(uint8_t aScanChannel, uint16_t aScanDuration); - -/** - * This function sets the current channel. - * - * @param[in] channel The channel index. - * - */ -void qorvoRadioSetCurrentChannel(uint8_t channel); - -/** - * This function sets the idle behaviour of the radio. - * - * @param[in] rxOnWhenIdle If true, the radio remains on which not transmitting. - * - */ -void qorvoRadioSetRxOnWhenIdle(bool rxOnWhenIdle); - -/** - * This function retrieves the MAC address of the radio. - * - * @param[out] aIeeeEui64 The MAC address of the radio. - * - */ -void qorvoRadioGetIeeeEui64(uint8_t *aIeeeEui64); - -/** - * This function transmits a frame. - * - * @param[in] aFrame The frame which needs to be transmitted. - * - */ -otError qorvoRadioTransmit(otRadioFrame *aFrame); - -/** - * This function sets the PanId. - * - * @param[in] panid The panId. - * - */ -void qorvoRadioSetPanId(uint16_t panid); - -/** - * This function sets the short address. - * - * @param[in] address The short address. - * - */ -void qorvoRadioSetShortAddress(uint16_t address); - -/** - * This function sets the extended address. - * - * @param[in] address The extended address. - * - */ -void qorvoRadioSetExtendedAddress(const uint8_t *address); - -/** - * This function enables source address matching for indirect transmit. - * - * @param[in] aEnable if True will enable source address matching, false will disable. - * - */ -void qorvoRadioEnableSrcMatch(bool aEnable); - -/** - * This function clears all entries from the source address match list. - * - */ -void qorvoRadioClearSrcMatchEntries(void); - -/** - * This function adds an short address plus panid to the source address match list. - * - * @param[in] aShortAddress The short address which should be added. - * @param[in] panid The panid. - * - */ -otError qorvoRadioAddSrcMatchShortEntry(uint16_t aShortAddress, uint16_t panid); - -/** - * This function adds an extended address plus panid to the source address match list. - * - * @param[in] aExtAddress The extended address which should be added. - * @param[in] panid The panid. - * - */ -otError qorvoRadioAddSrcMatchExtEntry(const uint8_t *aExtAddress, uint16_t panid); - -/** - * This function removes an short address plus panid from the source address match list. - * - * @param[in] aShortAddress The short address which should be removed. - * @param[in] panid The panid. - * - */ -otError qorvoRadioClearSrcMatchShortEntry(uint16_t aShortAddress, uint16_t panid); - -/** - * This function removes an extended address plus panid from the source address match list. - * - * @param[in] aExtAddress The extended address which should be removed. - * @param[in] panid The panid. - * - */ -otError qorvoRadioClearSrcMatchExtEntry(const uint8_t *aExtAddress, uint16_t panid); - -/** - * This function gets the transmit power for current channel - * - * @param[out] aPower The transmit power - * - */ -otError qorvoRadioGetTransmitPower(int8_t *aPower); - -/** - * This function sets the transmit power for current channel - * - * @param[in] aPower The transmit power - * - */ -otError qorvoRadioSetTransmitPower(int8_t aPower); - -/** - * Get the status of promiscuous mode. - * - * @retval TRUE Promiscuous mode is enabled. - * @retval FALSE Promiscuous mode is disabled. - * - */ -bool qorvoRadioGetPromiscuous(void); - -/** - * Enable or disable promiscuous mode. - * - * @param[in] aEnable TRUE to enable or FALSE to disable promiscuous mode. - * - */ -void qorvoRadioSetPromiscuous(bool aEnable); - -/** - * Update MAC keys and key index - * - * This function is used when radio provides OT_RADIO_CAPS_TRANSMIT_SEC capability. - * - * @param[in] aKeyIdMode The key ID mode. - * @param[in] aKeyId Current MAC key index. - * @param[in] aPrevKey A pointer to the previous MAC key. - * @param[in] aCurrKey A pointer to the current MAC key. - * @param[in] aNextKey A pointer to the next MAC key. - * @param[in] aKeyType Key Type used. - * - */ -void qorvoRadioSetMacKey(uint8_t aKeyIdMode, - uint8_t aKeyId, - const uint8_t *aPrevKey, - const uint8_t *aCurrKey, - const uint8_t *aNextKey, - uint8_t aKeyType); - -/** - * This method sets the current MAC frame counter value. - * - * This function is used when radio provides `OT_RADIO_CAPS_TRANSMIT_SEC` capability. - * - * @param[in] aMacFrameCounter The MAC frame counter value. - * - */ -void qorvoRadioSetMacFrameCounter(uint32_t aMacFrameCounter); - -/** - * Enable or disable CSL receiver. - * - * @param[in] aCslPeriod CSL period, 0 for disabling CSL. - * @param[in] aShortAddr The short source address of CSL receiver's peer. - * @param[in] aExtAddr The extended source address of CSL receiver's peer. - * - * @note Platforms should use CSL peer addresses to include CSL IE when generating enhanced acks. - * - * @retval kErrorNotImplemented Radio driver doesn't support CSL. - * @retval kErrorFailed Other platform specific errors. - * @retval kErrorNone Successfully enabled or disabled CSL. - * - */ -otError qorvoRadioEnableCsl(uint32_t aCslPeriod, uint16_t aShortAddr, const uint8_t *aExtAddr); - -/** - * Update CSL sample time in radio driver. - * - * Sample time is stored in radio driver as a copy to calculate phase when sending ACK with CSL IE. - * - * @param[in] aCslSampleTime The latest sample time. - * - */ -void qorvoRadioUpdateCslSampleTime(uint32_t aCslSampleTime); - -/** - * Enable/disable or update Enhanced-ACK Based Probing in radio for a specific Initiator. - * - * After Enhanced-ACK Based Probing is configured by a specific Probing Initiator, the Enhanced-ACK sent to that - * node should include Vendor-Specific IE containing Link Metrics data. This method informs the radio to start/stop to - * collect Link Metrics data and include Vendor-Specific IE that containing the data in Enhanced-ACK sent to that - * Probing Initiator. - * - * @param[in] aLinkMetrics This parameter specifies what metrics to query. Per spec 4.11.3.4.4.6, at most 2 metrics - * can be specified. The probing would be disabled if @p `aLinkMetrics` is bitwise 0. - * @param[in] aShortAddr The short address of the Probing Initiator. - * @param[in] aExtAddr The extended source address of the Probing Initiator. @p aExtAddr MUST NOT be `NULL`. - * - * @retval OT_ERROR_NONE Successfully configured the Enhanced-ACK Based Probing. - * @retval OT_ERROR_INVALID_ARGS @p aExtAddress is `NULL`. - * @retval OT_ERROR_NOT_FOUND The Initiator indicated by @p aShortAddress is not found when trying to clear. - * @retval OT_ERROR_NO_BUFS No more Initiator can be supported. - * - */ -otError qorvoRadioConfigureEnhAckProbing(otLinkMetrics aLinkMetrics, - uint16_t aShortAddress, - const uint8_t *aExtAddress); - -/** - * Get the current estimated time (in microseconds) of the radio chip. - * - * This microsecond timer must be a free-running timer. The timer must continue to advance with microsecond precision - * even when the radio is in the sleep state. - * - * @returns The current time in microseconds. UINT64_MAX when platform does not support or radio time is not ready. - * - */ -uint64_t qorvoRadioGetNow(void); - -/** - * Schedule a radio reception window at a specific time and duration. - * - * @param[in] aChannel The radio channel on which to receive. - * @param[in] aStart The receive window start time, in microseconds. - * @param[in] aDuration The receive window duration, in microseconds - * - * @retval OT_ERROR_NONE Successfully scheduled receive window. - * @retval OT_ERROR_FAILED The receive window could not be scheduled. - */ -otError qorvoRadioReceiveAt(uint8_t aChannel, uint32_t aStart, uint32_t aDuration); - -/** - * Retrieve the radio capabilities of the radio - * - * @returns caps The radio capabilities as described in include/openthread/platform/radio.h - */ -otRadioCaps qorvoRadioGetCaps(void); - -/** - * This callback is called when the energy scan is finished. - * - * @param[in] aEnergyScanMaxRssi The amount of energy detected during the ED scan. - * - */ -void cbQorvoRadioEnergyScanDone(int8_t aEnergyScanMaxRssi); - -/** - * This callback is called after a transmission is completed (and if required an ACK is received). - * - * @param[in] aFrame The packet which was transmitted. - * @param[in] aFramePending Indicates if the FP bit was set in the ACK frame or not. - * @param[in] aError Indicates if an error occurred during transmission. - * - */ -void cbQorvoRadioTransmitDone(otRadioFrame *aFrame, bool aFramePending, otError aError); - -/** - * This callback is called after a transmission is completed (and if required an ACK is received). - * - * @param[in] aFrame The packet which was transmitted. - * @param[in] aAckFrame The complete 802.15.4-2015 enhanced ack frame. - * @param[in] aError Indicates if an error occurred during transmission. - * - */ -void cbQorvoRadioTransmitDone_AckFrame(otRadioFrame *aFrame, otRadioFrame *aAckFrame, otError aError); - -/** - * This callback is called after a frame is received. - * - * @param[in] aFrame The packet which was received. - * @param[in] aError Any error which occurred during reception of the packet. - * - */ -void cbQorvoRadioReceiveDone(otRadioFrame *aFrame, otError aError); - -/** - * This callback is called to notify OpenThread that the transmission has started. - * - * @note This function should be called by the same thread that executes all of the other OpenThread code. It should - * not be called by ISR or any other task. - * - * @param[in] aFrame A pointer to the frame that is being transmitted. - * - */ -void cbQorvoRadioTxStarted(otRadioFrame *aFrame); - -#endif // RADIO_QORVO_H_ diff --git a/src/qpg6095/random_qorvo.h b/src/qpg6095/random_qorvo.h deleted file mode 100644 index d48d56474..000000000 --- a/src/qpg6095/random_qorvo.h +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (c) 2019, 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 declarations of the random functions from the Qorvo library. - * - */ - -#ifndef RANDOM_QORVO_H_ -#define RANDOM_QORVO_H_ - -#include -#include - -/** - * This function initializes the random number service used by OpenThread. - * - */ -void qorvoRandomInit(void); - -/** - * This function returns an array of random numbers. - * - * @param[out] aOutput Pointer to an array which will be filled with random data. - * @param[in] aOutputLength number of bytes which will be written into the array. - * - */ -void qorvoRandomGet(uint8_t *aOutput, uint8_t aOutputLength); - -#endif // RANDOM_QORVO_H_ diff --git a/src/qpg6095/settings.cpp b/src/qpg6095/settings.cpp deleted file mode 100644 index 8250cf676..000000000 --- a/src/qpg6095/settings.cpp +++ /dev/null @@ -1,128 +0,0 @@ -/* - * Copyright (c) 2019, 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 OpenThread platform abstraction for non-volatile storage of settings. - * - */ - -#include - -#include -#include "openthread/platform/settings.h" - -#include -#include - -#include "settings_qorvo.h" - -#if !OPENTHREAD_SETTINGS_RAM - -/***************************************************************************** - * Public Function Definitions - *****************************************************************************/ - -// settings API -void otPlatSettingsInit(otInstance *aInstance, const uint16_t *aSensitiveKeys, uint16_t aSensitiveKeysLength) -{ - OT_UNUSED_VARIABLE(aInstance); - OT_UNUSED_VARIABLE(aSensitiveKeys); - OT_UNUSED_VARIABLE(aSensitiveKeysLength); - qorvoSettingsInit(); -} - -void otPlatSettingsDeinit(otInstance *aInstance) -{ - OT_UNUSED_VARIABLE(aInstance); -} - -otError otPlatSettingsGet(otInstance *aInstance, uint16_t aKey, int aIndex, uint8_t *aValue, uint16_t *aValueLength) -{ - otError error = OT_ERROR_NOT_FOUND; - OT_UNUSED_VARIABLE(aInstance); - - /* we only support multiple entries for the ChildInfo */ - /* Note: removed the assert, since the settings types are protected now */ - // assert((aIndex == 0) || (aKey == ot::Settings::kKeyChildInfo)); - - error = qorvoSettingsGet(aKey, aIndex, aValue, aValueLength); - - if (error == OT_ERROR_NOT_FOUND) - { - if (aValue != nullptr) - { - *aValueLength = 0; - } - } - - return error; -} - -static otError PlatformSettingsAdd(otInstance *aInstance, - uint16_t aKey, - bool aIndex0, - const uint8_t *aValue, - uint16_t aValueLength) -{ - otError error = OT_ERROR_NONE; - OT_UNUSED_VARIABLE(aInstance); - - error = qorvoSettingsAdd(aKey, aIndex0, aValue, aValueLength); - - return error; -} - -otError otPlatSettingsSet(otInstance *aInstance, uint16_t aKey, const uint8_t *aValue, uint16_t aValueLength) -{ - return PlatformSettingsAdd(aInstance, aKey, true, aValue, aValueLength); -} - -otError otPlatSettingsAdd(otInstance *aInstance, uint16_t aKey, const uint8_t *aValue, uint16_t aValueLength) -{ - return PlatformSettingsAdd(aInstance, aKey, false, aValue, aValueLength); -} - -otError otPlatSettingsDelete(otInstance *aInstance, uint16_t aKey, int aIndex) -{ - otError error = OT_ERROR_NOT_FOUND; - OT_UNUSED_VARIABLE(aInstance); - - /* Existence of @aKey is done in @qorvoSettingsDelete */ - error = qorvoSettingsDelete(aKey, aIndex); - - return error; -} - -void otPlatSettingsWipe(otInstance *aInstance) -{ - qorvoSettingsWipe(); - otPlatSettingsInit(aInstance, NULL, 0); -} - -#endif /* OPENTHREAD_SETTINGS_RAM */ diff --git a/src/qpg6095/settings_qorvo.h b/src/qpg6095/settings_qorvo.h deleted file mode 100644 index b52c1f504..000000000 --- a/src/qpg6095/settings_qorvo.h +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright (c) 2019, 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 declarations of the settings functions from the Qorvo library. - * - */ - -#ifndef SETTINGS_QORVO_H_ -#define SETTINGS_QORVO_H_ - -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -void qorvoSettingsInit(void); - -otError qorvoSettingsGet(uint16_t aKey, int aIndex, uint8_t *aValue, uint16_t *aValueLength); - -otError qorvoSettingsAdd(uint16_t aKey, bool aIndex0, const uint8_t *aValue, uint16_t aValueLength); - -otError qorvoSettingsDelete(uint16_t aKey, int aIndex); - -void qorvoSettingsWipe(void); - -#ifdef __cplusplus -} -#endif - -#endif // SETTINGS_QORVO_H_ diff --git a/src/qpg6095/uart.c b/src/qpg6095/uart.c deleted file mode 100644 index a4b5d97ce..000000000 --- a/src/qpg6095/uart.c +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Copyright (c) 2019, 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 OpenThread platform abstraction for UART communication. - * - */ - -#include "uart_qorvo.h" - -/* work-around to avoid access to openthread-config.h */ -/* Define to 1 if stdbool.h conforms to C99. */ -#define HAVE_STDBOOL_H 1 -/* Define to 1 if the system has the type `_Bool'. */ -#define HAVE__BOOL 1 - -#include "common/code_utils.hpp" -#include "utils/uart.h" - -otError otPlatUartEnable(void) -{ - otError error = OT_ERROR_NONE; - qorvoUartInit(); - return error; -} - -otError otPlatUartDisable(void) -{ - otError error = OT_ERROR_NONE; - qorvoUartDeInit(); - return error; -} - -otError otPlatUartFlush(void) -{ - return qorvoUartFlush(); -} - -otError otPlatUartSend(const uint8_t *aBuf, uint16_t aBufLength) -{ - otError error = OT_ERROR_NONE; - qorvoUartSendOutput(aBuf, aBufLength); - return error; -} - -void qorvoUartSendInput(uint8_t *buffer, uint16_t length) -{ - otPlatUartReceived(buffer, length); -} - -void cbQorvoUartTxDone(void) -{ - otPlatUartSendDone(); -} - -OT_TOOL_WEAK void otPlatUartSendDone(void) -{ -} - -OT_TOOL_WEAK void otPlatUartReceived(const uint8_t *aBuf, uint16_t aBufLength) -{ - OT_UNUSED_VARIABLE(aBuf); - OT_UNUSED_VARIABLE(aBufLength); -} diff --git a/src/qpg6095/uart_qorvo.h b/src/qpg6095/uart_qorvo.h deleted file mode 100644 index 398161239..000000000 --- a/src/qpg6095/uart_qorvo.h +++ /dev/null @@ -1,102 +0,0 @@ -/* - * Copyright (c) 2019, 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 declarations of the uart functions from the Qorvo library. - * - */ - -#ifndef _UART_QORVO_H_ -#define _UART_QORVO_H_ - -#include -#include -#include -#include - -/** - * This function enables the UART driver. - * - */ -void qorvoUartInit(void); - -/** - * This function disables the UART driver. - * - */ -void qorvoUartDeInit(void); - -/** - * Callback function which will be called when uart transmission is done. - * - */ -void cbQorvoUartTxDone(void); - -/** - * Callback function which will be called when uart data is received. - * - * @param[in] aBuf A pointer to an array of received bytes. - * @param[in] aBufLength The number of bytes received from the uart. - * - */ -void qorvoUartSendInput(uint8_t *aBuf, uint16_t aBufLength); - -/** - * Function which transmits data via the uart. - * - * @param[out] aBuf A pointer to an array of bytes which need to be transmitted. - * @param[in] aBufLength The number of bytes to be transmitted via the uart. - * - */ -void qorvoUartSendOutput(const uint8_t *aBuf, uint16_t aBufLength); - -/** - * Function which transmits logging via the qorvo platform. - * - * @param[in] aLogLevel The severity level of logging. - * @param[in] aLogRegion The code region where the logging originated from. - * @param[in] aFormat The format strings. - * @param[in] varargs The arguments for the format string. - * - */ -void qorvoUartLog(otLogLevel aLogLevel, otLogRegion aLogRegion, const char *aFormat, ...); - -/** - * Flush the outgoing transmit buffer and wait for the data to be sent. - * This is called when the CLI UART interface has a full buffer but still - * wishes to send more data. - * - * @retval OT_ERROR_NONE Flush succeeded, we can proceed to write more - * data to the buffer. - * - * @retval OT_ERROR_NOT_IMPLEMENTED Driver does not support synchronous flush. - * @retval OT_ERROR_INVALID_STATE Driver has no data to flush. - */ -otError qorvoUartFlush(void); -#endif // _UART_QORVO_H_ diff --git a/src/qpg6100/CMakeLists.txt b/src/qpg6100/CMakeLists.txt deleted file mode 100644 index 4dca58b0f..000000000 --- a/src/qpg6100/CMakeLists.txt +++ /dev/null @@ -1,146 +0,0 @@ -# -# 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. -# - -target_compile_definitions(ot-config INTERFACE - "MBEDTLS_USER_CONFIG_FILE=\"qpg6100-mbedtls-config.h\"" -) - -list(APPEND OT_PUBLIC_INCLUDES - "${CMAKE_CURRENT_SOURCE_DIR}/crypto" -) -set(OT_PUBLIC_INCLUDES ${OT_PUBLIC_INCLUDES} PARENT_SCOPE) - -if(OT_CFLAGS MATCHES "-pedantic-errors") - string(REPLACE "-pedantic-errors" "" OT_CFLAGS "${OT_CFLAGS}") -endif() - -if(OT_CFLAGS MATCHES "-Wno-c\\+\\+14-compat") - string(REPLACE "-Wno-c++14-compat" "" OT_CFLAGS "${OT_CFLAGS}") -endif() - -add_library(openthread-qpg6100-ftd - alarm.c - diag.c - entropy.c - logging.c - misc.c - platform.c - radio.c - settings.cpp - uart.c -) - -set_target_properties( - openthread-qpg6100-ftd - PROPERTIES - C_STANDARD 99 - CXX_STANDARD 11 -) - -target_link_libraries(openthread-qpg6100-ftd - PRIVATE - -Wl,--start-group - qpg6100-driver-ftd - ${OT_MBEDTLS} - ot-config - -Wl,--end-group - PUBLIC - -T${SDK_DIR}/qpg6100/ld/qpg6100.ld - -nostdlib - -Wl,--gc-sections - -Wl,-Map=$.map,--cref -) - -target_compile_definitions(openthread-qpg6100-ftd - PUBLIC - ${OT_PLATFORM_DEFINES} -) - -target_compile_options(openthread-qpg6100-ftd - PRIVATE - ${OT_CFLAGS} -) - -target_include_directories(openthread-qpg6100-ftd - PRIVATE - ${OT_PUBLIC_INCLUDES} - ${OPENTHREAD_DIR}/examples/platforms -) - - -add_library(openthread-qpg6100-mtd - alarm.c - diag.c - entropy.c - logging.c - misc.c - platform.c - radio.c - settings.cpp - uart.c -) - -set_target_properties( - openthread-qpg6100-mtd - PROPERTIES - C_STANDARD 99 - CXX_STANDARD 11 -) - -target_link_libraries(openthread-qpg6100-mtd - PRIVATE - -Wl,--start-group - qpg6100-driver-mtd - ${OT_MBEDTLS} - ot-config - -Wl,--end-group - PUBLIC - -T${SDK_DIR}/qpg6100/ld/qpg6100.ld - -nostdlib - -Wl,--gc-sections - -Wl,-Map=$.map,--cref -) - -target_compile_definitions(openthread-qpg6100-mtd - PUBLIC - ${OT_PLATFORM_DEFINES} -) - -target_compile_options(openthread-qpg6100-mtd - PRIVATE - ${OT_CFLAGS} -) - -target_include_directories(openthread-qpg6100-mtd - PRIVATE - ${OT_PUBLIC_INCLUDES} - ${OPENTHREAD_DIR}/examples/platforms -) - -target_include_directories(ot-config INTERFACE ${OT_PUBLIC_INCLUDES}) -target_compile_definitions(ot-config INTERFACE ${OT_PLATFORM_DEFINES}) diff --git a/src/qpg6100/alarm.c b/src/qpg6100/alarm.c deleted file mode 100644 index 9bab20321..000000000 --- a/src/qpg6100/alarm.c +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Copyright (c) 2019, 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 OpenThread platform abstraction for the alarm. - * - */ - -#include -#include - -#include "alarm_qorvo.h" -#include -#include -#include - -uint32_t otPlatAlarmMilliGetNow(void) -{ - return qorvoAlarmGetTimeMs(); -} - -static void qorvoAlarmMilliFired(void *aInstance) -{ - otPlatAlarmMilliFired((otInstance *)aInstance); -} - -void otPlatAlarmMilliStartAt(otInstance *aInstance, uint32_t t0, uint32_t dt) -{ - OT_UNUSED_VARIABLE(t0); - - qorvoAlarmStop((qorvoAlarmCallback_t)qorvoAlarmMilliFired, aInstance); - qorvoAlarmMilliStart(dt, qorvoAlarmMilliFired, aInstance); -} - -void otPlatAlarmMilliStop(otInstance *aInstance) -{ - qorvoAlarmStop((qorvoAlarmCallback_t)qorvoAlarmMilliFired, aInstance); -} - -uint32_t otPlatAlarmMicroGetNow(void) -{ - return qorvoAlarmGetTimeUs(); -} - -static void qorvoAlarmMicroFired(void *aInstance) -{ - otPlatAlarmMicroFired((otInstance *)aInstance); -} - -void otPlatAlarmMicroStartAt(otInstance *aInstance, uint32_t t0, uint32_t dt) -{ - OT_UNUSED_VARIABLE(t0); - - qorvoAlarmStop((qorvoAlarmCallback_t)qorvoAlarmMicroFired, aInstance); - qorvoAlarmMicroStart(dt, qorvoAlarmMicroFired, aInstance); -} - -void otPlatAlarmMicroStop(otInstance *aInstance) -{ - qorvoAlarmStop((qorvoAlarmCallback_t)qorvoAlarmMicroFired, aInstance); -} diff --git a/src/qpg6100/alarm_qorvo.h b/src/qpg6100/alarm_qorvo.h deleted file mode 100644 index 88a0dc7f5..000000000 --- a/src/qpg6100/alarm_qorvo.h +++ /dev/null @@ -1,96 +0,0 @@ -/* - * Copyright (c) 2019, 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 declarations of the Alarm functions from the Qorvo library. - * - */ - -#ifndef ALARM_QORVO_H_ -#define ALARM_QORVO_H_ - -#include -#include -#include -#include - -typedef void (*qorvoAlarmCallback_t)(void *); - -/** - * This function initializes the alarm service used by OpenThread. - * - */ -void qorvoAlarmInit(void); - -/** - * This function retrieves the current host time in milliseconds. - * - * @param[out] The current time in ms. - * - */ -uint32_t qorvoAlarmGetTimeMs(void); - -/** - * This function retrieves the current host time in microseconds. - * - * @param[out] The current time in us. - * - */ -uint32_t qorvoAlarmGetTimeUs(void); - -/** - * This function schedules a callback after a relative amount of time. - * - * @param[in] rel_time The relative time in ms. - * @param[in] callback A callback function which will be called. - * @param[in] arg A context pointer which will be passed as an argument to the callback. - * - */ -void qorvoAlarmMilliStart(uint32_t rel_time, qorvoAlarmCallback_t callback, void *arg); - -/** - * This function schedules a callback after a relative amount of time. - * - * @param[in] rel_time The relative time in us. - * @param[in] callback A callback function which will be called. - * @param[in] arg A context pointer which will be passed as an argument to the callback. - * - */ -void qorvoAlarmMicroStart(uint32_t rel_time, qorvoAlarmCallback_t callback, void *arg); - -/** - * This function unschedules the callback. - * - * @param[in] callback A callback function which will be removed from the list. - * @param[in] arg A context pointer which will be passed as an argument to the callback. - * - */ -bool qorvoAlarmStop(qorvoAlarmCallback_t callback, void *arg); - -#endif // ALARM_QORVO_H_ diff --git a/src/qpg6100/arm-none-eabi.cmake b/src/qpg6100/arm-none-eabi.cmake deleted file mode 100644 index de1ed14aa..000000000 --- a/src/qpg6100/arm-none-eabi.cmake +++ /dev/null @@ -1,42 +0,0 @@ -# -# 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. -# - -set(CMAKE_SYSTEM_NAME Generic) -set(CMAKE_SYSTEM_PROCESSOR ARM) - -set(CMAKE_C_COMPILER arm-none-eabi-gcc) -set(CMAKE_CXX_COMPILER arm-none-eabi-g++) -set(CMAKE_ASM_COMPILER arm-none-eabi-as) -set(CMAKE_RANLIB arm-none-eabi-ranlib) - -set(COMMON_C_FLAGS "-mcpu=cortex-m4 -mthumb -fdata-sections -ffunction-sections") - -set(CMAKE_C_FLAGS_INIT "${COMMON_C_FLAGS} -std=gnu99") -set(CMAKE_CXX_FLAGS_INIT "${COMMON_C_FLAGS} -fno-exceptions -fno-rtti") -set(CMAKE_ASM_FLAGS_INIT "${COMMON_C_FLAGS}") -set(CMAKE_EXE_LINKER_FLAGS_INIT "${COMMON_C_FLAGS} -specs=nano.specs -specs=nosys.specs") diff --git a/src/qpg6100/crypto/aes_alt.h b/src/qpg6100/crypto/aes_alt.h deleted file mode 100644 index 07951eb60..000000000 --- a/src/qpg6100/crypto/aes_alt.h +++ /dev/null @@ -1,230 +0,0 @@ -/** - * \file aes_alt.h - * - * \brief AES block cipher - * - * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * This file is part of mbed TLS (https://tls.mbed.org) - */ -#ifndef MBEDTLS_AES_ALT_H -#define MBEDTLS_AES_ALT_H - -#if defined(MBEDTLS_AES_ALT) - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * \brief AES context structure - * - * \note buf is able to hold 32 extra bytes, which can be used: - * - for alignment purposes if VIA padlock is used, and/or - * - to simplify key expansion in the 256-bit case by - * generating an extra round key - */ -typedef struct -{ - uint32_t buf[68]; /*!< unaligned data */ - unsigned char key[32]; /*!< internal copy of the key */ - unsigned int keysize; /*!< size in bytes of the key */ -} mbedtls_aes_context; - -/** - * \brief Initialize AES context - * - * \param ctx AES context to be initialized - */ -void mbedtls_aes_init(mbedtls_aes_context *ctx); - -/** - * \brief Clear AES context - * - * \param ctx AES context to be cleared - */ -void mbedtls_aes_free(mbedtls_aes_context *ctx); - -/** - * \brief AES key schedule (encryption) - * - * \param ctx AES context to be initialized - * \param key encryption key - * \param keybits must be 128, 192 or 256 - * - * \return 0 if successful, or MBEDTLS_ERR_AES_INVALID_KEY_LENGTH - */ -int mbedtls_aes_setkey_enc(mbedtls_aes_context *ctx, const unsigned char *key, unsigned int keybits); - -/** - * \brief AES key schedule (decryption) - * - * \param ctx AES context to be initialized - * \param key decryption key - * \param keybits must be 128, 192 or 256 - * - * \return 0 if successful, or MBEDTLS_ERR_AES_INVALID_KEY_LENGTH - */ -int mbedtls_aes_setkey_dec(mbedtls_aes_context *ctx, const unsigned char *key, unsigned int keybits); - -/** - * \brief AES-ECB block encryption/decryption - * - * \param ctx AES context - * \param mode MBEDTLS_AES_ENCRYPT or MBEDTLS_AES_DECRYPT - * \param input 16-byte input block - * \param output 16-byte output block - * - * \return 0 if successful - */ -int mbedtls_aes_crypt_ecb(mbedtls_aes_context *ctx, int mode, const unsigned char input[16], unsigned char output[16]); - -#if defined(MBEDTLS_CIPHER_MODE_CBC) -/** - * \brief AES-CBC buffer encryption/decryption - * Length should be a multiple of the block - * size (16 bytes) - * - * \note Upon exit, the content of the IV is updated so that you can - * call the function same function again on the following - * block(s) of data and get the same result as if it was - * encrypted in one call. This allows a "streaming" usage. - * If on the other hand you need to retain the contents of the - * IV, you should either save it manually or use the cipher - * module instead. - * - * \param ctx AES context - * \param mode MBEDTLS_AES_ENCRYPT or MBEDTLS_AES_DECRYPT - * \param length length of the input data - * \param iv initialization vector (updated after use) - * \param input buffer holding the input data - * \param output buffer holding the output data - * - * \return 0 if successful, or MBEDTLS_ERR_AES_INVALID_INPUT_LENGTH - */ -int mbedtls_aes_crypt_cbc(mbedtls_aes_context *ctx, - int mode, - size_t length, - unsigned char iv[16], - const unsigned char *input, - unsigned char *output); -#endif /* MBEDTLS_CIPHER_MODE_CBC */ - -#if defined(MBEDTLS_CIPHER_MODE_CFB) -/** - * \brief AES-CFB128 buffer encryption/decryption. - * - * Note: Due to the nature of CFB you should use the same key schedule for - * both encryption and decryption. So a context initialized with - * mbedtls_aes_setkey_enc() for both MBEDTLS_AES_ENCRYPT and MBEDTLS_AES_DECRYPT. - * - * \note Upon exit, the content of the IV is updated so that you can - * call the function same function again on the following - * block(s) of data and get the same result as if it was - * encrypted in one call. This allows a "streaming" usage. - * If on the other hand you need to retain the contents of the - * IV, you should either save it manually or use the cipher - * module instead. - * - * \param ctx AES context - * \param mode MBEDTLS_AES_ENCRYPT or MBEDTLS_AES_DECRYPT - * \param length length of the input data - * \param iv_off offset in IV (updated after use) - * \param iv initialization vector (updated after use) - * \param input buffer holding the input data - * \param output buffer holding the output data - * - * \return 0 if successful - */ -int mbedtls_aes_crypt_cfb128(mbedtls_aes_context *ctx, - int mode, - size_t length, - size_t *iv_off, - unsigned char iv[16], - const unsigned char *input, - unsigned char *output); - -/** - * \brief AES-CFB8 buffer encryption/decryption. - * - * Note: Due to the nature of CFB you should use the same key schedule for - * both encryption and decryption. So a context initialized with - * mbedtls_aes_setkey_enc() for both MBEDTLS_AES_ENCRYPT and MBEDTLS_AES_DECRYPT. - * - * \note Upon exit, the content of the IV is updated so that you can - * call the function same function again on the following - * block(s) of data and get the same result as if it was - * encrypted in one call. This allows a "streaming" usage. - * If on the other hand you need to retain the contents of the - * IV, you should either save it manually or use the cipher - * module instead. - * - * \param ctx AES context - * \param mode MBEDTLS_AES_ENCRYPT or MBEDTLS_AES_DECRYPT - * \param length length of the input data - * \param iv initialization vector (updated after use) - * \param input buffer holding the input data - * \param output buffer holding the output data - * - * \return 0 if successful - */ -int mbedtls_aes_crypt_cfb8(mbedtls_aes_context *ctx, - int mode, - size_t length, - unsigned char iv[16], - const unsigned char *input, - unsigned char *output); -#endif /*MBEDTLS_CIPHER_MODE_CFB */ - -#if defined(MBEDTLS_CIPHER_MODE_CTR) -/** - * \brief AES-CTR buffer encryption/decryption - * - * Warning: You have to keep the maximum use of your counter in mind! - * - * Note: Due to the nature of CTR you should use the same key schedule for - * both encryption and decryption. So a context initialized with - * mbedtls_aes_setkey_enc() for both MBEDTLS_AES_ENCRYPT and MBEDTLS_AES_DECRYPT. - * - * \param ctx AES context - * \param length The length of the data - * \param nc_off The offset in the current stream_block (for resuming - * within current cipher stream). The offset pointer to - * should be 0 at the start of a stream. - * \param nonce_counter The 128-bit nonce and counter. - * \param stream_block The saved stream-block for resuming. Is overwritten - * by the function. - * \param input The input data stream - * \param output The output data stream - * - * \return 0 if successful - */ -int mbedtls_aes_crypt_ctr(mbedtls_aes_context *ctx, - size_t length, - size_t *nc_off, - unsigned char nonce_counter[16], - unsigned char stream_block[16], - const unsigned char *input, - unsigned char *output); -#endif /* MBEDTLS_CIPHER_MODE_CTR */ - -#ifdef __cplusplus -} -#endif - -#endif /* MBEDTLS_AES_ALT */ - -#endif /* aes_alt.h */ diff --git a/src/qpg6100/crypto/ccm_alt.h b/src/qpg6100/crypto/ccm_alt.h deleted file mode 100644 index 9ced9ab64..000000000 --- a/src/qpg6100/crypto/ccm_alt.h +++ /dev/null @@ -1,163 +0,0 @@ -/** - * \file ccm_alt.h - * - * \brief CCM combines Counter mode encryption with CBC-MAC authentication - * for 128-bit block ciphers. - * - * Input to CCM includes the following elements: - *
  • Payload - data that is both authenticated and encrypted.
  • - *
  • Associated data (Adata) - data that is authenticated but not - * encrypted, For example, a header.
  • - *
  • Nonce - A unique value that is assigned to the payload and the - * associated data.
- * - */ -/* - * Copyright (C) 2006-2018, Arm Limited (or its affiliates), All Rights Reserved - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * This file is part of Mbed TLS (https://tls.mbed.org) - */ - -#ifndef MBEDTLS_CCM_ALT_H -#define MBEDTLS_CCM_ALT_H - -#if defined(MBEDTLS_CCM_ALT) - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -#ifndef MBEDTLS_AES_MAX_KEY_SIZE -#define MBEDTLS_AES_MAX_KEY_SIZE 32 -#endif - -/** - * \brief The CCM context-type definition. The CCM context is passed - * to the APIs called. - */ -typedef struct -{ - uint8_t key[MBEDTLS_AES_MAX_KEY_SIZE]; - int keysize; -} mbedtls_ccm_context; - -/** - * \brief This function initializes the specified CCM context, - * to make references valid, and prepare the context - * for mbedtls_ccm_setkey() or mbedtls_ccm_free(). - * - * \param ctx The CCM context to initialize. - */ -void mbedtls_ccm_init(mbedtls_ccm_context *ctx); - -/** - * \brief This function initializes the CCM context set in the - * \p ctx parameter and sets the encryption key. - * - * \param ctx The CCM context to initialize. - * \param cipher The 128-bit block cipher to use. - * \param key The encryption key. - * \param keybits The key size in bits. This must be acceptable by the cipher. - * - * \return \c 0 on success, or a cipher-specific error code. - */ -int mbedtls_ccm_setkey(mbedtls_ccm_context *ctx, - mbedtls_cipher_id_t cipher, - const unsigned char *key, - unsigned int keybits); - -/** - * \brief This function releases and clears the specified CCM context - * and underlying cipher sub-context. - * - * \param ctx The CCM context to clear. - */ -void mbedtls_ccm_free(mbedtls_ccm_context *ctx); - -/** - * \brief This function encrypts a buffer using CCM. - * - * \param ctx The CCM context to use for encryption. - * \param length The length of the input data in Bytes. - * \param iv Initialization vector (nonce). - * \param iv_len The length of the IV in Bytes: 7, 8, 9, 10, 11, 12, or 13. - * \param add The additional data field. - * \param add_len The length of additional data in Bytes. - * Must be less than 2^16 - 2^8. - * \param input The buffer holding the input data. - * \param output The buffer holding the output data. - * Must be at least \p length Bytes wide. - * \param tag The buffer holding the tag. - * \param tag_len The length of the tag to generate in Bytes: - * 4, 6, 8, 10, 14 or 16. - * - * \note The tag is written to a separate buffer. To concatenate - * the \p tag with the \p output, as done in RFC-3610: - * Counter with CBC-MAC (CCM), use - * \p tag = \p output + \p length, and make sure that the - * output buffer is at least \p length + \p tag_len wide. - * - * \return \c 0 on success. - */ -int mbedtls_ccm_encrypt_and_tag(mbedtls_ccm_context *ctx, - size_t length, - const unsigned char *iv, - size_t iv_len, - const unsigned char *add, - size_t add_len, - const unsigned char *input, - unsigned char *output, - unsigned char *tag, - size_t tag_len); - -/** - * \brief This function performs a CCM authenticated decryption of a - * buffer. - * - * \param ctx The CCM context to use for decryption. - * \param length The length of the input data in Bytes. - * \param iv Initialization vector. - * \param iv_len The length of the IV in Bytes: 7, 8, 9, 10, 11, 12, or 13. - * \param add The additional data field. - * \param add_len The length of additional data in Bytes. - * \param input The buffer holding the input data. - * \param output The buffer holding the output data. - * \param tag The buffer holding the tag. - * \param tag_len The length of the tag in Bytes. - * - * \return 0 if successful and authenticated, or - * #MBEDTLS_ERR_CCM_AUTH_FAILED if the tag does not match. - */ -int mbedtls_ccm_auth_decrypt(mbedtls_ccm_context *ctx, - size_t length, - const unsigned char *iv, - size_t iv_len, - const unsigned char *add, - size_t add_len, - const unsigned char *input, - unsigned char *output, - const unsigned char *tag, - size_t tag_len); - -#ifdef __cplusplus -} -#endif - -#endif /* MBEDTLS_CCM_ALT */ - -#endif /* MBEDTLS_CCM_ALT_H */ diff --git a/src/qpg6100/crypto/ecjpake_alt.h b/src/qpg6100/crypto/ecjpake_alt.h deleted file mode 100644 index 95d35eed4..000000000 --- a/src/qpg6100/crypto/ecjpake_alt.h +++ /dev/null @@ -1,233 +0,0 @@ -/** - * \file ecjpake_alt.h - * - * \brief Elliptic curve J-PAKE - */ -/* - * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * This file is part of mbed TLS (https://tls.mbed.org) - */ -#ifndef MBEDTLS_ECJPAKE_ALT_H -#define MBEDTLS_ECJPAKE_ALT_H - -#if defined(MBEDTLS_ECJPAKE_ALT) - -#ifdef __cplusplus -extern "C" { -#endif - -#ifndef MBEDTLS_ECJPAKE_ALT // QORVO -/** - * Roles in the EC J-PAKE exchange - */ -typedef enum -{ - MBEDTLS_ECJPAKE_CLIENT = 0, /**< Client */ - MBEDTLS_ECJPAKE_SERVER, /**< Server */ -} mbedtls_ecjpake_role; -#endif // MBEDTLS_ECJPAKE_ALT // QORVO - -#ifndef MBEDTLS_ECJPAKE_MAX_BYTES - -/** The maximum size in bytes for a ECJPAKE number or coordinate. - * - * Default size works for P256 as MbedTLS and the Thread standard officially - * only support P256. To support larger curves, chose MBEDTLS_ECP_MAX_BYTES. - */ -#define MBEDTLS_ECJPAKE_MAX_BYTES (256 / 8) -#endif - -/** - * EC J-PAKE context structure. - * - * J-PAKE is a symmetric protocol, except for the identifiers used in - * Zero-Knowledge Proofs, and the serialization of the second message - * (KeyExchange) as defined by the Thread spec. - * - * In order to benefit from this symmetry, we choose a different naming - * convetion from the Thread v1.0 spec. Correspondance is indicated in the - * description as a pair C: client name, S: server name - */ -typedef struct -{ - mbedtls_ecp_group grp; /**< Elliptic curve */ - mbedtls_ecjpake_role role; /**< Are we client or server? */ - int point_format; /**< Format for point export */ - - mbedtls_ecp_point Xm1; /**< My public key 1 C: X1, S: X3 */ - mbedtls_ecp_point Xm2; /**< My public key 2 C: X2, S: X4 */ - mbedtls_ecp_point Xp1; /**< Peer public key 1 C: X3, S: X1 */ - mbedtls_ecp_point Xp2; /**< Peer public key 2 C: X4, S: X2 */ - mbedtls_ecp_point Xp; /**< Peer public key C: Xs, S: Xc */ - - mbedtls_mpi xm1; /**< My private key 1 C: x1, S: x3 */ - mbedtls_mpi xm2; /**< My private key 2 C: x2, S: x4 */ - - mbedtls_mpi s; /**< Pre-shared secret (passphrase) */ - - const struct sx_ecc_curve_t *curve; /**< Elliptic curve for HW offload */ - int hashalg; /**< Hash algorithm for HW offload */ -} mbedtls_ecjpake_context; - -#ifndef MBEDTLS_ECJPAKE_ALT // QORVO -/** - * \brief Initialize a context - * (just makes it ready for setup() or free()). - * - * \param ctx context to initialize - */ -void mbedtls_ecjpake_init(mbedtls_ecjpake_context *ctx); - -/** - * \brief Set up a context for use - * - * \note Currently the only values for hash/curve allowed by the - * standard are MBEDTLS_MD_SHA256/MBEDTLS_ECP_DP_SECP256R1. - * - * \param ctx context to set up - * \param role Our role: client or server - * \param hash hash function to use (MBEDTLS_MD_XXX) - * \param curve elliptic curve identifier (MBEDTLS_ECP_DP_XXX) - * \param secret pre-shared secret (passphrase) - * \param len length of the shared secret - * - * \return 0 if successfull, - * a negative error code otherwise - */ -int mbedtls_ecjpake_setup(mbedtls_ecjpake_context *ctx, - mbedtls_ecjpake_role role, - mbedtls_md_type_t hash, - mbedtls_ecp_group_id curve, - const unsigned char *secret, - size_t len); - -/** - * \brief Check if a context is ready for use - * - * \param ctx Context to check - * - * \return 0 if the context is ready for use, - * MBEDTLS_ERR_ECP_BAD_INPUT_DATA otherwise - */ -int mbedtls_ecjpake_check(const mbedtls_ecjpake_context *ctx); - -/** - * \brief Generate and write the first round message - * (TLS: contents of the Client/ServerHello extension, - * excluding extension type and length bytes) - * - * \param ctx Context to use - * \param buf Buffer to write the contents to - * \param len Buffer size - * \param olen Will be updated with the number of bytes written - * \param f_rng RNG function - * \param p_rng RNG parameter - * - * \return 0 if successfull, - * a negative error code otherwise - */ -int mbedtls_ecjpake_write_round_one(mbedtls_ecjpake_context *ctx, - unsigned char *buf, - size_t len, - size_t *olen, - int (*f_rng)(void *, unsigned char *, size_t), - void *p_rng); - -/** - * \brief Read and process the first round message - * (TLS: contents of the Client/ServerHello extension, - * excluding extension type and length bytes) - * - * \param ctx Context to use - * \param buf Pointer to extension contents - * \param len Extension length - * - * \return 0 if successfull, - * a negative error code otherwise - */ -int mbedtls_ecjpake_read_round_one(mbedtls_ecjpake_context *ctx, const unsigned char *buf, size_t len); - -/** - * \brief Generate and write the second round message - * (TLS: contents of the Client/ServerKeyExchange) - * - * \param ctx Context to use - * \param buf Buffer to write the contents to - * \param len Buffer size - * \param olen Will be updated with the number of bytes written - * \param f_rng RNG function - * \param p_rng RNG parameter - * - * \return 0 if successfull, - * a negative error code otherwise - */ -int mbedtls_ecjpake_write_round_two(mbedtls_ecjpake_context *ctx, - unsigned char *buf, - size_t len, - size_t *olen, - int (*f_rng)(void *, unsigned char *, size_t), - void *p_rng); - -/** - * \brief Read and process the second round message - * (TLS: contents of the Client/ServerKeyExchange) - * - * \param ctx Context to use - * \param buf Pointer to the message - * \param len Message length - * - * \return 0 if successfull, - * a negative error code otherwise - */ -int mbedtls_ecjpake_read_round_two(mbedtls_ecjpake_context *ctx, const unsigned char *buf, size_t len); - -/** - * \brief Derive the shared secret - * (TLS: Pre-Master Secret) - * - * \param ctx Context to use - * \param buf Buffer to write the contents to - * \param len Buffer size - * \param olen Will be updated with the number of bytes written - * \param f_rng RNG function - * \param p_rng RNG parameter - * - * \return 0 if successfull, - * a negative error code otherwise - */ -int mbedtls_ecjpake_derive_secret(mbedtls_ecjpake_context *ctx, - unsigned char *buf, - size_t len, - size_t *olen, - int (*f_rng)(void *, unsigned char *, size_t), - void *p_rng); - -/** - * \brief Free a context's content - * - * \param ctx context to free - */ -void mbedtls_ecjpake_free(mbedtls_ecjpake_context *ctx); -#endif // MBEDTLS_ECJPAKE_ALT // QORVO - -#ifdef __cplusplus -} -#endif - -#endif /* MBEDTLS_ECJPAKE_ALT */ - -#endif /* ecjpake.h */ diff --git a/src/qpg6100/crypto/ecp_alt.h b/src/qpg6100/crypto/ecp_alt.h deleted file mode 100644 index 2b3798c07..000000000 --- a/src/qpg6100/crypto/ecp_alt.h +++ /dev/null @@ -1,657 +0,0 @@ -/** - * \file ecp_alt.h - * - * \brief Elliptic curves over GF(p) - * - * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * This file is part of mbed TLS (https://tls.mbed.org) - */ -/* Adapted for hardware acceleration by CryptoSoc - * Copyright (c) 2018 Barco Silex - * Copyright (c) 2018 François Beerten - */ - -#ifndef MBEDTLS_ECP_ALT_H -#define MBEDTLS_ECP_ALT_H - -/* - * default mbed TLS elliptic curve arithmetic implementation - * - * (in case MBEDTLS_ECP_ALT is defined then the developer has to provide an - * alternative implementation for the whole module and it will replace this - * one.) - */ - -#ifdef __cplusplus -extern "C" { -#endif - -#ifndef MBEDTLS_ECP_ALT // QORVO -/** - * Domain parameters (curve, subgroup and generator) identifiers. - * - * Only curves over prime fields are supported. - * - * \warning This library does not support validation of arbitrary domain - * parameters. Therefore, only well-known domain parameters from trusted - * sources should be used. See mbedtls_ecp_group_load(). - */ -typedef enum -{ - MBEDTLS_ECP_DP_NONE = 0, - MBEDTLS_ECP_DP_SECP192R1, /*!< 192-bits NIST curve */ - MBEDTLS_ECP_DP_SECP224R1, /*!< 224-bits NIST curve */ - MBEDTLS_ECP_DP_SECP256R1, /*!< 256-bits NIST curve */ - MBEDTLS_ECP_DP_SECP384R1, /*!< 384-bits NIST curve */ - MBEDTLS_ECP_DP_SECP521R1, /*!< 521-bits NIST curve */ - MBEDTLS_ECP_DP_BP256R1, /*!< 256-bits Brainpool curve */ - MBEDTLS_ECP_DP_BP384R1, /*!< 384-bits Brainpool curve */ - MBEDTLS_ECP_DP_BP512R1, /*!< 512-bits Brainpool curve */ - MBEDTLS_ECP_DP_CURVE25519, /*!< Curve25519 */ - MBEDTLS_ECP_DP_SECP192K1, /*!< 192-bits "Koblitz" curve */ - MBEDTLS_ECP_DP_SECP224K1, /*!< 224-bits "Koblitz" curve */ - MBEDTLS_ECP_DP_SECP256K1, /*!< 256-bits "Koblitz" curve */ -} mbedtls_ecp_group_id; - -/** - * Number of supported curves (plus one for NONE). - * - * (Montgomery curves excluded for now.) - */ -#define MBEDTLS_ECP_DP_MAX 12 - -/** - * Curve information for use by other modules - */ -typedef struct -{ - mbedtls_ecp_group_id grp_id; /*!< Internal identifier */ - uint16_t tls_id; /*!< TLS NamedCurve identifier */ - uint16_t bit_size; /*!< Curve size in bits */ - const char *name; /*!< Human-friendly name */ -} mbedtls_ecp_curve_info; - -/** - * \brief ECP point structure (jacobian coordinates) - * - * \note All functions expect and return points satisfying - * the following condition: Z == 0 or Z == 1. (Other - * values of Z are used by internal functions only.) - * The point is zero, or "at infinity", if Z == 0. - * Otherwise, X and Y are its standard (affine) coordinates. - */ -typedef struct -{ - mbedtls_mpi X; /*!< the point's X coordinate */ - mbedtls_mpi Y; /*!< the point's Y coordinate */ - mbedtls_mpi Z; /*!< the point's Z coordinate */ -} mbedtls_ecp_point; -#endif // MBEDTLS_ECP_ALT // QORVO - -/** - * \brief ECP group structure - * - * We consider two types of curves equations: - * 1. Short Weierstrass y^2 = x^3 + A x + B mod P (SEC1 + RFC 4492) - * 2. Montgomery, y^2 = x^3 + A x^2 + x mod P (Curve25519 + draft) - * In both cases, a generator G for a prime-order subgroup is fixed. In the - * short weierstrass, this subgroup is actually the whole curve, and its - * cardinal is denoted by N. - * - * In the case of Short Weierstrass curves, our code requires that N is an odd - * prime. (Use odd in mbedtls_ecp_mul() and prime in mbedtls_ecdsa_sign() for blinding.) - * - * In the case of Montgomery curves, we don't store A but (A + 2) / 4 which is - * the quantity actually used in the formulas. Also, nbits is not the size of N - * but the required size for private keys. - * - * If modp is NULL, reduction modulo P is done using a generic algorithm. - * Otherwise, it must point to a function that takes an mbedtls_mpi in the range - * 0..2^(2*pbits)-1 and transforms it in-place in an integer of little more - * than pbits, so that the integer may be efficiently brought in the 0..P-1 - * range by a few additions or substractions. It must return 0 on success and - * non-zero on failure. - */ -typedef struct -{ - mbedtls_ecp_group_id id; /*!< internal group identifier */ - mbedtls_mpi P; /*!< prime modulus of the base field */ - mbedtls_mpi A; /*!< 1. A in the equation, or 2. (A + 2) / 4. for pkparse only. */ - mbedtls_mpi B; /*!< 1. B in the equation, or 2. unused. for pkparse only. */ - mbedtls_ecp_point G; /*!< generator of the (sub)group used */ - mbedtls_mpi N; /*!< 1. the order of G, or 2. unused */ - size_t pbits; /*!< number of bits in P */ - size_t nbits; /*!< number of bits in 1. P, or 2. private keys */ - unsigned int h; /*!< internal: 1 if the constants are static */ - int (*modp)(mbedtls_mpi *); /*!< Internally unused. NULL to build some tests. */ - mbedtls_ecp_point *T; /*!< Internally unused. Needed to build benchmark. */ - size_t T_size; /*!< Internally unused. Needed to build benchmark. */ -} mbedtls_ecp_group; - -#ifndef MBEDTLS_ECP_ALT // QORVO -/** - * \brief ECP key pair structure - * - * A generic key pair that could be used for ECDSA, fixed ECDH, etc. - * - * \note Members purposefully in the same order as struc mbedtls_ecdsa_context. - */ -typedef struct -{ - mbedtls_ecp_group grp; /*!< Elliptic curve and base point */ - mbedtls_mpi d; /*!< our secret value */ - mbedtls_ecp_point Q; /*!< our public value */ -} mbedtls_ecp_keypair; -#endif // MBEDTLS_ECP_ALT // QORVO - -/** - * \name SECTION: Module settings - * - * The configuration options you can set for this module are in this section. - * Either change them in config.h or define them on the compiler command line. - * \{ - */ - -#if !defined(MBEDTLS_ECP_MAX_BITS) -/** - * Maximum size of the groups (that is, of N and P) - */ -#define MBEDTLS_ECP_MAX_BITS 521 /**< Maximum bit size of groups */ -#endif - -#define MBEDTLS_ECP_MAX_BYTES ((MBEDTLS_ECP_MAX_BITS + 7) / 8) -#define MBEDTLS_ECP_MAX_PT_LEN (2 * MBEDTLS_ECP_MAX_BYTES + 1) - -#if defined(MBEDTLS_ECP_WINDOW_SIZE) -#error "MBEDTLS_ECP_WINDOW_SIZE not applicable for HW accel" -#endif /* MBEDTLS_ECP_WINDOW_SIZE */ - -#if defined(MBEDTLS_ECP_FIXED_POINT_OPTIM) -#error "MBEDTLS_ECP_FIXED_POINT_OPTIM not applicable for HW accel" -#endif /* MBEDTLS_ECP_FIXED_POINT_OPTIM */ - -/* \} name SECTION: Module settings */ - -/* - * Point formats, from RFC 4492's enum ECPointFormat - */ -#define MBEDTLS_ECP_PF_UNCOMPRESSED 0 /**< Uncompressed point format */ -#define MBEDTLS_ECP_PF_COMPRESSED 1 /**< Compressed point format */ - -/* - * Some other constants from RFC 4492 - */ -#define MBEDTLS_ECP_TLS_NAMED_CURVE 3 /**< ECCurveType's named_curve */ - -#ifndef MBEDTLS_ECP_ALT // QORVO -/** - * \brief Get the list of supported curves in order of preferrence - * (full information) - * - * \return A statically allocated array, the last entry is 0. - */ -const mbedtls_ecp_curve_info *mbedtls_ecp_curve_list(void); - -/** - * \brief Get the list of supported curves in order of preferrence - * (grp_id only) - * - * \return A statically allocated array, - * terminated with MBEDTLS_ECP_DP_NONE. - */ -const mbedtls_ecp_group_id *mbedtls_ecp_grp_id_list(void); - -/** - * \brief Get curve information from an internal group identifier - * - * \param grp_id A MBEDTLS_ECP_DP_XXX value - * - * \return The associated curve information or NULL - */ -const mbedtls_ecp_curve_info *mbedtls_ecp_curve_info_from_grp_id(mbedtls_ecp_group_id grp_id); - -/** - * \brief Get curve information from a TLS NamedCurve value - * - * \param tls_id A MBEDTLS_ECP_DP_XXX value - * - * \return The associated curve information or NULL - */ -const mbedtls_ecp_curve_info *mbedtls_ecp_curve_info_from_tls_id(uint16_t tls_id); - -/** - * \brief Get curve information from a human-readable name - * - * \param name The name - * - * \return The associated curve information or NULL - */ -const mbedtls_ecp_curve_info *mbedtls_ecp_curve_info_from_name(const char *name); - -/** - * \brief Initialize a point (as zero) - */ -void mbedtls_ecp_point_init(mbedtls_ecp_point *pt); - -/** - * \brief Initialize a group (to something meaningless) - */ -void mbedtls_ecp_group_init(mbedtls_ecp_group *grp); - -/** - * \brief Initialize a key pair (as an invalid one) - */ -void mbedtls_ecp_keypair_init(mbedtls_ecp_keypair *key); - -/** - * \brief Free the components of a point - */ -void mbedtls_ecp_point_free(mbedtls_ecp_point *pt); - -/** - * \brief Free the components of an ECP group - */ -void mbedtls_ecp_group_free(mbedtls_ecp_group *grp); - -/** - * \brief Free the components of a key pair - */ -void mbedtls_ecp_keypair_free(mbedtls_ecp_keypair *key); - -/** - * \brief Copy the contents of point Q into P - * - * \param P Destination point - * \param Q Source point - * - * \return 0 if successful, - * MBEDTLS_ERR_MPI_ALLOC_FAILED if memory allocation failed - */ -int mbedtls_ecp_copy(mbedtls_ecp_point *P, const mbedtls_ecp_point *Q); - -/** - * \brief Copy the contents of a group object - * - * \param dst Destination group - * \param src Source group - * - * \return 0 if successful, - * MBEDTLS_ERR_MPI_ALLOC_FAILED if memory allocation failed - */ -int mbedtls_ecp_group_copy(mbedtls_ecp_group *dst, const mbedtls_ecp_group *src); - -/** - * \brief Set a point to zero - * - * \param pt Destination point - * - * \return 0 if successful, - * MBEDTLS_ERR_MPI_ALLOC_FAILED if memory allocation failed - */ -int mbedtls_ecp_set_zero(mbedtls_ecp_point *pt); - -/** - * \brief Tell if a point is zero - * - * \param pt Point to test - * - * \return 1 if point is zero, 0 otherwise - */ -int mbedtls_ecp_is_zero(mbedtls_ecp_point *pt); - -/** - * \brief Compare two points - * - * \note This assumes the points are normalized. Otherwise, - * they may compare as "not equal" even if they are. - * - * \param P First point to compare - * \param Q Second point to compare - * - * \return 0 if the points are equal, - * MBEDTLS_ERR_ECP_BAD_INPUT_DATA otherwise - */ -int mbedtls_ecp_point_cmp(const mbedtls_ecp_point *P, const mbedtls_ecp_point *Q); - -/** - * \brief Import a non-zero point from two ASCII strings - * - * \param P Destination point - * \param radix Input numeric base - * \param x First affine coordinate as a null-terminated string - * \param y Second affine coordinate as a null-terminated string - * - * \return 0 if successful, or a MBEDTLS_ERR_MPI_XXX error code - */ -int mbedtls_ecp_point_read_string(mbedtls_ecp_point *P, int radix, const char *x, const char *y); - -/** - * \brief Export a point into unsigned binary data - * - * \param grp Group to which the point should belong - * \param P Point to export - * \param format Point format, should be a MBEDTLS_ECP_PF_XXX macro - * \param olen Length of the actual output - * \param buf Output buffer - * \param buflen Length of the output buffer - * - * \return 0 if successful, - * or MBEDTLS_ERR_ECP_BAD_INPUT_DATA - * or MBEDTLS_ERR_ECP_BUFFER_TOO_SMALL - */ -int mbedtls_ecp_point_write_binary(const mbedtls_ecp_group *grp, - const mbedtls_ecp_point *P, - int format, - size_t *olen, - unsigned char *buf, - size_t buflen); - -/** - * \brief Import a point from unsigned binary data - * - * \param grp Group to which the point should belong - * \param P Point to import - * \param buf Input buffer - * \param ilen Actual length of input - * - * \return 0 if successful, - * MBEDTLS_ERR_ECP_BAD_INPUT_DATA if input is invalid, - * MBEDTLS_ERR_MPI_ALLOC_FAILED if memory allocation failed, - * MBEDTLS_ERR_ECP_FEATURE_UNAVAILABLE if the point format - * is not implemented. - * - * \note This function does NOT check that the point actually - * belongs to the given group, see mbedtls_ecp_check_pubkey() for - * that. - */ -int mbedtls_ecp_point_read_binary(const mbedtls_ecp_group *grp, - mbedtls_ecp_point *P, - const unsigned char *buf, - size_t ilen); - -/** - * \brief Import a point from a TLS ECPoint record - * - * \param grp ECP group used - * \param pt Destination point - * \param buf $(Start of input buffer) - * \param len Buffer length - * - * \note buf is updated to point right after the ECPoint on exit - * - * \return 0 if successful, - * MBEDTLS_ERR_MPI_XXX if initialization failed - * MBEDTLS_ERR_ECP_BAD_INPUT_DATA if input is invalid - */ -int mbedtls_ecp_tls_read_point(const mbedtls_ecp_group *grp, - mbedtls_ecp_point *pt, - const unsigned char **buf, - size_t len); - -/** - * \brief Export a point as a TLS ECPoint record - * - * \param grp ECP group used - * \param pt Point to export - * \param format Export format - * \param olen length of data written - * \param buf Buffer to write to - * \param blen Buffer length - * - * \return 0 if successful, - * or MBEDTLS_ERR_ECP_BAD_INPUT_DATA - * or MBEDTLS_ERR_ECP_BUFFER_TOO_SMALL - */ -int mbedtls_ecp_tls_write_point(const mbedtls_ecp_group *grp, - const mbedtls_ecp_point *pt, - int format, - size_t *olen, - unsigned char *buf, - size_t blen); - -/** - * \brief Set a group using well-known domain parameters - * - * \param grp Destination group - * \param id Index in the list of well-known domain parameters - * - * \return 0 if successful, - * MBEDTLS_ERR_MPI_XXX if initialization failed - * MBEDTLS_ERR_ECP_FEATURE_UNAVAILABLE for unkownn groups - * - * \note Index should be a value of RFC 4492's enum NamedCurve, - * usually in the form of a MBEDTLS_ECP_DP_XXX macro. - */ -int mbedtls_ecp_group_load(mbedtls_ecp_group *grp, mbedtls_ecp_group_id id); - -/** - * \brief Set a group from a TLS ECParameters record - * - * \param grp Destination group - * \param buf &(Start of input buffer) - * \param len Buffer length - * - * \note buf is updated to point right after ECParameters on exit - * - * \return 0 if successful, - * MBEDTLS_ERR_MPI_XXX if initialization failed - * MBEDTLS_ERR_ECP_BAD_INPUT_DATA if input is invalid - */ -int mbedtls_ecp_tls_read_group(mbedtls_ecp_group *grp, const unsigned char **buf, size_t len); - -/** - * \brief Write the TLS ECParameters record for a group - * - * \param grp ECP group used - * \param olen Number of bytes actually written - * \param buf Buffer to write to - * \param blen Buffer length - * - * \return 0 if successful, - * or MBEDTLS_ERR_ECP_BUFFER_TOO_SMALL - */ -int mbedtls_ecp_tls_write_group(const mbedtls_ecp_group *grp, size_t *olen, unsigned char *buf, size_t blen); - -/** - * \brief Multiplication by an integer: R = m * P - * (Not thread-safe to use same group in multiple threads) - * - * \note In order to prevent timing attacks, this function - * executes the exact same sequence of (base field) - * operations for any valid m. It avoids any if-branch or - * array index depending on the value of m. - * - * \note If f_rng is not NULL, it is used to randomize intermediate - * results in order to prevent potential timing attacks - * targeting these results. It is recommended to always - * provide a non-NULL f_rng (the overhead is negligible). - * - * \param grp ECP group - * \param R Destination point - * \param m Integer by which to multiply - * \param P Point to multiply - * \param f_rng RNG function (see notes) - * \param p_rng RNG parameter - * - * \return 0 if successful, - * MBEDTLS_ERR_ECP_INVALID_KEY if m is not a valid privkey - * or P is not a valid pubkey, - * MBEDTLS_ERR_MPI_ALLOC_FAILED if memory allocation failed - */ -int mbedtls_ecp_mul(mbedtls_ecp_group *grp, - mbedtls_ecp_point *R, - const mbedtls_mpi *m, - const mbedtls_ecp_point *P, - int (*f_rng)(void *, unsigned char *, size_t), - void *p_rng); - -/** - * \brief Multiplication and addition of two points by integers: - * R = m * P + n * Q - * (Not thread-safe to use same group in multiple threads) - * - * \note In contrast to mbedtls_ecp_mul(), this function does not guarantee - * a constant execution flow and timing. - * - * \param grp ECP group - * \param R Destination point - * \param m Integer by which to multiply P - * \param P Point to multiply by m - * \param n Integer by which to multiply Q - * \param Q Point to be multiplied by n - * - * \return 0 if successful, - * MBEDTLS_ERR_ECP_INVALID_KEY if m or n is not a valid privkey - * or P or Q is not a valid pubkey, - * MBEDTLS_ERR_MPI_ALLOC_FAILED if memory allocation failed - */ -int mbedtls_ecp_muladd(mbedtls_ecp_group *grp, - mbedtls_ecp_point *R, - const mbedtls_mpi *m, - const mbedtls_ecp_point *P, - const mbedtls_mpi *n, - const mbedtls_ecp_point *Q); - -/** - * \brief Check that a point is a valid public key on this curve - * - * \param grp Curve/group the point should belong to - * \param pt Point to check - * - * \return 0 if point is a valid public key, - * MBEDTLS_ERR_ECP_INVALID_KEY otherwise. - * - * \note This function only checks the point is non-zero, has valid - * coordinates and lies on the curve, but not that it is - * indeed a multiple of G. This is additional check is more - * expensive, isn't required by standards, and shouldn't be - * necessary if the group used has a small cofactor. In - * particular, it is useless for the NIST groups which all - * have a cofactor of 1. - * - * \note Uses bare components rather than an mbedtls_ecp_keypair structure - * in order to ease use with other structures such as - * mbedtls_ecdh_context of mbedtls_ecdsa_context. - */ -int mbedtls_ecp_check_pubkey(const mbedtls_ecp_group *grp, const mbedtls_ecp_point *pt); - -/** - * \brief Check that an mbedtls_mpi is a valid private key for this curve - * - * \param grp Group used - * \param d Integer to check - * - * \return 0 if point is a valid private key, - * MBEDTLS_ERR_ECP_INVALID_KEY otherwise. - * - * \note Uses bare components rather than an mbedtls_ecp_keypair structure - * in order to ease use with other structures such as - * mbedtls_ecdh_context of mbedtls_ecdsa_context. - */ -int mbedtls_ecp_check_privkey(const mbedtls_ecp_group *grp, const mbedtls_mpi *d); - -/** - * \brief Generate a keypair with configurable base point - * - * \param grp ECP group - * \param G Chosen base point - * \param d Destination MPI (secret part) - * \param Q Destination point (public part) - * \param f_rng RNG function - * \param p_rng RNG parameter - * - * \return 0 if successful, - * or a MBEDTLS_ERR_ECP_XXX or MBEDTLS_MPI_XXX error code - * - * \note Uses bare components rather than an mbedtls_ecp_keypair structure - * in order to ease use with other structures such as - * mbedtls_ecdh_context of mbedtls_ecdsa_context. - */ -int mbedtls_ecp_gen_keypair_base(mbedtls_ecp_group *grp, - const mbedtls_ecp_point *G, - mbedtls_mpi *d, - mbedtls_ecp_point *Q, - int (*f_rng)(void *, unsigned char *, size_t), - void *p_rng); - -/** - * \brief Generate a keypair - * - * \param grp ECP group - * \param d Destination MPI (secret part) - * \param Q Destination point (public part) - * \param f_rng RNG function - * \param p_rng RNG parameter - * - * \return 0 if successful, - * or a MBEDTLS_ERR_ECP_XXX or MBEDTLS_MPI_XXX error code - * - * \note Uses bare components rather than an mbedtls_ecp_keypair structure - * in order to ease use with other structures such as - * mbedtls_ecdh_context of mbedtls_ecdsa_context. - */ -int mbedtls_ecp_gen_keypair(mbedtls_ecp_group *grp, - mbedtls_mpi *d, - mbedtls_ecp_point *Q, - int (*f_rng)(void *, unsigned char *, size_t), - void *p_rng); - -/** - * \brief Generate a keypair - * - * \param grp_id ECP group identifier - * \param key Destination keypair - * \param f_rng RNG function - * \param p_rng RNG parameter - * - * \return 0 if successful, - * or a MBEDTLS_ERR_ECP_XXX or MBEDTLS_MPI_XXX error code - */ -int mbedtls_ecp_gen_key(mbedtls_ecp_group_id grp_id, - mbedtls_ecp_keypair *key, - int (*f_rng)(void *, unsigned char *, size_t), - void *p_rng); - -/** - * \brief Check a public-private key pair - * - * \param pub Keypair structure holding a public key - * \param prv Keypair structure holding a private (plus public) key - * - * \return 0 if successful (keys are valid and match), or - * MBEDTLS_ERR_ECP_BAD_INPUT_DATA, or - * a MBEDTLS_ERR_ECP_XXX or MBEDTLS_ERR_MPI_XXX code. - */ -int mbedtls_ecp_check_pub_priv(const mbedtls_ecp_keypair *pub, const mbedtls_ecp_keypair *prv); -#endif // MBEDTLS_ECP_ALT // QORVO - -#if defined(MBEDTLS_SELF_TEST) - -/** - * \brief Checkup routine - * - * \return 0 if successful, or 1 if a test failed - */ -int mbedtls_ecp_self_test(int verbose); - -#endif /* MBEDTLS_SELF_TEST */ - -#ifdef __cplusplus -} -#endif - -#endif /* ecp_alt.h */ diff --git a/src/qpg6100/crypto/qpg6100-mbedtls-config.h b/src/qpg6100/crypto/qpg6100-mbedtls-config.h deleted file mode 100644 index 19febf530..000000000 --- a/src/qpg6100/crypto/qpg6100-mbedtls-config.h +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (c) 2019, 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. - */ - -#ifndef QPG6100_MBEDTLS_CONFIG_H -#define QPG6100_MBEDTLS_CONFIG_H - -// Use Qorvo HW crypto support -#undef MBEDTLS_ECP_WINDOW_SIZE -#undef MBEDTLS_ECP_FIXED_POINT_OPTIM - -#define MBEDTLS_AES_ALT -#define MBEDTLS_CCM_ALT -#define MBEDTLS_ECP_ALT -#define MBEDTLS_ECJPAKE_ALT -#define MBEDTLS_SHA256_ALT - -#if defined(QORVO_MBEDTLS_DEBUG) -#ifndef MBEDTLS_DEBUG_C -#define MBEDTLS_DEBUG_C -#endif // MBEDTLS_DEBUG_C -#else -#ifdef MBEDTLS_DEBUG_C -#undef MBEDTLS_DEBUG_C -#endif // MBEDTLS_DEBUG_C -#endif // QORVO_MBEDTLS_DEBUG - -#include "mbedtls/check_config.h" - -#endif // QPG6100_MBEDTLS_CONFIG_H diff --git a/src/qpg6100/crypto/sha256_alt.h b/src/qpg6100/crypto/sha256_alt.h deleted file mode 100644 index 48efadd96..000000000 --- a/src/qpg6100/crypto/sha256_alt.h +++ /dev/null @@ -1,194 +0,0 @@ -/** - * \file mbedtls_sha256.h - * - * \brief SHA-224 and SHA-256 cryptographic hash function - * - * Copyright (C) 2006-2014, ARM Limited, All Rights Reserved - * - * This file is part of mbed TLS (https://tls.mbed.org) - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ -#ifndef MBEDTLS_SHA256_ALT_H -#define MBEDTLS_SHA256_ALT_H - -#if !defined(MBEDTLS_CONFIG_FILE) -#include "config.h" -#else -#include MBEDTLS_CONFIG_FILE -#endif - -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * \brief SHA-256 context structure - */ -typedef struct -{ - uint32_t total[2]; /*!< number of bytes processed */ - uint32_t state[8]; /*!< intermediate digest state */ - unsigned char buffer[64]; /*!< data block being processed */ - int is224; /*!< 0 => SHA-256, else SHA-224 */ -} mbedtls_sha256_context; - -/** - * \brief This function initializes a SHA-256 context. - * - * \param ctx The SHA-256 context to initialize. - */ -void mbedtls_sha256_init(mbedtls_sha256_context *ctx); - -/** - * \brief This function clears a SHA-256 context. - * - * \param ctx The SHA-256 context to clear. - */ -void mbedtls_sha256_free(mbedtls_sha256_context *ctx); - -/** - * \brief This function clones the state of a SHA-256 context. - * - * \param dst The destination context. - * \param src The context to clone. - */ -void mbedtls_sha256_clone(mbedtls_sha256_context *dst, const mbedtls_sha256_context *src); - -/** - * \brief This function starts a SHA-224 or SHA-256 checksum - * calculation. - * - * \param ctx The context to initialize. - * \param is224 Determines which function to use. - *
  • 0: Use SHA-256.
  • - *
  • 1: Use SHA-224.
- * - * \return \c 0 on success. - */ -int mbedtls_sha256_starts_ret(mbedtls_sha256_context *ctx, int is224); - -/** - * \brief This function feeds an input buffer into an ongoing - * SHA-256 checksum calculation. - * - * \param ctx SHA-256 context - * \param input buffer holding the data - * \param ilen length of the input data - * - * \return \c 0 on success. - */ -int mbedtls_sha256_update_ret(mbedtls_sha256_context *ctx, const unsigned char *input, size_t ilen); - -/** - * \brief This function finishes the SHA-256 operation, and writes - * the result to the output buffer. - * - * \param ctx The SHA-256 context. - * \param output The SHA-224 or SHA-256 checksum result. - * - * \return \c 0 on success. - */ -int mbedtls_sha256_finish_ret(mbedtls_sha256_context *ctx, unsigned char output[32]); - -/** - * \brief This function processes a single data block within - * the ongoing SHA-256 computation. This function is for - * internal use only. - * - * \param ctx The SHA-256 context. - * \param data The buffer holding one block of data. - * - * \return \c 0 on success. - */ -int mbedtls_internal_sha256_process(mbedtls_sha256_context *ctx, const unsigned char data[64]); - -#if !defined(MBEDTLS_DEPRECATED_REMOVED) -#if defined(MBEDTLS_DEPRECATED_WARNING) -#define MBEDTLS_DEPRECATED __attribute__((deprecated)) -#else -#define MBEDTLS_DEPRECATED -#endif -/** - * \brief This function starts a SHA-256 checksum calculation. - * - * \deprecated Superseded by mbedtls_sha256_starts_ret() in 2.7.0. - * - * \param ctx The SHA-256 context to initialize. - * \param is224 Determines which function to use. - *
  • 0: Use SHA-256.
  • - *
  • 1: Use SHA-224.
- */ -MBEDTLS_DEPRECATED static inline void mbedtls_sha256_starts(mbedtls_sha256_context *ctx, int is224) -{ - mbedtls_sha256_starts_ret(ctx, is224); -} - -/** - * \brief This function feeds an input buffer into an ongoing - * SHA-256 checksum calculation. - * - * \deprecated Superseded by mbedtls_sha256_update_ret() in 2.7.0. - * - * \param ctx The SHA-256 context to initialize. - * \param input The buffer holding the data. - * \param ilen The length of the input data. - */ -MBEDTLS_DEPRECATED static inline void mbedtls_sha256_update(mbedtls_sha256_context *ctx, - const unsigned char *input, - size_t ilen) -{ - mbedtls_sha256_update_ret(ctx, input, ilen); -} - -/** - * \brief This function finishes the SHA-256 operation, and writes - * the result to the output buffer. - * - * \deprecated Superseded by mbedtls_sha256_finish_ret() in 2.7.0. - * - * \param ctx The SHA-256 context. - * \param output The SHA-224or SHA-256 checksum result. - */ -MBEDTLS_DEPRECATED static inline void mbedtls_sha256_finish(mbedtls_sha256_context *ctx, unsigned char output[32]) -{ - mbedtls_sha256_finish_ret(ctx, output); -} - -/** - * \brief This function processes a single data block within - * the ongoing SHA-256 computation. This function is for - * internal use only. - * - * \deprecated Superseded by mbedtls_internal_sha256_process() in 2.7.0. - * - * \param ctx The SHA-256 context. - * \param data The buffer holding one block of data. - */ -MBEDTLS_DEPRECATED static inline void mbedtls_sha256_process(mbedtls_sha256_context *ctx, const unsigned char data[64]) -{ - mbedtls_internal_sha256_process(ctx, data); -} - -#undef MBEDTLS_DEPRECATED -#endif /* !MBEDTLS_DEPRECATED_REMOVED */ -#ifdef __cplusplus -} -#endif - -#endif diff --git a/src/qpg6100/diag.c b/src/qpg6100/diag.c deleted file mode 100644 index e79c2f260..000000000 --- a/src/qpg6100/diag.c +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright (c) 2019, 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. - */ - -#include -#include -#include -#include - -#include -#include -#include - -#if OPENTHREAD_CONFIG_DIAG_ENABLE - -/** - * Diagnostics mode variables. - * - */ -static bool sDiagMode = false; - -void otPlatDiagModeSet(bool aMode) -{ - sDiagMode = aMode; -} - -bool otPlatDiagModeGet() -{ - return sDiagMode; -} - -void otPlatDiagChannelSet(uint8_t aChannel) -{ - OT_UNUSED_VARIABLE(aChannel); -} - -void otPlatDiagTxPowerSet(int8_t aTxPower) -{ - OT_UNUSED_VARIABLE(aTxPower); -} - -void otPlatDiagRadioReceived(otInstance *aInstance, otRadioFrame *aFrame, otError aError) -{ - OT_UNUSED_VARIABLE(aInstance); - OT_UNUSED_VARIABLE(aFrame); - OT_UNUSED_VARIABLE(aError); -} - -void otPlatDiagAlarmCallback(otInstance *aInstance) -{ - OT_UNUSED_VARIABLE(aInstance); -} - -#endif // OPENTHREAD_CONFIG_DIAG_ENABLE diff --git a/src/qpg6100/entropy.c b/src/qpg6100/entropy.c deleted file mode 100644 index e7a989d75..000000000 --- a/src/qpg6100/entropy.c +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (c) 2019, 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 an entropy source. - * - */ - -#include - -#include "assert.h" -#include "random_qorvo.h" -#include -#include - -otError otPlatEntropyGet(uint8_t *aOutput, uint16_t aOutputLength) -{ - otError error = OT_ERROR_NONE; - assert(aOutputLength < 256); - - qorvoRandomGet((uint8_t *)aOutput, (uint8_t)aOutputLength); - return error; -} diff --git a/src/qpg6100/logging.c b/src/qpg6100/logging.c deleted file mode 100644 index b703ecb97..000000000 --- a/src/qpg6100/logging.c +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (c) 2019, 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. - */ - -#include "openthread-core-config.h" - -#include "platform_qorvo.h" - -#include -#include -#include - -#include - -#include "uart_qorvo.h" -#include "utils/code_utils.h" - -#if (OPENTHREAD_CONFIG_LOG_OUTPUT == OPENTHREAD_CONFIG_LOG_OUTPUT_PLATFORM_DEFINED) -void otPlatLog(otLogLevel aLogLevel, otLogRegion aLogRegion, const char *aFormat, ...) -{ - va_list args; - va_start(args, aFormat); - qorvoUartLog(aLogLevel, aLogRegion, aFormat, args); - va_end(args); -} -#endif diff --git a/src/qpg6100/misc.c b/src/qpg6100/misc.c deleted file mode 100644 index 9ecc59d76..000000000 --- a/src/qpg6100/misc.c +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (c) 2019, 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. - */ - -#include "misc_qorvo.h" -#include -#include - -void otPlatReset(otInstance *aInstance) -{ - OT_UNUSED_VARIABLE(aInstance); - qorvoPlatReset(); -} - -otPlatResetReason otPlatGetResetReason(otInstance *aInstance) -{ - OT_UNUSED_VARIABLE(aInstance); - // TODO: Write me! - return OT_PLAT_RESET_REASON_POWER_ON; -} - -void otPlatAssertFail(const char *aFilename, int aLineNumber) -{ - qorvoPlatAssertFail(aFilename, aLineNumber); -} - -void otPlatWakeHost(void) -{ - // TODO: implement an operation to wake the host from sleep state. -} diff --git a/src/qpg6100/misc_qorvo.h b/src/qpg6100/misc_qorvo.h deleted file mode 100644 index 2db398458..000000000 --- a/src/qpg6100/misc_qorvo.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (c) 2019, 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 declarations of the misc functions from the Qorvo library. - * - */ - -#ifndef MISC_QORVO_H_ -#define MISC_QORVO_H_ - -#include -#include - -void qorvoPlatReset(void); -void qorvoPlatAssertFail(const char *aFilename, int aLineNumber); - -#endif // MISC_QORVO_H_ diff --git a/src/qpg6100/openthread-core-qpg6100-config-check.h b/src/qpg6100/openthread-core-qpg6100-config-check.h deleted file mode 100644 index 0ec3b40e5..000000000 --- a/src/qpg6100/openthread-core-qpg6100-config-check.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (c) 2019, 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. - */ - -#ifndef OPENTHREAD_CORE_QPG6100_CONFIG_CHECK_H_ -#define OPENTHREAD_CORE_QPG6100_CONFIG_CHECK_H_ - -#if OPENTHREAD_CONFIG_TIME_SYNC_ENABLE -#error "Platform qpg6100 doesn't support configuration option: OPENTHREAD_CONFIG_TIME_SYNC_ENABLE" -#endif - -#if OPENTHREAD_CONFIG_RADIO_915MHZ_OQPSK_SUPPORT -#error "Platform qpg6100 doesn't support configuration option: OPENTHREAD_CONFIG_RADIO_915MHZ_OQPSK_SUPPORT" -#endif - -#endif /* OPENTHREAD_CORE_QPG6100_CONFIG_CHECK_H_ */ diff --git a/src/qpg6100/openthread-core-qpg6100-config.h b/src/qpg6100/openthread-core-qpg6100-config.h deleted file mode 100644 index 4e2fb817a..000000000 --- a/src/qpg6100/openthread-core-qpg6100-config.h +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright (c) 2019, 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 qpg6100 compile-time configuration constants for OpenThread. - */ - -#ifndef OPENTHREAD_CORE_QPG6100_CONFIG_H_ -#define OPENTHREAD_CORE_QPG6100_CONFIG_H_ - -/** - * @def OPENTHREAD_CONFIG_PLATFORM_INFO - * - * The platform-specific string to insert into the OpenThread version string. - * - */ -#define OPENTHREAD_CONFIG_PLATFORM_INFO "QPG6100" - -/** - * @def OPENTHREAD_CONFIG_PLATFORM_ASSERT_MANAGEMENT - * - * The assert is managed by platform defined logic when this flag is set. - * - */ -#ifndef OPENTHREAD_CONFIG_PLATFORM_ASSERT_MANAGEMENT -#define OPENTHREAD_CONFIG_PLATFORM_ASSERT_MANAGEMENT 1 -#endif - -/** - * @def OPENTHREAD_CONFIG_DIAG_ENABLE - * - * Define as 1 to enable the diag feature. - * - */ -#ifndef OPENTHREAD_CONFIG_DIAG_ENABLE -#define OPENTHREAD_CONFIG_DIAG_ENABLE 1 -#endif - -/** - * @def OPENTHREAD_CONFIG_TLS_ENABLE - * - * Define as 1 to enable support for TLS over TCP. - * - */ -#ifndef OPENTHREAD_CONFIG_TLS_ENABLE -#define OPENTHREAD_CONFIG_TLS_ENABLE 0 -#endif - -#endif // OPENTHREAD_CORE_QPG6100_CONFIG_H_ diff --git a/src/qpg6100/platform.c b/src/qpg6100/platform.c deleted file mode 100644 index dcc1d7e68..000000000 --- a/src/qpg6100/platform.c +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Copyright (c) 2019, 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 - * @brief - * This file includes the platform-specific initializers. - */ - -#include "alarm_qorvo.h" -#include "platform_qorvo.h" -#include "radio_qorvo.h" -#include "random_qorvo.h" -#include "uart_qorvo.h" -#include - -#include "utils/uart.h" - -#include "stdio.h" -#include "stdlib.h" - -static otInstance *localInstance = NULL; - -uint8_t qorvoPlatGotoSleepCheck(void) -{ - if (localInstance) - { - return !otTaskletsArePending(localInstance); - } - else - { - return true; - } -} - -void otSysInit(int argc, char *argv[]) -{ - OT_UNUSED_VARIABLE(argc); - OT_UNUSED_VARIABLE(argv); - qorvoPlatInit((qorvoPlatGotoSleepCheckCallback_t)qorvoPlatGotoSleepCheck); - qorvoUartInit(); - qorvoAlarmInit(); - qorvoRandomInit(); - qorvoRadioInit(); -} - -bool otSysPseudoResetWasRequested(void) -{ - return false; -} - -void otSysProcessDrivers(otInstance *aInstance) -{ - if (localInstance == NULL) - { - // local copy in case we need to perform a callback. - localInstance = aInstance; - } - - qorvoPlatMainLoop(!otTaskletsArePending(aInstance)); -} diff --git a/src/qpg6100/platform_qorvo.h b/src/qpg6100/platform_qorvo.h deleted file mode 100644 index 85eb3808f..000000000 --- a/src/qpg6100/platform_qorvo.h +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright (c) 2019, 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 initializers. - * - */ - -#ifndef PLATFORM_QORVO_H_ -#define PLATFORM_QORVO_H_ - -#include -#include - -typedef uint8_t (*qorvoPlatGotoSleepCheckCallback_t)(void); - -/** - * This function initializes the platform. - * - * @param[in] gotoSleepCheckCallback The callback which needs to return if sleep is allowed. - * - */ -void qorvoPlatInit(qorvoPlatGotoSleepCheckCallback_t gotoSleepCheckCallback); - -/** - * This function runs the main loop of the platform once. - * - * @param[in] canGoToSleep Indicates if the platform can got to sleep. - * - */ -void qorvoPlatMainLoop(bool canGoToSleep); - -#endif // PLATFORM_QORVO_H_ diff --git a/src/qpg6100/radio.c b/src/qpg6100/radio.c deleted file mode 100644 index 6683ee306..000000000 --- a/src/qpg6100/radio.c +++ /dev/null @@ -1,497 +0,0 @@ -/* - * Copyright (c) 2019, 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 OpenThread platform abstraction for radio communication. - * - */ - -#include - -#include -#include - -#include "utils/code_utils.h" - -#include "radio_qorvo.h" - -#define QPG_RECEIVE_SENSITIVITY -100 // dBm - -#define IEEE802154_MIN_LENGTH 5 -#define IEEE802154_MAX_LENGTH 127 -#define IEEE802154_ACK_LENGTH 5 -#define IEEE802154_FRAME_TYPE_MAS 0x7 -#define IEEE802154_FRAME_TYPE_ACK 0x2 -#define IEEE802154_FRAME_PENDING 1 << 4 -#define IEEE802154_ACK_REQUEST 1 << 5 -#define IEEE802154_DSN_OFFSET 2 - -#define QORVO_RSSI_OFFSET 73 -#define QORVO_CRC_BIT_MAS 0x80 -#define QORVO_LQI_BIT_MAS 0x7f - -extern otRadioFrame sTransmitFrame; - -static otRadioState sState; -static otInstance *pQorvoInstance; - -typedef struct otCachedSettings_s -{ - uint16_t panid; -} otCachedSettings_t; - -static otCachedSettings_t otCachedSettings; - -/* Upper layer relies on txpower could be set before receive, but MAC have per-channel config for it. - Store txpower until channel set in Receive(). */ -#define PENDING_TX_POWER_NONE (-1) -static int8_t pendingTxPower = PENDING_TX_POWER_NONE; - -static uint8_t sScanstate = 0; -static int8_t sLastReceivedPower = 127; - -otRadioCaps otPlatRadioGetCaps(otInstance *aInstance) -{ - OT_UNUSED_VARIABLE(aInstance); - - return OT_RADIO_CAPS_ACK_TIMEOUT | OT_RADIO_CAPS_ENERGY_SCAN | OT_RADIO_CAPS_TRANSMIT_RETRIES; -} - -const char *otPlatRadioGetVersionString(otInstance *aInstance) -{ - OT_UNUSED_VARIABLE(aInstance); - - return "OPENTHREAD/Qorvo/0.0"; -} - -int8_t otPlatRadioGetReceiveSensitivity(otInstance *aInstance) -{ - OT_UNUSED_VARIABLE(aInstance); - - return QPG_RECEIVE_SENSITIVITY; -} - -void otPlatRadioGetIeeeEui64(otInstance *aInstance, uint8_t *aIeeeEui64) -{ - OT_UNUSED_VARIABLE(aInstance); - - qorvoRadioGetIeeeEui64(aIeeeEui64); -} - -void otPlatRadioSetPanId(otInstance *aInstance, otPanId aPanId) -{ - OT_UNUSED_VARIABLE(aInstance); - - qorvoRadioSetPanId((uint16_t)aPanId); - otCachedSettings.panid = aPanId; -} - -void otPlatRadioSetExtendedAddress(otInstance *aInstance, const otExtAddress *address) -{ - OT_UNUSED_VARIABLE(aInstance); - - qorvoRadioSetExtendedAddress(address->m8); -} - -void otPlatRadioSetShortAddress(otInstance *aInstance, otShortAddress aShortAddress) -{ - OT_UNUSED_VARIABLE(aInstance); - - qorvoRadioSetShortAddress((uint16_t)aShortAddress); -} - -otError otPlatRadioGetTransmitPower(otInstance *aInstance, int8_t *aPower) -{ - OT_UNUSED_VARIABLE(aInstance); - - otError result; - - if (aPower == NULL) - { - return OT_ERROR_INVALID_ARGS; - } - - if ((sState == OT_RADIO_STATE_DISABLED) || (sScanstate != 0)) - { - *aPower = (pendingTxPower == PENDING_TX_POWER_NONE) ? 0 : pendingTxPower; - return OT_ERROR_NONE; - } - - result = qorvoRadioGetTransmitPower(aPower); - - if (result == OT_ERROR_INVALID_STATE) - { - // Channel was not set, so txpower is ambigious - *aPower = (pendingTxPower == PENDING_TX_POWER_NONE) ? 0 : pendingTxPower; - return OT_ERROR_NONE; - } - - return result; -} - -otError otPlatRadioSetTransmitPower(otInstance *aInstance, int8_t aPower) -{ - OT_UNUSED_VARIABLE(aInstance); - - otError result; - - if ((sState == OT_RADIO_STATE_DISABLED) || (sScanstate != 0)) - { - pendingTxPower = aPower; - return OT_ERROR_NONE; - } - - result = qorvoRadioSetTransmitPower(aPower); - - if (result == OT_ERROR_INVALID_STATE) - { - // Channel was not set, so txpower is ambigious - pendingTxPower = aPower; - result = OT_ERROR_NONE; - } - - return result; -} - -otError otPlatRadioGetCcaEnergyDetectThreshold(otInstance *aInstance, int8_t *aThreshold) -{ - OT_UNUSED_VARIABLE(aInstance); - OT_UNUSED_VARIABLE(aThreshold); - - return OT_ERROR_NOT_IMPLEMENTED; -} - -otError otPlatRadioSetCcaEnergyDetectThreshold(otInstance *aInstance, int8_t aThreshold) -{ - OT_UNUSED_VARIABLE(aInstance); - OT_UNUSED_VARIABLE(aThreshold); - - return OT_ERROR_NOT_IMPLEMENTED; -} - -otError otPlatRadioGetFemLnaGain(otInstance *aInstance, int8_t *aGain) -{ - OT_UNUSED_VARIABLE(aInstance); - OT_UNUSED_VARIABLE(aGain); - - return OT_ERROR_NOT_IMPLEMENTED; -} - -otError otPlatRadioSetFemLnaGain(otInstance *aInstance, int8_t aGain) -{ - OT_UNUSED_VARIABLE(aInstance); - OT_UNUSED_VARIABLE(aGain); - - return OT_ERROR_NOT_IMPLEMENTED; -} - -bool otPlatRadioGetPromiscuous(otInstance *aInstance) -{ - OT_UNUSED_VARIABLE(aInstance); - - return qorvoRadioGetPromiscuous(); -} - -void otPlatRadioSetPromiscuous(otInstance *aInstance, bool aEnable) -{ - OT_UNUSED_VARIABLE(aInstance); - - qorvoRadioSetPromiscuous(aEnable); -} - -uint32_t otPlatRadioGetBusSpeed(otInstance *aInstance) -{ - OT_UNUSED_VARIABLE(aInstance); - - return 0; -} - -otError otPlatRadioEnable(otInstance *aInstance) -{ - pQorvoInstance = aInstance; - memset(&otCachedSettings, 0x00, sizeof(otCachedSettings_t)); - - if (!otPlatRadioIsEnabled(aInstance)) - { - sState = OT_RADIO_STATE_SLEEP; - } - - return OT_ERROR_NONE; -} - -otError otPlatRadioDisable(otInstance *aInstance) -{ - OT_UNUSED_VARIABLE(aInstance); - - otEXPECT(otPlatRadioIsEnabled(aInstance)); - - if (sState == OT_RADIO_STATE_RECEIVE) - { - qorvoRadioSetRxOnWhenIdle(false); - } - - sState = OT_RADIO_STATE_DISABLED; - -exit: - return OT_ERROR_NONE; -} - -bool otPlatRadioIsEnabled(otInstance *aInstance) -{ - OT_UNUSED_VARIABLE(aInstance); - - return (sState != OT_RADIO_STATE_DISABLED); -} - -otError otPlatRadioSleep(otInstance *aInstance) -{ - OT_UNUSED_VARIABLE(aInstance); - - otError error = OT_ERROR_INVALID_STATE; - - if (sState == OT_RADIO_STATE_RECEIVE || sState == OT_RADIO_STATE_SLEEP) - { - qorvoRadioSetRxOnWhenIdle(false); - error = OT_ERROR_NONE; - sState = OT_RADIO_STATE_SLEEP; - } - return error; -} - -otError otPlatRadioReceive(otInstance *aInstance, uint8_t aChannel) -{ - otError error = OT_ERROR_INVALID_STATE; - - pQorvoInstance = aInstance; - - if ((sState != OT_RADIO_STATE_DISABLED) && (sScanstate == 0)) - { - qorvoRadioSetCurrentChannel(aChannel); - if (pendingTxPower != PENDING_TX_POWER_NONE) - { - qorvoRadioSetTransmitPower(pendingTxPower); - pendingTxPower = PENDING_TX_POWER_NONE; - } - error = OT_ERROR_NONE; - } - - if (sState == OT_RADIO_STATE_SLEEP) - { - qorvoRadioSetRxOnWhenIdle(true); - error = OT_ERROR_NONE; - sState = OT_RADIO_STATE_RECEIVE; - } - - return error; -} - -void cbQorvoRadioReceiveDone(otRadioFrame *aFrame, otError aError) -{ - if (aError == OT_ERROR_NONE) - { - sLastReceivedPower = aFrame->mInfo.mRxInfo.mRssi; - } - - otPlatRadioReceiveDone(pQorvoInstance, aFrame, aError); -} - -otRadioFrame *otPlatRadioGetTransmitBuffer(otInstance *aInstance) -{ - OT_UNUSED_VARIABLE(aInstance); - - return &sTransmitFrame; -} - -otError otPlatRadioTransmit(otInstance *aInstance, otRadioFrame *aFrame) -{ - otError err = OT_ERROR_NONE; - - pQorvoInstance = aInstance; - - otEXPECT_ACTION(sState != OT_RADIO_STATE_DISABLED, err = OT_ERROR_INVALID_STATE); - - err = qorvoRadioTransmit(aFrame); - -exit: - return err; -} - -void cbQorvoRadioTransmitDone(otRadioFrame *aFrame, bool aFramePending, otError aError) -{ - // TODO: pass received ACK frame instead of generating one. - otRadioFrame ackFrame; - uint8_t psdu[IEEE802154_ACK_LENGTH]; - - ackFrame.mPsdu = psdu; - ackFrame.mLength = IEEE802154_ACK_LENGTH; - ackFrame.mPsdu[0] = IEEE802154_FRAME_TYPE_ACK; - - if (aFramePending) - { - ackFrame.mPsdu[0] |= IEEE802154_FRAME_PENDING; - } - - ackFrame.mPsdu[1] = 0; - ackFrame.mPsdu[2] = aFrame->mPsdu[IEEE802154_DSN_OFFSET]; - - otPlatRadioTxDone(pQorvoInstance, aFrame, &ackFrame, aError); -} - -int8_t otPlatRadioGetRssi(otInstance *aInstance) -{ - OT_UNUSED_VARIABLE(aInstance); - - return sLastReceivedPower; -} - -otError otPlatRadioEnergyScan(otInstance *aInstance, uint8_t aScanChannel, uint16_t aScanDuration) -{ - OT_UNUSED_VARIABLE(aInstance); - - sScanstate = 1; - return qorvoRadioEnergyScan(aScanChannel, aScanDuration); -} - -void cbQorvoRadioEnergyScanDone(int8_t aEnergyScanMaxRssi) -{ - sScanstate = 0; - otPlatRadioEnergyScanDone(pQorvoInstance, aEnergyScanMaxRssi); -} - -void otPlatRadioEnableSrcMatch(otInstance *aInstance, bool aEnable) -{ - OT_UNUSED_VARIABLE(aInstance); - - qorvoRadioEnableSrcMatch(aEnable); -} - -otError otPlatRadioAddSrcMatchShortEntry(otInstance *aInstance, otShortAddress aShortAddress) -{ - OT_UNUSED_VARIABLE(aInstance); - - return qorvoRadioAddSrcMatchShortEntry((uint16_t)aShortAddress, otCachedSettings.panid); -} - -otError otPlatRadioAddSrcMatchExtEntry(otInstance *aInstance, const otExtAddress *aExtAddress) -{ - OT_UNUSED_VARIABLE(aInstance); - - return qorvoRadioAddSrcMatchExtEntry(aExtAddress->m8, otCachedSettings.panid); -} - -otError otPlatRadioClearSrcMatchShortEntry(otInstance *aInstance, otShortAddress aShortAddress) -{ - OT_UNUSED_VARIABLE(aInstance); - - return qorvoRadioClearSrcMatchShortEntry((uint16_t)aShortAddress, otCachedSettings.panid); -} - -otError otPlatRadioClearSrcMatchExtEntry(otInstance *aInstance, const otExtAddress *aExtAddress) -{ - OT_UNUSED_VARIABLE(aInstance); - - return qorvoRadioClearSrcMatchExtEntry(aExtAddress->m8, otCachedSettings.panid); -} - -void otPlatRadioClearSrcMatchShortEntries(otInstance *aInstance) -{ - OT_UNUSED_VARIABLE(aInstance); - - /* clear both short and extended addresses here */ - qorvoRadioClearSrcMatchEntries(); -} - -void otPlatRadioClearSrcMatchExtEntries(otInstance *aInstance) -{ - OT_UNUSED_VARIABLE(aInstance); - - /* not implemented */ - /* assumes clearing of short and extended entries is done simultaniously by the openthread stack */ -} -uint32_t otPlatRadioGetSupportedChannelMask(otInstance *aInstance) -{ - OT_UNUSED_VARIABLE(aInstance); - - return 0x03fff800; -} - -uint32_t otPlatRadioGetPreferredChannelMask(otInstance *aInstance) -{ - OT_UNUSED_VARIABLE(aInstance); - - return 0x03fff800; -} - -otError otPlatRadioSetCoexEnabled(otInstance *aInstance, bool aEnabled) -{ - OT_UNUSED_VARIABLE(aInstance); - OT_UNUSED_VARIABLE(aEnabled); - - return OT_ERROR_NOT_IMPLEMENTED; -} - -bool otPlatRadioIsCoexEnabled(otInstance *aInstance) -{ - OT_UNUSED_VARIABLE(aInstance); - - return false; -} - -otError otPlatRadioGetCoexMetrics(otInstance *aInstance, otRadioCoexMetrics *aCoexMetrics) -{ - OT_UNUSED_VARIABLE(aInstance); - OT_UNUSED_VARIABLE(aCoexMetrics); - - return OT_ERROR_NOT_IMPLEMENTED; -} - -otError otPlatRadioSetChannelMaxTransmitPower(otInstance *aInstance, uint8_t aChannel, int8_t aMaxPower) -{ - OT_UNUSED_VARIABLE(aInstance); - OT_UNUSED_VARIABLE(aChannel); - OT_UNUSED_VARIABLE(aMaxPower); - - return OT_ERROR_NOT_IMPLEMENTED; -} - -otError otPlatRadioSetRegion(otInstance *aInstance, uint16_t aRegionCode) -{ - OT_UNUSED_VARIABLE(aInstance); - OT_UNUSED_VARIABLE(aRegionCode); - - return OT_ERROR_NOT_IMPLEMENTED; -} - -otError otPlatRadioGetRegion(otInstance *aInstance, uint16_t *aRegionCode) -{ - OT_UNUSED_VARIABLE(aInstance); - OT_UNUSED_VARIABLE(aRegionCode); - - return OT_ERROR_NOT_IMPLEMENTED; -} diff --git a/src/qpg6100/radio_qorvo.h b/src/qpg6100/radio_qorvo.h deleted file mode 100644 index bae778c48..000000000 --- a/src/qpg6100/radio_qorvo.h +++ /dev/null @@ -1,367 +0,0 @@ -/* - * Copyright (c) 2019, 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 declarations of the radio functions from the Qorvo library. - * - */ - -#ifndef RADIO_QORVO_H_ -#define RADIO_QORVO_H_ - -#include -#include - -#include -#include - -/** - * This function initializes the radio. - * - */ -void qorvoRadioInit(void); - -/** - * This function resets the radio. - * - */ -void qorvoRadioReset(void); - -/** - * This function processes event to/from the radio. - * - */ -void qorvoRadioProcess(void); - -/** - * This function starts an ED scan. - * - * @param[in] aScanChannel The channel which needs to be scanned. - * @param[in] aScanDuration The amount of time in ms which needs to be scanned. - * - */ -otError qorvoRadioEnergyScan(uint8_t aScanChannel, uint16_t aScanDuration); - -/** - * This function sets the current channel. - * - * @param[in] channel The channel index. - * - */ -void qorvoRadioSetCurrentChannel(uint8_t channel); - -/** - * This function sets the idle behaviour of the radio. - * - * @param[in] rxOnWhenIdle If true, the radio remains on which not transmitting. - * - */ -void qorvoRadioSetRxOnWhenIdle(bool rxOnWhenIdle); - -/** - * This function retrieves the MAC address of the radio. - * - * @param[out] aIeeeEui64 The MAC address of the radio. - * - */ -void qorvoRadioGetIeeeEui64(uint8_t *aIeeeEui64); - -/** - * This function transmits a frame. - * - * @param[in] aFrame The frame which needs to be transmitted. - * - */ -otError qorvoRadioTransmit(otRadioFrame *aFrame); - -/** - * This function sets the PanId. - * - * @param[in] panid The panId. - * - */ -void qorvoRadioSetPanId(uint16_t panid); - -/** - * This function sets the short address. - * - * @param[in] address The short address. - * - */ -void qorvoRadioSetShortAddress(uint16_t address); - -/** - * This function sets the extended address. - * - * @param[in] address The extended address. - * - */ -void qorvoRadioSetExtendedAddress(const uint8_t *address); - -/** - * This function enables source address matching for indirect transmit. - * - * @param[in] aEnable if True will enable source address matching, false will disable. - * - */ -void qorvoRadioEnableSrcMatch(bool aEnable); - -/** - * This function clears all entries from the source address match list. - * - */ -void qorvoRadioClearSrcMatchEntries(void); - -/** - * This function adds an short address plus panid to the source address match list. - * - * @param[in] aShortAddress The short address which should be added. - * @param[in] panid The panid. - * - */ -otError qorvoRadioAddSrcMatchShortEntry(uint16_t aShortAddress, uint16_t panid); - -/** - * This function adds an extended address plus panid to the source address match list. - * - * @param[in] aExtAddress The extended address which should be added. - * @param[in] panid The panid. - * - */ -otError qorvoRadioAddSrcMatchExtEntry(const uint8_t *aExtAddress, uint16_t panid); - -/** - * This function removes an short address plus panid from the source address match list. - * - * @param[in] aShortAddress The short address which should be removed. - * @param[in] panid The panid. - * - */ -otError qorvoRadioClearSrcMatchShortEntry(uint16_t aShortAddress, uint16_t panid); - -/** - * This function removes an extended address plus panid from the source address match list. - * - * @param[in] aExtAddress The extended address which should be removed. - * @param[in] panid The panid. - * - */ -otError qorvoRadioClearSrcMatchExtEntry(const uint8_t *aExtAddress, uint16_t panid); - -/** - * This function gets the transmit power for current channel - * - * @param[out] aPower The transmit power - * - */ -otError qorvoRadioGetTransmitPower(int8_t *aPower); - -/** - * This function sets the transmit power for current channel - * - * @param[in] aPower The transmit power - * - */ -otError qorvoRadioSetTransmitPower(int8_t aPower); - -/** - * Get the status of promiscuous mode. - * - * @retval TRUE Promiscuous mode is enabled. - * @retval FALSE Promiscuous mode is disabled. - * - */ -bool qorvoRadioGetPromiscuous(void); - -/** - * Enable or disable promiscuous mode. - * - * @param[in] aEnable TRUE to enable or FALSE to disable promiscuous mode. - * - */ -void qorvoRadioSetPromiscuous(bool aEnable); - -/** - * Update MAC keys and key index - * - * This function is used when radio provides OT_RADIO_CAPS_TRANSMIT_SEC capability. - * - * @param[in] aKeyIdMode The key ID mode. - * @param[in] aKeyId Current MAC key index. - * @param[in] aPrevKey A pointer to the previous MAC key. - * @param[in] aCurrKey A pointer to the current MAC key. - * @param[in] aNextKey A pointer to the next MAC key. - * @param[in] aKeyType Key Type used. - * - */ -void qorvoRadioSetMacKey(uint8_t aKeyIdMode, - uint8_t aKeyId, - const uint8_t *aPrevKey, - const uint8_t *aCurrKey, - const uint8_t *aNextKey, - uint8_t aKeyType); - -/** - * This method sets the current MAC frame counter value. - * - * This function is used when radio provides `OT_RADIO_CAPS_TRANSMIT_SEC` capability. - * - * @param[in] aMacFrameCounter The MAC frame counter value. - * - */ -void qorvoRadioSetMacFrameCounter(uint32_t aMacFrameCounter); - -/** - * Enable or disable CSL receiver. - * - * @param[in] aCslPeriod CSL period, 0 for disabling CSL. - * @param[in] aShortAddr The short source address of CSL receiver's peer. - * @param[in] aExtAddr The extended source address of CSL receiver's peer. - * - * @note Platforms should use CSL peer addresses to include CSL IE when generating enhanced acks. - * - * @retval kErrorNotImplemented Radio driver doesn't support CSL. - * @retval kErrorFailed Other platform specific errors. - * @retval kErrorNone Successfully enabled or disabled CSL. - * - */ -otError qorvoRadioEnableCsl(uint32_t aCslPeriod, uint16_t aShortAddr, const uint8_t *aExtAddr); - -/** - * Update CSL sample time in radio driver. - * - * Sample time is stored in radio driver as a copy to calculate phase when sending ACK with CSL IE. - * - * @param[in] aCslSampleTime The latest sample time. - * - */ -void qorvoRadioUpdateCslSampleTime(uint32_t aCslSampleTime); - -/** - * Enable/disable or update Enhanced-ACK Based Probing in radio for a specific Initiator. - * - * After Enhanced-ACK Based Probing is configured by a specific Probing Initiator, the Enhanced-ACK sent to that - * node should include Vendor-Specific IE containing Link Metrics data. This method informs the radio to start/stop to - * collect Link Metrics data and include Vendor-Specific IE that containing the data in Enhanced-ACK sent to that - * Probing Initiator. - * - * @param[in] aLinkMetrics This parameter specifies what metrics to query. Per spec 4.11.3.4.4.6, at most 2 metrics - * can be specified. The probing would be disabled if @p `aLinkMetrics` is bitwise 0. - * @param[in] aShortAddr The short address of the Probing Initiator. - * @param[in] aExtAddr The extended source address of the Probing Initiator. @p aExtAddr MUST NOT be `NULL`. - * - * @retval OT_ERROR_NONE Successfully configured the Enhanced-ACK Based Probing. - * @retval OT_ERROR_INVALID_ARGS @p aExtAddress is `NULL`. - * @retval OT_ERROR_NOT_FOUND The Initiator indicated by @p aShortAddress is not found when trying to clear. - * @retval OT_ERROR_NO_BUFS No more Initiator can be supported. - * - */ -otError qorvoRadioConfigureEnhAckProbing(otLinkMetrics aLinkMetrics, - uint16_t aShortAddress, - const uint8_t *aExtAddress); - -/** - * Get the current estimated time (in microseconds) of the radio chip. - * - * This microsecond timer must be a free-running timer. The timer must continue to advance with microsecond precision - * even when the radio is in the sleep state. - * - * @returns The current time in microseconds. UINT64_MAX when platform does not support or radio time is not ready. - * - */ -uint64_t qorvoRadioGetNow(void); - -/** - * Schedule a radio reception window at a specific time and duration. - * - * @param[in] aChannel The radio channel on which to receive. - * @param[in] aStart The receive window start time, in microseconds. - * @param[in] aDuration The receive window duration, in microseconds - * - * @retval OT_ERROR_NONE Successfully scheduled receive window. - * @retval OT_ERROR_FAILED The receive window could not be scheduled. - */ -otError qorvoRadioReceiveAt(uint8_t aChannel, uint32_t aStart, uint32_t aDuration); - -/** - * Retrieve the radio capabilities of the radio - * - * @returns caps The radio capabilities as described in include/openthread/platform/radio.h - */ -otRadioCaps qorvoRadioGetCaps(void); - -/** - * This callback is called when the energy scan is finished. - * - * @param[in] aEnergyScanMaxRssi The amount of energy detected during the ED scan. - * - */ -void cbQorvoRadioEnergyScanDone(int8_t aEnergyScanMaxRssi); - -/** - * This callback is called after a transmission is completed (and if required an ACK is received). - * - * @param[in] aFrame The packet which was transmitted. - * @param[in] aFramePending Indicates if the FP bit was set in the ACK frame or not. - * @param[in] aError Indicates if an error occurred during transmission. - * - */ -void cbQorvoRadioTransmitDone(otRadioFrame *aFrame, bool aFramePending, otError aError); - -/** - * This callback is called after a transmission is completed (and if required an ACK is received). - * - * @param[in] aFrame The packet which was transmitted. - * @param[in] aAckFrame The complete 802.15.4-2015 enhanced ack frame. - * @param[in] aError Indicates if an error occurred during transmission. - * - */ -void cbQorvoRadioTransmitDone_AckFrame(otRadioFrame *aFrame, otRadioFrame *aAckFrame, otError aError); - -/** - * This callback is called after a frame is received. - * - * @param[in] aFrame The packet which was received. - * @param[in] aError Any error which occurred during reception of the packet. - * - */ -void cbQorvoRadioReceiveDone(otRadioFrame *aFrame, otError aError); - -/** - * This callback is called to notify OpenThread that the transmission has started. - * - * @note This function should be called by the same thread that executes all of the other OpenThread code. It should - * not be called by ISR or any other task. - * - * @param[in] aFrame A pointer to the frame that is being transmitted. - * - */ -void cbQorvoRadioTxStarted(otRadioFrame *aFrame); - -#endif // RADIO_QORVO_H_ diff --git a/src/qpg6100/random_qorvo.h b/src/qpg6100/random_qorvo.h deleted file mode 100644 index d48d56474..000000000 --- a/src/qpg6100/random_qorvo.h +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (c) 2019, 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 declarations of the random functions from the Qorvo library. - * - */ - -#ifndef RANDOM_QORVO_H_ -#define RANDOM_QORVO_H_ - -#include -#include - -/** - * This function initializes the random number service used by OpenThread. - * - */ -void qorvoRandomInit(void); - -/** - * This function returns an array of random numbers. - * - * @param[out] aOutput Pointer to an array which will be filled with random data. - * @param[in] aOutputLength number of bytes which will be written into the array. - * - */ -void qorvoRandomGet(uint8_t *aOutput, uint8_t aOutputLength); - -#endif // RANDOM_QORVO_H_ diff --git a/src/qpg6100/settings.cpp b/src/qpg6100/settings.cpp deleted file mode 100644 index 8250cf676..000000000 --- a/src/qpg6100/settings.cpp +++ /dev/null @@ -1,128 +0,0 @@ -/* - * Copyright (c) 2019, 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 OpenThread platform abstraction for non-volatile storage of settings. - * - */ - -#include - -#include -#include "openthread/platform/settings.h" - -#include -#include - -#include "settings_qorvo.h" - -#if !OPENTHREAD_SETTINGS_RAM - -/***************************************************************************** - * Public Function Definitions - *****************************************************************************/ - -// settings API -void otPlatSettingsInit(otInstance *aInstance, const uint16_t *aSensitiveKeys, uint16_t aSensitiveKeysLength) -{ - OT_UNUSED_VARIABLE(aInstance); - OT_UNUSED_VARIABLE(aSensitiveKeys); - OT_UNUSED_VARIABLE(aSensitiveKeysLength); - qorvoSettingsInit(); -} - -void otPlatSettingsDeinit(otInstance *aInstance) -{ - OT_UNUSED_VARIABLE(aInstance); -} - -otError otPlatSettingsGet(otInstance *aInstance, uint16_t aKey, int aIndex, uint8_t *aValue, uint16_t *aValueLength) -{ - otError error = OT_ERROR_NOT_FOUND; - OT_UNUSED_VARIABLE(aInstance); - - /* we only support multiple entries for the ChildInfo */ - /* Note: removed the assert, since the settings types are protected now */ - // assert((aIndex == 0) || (aKey == ot::Settings::kKeyChildInfo)); - - error = qorvoSettingsGet(aKey, aIndex, aValue, aValueLength); - - if (error == OT_ERROR_NOT_FOUND) - { - if (aValue != nullptr) - { - *aValueLength = 0; - } - } - - return error; -} - -static otError PlatformSettingsAdd(otInstance *aInstance, - uint16_t aKey, - bool aIndex0, - const uint8_t *aValue, - uint16_t aValueLength) -{ - otError error = OT_ERROR_NONE; - OT_UNUSED_VARIABLE(aInstance); - - error = qorvoSettingsAdd(aKey, aIndex0, aValue, aValueLength); - - return error; -} - -otError otPlatSettingsSet(otInstance *aInstance, uint16_t aKey, const uint8_t *aValue, uint16_t aValueLength) -{ - return PlatformSettingsAdd(aInstance, aKey, true, aValue, aValueLength); -} - -otError otPlatSettingsAdd(otInstance *aInstance, uint16_t aKey, const uint8_t *aValue, uint16_t aValueLength) -{ - return PlatformSettingsAdd(aInstance, aKey, false, aValue, aValueLength); -} - -otError otPlatSettingsDelete(otInstance *aInstance, uint16_t aKey, int aIndex) -{ - otError error = OT_ERROR_NOT_FOUND; - OT_UNUSED_VARIABLE(aInstance); - - /* Existence of @aKey is done in @qorvoSettingsDelete */ - error = qorvoSettingsDelete(aKey, aIndex); - - return error; -} - -void otPlatSettingsWipe(otInstance *aInstance) -{ - qorvoSettingsWipe(); - otPlatSettingsInit(aInstance, NULL, 0); -} - -#endif /* OPENTHREAD_SETTINGS_RAM */ diff --git a/src/qpg6100/settings_qorvo.h b/src/qpg6100/settings_qorvo.h deleted file mode 100644 index b52c1f504..000000000 --- a/src/qpg6100/settings_qorvo.h +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright (c) 2019, 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 declarations of the settings functions from the Qorvo library. - * - */ - -#ifndef SETTINGS_QORVO_H_ -#define SETTINGS_QORVO_H_ - -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -void qorvoSettingsInit(void); - -otError qorvoSettingsGet(uint16_t aKey, int aIndex, uint8_t *aValue, uint16_t *aValueLength); - -otError qorvoSettingsAdd(uint16_t aKey, bool aIndex0, const uint8_t *aValue, uint16_t aValueLength); - -otError qorvoSettingsDelete(uint16_t aKey, int aIndex); - -void qorvoSettingsWipe(void); - -#ifdef __cplusplus -} -#endif - -#endif // SETTINGS_QORVO_H_ diff --git a/src/qpg6100/uart.c b/src/qpg6100/uart.c deleted file mode 100644 index a4b5d97ce..000000000 --- a/src/qpg6100/uart.c +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Copyright (c) 2019, 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 OpenThread platform abstraction for UART communication. - * - */ - -#include "uart_qorvo.h" - -/* work-around to avoid access to openthread-config.h */ -/* Define to 1 if stdbool.h conforms to C99. */ -#define HAVE_STDBOOL_H 1 -/* Define to 1 if the system has the type `_Bool'. */ -#define HAVE__BOOL 1 - -#include "common/code_utils.hpp" -#include "utils/uart.h" - -otError otPlatUartEnable(void) -{ - otError error = OT_ERROR_NONE; - qorvoUartInit(); - return error; -} - -otError otPlatUartDisable(void) -{ - otError error = OT_ERROR_NONE; - qorvoUartDeInit(); - return error; -} - -otError otPlatUartFlush(void) -{ - return qorvoUartFlush(); -} - -otError otPlatUartSend(const uint8_t *aBuf, uint16_t aBufLength) -{ - otError error = OT_ERROR_NONE; - qorvoUartSendOutput(aBuf, aBufLength); - return error; -} - -void qorvoUartSendInput(uint8_t *buffer, uint16_t length) -{ - otPlatUartReceived(buffer, length); -} - -void cbQorvoUartTxDone(void) -{ - otPlatUartSendDone(); -} - -OT_TOOL_WEAK void otPlatUartSendDone(void) -{ -} - -OT_TOOL_WEAK void otPlatUartReceived(const uint8_t *aBuf, uint16_t aBufLength) -{ - OT_UNUSED_VARIABLE(aBuf); - OT_UNUSED_VARIABLE(aBufLength); -} diff --git a/src/qpg6100/uart_qorvo.h b/src/qpg6100/uart_qorvo.h deleted file mode 100644 index 398161239..000000000 --- a/src/qpg6100/uart_qorvo.h +++ /dev/null @@ -1,102 +0,0 @@ -/* - * Copyright (c) 2019, 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 declarations of the uart functions from the Qorvo library. - * - */ - -#ifndef _UART_QORVO_H_ -#define _UART_QORVO_H_ - -#include -#include -#include -#include - -/** - * This function enables the UART driver. - * - */ -void qorvoUartInit(void); - -/** - * This function disables the UART driver. - * - */ -void qorvoUartDeInit(void); - -/** - * Callback function which will be called when uart transmission is done. - * - */ -void cbQorvoUartTxDone(void); - -/** - * Callback function which will be called when uart data is received. - * - * @param[in] aBuf A pointer to an array of received bytes. - * @param[in] aBufLength The number of bytes received from the uart. - * - */ -void qorvoUartSendInput(uint8_t *aBuf, uint16_t aBufLength); - -/** - * Function which transmits data via the uart. - * - * @param[out] aBuf A pointer to an array of bytes which need to be transmitted. - * @param[in] aBufLength The number of bytes to be transmitted via the uart. - * - */ -void qorvoUartSendOutput(const uint8_t *aBuf, uint16_t aBufLength); - -/** - * Function which transmits logging via the qorvo platform. - * - * @param[in] aLogLevel The severity level of logging. - * @param[in] aLogRegion The code region where the logging originated from. - * @param[in] aFormat The format strings. - * @param[in] varargs The arguments for the format string. - * - */ -void qorvoUartLog(otLogLevel aLogLevel, otLogRegion aLogRegion, const char *aFormat, ...); - -/** - * Flush the outgoing transmit buffer and wait for the data to be sent. - * This is called when the CLI UART interface has a full buffer but still - * wishes to send more data. - * - * @retval OT_ERROR_NONE Flush succeeded, we can proceed to write more - * data to the buffer. - * - * @retval OT_ERROR_NOT_IMPLEMENTED Driver does not support synchronous flush. - * @retval OT_ERROR_INVALID_STATE Driver has no data to flush. - */ -otError qorvoUartFlush(void); -#endif // _UART_QORVO_H_