Mercurial > ecos-v3_0-branch
annotate packages/hal/powerpc/adder/current/src/hal_aux.c @ 2863:7d8c61e6225c default tip
* Added execute permissions to files missed in conversion from CVS
| author | alexs |
|---|---|
| date | Thu, 26 Mar 2009 20:39:18 +0000 |
| parents | 74dbf4c3f2e1 |
| children |
| rev | line source |
|---|---|
| 432 | 1 //============================================================================= |
| 2 // | |
| 3 // hal_aux.c | |
| 4 // | |
| 5 // HAL auxiliary objects and code; per platform | |
| 6 // | |
| 7 //============================================================================= | |
|
2729
74dbf4c3f2e1
Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents:
1933
diff
changeset
|
8 // ####ECOSGPLCOPYRIGHTBEGIN#### |
|
74dbf4c3f2e1
Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents:
1933
diff
changeset
|
9 // ------------------------------------------- |
|
74dbf4c3f2e1
Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents:
1933
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:
1933
diff
changeset
|
11 // Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. |
| 432 | 12 // |
|
2729
74dbf4c3f2e1
Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents:
1933
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:
1933
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:
1933
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:
1933
diff
changeset
|
16 // version. |
| 432 | 17 // |
|
2729
74dbf4c3f2e1
Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents:
1933
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:
1933
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:
1933
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:
1933
diff
changeset
|
21 // for more details. |
| 432 | 22 // |
|
2729
74dbf4c3f2e1
Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents:
1933
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:
1933
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:
1933
diff
changeset
|
25 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
| 432 | 26 // |
|
2729
74dbf4c3f2e1
Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents:
1933
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:
1933
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:
1933
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:
1933
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:
1933
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:
1933
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:
1933
diff
changeset
|
33 // General Public License v2. |
| 432 | 34 // |
|
2729
74dbf4c3f2e1
Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents:
1933
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:
1933
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:
1933
diff
changeset
|
37 // ------------------------------------------- |
|
74dbf4c3f2e1
Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents:
1933
diff
changeset
|
38 // ####ECOSGPLCOPYRIGHTEND#### |
| 432 | 39 //============================================================================= |
| 40 //#####DESCRIPTIONBEGIN#### | |
| 41 // | |
| 42 // Author(s): hmt | |
| 43 // Contributors:hmt | |
| 44 // Date: 1999-06-08 | |
| 45 // Purpose: HAL aux objects: startup tables. | |
| 46 // Description: Tables for per-platform initialization | |
| 47 // | |
| 48 //####DESCRIPTIONEND#### | |
| 49 // | |
| 50 //============================================================================= | |
| 51 | |
| 52 #include <pkgconf/hal.h> | |
| 53 #include <pkgconf/hal_powerpc_quicc.h> | |
| 54 | |
| 55 #include <cyg/infra/cyg_type.h> | |
| 56 #include <cyg/hal/hal_mem.h> // HAL memory definitions | |
| 57 #define CYGARC_HAL_COMMON_EXPORT_CPU_MACROS | |
| 58 #include <cyg/hal/ppc_regs.h> | |
| 59 #include <cyg/hal/quicc/ppc8xx.h> | |
| 60 #include <cyg/hal/hal_if.h> // hal_if_init | |
| 61 #include <cyg/hal/hal_io.h> | |
| 62 #include CYGHWR_MEMORY_LAYOUT_H | |
| 63 | |
| 64 // The memory map is weakly defined, allowing the application to redefine | |
| 65 // it if necessary. The regions defined below are the minimum requirements. | |
| 66 CYGARC_MEMDESC_TABLE CYGBLD_ATTRIB_WEAK = { | |
| 67 // Mapping for the Adder 85x development boards | |
| 68 CYGARC_MEMDESC_CACHE( 0xfe000000, 0x00800000 ), // ROM region | |
| 69 CYGARC_MEMDESC_NOCACHE( 0xff000000, 0x00100000 ), // MCP registers | |
| 70 CYGARC_MEMDESC_NOCACHE( 0xfa000000, 0x00400000 ), // Control/Status+LEDs | |
| 71 CYGARC_MEMDESC_CACHE( CYGMEM_REGION_ram, CYGMEM_REGION_ram_SIZE ), // Main memory | |
| 72 | |
| 73 CYGARC_MEMDESC_TABLE_END | |
| 74 }; | |
| 75 | |
|
1933
7251145cdb9d
* src/hal_aux.c: Added prototype of _adder_set_led() to remove
asl
parents:
1755
diff
changeset
|
76 void |
|
7251145cdb9d
* src/hal_aux.c: Added prototype of _adder_set_led() to remove
asl
parents:
1755
diff
changeset
|
77 _adder_set_leds(int pat); |
|
7251145cdb9d
* src/hal_aux.c: Added prototype of _adder_set_led() to remove
asl
parents:
1755
diff
changeset
|
78 |
| 432 | 79 //-------------------------------------------------------------------------- |
| 80 // Platform init code. | |
| 81 void | |
| 82 hal_platform_init(void) | |
| 83 { | |
| 84 volatile EPPC *eppc = (volatile EPPC *)eppc_base(); | |
| 85 | |
| 86 // Special routing information for CICR | |
| 857 | 87 eppc->cpmi_cicr &= ~0xFF0000; // Routing bits |
| 88 eppc->cpmi_cicr |= 0x240000; // SCC2, SCC3 on "normal" bit positions | |
| 432 | 89 |
| 948 | 90 #if defined(CYGHWR_HAL_POWERPC_ADDER_I) |
| 432 | 91 eppc->pip_pbpar &= ~0x0000400E; // PB29..30 AS GPIO |
| 92 eppc->pip_pbdir |= 0x0000400E; | |
| 93 eppc->pip_pbdat = 0x00004000; | |
| 948 | 94 #endif |
| 95 | |
| 96 #if defined(CYGHWR_HAL_POWERPC_ADDER_II) | |
|
1755
d61d51cfd8ab
Move parallel port initializations to platform code
gthomas
parents:
948
diff
changeset
|
97 |
|
d61d51cfd8ab
Move parallel port initializations to platform code
gthomas
parents:
948
diff
changeset
|
98 #if defined(CYGHWR_HAL_POWERPC_MPC8XX_852T) |
|
d61d51cfd8ab
Move parallel port initializations to platform code
gthomas
parents:
948
diff
changeset
|
99 // Special settings - according to manual errata |
|
d61d51cfd8ab
Move parallel port initializations to platform code
gthomas
parents:
948
diff
changeset
|
100 eppc->pio_papar &= ~0xffffffff; // PA manatory settings |
|
d61d51cfd8ab
Move parallel port initializations to platform code
gthomas
parents:
948
diff
changeset
|
101 eppc->pio_padir |= 0xffffffff; |
|
d61d51cfd8ab
Move parallel port initializations to platform code
gthomas
parents:
948
diff
changeset
|
102 |
|
d61d51cfd8ab
Move parallel port initializations to platform code
gthomas
parents:
948
diff
changeset
|
103 eppc->pip_pbpar &= ~0x0003ff07; // PB29..31 AS GPIO |
|
d61d51cfd8ab
Move parallel port initializations to platform code
gthomas
parents:
948
diff
changeset
|
104 eppc->pip_pbdir |= 0x0003ff07; |
|
d61d51cfd8ab
Move parallel port initializations to platform code
gthomas
parents:
948
diff
changeset
|
105 eppc->pip_pbdat = 0x00010007; |
|
d61d51cfd8ab
Move parallel port initializations to platform code
gthomas
parents:
948
diff
changeset
|
106 |
|
d61d51cfd8ab
Move parallel port initializations to platform code
gthomas
parents:
948
diff
changeset
|
107 eppc->pio_pcpar &= ~0xffffffff; // PC manatory settings |
|
d61d51cfd8ab
Move parallel port initializations to platform code
gthomas
parents:
948
diff
changeset
|
108 eppc->pio_pcdir |= 0xffffffff; |
|
d61d51cfd8ab
Move parallel port initializations to platform code
gthomas
parents:
948
diff
changeset
|
109 #endif |
|
d61d51cfd8ab
Move parallel port initializations to platform code
gthomas
parents:
948
diff
changeset
|
110 |
| 948 | 111 eppc->pip_pbpar &= ~0x00000007; // PB29..31 AS GPIO for LEDS |
| 112 eppc->pip_pbdir |= 0x00000007; | |
| 113 eppc->pip_pbdat |= 0x00000007; | |
| 114 #endif | |
| 432 | 115 |
| 116 hal_if_init(); | |
| 117 | |
| 118 _adder_set_leds(0x1); | |
| 119 } | |
| 120 | |
|
862
725ba4e57f0c
Add support for A&M Adder-II (by extending Adder platform)
gthomas
parents:
857
diff
changeset
|
121 #ifdef CYGHWR_HAL_POWERPC_ADDER_I |
| 432 | 122 void |
| 123 _adder_set_leds(int pat) | |
| 124 { | |
| 125 volatile EPPC *eppc = (volatile EPPC *)eppc_base(); | |
| 126 | |
| 127 eppc->pip_pbdat = (eppc->pip_pbdat & ~0x0000000E) | (pat << 1); | |
| 128 } | |
| 129 | |
| 130 int | |
| 131 _adder_get_leds(void) | |
| 132 { | |
| 133 volatile EPPC *eppc = (volatile EPPC *)eppc_base(); | |
| 134 | |
| 135 return ((eppc->pip_pbdat & 0x0000000E) >> 1); | |
| 136 } | |
|
862
725ba4e57f0c
Add support for A&M Adder-II (by extending Adder platform)
gthomas
parents:
857
diff
changeset
|
137 #endif |
|
725ba4e57f0c
Add support for A&M Adder-II (by extending Adder platform)
gthomas
parents:
857
diff
changeset
|
138 |
|
725ba4e57f0c
Add support for A&M Adder-II (by extending Adder platform)
gthomas
parents:
857
diff
changeset
|
139 #ifdef CYGHWR_HAL_POWERPC_ADDER_II |
|
725ba4e57f0c
Add support for A&M Adder-II (by extending Adder platform)
gthomas
parents:
857
diff
changeset
|
140 void |
|
725ba4e57f0c
Add support for A&M Adder-II (by extending Adder platform)
gthomas
parents:
857
diff
changeset
|
141 _adder_set_leds(int pat) |
|
725ba4e57f0c
Add support for A&M Adder-II (by extending Adder platform)
gthomas
parents:
857
diff
changeset
|
142 { |
|
725ba4e57f0c
Add support for A&M Adder-II (by extending Adder platform)
gthomas
parents:
857
diff
changeset
|
143 volatile EPPC *eppc = (volatile EPPC *)eppc_base(); |
|
725ba4e57f0c
Add support for A&M Adder-II (by extending Adder platform)
gthomas
parents:
857
diff
changeset
|
144 |
|
725ba4e57f0c
Add support for A&M Adder-II (by extending Adder platform)
gthomas
parents:
857
diff
changeset
|
145 eppc->pip_pbdat = (eppc->pip_pbdat & ~0x00000007) |(~(pat&0x0007) ); |
|
725ba4e57f0c
Add support for A&M Adder-II (by extending Adder platform)
gthomas
parents:
857
diff
changeset
|
146 } |
|
725ba4e57f0c
Add support for A&M Adder-II (by extending Adder platform)
gthomas
parents:
857
diff
changeset
|
147 |
|
725ba4e57f0c
Add support for A&M Adder-II (by extending Adder platform)
gthomas
parents:
857
diff
changeset
|
148 int |
|
725ba4e57f0c
Add support for A&M Adder-II (by extending Adder platform)
gthomas
parents:
857
diff
changeset
|
149 _adder_get_leds(void) |
|
725ba4e57f0c
Add support for A&M Adder-II (by extending Adder platform)
gthomas
parents:
857
diff
changeset
|
150 { |
|
725ba4e57f0c
Add support for A&M Adder-II (by extending Adder platform)
gthomas
parents:
857
diff
changeset
|
151 volatile EPPC *eppc = (volatile EPPC *)eppc_base(); |
|
725ba4e57f0c
Add support for A&M Adder-II (by extending Adder platform)
gthomas
parents:
857
diff
changeset
|
152 |
|
725ba4e57f0c
Add support for A&M Adder-II (by extending Adder platform)
gthomas
parents:
857
diff
changeset
|
153 return ((~(eppc->pip_pbdat & 0x00000007)) & 0x0007 ); |
|
725ba4e57f0c
Add support for A&M Adder-II (by extending Adder platform)
gthomas
parents:
857
diff
changeset
|
154 } |
|
725ba4e57f0c
Add support for A&M Adder-II (by extending Adder platform)
gthomas
parents:
857
diff
changeset
|
155 #endif |
| 432 | 156 |
| 157 // EOF hal_aux.c |
