1 |
27 |
unneback |
//=============================================================================
|
2 |
|
|
//
|
3 |
|
|
// hal_diag.c
|
4 |
|
|
//
|
5 |
|
|
// HAL diagnostic output code
|
6 |
|
|
//
|
7 |
|
|
//=============================================================================
|
8 |
|
|
//####UNSUPPORTEDBEGIN####
|
9 |
|
|
//
|
10 |
|
|
// -------------------------------------------
|
11 |
|
|
// This source file has been contributed to eCos/Red Hat. It may have been
|
12 |
|
|
// changed slightly to provide an interface consistent with those of other
|
13 |
|
|
// files.
|
14 |
|
|
//
|
15 |
|
|
// The functionality and contents of this file is supplied "AS IS"
|
16 |
|
|
// without any form of support and will not necessarily be kept up
|
17 |
|
|
// to date by Red Hat.
|
18 |
|
|
//
|
19 |
|
|
// All inquiries about this file, or the functionality provided by it,
|
20 |
|
|
// should be directed to the 'ecos-discuss' mailing list (see
|
21 |
|
|
// http://sourceware.cygnus.com/ecos/intouch.html for details).
|
22 |
|
|
//
|
23 |
|
|
// Contributed by: Kevin Hester <khester@opticworks.com>
|
24 |
|
|
// Maintained by: <Unmaintained>
|
25 |
|
|
// -------------------------------------------
|
26 |
|
|
//
|
27 |
|
|
//####UNSUPPORTEDEND####
|
28 |
|
|
//=============================================================================
|
29 |
|
|
//####ECOSGPLCOPYRIGHTBEGIN####
|
30 |
|
|
// -------------------------------------------
|
31 |
|
|
// This file is part of eCos, the Embedded Configurable Operating System.
|
32 |
|
|
// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
|
33 |
|
|
//
|
34 |
|
|
// eCos is free software; you can redistribute it and/or modify it under
|
35 |
|
|
// the terms of the GNU General Public License as published by the Free
|
36 |
|
|
// Software Foundation; either version 2 or (at your option) any later version.
|
37 |
|
|
//
|
38 |
|
|
// eCos is distributed in the hope that it will be useful, but WITHOUT ANY
|
39 |
|
|
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
40 |
|
|
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
41 |
|
|
// for more details.
|
42 |
|
|
//
|
43 |
|
|
// You should have received a copy of the GNU General Public License along
|
44 |
|
|
// with eCos; if not, write to the Free Software Foundation, Inc.,
|
45 |
|
|
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
|
46 |
|
|
//
|
47 |
|
|
// As a special exception, if other files instantiate templates or use macros
|
48 |
|
|
// or inline functions from this file, or you compile this file and link it
|
49 |
|
|
// with other works to produce a work based on this file, this file does not
|
50 |
|
|
// by itself cause the resulting work to be covered by the GNU General Public
|
51 |
|
|
// License. However the source code for this file must still be made available
|
52 |
|
|
// in accordance with section (3) of the GNU General Public License.
|
53 |
|
|
//
|
54 |
|
|
// This exception does not invalidate any other reasons why a work based on
|
55 |
|
|
// this file might be covered by the GNU General Public License.
|
56 |
|
|
//
|
57 |
|
|
// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
|
58 |
|
|
// at http://sources.redhat.com/ecos/ecos-license/
|
59 |
|
|
// -------------------------------------------
|
60 |
|
|
//####ECOSGPLCOPYRIGHTEND####
|
61 |
|
|
//=============================================================================
|
62 |
|
|
//#####DESCRIPTIONBEGIN####
|
63 |
|
|
//
|
64 |
|
|
// Author(s): nickg, jskov
|
65 |
|
|
// Contributors:nickg
|
66 |
|
|
// Date: 1998-03-02
|
67 |
|
|
// Purpose: HAL diagnostic output
|
68 |
|
|
// Description: Implementations of HAL diagnostic output support.
|
69 |
|
|
//
|
70 |
|
|
//####DESCRIPTIONEND####
|
71 |
|
|
//
|
72 |
|
|
//=============================================================================
|
73 |
|
|
|
74 |
|
|
#include <pkgconf/hal.h>
|
75 |
|
|
|
76 |
|
|
#ifndef CYGSEM_HAL_VIRTUAL_VECTOR_DIAG
|
77 |
|
|
|
78 |
|
|
#include <cyg/infra/cyg_type.h> // base types
|
79 |
|
|
#include <cyg/infra/cyg_trac.h> // tracing macros
|
80 |
|
|
#include <cyg/infra/cyg_ass.h> // assertion macros
|
81 |
|
|
|
82 |
|
|
#include <cyg/hal/hal_io.h> // IO macros
|
83 |
|
|
#include <cyg/hal/hal_diag.h>
|
84 |
|
|
#include <cyg/hal/hal_intr.h> // Interrupt macros
|
85 |
|
|
|
86 |
|
|
#if defined(CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS)
|
87 |
|
|
#include <cyg/hal/hal_stub.h> // hal_output_gdb_string
|
88 |
|
|
#endif
|
89 |
|
|
|
90 |
|
|
#include <cyg/hal/ppc_regs.h>
|
91 |
|
|
#include <cyg/hal/quicc_smc2.h>
|
92 |
|
|
|
93 |
|
|
//-----------------------------------------------------------------------------
|
94 |
|
|
// Select default diag channel to use
|
95 |
|
|
|
96 |
|
|
//#define CYG_KERNEL_DIAG_ROMART
|
97 |
|
|
//#define CYG_KERNEL_DIAG_SERIAL
|
98 |
|
|
|
99 |
|
|
#if !defined(CYG_KERNEL_DIAG_SERIAL)
|
100 |
|
|
#define CYG_KERNEL_DIAG_SERIAL
|
101 |
|
|
#endif
|
102 |
|
|
|
103 |
|
|
//-----------------------------------------------------------------------------
|
104 |
|
|
// Fads board specific serial
|
105 |
|
|
|
106 |
|
|
#if defined(CYG_KERNEL_DIAG_SERIAL)
|
107 |
|
|
|
108 |
|
|
void hal_diag_init(void)
|
109 |
|
|
{
|
110 |
|
|
#if !defined(CYGDBG_KERNEL_DEBUG_GDB_INCLUDE_STUBS)
|
111 |
|
|
// init the actual serial port
|
112 |
|
|
cyg_smc2_init(9600);
|
113 |
|
|
#endif
|
114 |
|
|
}
|
115 |
|
|
|
116 |
|
|
void hal_diag_write_char(char c)
|
117 |
|
|
{
|
118 |
|
|
#if !defined(CYGDBG_KERNEL_DEBUG_GDB_INCLUDE_STUBS)
|
119 |
|
|
unsigned long __state;
|
120 |
|
|
HAL_DISABLE_INTERRUPTS(__state);
|
121 |
|
|
cyg_smc2_putchar(c);
|
122 |
|
|
HAL_RESTORE_INTERRUPTS(__state);
|
123 |
|
|
#else
|
124 |
|
|
hal_output_gdb_string (&c, 1);
|
125 |
|
|
#endif
|
126 |
|
|
}
|
127 |
|
|
|
128 |
|
|
void hal_diag_read_char(char *c)
|
129 |
|
|
{
|
130 |
|
|
*c = cyg_smc2_getchar();
|
131 |
|
|
}
|
132 |
|
|
#endif
|
133 |
|
|
|
134 |
|
|
#endif // CYGSEM_HAL_VIRTUAL_VECTOR_DIAG
|