Tom Rini | 10e4779 | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0+ */ |
Gary Jennejohn | c6dc755 | 2008-11-06 15:04:23 +0100 | [diff] [blame] | 2 | /* |
| 3 | * (C) Copyright 2008 |
| 4 | * Gary Jennejohn, DENX Software Engineering GmbH, garyj@denx.de. |
Gary Jennejohn | c6dc755 | 2008-11-06 15:04:23 +0100 | [diff] [blame] | 5 | */ |
| 6 | |
| 7 | #ifndef _IO_MUX_H |
| 8 | #define _IO_MUX_H |
| 9 | |
Jean-Christophe PLAGNIOL-VILLARD | 2a7a031 | 2009-05-16 12:14:54 +0200 | [diff] [blame] | 10 | #include <stdio_dev.h> |
Gary Jennejohn | c6dc755 | 2008-11-06 15:04:23 +0100 | [diff] [blame] | 11 | |
| 12 | /* |
| 13 | * Stuff required to support console multiplexing. |
| 14 | */ |
| 15 | |
| 16 | /* |
| 17 | * Pointers to devices used for each file type. Defined in console.c |
| 18 | * but storage is allocated in iomux.c. |
| 19 | */ |
Jean-Christophe PLAGNIOL-VILLARD | 2a7a031 | 2009-05-16 12:14:54 +0200 | [diff] [blame] | 20 | extern struct stdio_dev **console_devices[MAX_FILES]; |
Gary Jennejohn | c6dc755 | 2008-11-06 15:04:23 +0100 | [diff] [blame] | 21 | /* |
| 22 | * The count of devices assigned to each FILE. Defined in console.c |
| 23 | * and populated in iomux.c. |
| 24 | */ |
| 25 | extern int cd_count[MAX_FILES]; |
| 26 | |
Sean Anderson | 174c149 | 2022-04-06 14:36:35 -0400 | [diff] [blame] | 27 | #define for_each_console_dev(i, file, dev) \ |
| 28 | for (i = 0; \ |
| 29 | i < cd_count[file] && (dev = console_devices[file][i]); \ |
| 30 | i++) |
Andy Shevchenko | e29d019 | 2021-02-11 17:09:42 +0200 | [diff] [blame] | 31 | |
Andy Shevchenko | 75039f5 | 2021-02-11 17:09:41 +0200 | [diff] [blame] | 32 | int iomux_match_device(struct stdio_dev **, const int, struct stdio_dev *); |
Gary Jennejohn | c6dc755 | 2008-11-06 15:04:23 +0100 | [diff] [blame] | 33 | int iomux_doenv(const int, const char *); |
Andy Shevchenko | 8ee40d3 | 2021-02-11 17:09:43 +0200 | [diff] [blame] | 34 | int iomux_replace_device(const int, const char *, const char *); |
Gary Jennejohn | c6dc755 | 2008-11-06 15:04:23 +0100 | [diff] [blame] | 35 | void iomux_printdevs(const int); |
Gary Jennejohn | c6dc755 | 2008-11-06 15:04:23 +0100 | [diff] [blame] | 36 | |
| 37 | #endif /* _IO_MUX_H */ |