blob: ff1ce990093bba737d005ac124b22e27fa6f88c9 [file] [log] [blame]
lh9ed821d2023-04-07 01:36:19 -07001#ifndef __SERIAL_H__
2#define __SERIAL_H__
3
4#include <post.h>
5
6#define NAMESIZE 16
7
8struct serial_device {
9 char name[NAMESIZE];
10
11 int (*init) (void);
12 int (*uninit) (void);
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#if CONFIG_POST & CONFIG_SYS_POST_UART
19 void (*loop) (int);
20#endif
21
22 struct serial_device *next;
23};
24
25extern struct serial_device serial_smc_device;
26extern struct serial_device serial_scc_device;
27extern struct serial_device * default_serial_console (void);
28
29#if defined(CONFIG_405GP) || defined(CONFIG_405CR) || defined(CONFIG_440) || \
30 defined(CONFIG_405EP) || defined(CONFIG_405EZ) || defined(CONFIG_405EX) || \
31 defined(CONFIG_MB86R0x) || defined(CONFIG_MPC5xxx) || \
32 defined(CONFIG_MPC83xx) || defined(CONFIG_MPC85xx) || \
33 defined(CONFIG_MPC86xx) || defined(CONFIG_SYS_SC520) || \
34 defined(CONFIG_TEGRA2)
35extern struct serial_device serial0_device;
36extern struct serial_device serial1_device;
37#if defined(CONFIG_SYS_NS16550_SERIAL)
38extern struct serial_device eserial1_device;
39extern struct serial_device eserial2_device;
40extern struct serial_device eserial3_device;
41extern struct serial_device eserial4_device;
42#endif /* CONFIG_SYS_NS16550_SERIAL */
43
44#endif
45
46#if defined(CONFIG_MPC512X)
47extern struct serial_device serial1_device;
48extern struct serial_device serial3_device;
49extern struct serial_device serial4_device;
50extern struct serial_device serial6_device;
51#endif
52
53#if defined(CONFIG_S3C2410)
54extern struct serial_device s3c24xx_serial0_device;
55extern struct serial_device s3c24xx_serial1_device;
56extern struct serial_device s3c24xx_serial2_device;
57#endif
58
59#if defined(CONFIG_S5P)
60extern struct serial_device s5p_serial0_device;
61extern struct serial_device s5p_serial1_device;
62extern struct serial_device s5p_serial2_device;
63extern struct serial_device s5p_serial3_device;
64#endif
65
66#if defined(CONFIG_OMAP3_ZOOM2)
67extern struct serial_device zoom2_serial_device0;
68extern struct serial_device zoom2_serial_device1;
69extern struct serial_device zoom2_serial_device2;
70extern struct serial_device zoom2_serial_device3;
71#endif
72
73extern struct serial_device serial_ffuart_device;
74extern struct serial_device serial_btuart_device;
75extern struct serial_device serial_stuart_device;
76
77#if defined(CONFIG_SYS_BFIN_UART)
78extern void serial_register_bfin_uart(void);
79extern struct serial_device bfin_serial0_device;
80extern struct serial_device bfin_serial1_device;
81extern struct serial_device bfin_serial2_device;
82extern struct serial_device bfin_serial3_device;
83#endif
84
85extern void serial_register(struct serial_device *);
86extern void serial_initialize(void);
87extern void serial_stdio_init(void);
88extern int serial_assign(char * name);
89extern void serial_reinit_all(void);
90
91/* For usbtty */
92#ifdef CONFIG_USB_TTY
93
94extern int usbtty_getc(void);
95extern void usbtty_putc(const char c);
96extern void usbtty_puts(const char *str);
97extern int usbtty_tstc(void);
98
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
109#if defined(CONFIG_MPC512X) && defined(CONFIG_SERIAL_MULTI)
110extern struct stdio_dev *open_port(int num, int baudrate);
111extern int close_port(int num);
112extern int write_port(struct stdio_dev *port, char *buf);
113extern int read_port(struct stdio_dev *port, char *buf, int size);
114#endif
115
116#endif