Esempio n. 1
0
/* Enable the transmit interrupt.  Called when data is ready to be sent.
   This routine should be ISR safe. */
void uart_hw_enable_tx_int(PUART_INFO uinfo) 
{
  uinfo = uinfo;
  EnableTx();
  LastInterrupt = UART_OUTPUT_INTERRUPT;
  uart_interrupt(0);
}
Esempio n. 2
0
bool UartDevice::SendBuffer(vector<Byte> &&buf)
{
    if (buf.size() == 0)
    {
        return true;
    }

    if(m_tx_buf->PushBlock(TxBuffer::Block(new vector<Byte>(std::move(buf)))))
    {
        EnableTx();
        return true;
    }
    else
    {
        return false;
    }
}
Esempio n. 3
0
bool UartDevice::SendBuffer(unique_ptr<Byte[]> &&buf, const size_t len)
{
    if (len == 0)
    {
        return true;
    }

    if(m_tx_buf->PushBlock(TxBuffer::Block(buf.release(), len)))
    {
        EnableTx();
        return true;
    }
    else
    {
        return false;
    }
}
Esempio n. 4
0
bool UartDevice::SendStr(string &&str)
{
    if (str.size() == 0)
    {
        return true;
    }

    if(m_tx_buf->PushBlock(TxBuffer::Block(new string(std::move(str)))))
    {
        EnableTx();
        return true;
    }
    else
    {
        return false;
    }
}
Esempio n. 5
0
bool UartDevice::SendStrLiteral(const char *str)
{
    const size_t size = strlen(str);
    if (size == 0)
    {
        return true;
    }

    if (m_tx_buf->PushBlock(TxBuffer::Block((Byte*)str, size, false)))
    {
        EnableTx();
        return true;
    }
    else
    {
        return false;
    }
}
Esempio n. 6
0
bool UartDevice::SendBuffer(const Byte *buf, const size_t len)
{
    if (len == 0)
    {
        return true;
    }
    Byte *data = new Byte[len];
    memcpy(data, buf, len);

    if(m_tx_buf->PushBlock(TxBuffer::Block(data, len)))
    {
        EnableTx();
        return true;
    }
    else
    {
        return false;
    }
}
Esempio n. 7
0
bool UartDevice::SendStr(unique_ptr<char[]> &&str)
{
    const size_t size = strlen(str.get());
    if (size == 0)
    {
        return true;
    }

    if(m_tx_buf->PushBlock(TxBuffer::Block(reinterpret_cast<Byte*>(str.release()),
                                           size)))
    {
        EnableTx();
        return true;
    }
    else
    {
        return false;
    }
}
Esempio n. 8
0
bool UartDevice::SendStr(const char *str)
{
    const size_t size = strlen(str);
    if (size == 0)
    {
        return true;
    }
    Byte *data = new Byte[size];
    memcpy(data, str, size);

    if(m_tx_buf->PushBlock(TxBuffer::Block(data, size)))
    {
        EnableTx();
        return true;
    }
    else
    {
        return false;
    }
}