示例#1
0
/* kernel writes to system console -- never sleep! */
void kputchar(char c)
{
	while(tty_writeready(TTYDEV - 512) != TTY_READY_NOW);
	if (c == '\n')
		tty_putc(TTYDEV - 512, '\r');
	while(tty_writeready(TTYDEV - 512) != TTY_READY_NOW);
	tty_putc(TTYDEV - 512, c);
}
示例#2
0
文件: tty.c 项目: 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);
}
示例#3
0
文件: tty.c 项目: 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);
}