void nios_console_write (struct console *co, const char *str, unsigned int count) { while (count--) { if (*str == '\n') rs_put_char('\r', nios_soft); rs_put_char( *str++, nios_soft); } }
void m68328_console_write (struct console *co, const char *str, unsigned int count) { if (!m68328_console_initted) m68328_set_baud(); while (count--) { if (*str == '\n') rs_put_char('\r'); rs_put_char( *str++ ); } }
/* * m68k_console_print is registered for printk. */ void console_print_68328(const char *p) { char c; while((c=*(p++)) != 0) { if(c == '\n') rs_put_char('\r'); rs_put_char(c); } /* Comment this if you want to have a strict interrupt-driven output */ rs_fair_output(); return; }
/* * console_print_NIOS is registered for printk. */ void console_print_NIOS(const char *p) { char c; while((c=*(p++)) != 0) { if(c == '\n') rs_put_char('\r', nios_soft); rs_put_char(c, nios_soft); } /* Comment this if you want to have a strict interrupt-driven output */ /* rs_fair_output(); */ return; }
/* * Fair output driver allows a process to speak. */ static void rs_fair_output(void) { int left; /* Output no more than that */ unsigned long flags; struct m68k_serial *info = &m68k_soft[0]; char c; if (info == 0) return; if (info->xmit_buf == 0) return; local_irq_save(flags); left = info->xmit_cnt; while (left != 0) { c = info->xmit_buf[info->xmit_tail]; info->xmit_tail = (info->xmit_tail+1) & (SERIAL_XMIT_SIZE-1); info->xmit_cnt--; local_irq_restore(flags); rs_put_char(c); local_irq_save(flags); left = min(info->xmit_cnt, left-1); } /* Last character is being transmitted now (hopefully). */ udelay(5); local_irq_restore(flags); return; }
static void rs_fair_output(void) { int left; /* Output no more than that */ unsigned long flags; struct NIOS_serial *info = &nios_soft; char c; if (info == 0) return; if (info->xmit_buf == 0) return; save_flags(flags); cli(); left = info->xmit_cnt; while (left != 0) { c = info->xmit_buf[info->xmit_tail]; info->xmit_tail = (info->xmit_tail+1) & (SERIAL_XMIT_SIZE-1); info->xmit_cnt--; restore_flags(flags); rs_put_char(c, info); save_flags(flags); cli(); left = MIN(info->xmit_cnt, left-1); } /* Last character is being transmitted now (hopefully). */ udelay(5); restore_flags(flags); return; }