check out slide 5 here:<div><br></div><div><meta http-equiv="content-type" content="text/html; charset=utf-8"><a href="http://www.slideshare.net/anil_pugalia/embedded-device-busdrivers">http://www.slideshare.net/anil_pugalia/embedded-device-busdrivers</a><br>
<br><div class="gmail_quote">On Wed, Jan 25, 2012 at 9:36 AM, Peter Teoh <span dir="ltr">&lt;<a href="mailto:htmldeveloper@gmail.com">htmldeveloper@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
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><a href="http://lxr.free-electrons.com/source/drivers/tty/serial/serial_core.c" target="_blank">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><a href="http://lxr.free-electrons.com/source/drivers/tty/serial/serial_core.c" target="_blank">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 style="color:rgb(120,120,120);font-family:&#39;Lucida Grande&#39;,Verdana,Arial,sans-serif;font-size:15px;font-weight:bold"><pre style="font-family:Monaco,&#39;Courier New&#39;,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">
 <a name="13512821bb04b5f9_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" target="_blank">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" target="_blank">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" target="_blank">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" target="_blank">tty</a>)
 <a name="13512821bb04b5f9_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" target="_blank">79</a> {
 <a name="13512821bb04b5f9_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" target="_blank">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" target="_blank">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" target="_blank">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" target="_blank">tty</a>-&gt;<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" target="_blank">driver_data</a>;
 <a name="13512821bb04b5f9_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" target="_blank">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" target="_blank">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" target="_blank">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" target="_blank">state</a>-&gt;<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" target="_blank">uart_port</a>;
 <a name="13512821bb04b5f9_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" target="_blank">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" target="_blank">flags</a>;
 <a name="13512821bb04b5f9_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" target="_blank">83</a> 
 <a name="13512821bb04b5f9_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" target="_blank">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" target="_blank">spin_lock_irqsave</a>(&amp;<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" target="_blank">port</a>-&gt;<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" target="_blank">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" target="_blank">flags</a>);
 <a name="13512821bb04b5f9_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" target="_blank">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" target="_blank">port</a>-&gt;<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" target="_blank">ops</a>-&gt;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" target="_blank">port</a>);
 <a name="13512821bb04b5f9_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" target="_blank">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" target="_blank">spin_unlock_irqrestore</a>(&amp;<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" target="_blank">port</a>-&gt;<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" target="_blank">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" target="_blank">flags</a>);
 <a name="13512821bb04b5f9_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" target="_blank">87</a> }
 <a name="13512821bb04b5f9_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" target="_blank">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"><div>
<div><font face="arial"><span style="white-space:normal">static void serial8250_stop_tx(struct uart_port *port)</span></font></div><div><font face="arial"><span style="white-space:normal">{</span></font></div>
<div><font face="arial"><span style="white-space:normal">        struct uart_8250_port *up =</span></font></div><div><font face="arial"><span style="white-space:normal">                container_of(port, struct uart_8250_port, port);</span></font></div>

<div><font face="arial"><span style="white-space:normal"><br></span></font></div><div><font face="arial"><span style="white-space:normal">        __stop_tx(up);</span></font></div>
<div><font face="arial"><span style="white-space:normal"><br></span></font></div><div><font face="arial"><span style="white-space:normal">        /*</span></font></div>
<div><font face="arial"><span style="white-space:normal">         * We really want to stop the transmitter from sending.</span></font></div><div><font face="arial"><span style="white-space:normal">         */</span></font></div>

<div><font face="arial"><span style="white-space:normal">        if (up-&gt;port.type == PORT_16C950) {</span></font></div><div><font face="arial"><span style="white-space:normal">                up-&gt;acr |= UART_ACR_TXDIS;</span></font></div>

<div><font face="arial"><span style="white-space:normal">                serial_icr_write(up, UART_ACR, up-&gt;acr);</span></font></div><div><font face="arial"><span style="white-space:normal">        }</span></font></div>

<div><font face="arial"><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 face="arial"><span style="white-space:normal"> * The 16C950 Additional Control Register</span></font></div>

<div><font face="arial"><span style="white-space:normal"> */</span></font></div><div><font face="arial"><span style="white-space:normal">#define UART_ACR_RXDIS  0x01    /* Receiver disable */</span></font></div>
<div><font face="arial"><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"><pre style="padding-top:1em;padding-right:1em;padding-bottom:1em;padding-left:1em;background-color:white">
<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 style="white-space:pre-wrap"><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 style="white-space:pre-wrap"><span style="white-space:normal">drivers/tty/serial/8250.c:</span><span style="white-space:normal"><span style="white-space:pre-wrap">                </span></span><span style="white-space:normal">up-&gt;acr |= UART_ACR_TXDIS;</span></span></div>

</pre></div><div><div><span style="font-family:arial;white-space:normal">drivers/tty/serial/8250.c:<span style="white-space:pre-wrap">                </span>up-&gt;acr &amp;= ~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><div><div></div><div class="h5"><pre style="font-weight:bold;font-family:Monaco,&#39;Courier New&#39;,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">
<br></pre><div class="gmail_quote">On Wed, Jan 4, 2012 at 8:43 AM, hz hanks <span dir="ltr">&lt;<a href="mailto:hankshz@gmail.com" target="_blank">hankshz@gmail.com</a>&gt;</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&#39;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&#39;t know how? I search the Internet, but there&#39;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></div></div><font color="#888888">-- <br>Regards,<br>Peter Teoh<br>
</font></div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br>Regards,<br>Peter Teoh<br>
</div>