Exemplo n.º 1
0
Arquivo: tty.c Projeto: aralbrec/FUZIX
void tty_putc_wait(uint8_t minor, unsigned char c)
{
        uint8_t t;
#ifdef CONFIG_DEV_PTY
	if (minor >= PTY_OFFSET)
		ptty_putc_wait(minor, c);
	else
#endif
        /* For slower platforms it's not worth the task switching and return
           costs versus waiting a bit. A box with tx interrupts and sufficient
           performance can buffer or sleep in tty_putc instead.

           The driver should return a value from the ttyready_t enum:
            1 (TTY_READY_NOW) -- send bytes now
            0 (TTY_READY_SOON) -- spinning may be useful
           -1 (TTY_READY_LATER) -- blocked, don't spin (eg flow controlled) */
	if (!udata.u_ininterrupt) {
		while ((t = tty_writeready(minor)) != TTY_READY_NOW)
			if (t != TTY_READY_SOON || need_resched()){
				irqflags_t irq = di();
				tty_sleeping(minor);
				psleep(&ttydata[minor]);
				irqrestore(irq);
			}
	}
	tty_putc(minor, c);
}
Exemplo n.º 2
0
Arquivo: tty.c Projeto: jfernand/FUZIX
void tty_putc_wait(uint8_t minor, unsigned char c)
{
#ifdef CONFIG_DEV_PTY
	if (minor >= PTY_OFFSET)
		ptty_putc_wait(minor, c);
	else
#endif
	if (!udata.u_ininterrupt) {
		while (!tty_writeready(minor))
			psleep(&ttydata[minor]);
	}
	tty_putc(minor, c);
}