wdenk | 281e00a | 2004-08-01 22:48:16 +0000 | [diff] [blame] | 1 | #ifndef __SERIAL_H__ |
| 2 | #define __SERIAL_H__ |
| 3 | |
| 4 | #define NAMESIZE 16 |
| 5 | #define CTLRSIZE 8 |
| 6 | |
| 7 | struct serial_device { |
| 8 | char name[NAMESIZE]; |
| 9 | char ctlr[CTLRSIZE]; |
| 10 | |
| 11 | int (*init) (void); |
Anatolij Gustschin | fbb0030 | 2010-04-24 19:27:04 +0200 | [diff] [blame] | 12 | int (*uninit) (void); |
wdenk | 281e00a | 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); |
| 18 | |
| 19 | struct serial_device *next; |
| 20 | }; |
| 21 | |
| 22 | extern struct serial_device serial_smc_device; |
| 23 | extern struct serial_device serial_scc_device; |
| 24 | extern struct serial_device * default_serial_console (void); |
| 25 | |
Stefan Roese | dbbd125 | 2007-10-05 17:10:59 +0200 | [diff] [blame] | 26 | #if defined(CONFIG_405GP) || defined(CONFIG_405CR) || defined(CONFIG_440) || \ |
| 27 | defined(CONFIG_405EP) || defined(CONFIG_405EZ) || defined(CONFIG_405EX) || \ |
Matthias Weisser | 6052ac8 | 2010-08-09 13:31:49 +0200 | [diff] [blame] | 28 | defined(CONFIG_MB86R0x) || defined(CONFIG_MPC5xxx) || \ |
| 29 | defined(CONFIG_MPC83xx) || defined(CONFIG_MPC85xx) || \ |
Tom Warren | 2ee3678 | 2011-01-27 10:58:06 +0000 | [diff] [blame] | 30 | defined(CONFIG_MPC86xx) || defined(CONFIG_SYS_SC520) || \ |
| 31 | defined(CONFIG_TEGRA2) |
wdenk | ff36fd8 | 2005-01-09 22:28:56 +0000 | [diff] [blame] | 32 | extern struct serial_device serial0_device; |
| 33 | extern struct serial_device serial1_device; |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 34 | #if defined(CONFIG_SYS_NS16550_SERIAL) |
Wolfgang Denk | 0fd3025 | 2006-08-30 23:02:10 +0200 | [diff] [blame] | 35 | extern struct serial_device eserial1_device; |
| 36 | extern struct serial_device eserial2_device; |
| 37 | extern struct serial_device eserial3_device; |
| 38 | extern struct serial_device eserial4_device; |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 39 | #endif /* CONFIG_SYS_NS16550_SERIAL */ |
Wolfgang Denk | 0fd3025 | 2006-08-30 23:02:10 +0200 | [diff] [blame] | 40 | |
wdenk | ff36fd8 | 2005-01-09 22:28:56 +0000 | [diff] [blame] | 41 | #endif |
| 42 | |
Anatolij Gustschin | e3b28e6 | 2010-04-24 19:27:05 +0200 | [diff] [blame] | 43 | #if defined(CONFIG_MPC512X) |
| 44 | extern struct serial_device serial1_device; |
| 45 | extern struct serial_device serial3_device; |
| 46 | extern struct serial_device serial4_device; |
| 47 | extern struct serial_device serial6_device; |
| 48 | #endif |
| 49 | |
Harald Welte | a7c185e | 2007-12-19 14:24:40 +0100 | [diff] [blame] | 50 | #if defined(CONFIG_S3C2410) |
| 51 | extern struct serial_device s3c24xx_serial0_device; |
| 52 | extern struct serial_device s3c24xx_serial1_device; |
| 53 | extern struct serial_device s3c24xx_serial2_device; |
| 54 | #endif |
wdenk | ff36fd8 | 2005-01-09 22:28:56 +0000 | [diff] [blame] | 55 | |
Minkyu Kang | 889a275 | 2010-08-23 19:52:03 +0900 | [diff] [blame] | 56 | #if defined(CONFIG_S5P) |
Minkyu Kang | 46a3b5c | 2010-03-24 16:59:30 +0900 | [diff] [blame] | 57 | extern struct serial_device s5p_serial0_device; |
| 58 | extern struct serial_device s5p_serial1_device; |
| 59 | extern struct serial_device s5p_serial2_device; |
| 60 | extern struct serial_device s5p_serial3_device; |
Minkyu Kang | dd2c9e6 | 2009-10-01 17:20:28 +0900 | [diff] [blame] | 61 | #endif |
| 62 | |
Tom Rix | 660888b | 2009-05-31 12:44:37 +0200 | [diff] [blame] | 63 | #if defined(CONFIG_OMAP3_ZOOM2) |
| 64 | extern struct serial_device zoom2_serial_device0; |
| 65 | extern struct serial_device zoom2_serial_device1; |
| 66 | extern struct serial_device zoom2_serial_device2; |
| 67 | extern struct serial_device zoom2_serial_device3; |
| 68 | #endif |
| 69 | |
stefano babic | 80172c6 | 2007-08-30 22:57:04 +0200 | [diff] [blame] | 70 | extern struct serial_device serial_ffuart_device; |
| 71 | extern struct serial_device serial_btuart_device; |
| 72 | extern struct serial_device serial_stuart_device; |
| 73 | |
Mike Frysinger | 635f330 | 2011-04-29 23:23:28 -0400 | [diff] [blame] | 74 | #if defined(CONFIG_SYS_BFIN_UART) |
| 75 | extern void serial_register_bfin_uart(void); |
| 76 | extern struct serial_device bfin_serial0_device; |
| 77 | extern struct serial_device bfin_serial1_device; |
| 78 | extern struct serial_device bfin_serial2_device; |
| 79 | extern struct serial_device bfin_serial3_device; |
| 80 | #endif |
| 81 | |
| 82 | extern void serial_register(struct serial_device *); |
wdenk | 281e00a | 2004-08-01 22:48:16 +0000 | [diff] [blame] | 83 | extern void serial_initialize(void); |
Jean-Christophe PLAGNIOL-VILLARD | 52cb4d4 | 2009-05-16 12:14:54 +0200 | [diff] [blame] | 84 | extern void serial_stdio_init(void); |
wdenk | 281e00a | 2004-08-01 22:48:16 +0000 | [diff] [blame] | 85 | extern int serial_assign(char * name); |
| 86 | extern void serial_reinit_all(void); |
| 87 | |
Tom Rix | 6299487 | 2009-10-31 12:37:44 -0500 | [diff] [blame] | 88 | /* For usbtty */ |
Tom Rix | 2ec1abe | 2009-10-31 12:37:45 -0500 | [diff] [blame] | 89 | #ifdef CONFIG_USB_TTY |
| 90 | |
Tom Rix | 6299487 | 2009-10-31 12:37:44 -0500 | [diff] [blame] | 91 | extern int usbtty_getc(void); |
| 92 | extern void usbtty_putc(const char c); |
| 93 | extern void usbtty_puts(const char *str); |
| 94 | extern int usbtty_tstc(void); |
| 95 | |
Tom Rix | 2ec1abe | 2009-10-31 12:37:45 -0500 | [diff] [blame] | 96 | #else |
| 97 | |
| 98 | /* stubs */ |
| 99 | #define usbtty_getc() 0 |
| 100 | #define usbtty_putc(a) |
| 101 | #define usbtty_puts(a) |
| 102 | #define usbtty_tstc() 0 |
| 103 | |
| 104 | #endif /* CONFIG_USB_TTY */ |
| 105 | |
Anatolij Gustschin | 8e234e3 | 2010-04-24 19:27:06 +0200 | [diff] [blame] | 106 | #if defined(CONFIG_MPC512X) && defined(CONFIG_SERIAL_MULTI) |
| 107 | extern struct stdio_dev *open_port(int num, int baudrate); |
| 108 | extern int close_port(int num); |
| 109 | extern int write_port(struct stdio_dev *port, char *buf); |
| 110 | extern int read_port(struct stdio_dev *port, char *buf, int size); |
| 111 | #endif |
| 112 | |
wdenk | 281e00a | 2004-08-01 22:48:16 +0000 | [diff] [blame] | 113 | #endif |