OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [trunk/] [rtos/] [rtems/] [c/] [src/] [lib/] [libbsp/] [powerpc/] [dmv177/] [console/] [debugio.c] - Blame information for rev 173

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 30 unneback
/*
2
 *  This file contains the debug IO support.
3
 *
4
 *  COPYRIGHT (c) 1998 by Radstone Technology
5
 *
6
 *
7
 * THIS FILE IS PROVIDED TO YOU, THE USER, "AS IS", WITHOUT WARRANTY OF ANY
8
 * KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
9
 * IMPLIED WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK
10
 * AS TO THE QUALITY AND PERFORMANCE OF ALL CODE IN THIS FILE IS WITH YOU.
11
 *
12
 * You are hereby granted permission to use, copy, modify, and distribute
13
 * this file, provided that this notice, plus the above copyright notice
14
 * and disclaimer, appears in all copies. Radstone Technology will provide
15
 * no support for this code.
16
 *
17
 *  COPYRIGHT (c) 1989-1997.
18
 *  On-Line Applications Research Corporation (OAR).
19
 *  Copyright assigned to U.S. Government, 1994.
20
 *
21
 *  The license and distribution terms for this file may be
22
 *  found in the file LICENSE in this distribution or at
23
 *  http://www.OARcorp.com/rtems/license.html.
24
 *
25
 *  $Id: debugio.c,v 1.2 2001-09-27 12:00:32 chris Exp $
26
 */
27
 
28
#include <bsp.h>
29
#include <rtems/libio.h>
30
#include <stdlib.h>
31
#include <assert.h>
32
#include <termios.h>
33
 
34
#include <libchip/serial.h>
35
 
36
/*
37
 * Load configuration table
38
 */
39
 
40
extern console_data  Console_Port_Data[];
41
extern rtems_device_minor_number  Console_Port_Minor;
42
 
43
/* PAGE
44
 *
45
 *  DEBUG_puts
46
 *
47
 *  This should be safe in the event of an error.  It attempts to ensure
48
 *  that no TX empty interrupts occur while it is doing polled IO.  Then
49
 *  it restores the state of that external interrupt.
50
 *
51
 *  Input parameters:
52
 *    string  - pointer to debug output string
53
 *
54
 *  Output parameters:  NONE
55
 *
56
 *  Return values:      NONE
57
 */
58
 
59
void DEBUG_puts(
60
  char *string
61
)
62
{
63
  char *s;
64
  unsigned32  Irql;
65
 
66
  rtems_interrupt_disable(Irql);
67
 
68
  for ( s = string ; *s ; s++ ) {
69
    Console_Port_Tbl[Console_Port_Minor].pDeviceFns->
70
      deviceWritePolled(Console_Port_Minor, *s);
71
  }
72
 
73
  rtems_interrupt_enable(Irql);
74
}
75
 
76
/* PAGE
77
 *
78
 *  DEBUG_puth
79
 *
80
 *  This should be safe in the event of an error.  It attempts to ensure
81
 *  that no TX empty interrupts occur while it is doing polled IO.  Then
82
 *  it restores the state of that external interrupt.
83
 *
84
 *  Input parameters:
85
 *    ulHexNum - value to display
86
 *
87
 *  Output parameters:  NONE
88
 *
89
 *  Return values:      NONE
90
 */
91
 
92
void DEBUG_puth(
93
  unsigned32 ulHexNum
94
)
95
{
96
  unsigned long  i,d;
97
  unsigned32      Irql;
98
  void          (*poll)(int minor, char cChar);
99
 
100
  poll = Console_Port_Tbl[Console_Port_Minor].pDeviceFns->deviceWritePolled;
101
 
102
  rtems_interrupt_disable(Irql);
103
 
104
    (*poll)(Console_Port_Minor, '0');
105
    (*poll)(Console_Port_Minor, 'x');
106
 
107
    for ( i=32 ; i ; ) {
108
      i -= 4;
109
      d  = (ulHexNum>>i)&0xf;
110
      (*poll)(Console_Port_Minor, (d<=9) ? d+'0' : d+'a'-0xa);
111
    }
112
  rtems_interrupt_enable(Irql);
113
}
114
 

powered by: WebSVN 2.1.0

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