Re: How to shutdown console redirection

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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/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 static void uart_stop(struct tty_struct *tty)
 79 {
 80         struct uart_state *state = tty->driver_data;
 81         struct uart_port *port = state->uart_port;
 82         unsigned long flags;
 83 
 84         spin_lock_irqsave(&port->lock, flags);
 85         port->ops->stop_tx(port);
 86         spin_unlock_irqrestore(&port->lock, flags);
 87 }
 88
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@xxxxxxxxx> 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@xxxxxxxxxxxxxxxxx
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies



--
Regards,
Peter Teoh
_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@xxxxxxxxxxxxxxxxx
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux