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
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
432
cc4df9225149 Add Adder platform from Analogue & Micro
gthomas
parents:
diff changeset
1 //=============================================================================
cc4df9225149 Add Adder platform from Analogue & Micro
gthomas
parents:
diff changeset
2 //
cc4df9225149 Add Adder platform from Analogue & Micro
gthomas
parents:
diff changeset
3 // hal_aux.c
cc4df9225149 Add Adder platform from Analogue & Micro
gthomas
parents:
diff changeset
4 //
cc4df9225149 Add Adder platform from Analogue & Micro
gthomas
parents:
diff changeset
5 // HAL auxiliary objects and code; per platform
cc4df9225149 Add Adder platform from Analogue & Micro
gthomas
parents:
diff changeset
6 //
cc4df9225149 Add Adder platform from Analogue & Micro
gthomas
parents:
diff changeset
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
cc4df9225149 Add Adder platform from Analogue & Micro
gthomas
parents:
diff changeset
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
cc4df9225149 Add Adder platform from Analogue & Micro
gthomas
parents:
diff changeset
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
cc4df9225149 Add Adder platform from Analogue & Micro
gthomas
parents:
diff changeset
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
cc4df9225149 Add Adder platform from Analogue & Micro
gthomas
parents:
diff changeset
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
cc4df9225149 Add Adder platform from Analogue & Micro
gthomas
parents:
diff changeset
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
cc4df9225149 Add Adder platform from Analogue & Micro
gthomas
parents:
diff changeset
39 //=============================================================================
cc4df9225149 Add Adder platform from Analogue & Micro
gthomas
parents:
diff changeset
40 //#####DESCRIPTIONBEGIN####
cc4df9225149 Add Adder platform from Analogue & Micro
gthomas
parents:
diff changeset
41 //
cc4df9225149 Add Adder platform from Analogue & Micro
gthomas
parents:
diff changeset
42 // Author(s): hmt
cc4df9225149 Add Adder platform from Analogue & Micro
gthomas
parents:
diff changeset
43 // Contributors:hmt
cc4df9225149 Add Adder platform from Analogue & Micro
gthomas
parents:
diff changeset
44 // Date: 1999-06-08
cc4df9225149 Add Adder platform from Analogue & Micro
gthomas
parents:
diff changeset
45 // Purpose: HAL aux objects: startup tables.
cc4df9225149 Add Adder platform from Analogue & Micro
gthomas
parents:
diff changeset
46 // Description: Tables for per-platform initialization
cc4df9225149 Add Adder platform from Analogue & Micro
gthomas
parents:
diff changeset
47 //
cc4df9225149 Add Adder platform from Analogue & Micro
gthomas
parents:
diff changeset
48 //####DESCRIPTIONEND####
cc4df9225149 Add Adder platform from Analogue & Micro
gthomas
parents:
diff changeset
49 //
cc4df9225149 Add Adder platform from Analogue & Micro
gthomas
parents:
diff changeset
50 //=============================================================================
cc4df9225149 Add Adder platform from Analogue & Micro
gthomas
parents:
diff changeset
51
cc4df9225149 Add Adder platform from Analogue & Micro
gthomas
parents:
diff changeset
52 #include <pkgconf/hal.h>
cc4df9225149 Add Adder platform from Analogue & Micro
gthomas
parents:
diff changeset
53 #include <pkgconf/hal_powerpc_quicc.h>
cc4df9225149 Add Adder platform from Analogue & Micro
gthomas
parents:
diff changeset
54
cc4df9225149 Add Adder platform from Analogue & Micro
gthomas
parents:
diff changeset
55 #include <cyg/infra/cyg_type.h>
cc4df9225149 Add Adder platform from Analogue & Micro
gthomas
parents:
diff changeset
56 #include <cyg/hal/hal_mem.h> // HAL memory definitions
cc4df9225149 Add Adder platform from Analogue & Micro
gthomas
parents:
diff changeset
57 #define CYGARC_HAL_COMMON_EXPORT_CPU_MACROS
cc4df9225149 Add Adder platform from Analogue & Micro
gthomas
parents:
diff changeset
58 #include <cyg/hal/ppc_regs.h>
cc4df9225149 Add Adder platform from Analogue & Micro
gthomas
parents:
diff changeset
59 #include <cyg/hal/quicc/ppc8xx.h>
cc4df9225149 Add Adder platform from Analogue & Micro
gthomas
parents:
diff changeset
60 #include <cyg/hal/hal_if.h> // hal_if_init
cc4df9225149 Add Adder platform from Analogue & Micro
gthomas
parents:
diff changeset
61 #include <cyg/hal/hal_io.h>
cc4df9225149 Add Adder platform from Analogue & Micro
gthomas
parents:
diff changeset
62 #include CYGHWR_MEMORY_LAYOUT_H
cc4df9225149 Add Adder platform from Analogue & Micro
gthomas
parents:
diff changeset
63
cc4df9225149 Add Adder platform from Analogue & Micro
gthomas
parents:
diff changeset
64 // The memory map is weakly defined, allowing the application to redefine
cc4df9225149 Add Adder platform from Analogue & Micro
gthomas
parents:
diff changeset
65 // it if necessary. The regions defined below are the minimum requirements.
cc4df9225149 Add Adder platform from Analogue & Micro
gthomas
parents:
diff changeset
66 CYGARC_MEMDESC_TABLE CYGBLD_ATTRIB_WEAK = {
cc4df9225149 Add Adder platform from Analogue & Micro
gthomas
parents:
diff changeset
67 // Mapping for the Adder 85x development boards
cc4df9225149 Add Adder platform from Analogue & Micro
gthomas
parents:
diff changeset
68 CYGARC_MEMDESC_CACHE( 0xfe000000, 0x00800000 ), // ROM region
cc4df9225149 Add Adder platform from Analogue & Micro
gthomas
parents:
diff changeset
69 CYGARC_MEMDESC_NOCACHE( 0xff000000, 0x00100000 ), // MCP registers
cc4df9225149 Add Adder platform from Analogue & Micro
gthomas
parents:
diff changeset
70 CYGARC_MEMDESC_NOCACHE( 0xfa000000, 0x00400000 ), // Control/Status+LEDs
cc4df9225149 Add Adder platform from Analogue & Micro
gthomas
parents:
diff changeset
71 CYGARC_MEMDESC_CACHE( CYGMEM_REGION_ram, CYGMEM_REGION_ram_SIZE ), // Main memory
cc4df9225149 Add Adder platform from Analogue & Micro
gthomas
parents:
diff changeset
72
cc4df9225149 Add Adder platform from Analogue & Micro
gthomas
parents:
diff changeset
73 CYGARC_MEMDESC_TABLE_END
cc4df9225149 Add Adder platform from Analogue & Micro
gthomas
parents:
diff changeset
74 };
cc4df9225149 Add Adder platform from Analogue & Micro
gthomas
parents:
diff changeset
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
cc4df9225149 Add Adder platform from Analogue & Micro
gthomas
parents:
diff changeset
79 //--------------------------------------------------------------------------
cc4df9225149 Add Adder platform from Analogue & Micro
gthomas
parents:
diff changeset
80 // Platform init code.
cc4df9225149 Add Adder platform from Analogue & Micro
gthomas
parents:
diff changeset
81 void
cc4df9225149 Add Adder platform from Analogue & Micro
gthomas
parents:
diff changeset
82 hal_platform_init(void)
cc4df9225149 Add Adder platform from Analogue & Micro
gthomas
parents:
diff changeset
83 {
cc4df9225149 Add Adder platform from Analogue & Micro
gthomas
parents:
diff changeset
84 volatile EPPC *eppc = (volatile EPPC *)eppc_base();
cc4df9225149 Add Adder platform from Analogue & Micro
gthomas
parents:
diff changeset
85
cc4df9225149 Add Adder platform from Analogue & Micro
gthomas
parents:
diff changeset
86 // Special routing information for CICR
857
4dcc6006d82f Fix typo in board initialization
gthomas
parents: 432
diff changeset
87 eppc->cpmi_cicr &= ~0xFF0000; // Routing bits
4dcc6006d82f Fix typo in board initialization
gthomas
parents: 432
diff changeset
88 eppc->cpmi_cicr |= 0x240000; // SCC2, SCC3 on "normal" bit positions
432
cc4df9225149 Add Adder platform from Analogue & Micro
gthomas
parents:
diff changeset
89
948
83ca3aef4a92 Adjust configuration for MPC852T platforms
gthomas
parents: 862
diff changeset
90 #if defined(CYGHWR_HAL_POWERPC_ADDER_I)
432
cc4df9225149 Add Adder platform from Analogue & Micro
gthomas
parents:
diff changeset
91 eppc->pip_pbpar &= ~0x0000400E; // PB29..30 AS GPIO
cc4df9225149 Add Adder platform from Analogue & Micro
gthomas
parents:
diff changeset
92 eppc->pip_pbdir |= 0x0000400E;
cc4df9225149 Add Adder platform from Analogue & Micro
gthomas
parents:
diff changeset
93 eppc->pip_pbdat = 0x00004000;
948
83ca3aef4a92 Adjust configuration for MPC852T platforms
gthomas
parents: 862
diff changeset
94 #endif
83ca3aef4a92 Adjust configuration for MPC852T platforms
gthomas
parents: 862
diff changeset
95
83ca3aef4a92 Adjust configuration for MPC852T platforms
gthomas
parents: 862
diff changeset
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
83ca3aef4a92 Adjust configuration for MPC852T platforms
gthomas
parents: 862
diff changeset
111 eppc->pip_pbpar &= ~0x00000007; // PB29..31 AS GPIO for LEDS
83ca3aef4a92 Adjust configuration for MPC852T platforms
gthomas
parents: 862
diff changeset
112 eppc->pip_pbdir |= 0x00000007;
83ca3aef4a92 Adjust configuration for MPC852T platforms
gthomas
parents: 862
diff changeset
113 eppc->pip_pbdat |= 0x00000007;
83ca3aef4a92 Adjust configuration for MPC852T platforms
gthomas
parents: 862
diff changeset
114 #endif
432
cc4df9225149 Add Adder platform from Analogue & Micro
gthomas
parents:
diff changeset
115
cc4df9225149 Add Adder platform from Analogue & Micro
gthomas
parents:
diff changeset
116 hal_if_init();
cc4df9225149 Add Adder platform from Analogue & Micro
gthomas
parents:
diff changeset
117
cc4df9225149 Add Adder platform from Analogue & Micro
gthomas
parents:
diff changeset
118 _adder_set_leds(0x1);
cc4df9225149 Add Adder platform from Analogue & Micro
gthomas
parents:
diff changeset
119 }
cc4df9225149 Add Adder platform from Analogue & Micro
gthomas
parents:
diff changeset
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
cc4df9225149 Add Adder platform from Analogue & Micro
gthomas
parents:
diff changeset
122 void
cc4df9225149 Add Adder platform from Analogue & Micro
gthomas
parents:
diff changeset
123 _adder_set_leds(int pat)
cc4df9225149 Add Adder platform from Analogue & Micro
gthomas
parents:
diff changeset
124 {
cc4df9225149 Add Adder platform from Analogue & Micro
gthomas
parents:
diff changeset
125 volatile EPPC *eppc = (volatile EPPC *)eppc_base();
cc4df9225149 Add Adder platform from Analogue & Micro
gthomas
parents:
diff changeset
126
cc4df9225149 Add Adder platform from Analogue & Micro
gthomas
parents:
diff changeset
127 eppc->pip_pbdat = (eppc->pip_pbdat & ~0x0000000E) | (pat << 1);
cc4df9225149 Add Adder platform from Analogue & Micro
gthomas
parents:
diff changeset
128 }
cc4df9225149 Add Adder platform from Analogue & Micro
gthomas
parents:
diff changeset
129
cc4df9225149 Add Adder platform from Analogue & Micro
gthomas
parents:
diff changeset
130 int
cc4df9225149 Add Adder platform from Analogue & Micro
gthomas
parents:
diff changeset
131 _adder_get_leds(void)
cc4df9225149 Add Adder platform from Analogue & Micro
gthomas
parents:
diff changeset
132 {
cc4df9225149 Add Adder platform from Analogue & Micro
gthomas
parents:
diff changeset
133 volatile EPPC *eppc = (volatile EPPC *)eppc_base();
cc4df9225149 Add Adder platform from Analogue & Micro
gthomas
parents:
diff changeset
134
cc4df9225149 Add Adder platform from Analogue & Micro
gthomas
parents:
diff changeset
135 return ((eppc->pip_pbdat & 0x0000000E) >> 1);
cc4df9225149 Add Adder platform from Analogue & Micro
gthomas
parents:
diff changeset
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
cc4df9225149 Add Adder platform from Analogue & Micro
gthomas
parents:
diff changeset
156
cc4df9225149 Add Adder platform from Analogue & Micro
gthomas
parents:
diff changeset
157 // EOF hal_aux.c