bool_t usart0_tx_finished(void) { if(!ring_buffer_empty(&usart0_tx_ring_buffer)) { return FALSE; } return usart0_tx_finished_flag; }
SEXP R_ring_buffer_tail(SEXP extPtr) { ring_buffer * buffer = ring_buffer_get(extPtr, 1); if (ring_buffer_empty(buffer)) { Rf_error("Buffer is empty"); } SEXP ret = PROTECT(allocVector(RAWSXP, buffer->stride)); memcpy(RAW(ret), ring_buffer_tail(buffer), buffer->stride); UNPROTECT(1); return ret; }
/* * IRQ handler for the uart */ static void uart_irq_handle(unsigned int irq) { unsigned int uart_index = (irq - IRQ_S3CUART_BASE0)/4; unsigned int regs; if (uart_index > 3) printk(PR_SS_IRQ, PR_LVL_DBG2, "%s, invalid uart irq: irq = %x, uart_index = %x\n", __func__, irq, uart_index); regs = uart_irqs[uart_index].regs; if (UART_IRQ_RXD == (irq & 0x0f)) { /* data received */ int n, error; char ch; while(1) { n = __raw_readl(regs + S3C64XX_UFSTAT); printk(PR_SS_IRQ, PR_LVL_DBG2, "%s, %x char(s) in FIFO\n", __func__, n); if (0 == n) break; error = __raw_readl(regs + S3C64XX_UERSTAT); printk(PR_SS_IRQ, PR_LVL_DBG2, "%s, there %s error in FIFO\n", __func__, error?"is":"isn't"); ch = __raw_readl(regs + S3C64XX_URXH); printk(PR_SS_IRQ, PR_LVL_DBG2, "%s, '%c' read from FIFO\n", __func__, ch); uart_input_char(ch); } } else if (UART_IRQ_TXD == (irq & 0x0f)) { /* data to transmit */ if (ring_buffer_enabled) while(!ring_buffer_empty(user_ring_buffer)) { if (__raw_readl(regs + S3C64XX_UFSTAT)) /* if there is error */ break; else __raw_writel(regs + S3C64XX_UTXH, ring_buffer_get_char(user_ring_buffer)); } } }
SEXP R_ring_buffer_empty(SEXP extPtr) { return ScalarLogical(ring_buffer_empty(ring_buffer_get(extPtr, 1))); }
bool_t usart0_tx_buffer_empty(void) { return ring_buffer_empty(&usart0_tx_ring_buffer); }
bool uart_drv_t::is_empty() { return ring_buffer_empty(&ring_buf); }