[U-Boot] [PATCH 1/2] IOMUX: Add console multiplexing support.

Jean-Christophe PLAGNIOL-VILLARD plagnioj at jcrosoft.com
Sun Sep 14 23:59:39 CEST 2008


> +				return i;
> +#else
>  			/* Try assigning specified device */
>  			if (console_assign (console, argv[2]) < 0)
>  				return 1;
> @@ -221,6 +226,7 @@ int _do_setenv (int flag, int argc, char *argv[])
>  			if (serial_assign (argv[2]) < 0)
>  				return 1;
>  #endif
> +#endif /* CONFIG_IO_MUX */
>  		}
>  
>  		/*
> diff --git a/common/console.c b/common/console.c
> index 56d9118..6158af9 100644
> --- a/common/console.c
> +++ b/common/console.c
> @@ -93,6 +93,78 @@ static int console_setfile (int file, device_t * dev)
>  	return error;
>  }
>  
> +#if defined(CONFIG_IO_MUX)
> +/** Console I/O multiplexing *******************************************/
> +
> +static device_t *tstcdev;
> +device_t *console_devices[MAX_FILES][MAX_CONSARGS];

please use a list_head instead


> +
> +/*
> + * This depends on tstc() always being called before getc().
> + * No attempt is made to demultiplex multiple input sources.
> + */
> +static int iomux_getc(void)
> +{
> +	unsigned char ret;
> +
> +	ret = tstcdev->getc();
> +	tstcdev = NULL;
> +	return ret;
> +}
> +
  #ifdef CONFIG_STATUS_LED
> diff --git a/include/iomux.h b/include/iomux.h
> new file mode 100644
> index 0000000..1310a75
> --- /dev/null
> +++ b/include/iomux.h
> @@ -0,0 +1,48 @@
> +/*
> + * (C) Copyright 2008
> + * Gary Jennejohn, DENX Software Engineering GmbH, garyj at denx.de.
> + *
> + * See file CREDITS for list of people who contributed to this
> + * project.
> + *
> + * This program is free software; you can redistribute it and/or                 * modify it under the terms of the GNU General Public License as
> + * published by the Free Software Foundation; either version 2 of                * the License, or (at your option) any later version.
> + *                                                                               * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> + * GNU General Public License for more details.
please fix

> + *
> + * You should have received a copy of the GNU General Public License
> + * along with this program; if not, write to the Free Software
> + * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
> + * MA 02111-1307 USA
> + */
> +
> +#ifndef _IO_MUX_H
> +#define _IO_MUX_H
> +
> +#include <devices.h>
> +
> +/*
> + * Stuff required to support console multiplexing.
> + */
> +/* Only allow this many devices in the comma separated list of consoles */
> +#define MAX_CONSARGS 6
No more need if you use list_head
> +
> +/*
> + * Avoid invoking WATCHDOG via udelayy() on every pass through the loop
> + * in fgetc(). Note this is all based on guesswork.
> + */
> +#define COUNT_TIL_UDELAY	10000
> +
> +/*
> + * Pointers to devices used for each file type.  Defined in console.c.
> + */
> +extern device_t *console_devices[MAX_FILES][MAX_CONSARGS];
ditto
> +#define CONSDEVS_LINE_SIZE	(sizeof(device_t *) * MAX_CONSARGS)
ditto

Best Regards,
J.


More information about the U-Boot mailing list