mirror of
https://github.com/espressif/openthread.git
synced 2026-08-04 09:57:47 +00:00
Move otPlatUartEnable to CLI or NCP init functions. (#1359)
This commit is contained in:
committed by
Jonathan Hui
parent
c1dc4f6aa9
commit
fb49b6a222
@@ -32,7 +32,6 @@
|
||||
* This file includes the platform-specific initializers.
|
||||
*/
|
||||
|
||||
#include <platform/uart.h>
|
||||
#include "platform-cc2538.h"
|
||||
|
||||
otInstance *sInstance;
|
||||
@@ -42,7 +41,6 @@ void PlatformInit(int argc, char *argv[])
|
||||
cc2538AlarmInit();
|
||||
cc2538RandomInit();
|
||||
cc2538RadioInit();
|
||||
otPlatUartEnable();
|
||||
|
||||
(void)argc;
|
||||
(void)argv;
|
||||
|
||||
@@ -27,7 +27,6 @@
|
||||
*/
|
||||
|
||||
#include <openthread-types.h>
|
||||
#include <platform/uart.h>
|
||||
#include "platform-cc2650.h"
|
||||
|
||||
otInstance *sInstance;
|
||||
@@ -42,7 +41,6 @@ void PlatformInit(int argc, char *argv[])
|
||||
cc2650AlarmInit();
|
||||
cc2650RandomInit();
|
||||
cc2650RadioInit();
|
||||
otPlatUartEnable();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -43,7 +43,6 @@
|
||||
#include "hw_watchdog.h"
|
||||
#include "ftdf.h"
|
||||
#include "hw_gpio.h"
|
||||
#include "platform/uart.h"
|
||||
|
||||
static bool sBlink = false;
|
||||
static int sMsCounterInit;
|
||||
@@ -144,8 +143,6 @@ void PlatformInit(int argc, char *argv[])
|
||||
da15000AlarmInit();
|
||||
// Initialize Radio
|
||||
da15000RadioInit();
|
||||
// Initialize UART
|
||||
otPlatUartEnable();
|
||||
// enable interrupts
|
||||
portENABLE_INTERRUPTS();
|
||||
|
||||
|
||||
@@ -33,7 +33,6 @@
|
||||
*/
|
||||
|
||||
#include <platform/logging.h>
|
||||
#include <platform/uart.h>
|
||||
|
||||
#include "drivers/nrf_drv_clock.h"
|
||||
#include "platform-nrf5.h"
|
||||
@@ -58,9 +57,6 @@ void PlatformInit(int argc, char *argv[])
|
||||
#if (OPENTHREAD_ENABLE_DEFAULT_LOGGING == 0)
|
||||
nrf5LogInit();
|
||||
#endif
|
||||
|
||||
// Enable UART since its not enabled by higher level layers.
|
||||
otPlatUartEnable();
|
||||
}
|
||||
|
||||
void PlatformProcessDrivers(otInstance *aInstance)
|
||||
|
||||
@@ -49,7 +49,6 @@
|
||||
#include <openthread.h>
|
||||
#include <openthread-tasklet.h>
|
||||
#include <platform/alarm.h>
|
||||
#include <platform/uart.h>
|
||||
|
||||
uint32_t NODE_ID = 1;
|
||||
uint32_t WELLKNOWN_NODE_ID = 34;
|
||||
@@ -81,8 +80,6 @@ void PlatformInit(int argc, char *argv[])
|
||||
platformRandomInit();
|
||||
}
|
||||
|
||||
bool UartInitialized = false;
|
||||
|
||||
void PlatformProcessDrivers(otInstance *aInstance)
|
||||
{
|
||||
fd_set read_fds;
|
||||
@@ -92,12 +89,6 @@ void PlatformProcessDrivers(otInstance *aInstance)
|
||||
struct timeval timeout;
|
||||
int rval;
|
||||
|
||||
if (!UartInitialized)
|
||||
{
|
||||
UartInitialized = true;
|
||||
otPlatUartEnable();
|
||||
}
|
||||
|
||||
FD_ZERO(&read_fds);
|
||||
FD_ZERO(&write_fds);
|
||||
FD_ZERO(&error_fds);
|
||||
@@ -121,4 +112,3 @@ void PlatformProcessDrivers(otInstance *aInstance)
|
||||
platformRadioProcess(aInstance);
|
||||
platformAlarmProcess(aInstance);
|
||||
}
|
||||
|
||||
|
||||
@@ -68,6 +68,8 @@ Uart::Uart(otInstance *aInstance):
|
||||
mTxHead = 0;
|
||||
mTxLength = 0;
|
||||
mSendLength = 0;
|
||||
|
||||
otPlatUartEnable();
|
||||
}
|
||||
|
||||
extern "C" void otPlatUartReceived(const uint8_t *aBuf, uint16_t aBufLength)
|
||||
|
||||
@@ -95,6 +95,8 @@ NcpUart::NcpUart(otInstance *aInstance):
|
||||
mUartSendTask(aInstance->mIp6.mTaskletScheduler, EncodeAndSendToUart, this)
|
||||
{
|
||||
mTxFrameBuffer.SetCallbacks(NULL, TxFrameBufferHasData, this);
|
||||
|
||||
otPlatUartEnable();
|
||||
}
|
||||
|
||||
ThreadError NcpUart::OutboundFrameBegin(void)
|
||||
|
||||
Reference in New Issue
Block a user