Mercurial > ecos-v3_0-branch
annotate packages/hal/coldfire/m5272c3/current/src/plf_startup.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 | a62600d0e7b5 |
| children |
| rev | line source |
|---|---|
|
2201
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
1 //========================================================================== |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
2 // |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
3 // plf_startup.c |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
4 // |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
5 // M5272C3 platform HAL startup code |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
6 // |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
7 //========================================================================== |
|
2729
74dbf4c3f2e1
Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents:
2201
diff
changeset
|
8 // ####ECOSGPLCOPYRIGHTBEGIN#### |
|
74dbf4c3f2e1
Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents:
2201
diff
changeset
|
9 // ------------------------------------------- |
|
74dbf4c3f2e1
Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents:
2201
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:
2201
diff
changeset
|
11 // Copyright (C) 1998, 1999, 2000, 2001, 2002, 2006 Free Software Foundation, Inc. |
|
2201
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
12 // |
|
2729
74dbf4c3f2e1
Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents:
2201
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:
2201
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:
2201
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:
2201
diff
changeset
|
16 // version. |
|
2201
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
17 // |
|
2729
74dbf4c3f2e1
Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents:
2201
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:
2201
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:
2201
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:
2201
diff
changeset
|
21 // for more details. |
|
2201
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
22 // |
|
2729
74dbf4c3f2e1
Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents:
2201
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:
2201
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:
2201
diff
changeset
|
25 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
|
2201
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
26 // |
|
2729
74dbf4c3f2e1
Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents:
2201
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:
2201
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:
2201
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:
2201
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:
2201
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:
2201
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:
2201
diff
changeset
|
33 // General Public License v2. |
|
2201
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
34 // |
|
2729
74dbf4c3f2e1
Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents:
2201
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:
2201
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:
2201
diff
changeset
|
37 // ------------------------------------------- |
|
74dbf4c3f2e1
Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents:
2201
diff
changeset
|
38 // ####ECOSGPLCOPYRIGHTEND#### |
|
2201
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
39 //========================================================================== |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
40 //#####DESCRIPTIONBEGIN#### |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
41 // |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
42 // Author(s): Enrico Piria |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
43 // Contributors: |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
44 // Date: 2005-25-06 |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
45 // Purpose: Platform startup code. |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
46 // Description: This module contains code that sets up the platform specific |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
47 // hardware and data. All the code must be contained in the |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
48 // section called ".boot", in order for the ROMRAM startup |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
49 // to work properly. |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
50 // |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
51 //####DESCRIPTIONEND#### |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
52 //======================================================================== |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
53 |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
54 #include <cyg/infra/cyg_type.h> |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
55 #include <pkgconf/hal.h> |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
56 #include <cyg/hal/hal_startup.h> |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
57 #include CYGHWR_MEMORY_LAYOUT_H |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
58 #include <cyg/hal/hal_arch.h> |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
59 #include <cyg/hal/hal_io.h> |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
60 #include <cyg/hal/coldfire_regs.h> |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
61 |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
62 static void plf_init_sim(void) __attribute__ ((section (".boot"))); |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
63 static void plf_init_intc(void) __attribute__ ((section (".boot"))); |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
64 static void plf_init_cs(void) __attribute__ ((section (".boot"))); |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
65 static void plf_init_sdramc(void) __attribute__ ((section (".boot"))); |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
66 static void plf_init_cache_acr(void) __attribute__ ((section (".boot"))); |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
67 |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
68 |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
69 // Platform-specific reset vector initialization routine |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
70 void plf_reset(void) |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
71 { |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
72 plf_init_sim(); |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
73 plf_init_intc(); |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
74 plf_init_cs(); |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
75 plf_init_sdramc(); |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
76 |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
77 // Call a routine to set up the cache and ACRs for this specific |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
78 // platform. |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
79 plf_init_cache_acr(); |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
80 } |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
81 |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
82 |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
83 // Initialize the cache and access control registers. |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
84 // The reset procedure already invalidated the cache and ACRs. |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
85 // This routine only needs to enable the ACRs that it will use. |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
86 static void plf_init_cache_acr(void) |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
87 { |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
88 // Enable the instruction cache with the following options: |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
89 // Enable CPUSHL invalidation. |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
90 // No freeze. |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
91 // Invalidate all cache lines (flush). |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
92 // No external arbiter control. |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
93 // Disable non-cacheable instruction bursting. |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
94 // Default memory is cacheable. |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
95 // Enable buffered writes. |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
96 // Read and write access permitted by default. |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
97 // Instruction fetch size is cache line. |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
98 |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
99 #ifdef CYGSEM_HAL_ENABLE_ICACHE_ON_STARTUP |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
100 CYGARC_MOVEC((CYG_WORD32) 0x81000102, CYGARC_REG_CACR); |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
101 #endif |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
102 |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
103 // Leave the access control registers disabled. |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
104 } |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
105 |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
106 |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
107 // Initialize SIM module and system configuration registers |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
108 void plf_init_sim(void) |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
109 { |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
110 // Set up the mapping of our internal registers. The LSB indicates that |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
111 // the register contents are valid. |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
112 CYGARC_MOVEC((CYG_WORD32)(CYGMEM_REGION_devs | 1), CYGARC_REG_MBAR); |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
113 |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
114 // Initialize System Config Register |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
115 // Setup Watch Dog Timeout |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
116 HAL_WRITE_UINT16(&MCF5272_DEVS->cfg.scr, MCF5272_SIM_SCR_HWWD_1024); |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
117 |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
118 // Initialize System Protection Register |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
119 // Enable all bus error exceptions |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
120 HAL_WRITE_UINT16(&MCF5272_DEVS->cfg.spr, |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
121 (0 | MCF5272_SIM_SPR_ADC | MCF5272_SIM_SPR_ADCEN |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
122 | MCF5272_SIM_SPR_WPV | MCF5272_SIM_SPR_WPVEN |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
123 | MCF5272_SIM_SPR_SMV | MCF5272_SIM_SPR_SMVEN |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
124 | MCF5272_SIM_SPR_SBE | MCF5272_SIM_SPR_SBEEN |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
125 | MCF5272_SIM_SPR_HWT | MCF5272_SIM_SPR_HWTEN |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
126 | MCF5272_SIM_SPR_RPV | MCF5272_SIM_SPR_RPVEN |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
127 | MCF5272_SIM_SPR_EXT | MCF5272_SIM_SPR_EXTEN |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
128 | MCF5272_SIM_SPR_SUV | MCF5272_SIM_SPR_SUVEN |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
129 )) ; |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
130 } |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
131 |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
132 |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
133 // Initialize interrupt controller |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
134 void plf_init_intc(void) |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
135 { |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
136 int i; |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
137 |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
138 // Initialize the vector base register in the interrupt controller. |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
139 HAL_WRITE_UINT8(&MCF5272_DEVS->intc.ipvr, HAL_PROG_INT_VEC_BASE); |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
140 |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
141 // Initialize the interrupt control register. |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
142 // Disable all interrupts by setting all priorities to zero. |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
143 for (i = 0; i < 4; i++) |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
144 { |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
145 HAL_WRITE_UINT32(&MCF5272_DEVS->intc.icr[i], 0x88888888); |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
146 } |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
147 |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
148 // Initialize the processor's vector base register (align to 1M boundary). |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
149 CYGARC_MOVEC((CYG_WORD32) __ramvec_start & 0xFFF00000, CYGARC_REG_VBR); |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
150 } |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
151 |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
152 |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
153 // Initialize chip-select modules |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
154 void plf_init_cs(void) |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
155 { |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
156 // ChipSelect 0 - 2MB FLASH |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
157 // At startup, CS0 is configured so that addresses starting at 0xXXX00000 |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
158 // are aliased to 0x00000000, so, in ROM startup configuration, code can |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
159 // be placed starting at VMA address 0xFFE00000. When we are here, |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
160 // the PC points to addresses in 0xFFE00000 space, and we can safely |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
161 // reconfigure CS0 to respond uniquely to those addresses. |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
162 HAL_WRITE_UINT32(&MCF5272_DEVS->cs[0].csbr, (0 |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
163 | MCF5272_CS_BR_BASE(CYGMEM_REGION_flash) |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
164 | MCF5272_CS_BR_SRAM |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
165 | MCF5272_CS_BR_PS_16 |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
166 | MCF5272_CS_BR_EN)); |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
167 |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
168 HAL_WRITE_UINT32(&MCF5272_DEVS->cs[0].csor, |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
169 (0 | MCF5272_CS_OR_MASK_2M |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
170 | MCF5272_CS_OR_WS(5))); |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
171 |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
172 #ifdef CYGHWR_EXT_SRAM_INSTALLED |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
173 // Chip Select 2 - 512KB SRAM |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
174 HAL_WRITE_UINT32(&MCF5272_DEVS->cs[2].csbr, (0 |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
175 | MCF5272_CS_BR_BASE(CYGMEM_REGION_ext_sram) |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
176 | MCF5272_CS_BR_SRAM |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
177 | MCF5272_CS_BR_PS_32 |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
178 | MCF5272_CS_BR_EN)); |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
179 |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
180 HAL_WRITE_UINT32(&MCF5272_DEVS->cs[2].csor, (0 |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
181 | MCF5272_CS_OR_MASK_512K |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
182 | MCF5272_CS_OR_WS(0))); |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
183 #endif // CYGHWR_EXT_SRAM_INSTALLED |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
184 |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
185 // ChipSelect 7 - 16MB SDRAM |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
186 HAL_WRITE_UINT32(&MCF5272_DEVS->cs[7].csbr, (0 |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
187 | MCF5272_CS_BR_BASE(CYGMEM_REGION_sdram) |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
188 | MCF5272_CS_BR_SDRAM |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
189 | MCF5272_CS_BR_PS_LINE |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
190 | MCF5272_CS_BR_EN)); |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
191 |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
192 HAL_WRITE_UINT32(&MCF5272_DEVS->cs[7].csor, (0 |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
193 #if (CYGHWR_INSTALLED_SDRAM_SIZE == 4) |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
194 | MCF5272_CS_OR_MASK_4M |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
195 #else |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
196 | MCF5272_CS_OR_MASK_16M |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
197 #endif |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
198 | MCF5272_CS_OR_WS(0x1F))); |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
199 } |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
200 |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
201 |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
202 // Initialize SDRAM controller |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
203 void plf_init_sdramc(void) |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
204 { |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
205 cyg_uint16 sdcr; |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
206 |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
207 |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
208 HAL_READ_UINT16(&MCF5272_DEVS->sdramc.sdcr, sdcr); |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
209 |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
210 // Do not initialize SDRAM if it is already active |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
211 if (!(sdcr & MCF5272_SDRAMC_SDCCR_ACT)) |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
212 { |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
213 #if (CYGHWR_HAL_SYSTEM_CLOCK_MHZ == 66) |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
214 HAL_WRITE_UINT16(&MCF5272_DEVS->sdramc.sdtr, (0 |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
215 | MCF5272_SDRAMC_SDCTR_RTP_66MHz |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
216 | MCF5272_SDRAMC_SDCTR_RC(0) |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
217 | MCF5272_SDRAMC_SDCTR_RP(1) |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
218 | MCF5272_SDRAMC_SDCTR_RCD(1) |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
219 | MCF5272_SDRAMC_SDCTR_CLT_2)); |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
220 #else |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
221 // Clock frequency must be 48 Mhz |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
222 HAL_WRITE_UINT16(&MCF5272_DEVS->sdramc.sdtr, (0 |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
223 | MCF5272_SDRAMC_SDCTR_RTP_48MHz |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
224 | MCF5272_SDRAMC_SDCTR_RC(0) |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
225 | MCF5272_SDRAMC_SDCTR_RP(1) |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
226 | MCF5272_SDRAMC_SDCTR_RCD(0) |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
227 | MCF5272_SDRAMC_SDCTR_CLT_2)); |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
228 #endif |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
229 |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
230 HAL_WRITE_UINT16(&MCF5272_DEVS->sdramc.sdcr, (0 |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
231 | MCF5272_SDRAMC_SDCCR_MCAS_A9 |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
232 #if (CYGHWR_INSTALLED_SDRAM_SIZE == 4) |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
233 | MCF5272_SDRAMC_SDCCR_BALOC_A21 |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
234 #else |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
235 | MCF5272_SDRAMC_SDCCR_BALOC_A22 |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
236 #endif |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
237 | MCF5272_SDRAMC_SDCCR_REG |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
238 | MCF5272_SDRAMC_SDCCR_INIT)); |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
239 |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
240 // Start SDRAM controller with a memory write |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
241 *((volatile char *) CYGMEM_REGION_sdram) = 0; |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
242 |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
243 // Wait until controller is ready |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
244 do |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
245 { |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
246 HAL_READ_UINT16(&MCF5272_DEVS->sdramc.sdcr, sdcr); |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
247 } while(!(sdcr & MCF5272_SDRAMC_SDCCR_ACT)); |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
248 } |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
249 } |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
250 |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
251 |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
252 // Platform specific data initialization routine |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
253 void plf_init_data(void) |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
254 { |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
255 // Nothing to do |
|
a62600d0e7b5
Import of the new ColdFire architecture HAL and M52272C port, with
asl
parents:
diff
changeset
|
256 } |
