How to shutdown console redirection
Peter Teoh
htmldeveloper at gmail.com
Tue Jan 24 21:08:28 EST 2012
check out slide 5 here:
http://www.slideshare.net/anil_pugalia/embedded-device-busdrivers
On Wed, Jan 25, 2012 at 9:36 AM, Peter Teoh <htmldeveloper at gmail.com> wrote:
> read this:
>
> http://elinux.org/Disable_Console
>
> and this:
>
> http://elinux.org/Kernel_Debugging_Tips#Controlling_console_output
>
> Perhaps u can extract relevant APIs from below URLs to solve your problem:
>
> a. at the hardware level, serial communication can come from UART
> interface, or infrared interface, or USB.
>
> b. next, is the 8250.c handler:
> http://lxr.free-electrons.com/source/drivers/tty/serial/<http://lxr.free-electrons.com/source/drivers/tty/serial/serial_core.c>8250_*.c
> (star represent the different hardware devices handling the serial signals).
>
> c. next all these information will feed into serial_core.c (USB is not
> included here):
>
> http://lxr.free-electrons.com/source/drivers/tty/serial/serial_core.c
>
> And here u can see how u can disable the signal from software standpoint,
> eg,
>
> In particular:
>
> 78 <http://lxr.free-electrons.com/source/drivers/tty/serial/serial_core.c#L78> static void uart_stop <http://lxr.free-electrons.com/ident?i=uart_stop>(struct tty_struct <http://lxr.free-electrons.com/ident?i=tty_struct> *tty <http://lxr.free-electrons.com/ident?i=tty>)
> 79 <http://lxr.free-electrons.com/source/drivers/tty/serial/serial_core.c#L79> {
> 80 <http://lxr.free-electrons.com/source/drivers/tty/serial/serial_core.c#L80> struct uart_state <http://lxr.free-electrons.com/ident?i=uart_state> *state <http://lxr.free-electrons.com/ident?i=state> = tty <http://lxr.free-electrons.com/ident?i=tty>->driver_data <http://lxr.free-electrons.com/ident?i=driver_data>;
> 81 <http://lxr.free-electrons.com/source/drivers/tty/serial/serial_core.c#L81> struct uart_port <http://lxr.free-electrons.com/ident?i=uart_port> *port <http://lxr.free-electrons.com/ident?i=port> = state <http://lxr.free-electrons.com/ident?i=state>->uart_port <http://lxr.free-electrons.com/ident?i=uart_port>;
> 82 <http://lxr.free-electrons.com/source/drivers/tty/serial/serial_core.c#L82> unsigned long flags <http://lxr.free-electrons.com/ident?i=flags>;
> 83 <http://lxr.free-electrons.com/source/drivers/tty/serial/serial_core.c#L83>
> 84 <http://lxr.free-electrons.com/source/drivers/tty/serial/serial_core.c#L84> spin_lock_irqsave <http://lxr.free-electrons.com/ident?i=spin_lock_irqsave>(&port <http://lxr.free-electrons.com/ident?i=port>->lock <http://lxr.free-electrons.com/ident?i=lock>, flags <http://lxr.free-electrons.com/ident?i=flags>);
> 85 <http://lxr.free-electrons.com/source/drivers/tty/serial/serial_core.c#L85> port <http://lxr.free-electrons.com/ident?i=port>->ops <http://lxr.free-electrons.com/ident?i=ops>->stop_tx(port <http://lxr.free-electrons.com/ident?i=port>);
> 86 <http://lxr.free-electrons.com/source/drivers/tty/serial/serial_core.c#L86> spin_unlock_irqrestore <http://lxr.free-electrons.com/ident?i=spin_unlock_irqrestore>(&port <http://lxr.free-electrons.com/ident?i=port>->lock <http://lxr.free-electrons.com/ident?i=lock>, flags <http://lxr.free-electrons.com/ident?i=flags>);
> 87 <http://lxr.free-electrons.com/source/drivers/tty/serial/serial_core.c#L87> }
> 88 <http://lxr.free-electrons.com/source/drivers/tty/serial/serial_core.c#L88>
>
> From above, u can see stop_tx() can be called, looking further into 8250.c:
>
> static void serial8250_stop_tx(struct uart_port *port)
> {
> struct uart_8250_port *up =
> container_of(port, struct uart_8250_port, port);
>
> __stop_tx(up);
>
> /*
> * We really want to stop the transmitter from sending.
> */
> if (up->port.type == PORT_16C950) {
> up->acr |= UART_ACR_TXDIS;
> serial_icr_write(up, UART_ACR, up->acr);
> }
> }
>
> And referring further to definition:
>
> /*
> * The 16C950 Additional Control Register
> */
> #define UART_ACR_RXDIS 0x01 /* Receiver disable */
> #define UART_ACR_TXDIS 0x02 /* Transmitter disable */
>
> So perhaps writing UART_ACR_XXX_DIS will disable the input/output:
>
> drivers/tty/serial/8250.c: up->acr |= UART_ACR_TXDIS;
>
> drivers/tty/serial/8250.c: up->acr &= ~UART_ACR_TXDIS;
>
> Experiment first....I am just guessing....
>
>
> On Wed, Jan 4, 2012 at 8:43 AM, hz hanks <hankshz at gmail.com> wrote:
>
>> Hi, all~
>> I'm studying in an embedded Linux board with only one uart, which is
>> set default as the console display. Now as I try to develop uart
>> driver, I want to shutdown this console redirection temporarily. But I
>> don't know how? I search the Internet, but there's only the tutorial
>> for setting this redirection rather than shutdown it. Is there anyone
>> can help? Thank you very much.
>>
>> _______________________________________________
>> Kernelnewbies mailing list
>> Kernelnewbies at kernelnewbies.org
>> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>>
>
>
>
> --
> Regards,
> Peter Teoh
>
--
Regards,
Peter Teoh
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20120125/2a14abda/attachment-0001.html
More information about the Kernelnewbies
mailing list