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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [ecos-3.0/] [packages/] [hal/] [sparclite/] [sleb/] [current/] [include/] [hal_diag.h] - Blame information for rev 856

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

Line No. Rev Author Line
1 786 skrzyp
#ifndef CYGONCE_HAL_HAL_DIAG_H
2
#define CYGONCE_HAL_HAL_DIAG_H
3
 
4
/*=============================================================================
5
//
6
//      hal_diag.h
7
//
8
//      HAL Support for Kernel Diagnostic Routines
9
//
10
//=============================================================================
11
// ####ECOSGPLCOPYRIGHTBEGIN####
12
// -------------------------------------------
13
// This file is part of eCos, the Embedded Configurable Operating System.
14
// Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
15
//
16
// eCos is free software; you can redistribute it and/or modify it under
17
// the terms of the GNU General Public License as published by the Free
18
// Software Foundation; either version 2 or (at your option) any later
19
// version.
20
//
21
// eCos is distributed in the hope that it will be useful, but WITHOUT
22
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
23
// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
24
// for more details.
25
//
26
// You should have received a copy of the GNU General Public License
27
// along with eCos; if not, write to the Free Software Foundation, Inc.,
28
// 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
29
//
30
// As a special exception, if other files instantiate templates or use
31
// macros or inline functions from this file, or you compile this file
32
// and link it with other works to produce a work based on this file,
33
// this file does not by itself cause the resulting work to be covered by
34
// the GNU General Public License. However the source code for this file
35
// must still be made available in accordance with section (3) of the GNU
36
// General Public License v2.
37
//
38
// This exception does not invalidate any other reasons why a work based
39
// on this file might be covered by the GNU General Public License.
40
// -------------------------------------------
41
// ####ECOSGPLCOPYRIGHTEND####
42
//=============================================================================
43
//#####DESCRIPTIONBEGIN####
44
//
45
// Author(s):   hmt
46
// Contributors:        hmt
47
// Date:        1999-01-11
48
// Purpose:     HAL Support for Kernel Diagnostic Routines
49
// Description: Diagnostic routines for use during kernel development.
50
// Usage:       #include <cyg/hal/hal_diag.h>
51
//
52
//####DESCRIPTIONEND####
53
//
54
//===========================================================================*/
55
 
56
#include <pkgconf/system.h>
57
#include <pkgconf/hal.h>
58
#include <pkgconf/hal_sparclite.h>
59
#include <pkgconf/hal_sparclite_sleb.h>
60
 
61
#include <cyg/infra/cyg_type.h>
62
 
63
#include <cyg/hal/hal_hwio.h>
64
 
65
/*---------------------------------------------------------------------------*/
66
/* SPARClite Evaluation Board - SLEB - 86940 SDTR output (+ the LEDs)        */
67
 
68
#define SLEB_LED (*(volatile char *)(0x02000003))
69
 
70
#define SLEB_86940_SDTR0_OUT
71
#ifdef  SLEB_86940_SDTR0_OUT
72
 
73
 
74
#define HAL_SPARC_86940_FLAG_TXRDY  (0x01)
75
#define HAL_SPARC_86940_FLAG_RXRDY  (0x02)
76
 
77
#define HAL_DIAG_WRITE_CHAR_DIRECT(_c_) CYG_MACRO_START                     \
78
    cyg_uint32 status = 0;                                                  \
79
    while ( 0 == (HAL_SPARC_86940_FLAG_TXRDY & status) ) {                  \
80
        HAL_SPARC_86940_SDTR0_STAT_READ( status );                          \
81
    }                                                                       \
82
    HAL_SPARC_86940_SDTR0_TXDATA_WRITE( _c_ );                              \
83
CYG_MACRO_END
84
 
85
#define HAL_DIAG_WRITE_CHAR_WAIT_FOR_EMPTY() CYG_MACRO_START                \
86
    cyg_uint32 status = HAL_SPARC_86940_FLAG_TXRDY;                         \
87
    while ( 0 != (HAL_SPARC_86940_FLAG_TXRDY & status) ) {                  \
88
        HAL_SPARC_86940_SDTR0_STAT_READ( status );                          \
89
    }                                                                       \
90
CYG_MACRO_END
91
 
92
 
93
 
94
#ifdef CYG_KERNEL_DIAG_GDB
95
// then use routines from hal_diag.c:
96
 
97
externC void hal_diag_init(void);
98
externC void hal_diag_write_char(char c);
99
#define HAL_DIAG_INIT() hal_diag_init()
100
#define HAL_DIAG_WRITE_CHAR(_c_) CYG_MACRO_START                    \
101
    SLEB_LED = (_c_); /* immediately */                             \
102
    hal_diag_write_char(_c_);                                       \
103
CYG_MACRO_END
104
 
105
 
106
#else // CYG_KERNEL_DIAG_GDB
107
// else go to the serial line directly (after initialization):
108
 
109
externC void hal_diag_init(void);
110
#define HAL_DIAG_INIT() hal_diag_init()
111
 
112
#define HAL_DIAG_WRITE_CHAR(_c_) CYG_MACRO_START                    \
113
    SLEB_LED = (_c_);                                               \
114
    HAL_DIAG_WRITE_CHAR_DIRECT( _c_ );                              \
115
CYG_MACRO_END
116
 
117
#endif // CYG_KERNEL_DIAG_GDB
118
 
119
 
120
 
121
#define HAL_DIAG_READ_CHAR(_c_) (_c_) = 0
122
 
123
 
124
#else
125
/*---------------------------------------------------------------------------*/
126
/* SPARClite Evaluation Board - SLEB - Just use the LEDs on board            */
127
 
128
#define HAL_DIAG_INIT()
129
 
130
#define HAL_DIAG_WRITE_CHAR(_c_) CYG_MACRO_START                            \
131
      SLEB_LED = (_c_);                                                     \
132
CYG_MACRO_END
133
 
134
#define HAL_DIAG_READ_CHAR(_c_) (_c_) = 0
135
 
136
 
137
#endif // SLEB_86940_SDTR0_OUT
138
 
139
/*---------------------------------------------------------------------------*/
140
/* end of hal_diag.h                                                         */
141
#endif /* CYGONCE_HAL_HAL_DIAG_H */

powered by: WebSVN 2.1.0

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