Require radio driver to provide transmit and receive buffers. (#87)

Some radio chips have memory-mapped regions for transmit and receive buffers.
This change allows the radio driver to pass those buffers, when available,
directly to upper layers and avoid unnecessary copies.
This commit is contained in:
Jonathan Hui
2016-05-27 14:17:48 -07:00
parent cc2e961f4b
commit e2a85d62e3
6 changed files with 145 additions and 130 deletions
+2 -2
View File
@@ -135,7 +135,7 @@ ThreadError Serial::ProcessCommand(void)
int Serial::Output(const char *aBuf, uint16_t aBufLength)
{
uint16_t remaining = kTxBufferSize - mTxLength;
uint16_t tail = (mTxHead + mTxLength) % kTxBufferSize;
uint16_t tail;
if (aBufLength > remaining)
{
@@ -170,7 +170,7 @@ void Serial::Send(void)
{
VerifyOrExit(mSendLength == 0, ;);
if (mTxHead + mTxLength > kTxBufferSize)
if (mTxLength > kTxBufferSize - mTxHead)
{
mSendLength = kTxBufferSize - mTxHead;
}