]> git.sur5r.net Git - freertos/blob - Demo/HCS12_GCC_banked/asm-m68hcs12/sio.h
Start to re-arrange files to include FreeRTOS+ in main download.
[freertos] / Demo / HCS12_GCC_banked / asm-m68hcs12 / sio.h
1 /* m68hc11/sio.h -- Utility methods to read/write the SIO\r
2    Copyright 1999, 2000, 2003 Free Software Foundation, Inc.\r
3    Written by Stephane Carrez (stcarrez@nerim.fr)\r
4 \r
5 This file is part of GDB, GAS, and the GNU binutils.\r
6 \r
7 GDB, GAS, and the GNU binutils are free software; you can redistribute\r
8 them and/or modify them under the terms of the GNU General Public\r
9 License as published by the Free Software Foundation; either version\r
10 1, or (at your option) any later version.\r
11 \r
12 GDB, GAS, and the GNU binutils are distributed in the hope that they\r
13 will be useful, but WITHOUT ANY WARRANTY; without even the implied\r
14 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See\r
15 the GNU General Public License for more details.\r
16 \r
17 You should have received a copy of the GNU General Public License\r
18 along with this file; see the file COPYING.  If not, write to the Free\r
19 Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */\r
20 \r
21 #ifndef _M68HC12_SIO_H\r
22 #define _M68HC12_SIO_H\r
23 \r
24 #include <sys/param.h>\r
25 #include <sys/ports.h>\r
26 \r
27 /*  Initialize SCI serial port to default baudrate and enable. */\r
28 extern inline void\r
29 serial_init (void)\r
30 {\r
31   SCIBD = M6811_DEF_BAUD;\r
32   SCICR1 = 0x00;            //typical 8 bit\r
33   SCICR2 = 0x0c;            //Enable sci for polling\r
34 }\r
35 \r
36 /* Return != 0 if there is something to read on the serial line.  */\r
37 extern inline unsigned char\r
38 serial_receive_pending (void)\r
39 {\r
40   return SCISR1 & RDRF;\r
41 }\r
42 \r
43 /* Wait until the SIO has finished to send the character.  */\r
44 extern inline void\r
45 serial_flush (void)\r
46 {\r
47   while (!(SCISR1 & TDRE))\r
48     cop_optional_reset ();\r
49 }\r
50 \r
51 /* Return != 0 if serial port is ready to send another char.  */\r
52 extern inline unsigned char\r
53 serial_send_ready (void)\r
54 {\r
55   return SCISR1 & TDRE;\r
56 }\r
57 \r
58 /* Send the character on the serial line.  */\r
59 extern inline void\r
60 serial_send (char c)\r
61 {\r
62   serial_flush ();\r
63   SCIDRL = c;\r
64   SCICR2 |= (1<<3);\r
65 }\r
66 \r
67 /* Wait for a character on the serial line and return it.  */\r
68 extern inline unsigned char\r
69 serial_recv (void)\r
70 {\r
71   while (!(SCISR1 & RDRF))\r
72     cop_optional_reset ();\r
73 \r
74   return SCIDRL;\r
75 }\r
76 \r
77 extern void serial_print (const char *msg);\r
78 extern void serial_getline (char *buf);\r
79 \r
80 #endif /* _M68HC11_SIO_H */\r
81 \r