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(); }
/* 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(); }
int USART_Peek(void) { return RingBufferPeek(&RingBufferUART4RX); }