示例#1
0
void CommunicationCheckWrite(CommunicationState *com) {
    char ch;
    while(RingBufferPeek(&com->uart_out_ringbuffer, &ch)) {
        if(CommunicationTrySendChar(ch))
            RingBufferPop(&com->uart_out_ringbuffer, 0);
    }

    if(RingBufferSize(&com->uart_out_ringbuffer) > 0)
        CommunicationIntDisableWrite();
}
示例#2
0
/* Call interrupt if read flag is set and there is data in buffer */
void checkedCallReadInterrupt(UartMockDriverState *ms) {
    if(ms->int_flags & UART_INT_RHR_CTI &&
            RingBufferPeek(&ms->comm_state.uart_in_ringbuffer, 0))
        ms->int_handler();
}
示例#3
0
int USART_Peek(void)
{
    return RingBufferPeek(&RingBufferUART4RX);
}