|
0
|
1 #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 //####COPYRIGHTBEGIN#### |
|
|
12 // |
|
|
13 // ------------------------------------------- |
|
|
14 // The contents of this file are subject to the Cygnus eCos Public License |
|
|
15 // Version 1.0 (the "License"); you may not use this file except in |
|
|
16 // compliance with the License. You may obtain a copy of the License at |
|
|
17 // http://sourceware.cygnus.com/ecos |
|
|
18 // |
|
|
19 // Software distributed under the License is distributed on an "AS IS" |
|
|
20 // basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the |
|
|
21 // License for the specific language governing rights and limitations under |
|
|
22 // the License. |
|
|
23 // |
|
|
24 // The Original Code is eCos - Embedded Cygnus Operating System, released |
|
|
25 // September 30, 1998. |
|
|
26 // |
|
|
27 // The Initial Developer of the Original Code is Cygnus. Portions created |
|
|
28 // by Cygnus are Copyright (C) 1998 Cygnus Solutions. All Rights Reserved. |
|
|
29 // ------------------------------------------- |
|
|
30 // |
|
|
31 //####COPYRIGHTEND#### |
|
|
32 //============================================================================= |
|
|
33 //#####DESCRIPTIONBEGIN#### |
|
|
34 // |
|
|
35 // Author(s): nickg |
|
|
36 // Contributors: nickg |
|
|
37 // Date: 1998-03-02 |
|
|
38 // Purpose: HAL Support for Kernel Diagnostic Routines |
|
|
39 // Description: Diagnostic routines for use during kernel development. |
|
|
40 // Usage: #include <cyg/hal/hal_diag.h> |
|
|
41 // |
|
|
42 //####DESCRIPTIONEND#### |
|
|
43 // |
|
|
44 //============================================================================= |
|
|
45 |
|
|
46 #include <pkgconf/hal.h> |
|
|
47 |
|
|
48 #include <cyg/infra/cyg_type.h> |
|
|
49 |
|
|
50 //----------------------------------------------------------------------------- |
|
|
51 // Register addresses |
|
|
52 |
|
|
53 #define PAL_RESET 0x00 |
|
|
54 #define PAL_CPU_NR 0x04 |
|
|
55 #define PAL_INT 0x08 |
|
|
56 #define PAL_NR_CPU 0x0a |
|
|
57 |
|
|
58 #define PAL_READ_FIFO 0x10 |
|
|
59 #define PAL_READ_STATUS 0x14 |
|
|
60 #define PAL_WRITE_FIFO 0x18 |
|
|
61 #define PAL_WRITE_STATUS 0x1a |
|
|
62 |
|
|
63 #define OEA_DEV 0xf0001000 |
|
|
64 |
|
|
65 //----------------------------------------------------------------------------- |
|
|
66 |
|
|
67 #define HAL_DIAG_INIT() |
|
|
68 |
|
|
69 #define HAL_DIAG_WRITE_CHAR(_c_) \ |
|
|
70 { \ |
|
|
71 volatile unsigned char *tty_buffer = \ |
|
|
72 (unsigned char*)(OEA_DEV + PAL_WRITE_FIFO); \ |
|
|
73 volatile unsigned char *tty_status = \ |
|
|
74 (unsigned char*)(OEA_DEV + PAL_WRITE_STATUS); \ |
|
|
75 if( _c_ != '\r' ) \ |
|
|
76 { \ |
|
|
77 while( *tty_status == 0 ) continue; \ |
|
|
78 *tty_buffer = _c_; \ |
|
|
79 } \ |
|
|
80 } |
|
|
81 |
|
|
82 #define HAL_DIAG_READ_CHAR(_c_) \ |
|
|
83 { \ |
|
|
84 volatile unsigned char *tty_buffer = \ |
|
|
85 (unsigned char*)(OEA_DEV + PAL_READ_FIFO); \ |
|
|
86 volatile unsigned char *tty_status = \ |
|
|
87 (unsigned char*)(OEA_DEV + PAL_READ_STATUS); \ |
|
|
88 while( *tty_status == 0 ) continue; \ |
|
|
89 _c_ = *tty_buffer; \ |
|
|
90 } |
|
|
91 |
|
|
92 //----------------------------------------------------------------------------- |
|
|
93 // end of hal_diag.h |
|
|
94 #endif // CYGONCE_HAL_HAL_DIAG_H |