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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [rtems-20020807/] [c/] [src/] [lib/] [libbsp/] [powerpc/] [ppcn_60x/] [console/] [debugio.c] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1026 ivang
/*
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
 *
20
 *  The license and distribution terms for this file may be
21
 *  found in the file LICENSE in this distribution or at
22
 *  http://www.OARcorp.com/rtems/license.html.
23
 *
24
 *  debugio.c,v 1.2 2001/10/12 21:06:23 joel Exp
25
 */
26
 
27
#include <bsp.h>
28
#include <rtems/libio.h>
29
#include <stdlib.h>
30
#include <assert.h>
31
#include <termios.h>
32
 
33
#include <libchip/serial.h>
34
 
35
/*
36
 * Load configuration table
37
 */
38
 
39
extern console_data  Console_Port_Data[];
40
extern rtems_device_minor_number  Console_Port_Minor;
41
 
42
/* PAGE
43
 *
44
 *  DEBUG_puts
45
 *
46
 *  This should be safe in the event of an error.  It attempts to ensure
47
 *  that no TX empty interrupts occur while it is doing polled IO.  Then
48
 *  it restores the state of that external interrupt.
49
 *
50
 *  Input parameters:
51
 *    string  - pointer to debug output string
52
 *
53
 *  Output parameters:  NONE
54
 *
55
 *  Return values:      NONE
56
 */
57
 
58
void DEBUG_puts(
59
  char *string
60
)
61
{
62
  char *s;
63
  unsigned32  Irql;
64
 
65
  rtems_interrupt_disable(Irql);
66
 
67
  for ( s = string ; *s ; s++ ) {
68
    Console_Port_Tbl[Console_Port_Minor].pDeviceFns->
69
      deviceWritePolled(Console_Port_Minor, *s);
70
  }
71
 
72
  rtems_interrupt_enable(Irql);
73
}
74
 
75
/* PAGE
76
 *
77
 *  DEBUG_puth
78
 *
79
 *  This should be safe in the event of an error.  It attempts to ensure
80
 *  that no TX empty interrupts occur while it is doing polled IO.  Then
81
 *  it restores the state of that external interrupt.
82
 *
83
 *  Input parameters:
84
 *    ulHexNum - value to display
85
 *
86
 *  Output parameters:  NONE
87
 *
88
 *  Return values:      NONE
89
 */
90
 
91
void DEBUG_puth(
92
  unsigned32 ulHexNum
93
)
94
{
95
  unsigned long  i,d;
96
  unsigned32      Irql;
97
  void          (*poll)(int minor, char cChar);
98
 
99
  poll = Console_Port_Tbl[Console_Port_Minor].pDeviceFns->deviceWritePolled;
100
 
101
  rtems_interrupt_disable(Irql);
102
 
103
    (*poll)(Console_Port_Minor, '0');
104
    (*poll)(Console_Port_Minor, 'x');
105
 
106
    for ( i=32 ; i ; ) {
107
      i -= 4;
108
      d  = (ulHexNum>>i)&0xf;
109
      (*poll)(Console_Port_Minor, (d<=9) ? d+'0' : d+'a'-0xa);
110
    }
111
  rtems_interrupt_enable(Irql);
112
}
113
 

powered by: WebSVN 2.1.0

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