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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [newlib-1.17.0/] [libgloss/] [m68k/] [idp-inbyte.c] - Blame information for rev 295

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

Line No. Rev Author Line
1 148 jeremybenn
/* idp-inbyte.c --
2
 * Copyright (c) 1995 Cygnus Support
3
 *
4
 * The authors hereby grant permission to use, copy, modify, distribute,
5
 * and license this software and its documentation for any purpose, provided
6
 * that existing copyright notices are retained in all copies and that this
7
 * notice is included verbatim in any distributions. No written agreement,
8
 * license, or royalty fee is required for any of the authorized uses.
9
 * Modifications to this software may be copyrighted by their authors
10
 * and need not follow the licensing terms described here, provided that
11
 * the new terms are clearly indicated on the first page of each file where
12
 * they apply.
13
 */
14
 
15
#include <_ansi.h>
16
#include "mc68681reg.h"
17
 
18
/*
19
 * The DUART is mapped into the IDP address space in an unusual
20
 * manner.  The mc68681 is an 8 bit device located on the least
21
 * significant byte (byte0) of the data bus.  Bytes 3, 2, and
22
 * one have nothing in them and writes to these locations are
23
 * not valid.
24
 */
25
 
26
#define DUART_ADDR      0x00B00000
27
#define READREG(x)      (*((volatile char *) DUART_ADDR + (x * 4) + 3))
28
#define WRITEREG(x, y)  (*((char *) DUART_ADDR + (x * 4) + 3) = y)
29
 
30
/*
31
 * inbyte -- get a byte from the DUART RX buffer. This only reads
32
 *           from channel A
33
 */
34
char
35
_DEFUN_VOID (inbyte)
36
{
37
  while ((READREG (DUART_SRA) & 0x01) == 0x00)
38
    ;
39
 
40
  return (READREG (DUART_RBA));         /* read the byte */
41
}

powered by: WebSVN 2.1.0

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