sio.h

Description | Download | Table of Contents | Modules | Compound List | File List | Functions


Overview
Compiler
Documentation
Examples
Misc
Help
IDE & Tools

Download
Install

Links
Projects






00001 /* asm-m68hc11/sio.h -- Utility methods to read/write the SIO
00002    Copyright 1999, 2000, 2001 Free Software Foundation, Inc.
00003    Written by Stephane Carrez (stcarrez@worldnet.fr)
00004 
00005 This file is part of GDB, GAS, and the GNU binutils.
00006 
00007 GDB, GAS, and the GNU binutils are free software; you can redistribute
00008 them and/or modify them under the terms of the GNU General Public
00009 License as published by the Free Software Foundation; either version
00010 1, or (at your option) any later version.
00011 
00012 GDB, GAS, and the GNU binutils are distributed in the hope that they
00013 will be useful, but WITHOUT ANY WARRANTY; without even the implied
00014 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
00015 the GNU General Public License for more details.
00016 
00017 You should have received a copy of the GNU General Public License
00018 along with this file; see the file COPYING.  If not, write to the Free
00019 Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
00020 
00021 #ifndef _M68HC11_SIO_H
00022 #define _M68HC11_SIO_H
00023 
00029 
00039 extern inline void
00040 serial_init (void)
00041 {
00042   _io_ports[M6811_BAUD] = M6811_DEF_BAUD;
00043 
00044   /* Setup character format 1 start, 8-bits, 1 stop.  */
00045   _io_ports[M6811_SCCR1] = 0;
00046 
00047   /* Enable reciever and transmitter.  */
00048   _io_ports[M6811_SCCR2] = 0xc;
00049 }
00050 
00057 extern inline unsigned char
00058 serial_receive_pending (void)
00059 {
00060   return _io_ports[M6811_SCSR] & M6811_RDRF;
00061 }
00062 
00070 extern inline void
00071 serial_flush (void)
00072 {
00073   while (!(_io_ports[M6811_SCSR] & M6811_TDRE))
00074     cop_optional_reset ();
00075 }
00076 
00089 extern inline void
00090 serial_send (char c)
00091 {
00092   serial_flush ();
00093   _io_ports[M6811_SCDR] = c;
00094   _io_ports[M6811_SCCR2] |= M6811_TE;
00095 }
00096 
00107 extern inline unsigned char
00108 serial_recv (void)
00109 {
00110   while (!(_io_ports[M6811_SCSR] & M6811_RDRF))
00111     cop_optional_reset ();
00112 
00113   return _io_ports[M6811_SCDR];
00114 }
00115 
00118 #endif /* _M68HC11_SIO_H */
00119 

Description | Download | Table of Contents | Modules | Compound List | File List | Functions

    Last modified,
    Apr 16, 2001
[ Copying ]     [ Feedback to Stephane.Carrez@worldnet.fr ]