]> git.kernelconcepts.de Git - karo-tx-redboot.git/blob - packages/hal/arm/edb7xxx/v2_0/include/hal_platform_extras.h
Initial revision
[karo-tx-redboot.git] / packages / hal / arm / edb7xxx / v2_0 / include / hal_platform_extras.h
1 #ifndef CYGONCE_HAL_PLATFORM_EXTRAS_H
2 #define CYGONCE_HAL_PLATFORM_EXTRAS_H
3
4 /*=============================================================================
5 //
6 //      hal_platform_extras.h
7 //
8 //      Platform specific support for HAL (assembly code)
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: gthomas
48 // Date:         1999-11-23
49 // Purpose:      Cirrus EDB7XXX platform extras, in particular MMU tables
50 // Description: 
51 // Usage:       #include <cyg/hal/hal_platform_extras.h>
52 //
53 //####DESCRIPTIONEND####
54 //
55 //===========================================================================*/
56
57         .section ".mmu_tables","aw"
58
59 #define NEXT_PAGE                \
60         .long   PTE                     ; \
61         .set    PTE,PTE+MMU_PAGE_SIZE
62 _PT_0x0:
63 #if (CYGHWR_HAL_ARM_EDB7XXX_DRAM_SIZE == 2)
64 #err Static MMU tables not yet available for 2M boards.
65 #elif (CYGHWR_HAL_ARM_EDB7XXX_DRAM_SIZE == 16)
66         .set    PTE,(DRAM_PA_START+LCD_BUFFER_SIZE)|MMU_L2_TYPE_Small\
67                     |MMU_AP_Any|MMU_Bufferable|MMU_Cacheable
68         .rept   (0x800000-LCD_BUFFER_SIZE)/0x1000
69         NEXT_PAGE
70         .endr
71         .set    PTE,(DRAM_PA_START+0x01000000)|MMU_L2_TYPE_Small\
72                     |MMU_AP_Any|MMU_Bufferable|MMU_Cacheable
73         .rept   0x800000/0x1000
74         NEXT_PAGE
75         .endr
76 #endif
77         .balign 0x0400
78
79 // Too bad these macros don't work ['as' bug?] :-(
80
81 #define NEXT_SECTION                                            \
82         .long   PTE+OFF                                        ;\
83         .set    OFF,OFF+(MMU_SECTION_SIZE/MMU_PAGE_SIZE)*4
84
85 #define FILL_SEGMENT_(base)                     \
86         .set    PTE,base                        \
87         .set    OFF,0x00000000                  \
88         .rept   0x10000000/MMU_SECTION_SIZE     \
89             NEXT_SECTION                        \
90         .endr
91
92 #define OFF     ((MMU_SECTION_SIZE/MMU_PAGE_SIZE)*4)
93
94 #define FILL_16M_SEGMENT(base,seg)              \
95         .long   base+(OFF*(seg+0x00));          \
96         .long   base+(OFF*(seg+0x01));          \
97         .long   base+(OFF*(seg+0x02));          \
98         .long   base+(OFF*(seg+0x03));          \
99         .long   base+(OFF*(seg+0x04));          \
100         .long   base+(OFF*(seg+0x05));          \
101         .long   base+(OFF*(seg+0x06));          \
102         .long   base+(OFF*(seg+0x07));          \
103         .long   base+(OFF*(seg+0x08));          \
104         .long   base+(OFF*(seg+0x09));          \
105         .long   base+(OFF*(seg+0x0A));          \
106         .long   base+(OFF*(seg+0x0B));          \
107         .long   base+(OFF*(seg+0x0C));          \
108         .long   base+(OFF*(seg+0x0D));          \
109         .long   base+(OFF*(seg+0x0E));          \
110         .long   base+(OFF*(seg+0x0F));
111
112 #define FILL_256M_SEGMENT(base)                 \
113         FILL_16M_SEGMENT(base,0x00);            \
114         FILL_16M_SEGMENT(base,0x10);            \
115         FILL_16M_SEGMENT(base,0x20);            \
116         FILL_16M_SEGMENT(base,0x30);            \
117         FILL_16M_SEGMENT(base,0x40);            \
118         FILL_16M_SEGMENT(base,0x50);            \
119         FILL_16M_SEGMENT(base,0x60);            \
120         FILL_16M_SEGMENT(base,0x70);            \
121         FILL_16M_SEGMENT(base,0x80);            \
122         FILL_16M_SEGMENT(base,0x90);            \
123         FILL_16M_SEGMENT(base,0xA0);            \
124         FILL_16M_SEGMENT(base,0xB0);            \
125         FILL_16M_SEGMENT(base,0xC0);            \
126         FILL_16M_SEGMENT(base,0xD0);            \
127         FILL_16M_SEGMENT(base,0xE0);            \
128         FILL_16M_SEGMENT(base,0xF0);
129
130         .balign 0x4000
131 _MMU_table:     
132         FILL_16M_SEGMENT(_PT_0x0-0xE0000000+MMU_L1_TYPE_Page,0x00)
133         FILL_16M_SEGMENT(MMU_L1_TYPE_Fault,0x00)
134         FILL_16M_SEGMENT(MMU_L1_TYPE_Fault,0x00)
135         FILL_16M_SEGMENT(MMU_L1_TYPE_Fault,0x00)
136         FILL_16M_SEGMENT(MMU_L1_TYPE_Fault,0x00)
137         FILL_16M_SEGMENT(MMU_L1_TYPE_Fault,0x00)
138         FILL_16M_SEGMENT(MMU_L1_TYPE_Fault,0x00)
139         FILL_16M_SEGMENT(MMU_L1_TYPE_Fault,0x00)
140         FILL_16M_SEGMENT(MMU_L1_TYPE_Fault,0x00)
141         FILL_16M_SEGMENT(MMU_L1_TYPE_Fault,0x00)
142         FILL_16M_SEGMENT(MMU_L1_TYPE_Fault,0x00)
143         FILL_16M_SEGMENT(MMU_L1_TYPE_Fault,0x00)
144         FILL_16M_SEGMENT(MMU_L1_TYPE_Fault,0x00)
145         FILL_16M_SEGMENT(MMU_L1_TYPE_Fault,0x00)
146         FILL_16M_SEGMENT(MMU_L1_TYPE_Fault,0x00)
147         FILL_16M_SEGMENT(MMU_L1_TYPE_Fault,0x00)
148         FILL_256M_SEGMENT(MMU_L1_TYPE_Fault)
149         FILL_256M_SEGMENT(EXPANSION2_PA|MMU_L1_TYPE_Section|MMU_AP_Any)
150         FILL_256M_SEGMENT(EXPANSION3_PA|MMU_L1_TYPE_Section|MMU_AP_Any)
151         FILL_256M_SEGMENT(MMU_L1_TYPE_Fault)
152         FILL_256M_SEGMENT(MMU_L1_TYPE_Fault)
153         FILL_256M_SEGMENT(SRAM_PA|MMU_L1_TYPE_Section|MMU_AP_Any)
154         FILL_256M_SEGMENT(MMU_L1_TYPE_Fault)
155         FILL_256M_SEGMENT(IO_PA|MMU_L1_TYPE_Section|MMU_AP_Any)
156         FILL_256M_SEGMENT(MMU_L1_TYPE_Fault)
157         FILL_256M_SEGMENT(MMU_L1_TYPE_Fault)
158         FILL_256M_SEGMENT(MMU_L1_TYPE_Fault)
159         FILL_256M_SEGMENT(DRAM_PA|MMU_L1_TYPE_Section|MMU_AP_Any)
160         FILL_256M_SEGMENT(MMU_L1_TYPE_Fault)
161         FILL_256M_SEGMENT(ROM0_PA|MMU_L1_TYPE_Section|MMU_AP_Any)
162         FILL_256M_SEGMENT(ROM1_PA|MMU_L1_TYPE_Section|MMU_AP_Any)
163
164 #endif // CYGONCE_HAL_PLATFORM_EXTRAS_H