linux-mips
[Top] [All Lists]

Re: printk problems

To: Justin Carlson <justinca@cs.cmu.edu>
Subject: Re: printk problems
From: Michael Pruznick <michael_pruznick@mvista.com>
Date: Tue, 08 Apr 2003 12:24:45 -0600
Cc: "Avinash S." <avinash.s@inspiretech.com>, linux <linux-mips@linux-mips.org>
Organization: MontaVista
Original-recipient: rfc822;linux-mips@linux-mips.org
References: <200304081211.h38CBgf6024962@smtp.inspirtek.com> <1049816267.17005.25.camel@gs256.sp.cs.cmu.edu>
Reply-to: michael_pruznick@mvista.com
Sender: linux-mips-bounce@linux-mips.org
> Until this point, printk() calls are buffered in memory. 

This is what I like to use to bypass the buffering for
non-standard serial hardware.  

The raw_output() function needs to be specific to
your serial driver.  The one below is just an example
from a board I'm currently working on (that is not in
the linux-mips tree yet).  Basically, raw_output() needs
to put the char in the serial hardware output register
and then wait for the serial hardware to indicate that
it put the char on the wire to prevent over-run.


Changes to kernel/printk.c
#define RAW_OUTPUT
static void emit_log_char(char c)
{
#ifdef RAW_OUTPUT
        void raw_output(char c);
        raw_output(c);
#else
        LOG_BUF(log_end) = c;
        log_end++;
        if (log_end - log_start > LOG_BUF_LEN)
                log_start = log_end - LOG_BUF_LEN;
        if (log_end - con_start > LOG_BUF_LEN)
                con_start = log_end - LOG_BUF_LEN;
        if (logged_chars < LOG_BUF_LEN)
                logged_chars++;
#endif
}


What I added to my serial driver.  You will need to
do the similar for your specific serial hardware.
#ifdef RAW_OUTPUT
void raw_output(char c)
{
        struct rs_port *port = &rs_ports[0];
        if ( c == '\n' )
        {
          sio_out(port, TXX9_SITFIFO, '\r');
          wait_for_xmitr(port);
        }
        sio_out(port, TXX9_SITFIFO, c);
        wait_for_xmitr(port);
        return;
}
#endif


-- 
Michael Pruznick, michael_pruznick@mvista.com, www.mvista.com
MontaVista Software, 1237 East Arques Ave, Sunnyvale, CA 94085

<Prev in Thread] Current Thread [Next in Thread>