Merge branch 'micropeak-1.1'
[fw/altos] / src / core / ao_serial.h
1 /*
2  * Copyright © 2012 Keith Packard <keithp@keithp.com>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; version 2 of the License.
7  *
8  * This program is distributed in the hope that it will be useful, but
9  * WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11  * General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License along
14  * with this program; if not, write to the Free Software Foundation, Inc.,
15  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
16  */
17
18 #ifndef _AO_SERIAL_H_
19 #define _AO_SERIAL_H_
20
21 #define AO_SERIAL_SPEED_4800    0
22 #define AO_SERIAL_SPEED_9600    1
23 #define AO_SERIAL_SPEED_19200   2
24 #define AO_SERIAL_SPEED_57600   3
25 #define AO_SERIAL_SPEED_115200  4
26
27 #if HAS_SERIAL_0
28 extern volatile __xdata struct ao_fifo  ao_serial0_rx_fifo;
29 extern volatile __xdata struct ao_fifo  ao_serial0_tx_fifo;
30
31 char
32 ao_serial0_getchar(void);
33
34 int
35 ao_serial0_pollchar(void);
36
37 void
38 ao_serial0_putchar(char c);
39
40 void
41 ao_serial0_drain(void);
42
43 void
44 ao_serial0_set_speed(uint8_t speed);
45 #endif
46
47 #if HAS_SERIAL_1
48 extern volatile __xdata struct ao_fifo  ao_serial1_rx_fifo;
49 extern volatile __xdata struct ao_fifo  ao_serial1_tx_fifo;
50
51 char
52 ao_serial1_getchar(void);
53
54 int
55 ao_serial1_pollchar(void);
56
57 void
58 ao_serial1_putchar(char c);
59
60 void
61 ao_serial1_drain(void);
62
63 void
64 ao_serial1_set_speed(uint8_t speed);
65 #endif
66
67 #if HAS_SERIAL_2
68 extern volatile __xdata struct ao_fifo  ao_serial2_rx_fifo;
69 extern volatile __xdata struct ao_fifo  ao_serial2_tx_fifo;
70
71 char
72 ao_serial2_getchar(void);
73
74 int
75 ao_serial2_pollchar(void);
76
77 void
78 ao_serial2_putchar(char c);
79
80 void
81 ao_serial2_drain(void);
82
83 void
84 ao_serial2_set_speed(uint8_t speed);
85 #endif
86
87 #if HAS_SERIAL_3
88 extern volatile __xdata struct ao_fifo  ao_serial3_rx_fifo;
89 extern volatile __xdata struct ao_fifo  ao_serial3_tx_fifo;
90
91 char
92 ao_serial3_getchar(void);
93
94 int
95 ao_serial3_pollchar(void);
96
97 void
98 ao_serial3_putchar(char c);
99
100 void
101 ao_serial3_drain(void);
102
103 void
104 ao_serial3_set_speed(uint8_t speed);
105 #endif
106
107 void
108 ao_serial_init(void);
109
110 #endif /* _AO_SERIAL_H_ */