예제 #1
0
int
UARTClass::available(void)
{

  sio_probe_rx();
  return (!(sio_rxbuf_head == sio_rxbuf_tail));
}
예제 #2
0
int
UARTClass::peek(void)
{

  sio_probe_rx();
  if (sio_rxbuf_tail == sio_rxbuf_head)
    return (-1);
  else
    return (sio_rxbuf[sio_rxbuf_tail]);
}
예제 #3
0
int
UARTClass::availableForWrite(void)
{
  int in, busy;

  in = sio_probe_rx();
  busy = (in & SIO_TX_BUSY) || (tx_xoff & 1);
  
  return (!busy);
}
예제 #4
0
파일: sio_poll.c 프로젝트: ojura/f32c
__attribute__((optimize("-Os"))) int
sio_putchar(int c, int blocking)
{
	int in, busy;

	do {
		in = sio_probe_rx();
		busy = (in & SIO_TX_BUSY) || sio_tx_xoff;
	} while (blocking && busy);

	if (busy == 0)
		OUTB(IO_SIO_BYTE, c);
	return (busy);
}
예제 #5
0
int
UARTClass::sio_putchar(int c, int blocking)
{
  int in, busy;

  do {
    in = sio_probe_rx();
    busy = (in & SIO_TX_BUSY) || (tx_xoff & 1);
  } while (blocking && busy);

  if (busy == 0)
    serbase[IO_SIO_BYTE-IO_SIO_BYTE] = c;
  return (busy);
}
예제 #6
0
파일: sio_poll.c 프로젝트: ojura/f32c
__attribute__((optimize("-Os"))) int
sio_getchar(int blocking)
{
	int c, busy;

	/* Any new characters received from RS-232? */
	do {
		sio_probe_rx();
		busy = (sio_rxbuf_head == sio_rxbuf_tail);
	} while (blocking && busy);

	if (busy)
		return (-1);
	c = sio_rxbuf[sio_rxbuf_tail++];
	sio_rxbuf_tail &= SIO_RXBUFMASK;
	return (c);
}
예제 #7
0
int
UARTClass::sio_getchar(int blocking)
{
  int c, busy;

  /* Any new characters received from RS-232? */
  do {
    sio_probe_rx();
    busy = (sio_rxbuf_head == sio_rxbuf_tail);
  } while (blocking && busy);

  if (busy)
    return (-1);
  c = sio_rxbuf[sio_rxbuf_tail++];
  sio_rxbuf_tail &= SIO_RXBUFMASK;
  return (c);
}