wdenk | 281e00a | 2004-08-01 22:48:16 +0000 | [diff] [blame] | 1 | #ifndef __SERIAL_H__ |
| 2 | #define __SERIAL_H__ |
| 3 | |
Mike Frysinger | 7b826c2 | 2011-05-14 06:56:15 +0000 | [diff] [blame] | 4 | #include <post.h> |
| 5 | |
wdenk | 281e00a | 2004-08-01 22:48:16 +0000 | [diff] [blame] | 6 | struct serial_device { |
Mike Frysinger | f6add13 | 2011-11-10 14:11:04 +0000 | [diff] [blame] | 7 | /* enough bytes to match alignment of following func pointer */ |
Marek Vasut | 78322d6 | 2012-09-07 14:32:10 +0200 | [diff] [blame^] | 8 | char name[16]; |
wdenk | 281e00a | 2004-08-01 22:48:16 +0000 | [diff] [blame] | 9 | |
Marek Vasut | 78322d6 | 2012-09-07 14:32:10 +0200 | [diff] [blame^] | 10 | int (*init)(void); |
| 11 | int (*uninit)(void); |
| 12 | void (*setbrg)(void); |
| 13 | int (*getc)(void); |
| 14 | int (*tstc)(void); |
| 15 | void (*putc)(const char c); |
| 16 | void (*puts)(const char *s); |
Mike Frysinger | 7b826c2 | 2011-05-14 06:56:15 +0000 | [diff] [blame] | 17 | #if CONFIG_POST & CONFIG_SYS_POST_UART |
Marek Vasut | 78322d6 | 2012-09-07 14:32:10 +0200 | [diff] [blame^] | 18 | void (*loop)(int); |
Mike Frysinger | 7b826c2 | 2011-05-14 06:56:15 +0000 | [diff] [blame] | 19 | #endif |
Marek Vasut | 78322d6 | 2012-09-07 14:32:10 +0200 | [diff] [blame^] | 20 | struct serial_device *next; |
wdenk | 281e00a | 2004-08-01 22:48:16 +0000 | [diff] [blame] | 21 | }; |
| 22 | |
| 23 | extern struct serial_device serial_smc_device; |
| 24 | extern struct serial_device serial_scc_device; |
Gerlando Falauto | a6e6f7f | 2011-11-18 06:49:11 +0000 | [diff] [blame] | 25 | extern struct serial_device *default_serial_console(void); |
wdenk | 281e00a | 2004-08-01 22:48:16 +0000 | [diff] [blame] | 26 | |
Gerlando Falauto | a6e6f7f | 2011-11-18 06:49:11 +0000 | [diff] [blame] | 27 | #if defined(CONFIG_405GP) || defined(CONFIG_405CR) || \ |
| 28 | defined(CONFIG_405EP) || defined(CONFIG_405EZ) || \ |
| 29 | defined(CONFIG_405EX) || defined(CONFIG_440) || \ |
| 30 | defined(CONFIG_MB86R0x) || defined(CONFIG_MPC5xxx) || \ |
| 31 | defined(CONFIG_MPC83xx) || defined(CONFIG_MPC85xx) || \ |
| 32 | defined(CONFIG_MPC86xx) || defined(CONFIG_SYS_SC520) || \ |
Michal Simek | 7636ebe | 2012-07-02 12:38:14 +0200 | [diff] [blame] | 33 | defined(CONFIG_TEGRA20) || defined(CONFIG_SYS_COREBOOT) || \ |
| 34 | defined(CONFIG_MICROBLAZE) |
wdenk | ff36fd8 | 2005-01-09 22:28:56 +0000 | [diff] [blame] | 35 | extern struct serial_device serial0_device; |
| 36 | extern struct serial_device serial1_device; |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 37 | #if defined(CONFIG_SYS_NS16550_SERIAL) |
Wolfgang Denk | 0fd3025 | 2006-08-30 23:02:10 +0200 | [diff] [blame] | 38 | extern struct serial_device eserial1_device; |
| 39 | extern struct serial_device eserial2_device; |
| 40 | extern struct serial_device eserial3_device; |
| 41 | extern struct serial_device eserial4_device; |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 42 | #endif /* CONFIG_SYS_NS16550_SERIAL */ |
Wolfgang Denk | 0fd3025 | 2006-08-30 23:02:10 +0200 | [diff] [blame] | 43 | |
wdenk | ff36fd8 | 2005-01-09 22:28:56 +0000 | [diff] [blame] | 44 | #endif |
| 45 | |
Anatolij Gustschin | e3b28e6 | 2010-04-24 19:27:05 +0200 | [diff] [blame] | 46 | #if defined(CONFIG_MPC512X) |
| 47 | extern struct serial_device serial1_device; |
| 48 | extern struct serial_device serial3_device; |
| 49 | extern struct serial_device serial4_device; |
| 50 | extern struct serial_device serial6_device; |
| 51 | #endif |
| 52 | |
Michal Simek | 49a23e4 | 2011-09-25 21:03:08 +0000 | [diff] [blame] | 53 | #if defined(CONFIG_XILINX_UARTLITE) |
| 54 | extern struct serial_device uartlite_serial0_device; |
| 55 | extern struct serial_device uartlite_serial1_device; |
| 56 | extern struct serial_device uartlite_serial2_device; |
| 57 | extern struct serial_device uartlite_serial3_device; |
| 58 | #endif |
| 59 | |
Harald Welte | a7c185e | 2007-12-19 14:24:40 +0100 | [diff] [blame] | 60 | #if defined(CONFIG_S3C2410) |
| 61 | extern struct serial_device s3c24xx_serial0_device; |
| 62 | extern struct serial_device s3c24xx_serial1_device; |
| 63 | extern struct serial_device s3c24xx_serial2_device; |
| 64 | #endif |
wdenk | ff36fd8 | 2005-01-09 22:28:56 +0000 | [diff] [blame] | 65 | |
Minkyu Kang | 889a275 | 2010-08-23 19:52:03 +0900 | [diff] [blame] | 66 | #if defined(CONFIG_S5P) |
Minkyu Kang | 46a3b5c | 2010-03-24 16:59:30 +0900 | [diff] [blame] | 67 | extern struct serial_device s5p_serial0_device; |
| 68 | extern struct serial_device s5p_serial1_device; |
| 69 | extern struct serial_device s5p_serial2_device; |
| 70 | extern struct serial_device s5p_serial3_device; |
Minkyu Kang | dd2c9e6 | 2009-10-01 17:20:28 +0900 | [diff] [blame] | 71 | #endif |
| 72 | |
Tom Rix | 660888b | 2009-05-31 12:44:37 +0200 | [diff] [blame] | 73 | #if defined(CONFIG_OMAP3_ZOOM2) |
| 74 | extern struct serial_device zoom2_serial_device0; |
| 75 | extern struct serial_device zoom2_serial_device1; |
| 76 | extern struct serial_device zoom2_serial_device2; |
| 77 | extern struct serial_device zoom2_serial_device3; |
| 78 | #endif |
| 79 | |
stefano babic | 80172c6 | 2007-08-30 22:57:04 +0200 | [diff] [blame] | 80 | extern struct serial_device serial_ffuart_device; |
| 81 | extern struct serial_device serial_btuart_device; |
| 82 | extern struct serial_device serial_stuart_device; |
| 83 | |
Mike Frysinger | 635f330 | 2011-04-29 23:23:28 -0400 | [diff] [blame] | 84 | #if defined(CONFIG_SYS_BFIN_UART) |
| 85 | extern void serial_register_bfin_uart(void); |
| 86 | extern struct serial_device bfin_serial0_device; |
| 87 | extern struct serial_device bfin_serial1_device; |
| 88 | extern struct serial_device bfin_serial2_device; |
| 89 | extern struct serial_device bfin_serial3_device; |
| 90 | #endif |
| 91 | |
Michal Simek | 194846f | 2012-09-14 00:55:24 +0000 | [diff] [blame] | 92 | #if defined(CONFIG_ZYNQ_SERIAL) |
| 93 | extern struct serial_device uart_zynq_serial0_device; |
| 94 | extern struct serial_device uart_zynq_serial1_device; |
| 95 | #endif |
| 96 | |
Mike Frysinger | 635f330 | 2011-04-29 23:23:28 -0400 | [diff] [blame] | 97 | extern void serial_register(struct serial_device *); |
wdenk | 281e00a | 2004-08-01 22:48:16 +0000 | [diff] [blame] | 98 | extern void serial_initialize(void); |
Jean-Christophe PLAGNIOL-VILLARD | 52cb4d4 | 2009-05-16 12:14:54 +0200 | [diff] [blame] | 99 | extern void serial_stdio_init(void); |
Gerlando Falauto | 7813ca9 | 2011-11-18 06:49:12 +0000 | [diff] [blame] | 100 | extern int serial_assign(const char *name); |
wdenk | 281e00a | 2004-08-01 22:48:16 +0000 | [diff] [blame] | 101 | extern void serial_reinit_all(void); |
| 102 | |
Tom Rix | 6299487 | 2009-10-31 12:37:44 -0500 | [diff] [blame] | 103 | /* For usbtty */ |
Tom Rix | 2ec1abe | 2009-10-31 12:37:45 -0500 | [diff] [blame] | 104 | #ifdef CONFIG_USB_TTY |
| 105 | |
Tom Rix | 6299487 | 2009-10-31 12:37:44 -0500 | [diff] [blame] | 106 | extern int usbtty_getc(void); |
| 107 | extern void usbtty_putc(const char c); |
| 108 | extern void usbtty_puts(const char *str); |
| 109 | extern int usbtty_tstc(void); |
| 110 | |
Tom Rix | 2ec1abe | 2009-10-31 12:37:45 -0500 | [diff] [blame] | 111 | #else |
| 112 | |
| 113 | /* stubs */ |
| 114 | #define usbtty_getc() 0 |
| 115 | #define usbtty_putc(a) |
| 116 | #define usbtty_puts(a) |
| 117 | #define usbtty_tstc() 0 |
| 118 | |
| 119 | #endif /* CONFIG_USB_TTY */ |
| 120 | |
Anatolij Gustschin | 8e234e3 | 2010-04-24 19:27:06 +0200 | [diff] [blame] | 121 | #if defined(CONFIG_MPC512X) && defined(CONFIG_SERIAL_MULTI) |
| 122 | extern struct stdio_dev *open_port(int num, int baudrate); |
| 123 | extern int close_port(int num); |
| 124 | extern int write_port(struct stdio_dev *port, char *buf); |
| 125 | extern int read_port(struct stdio_dev *port, char *buf, int size); |
| 126 | #endif |
| 127 | |
wdenk | 281e00a | 2004-08-01 22:48:16 +0000 | [diff] [blame] | 128 | #endif |