1 |
27 |
unneback |
//==========================================================================
|
2 |
|
|
//
|
3 |
|
|
// iq80321_misc.c
|
4 |
|
|
//
|
5 |
|
|
// HAL misc board support code for Intel XScale IQ80321
|
6 |
|
|
//
|
7 |
|
|
//==========================================================================
|
8 |
|
|
//####ECOSGPLCOPYRIGHTBEGIN####
|
9 |
|
|
// -------------------------------------------
|
10 |
|
|
// This file is part of eCos, the Embedded Configurable Operating System.
|
11 |
|
|
// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
|
12 |
|
|
//
|
13 |
|
|
// eCos is free software; you can redistribute it and/or modify it under
|
14 |
|
|
// the terms of the GNU General Public License as published by the Free
|
15 |
|
|
// Software Foundation; either version 2 or (at your option) any later version.
|
16 |
|
|
//
|
17 |
|
|
// eCos is distributed in the hope that it will be useful, but WITHOUT ANY
|
18 |
|
|
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
19 |
|
|
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
20 |
|
|
// for more details.
|
21 |
|
|
//
|
22 |
|
|
// You should have received a copy of the GNU General Public License along
|
23 |
|
|
// with eCos; if not, write to the Free Software Foundation, Inc.,
|
24 |
|
|
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
|
25 |
|
|
//
|
26 |
|
|
// As a special exception, if other files instantiate templates or use macros
|
27 |
|
|
// or inline functions from this file, or you compile this file and link it
|
28 |
|
|
// with other works to produce a work based on this file, this file does not
|
29 |
|
|
// by itself cause the resulting work to be covered by the GNU General Public
|
30 |
|
|
// License. However the source code for this file must still be made available
|
31 |
|
|
// in accordance with section (3) of the GNU General Public License.
|
32 |
|
|
//
|
33 |
|
|
// This exception does not invalidate any other reasons why a work based on
|
34 |
|
|
// this file might be covered by the GNU General Public License.
|
35 |
|
|
//
|
36 |
|
|
// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
|
37 |
|
|
// at http://sources.redhat.com/ecos/ecos-license/
|
38 |
|
|
// -------------------------------------------
|
39 |
|
|
//####ECOSGPLCOPYRIGHTEND####
|
40 |
|
|
//==========================================================================
|
41 |
|
|
//#####DESCRIPTIONBEGIN####
|
42 |
|
|
//
|
43 |
|
|
// Author(s): msalter
|
44 |
|
|
// Contributors: msalter
|
45 |
|
|
// Date: 2001-12-03
|
46 |
|
|
// Purpose: HAL board support
|
47 |
|
|
// Description: Implementations of HAL board interfaces
|
48 |
|
|
//
|
49 |
|
|
//####DESCRIPTIONEND####
|
50 |
|
|
//
|
51 |
|
|
//========================================================================*/
|
52 |
|
|
|
53 |
|
|
#include <pkgconf/hal.h>
|
54 |
|
|
#include <pkgconf/system.h>
|
55 |
|
|
#include CYGBLD_HAL_PLATFORM_H
|
56 |
|
|
|
57 |
|
|
#include <cyg/infra/cyg_type.h> // base types
|
58 |
|
|
#include <cyg/infra/cyg_trac.h> // tracing macros
|
59 |
|
|
#include <cyg/infra/cyg_ass.h> // assertion macros
|
60 |
|
|
|
61 |
|
|
#include <cyg/hal/hal_io.h> // IO macros
|
62 |
|
|
#include <cyg/hal/hal_arch.h> // Register state info
|
63 |
|
|
#include <cyg/hal/hal_diag.h>
|
64 |
|
|
#include <cyg/hal/hal_intr.h> // Interrupt names
|
65 |
|
|
#include <cyg/hal/hal_cache.h>
|
66 |
|
|
#include <cyg/hal/hal_verde.h> // Hardware definitions
|
67 |
|
|
#include <cyg/hal/iq80321.h> // Platform specifics
|
68 |
|
|
|
69 |
|
|
#include <cyg/infra/diag.h> // diag_printf
|
70 |
|
|
|
71 |
|
|
#ifdef CYGPKG_IO_PCI
|
72 |
|
|
cyg_uint32 cyg_pci_window_real_base = 0;
|
73 |
|
|
#endif
|
74 |
|
|
|
75 |
|
|
//
|
76 |
|
|
// Platform specific initialization
|
77 |
|
|
//
|
78 |
|
|
|
79 |
|
|
void
|
80 |
|
|
plf_hardware_init(void)
|
81 |
|
|
{
|
82 |
|
|
INTCTL_WRITE(0); // mask all irqs
|
83 |
|
|
INTSTR_WRITE(0); // everything goes to IRQ
|
84 |
|
|
*PIRSR = 0x0f;
|
85 |
|
|
|
86 |
|
|
// RAM startup only - rewrite relevent bits depending on config
|
87 |
|
|
#ifndef CYG_HAL_STARTUP_ROM
|
88 |
|
|
HAL_DCACHE_SYNC(); // Force data out
|
89 |
|
|
HAL_DCACHE_INVALIDATE_ALL(); // Flush TLBs: make new mmu state effective
|
90 |
|
|
#endif // ! CYG_HAL_STARTUP_ROM - RAM start only
|
91 |
|
|
}
|
92 |
|
|
|
93 |
|
|
//
|
94 |
|
|
// Memory layout - runtime variations of all kinds.
|
95 |
|
|
//
|
96 |
|
|
externC cyg_uint8 *
|
97 |
|
|
hal_arm_mem_real_region_top( cyg_uint8 *regionend )
|
98 |
|
|
{
|
99 |
|
|
CYG_ASSERT( hal_dram_size > 0, "Didn't detect DRAM size!" );
|
100 |
|
|
CYG_ASSERT( hal_dram_size <= 256<<20,
|
101 |
|
|
"More than 256MB reported - that can't be right" );
|
102 |
|
|
CYG_ASSERT( 0 == (hal_dram_size & 0xfffff),
|
103 |
|
|
"hal_dram_size not whole Mb" );
|
104 |
|
|
// is it the "normal" end of the DRAM region? If so, it should be
|
105 |
|
|
// replaced by the real size
|
106 |
|
|
if ( regionend ==
|
107 |
|
|
((cyg_uint8 *)CYGMEM_REGION_ram + CYGMEM_REGION_ram_SIZE) ) {
|
108 |
|
|
regionend = (cyg_uint8 *)CYGMEM_REGION_ram + hal_dram_size;
|
109 |
|
|
}
|
110 |
|
|
// Also, we must check for the top of the heap having moved. This is
|
111 |
|
|
// because the heap does not abut the top of memory.
|
112 |
|
|
#ifdef CYGMEM_SECTION_heap1
|
113 |
|
|
if ( regionend ==
|
114 |
|
|
((cyg_uint8 *)CYGMEM_SECTION_heap1 + CYGMEM_SECTION_heap1_SIZE) ) {
|
115 |
|
|
// hal_dram_size excludes the PCI window on this platform.
|
116 |
|
|
if ( regionend > (cyg_uint8 *)CYGMEM_REGION_ram + hal_dram_size )
|
117 |
|
|
regionend = (cyg_uint8 *)CYGMEM_REGION_ram + hal_dram_size;
|
118 |
|
|
}
|
119 |
|
|
#endif
|
120 |
|
|
return regionend;
|
121 |
|
|
}
|
122 |
|
|
|
123 |
|
|
// ------------------------------------------------------------------------
|
124 |
|
|
// EOF iq80321_misc.c
|