mirror of
https://github.com/espressif/openthread.git
synced 2026-09-05 16:50:05 +00:00
[platform] addition of QPG7015M/GP712 RCP build (#6110)
- Addition of RCP build for QPG7015M and GP712 Qorvo platforms - Addition required RCP API to glue code
This commit is contained in:
+12
-7
@@ -47,12 +47,17 @@ OBJCOPY = $(CROSS_COMPILE)objcopy
|
||||
|
||||
BuildJobs ?= 9
|
||||
|
||||
configure_OPTIONS += \
|
||||
--disable-tools \
|
||||
--enable-cli \
|
||||
--enable-ftd \
|
||||
--enable-mtd \
|
||||
--with-examples=$(PREFIX_LC) \
|
||||
configure_OPTIONS = \
|
||||
--disable-tools \
|
||||
--enable-cli \
|
||||
--enable-ftd \
|
||||
--enable-mtd \
|
||||
--enable-ncp \
|
||||
--enable-cli-app \
|
||||
--enable-radio-only \
|
||||
--with-ncp-vendor-hook-source=no \
|
||||
--with-ncp-bus=uart \
|
||||
--with-examples=$(PREFIX_LC) \
|
||||
$(NULL)
|
||||
|
||||
ifeq ($(CLI_LOGGING),1)
|
||||
@@ -100,7 +105,7 @@ LDFLAGS += \
|
||||
-Wl,--gc-sections \
|
||||
-Wl,-Map=$(PREFIX_LC).map \
|
||||
-lrt \
|
||||
-lpthread \
|
||||
-pthread \
|
||||
$(NULL)
|
||||
|
||||
ECHO := @echo
|
||||
|
||||
@@ -47,12 +47,17 @@ OBJCOPY = $(CROSS_COMPILE)objcopy
|
||||
|
||||
BuildJobs ?= 9
|
||||
|
||||
configure_OPTIONS += \
|
||||
--disable-tools \
|
||||
--enable-cli \
|
||||
--enable-ftd \
|
||||
--enable-mtd \
|
||||
--with-examples=$(PREFIX_LC) \
|
||||
configure_OPTIONS = \
|
||||
--disable-tools \
|
||||
--enable-cli \
|
||||
--enable-ftd \
|
||||
--enable-mtd \
|
||||
--enable-ncp \
|
||||
--enable-cli-app \
|
||||
--enable-radio-only \
|
||||
--with-ncp-vendor-hook-source=no \
|
||||
--with-ncp-bus=uart \
|
||||
--with-examples=$(PREFIX_LC) \
|
||||
$(NULL)
|
||||
|
||||
ifeq ($(CLI_LOGGING),1)
|
||||
@@ -100,7 +105,7 @@ LDFLAGS += \
|
||||
-Wl,--gc-sections \
|
||||
-Wl,-Map=$(PREFIX_LC).map \
|
||||
-lrt \
|
||||
-lpthread \
|
||||
-pthread \
|
||||
$(NULL)
|
||||
|
||||
ECHO := @echo
|
||||
|
||||
@@ -40,7 +40,7 @@ libopenthread_gp712_a_CPPFLAGS = \
|
||||
-I$(top_srcdir)/examples/platforms \
|
||||
-I$(top_srcdir)/examples/platforms/gp712 \
|
||||
-lrt \
|
||||
-lpthread \
|
||||
-pthread \
|
||||
$(NULL)
|
||||
|
||||
PLATFORM_SOURCES = \
|
||||
|
||||
@@ -37,10 +37,10 @@ if OPENTHREAD_ENABLE_FTD
|
||||
LDADD_COMMON += \
|
||||
$(top_srcdir)/third_party/Qorvo/repo/gp712/libQorvoGP712_ftd.a \
|
||||
$(NULL)
|
||||
endif # OPENTHREAD_ENABLE_FTD
|
||||
else # OPENTHREAD_ENABLE_FTD
|
||||
if OPENTHREAD_ENABLE_MTD
|
||||
LDADD_COMMON += \
|
||||
$(top_srcdir)/third_party/Qorvo/repo/gp712/libQorvoGP712_mtd.a \
|
||||
$(NULL)
|
||||
endif # OPENTHREAD_ENABLE_MTD
|
||||
|
||||
endif
|
||||
@@ -4,7 +4,7 @@ This directory contains example platform drivers for Qorvo gp712 on RPi.
|
||||
|
||||
## Toolchain
|
||||
|
||||
This example use the GNU GCC toolchain on the Raspberry Pi. To build on the Pi:
|
||||
This example uses the GNU GCC toolchain on the Raspberry Pi. To build on the Pi:
|
||||
|
||||
1. Download the repo to the Pi
|
||||
2. go to the subfolder in the openthread repo: third_party/nlbuild-autotools/repo/tools/packages and enter this command:
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
#include <string.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
#include <openthread/config.h>
|
||||
#include <openthread-core-config.h>
|
||||
#include <openthread/platform/alarm-milli.h>
|
||||
#include <openthread/platform/radio.h>
|
||||
|
||||
|
||||
@@ -41,53 +41,14 @@
|
||||
|
||||
#include "utils/code_utils.h"
|
||||
|
||||
#if __SANITIZE_ADDRESS__ != 0
|
||||
|
||||
static uint32_t sState = 1;
|
||||
|
||||
#endif // __SANITIZE_ADDRESS__
|
||||
|
||||
void qorvoRandomInit(void)
|
||||
{
|
||||
#if __SANITIZE_ADDRESS__ != 0
|
||||
|
||||
sState = (uint32_t)time(NULL);
|
||||
|
||||
#endif // __SANITIZE_ADDRESS__
|
||||
}
|
||||
|
||||
#if __SANITIZE_ADDRESS__ != 0
|
||||
|
||||
static uint32_t randomUint32Get(void)
|
||||
{
|
||||
uint32_t mlcg, p, q;
|
||||
uint64_t tmpstate;
|
||||
|
||||
tmpstate = (uint64_t)33614 * (uint64_t)sState;
|
||||
q = tmpstate & 0xffffffff;
|
||||
q = q >> 1;
|
||||
p = tmpstate >> 32;
|
||||
mlcg = p + q;
|
||||
|
||||
if (mlcg & 0x80000000)
|
||||
{
|
||||
mlcg &= 0x7fffffff;
|
||||
mlcg++;
|
||||
}
|
||||
|
||||
sState = mlcg;
|
||||
|
||||
return mlcg;
|
||||
}
|
||||
|
||||
#endif // __SANITIZE_ADDRESS__
|
||||
|
||||
otError otPlatEntropyGet(uint8_t *aOutput, uint16_t aOutputLength)
|
||||
{
|
||||
otError error = OT_ERROR_NONE;
|
||||
|
||||
#if __SANITIZE_ADDRESS__ == 0
|
||||
|
||||
FILE * file = NULL;
|
||||
size_t readLength;
|
||||
|
||||
@@ -106,26 +67,5 @@ exit:
|
||||
fclose(file);
|
||||
}
|
||||
|
||||
#else // __SANITIZE_ADDRESS__
|
||||
|
||||
/*
|
||||
* THE IMPLEMENTATION BELOW IS NOT COMPLIANT WITH THE THREAD SPECIFICATION.
|
||||
*
|
||||
* Address Sanitizer triggers test failures when reading random
|
||||
* values from /dev/urandom. The pseudo-random number generator
|
||||
* implementation below is only used to enable continuous
|
||||
* integration checks with Address Sanitizer enabled.
|
||||
*/
|
||||
otEXPECT_ACTION(aOutput && aOutputLength, error = OT_ERROR_INVALID_ARGS);
|
||||
|
||||
for (uint16_t length = 0; length < aOutputLength; length++)
|
||||
{
|
||||
aOutput[length] = (uint8_t)randomUint32Get();
|
||||
}
|
||||
|
||||
exit:
|
||||
|
||||
#endif // __SANITIZE_ADDRESS__
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <openthread/config.h>
|
||||
#include <openthread-core-config.h>
|
||||
#include <openthread/platform/flash.h>
|
||||
|
||||
static int sFlashFd = -1;
|
||||
|
||||
@@ -28,7 +28,6 @@
|
||||
|
||||
#include "platform_qorvo.h"
|
||||
#include <openthread-core-config.h>
|
||||
#include <openthread/config.h>
|
||||
|
||||
#include <ctype.h>
|
||||
#include <inttypes.h>
|
||||
|
||||
@@ -53,4 +53,84 @@
|
||||
*/
|
||||
#define OPENTHREAD_CONFIG_PLATFORM_FLASH_API_ENABLE 1
|
||||
|
||||
/**
|
||||
* @def OPENTHREAD_CONFIG_MAC_SOFTWARE_ACK_TIMEOUT_ENABLE
|
||||
*
|
||||
* Define to 1 if you want to enable software ACK timeout logic.
|
||||
*
|
||||
*/
|
||||
#ifndef OPENTHREAD_CONFIG_MAC_SOFTWARE_ACK_TIMEOUT_ENABLE
|
||||
#define OPENTHREAD_CONFIG_MAC_SOFTWARE_ACK_TIMEOUT_ENABLE 0
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @def OPENTHREAD_CONFIG_MAC_SOFTWARE_RETRANSMIT_ENABLE
|
||||
*
|
||||
* Define to 1 if you want to enable software retransmission logic.
|
||||
*
|
||||
*/
|
||||
#ifndef OPENTHREAD_CONFIG_MAC_SOFTWARE_RETRANSMIT_ENABLE
|
||||
#define OPENTHREAD_CONFIG_MAC_SOFTWARE_RETRANSMIT_ENABLE 1
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @def OPENTHREAD_CONFIG_MAC_SOFTWARE_CSMA_BACKOFF_ENABLE
|
||||
*
|
||||
* Define to 1 if you want to enable software CSMA-CA backoff logic.
|
||||
*
|
||||
*/
|
||||
#ifndef OPENTHREAD_CONFIG_MAC_SOFTWARE_CSMA_BACKOFF_ENABLE
|
||||
#define OPENTHREAD_CONFIG_MAC_SOFTWARE_CSMA_BACKOFF_ENABLE 1
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @def OPENTHREAD_CONFIG_MAC_SOFTWARE_TX_SECURITY_ENABLE
|
||||
*
|
||||
* Define to 1 if you want to enable software transmission security logic.
|
||||
*
|
||||
*/
|
||||
#ifndef OPENTHREAD_CONFIG_MAC_SOFTWARE_TX_SECURITY_ENABLE
|
||||
#define OPENTHREAD_CONFIG_MAC_SOFTWARE_TX_SECURITY_ENABLE (OPENTHREAD_CONFIG_THREAD_VERSION >= OT_THREAD_VERSION_1_2)
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @def OPENTHREAD_CONFIG_MAC_SOFTWARE_TX_TIMING_ENABLE
|
||||
*
|
||||
* Define to 1 to enable software transmission target time logic.
|
||||
*
|
||||
*/
|
||||
#ifndef OPENTHREAD_CONFIG_MAC_SOFTWARE_TX_TIMING_ENABLE
|
||||
#define OPENTHREAD_CONFIG_MAC_SOFTWARE_TX_TIMING_ENABLE (OPENTHREAD_CONFIG_THREAD_VERSION >= OT_THREAD_VERSION_1_2)
|
||||
#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_NCP_SPI_ENABLE
|
||||
*
|
||||
* Define as 1 to enable SPI NCP interface.
|
||||
*
|
||||
*/
|
||||
#ifndef OPENTHREAD_CONFIG_NCP_SPI_ENABLE
|
||||
#define OPENTHREAD_CONFIG_NCP_SPI_ENABLE 0
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @def OPENTHREAD_CONFIG_NCP_UART_ENABLE
|
||||
*
|
||||
* Define as 1 to enable UART NCP interface.
|
||||
*
|
||||
*/
|
||||
#ifndef OPENTHREAD_CONFIG_NCP_UART_ENABLE
|
||||
#define OPENTHREAD_CONFIG_NCP_UART_ENABLE 1
|
||||
#endif
|
||||
|
||||
#endif // OPENTHREAD_CORE_GP712_CONFIG_H_
|
||||
|
||||
@@ -36,7 +36,6 @@
|
||||
#define PLATFORM_QORVO_H_
|
||||
|
||||
#include <openthread-core-config.h>
|
||||
#include <openthread/config.h>
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
|
||||
@@ -77,6 +77,11 @@ typedef struct otCachedSettings_s
|
||||
|
||||
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;
|
||||
|
||||
@@ -150,13 +155,15 @@ otError otPlatRadioSleep(otInstance *aInstance)
|
||||
{
|
||||
OT_UNUSED_VARIABLE(aInstance);
|
||||
|
||||
if (sState == OT_RADIO_STATE_RECEIVE)
|
||||
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 OT_ERROR_NONE;
|
||||
return error;
|
||||
}
|
||||
|
||||
otError otPlatRadioReceive(otInstance *aInstance, uint8_t aChannel)
|
||||
@@ -168,6 +175,11 @@ otError otPlatRadioReceive(otInstance *aInstance, uint8_t aChannel)
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -183,8 +195,7 @@ otError otPlatRadioReceive(otInstance *aInstance, uint8_t aChannel)
|
||||
|
||||
otError otPlatRadioTransmit(otInstance *aInstance, otRadioFrame *aPacket)
|
||||
{
|
||||
otError err = OT_ERROR_NONE;
|
||||
|
||||
otError err = OT_ERROR_NONE;
|
||||
pQorvoInstance = aInstance;
|
||||
|
||||
otEXPECT_ACTION(sState != OT_RADIO_STATE_DISABLED, err = OT_ERROR_INVALID_STATE);
|
||||
@@ -328,23 +339,54 @@ void cbQorvoRadioEnergyScanDone(int8_t aEnergyScanMaxRssi)
|
||||
otError otPlatRadioGetTransmitPower(otInstance *aInstance, int8_t *aPower)
|
||||
{
|
||||
OT_UNUSED_VARIABLE(aInstance);
|
||||
if ((sState == OT_RADIO_STATE_DISABLED) || (sScanstate != 0))
|
||||
|
||||
otError result;
|
||||
|
||||
if (aPower == NULL)
|
||||
{
|
||||
return OT_ERROR_INVALID_STATE;
|
||||
return OT_ERROR_INVALID_ARGS;
|
||||
}
|
||||
|
||||
return qorvoRadioGetTransmitPower(aPower);
|
||||
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))
|
||||
{
|
||||
return OT_ERROR_INVALID_STATE;
|
||||
pendingTxPower = aPower;
|
||||
return OT_ERROR_NONE;
|
||||
}
|
||||
|
||||
return qorvoRadioSetTransmitPower(aPower);
|
||||
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)
|
||||
|
||||
@@ -54,7 +54,7 @@ otInstance *localInstance = NULL;
|
||||
int gArgumentsCount = 0;
|
||||
char **gArguments = NULL;
|
||||
|
||||
bool qorvoPlatGotoSleepCheck(void)
|
||||
uint8_t qorvoPlatGotoSleepCheck(void)
|
||||
{
|
||||
bool canGotoSleep = false;
|
||||
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
#define _XOPEN_SOURCE 500
|
||||
|
||||
#include "alarm_qorvo.h"
|
||||
#include "platform_qorvo.h"
|
||||
@@ -189,14 +190,11 @@ otError otPlatUartEnable(void)
|
||||
otEXPECT_ACTION(tcsetattr(s_out_fd, TCSANOW, &termios) == 0, perror("tcsetattr"); error = OT_ERROR_GENERIC);
|
||||
}
|
||||
|
||||
return error;
|
||||
|
||||
exit:
|
||||
|
||||
if (error != OT_ERROR_NONE)
|
||||
{
|
||||
close(s_in_fd);
|
||||
close(s_out_fd);
|
||||
}
|
||||
|
||||
close(s_in_fd);
|
||||
close(s_out_fd);
|
||||
return error;
|
||||
}
|
||||
|
||||
@@ -219,13 +217,70 @@ otError otPlatUartSend(const uint8_t *aBuf, uint16_t aBufLength)
|
||||
s_write_buffer = aBuf;
|
||||
s_write_length = aBufLength;
|
||||
|
||||
qorvoAlarmScheduleEventArg(0, platformDummy, (void *)&s_in_fd);
|
||||
|
||||
exit:
|
||||
return error;
|
||||
}
|
||||
|
||||
void platformUartUpdateFdSet(fd_set *aReadFdSet, fd_set *aWriteFdSet, fd_set *aErrorFdSet, int *aMaxFd)
|
||||
{
|
||||
if (aReadFdSet != NULL)
|
||||
{
|
||||
FD_SET(s_in_fd, aReadFdSet);
|
||||
|
||||
if (aErrorFdSet != NULL)
|
||||
{
|
||||
FD_SET(s_in_fd, aErrorFdSet);
|
||||
}
|
||||
|
||||
if (aMaxFd != NULL && *aMaxFd < s_in_fd)
|
||||
{
|
||||
*aMaxFd = s_in_fd;
|
||||
}
|
||||
}
|
||||
|
||||
if ((aWriteFdSet != NULL) && (s_write_length > 0))
|
||||
{
|
||||
FD_SET(s_out_fd, aWriteFdSet);
|
||||
|
||||
if (aErrorFdSet != NULL)
|
||||
{
|
||||
FD_SET(s_out_fd, aErrorFdSet);
|
||||
}
|
||||
|
||||
if (aMaxFd != NULL && *aMaxFd < s_out_fd)
|
||||
{
|
||||
*aMaxFd = s_out_fd;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
otError otPlatUartFlush(void)
|
||||
{
|
||||
return OT_ERROR_NOT_IMPLEMENTED;
|
||||
otError error = OT_ERROR_NONE;
|
||||
ssize_t count;
|
||||
|
||||
otEXPECT_ACTION(s_write_buffer != NULL && s_write_length > 0, error = OT_ERROR_INVALID_STATE);
|
||||
|
||||
while ((count = write(s_out_fd, s_write_buffer, s_write_length)) > 0 && (s_write_length -= count) > 0)
|
||||
{
|
||||
s_write_buffer += count;
|
||||
}
|
||||
|
||||
if (count != -1)
|
||||
{
|
||||
assert(s_write_length == 0);
|
||||
s_write_buffer = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
perror("write(UART)");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
exit:
|
||||
return error;
|
||||
}
|
||||
|
||||
void platformUartProcess(void)
|
||||
@@ -270,7 +325,6 @@ void platformUartProcess(void)
|
||||
perror("read");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
otPlatUartReceived(s_receive_buffer, (uint16_t)rval);
|
||||
}
|
||||
|
||||
@@ -278,19 +332,21 @@ void platformUartProcess(void)
|
||||
{
|
||||
rval = write(s_out_fd, s_write_buffer, s_write_length);
|
||||
|
||||
if (rval <= 0)
|
||||
if (rval >= 0)
|
||||
{
|
||||
s_write_buffer += (uint16_t)rval;
|
||||
s_write_length -= (uint16_t)rval;
|
||||
|
||||
if (s_write_length == 0)
|
||||
{
|
||||
otPlatUartSendDone();
|
||||
}
|
||||
}
|
||||
else if (errno != EINTR)
|
||||
{
|
||||
perror("write");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
s_write_buffer += (uint16_t)rval;
|
||||
s_write_length -= (uint16_t)rval;
|
||||
|
||||
if (s_write_length == 0)
|
||||
{
|
||||
otPlatUartSendDone();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,13 +37,14 @@ if OPENTHREAD_ENABLE_FTD
|
||||
LDADD_COMMON += \
|
||||
$(top_srcdir)/third_party/Qorvo/repo/qpg6095/libQorvoQPG6095_ftd.a \
|
||||
$(NULL)
|
||||
endif # OPENTHREAD_ENABLE_FTD
|
||||
else # OPENTHREAD_ENABLE_FTD
|
||||
if OPENTHREAD_ENABLE_MTD
|
||||
LDADD_COMMON += \
|
||||
$(top_srcdir)/third_party/Qorvo/repo/qpg6095/libQorvoQPG6095_mtd.a \
|
||||
$(NULL)
|
||||
endif # OPENTHREAD_ENABLE_MTD
|
||||
endif
|
||||
|
||||
LDFLAGS_COMMON += \
|
||||
-T $(top_srcdir)/examples/platforms/qpg6095/qpg6095.ld \
|
||||
$(NULL)
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
#include <string.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
#include <openthread/config.h>
|
||||
#include <openthread-core-config.h>
|
||||
#include <openthread/platform/alarm-milli.h>
|
||||
#include <openthread/platform/radio.h>
|
||||
|
||||
|
||||
@@ -50,12 +50,4 @@
|
||||
*/
|
||||
#define OPENTHREAD_CONFIG_PLATFORM_INFO "QPG6095"
|
||||
|
||||
/**
|
||||
* @def OPENTHREAD_CONFIG_NCP_UART_ENABLE
|
||||
*
|
||||
* Define to 1 to enable NCP UART support.
|
||||
*
|
||||
*/
|
||||
#define OPENTHREAD_CONFIG_NCP_UART_ENABLE 1
|
||||
|
||||
#endif // OPENTHREAD_CORE_QPG6095_CONFIG_H_
|
||||
|
||||
@@ -49,7 +49,7 @@ static otInstance *localInstance = NULL;
|
||||
extern void flash_jump_gpJumpTables_GetRomVersion(void);
|
||||
#endif // QORVO_USE_ROM
|
||||
|
||||
bool qorvoPlatGotoSleepCheck(void)
|
||||
uint8_t qorvoPlatGotoSleepCheck(void)
|
||||
{
|
||||
if (localInstance)
|
||||
{
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
|
||||
typedef bool (*qorvoPlatGotoSleepCheckCallback_t)(void);
|
||||
typedef uint8_t (*qorvoPlatGotoSleepCheckCallback_t)(void);
|
||||
|
||||
/**
|
||||
* This function initializes the platform.
|
||||
|
||||
@@ -77,6 +77,11 @@ typedef struct otCachedSettings_s
|
||||
|
||||
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;
|
||||
|
||||
@@ -150,13 +155,15 @@ otError otPlatRadioSleep(otInstance *aInstance)
|
||||
{
|
||||
OT_UNUSED_VARIABLE(aInstance);
|
||||
|
||||
if (sState == OT_RADIO_STATE_RECEIVE)
|
||||
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 OT_ERROR_NONE;
|
||||
return error;
|
||||
}
|
||||
|
||||
otError otPlatRadioReceive(otInstance *aInstance, uint8_t aChannel)
|
||||
@@ -168,6 +175,11 @@ otError otPlatRadioReceive(otInstance *aInstance, uint8_t aChannel)
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -328,23 +340,54 @@ void cbQorvoRadioEnergyScanDone(int8_t aEnergyScanMaxRssi)
|
||||
otError otPlatRadioGetTransmitPower(otInstance *aInstance, int8_t *aPower)
|
||||
{
|
||||
OT_UNUSED_VARIABLE(aInstance);
|
||||
if ((sState == OT_RADIO_STATE_DISABLED) || (sScanstate != 0))
|
||||
|
||||
otError result;
|
||||
|
||||
if (aPower == NULL)
|
||||
{
|
||||
return OT_ERROR_INVALID_STATE;
|
||||
return OT_ERROR_INVALID_ARGS;
|
||||
}
|
||||
|
||||
return qorvoRadioGetTransmitPower(aPower);
|
||||
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))
|
||||
{
|
||||
return OT_ERROR_INVALID_STATE;
|
||||
pendingTxPower = aPower;
|
||||
return OT_ERROR_NONE;
|
||||
}
|
||||
|
||||
return qorvoRadioSetTransmitPower(aPower);
|
||||
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)
|
||||
|
||||
@@ -38,6 +38,7 @@
|
||||
#include "openthread/platform/settings.h"
|
||||
|
||||
#include <utils/code_utils.h>
|
||||
#include <utils/settings.h>
|
||||
|
||||
#include "settings_qorvo.h"
|
||||
|
||||
|
||||
@@ -42,12 +42,13 @@ if OPENTHREAD_ENABLE_FTD
|
||||
LDADD_COMMON += \
|
||||
$(top_srcdir)/third_party/Qorvo/repo/qpg6100/libQorvoQPG6100_ftd.a \
|
||||
$(NULL)
|
||||
endif # OPENTHREAD_ENABLE_FTD
|
||||
else # OPENTHREAD_ENABLE_FTD
|
||||
if OPENTHREAD_ENABLE_MTD
|
||||
LDADD_COMMON += \
|
||||
$(top_srcdir)/third_party/Qorvo/repo/qpg6100/libQorvoQPG6100_mtd.a \
|
||||
$(NULL)
|
||||
endif # OPENTHREAD_ENABLE_MTD
|
||||
endif
|
||||
LDFLAGS_COMMON += \
|
||||
-T $(top_srcdir)/examples/platforms/qpg6100/qpg6100.ld \
|
||||
$(NULL)
|
||||
|
||||
@@ -50,12 +50,4 @@
|
||||
*/
|
||||
#define OPENTHREAD_CONFIG_PLATFORM_INFO "QPG6100"
|
||||
|
||||
/**
|
||||
* @def OPENTHREAD_CONFIG_NCP_UART_ENABLE
|
||||
*
|
||||
* Define to 1 to enable NCP UART support.
|
||||
*
|
||||
*/
|
||||
#define OPENTHREAD_CONFIG_NCP_UART_ENABLE 1
|
||||
|
||||
#endif // OPENTHREAD_CORE_QPG6100_CONFIG_H_
|
||||
|
||||
@@ -40,7 +40,7 @@ libopenthread_qpg7015m_a_CPPFLAGS = \
|
||||
-I$(top_srcdir)/examples/platforms \
|
||||
-I$(top_srcdir)/examples/platforms/qpg7015m \
|
||||
-lrt \
|
||||
-lpthread \
|
||||
-pthread \
|
||||
$(NULL)
|
||||
|
||||
PLATFORM_SOURCES = \
|
||||
|
||||
@@ -37,10 +37,10 @@ if OPENTHREAD_ENABLE_FTD
|
||||
LDADD_COMMON += \
|
||||
$(top_srcdir)/third_party/Qorvo/repo/qpg7015m/libQorvoQPG7015M_ftd.a \
|
||||
$(NULL)
|
||||
endif # OPENTHREAD_ENABLE_FTD
|
||||
else # OPENTHREAD_ENABLE_FTD
|
||||
if OPENTHREAD_ENABLE_MTD
|
||||
LDADD_COMMON += \
|
||||
$(top_srcdir)/third_party/Qorvo/repo/qpg7015m/libQorvoQPG7015M_mtd.a \
|
||||
$(NULL)
|
||||
endif # OPENTHREAD_ENABLE_MTD
|
||||
|
||||
endif
|
||||
|
||||
@@ -0,0 +1,71 @@
|
||||
# OpenThread on Qorvo qpg7015m Example
|
||||
|
||||
This directory contains example platform drivers for Qorvo qpg7015m on RPi.
|
||||
|
||||
## Toolchain
|
||||
|
||||
This example uses the GNU GCC toolchain on the Raspberry Pi. To build on the Pi:
|
||||
|
||||
1. Download the repo to the Pi
|
||||
2. go to the subfolder in the openthread repo: third_party/nlbuild-autotools/repo/tools/packages and enter this command:
|
||||
|
||||
```bash
|
||||
$ sudo /bin/bash build
|
||||
```
|
||||
|
||||
Note that you may need to install additional packages to make this build work, depending on your actual RPi OS version. The build process will complain if additional packages are required.
|
||||
|
||||
## Build Examples
|
||||
|
||||
```bash
|
||||
$ cd <path-to-openthread>
|
||||
$ ./script/bootstrap
|
||||
$ ./bootstrap
|
||||
$ REFERENCE_DEVICE=1 CLI_LOGGING=1 COMMISSIONER=1 JOINER=1 DHCP6_CLIENT=1 DHCP6_SERVER=1 BORDER_ROUTER=1 make -f examples/Makefile-qpg7015m
|
||||
```
|
||||
|
||||
After a successful build, the `elf` files are found in `<path-to-openthread>/output/qpg7015m/bin`.
|
||||
|
||||
Building a variant which interfaces via a tcp socket is also possible. Replace the uart-posix.c with uart-socket.c in the Makefile.am from examples/platforms/qpg7015m/Makefile.am and rebuild. Now it should be possible to open a telnet to socket 9190 of the raspberry pi from a remote PC. This also easier testing with the official Thread Test Harness.
|
||||
|
||||
##
|
||||
|
||||
## Interact
|
||||
|
||||
1. Spawn the process:
|
||||
|
||||
```bash
|
||||
$ cd <path-to-openthread>/output/qpg7015m/bin
|
||||
$ ./qpg7015m-ot-cli-ftd
|
||||
```
|
||||
|
||||
2. Type `help` for list of commands.
|
||||
|
||||
```bash
|
||||
> help
|
||||
help
|
||||
channel
|
||||
childtimeout
|
||||
contextreusedelay
|
||||
extaddr
|
||||
extpanid
|
||||
ipaddr
|
||||
keysequence
|
||||
leaderweight
|
||||
masterkey
|
||||
mode
|
||||
netdata register
|
||||
networkidtimeout
|
||||
networkname
|
||||
panid
|
||||
ping
|
||||
prefix
|
||||
releaserouterid
|
||||
rloc16
|
||||
route
|
||||
routerupgradethreshold
|
||||
scan
|
||||
start
|
||||
state
|
||||
stop
|
||||
```
|
||||
Executable → Regular
+80
@@ -53,4 +53,84 @@
|
||||
*/
|
||||
#define OPENTHREAD_CONFIG_PLATFORM_FLASH_API_ENABLE 1
|
||||
|
||||
/**
|
||||
* @def OPENTHREAD_CONFIG_MAC_SOFTWARE_ACK_TIMEOUT_ENABLE
|
||||
*
|
||||
* Define to 1 if you want to enable software ACK timeout logic.
|
||||
*
|
||||
*/
|
||||
#ifndef OPENTHREAD_CONFIG_MAC_SOFTWARE_ACK_TIMEOUT_ENABLE
|
||||
#define OPENTHREAD_CONFIG_MAC_SOFTWARE_ACK_TIMEOUT_ENABLE 0
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @def OPENTHREAD_CONFIG_MAC_SOFTWARE_RETRANSMIT_ENABLE
|
||||
*
|
||||
* Define to 1 if you want to enable software retransmission logic.
|
||||
*
|
||||
*/
|
||||
#ifndef OPENTHREAD_CONFIG_MAC_SOFTWARE_RETRANSMIT_ENABLE
|
||||
#define OPENTHREAD_CONFIG_MAC_SOFTWARE_RETRANSMIT_ENABLE 1
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @def OPENTHREAD_CONFIG_MAC_SOFTWARE_CSMA_BACKOFF_ENABLE
|
||||
*
|
||||
* Define to 1 if you want to enable software CSMA-CA backoff logic.
|
||||
*
|
||||
*/
|
||||
#ifndef OPENTHREAD_CONFIG_MAC_SOFTWARE_CSMA_BACKOFF_ENABLE
|
||||
#define OPENTHREAD_CONFIG_MAC_SOFTWARE_CSMA_BACKOFF_ENABLE 1
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @def OPENTHREAD_CONFIG_MAC_SOFTWARE_TX_SECURITY_ENABLE
|
||||
*
|
||||
* Define to 1 if you want to enable software transmission security logic.
|
||||
*
|
||||
*/
|
||||
#ifndef OPENTHREAD_CONFIG_MAC_SOFTWARE_TX_SECURITY_ENABLE
|
||||
#define OPENTHREAD_CONFIG_MAC_SOFTWARE_TX_SECURITY_ENABLE (OPENTHREAD_CONFIG_THREAD_VERSION >= OT_THREAD_VERSION_1_2)
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @def OPENTHREAD_CONFIG_MAC_SOFTWARE_TX_TIMING_ENABLE
|
||||
*
|
||||
* Define to 1 to enable software transmission target time logic.
|
||||
*
|
||||
*/
|
||||
#ifndef OPENTHREAD_CONFIG_MAC_SOFTWARE_TX_TIMING_ENABLE
|
||||
#define OPENTHREAD_CONFIG_MAC_SOFTWARE_TX_TIMING_ENABLE (OPENTHREAD_CONFIG_THREAD_VERSION >= OT_THREAD_VERSION_1_2)
|
||||
#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_NCP_SPI_ENABLE
|
||||
*
|
||||
* Define as 1 to enable SPI NCP interface.
|
||||
*
|
||||
*/
|
||||
#ifndef OPENTHREAD_CONFIG_NCP_SPI_ENABLE
|
||||
#define OPENTHREAD_CONFIG_NCP_SPI_ENABLE 0
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @def OPENTHREAD_CONFIG_NCP_UART_ENABLE
|
||||
*
|
||||
* Define as 1 to enable UART NCP interface.
|
||||
*
|
||||
*/
|
||||
#ifndef OPENTHREAD_CONFIG_NCP_UART_ENABLE
|
||||
#define OPENTHREAD_CONFIG_NCP_UART_ENABLE 1
|
||||
#endif
|
||||
|
||||
#endif // OPENTHREAD_CORE_QPG7015M_CONFIG_H_
|
||||
|
||||
Reference in New Issue
Block a user