wdenk | 7ac1610 | 2004-08-01 22:48:16 +0000 | [diff] [blame] | 1 | #ifndef __SERIAL_H__ |
| 2 | #define __SERIAL_H__ |
| 3 | |
Mike Frysinger | 078f2f1 | 2011-05-14 06:56:15 +0000 | [diff] [blame] | 4 | #include <post.h> |
| 5 | |
wdenk | 7ac1610 | 2004-08-01 22:48:16 +0000 | [diff] [blame] | 6 | #define NAMESIZE 16 |
wdenk | 7ac1610 | 2004-08-01 22:48:16 +0000 | [diff] [blame] | 7 | |
| 8 | struct serial_device { |
| 9 | char name[NAMESIZE]; |
wdenk | 7ac1610 | 2004-08-01 22:48:16 +0000 | [diff] [blame] | 10 | |
| 11 | int (*init) (void); |
Anatolij Gustschin | 99d25f9 | 2010-04-24 19:27:04 +0200 | [diff] [blame] | 12 | int (*uninit) (void); |
wdenk | 7ac1610 | 2004-08-01 22:48:16 +0000 | [diff] [blame] | 13 | void (*setbrg) (void); |
| 14 | int (*getc) (void); |
| 15 | int (*tstc) (void); |
| 16 | void (*putc) (const char c); |
| 17 | void (*puts) (const char *s); |
Mike Frysinger | 078f2f1 | 2011-05-14 06:56:15 +0000 | [diff] [blame] | 18 | #if CONFIG_POST & CONFIG_SYS_POST_UART |
| 19 | void (*loop) (int); |
| 20 | #endif |
wdenk | 7ac1610 | 2004-08-01 22:48:16 +0000 | [diff] [blame] | 21 | |
| 22 | struct serial_device *next; |
| 23 | }; |
| 24 | |
| 25 | extern struct serial_device serial_smc_device; |
| 26 | extern struct serial_device serial_scc_device; |
| 27 | extern struct serial_device * default_serial_console (void); |
| 28 | |
Stefan Roese | 153b3e2 | 2007-10-05 17:10:59 +0200 | [diff] [blame] | 29 | #if defined(CONFIG_405GP) || defined(CONFIG_405CR) || defined(CONFIG_440) || \ |
| 30 | defined(CONFIG_405EP) || defined(CONFIG_405EZ) || defined(CONFIG_405EX) || \ |
Matthias Weisser | 63c36f5 | 2010-08-09 13:31:49 +0200 | [diff] [blame] | 31 | defined(CONFIG_MB86R0x) || defined(CONFIG_MPC5xxx) || \ |
| 32 | defined(CONFIG_MPC83xx) || defined(CONFIG_MPC85xx) || \ |
Tom Warren | 1ded602 | 2011-01-27 10:58:06 +0000 | [diff] [blame] | 33 | defined(CONFIG_MPC86xx) || defined(CONFIG_SYS_SC520) || \ |
| 34 | defined(CONFIG_TEGRA2) |
wdenk | 96c7a8c | 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 | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 37 | #if defined(CONFIG_SYS_NS16550_SERIAL) |
Wolfgang Denk | 44df561 | 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 | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 42 | #endif /* CONFIG_SYS_NS16550_SERIAL */ |
Wolfgang Denk | 44df561 | 2006-08-30 23:02:10 +0200 | [diff] [blame] | 43 | |
wdenk | 96c7a8c | 2005-01-09 22:28:56 +0000 | [diff] [blame] | 44 | #endif |
| 45 | |
Anatolij Gustschin | ee4aac8 | 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 | |
Harald Welte | da41262 | 2007-12-19 14:24:40 +0100 | [diff] [blame] | 53 | #if defined(CONFIG_S3C2410) |
| 54 | extern struct serial_device s3c24xx_serial0_device; |
| 55 | extern struct serial_device s3c24xx_serial1_device; |
| 56 | extern struct serial_device s3c24xx_serial2_device; |
| 57 | #endif |
wdenk | 96c7a8c | 2005-01-09 22:28:56 +0000 | [diff] [blame] | 58 | |
Minkyu Kang | 485feb6 | 2010-08-23 19:52:03 +0900 | [diff] [blame] | 59 | #if defined(CONFIG_S5P) |
Minkyu Kang | baa3688 | 2010-03-24 16:59:30 +0900 | [diff] [blame] | 60 | extern struct serial_device s5p_serial0_device; |
| 61 | extern struct serial_device s5p_serial1_device; |
| 62 | extern struct serial_device s5p_serial2_device; |
| 63 | extern struct serial_device s5p_serial3_device; |
Minkyu Kang | fca3084 | 2009-10-01 17:20:28 +0900 | [diff] [blame] | 64 | #endif |
| 65 | |
Tom Rix | 93bed9b | 2009-05-31 12:44:37 +0200 | [diff] [blame] | 66 | #if defined(CONFIG_OMAP3_ZOOM2) |
| 67 | extern struct serial_device zoom2_serial_device0; |
| 68 | extern struct serial_device zoom2_serial_device1; |
| 69 | extern struct serial_device zoom2_serial_device2; |
| 70 | extern struct serial_device zoom2_serial_device3; |
| 71 | #endif |
| 72 | |
stefano babic | 5ab4f03 | 2007-08-30 22:57:04 +0200 | [diff] [blame] | 73 | extern struct serial_device serial_ffuart_device; |
| 74 | extern struct serial_device serial_btuart_device; |
| 75 | extern struct serial_device serial_stuart_device; |
| 76 | |
Mike Frysinger | 53ba322 | 2011-04-29 23:23:28 -0400 | [diff] [blame] | 77 | #if defined(CONFIG_SYS_BFIN_UART) |
| 78 | extern void serial_register_bfin_uart(void); |
| 79 | extern struct serial_device bfin_serial0_device; |
| 80 | extern struct serial_device bfin_serial1_device; |
| 81 | extern struct serial_device bfin_serial2_device; |
| 82 | extern struct serial_device bfin_serial3_device; |
| 83 | #endif |
| 84 | |
| 85 | extern void serial_register(struct serial_device *); |
wdenk | 7ac1610 | 2004-08-01 22:48:16 +0000 | [diff] [blame] | 86 | extern void serial_initialize(void); |
Jean-Christophe PLAGNIOL-VILLARD | 2a7a031 | 2009-05-16 12:14:54 +0200 | [diff] [blame] | 87 | extern void serial_stdio_init(void); |
wdenk | 7ac1610 | 2004-08-01 22:48:16 +0000 | [diff] [blame] | 88 | extern int serial_assign(char * name); |
| 89 | extern void serial_reinit_all(void); |
| 90 | |
Tom Rix | a36796b | 2009-10-31 12:37:44 -0500 | [diff] [blame] | 91 | /* For usbtty */ |
Tom Rix | 7bea868 | 2009-10-31 12:37:45 -0500 | [diff] [blame] | 92 | #ifdef CONFIG_USB_TTY |
| 93 | |
Tom Rix | a36796b | 2009-10-31 12:37:44 -0500 | [diff] [blame] | 94 | extern int usbtty_getc(void); |
| 95 | extern void usbtty_putc(const char c); |
| 96 | extern void usbtty_puts(const char *str); |
| 97 | extern int usbtty_tstc(void); |
| 98 | |
Tom Rix | 7bea868 | 2009-10-31 12:37:45 -0500 | [diff] [blame] | 99 | #else |
| 100 | |
| 101 | /* stubs */ |
| 102 | #define usbtty_getc() 0 |
| 103 | #define usbtty_putc(a) |
| 104 | #define usbtty_puts(a) |
| 105 | #define usbtty_tstc() 0 |
| 106 | |
| 107 | #endif /* CONFIG_USB_TTY */ |
| 108 | |
Anatolij Gustschin | 65c3dfc | 2010-04-24 19:27:06 +0200 | [diff] [blame] | 109 | #if defined(CONFIG_MPC512X) && defined(CONFIG_SERIAL_MULTI) |
| 110 | extern struct stdio_dev *open_port(int num, int baudrate); |
| 111 | extern int close_port(int num); |
| 112 | extern int write_port(struct stdio_dev *port, char *buf); |
| 113 | extern int read_port(struct stdio_dev *port, char *buf, int size); |
| 114 | #endif |
| 115 | |
wdenk | 7ac1610 | 2004-08-01 22:48:16 +0000 | [diff] [blame] | 116 | #endif |