Exemplo n.º 1
0
/**********************************************************************************************************
* Description: 	This function is used to continue transfer data.
*
* Arguments  : 	port			is the uart port
*
* Returns    :
**********************************************************************************************************/
static void tls_uart_tx_chars(struct tls_uart_port *port)
{
    struct tls_uart_circ_buf *xmit = &port->xmit;
    int tx_count = 64;
    int len;

    if (uart_circ_empty(xmit)) {
        // tls_uart_tx_disable(port);

        if(port->tx_sem)
            tls_os_sem_release(port->tx_sem);

        return;
    }

    while (!uart_circ_empty(xmit) && tx_count-- > 0) {
        /* 检查tx fifo是否已满 */
        if ((port->regs->UR_FIFOS & UFS_TX_FIFO_CNT_MASK) ==
                port->tx_fifofull)
            break;

        port->regs->UR_TXW = xmit->buf[xmit->tail];
        xmit->tail = (xmit->tail + 1) & (TLS_UART_TX_BUF_SIZE - 1);
        port->icount.tx++;
    }

    len = uart_circ_chars_pending(xmit);
    if (len < WAKEUP_CHARS) {
        if(port->tx_callback)
            port->tx_callback(port);
    }

#if 0
    if (uart_circ_empty(xmit))
        tls_uart_tx_disable(port);
#endif
}
Exemplo n.º 2
0
void _mutex_release (u32 *mutex) {
    /* Release a system mutex, unlock stdlib resources. */
    tls_os_sem_release(libc_sem);
}