1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22#ifndef ZOOM2_SERIAL_H
23#define ZOOM2_SERIAL_H
24
25extern int zoom2_debug_board_connected (void);
26
27#define SERIAL_TL16CP754C_BASE 0x10000000
28
29#define QUAD_BASE_0 SERIAL_TL16CP754C_BASE
30#define QUAD_BASE_1 (SERIAL_TL16CP754C_BASE + 0x100)
31#define QUAD_BASE_2 (SERIAL_TL16CP754C_BASE + 0x200)
32#define QUAD_BASE_3 (SERIAL_TL16CP754C_BASE + 0x300)
33
34#define S(a) #a
35#define N(a) S(quad##a)
36#define U(a) S(UART##a)
37
38#define QUAD_INIT(n) \
39int quad_init_##n(void) \
40{ \
41 return quad_init_dev(QUAD_BASE_##n); \
42} \
43void quad_setbrg_##n(void) \
44{ \
45 quad_setbrg_dev(QUAD_BASE_##n); \
46} \
47void quad_putc_##n(const char c) \
48{ \
49 quad_putc_dev(QUAD_BASE_##n, c); \
50} \
51void quad_puts_##n(const char *s) \
52{ \
53 quad_puts_dev(QUAD_BASE_##n, s); \
54} \
55int quad_getc_##n(void) \
56{ \
57 return quad_getc_dev(QUAD_BASE_##n); \
58} \
59int quad_tstc_##n(void) \
60{ \
61 return quad_tstc_dev(QUAD_BASE_##n); \
62} \
63struct serial_device zoom2_serial_device##n = \
64{ \
65 N(n), \
66 U(n), \
67 quad_init_##n, \
68 quad_setbrg_##n, \
69 quad_getc_##n, \
70 quad_tstc_##n, \
71 quad_putc_##n, \
72 quad_puts_##n, \
73};
74
75#endif
76