source: rtems/c/src/lib/libbsp/powerpc/dmv177/console/debugio.c @ de2b815

4.104.114.84.95
Last change on this file since de2b815 was 85f50b19, checked in by Joel Sherrill <joel.sherrill@…>, on 09/04/03 at 18:52:20

2003-09-04 Joel Sherrill <joel@…>

  • clock/clock.c, console/debugio.c, include/dmv170.h, startup/bspclean.c, startup/genpvec.c, startup/setvec.c, startup/vmeintr.c, timer/timer.c: URL for license changed.
  • Property mode set to 100644
File size: 2.6 KB
Line 
1/*
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.rtems.com/license/LICENSE.
23 *
24 *  $Id$
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
39extern console_data  Console_Port_Data[];
40extern 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
58void 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
91void 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
Note: See TracBrowser for help on using the repository browser.