]> git.kernelconcepts.de Git - karo-tx-uboot.git/blob - include/serial.h
serial: zynq: Move serial registration from serial_initialize()
[karo-tx-uboot.git] / include / serial.h
1 #ifndef __SERIAL_H__
2 #define __SERIAL_H__
3
4 #include <post.h>
5
6 struct serial_device {
7         /* enough bytes to match alignment of following func pointer */
8         char    name[16];
9
10         int     (*start)(void);
11         int     (*stop)(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);
17 #if CONFIG_POST & CONFIG_SYS_POST_UART
18         void    (*loop)(int);
19 #endif
20         struct serial_device    *next;
21 };
22
23 extern struct serial_device serial_smc_device;
24 extern struct serial_device serial_scc_device;
25 extern struct serial_device *default_serial_console(void);
26
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) || \
33         defined(CONFIG_TEGRA20) || defined(CONFIG_SYS_COREBOOT) || \
34         defined(CONFIG_MICROBLAZE)
35 extern struct serial_device serial0_device;
36 extern struct serial_device serial1_device;
37 #if defined(CONFIG_SYS_NS16550_SERIAL)
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;
42 #endif /* CONFIG_SYS_NS16550_SERIAL */
43
44 #endif
45
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
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
60 #if defined(CONFIG_OMAP3_ZOOM2)
61 extern struct serial_device zoom2_serial_device0;
62 extern struct serial_device zoom2_serial_device1;
63 extern struct serial_device zoom2_serial_device2;
64 extern struct serial_device zoom2_serial_device3;
65 #endif
66
67 #if defined(CONFIG_SYS_BFIN_UART)
68 extern void serial_register_bfin_uart(void);
69 extern struct serial_device bfin_serial0_device;
70 extern struct serial_device bfin_serial1_device;
71 extern struct serial_device bfin_serial2_device;
72 extern struct serial_device bfin_serial3_device;
73 #endif
74
75 extern void serial_register(struct serial_device *);
76 extern void serial_initialize(void);
77 extern void serial_stdio_init(void);
78 extern int serial_assign(const char *name);
79 extern void serial_reinit_all(void);
80
81 /* For usbtty */
82 #ifdef CONFIG_USB_TTY
83
84 extern int usbtty_getc(void);
85 extern void usbtty_putc(const char c);
86 extern void usbtty_puts(const char *str);
87 extern int usbtty_tstc(void);
88
89 #else
90
91 /* stubs */
92 #define usbtty_getc() 0
93 #define usbtty_putc(a)
94 #define usbtty_puts(a)
95 #define usbtty_tstc() 0
96
97 #endif /* CONFIG_USB_TTY */
98
99 #if defined(CONFIG_MPC512X) &&  defined(CONFIG_SERIAL_MULTI)
100 extern struct stdio_dev *open_port(int num, int baudrate);
101 extern int close_port(int num);
102 extern int write_port(struct stdio_dev *port, char *buf);
103 extern int read_port(struct stdio_dev *port, char *buf, int size);
104 #endif
105
106 #endif