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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [ecos-2.0/] [packages/] [hal/] [arm/] [sa11x0/] [var/] [v2_0/] [include/] [hal_mm.h] - Blame information for rev 1254

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1254 phoenix
#ifndef CYGONCE_HAL_MM_H
2
#define CYGONCE_HAL_MM_H
3
 
4
//=============================================================================
5
//
6
//      hal_mm.h
7
//
8
//      ARM SA11x0 MM common definitions 
9
//
10
//=============================================================================
11
//####ECOSGPLCOPYRIGHTBEGIN####
12
// -------------------------------------------
13
// This file is part of eCos, the Embedded Configurable Operating System.
14
// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
15
//
16
// eCos is free software; you can redistribute it and/or modify it under
17
// the terms of the GNU General Public License as published by the Free
18
// Software Foundation; either version 2 or (at your option) any later version.
19
//
20
// eCos is distributed in the hope that it will be useful, but WITHOUT ANY
21
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
22
// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
23
// for more details.
24
//
25
// You should have received a copy of the GNU General Public License along
26
// with eCos; if not, write to the Free Software Foundation, Inc.,
27
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
28
//
29
// As a special exception, if other files instantiate templates or use macros
30
// or inline functions from this file, or you compile this file and link it
31
// with other works to produce a work based on this file, this file does not
32
// by itself cause the resulting work to be covered by the GNU General Public
33
// License. However the source code for this file must still be made available
34
// in accordance with section (3) of the GNU General Public License.
35
//
36
// This exception does not invalidate any other reasons why a work based on
37
// this file might be covered by the GNU General Public License.
38
//
39
// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
40
// at http://sources.redhat.com/ecos/ecos-license/
41
// -------------------------------------------
42
//####ECOSGPLCOPYRIGHTEND####
43
//=============================================================================
44
//#####DESCRIPTIONBEGIN####
45
//
46
// Author(s):    gthomas
47
// Contributors: hmt
48
//               Travis C. Furrer <furrer@mit.edu>
49
// Date:         2000-12-13
50
// Purpose:      ARM SA11x0 MM common definitions
51
// Description:  The macros defined here provide common definitions for
52
//               memory management initialization.
53
// Usage:
54
//               #include <cyg/hal/hal_mm.h>
55
//               ...
56
//              
57
//
58
//####DESCRIPTIONEND####
59
//
60
//=============================================================================
61
 
62
 
63
// -------------------------------------------------------------------------
64
// MMU initialization:
65
// 
66
// These structures are laid down in memory to define the translation
67
// table.
68
// 
69
 
70
/*
71
 * SA-1100 Translation Table Base Bit Masks
72
 */
73
#define ARM_TRANSLATION_TABLE_MASK               0xFFFFC000
74
 
75
/*
76
 * SA-1100 Domain Access Control Bit Masks
77
 */
78
#define ARM_ACCESS_TYPE_NO_ACCESS(domain_num)    (0x0 << (domain_num)*2)
79
#define ARM_ACCESS_TYPE_CLIENT(domain_num)       (0x1 << (domain_num)*2)
80
#define ARM_ACCESS_TYPE_MANAGER(domain_num)      (0x3 << (domain_num)*2)
81
 
82
struct ARM_MMU_FIRST_LEVEL_FAULT {
83
    unsigned int id : 2;
84
    unsigned int sbz : 30;
85
};
86
#define ARM_MMU_FIRST_LEVEL_FAULT_ID 0x0
87
 
88
struct ARM_MMU_FIRST_LEVEL_PAGE_TABLE {
89
    unsigned int id : 2;
90
    unsigned int imp : 2;
91
    unsigned int domain : 4;
92
    unsigned int sbz : 1;
93
    unsigned int base_address : 23;
94
};
95
#define ARM_MMU_FIRST_LEVEL_PAGE_TABLE_ID 0x1
96
 
97
struct ARM_MMU_FIRST_LEVEL_SECTION {
98
    unsigned int id : 2;
99
    unsigned int b : 1;
100
    unsigned int c : 1;
101
    unsigned int imp : 1;
102
    unsigned int domain : 4;
103
    unsigned int sbz0 : 1;
104
    unsigned int ap : 2;
105
    unsigned int sbz1 : 8;
106
    unsigned int base_address : 12;
107
};
108
#define ARM_MMU_FIRST_LEVEL_SECTION_ID 0x2
109
 
110
struct ARM_MMU_FIRST_LEVEL_RESERVED {
111
    unsigned int id : 2;
112
    unsigned int sbz : 30;
113
};
114
#define ARM_MMU_FIRST_LEVEL_RESERVED_ID 0x3
115
 
116
#define ARM_MMU_FIRST_LEVEL_DESCRIPTOR_ADDRESS(ttb_base, table_index) \
117
   (unsigned long *)((unsigned long)(ttb_base) + ((table_index) << 2))
118
 
119
#define ARM_FIRST_LEVEL_PAGE_TABLE_SIZE 0x4000
120
 
121
#define ARM_MMU_SECTION(ttb_base, actual_base, virtual_base,              \
122
                        cacheable, bufferable, perm)                      \
123
    CYG_MACRO_START                                                       \
124
        register union ARM_MMU_FIRST_LEVEL_DESCRIPTOR desc;               \
125
                                                                          \
126
        desc.word = 0;                                                    \
127
        desc.section.id = ARM_MMU_FIRST_LEVEL_SECTION_ID;                 \
128
        desc.section.domain = 0;                                          \
129
        desc.section.c = (cacheable);                                     \
130
        desc.section.b = (bufferable);                                    \
131
        desc.section.ap = (perm);                                         \
132
        desc.section.base_address = (actual_base);                        \
133
        *ARM_MMU_FIRST_LEVEL_DESCRIPTOR_ADDRESS(ttb_base, (virtual_base)) \
134
                            = desc.word;                                  \
135
    CYG_MACRO_END
136
 
137
#define X_ARM_MMU_SECTION(abase,vbase,size,cache,buff,access)      \
138
    { int i; int j = abase; int k = vbase;                         \
139
      for (i = size; i > 0 ; i--,j++,k++)                          \
140
      {                                                            \
141
        ARM_MMU_SECTION(ttb_base, j, k, cache, buff, access);      \
142
      }                                                            \
143
    }
144
 
145
union ARM_MMU_FIRST_LEVEL_DESCRIPTOR {
146
    unsigned long word;
147
    struct ARM_MMU_FIRST_LEVEL_FAULT fault;
148
    struct ARM_MMU_FIRST_LEVEL_PAGE_TABLE page_table;
149
    struct ARM_MMU_FIRST_LEVEL_SECTION section;
150
    struct ARM_MMU_FIRST_LEVEL_RESERVED reserved;
151
};
152
 
153
#define ARM_UNCACHEABLE                         0
154
#define ARM_CACHEABLE                           1
155
#define ARM_UNBUFFERABLE                        0
156
#define ARM_BUFFERABLE                          1
157
 
158
#define ARM_ACCESS_PERM_NONE_NONE               0
159
#define ARM_ACCESS_PERM_RO_NONE                 0
160
#define ARM_ACCESS_PERM_RO_RO                   0
161
#define ARM_ACCESS_PERM_RW_NONE                 1
162
#define ARM_ACCESS_PERM_RW_RO                   2
163
#define ARM_ACCESS_PERM_RW_RW                   3
164
 
165
/*
166
 * Initialization for the Domain Access Control Register
167
 */
168
#define ARM_ACCESS_DACR_DEFAULT      (          \
169
        ARM_ACCESS_TYPE_MANAGER(0)    |         \
170
        ARM_ACCESS_TYPE_NO_ACCESS(1)  |         \
171
        ARM_ACCESS_TYPE_NO_ACCESS(2)  |         \
172
        ARM_ACCESS_TYPE_NO_ACCESS(3)  |         \
173
        ARM_ACCESS_TYPE_NO_ACCESS(4)  |         \
174
        ARM_ACCESS_TYPE_NO_ACCESS(5)  |         \
175
        ARM_ACCESS_TYPE_NO_ACCESS(6)  |         \
176
        ARM_ACCESS_TYPE_NO_ACCESS(7)  |         \
177
        ARM_ACCESS_TYPE_NO_ACCESS(8)  |         \
178
        ARM_ACCESS_TYPE_NO_ACCESS(9)  |         \
179
        ARM_ACCESS_TYPE_NO_ACCESS(10) |         \
180
        ARM_ACCESS_TYPE_NO_ACCESS(11) |         \
181
        ARM_ACCESS_TYPE_NO_ACCESS(12) |         \
182
        ARM_ACCESS_TYPE_NO_ACCESS(13) |         \
183
        ARM_ACCESS_TYPE_NO_ACCESS(14) |         \
184
        ARM_ACCESS_TYPE_NO_ACCESS(15)  )
185
 
186
// ------------------------------------------------------------------------
187
#endif // ifndef CYGONCE_HAL_MM_H
188
// End of hal_mm.h
189
 
190
 
191
 
192
 
193
 

powered by: WebSVN 2.1.0

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