Mercurial > ecos-v3_0-branch
annotate packages/hal/mips/jmr3904/current/src/plf_stub.c @ 2729:74dbf4c3f2e1 after-copyright-change-20090129
Update all copyright banners to reflect FSF ownership; fix and improve licence text.
| author | jlarmour |
|---|---|
| date | Thu, 29 Jan 2009 17:47:46 +0000 |
| parents | d2c90368aeef |
| children |
| rev | line source |
|---|---|
| 2 | 1 //============================================================================= |
| 2 // | |
| 3 // plf_stub.c | |
| 4 // | |
| 5 // Platform specific code for GDB stub support. | |
| 6 // | |
| 7 //============================================================================= | |
|
2729
74dbf4c3f2e1
Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents:
210
diff
changeset
|
8 // ####ECOSGPLCOPYRIGHTBEGIN#### |
|
74dbf4c3f2e1
Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents:
210
diff
changeset
|
9 // ------------------------------------------- |
|
74dbf4c3f2e1
Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents:
210
diff
changeset
|
10 // This file is part of eCos, the Embedded Configurable Operating System. |
|
74dbf4c3f2e1
Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents:
210
diff
changeset
|
11 // Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. |
|
208
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
76
diff
changeset
|
12 // |
|
2729
74dbf4c3f2e1
Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents:
210
diff
changeset
|
13 // eCos is free software; you can redistribute it and/or modify it under |
|
74dbf4c3f2e1
Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents:
210
diff
changeset
|
14 // the terms of the GNU General Public License as published by the Free |
|
74dbf4c3f2e1
Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents:
210
diff
changeset
|
15 // Software Foundation; either version 2 or (at your option) any later |
|
74dbf4c3f2e1
Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents:
210
diff
changeset
|
16 // version. |
|
208
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
76
diff
changeset
|
17 // |
|
2729
74dbf4c3f2e1
Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents:
210
diff
changeset
|
18 // eCos is distributed in the hope that it will be useful, but WITHOUT |
|
74dbf4c3f2e1
Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents:
210
diff
changeset
|
19 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
74dbf4c3f2e1
Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents:
210
diff
changeset
|
20 // FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
74dbf4c3f2e1
Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents:
210
diff
changeset
|
21 // for more details. |
|
208
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
76
diff
changeset
|
22 // |
|
2729
74dbf4c3f2e1
Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents:
210
diff
changeset
|
23 // You should have received a copy of the GNU General Public License |
|
74dbf4c3f2e1
Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents:
210
diff
changeset
|
24 // along with eCos; if not, write to the Free Software Foundation, Inc., |
|
74dbf4c3f2e1
Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents:
210
diff
changeset
|
25 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
|
208
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
76
diff
changeset
|
26 // |
|
2729
74dbf4c3f2e1
Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents:
210
diff
changeset
|
27 // As a special exception, if other files instantiate templates or use |
|
74dbf4c3f2e1
Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents:
210
diff
changeset
|
28 // macros or inline functions from this file, or you compile this file |
|
74dbf4c3f2e1
Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents:
210
diff
changeset
|
29 // and link it with other works to produce a work based on this file, |
|
74dbf4c3f2e1
Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents:
210
diff
changeset
|
30 // this file does not by itself cause the resulting work to be covered by |
|
74dbf4c3f2e1
Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents:
210
diff
changeset
|
31 // the GNU General Public License. However the source code for this file |
|
74dbf4c3f2e1
Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents:
210
diff
changeset
|
32 // must still be made available in accordance with section (3) of the GNU |
|
74dbf4c3f2e1
Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents:
210
diff
changeset
|
33 // General Public License v2. |
|
208
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
76
diff
changeset
|
34 // |
|
2729
74dbf4c3f2e1
Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents:
210
diff
changeset
|
35 // This exception does not invalidate any other reasons why a work based |
|
74dbf4c3f2e1
Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents:
210
diff
changeset
|
36 // on this file might be covered by the GNU General Public License. |
|
74dbf4c3f2e1
Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents:
210
diff
changeset
|
37 // ------------------------------------------- |
|
74dbf4c3f2e1
Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents:
210
diff
changeset
|
38 // ####ECOSGPLCOPYRIGHTEND#### |
| 2 | 39 //============================================================================= |
| 40 //#####DESCRIPTIONBEGIN#### | |
| 41 // | |
| 42 // Author(s): nickg, jskov (based on the old tx39 hal_stub.c) | |
| 43 // Contributors:nickg, jskov | |
| 44 // Date: 1999-02-12 | |
| 45 // Purpose: Platform specific code for GDB stub support. | |
| 46 // | |
| 47 //####DESCRIPTIONEND#### | |
| 48 // | |
| 49 //============================================================================= | |
| 50 | |
| 51 #include <pkgconf/hal.h> | |
| 52 | |
| 53 #ifdef CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS | |
| 54 | |
| 55 #include <cyg/hal/hal_stub.h> | |
| 56 | |
| 57 #include <cyg/hal/hal_io.h> // HAL IO macros | |
| 58 #include <cyg/hal/hal_diag.h> // diag output. FIXME | |
| 59 | |
| 60 //----------------------------------------------------------------------------- | |
| 61 // Serial definitions. | |
| 62 #define DIAG_BASE 0xfffff300 | |
| 63 #define DIAG_SLCR (DIAG_BASE+0x00) | |
| 64 #define DIAG_SLSR (DIAG_BASE+0x04) | |
| 65 #define DIAG_SLDICR (DIAG_BASE+0x08) | |
| 66 #define DIAG_SLDISR (DIAG_BASE+0x0C) | |
| 67 #define DIAG_SFCR (DIAG_BASE+0x10) | |
| 68 #define DIAG_SBRG (DIAG_BASE+0x14) | |
| 69 #define DIAG_TFIFO (DIAG_BASE+0x20) | |
| 70 #define DIAG_RFIFO (DIAG_BASE+0x30) | |
| 71 | |
| 72 #define BRG_T0 0x0000 | |
| 73 #define BRG_T2 0x0100 | |
| 74 #define BRG_T4 0x0200 | |
| 75 #define BRG_T5 0x0300 | |
| 76 | |
| 77 //----------------------------------------------------------------------------- | |
| 78 | |
| 79 // Initialize the current serial port. | |
| 80 void hal_jmr_init_serial( void ) | |
| 81 { | |
| 82 //hal_diag_led(0x10); | |
| 83 HAL_WRITE_UINT16( DIAG_SLCR , 0x0020 ); | |
| 84 | |
| 85 HAL_WRITE_UINT16( DIAG_SLDICR , 0x0000 ); | |
| 86 | |
| 87 HAL_WRITE_UINT16( DIAG_SFCR , 0x0000 ); | |
| 88 | |
| 89 // HAL_WRITE_UINT16( DIAG_SBRG , BRG_T2 | 20 ); | |
| 90 // HAL_WRITE_UINT16( DIAG_SBRG , BRG_T2 | 10 ); | |
| 91 HAL_WRITE_UINT16( DIAG_SBRG , BRG_T2 | 5 ); | |
| 92 | |
| 93 //hal_diag_led(0x10); | |
| 94 } | |
| 95 | |
| 96 // Write C to the current serial port. | |
| 97 void hal_jmr_put_char( int c ) | |
| 98 { | |
| 99 CYG_WORD16 disr; | |
| 100 | |
| 101 //hal_diag_led(0x20); | |
| 102 | |
| 103 for(;;) | |
| 104 { | |
| 105 HAL_READ_UINT16( DIAG_SLDISR , disr ); | |
| 106 | |
| 107 if( disr & 0x0002 ) break; | |
| 108 } | |
| 109 | |
| 110 disr = disr & ~0x0002; | |
| 111 | |
| 112 HAL_WRITE_UINT8( DIAG_TFIFO, c ); | |
| 113 | |
| 114 HAL_WRITE_UINT16( DIAG_SLDISR , disr ); | |
| 115 | |
| 116 //hal_diag_led(0x20); | |
| 117 // HAL_DIAG_WRITE_CHAR( c ); | |
| 118 } | |
| 119 | |
| 120 // Read one character from the current serial port. | |
| 121 int hal_jmr_get_char( void ) | |
| 122 { | |
|
76
435cced73e2f
eCos v1.3.1 merged from eCos master repository on 2000-03-27-23:22:51-BST
jlarmour
parents:
66
diff
changeset
|
123 #ifdef CYGPKG_HAL_MIPS_SIM |
| 2 | 124 // FIXME: ask nickg if this can go to /dev/null |
| 125 static char input[] = "+$s#73"; | |
| 126 static int i = 0; | |
| 127 return input[i++]; | |
| 128 #else | |
| 129 char c; | |
| 130 | |
| 131 CYG_WORD16 disr; | |
| 132 | |
| 133 //hal_diag_led(0x40); | |
| 134 for(;;) | |
| 135 { | |
| 136 | |
| 137 HAL_READ_UINT16( DIAG_SLDISR , disr ); | |
| 138 | |
| 139 if( disr & 0x0001 ) break; | |
| 140 } | |
| 141 | |
| 142 disr = disr & ~0x0001; | |
| 143 | |
| 144 HAL_READ_UINT8( DIAG_RFIFO, c ); | |
| 145 | |
| 146 HAL_WRITE_UINT16( DIAG_SLDISR , disr ); | |
| 147 | |
| 148 //hal_diag_led(0x40); | |
| 149 | |
| 150 // HAL_DIAG_READ_CHAR(c); | |
| 151 // diag_printf("<%02x:%c>",c); | |
| 152 | |
| 153 return c; | |
| 154 | |
| 155 #endif | |
| 156 } | |
| 157 | |
| 158 #endif // ifdef CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS | |
| 159 //----------------------------------------------------------------------------- | |
| 160 // End of plf_stub.c |
