Rename otPlatSerial* to otPlatUart*. (#253)

This commit is contained in:
Jonathan Hui
2016-07-07 12:18:58 -07:00
committed by GitHub
parent e59f66b4d0
commit 9baa18e6e6
20 changed files with 97 additions and 97 deletions
+2 -2
View File
@@ -27,7 +27,7 @@
*/
#include <openthread.h>
#include <cli/cli-serial.h>
#include <cli/cli-uart.h>
#include <platform.h>
void otSignalTaskletPending(void)
@@ -38,7 +38,7 @@ int main(int argc, char *argv[])
{
PlatformInit(argc, argv);
otInit();
otCliSerialInit();
otCliUartInit();
while (1)
{
+1 -1
View File
@@ -41,7 +41,7 @@ libopenthread_cc2538_a_SOURCES = \
platform.c \
radio.c \
random.c \
serial.c \
uart.c \
startup-gcc.c \
$(NULL)
+2 -2
View File
@@ -70,9 +70,9 @@ void cc2538RadioProcess(void);
void cc2538RandomInit(void);
/**
* This function performs radio driver processing.
* This function performs UART driver processing.
*
*/
void cc2538SerialProcess(void);
void cc2538UartProcess(void);
#endif // PLATFORM_CC2538_H_
+3 -3
View File
@@ -32,7 +32,7 @@
* This file includes the platform-specific initializers.
*/
#include <platform/serial.h>
#include <platform/uart.h>
#include "platform-cc2538.h"
void PlatformInit(int argc, char *argv[])
@@ -40,14 +40,14 @@ void PlatformInit(int argc, char *argv[])
cc2538AlarmInit();
cc2538RadioInit();
cc2538RandomInit();
otPlatSerialEnable();
otPlatUartEnable();
}
void PlatformProcessDrivers(void)
{
// should sleep and wait for interrupts here
cc2538SerialProcess();
cc2538UartProcess();
cc2538RadioProcess();
cc2538AlarmProcess();
}
@@ -28,7 +28,7 @@
/**
* @file
* This file implements the OpenThread platform abstraction for serial communication.
* This file implements the OpenThread platform abstraction for UART communication.
*
*/
@@ -36,7 +36,7 @@
#include <openthread-types.h>
#include <common/code_utils.hpp>
#include <platform/serial.h>
#include <platform/uart.h>
#include "platform-cc2538.h"
enum
@@ -58,7 +58,7 @@ static uint8_t sReceiveBuffer[kReceiveBufferSize];
static uint16_t sReceiveHead = 0;
static uint16_t sReceiveLength = 0;
ThreadError otPlatSerialEnable(void)
ThreadError otPlatUartEnable(void)
{
uint32_t div;
@@ -99,12 +99,12 @@ ThreadError otPlatSerialEnable(void)
return kThreadError_None;
}
ThreadError otPlatSerialDisable(void)
ThreadError otPlatUartDisable(void)
{
return kThreadError_None;
}
ThreadError otPlatSerialSend(const uint8_t *aBuf, uint16_t aBufLength)
ThreadError otPlatUartSend(const uint8_t *aBuf, uint16_t aBufLength)
{
ThreadError error = kThreadError_None;
@@ -127,14 +127,14 @@ void processReceive(void)
if (sReceiveLength >= remaining)
{
otPlatSerialReceived(sReceiveBuffer + sReceiveHead, remaining);
otPlatUartReceived(sReceiveBuffer + sReceiveHead, remaining);
sReceiveHead = 0;
sReceiveLength -= remaining;
}
if (sReceiveLength > 0)
{
otPlatSerialReceived(sReceiveBuffer + sReceiveHead, sReceiveLength);
otPlatUartReceived(sReceiveBuffer + sReceiveHead, sReceiveLength);
sReceiveHead += sReceiveLength;
sReceiveLength = 0;
}
@@ -155,13 +155,13 @@ void processTransmit(void)
}
sTransmitBuffer = NULL;
otPlatSerialSendDone();
otPlatUartSendDone();
exit:
return;
}
void cc2538SerialProcess(void)
void cc2538UartProcess(void)
{
processReceive();
processTransmit();
+1 -1
View File
@@ -42,7 +42,7 @@ libopenthread_posix_a_SOURCES = \
platform.c \
radio.c \
random.c \
serial.c \
uart.c \
$(NULL)
noinst_HEADERS = \
+3 -3
View File
@@ -100,19 +100,19 @@ void posixRadioProcess(void);
void posixRandomInit(void);
/**
* This function updates the file descriptor sets with file descriptors used by the serial driver.
* This function updates the file descriptor sets with file descriptors used by the UART driver.
*
* @param[inout] aReadFdSet A pointer to the read file descriptors.
* @param[inout] aWriteFdSet A pointer to the write file descriptors.
* @param[inout] aMaxFd A pointer to the max file descriptor.
*
*/
void posixSerialUpdateFdSet(fd_set *aReadFdSet, fd_set *aWriteFdSet, int *aMaxFd);
void posixUartUpdateFdSet(fd_set *aReadFdSet, fd_set *aWriteFdSet, int *aMaxFd);
/**
* This function performs radio driver processing.
*
*/
void posixSerialProcess(void);
void posixUartProcess(void);
#endif // PLATFORM_POSIX_H_
+4 -4
View File
@@ -41,7 +41,7 @@
#include <openthread.h>
#include <platform/alarm.h>
#include <platform/serial.h>
#include <platform/uart.h>
#include "platform-posix.h"
uint32_t NODE_ID = 1;
@@ -59,7 +59,7 @@ void PlatformInit(int argc, char *argv[])
posixAlarmInit();
posixRadioInit();
posixRandomInit();
otPlatSerialEnable();
otPlatUartEnable();
}
void PlatformProcessDrivers(void)
@@ -73,7 +73,7 @@ void PlatformProcessDrivers(void)
FD_ZERO(&read_fds);
FD_ZERO(&write_fds);
posixSerialUpdateFdSet(&read_fds, &write_fds, &max_fd);
posixUartUpdateFdSet(&read_fds, &write_fds, &max_fd);
posixRadioUpdateFdSet(&read_fds, &write_fds, &max_fd);
posixAlarmUpdateTimeout(&timeout);
@@ -83,7 +83,7 @@ void PlatformProcessDrivers(void)
assert(rval >= 0 && errno != ETIME);
}
posixSerialProcess();
posixUartProcess();
posixRadioProcess();
posixAlarmProcess();
}
@@ -35,7 +35,7 @@
#include <unistd.h>
#include <common/code_utils.hpp>
#include <platform/serial.h>
#include <platform/uart.h>
#include "platform-posix.h"
#ifdef OPENTHREAD_TARGET_LINUX
@@ -64,7 +64,7 @@ static void restore_stdout_termios(void)
tcsetattr(s_out_fd, TCSAFLUSH, &original_stdout_termios);
}
ThreadError otPlatSerialEnable(void)
ThreadError otPlatUartEnable(void)
{
ThreadError error = kThreadError_None;
struct termios termios;
@@ -140,7 +140,7 @@ exit:
return error;
}
ThreadError otPlatSerialDisable(void)
ThreadError otPlatUartDisable(void)
{
ThreadError error = kThreadError_None;
@@ -150,7 +150,7 @@ ThreadError otPlatSerialDisable(void)
return error;
}
ThreadError otPlatSerialSend(const uint8_t *aBuf, uint16_t aBufLength)
ThreadError otPlatUartSend(const uint8_t *aBuf, uint16_t aBufLength)
{
ThreadError error = kThreadError_None;
@@ -163,7 +163,7 @@ exit:
return error;
}
void posixSerialUpdateFdSet(fd_set *aReadFdSet, fd_set *aWriteFdSet, int *aMaxFd)
void posixUartUpdateFdSet(fd_set *aReadFdSet, fd_set *aWriteFdSet, int *aMaxFd)
{
if (aReadFdSet != NULL)
{
@@ -186,7 +186,7 @@ void posixSerialUpdateFdSet(fd_set *aReadFdSet, fd_set *aWriteFdSet, int *aMaxFd
}
}
void posixSerialProcess(void)
void posixUartProcess(void)
{
const int flags = POLLRDNORM | POLLERR | POLLNVAL | POLLHUP;
struct pollfd pollfd = { s_in_fd, flags, 0 };
@@ -196,7 +196,7 @@ void posixSerialProcess(void)
{
rval = read(s_in_fd, s_receive_buffer, sizeof(s_receive_buffer));
assert(rval >= 0);
otPlatSerialReceived(s_receive_buffer, rval);
otPlatUartReceived(s_receive_buffer, rval);
}
if (s_write_length > 0)
@@ -204,6 +204,6 @@ void posixSerialProcess(void)
rval = write(s_out_fd, s_write_buffer, s_write_length);
assert(rval >= 0);
s_write_length = 0;
otPlatSerialSendDone();
otPlatUartSendDone();
}
}
+1 -1
View File
@@ -29,7 +29,7 @@
include $(abs_top_nlbuild_autotools_dir)/automake/pre.am
ot_cli_headers = \
cli-serial.h \
cli-uart.h \
$(NULL)
ot_clidir = $(includedir)/cli
@@ -32,18 +32,18 @@
* This file defines the top-level functions for the OpenThread CLI server.
*/
#ifndef CLI_SERIAL_H_
#define CLI_SERIAL_H_
#ifndef CLI_UART_H_
#define CLI_UART_H_
#ifdef __cplusplus
extern "C" {
#endif
/**
* Initialize the CLI serial server.
* Initialize the CLI UART module.
*
*/
void otCliSerialInit(void);
void otCliUartInit(void);
#ifdef __cplusplus
} // extern "C"
+2 -2
View File
@@ -29,7 +29,7 @@
/**
* @file
* @brief
* This file defines the top-level functions for the OpenThread CLI server.
* This file defines the top-level functions for the OpenThread NCP module.
*/
#ifndef NCP_H_
@@ -40,7 +40,7 @@ extern "C" {
#endif
/**
* Initialize the CLI serial server.
* Initialize the NCP.
*
*/
void otNcpInit(void);
+1 -1
View File
@@ -33,7 +33,7 @@ ot_platform_headers =\
logging.h \
radio.h \
random.h \
serial.h \
uart.h \
spi-slave.h \
toolchain.h \
$(NULL)
@@ -29,11 +29,11 @@
/**
* @file
* @brief
* This file includes the platform abstraction for serial communication.
* This file includes the platform abstraction for UART communication.
*/
#ifndef SERIAL_H_
#define SERIAL_H_
#ifndef UART_H_
#define UART_H_
#include <stdint.h>
@@ -44,57 +44,57 @@ extern "C" {
#endif
/**
* @defgroup serial Serial
* @defgroup uart UART
* @ingroup platform
*
* @brief
* This module includes the platform abstraction for serial communication.
* This module includes the platform abstraction for UART communication.
*
* @{
*
*/
/**
* Enable the serial.
* Enable the UART.
*
* @retval ::kThreadError_None Successfully enabled the serial.
* @retval ::kThreadError_Fail Failed to enabled the serial.
* @retval ::kThreadError_None Successfully enabled the UART.
* @retval ::kThreadError_Failed Failed to enabled the UART.
*/
ThreadError otPlatSerialEnable(void);
ThreadError otPlatUartEnable(void);
/**
* Disable the serial.
* Disable the UART.
*
* @retval ::kThreadError_None Successfully disabled the serial.
* @retval ::kThreadError_Fail Failed to disable the serial.
* @retval ::kThreadError_None Successfully disabled the UART.
* @retval ::kThreadError_Failed Failed to disable the UART.
*/
ThreadError otPlatSerialDisable(void);
ThreadError otPlatUartDisable(void);
/**
* Send bytes over the serial.
* Send bytes over the UART.
*
* @param[in] aBuf A pointer to the data buffer.
* @param[in] aBufLength Number of bytes to transmit.
*
* @retval ::kThreadError_None Successfully started transmission.
* @retval ::kThreadError_Fail Failed to start the transmission.
* @retval ::kThreadError_None Successfully started transmission.
* @retval ::kThreadError_Failed Failed to start the transmission.
*/
ThreadError otPlatSerialSend(const uint8_t *aBuf, uint16_t aBufLength);
ThreadError otPlatUartSend(const uint8_t *aBuf, uint16_t aBufLength);
/**
* The serial driver calls this method to notify OpenThread that the requested bytes have been sent.
* The UART driver calls this method to notify OpenThread that the requested bytes have been sent.
*
*/
extern void otPlatSerialSendDone(void);
extern void otPlatUartSendDone(void);
/**
* The serial driver calls this method to notify OpenThread that bytes have been received.
* The UART driver calls this method to notify OpenThread that bytes have been received.
*
* @param[in] aBuf A pointer to the received bytes.
* @param[in] aBufLength The number of bytes received.
*
*/
extern void otPlatSerialReceived(const uint8_t *aBuf, uint16_t aBufLength);
extern void otPlatUartReceived(const uint8_t *aBuf, uint16_t aBufLength);
/**
* @}
@@ -105,4 +105,4 @@ extern void otPlatSerialReceived(const uint8_t *aBuf, uint16_t aBufLength);
} // extern "C"
#endif
#endif // SERIAL_H_
#endif // UART_H_
+2 -2
View File
@@ -39,13 +39,13 @@ libopenthread_cli_a_CPPFLAGS = \
libopenthread_cli_a_SOURCES = \
cli.cpp \
cli_serial.cpp \
cli_uart.cpp \
cli_udp.cpp \
$(NULL)
noinst_HEADERS = \
cli.hpp \
cli_serial.hpp \
cli_uart.hpp \
cli_server.hpp \
cli_udp.hpp \
$(NULL)
+1 -1
View File
@@ -40,7 +40,7 @@
#include "cli.hpp"
#include <common/encoding.hpp>
#include <platform/serial.h>
#include <platform/uart.h>
using Thread::Encoding::BigEndian::HostSwap16;
using Thread::Encoding::BigEndian::HostSwap32;
+18 -18
View File
@@ -28,7 +28,7 @@
/**
* @file
* This file implements the CLI server on the serial service.
* This file implements the CLI server on the UART service.
*/
#include <stdarg.h>
@@ -37,13 +37,13 @@
#include <string.h>
#include <cli/cli.hpp>
#include <cli/cli-serial.h>
#include <cli/cli_serial.hpp>
#include <cli/cli-uart.h>
#include <cli/cli_uart.hpp>
#include <common/code_utils.hpp>
#include <common/encoding.hpp>
#include <common/new.hpp>
#include <common/tasklet.hpp>
#include <platform/serial.h>
#include <platform/uart.h>
namespace Thread {
namespace Cli {
@@ -51,16 +51,16 @@ namespace Cli {
static const char sCommandPrompt[] = {'>', ' '};
static const char sEraseString[] = {'\b', ' ', '\b'};
static const char CRNL[] = {'\r', '\n'};
static Serial *sServer;
static Uart *sServer;
static otDEFINE_ALIGNED_VAR(sCliSerialRaw, sizeof(Serial), uint64_t);
static otDEFINE_ALIGNED_VAR(sCliUartRaw, sizeof(Uart), uint64_t);
extern "C" void otCliSerialInit(void)
extern "C" void otCliUartInit(void)
{
sServer = new(&sCliSerialRaw) Serial;
sServer = new(&sCliUartRaw) Uart;
}
Serial::Serial(void)
Uart::Uart(void)
{
mRxLength = 0;
mTxHead = 0;
@@ -68,12 +68,12 @@ Serial::Serial(void)
mSendLength = 0;
}
extern "C" void otPlatSerialReceived(const uint8_t *aBuf, uint16_t aBufLength)
extern "C" void otPlatUartReceived(const uint8_t *aBuf, uint16_t aBufLength)
{
sServer->ReceiveTask(aBuf, aBufLength);
}
void Serial::ReceiveTask(const uint8_t *aBuf, uint16_t aBufLength)
void Uart::ReceiveTask(const uint8_t *aBuf, uint16_t aBufLength)
{
const uint8_t *end;
@@ -115,7 +115,7 @@ void Serial::ReceiveTask(const uint8_t *aBuf, uint16_t aBufLength)
}
}
ThreadError Serial::ProcessCommand(void)
ThreadError Uart::ProcessCommand(void)
{
ThreadError error = kThreadError_None;
@@ -136,7 +136,7 @@ ThreadError Serial::ProcessCommand(void)
return error;
}
int Serial::Output(const char *aBuf, uint16_t aBufLength)
int Uart::Output(const char *aBuf, uint16_t aBufLength)
{
uint16_t remaining = kTxBufferSize - mTxLength;
uint16_t tail;
@@ -158,7 +158,7 @@ int Serial::Output(const char *aBuf, uint16_t aBufLength)
return aBufLength;
}
int Serial::OutputFormat(const char *fmt, ...)
int Uart::OutputFormat(const char *fmt, ...)
{
char buf[kMaxLineLength];
va_list ap;
@@ -170,7 +170,7 @@ int Serial::OutputFormat(const char *fmt, ...)
return Output(buf, strlen(buf));
}
void Serial::Send(void)
void Uart::Send(void)
{
VerifyOrExit(mSendLength == 0, ;);
@@ -185,19 +185,19 @@ void Serial::Send(void)
if (mSendLength > 0)
{
otPlatSerialSend(reinterpret_cast<uint8_t *>(mTxBuffer + mTxHead), mSendLength);
otPlatUartSend(reinterpret_cast<uint8_t *>(mTxBuffer + mTxHead), mSendLength);
}
exit:
return;
}
extern "C" void otPlatSerialSendDone(void)
extern "C" void otPlatUartSendDone(void)
{
sServer->SendDoneTask();
}
void Serial::SendDoneTask(void)
void Uart::SendDoneTask(void)
{
mTxHead = (mTxHead + mSendLength) % kTxBufferSize;
mTxLength -= mSendLength;
@@ -28,11 +28,11 @@
/**
* @file
* This file contains definitions for a CLI server on the serial service.
* This file contains definitions for a CLI server on the UART service.
*/
#ifndef CLI_SERIAL_HPP_
#define CLI_SERIAL_HPP_
#ifndef CLI_UART_HPP_
#define CLI_UART_HPP_
#include <openthread-types.h>
#include <cli/cli_server.hpp>
@@ -42,13 +42,13 @@ namespace Thread {
namespace Cli {
/**
* This class implements the CLI server on top of the serial platform abstraction.
* This class implements the CLI server on top of the UART platform abstraction.
*
*/
class Serial: public Server
class Uart: public Server
{
public:
Serial(void);
Uart(void);
/**
* This method delivers raw characters to the client.
@@ -99,4 +99,4 @@ private:
} // namespace Cli
} // namespace Thread
#endif // CLI_SERIAL_HPP_
#endif // CLI_UART_HPP_
+4 -4
View File
@@ -34,7 +34,7 @@
#include <common/new.hpp>
#include <ncp/ncp.h>
#include <ncp/ncp.hpp>
#include <platform/serial.h>
#include <platform/uart.h>
namespace Thread {
@@ -128,7 +128,7 @@ Ncp::OutboundFrameSend(void)
if (errorCode == kThreadError_None)
{
mSendFrameIter += outLength;
errorCode = otPlatSerialSend(mSendFrame, mSendFrameIter - mSendFrame);
errorCode = otPlatUartSend(mSendFrame, mSendFrameIter - mSendFrame);
}
if (errorCode == kThreadError_None)
@@ -139,7 +139,7 @@ Ncp::OutboundFrameSend(void)
return errorCode;
}
extern "C" void otPlatSerialSendDone(void)
extern "C" void otPlatUartSendDone(void)
{
sNcp->SendDoneTask();
}
@@ -151,7 +151,7 @@ void Ncp::SendDoneTask(void)
super_t::HandleSendDone();
}
extern "C" void otPlatSerialReceived(const uint8_t *aBuf, uint16_t aBufLength)
extern "C" void otPlatUartReceived(const uint8_t *aBuf, uint16_t aBufLength)
{
sNcp->ReceiveTask(aBuf, aBufLength);
}
+2 -2
View File
@@ -49,11 +49,11 @@ extern "C" bool otAreTaskletsPending(void)
return false;
}
extern "C" void otPlatSerialSendDone(void)
extern "C" void otPlatUartSendDone(void)
{
}
extern "C" void otPlatSerialReceived(const uint8_t *aBuf, uint16_t aBufLength)
extern "C" void otPlatUartReceived(const uint8_t *aBuf, uint16_t aBufLength)
{
}