![]() |
![]() |
TI-OpenThread
1.08.06.06
|
#include <openthread/config.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <openthread/platform/alarm-milli.h>
#include <openthread/platform/diag.h>
#include <openthread/platform/radio.h>
#include <common/logging.hpp>
#include <utils/code_utils.h>
#include "radio.h"
Macros | |
#define | PLAT_DIAG_RX_SEQNO_WINDOW 100 |
#define | PLAT_DIAG_TX_INTERFRAME 100 |
#define | PLAT_DIAG_TX_PACKETSIZE 30 |
Functions | |
bool | otDiagIsEnabled (otInstance *aInstance) |
void | otPlatDiagAlarmCallback (otInstance *aInstance) |
void | otPlatDiagChannelSet (uint8_t aChannel) |
bool | otPlatDiagModeGet () |
void | otPlatDiagModeSet (bool aMode) |
otError | otPlatDiagProcess (otInstance *aInstance, uint8_t argc, char *argv[], char *aOutput, size_t aOutputMaxLen) |
void | otPlatDiagRadioReceived (otInstance *aInstance, otRadioFrame *aFrame, otError aError) |
void | otPlatDiagTxPowerSet (int8_t aTxPower) |
unsigned int | PlatDiag_calculatePER (void) |
otError | PlatDiag_parseLong (char *aArgVector, long *aValue) |
otError | PlatDiag_processReceive (otInstance *aInstance, int argc, char *argv[], char *aOutput, size_t aOutputMaxLen) |
otError | PlatDiag_processShield (otInstance *aInstance, int argc, char *argv[], char *aOutput, size_t aOutputMaxLen) |
otError | PlatDiag_processTone (otInstance *aInstance, int argc, char *argv[], char *aOutput, size_t aOutputMaxLen) |
otError | PlatDiag_processTransmit (otInstance *aInstance, int argc, char *argv[], char *aOutput, size_t aOutputMaxLen) |
Variables | |
static bool | PlatDiag_diagEnabled = false |
static bool | PlatDiag_rxEnabled = false |
static uint16_t | PlatDiag_rxExpectedSeqNo |
static uint16_t | PlatDiag_rxFrameCount |
static uint16_t | PlatDiag_rxLostFrames |
static uint16_t | PlatDiag_rxNokCount |
static uint16_t | PlatDiag_rxReceivedCount |
static bool | PlatDiag_txEnabled = false |
static uint16_t | PlatDiag_txFrameCount |
static uint16_t | PlatDiag_txFrameSize |
static uint32_t | PlatDiag_txPeriod |
static uint16_t | PlatDiag_txSentCount |
#define PLAT_DIAG_RX_SEQNO_WINDOW 100 |
Window for rx frame to be counted as lost instead of RX nOK.
Workaround for issue of receiving valid 802.15.4 frames counts ad very large sequence numbers.
Referenced by otPlatDiagRadioReceived().
#define PLAT_DIAG_TX_INTERFRAME 100 |
Default interframe spacing used for transmission command.
Referenced by PlatDiag_processTransmit().
#define PLAT_DIAG_TX_PACKETSIZE 30 |
Default packet size used for transmission command.
Referenced by PlatDiag_processTransmit().
otError PlatDiag_parseLong | ( | char * | aArgVector, |
long * | aValue | ||
) |
Helper function to parse strings into long variables and mark errors.
[in] | aArgVector | C string to parse. |
[out] | aValue | address of long container. |
OT_ERROR_NONE | The string was parsed correctly. |
OT_ERROR_PARSE | The string was not formatted correctly. |
Referenced by PlatDiag_processReceive(), PlatDiag_processShield(), and PlatDiag_processTransmit().
unsigned int PlatDiag_calculatePER | ( | void | ) |
Helper function to calculate the Packet Error Rate.
PER value based on PlatDiag_rxFrameCount PlatDiag_rxReceivedCount PlatDiag_rxNokCount and PlatDiag_rxLostFrames.
References PlatDiag_rxFrameCount, PlatDiag_rxLostFrames, PlatDiag_rxNokCount, and PlatDiag_rxReceivedCount.
Referenced by PlatDiag_processReceive().
otError PlatDiag_processReceive | ( | otInstance * | aInstance, |
int | argc, | ||
char * | argv[], | ||
char * | aOutput, | ||
size_t | aOutputMaxLen | ||
) |
Process the diag receive
command.
[in] | aInstance | OpenThread instance structure. |
[in] | argc | Count of command arguments. |
[in] | argv | Array of command arguments. |
[out] | aOutput | Output buffer used for user interaction. |
[in] | aOutputMaxLen | Size of the Output buffer. |
References PlatDiag_calculatePER(), PlatDiag_diagEnabled, PlatDiag_parseLong(), PlatDiag_rxEnabled, PlatDiag_rxExpectedSeqNo, PlatDiag_rxFrameCount, PlatDiag_rxLostFrames, PlatDiag_rxNokCount, PlatDiag_rxReceivedCount, and PlatDiag_txEnabled.
Referenced by otPlatDiagProcess().
otError PlatDiag_processTransmit | ( | otInstance * | aInstance, |
int | argc, | ||
char * | argv[], | ||
char * | aOutput, | ||
size_t | aOutputMaxLen | ||
) |
Process the diag transmit
command.
[in] | aInstance | OpenThread instance structure. |
[in] | argc | Count of command arguments. |
[in] | argv | Array of command arguments. |
[out] | aOutput | Output buffer used for user interaction. |
[in] | aOutputMaxLen | Size of the Output buffer. |
References otPlatAlarmMilliGetNow(), otPlatAlarmMilliStartAt(), otPlatAlarmMilliStop(), PLAT_DIAG_TX_INTERFRAME, PLAT_DIAG_TX_PACKETSIZE, PlatDiag_diagEnabled, PlatDiag_parseLong(), PlatDiag_rxEnabled, PlatDiag_txEnabled, PlatDiag_txFrameCount, PlatDiag_txFrameSize, PlatDiag_txPeriod, and PlatDiag_txSentCount.
Referenced by otPlatDiagProcess().
otError PlatDiag_processTone | ( | otInstance * | aInstance, |
int | argc, | ||
char * | argv[], | ||
char * | aOutput, | ||
size_t | aOutputMaxLen | ||
) |
Process the diag tone
command.
[in] | aInstance | OpenThread instance structure. |
[in] | argc | Count of command arguments. |
[in] | argv | Array of command arguments. |
[out] | aOutput | Output buffer used for user interaction. |
[in] | aOutputMaxLen | Size of the Output buffer. |
References otPlatDiagRadioToneStart(), otPlatDiagRadioToneStop(), and PlatDiag_diagEnabled.
Referenced by otPlatDiagProcess().
otError PlatDiag_processShield | ( | otInstance * | aInstance, |
int | argc, | ||
char * | argv[], | ||
char * | aOutput, | ||
size_t | aOutputMaxLen | ||
) |
Process the diag shield
command.
[in] | aInstance | OpenThread instance structure. |
[in] | argc | Count of command arguments. |
[in] | argv | Array of command arguments. |
[out] | aOutput | Output buffer used for user interaction. |
[in] | aOutputMaxLen | Size of the Output buffer. |
References PlatDiag_parseLong(), rfCoreDiagChannelDisable(), and rfCoreDiagChannelEnable().
Referenced by otPlatDiagProcess().
otError otPlatDiagProcess | ( | otInstance * | aInstance, |
uint8_t | argc, | ||
char * | argv[], | ||
char * | aOutput, | ||
size_t | aOutputMaxLen | ||
) |
Documented in <openthread/platform/diag.h>
References PlatDiag_processReceive(), PlatDiag_processShield(), PlatDiag_processTone(), and PlatDiag_processTransmit().
void otPlatDiagModeSet | ( | bool | aMode | ) |
Documented in <openthread/platform/diag.h>
References PlatDiag_diagEnabled.
bool otPlatDiagModeGet | ( | ) |
Documented in <openthread/platform/diag.h>
References PlatDiag_diagEnabled.
void otPlatDiagChannelSet | ( | uint8_t | aChannel | ) |
Documented in <openthread/platform/diag.h>
void otPlatDiagTxPowerSet | ( | int8_t | aTxPower | ) |
Documented in <openthread/platform/diag.h>
void otPlatDiagRadioReceived | ( | otInstance * | aInstance, |
otRadioFrame * | aFrame, | ||
otError | aError | ||
) |
Documented in <openthread/platform/diag.h>
References otPlatLog(), PLAT_DIAG_RX_SEQNO_WINDOW, PlatDiag_rxEnabled, PlatDiag_rxExpectedSeqNo, PlatDiag_rxFrameCount, PlatDiag_rxLostFrames, PlatDiag_rxNokCount, and PlatDiag_rxReceivedCount.
void otPlatDiagAlarmCallback | ( | otInstance * | aInstance | ) |
Documented in <openthread/platform/diag.h>
References otPlatAlarmMilliGetNow(), otPlatAlarmMilliStartAt(), otPlatLog(), otPlatRadioGetTransmitBuffer(), otPlatRadioTransmit(), PlatDiag_txEnabled, PlatDiag_txFrameCount, PlatDiag_txFrameSize, PlatDiag_txPeriod, and PlatDiag_txSentCount.
bool otDiagIsEnabled | ( | otInstance * | aInstance | ) |
Documented in <openthread/platform/diag.h>
|
static |
Diagnostics mode variables.
Referenced by otPlatDiagModeGet(), otPlatDiagModeSet(), PlatDiag_processReceive(), PlatDiag_processTone(), and PlatDiag_processTransmit().
|
static |
Referenced by otPlatDiagRadioReceived(), PlatDiag_processReceive(), and PlatDiag_processTransmit().
|
static |
Referenced by otPlatDiagAlarmCallback(), PlatDiag_processReceive(), and PlatDiag_processTransmit().
|
static |
diag transmit
variables.
Referenced by otPlatDiagAlarmCallback(), and PlatDiag_processTransmit().
|
static |
Referenced by otPlatDiagAlarmCallback(), and PlatDiag_processTransmit().
|
static |
Referenced by otPlatDiagAlarmCallback(), and PlatDiag_processTransmit().
|
static |
Referenced by otPlatDiagAlarmCallback(), and PlatDiag_processTransmit().
|
static |
diag receive
variables.
Referenced by otPlatDiagRadioReceived(), and PlatDiag_processReceive().
|
static |
Referenced by otPlatDiagRadioReceived(), PlatDiag_calculatePER(), and PlatDiag_processReceive().
|
static |
Referenced by otPlatDiagRadioReceived(), PlatDiag_calculatePER(), and PlatDiag_processReceive().
|
static |
Referenced by otPlatDiagRadioReceived(), PlatDiag_calculatePER(), and PlatDiag_processReceive().
|
static |
Referenced by otPlatDiagRadioReceived(), PlatDiag_calculatePER(), and PlatDiag_processReceive().