read this:<div><br></div><div><a href="http://elinux.org/Disable_Console" target="_blank">http://elinux.org/Disable_Console</a> </div><div><br></div><div>and this:</div><div><br></div><div><a href="http://elinux.org/Kernel_Debugging_Tips#Controlling_console_output" target="_blank">http://elinux.org/Kernel_Debugging_Tips#Controlling_console_output</a> </div>
<div><br></div><div>Perhaps u can extract relevant APIs from below URLs to solve your problem:</div><div><br></div><div>a. at the hardware level, serial communication can come from UART interface, or infrared interface, or USB.</div>
<div><br></div><div>b. next, is the 8250.c handler: </div><div><meta http-equiv="content-type" content="text/html; charset=utf-8"><a href="http://lxr.free-electrons.com/source/drivers/tty/serial/serial_core.c">http://lxr.free-electrons.com/source/drivers/tty/serial/</a>8250_*.c (star represent the different hardware devices handling the serial signals).</div>
<div><br></div><div>c. next all these information will feed into serial_core.c (USB is not included here):</div><div><br></div><div><meta http-equiv="content-type" content="text/html; charset=utf-8"><a href="http://lxr.free-electrons.com/source/drivers/tty/serial/serial_core.c">http://lxr.free-electrons.com/source/drivers/tty/serial/serial_core.c</a></div>
<div><br></div><div>
And here u can see how u can disable the signal from software standpoint, eg, </div><div><br></div><div>In particular:</div><div><span class="Apple-style-span" style="color:rgb(120,120,120);font-family:'Lucida Grande',Verdana,Arial,sans-serif;font-size:15px;font-weight:bold"><pre style="font-family:Monaco,'Courier New',Courier,monospace;font-size:0.95em;padding-top:1em;padding-right:1em;padding-bottom:1em;padding-left:1em;color:rgb(120,120,120);background-color:white;overflow-x:auto;overflow-y:auto">
<a name="L78" href="http://lxr.free-electrons.com/source/drivers/tty/serial/serial_core.c#L78" style="text-decoration:none;border-bottom-width:1px;border-bottom-style:dotted;border-bottom-color:rgb(153,153,153);color:black;background-color:white">78</a> static void <a href="http://lxr.free-electrons.com/ident?i=uart_stop" style="text-decoration:none;border-bottom-width:1px;border-bottom-style:dotted;border-bottom-color:rgb(153,153,153);color:black;background-color:white">uart_stop</a>(struct <a href="http://lxr.free-electrons.com/ident?i=tty_struct" style="text-decoration:none;border-bottom-width:1px;border-bottom-style:dotted;border-bottom-color:rgb(153,153,153);color:black;background-color:white">tty_struct</a> *<a href="http://lxr.free-electrons.com/ident?i=tty" style="text-decoration:none;border-bottom-width:1px;border-bottom-style:dotted;border-bottom-color:rgb(153,153,153);color:black;background-color:white">tty</a>)
<a name="L79" href="http://lxr.free-electrons.com/source/drivers/tty/serial/serial_core.c#L79" style="text-decoration:none;border-bottom-width:1px;border-bottom-style:dotted;border-bottom-color:rgb(153,153,153);color:black;background-color:white">79</a> {
<a name="L80" href="http://lxr.free-electrons.com/source/drivers/tty/serial/serial_core.c#L80" style="text-decoration:none;border-bottom-width:1px;border-bottom-style:dotted;border-bottom-color:rgb(153,153,153);color:black;background-color:white">80</a> struct <a href="http://lxr.free-electrons.com/ident?i=uart_state" style="text-decoration:none;border-bottom-width:1px;border-bottom-style:dotted;border-bottom-color:rgb(153,153,153);color:black;background-color:white">uart_state</a> *<a href="http://lxr.free-electrons.com/ident?i=state" style="text-decoration:none;border-bottom-width:1px;border-bottom-style:dotted;border-bottom-color:rgb(153,153,153);color:black;background-color:white">state</a> = <a href="http://lxr.free-electrons.com/ident?i=tty" style="text-decoration:none;border-bottom-width:1px;border-bottom-style:dotted;border-bottom-color:rgb(153,153,153);color:black;background-color:white">tty</a>-><a href="http://lxr.free-electrons.com/ident?i=driver_data" style="text-decoration:none;border-bottom-width:1px;border-bottom-style:dotted;border-bottom-color:rgb(153,153,153);color:black;background-color:white">driver_data</a>;
<a name="L81" href="http://lxr.free-electrons.com/source/drivers/tty/serial/serial_core.c#L81" style="text-decoration:none;border-bottom-width:1px;border-bottom-style:dotted;border-bottom-color:rgb(153,153,153);color:black;background-color:white">81</a> struct <a href="http://lxr.free-electrons.com/ident?i=uart_port" style="text-decoration:none;border-bottom-width:1px;border-bottom-style:dotted;border-bottom-color:rgb(153,153,153);color:black;background-color:white">uart_port</a> *<a href="http://lxr.free-electrons.com/ident?i=port" style="text-decoration:none;border-bottom-width:1px;border-bottom-style:dotted;border-bottom-color:rgb(153,153,153);color:black;background-color:white">port</a> = <a href="http://lxr.free-electrons.com/ident?i=state" style="text-decoration:none;border-bottom-width:1px;border-bottom-style:dotted;border-bottom-color:rgb(153,153,153);color:black;background-color:white">state</a>-><a href="http://lxr.free-electrons.com/ident?i=uart_port" style="text-decoration:none;border-bottom-width:1px;border-bottom-style:dotted;border-bottom-color:rgb(153,153,153);color:black;background-color:white">uart_port</a>;
<a name="L82" href="http://lxr.free-electrons.com/source/drivers/tty/serial/serial_core.c#L82" style="text-decoration:none;border-bottom-width:1px;border-bottom-style:dotted;border-bottom-color:rgb(153,153,153);color:black;background-color:white">82</a> unsigned long <a href="http://lxr.free-electrons.com/ident?i=flags" style="text-decoration:none;border-bottom-width:1px;border-bottom-style:dotted;border-bottom-color:rgb(153,153,153);color:black;background-color:white">flags</a>;
<a name="L83" href="http://lxr.free-electrons.com/source/drivers/tty/serial/serial_core.c#L83" style="text-decoration:none;border-bottom-width:1px;border-bottom-style:dotted;border-bottom-color:rgb(153,153,153);color:black;background-color:white">83</a>
<a name="L84" href="http://lxr.free-electrons.com/source/drivers/tty/serial/serial_core.c#L84" style="text-decoration:none;border-bottom-width:1px;border-bottom-style:dotted;border-bottom-color:rgb(153,153,153);color:black;background-color:white">84</a> <a href="http://lxr.free-electrons.com/ident?i=spin_lock_irqsave" style="text-decoration:none;border-bottom-width:1px;border-bottom-style:dotted;border-bottom-color:rgb(153,153,153);color:black;background-color:white">spin_lock_irqsave</a>(&<a href="http://lxr.free-electrons.com/ident?i=port" style="text-decoration:none;border-bottom-width:1px;border-bottom-style:dotted;border-bottom-color:rgb(153,153,153);color:black;background-color:white">port</a>-><a href="http://lxr.free-electrons.com/ident?i=lock" style="text-decoration:none;border-bottom-width:1px;border-bottom-style:dotted;border-bottom-color:rgb(153,153,153);color:black;background-color:white">lock</a>, <a href="http://lxr.free-electrons.com/ident?i=flags" style="text-decoration:none;border-bottom-width:1px;border-bottom-style:dotted;border-bottom-color:rgb(153,153,153);color:black;background-color:white">flags</a>);
<a name="L85" href="http://lxr.free-electrons.com/source/drivers/tty/serial/serial_core.c#L85" style="text-decoration:none;border-bottom-width:1px;border-bottom-style:dotted;border-bottom-color:rgb(153,153,153);color:black;background-color:white">85</a> <a href="http://lxr.free-electrons.com/ident?i=port" style="text-decoration:none;border-bottom-width:1px;border-bottom-style:dotted;border-bottom-color:rgb(153,153,153);color:black;background-color:white">port</a>-><a href="http://lxr.free-electrons.com/ident?i=ops" style="text-decoration:none;border-bottom-width:1px;border-bottom-style:dotted;border-bottom-color:rgb(153,153,153);color:black;background-color:white">ops</a>->stop_tx(<a href="http://lxr.free-electrons.com/ident?i=port" style="text-decoration:none;border-bottom-width:1px;border-bottom-style:dotted;border-bottom-color:rgb(153,153,153);color:black;background-color:white">port</a>);
<a name="L86" href="http://lxr.free-electrons.com/source/drivers/tty/serial/serial_core.c#L86" style="text-decoration:none;border-bottom-width:1px;border-bottom-style:dotted;border-bottom-color:rgb(153,153,153);color:black;background-color:white">86</a> <a href="http://lxr.free-electrons.com/ident?i=spin_unlock_irqrestore" style="text-decoration:none;border-bottom-width:1px;border-bottom-style:dotted;border-bottom-color:rgb(153,153,153);color:black;background-color:white">spin_unlock_irqrestore</a>(&<a href="http://lxr.free-electrons.com/ident?i=port" style="text-decoration:none;border-bottom-width:1px;border-bottom-style:dotted;border-bottom-color:rgb(153,153,153);color:black;background-color:white">port</a>-><a href="http://lxr.free-electrons.com/ident?i=lock" style="text-decoration:none;border-bottom-width:1px;border-bottom-style:dotted;border-bottom-color:rgb(153,153,153);color:black;background-color:white">lock</a>, <a href="http://lxr.free-electrons.com/ident?i=flags" style="text-decoration:none;border-bottom-width:1px;border-bottom-style:dotted;border-bottom-color:rgb(153,153,153);color:black;background-color:white">flags</a>);
<a name="L87" href="http://lxr.free-electrons.com/source/drivers/tty/serial/serial_core.c#L87" style="text-decoration:none;border-bottom-width:1px;border-bottom-style:dotted;border-bottom-color:rgb(153,153,153);color:black;background-color:white">87</a> }
<a name="L88" href="http://lxr.free-electrons.com/source/drivers/tty/serial/serial_core.c#L88" style="text-decoration:none;border-bottom-width:1px;border-bottom-style:dotted;border-bottom-color:rgb(153,153,153);color:black;background-color:white">88</a></pre>
</span>From above, u can see stop_tx() can be called, looking further into 8250.c:<pre style="padding-top:1em;padding-right:1em;padding-bottom:1em;padding-left:1em;background-color:white;overflow-x:auto;overflow-y:auto"><meta http-equiv="content-type" content="text/html; charset=utf-8"><div>
<div><font class="Apple-style-span" face="arial"><span class="Apple-style-span" style="white-space:normal">static void serial8250_stop_tx(struct uart_port *port)</span></font></div><div><font class="Apple-style-span" face="arial"><span class="Apple-style-span" style="white-space:normal">{</span></font></div>
<div><font class="Apple-style-span" face="arial"><span class="Apple-style-span" style="white-space:normal"> struct uart_8250_port *up =</span></font></div><div><font class="Apple-style-span" face="arial"><span class="Apple-style-span" style="white-space:normal"> container_of(port, struct uart_8250_port, port);</span></font></div>
<div><font class="Apple-style-span" face="arial"><span class="Apple-style-span" style="white-space:normal"><br></span></font></div><div><font class="Apple-style-span" face="arial"><span class="Apple-style-span" style="white-space:normal"> __stop_tx(up);</span></font></div>
<div><font class="Apple-style-span" face="arial"><span class="Apple-style-span" style="white-space:normal"><br></span></font></div><div><font class="Apple-style-span" face="arial"><span class="Apple-style-span" style="white-space:normal"> /*</span></font></div>
<div><font class="Apple-style-span" face="arial"><span class="Apple-style-span" style="white-space:normal"> * We really want to stop the transmitter from sending.</span></font></div><div><font class="Apple-style-span" face="arial"><span class="Apple-style-span" style="white-space:normal"> */</span></font></div>
<div><font class="Apple-style-span" face="arial"><span class="Apple-style-span" style="white-space:normal"> if (up->port.type == PORT_16C950) {</span></font></div><div><font class="Apple-style-span" face="arial"><span class="Apple-style-span" style="white-space:normal"> up->acr |= UART_ACR_TXDIS;</span></font></div>
<div><font class="Apple-style-span" face="arial"><span class="Apple-style-span" style="white-space:normal"> serial_icr_write(up, UART_ACR, up->acr);</span></font></div><div><font class="Apple-style-span" face="arial"><span class="Apple-style-span" style="white-space:normal"> }</span></font></div>
<div><font class="Apple-style-span" face="arial"><span class="Apple-style-span" style="white-space:normal">}</span></font></div></div><div style="color:rgb(0,0,0);font-family:arial;font-weight:normal;white-space:normal;font-size:small">
<br></div><div style="color:rgb(0,0,0);font-family:arial;font-weight:normal;white-space:normal;font-size:small">And referring further to definition:</div><div style="color:rgb(0,0,0);font-family:arial;font-weight:normal;white-space:normal;font-size:small">
<br></div><div style="color:rgb(0,0,0);font-family:arial;font-weight:normal;white-space:normal;font-size:small">/*</div><div><div><font class="Apple-style-span" face="arial"><span class="Apple-style-span" style="white-space:normal"> * The 16C950 Additional Control Register</span></font></div>
<div><font class="Apple-style-span" face="arial"><span class="Apple-style-span" style="white-space:normal"> */</span></font></div><div><font class="Apple-style-span" face="arial"><span class="Apple-style-span" style="white-space:normal">#define UART_ACR_RXDIS 0x01 /* Receiver disable */</span></font></div>
<div><font class="Apple-style-span" face="arial"><span class="Apple-style-span" style="white-space:normal">#define UART_ACR_TXDIS 0x02 /* Transmitter disable */</span></font></div><div style="color:rgb(0,0,0);font-family:arial;font-weight:normal;white-space:normal;font-size:small">
<br></div></div><div style="color:rgb(0,0,0);font-family:arial;font-weight:normal;white-space:normal;font-size:small"><meta http-equiv="content-type" content="text/html; charset=utf-8"><pre style="padding-top:1em;padding-right:1em;padding-bottom:1em;padding-left:1em;background-color:white;overflow-x:auto;overflow-y:auto">
<div style="color:rgb(0,0,0);font-family:arial;font-weight:normal;white-space:normal;font-size:small">So perhaps writing UART_ACR_XXX_DIS will disable the input/output:</div><div style="color:rgb(0,0,0);font-family:arial;font-weight:normal;white-space:normal;font-size:small">
<span class="Apple-style-span" style="white-space:pre"><span class="Apple-style-span" style="white-space:normal"><br></span></span></div><div style="color:rgb(0,0,0);font-family:arial;font-weight:normal;white-space:normal;font-size:small">
<span class="Apple-style-span" style="white-space:pre"><span class="Apple-style-span" style="white-space:normal">drivers/tty/serial/8250.c:</span><span class="Apple-style-span" style="white-space:normal"><span class="Apple-tab-span" style="white-space:pre">                </span></span><span class="Apple-style-span" style="white-space:normal">up->acr |= UART_ACR_TXDIS;</span></span></div>
</pre></div><div><div><span class="Apple-style-span" style="font-family:arial;white-space:normal">drivers/tty/serial/8250.c:<span class="Apple-tab-span" style="white-space:pre">                </span>up->acr &= ~UART_ACR_TXDIS;</span></div>
<div style="color:rgb(0,0,0);font-family:arial;font-weight:normal;white-space:normal;font-size:small"><br></div></div><div style="color:rgb(0,0,0);font-family:arial;font-weight:normal;white-space:normal;font-size:small">Experiment first....I am just guessing....</div>
<div style="color:rgb(0,0,0);font-family:arial;font-weight:normal;white-space:normal;font-size:small"><br></div></pre><pre style="font-weight:bold;font-family:Monaco,'Courier New',Courier,monospace;font-size:0.95em;padding-top:1em;padding-right:1em;padding-bottom:1em;padding-left:1em;color:rgb(120,120,120);background-color:white;overflow-x:auto;overflow-y:auto">
<br></pre><div class="gmail_quote">On Wed, Jan 4, 2012 at 8:43 AM, hz hanks <span dir="ltr"><<a href="mailto:hankshz@gmail.com" target="_blank">hankshz@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi, all~<br>
I'm studying in an embedded Linux board with only one uart, which is<br>
set default as the console display. Now as I try to develop uart<br>
driver, I want to shutdown this console redirection temporarily. But I<br>
don't know how? I search the Internet, but there's only the tutorial<br>
for setting this redirection rather than shutdown it. Is there anyone<br>
can help? Thank you very much.<br>
<br>
_______________________________________________<br>
Kernelnewbies mailing list<br>
<a href="mailto:Kernelnewbies@kernelnewbies.org" target="_blank">Kernelnewbies@kernelnewbies.org</a><br>
<a href="http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies" target="_blank">http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies</a><br>
</blockquote></div><br><br clear="all"><div><br></div>-- <br>Regards,<br>Peter Teoh<br>
</div>