1 |
786 |
skrzyp |
#ifndef CYGONCE_HAL_DIAG_H
|
2 |
|
|
#define CYGONCE_HAL_DIAG_H
|
3 |
|
|
|
4 |
|
|
/*=============================================================================
|
5 |
|
|
//
|
6 |
|
|
// hal_diag.h
|
7 |
|
|
//
|
8 |
|
|
// MCFxxxx 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) 2003, 2006, 2008 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): bartv
|
46 |
|
|
// Date: 2003-06-04
|
47 |
|
|
//
|
48 |
|
|
//####DESCRIPTIONEND####
|
49 |
|
|
//===========================================================================*/
|
50 |
|
|
|
51 |
|
|
#include <pkgconf/hal.h>
|
52 |
|
|
#include <pkgconf/hal_m68k_mcfxxxx.h>
|
53 |
|
|
#include <cyg/infra/cyg_type.h>
|
54 |
|
|
#include <cyg/hal/hal_io.h>
|
55 |
|
|
#include <cyg/hal/hal_intr.h>
|
56 |
|
|
#include <cyg/hal/hal_if.h>
|
57 |
|
|
|
58 |
|
|
// On most ColdFire platforms the mcfxxxx variant HAL provides the HAL
|
59 |
|
|
// diagnostics support via a UART. The
|
60 |
|
|
// CYGINT_HAL_M68K_MCFxxxx_DIAGNOSTICS_USE_DEFAULT interface
|
61 |
|
|
// enables this.
|
62 |
|
|
#if defined(CYGSEM_HAL_VIRTUAL_VECTOR_DIAG) && !defined(CYGSEM_HAL_VIRTUAL_VECTOR_CLAIM_COMMS)
|
63 |
|
|
# include <cyg/hal/hal_if.h>
|
64 |
|
|
# define HAL_DIAG_INIT() hal_if_diag_init()
|
65 |
|
|
# define HAL_DIAG_WRITE_CHAR(_c_) hal_if_diag_write_char(_c_)
|
66 |
|
|
# define HAL_DIAG_READ_CHAR(_c_) hal_if_diag_read_char(&_c_)
|
67 |
|
|
|
68 |
|
|
#elif !defined(CYGINT_HAL_M68K_MCFxxxx_DIAGNOSTICS_USE_DEFAULT)
|
69 |
|
|
// Allow the platform HAL to provide the diagnostics channel.
|
70 |
|
|
# include <cyg/hal/plf_diag.h>
|
71 |
|
|
#else
|
72 |
|
|
|
73 |
|
|
externC void hal_mcfxxxx_diag_uart_init(cyg_uint8*, cyg_uint32);
|
74 |
|
|
externC void hal_mcfxxxx_diag_uart_putc(void*, char c);
|
75 |
|
|
externC cyg_uint8 hal_mcfxxxx_diag_uart_getc(void*);
|
76 |
|
|
|
77 |
|
|
# if defined(CYGHWR_HAL_M68K_MCFxxxx_DIAGNOSTICS_PORT_uart0)
|
78 |
|
|
# define _HAL_MCFxxxx_DIAG_UART_BASE_ HAL_MCFxxxx_UART0_BASE
|
79 |
|
|
# define _HAL_MCFxxxx_DIAG_UART_ISRVEC_ CYGNUM_HAL_ISR_UART0
|
80 |
|
|
# elif defined(CYGHWR_HAL_M68K_MCFxxxx_DIAGNOSTICS_PORT_uart1)
|
81 |
|
|
# define _HAL_MCFxxxx_DIAG_UART_BASE_ HAL_MCFxxxx_UART1_BASE
|
82 |
|
|
# define _HAL_MCFxxxx_DIAG_UART_ISRVEC_ CYGNUM_HAL_ISR_UART1
|
83 |
|
|
# elif defined(CYGHWR_HAL_M68K_MCFxxxx_DIAGNOSTICS_PORT_uart2)
|
84 |
|
|
# define _HAL_MCFxxxx_DIAG_UART_BASE_ HAL_MCFxxxx_UART2_BASE
|
85 |
|
|
# define _HAL_MCFxxxx_DIAG_UART_ISRVEC_ CYGNUM_HAL_ISR_UART2
|
86 |
|
|
# else
|
87 |
|
|
# error Diagnostics channel UART base not defined.
|
88 |
|
|
# endif
|
89 |
|
|
|
90 |
|
|
// Even if the standard diagnostics facilities are enabled, allow the
|
91 |
|
|
// platform HAL to override things.
|
92 |
|
|
# ifndef HAL_DIAG_INIT
|
93 |
|
|
# define HAL_DIAG_INIT() \
|
94 |
|
|
CYG_MACRO_START \
|
95 |
|
|
hal_mcfxxxx_diag_uart_init((cyg_uint8*) (_HAL_MCFxxxx_DIAG_UART_BASE_), \
|
96 |
|
|
CYGNUM_HAL_M68K_MCFxxxx_DIAGNOSTICS_BAUD); \
|
97 |
|
|
CYG_MACRO_END
|
98 |
|
|
# endif
|
99 |
|
|
|
100 |
|
|
# ifndef HAL_DIAG_WRITE_CHAR
|
101 |
|
|
# define HAL_DIAG_WRITE_CHAR(_c_) \
|
102 |
|
|
CYG_MACRO_START \
|
103 |
|
|
hal_mcfxxxx_diag_uart_putc((void*)_HAL_MCFxxxx_DIAG_UART_BASE_, _c_); \
|
104 |
|
|
CYG_MACRO_END
|
105 |
|
|
# endif
|
106 |
|
|
|
107 |
|
|
# ifndef HAL_DIAG_READ_CHAR
|
108 |
|
|
# define HAL_DIAG_READ_CHAR(_c_) \
|
109 |
|
|
CYG_MACRO_START \
|
110 |
|
|
(_c_) = hal_mcfxxxx_diag_uart_getc((void*)(_HAL_MCFxxxx_DIAG_UART_BASE_)); \
|
111 |
|
|
CYG_MACRO_END
|
112 |
|
|
# endif
|
113 |
|
|
|
114 |
|
|
#endif // VV/MCFxxxx_DIAGNOSTICS
|
115 |
|
|
|
116 |
|
|
#endif /* CYGONCE_HAL_DIAG_H */
|