OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [ecos-2.0/] [packages/] [hal/] [arm/] [sa11x0/] [ipaq/] [v2_0/] [src/] [ipaq_misc.c] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1254 phoenix
//==========================================================================
2
//
3
//      ipaq_misc.c
4
//
5
//      HAL misc board support code for StrongARM SA1110/iPAQ
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):    gthomas
44
// Contributors: hmt
45
//               Travis C. Furrer <furrer@mit.edu>
46
//               Richard Panton <richard.panton@3glab.com>
47
// Date:         2001-02-24
48
// Purpose:      HAL board support
49
// Description:  Implementations of HAL board interfaces
50
//
51
//####DESCRIPTIONEND####
52
//
53
//========================================================================*/
54
 
55
#include <pkgconf/hal.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_if.h>             // Virtual vector interfaces
63
#include <cyg/hal/hal_arch.h>           // Register state info
64
#include <cyg/hal/hal_diag.h>
65
#include <cyg/hal/hal_intr.h>           // Interrupt names
66
#include <cyg/hal/hal_cache.h>
67
#include <cyg/hal/hal_sa11x0.h>         // Hardware definitions
68
#include <cyg/hal/ipaq.h>               // Platform specifics
69
 
70
#include <cyg/infra/diag.h>             // diag_printf
71
 
72
#include <cyg/hal/lcd_support.h>
73
#include <cyg/hal/atmel_support.h>
74
 
75
// All the MM table layout is here:
76
#include <cyg/hal/hal_mm.h>
77
 
78
#include <string.h>                     // memset()
79
 
80
void
81
hal_mmu_init(void)
82
{
83
    unsigned long ttb_base = SA11X0_RAM_BANK0_BASE + 0x4000;
84
    unsigned long i;
85
 
86
    /*
87
     * Set the TTB register
88
     */
89
    asm volatile ("mcr  p15,0,%0,c2,c0,0" : : "r"(ttb_base) /*:*/);
90
 
91
    /*
92
     * Set the Domain Access Control Register
93
     */
94
    i = ARM_ACCESS_DACR_DEFAULT;
95
    asm volatile ("mcr  p15,0,%0,c3,c0,0" : : "r"(i) /*:*/);
96
 
97
    /*
98
     * First clear all TT entries - ie Set them to Faulting
99
     */
100
    memset((void *)ttb_base, 0, ARM_FIRST_LEVEL_PAGE_TABLE_SIZE);
101
 
102
    /*               Actual  Virtual  Size   Attributes                                                    Function  */
103
    /*               Base     Base     MB      cached?           buffered?        access permissions                 */
104
    /*             xxx00000  xxx00000                                                                                */
105
    X_ARM_MMU_SECTION(0x000,  0x500,    32,  ARM_CACHEABLE,   ARM_BUFFERABLE,   ARM_ACCESS_PERM_RW_RW); /* Boot flash ROMspace */
106
    X_ARM_MMU_SECTION(0x080,  0x080,     4,  ARM_CACHEABLE,   ARM_BUFFERABLE,   ARM_ACCESS_PERM_RW_RW); /* Application flash ROM */
107
    X_ARM_MMU_SECTION(0x100,  0x100,   128,  ARM_UNCACHEABLE, ARM_UNBUFFERABLE, ARM_ACCESS_PERM_RW_RW); /* SA-1101 Development Board Registers */
108
    X_ARM_MMU_SECTION(0x180,  0x180,   128,  ARM_UNCACHEABLE, ARM_UNBUFFERABLE, ARM_ACCESS_PERM_RW_RW); /* Ethernet Adaptor */
109
    X_ARM_MMU_SECTION(0x184,  0x184,     1,  ARM_UNCACHEABLE, ARM_UNBUFFERABLE, ARM_ACCESS_PERM_RW_RW); /* XBusReg    */
110
    X_ARM_MMU_SECTION(0x188,  0x188,     1,  ARM_UNCACHEABLE, ARM_UNBUFFERABLE, ARM_ACCESS_PERM_RW_RW); /* SysRegA    */
111
    X_ARM_MMU_SECTION(0x18C,  0x18C,     1,  ARM_UNCACHEABLE, ARM_UNBUFFERABLE, ARM_ACCESS_PERM_RW_RW); /* SysRegB    */
112
    X_ARM_MMU_SECTION(0x190,  0x190,     4,  ARM_UNCACHEABLE, ARM_UNBUFFERABLE, ARM_ACCESS_PERM_RW_RW); /* CPLD A     */
113
    X_ARM_MMU_SECTION(0x194,  0x194,     4,  ARM_UNCACHEABLE, ARM_UNBUFFERABLE, ARM_ACCESS_PERM_RW_RW); /* CPLD B     */
114
    X_ARM_MMU_SECTION(0x200,  0x200,   512,  ARM_UNCACHEABLE, ARM_UNBUFFERABLE, ARM_ACCESS_PERM_RW_RW); /* PCMCIA Socket A */
115
    X_ARM_MMU_SECTION(0x300,  0x300,   512,  ARM_UNCACHEABLE, ARM_UNBUFFERABLE, ARM_ACCESS_PERM_RW_RW); /* PCMCIA Sockets B */
116
    X_ARM_MMU_SECTION(0x400,  0x400,   128,  ARM_UNCACHEABLE, ARM_UNBUFFERABLE, ARM_ACCESS_PERM_RW_RW); /* SA1111 Daughter card */
117
    X_ARM_MMU_SECTION(0x480,  0x480,   128,  ARM_UNCACHEABLE, ARM_UNBUFFERABLE, ARM_ACCESS_PERM_RW_RW); /* Video Controller Daughter card */
118
    X_ARM_MMU_SECTION(0x800,  0x800, 0x400,  ARM_UNCACHEABLE, ARM_UNBUFFERABLE, ARM_ACCESS_PERM_RW_RW); /* StrongARM(R) Registers */
119
    X_ARM_MMU_SECTION(0xC00,  0x000,    32,  ARM_CACHEABLE,   ARM_BUFFERABLE,   ARM_ACCESS_PERM_RW_RW); /* DRAM Bank 0 */
120
    X_ARM_MMU_SECTION(0xC00,  0xC00,    32,  ARM_UNCACHEABLE, ARM_BUFFERABLE,   ARM_ACCESS_PERM_RW_RW); /* DRAM Bank 0 */
121
    X_ARM_MMU_SECTION(0xE00,  0xE00,   128,  ARM_CACHEABLE,   ARM_BUFFERABLE,   ARM_ACCESS_PERM_RW_RW); /* Zeros (Cache Clean) Bank */
122
 
123
}
124
 
125
//
126
// Board control register support
127
//   Update the board control register (write only).  Only the bits
128
// specified by 'mask' are changed to 'value'.
129
//
130
 
131
void
132
ipaq_EGPIO(unsigned long mask, unsigned long value)
133
{
134
    _ipaq_EGPIO = (_ipaq_EGPIO & ~mask) | (mask & value);
135
    *SA1110_EGPIO = _ipaq_EGPIO;
136
}
137
 
138
//
139
// Platform specific initialization
140
//
141
 
142
void
143
plf_hardware_init(void)
144
{
145
    // Force "alternate" use of GPIO pins used for LCD screen
146
    *SA11X0_GPIO_ALTERNATE_FUNCTION |= 0x000003FC;      // Bits 2..9
147
    *SA11X0_GPIO_PIN_DIRECTION |= 0x000003FC;           // Bits 2..9
148
    *SA11X0_GPIO_PIN_OUTPUT_CLEAR = 0x000003FC;         // Bits 2..9
149
 
150
    // Pins used for buttons, communications with Atmel
151
    //*SA11X0_GPIO_PIN_DIRECTION &= 0x03FE0C003;
152
    *SA11X0_GPIO_RISING_EDGE_DETECT |= 0x00000002;
153
    *SA11X0_GPIO_FALLING_EDGE_DETECT |= 0x00000002;
154
 
155
    // Setup communication with Atmel micro-controller
156
    *SA1110_GPCLK_CONTROL_0 = SA1110_GPCLK_SUS_UART;
157
    *SA11X0_PPC_PIN_ASSIGNMENT &= ~SA11X0_PPC_UART_PIN_REASSIGNED;
158
    atmel_init();
159
}
160
 
161
//
162
// Support for platform specific I/O channels
163
//
164
 
165
void
166
plf_if_init(void)
167
{
168
    // Initialize screen
169
    lcd_init(16);
170
#ifdef CYGSEM_IPAQ_LCD_COMM
171
    // Initialize I/O channel
172
    lcd_comm_init();
173
#endif
174
}
175
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.