OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [freertos-6.1.1/] [Demo/] [HCS12_GCC_banked/] [asm-m68hcs12/] [sio.h] - Blame information for rev 867

Go to most recent revision | Details | Compare with Previous | View Log

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

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.