1 |
786 |
skrzyp |
//=============================================================================
|
2 |
|
|
//
|
3 |
|
|
// hal_aux.c
|
4 |
|
|
//
|
5 |
|
|
// HAL auxiliary objects and code; per platform
|
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, 2003, 2004 Free Software Foundation, 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
|
16 |
|
|
// version.
|
17 |
|
|
//
|
18 |
|
|
// eCos is distributed in the hope that it will be useful, but WITHOUT
|
19 |
|
|
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
20 |
|
|
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
21 |
|
|
// for more details.
|
22 |
|
|
//
|
23 |
|
|
// You should have received a copy of the GNU General Public License
|
24 |
|
|
// along with eCos; if not, write to the Free Software Foundation, Inc.,
|
25 |
|
|
// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
26 |
|
|
//
|
27 |
|
|
// As a special exception, if other files instantiate templates or use
|
28 |
|
|
// macros or inline functions from this file, or you compile this file
|
29 |
|
|
// and link it with other works to produce a work based on this file,
|
30 |
|
|
// this file does not by itself cause the resulting work to be covered by
|
31 |
|
|
// the GNU General Public License. However the source code for this file
|
32 |
|
|
// must still be made available in accordance with section (3) of the GNU
|
33 |
|
|
// General Public License v2.
|
34 |
|
|
//
|
35 |
|
|
// This exception does not invalidate any other reasons why a work based
|
36 |
|
|
// on this file might be covered by the GNU General Public License.
|
37 |
|
|
// -------------------------------------------
|
38 |
|
|
// ####ECOSGPLCOPYRIGHTEND####
|
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 |
|
|
|
76 |
|
|
void
|
77 |
|
|
_adder_set_leds(int pat);
|
78 |
|
|
|
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
|
87 |
|
|
eppc->cpmi_cicr &= ~0xFF0000; // Routing bits
|
88 |
|
|
eppc->cpmi_cicr |= 0x240000; // SCC2, SCC3 on "normal" bit positions
|
89 |
|
|
|
90 |
|
|
#if defined(CYGHWR_HAL_POWERPC_ADDER_I)
|
91 |
|
|
eppc->pip_pbpar &= ~0x0000400E; // PB29..30 AS GPIO
|
92 |
|
|
eppc->pip_pbdir |= 0x0000400E;
|
93 |
|
|
eppc->pip_pbdat = 0x00004000;
|
94 |
|
|
#endif
|
95 |
|
|
|
96 |
|
|
#if defined(CYGHWR_HAL_POWERPC_ADDER_II)
|
97 |
|
|
|
98 |
|
|
#if defined(CYGHWR_HAL_POWERPC_MPC8XX_852T)
|
99 |
|
|
// Special settings - according to manual errata
|
100 |
|
|
eppc->pio_papar &= ~0xffffffff; // PA manatory settings
|
101 |
|
|
eppc->pio_padir |= 0xffffffff;
|
102 |
|
|
|
103 |
|
|
eppc->pip_pbpar &= ~0x0003ff07; // PB29..31 AS GPIO
|
104 |
|
|
eppc->pip_pbdir |= 0x0003ff07;
|
105 |
|
|
eppc->pip_pbdat = 0x00010007;
|
106 |
|
|
|
107 |
|
|
eppc->pio_pcpar &= ~0xffffffff; // PC manatory settings
|
108 |
|
|
eppc->pio_pcdir |= 0xffffffff;
|
109 |
|
|
#endif
|
110 |
|
|
|
111 |
|
|
eppc->pip_pbpar &= ~0x00000007; // PB29..31 AS GPIO for LEDS
|
112 |
|
|
eppc->pip_pbdir |= 0x00000007;
|
113 |
|
|
eppc->pip_pbdat |= 0x00000007;
|
114 |
|
|
#endif
|
115 |
|
|
|
116 |
|
|
hal_if_init();
|
117 |
|
|
|
118 |
|
|
_adder_set_leds(0x1);
|
119 |
|
|
}
|
120 |
|
|
|
121 |
|
|
#ifdef CYGHWR_HAL_POWERPC_ADDER_I
|
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 |
|
|
}
|
137 |
|
|
#endif
|
138 |
|
|
|
139 |
|
|
#ifdef CYGHWR_HAL_POWERPC_ADDER_II
|
140 |
|
|
void
|
141 |
|
|
_adder_set_leds(int pat)
|
142 |
|
|
{
|
143 |
|
|
volatile EPPC *eppc = (volatile EPPC *)eppc_base();
|
144 |
|
|
|
145 |
|
|
eppc->pip_pbdat = (eppc->pip_pbdat & ~0x00000007) |(~(pat&0x0007) );
|
146 |
|
|
}
|
147 |
|
|
|
148 |
|
|
int
|
149 |
|
|
_adder_get_leds(void)
|
150 |
|
|
{
|
151 |
|
|
volatile EPPC *eppc = (volatile EPPC *)eppc_base();
|
152 |
|
|
|
153 |
|
|
return ((~(eppc->pip_pbdat & 0x00000007)) & 0x0007 );
|
154 |
|
|
}
|
155 |
|
|
#endif
|
156 |
|
|
|
157 |
|
|
// EOF hal_aux.c
|