]> git.kernelconcepts.de Git - karo-tx-redboot.git/blob - packages/hal/arm/cma230/v2_0/include/hal_platform_extras.h
Initial revision
[karo-tx-redboot.git] / packages / hal / arm / cma230 / 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, msalter
48 // Date:         1999-12-02
49 // Purpose:      Cogent CMA222 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
63 _PT_0x0:
64         .set    PTE,DRAM_PA_START|MMU_L2_TYPE_Small\
65                     |MMU_AP_Any|MMU_Bufferable|MMU_Cacheable
66         .rept   (0x2000000)/0x1000
67         NEXT_PAGE
68         .endr
69         .balign 0x0400
70
71 // Too bad these macros don't work ['as' bug?] :-(
72
73 #define NEXT_SECTION                                            \
74         .long   PTE+OFF                                        ;\
75         .set    OFF,OFF+(MMU_SECTION_SIZE/MMU_PAGE_SIZE)*4
76
77 #define FILL_SEGMENT_(base)                     \
78         .set    PTE,base                        \
79         .set    OFF,0x00000000                  \
80         .rept   0x10000000/MMU_SECTION_SIZE     \
81             NEXT_SECTION                        \
82         .endr
83
84 #define OFF     ((MMU_SECTION_SIZE/MMU_PAGE_SIZE)*4)
85
86 #define FILL_8M_SEGMENT(base,seg)               \
87         .long   base+(OFF*(seg+0x00));          \
88         .long   base+(OFF*(seg+0x01));          \
89         .long   base+(OFF*(seg+0x02));          \
90         .long   base+(OFF*(seg+0x03));          \
91         .long   base+(OFF*(seg+0x04));          \
92         .long   base+(OFF*(seg+0x05));          \
93         .long   base+(OFF*(seg+0x06));          \
94         .long   base+(OFF*(seg+0x07));          \
95         .long   base+(OFF*(seg+0x08));
96
97 #define FILL_16M_SEGMENT(base,seg)              \
98         .long   base+(OFF*(seg+0x00));          \
99         .long   base+(OFF*(seg+0x01));          \
100         .long   base+(OFF*(seg+0x02));          \
101         .long   base+(OFF*(seg+0x03));          \
102         .long   base+(OFF*(seg+0x04));          \
103         .long   base+(OFF*(seg+0x05));          \
104         .long   base+(OFF*(seg+0x06));          \
105         .long   base+(OFF*(seg+0x07));          \
106         .long   base+(OFF*(seg+0x08));          \
107         .long   base+(OFF*(seg+0x09));          \
108         .long   base+(OFF*(seg+0x0A));          \
109         .long   base+(OFF*(seg+0x0B));          \
110         .long   base+(OFF*(seg+0x0C));          \
111         .long   base+(OFF*(seg+0x0D));          \
112         .long   base+(OFF*(seg+0x0E));          \
113         .long   base+(OFF*(seg+0x0F));
114
115 #define FILL_32M_SEGMENT(base,seg)              \
116         FILL_16M_SEGMENT(base,0x00);            \
117         FILL_16M_SEGMENT(base,0x10);
118
119 #define FILL_256M_SEGMENT(base)                 \
120         FILL_16M_SEGMENT(base,0x00);            \
121         FILL_16M_SEGMENT(base,0x10);            \
122         FILL_16M_SEGMENT(base,0x20);            \
123         FILL_16M_SEGMENT(base,0x30);            \
124         FILL_16M_SEGMENT(base,0x40);            \
125         FILL_16M_SEGMENT(base,0x50);            \
126         FILL_16M_SEGMENT(base,0x60);            \
127         FILL_16M_SEGMENT(base,0x70);            \
128         FILL_16M_SEGMENT(base,0x80);            \
129         FILL_16M_SEGMENT(base,0x90);            \
130         FILL_16M_SEGMENT(base,0xA0);            \
131         FILL_16M_SEGMENT(base,0xB0);            \
132         FILL_16M_SEGMENT(base,0xC0);            \
133         FILL_16M_SEGMENT(base,0xD0);            \
134         FILL_16M_SEGMENT(base,0xE0);            \
135         FILL_16M_SEGMENT(base,0xF0);
136
137         .balign 0x4000
138 _MMU_table:     
139         FILL_32M_SEGMENT(_PT_0x0+MMU_L1_TYPE_Page,0x00)
140         FILL_32M_SEGMENT(MMU_L1_TYPE_Fault,0x00)
141         FILL_32M_SEGMENT(PCIMEM_PA|MMU_L1_TYPE_Section|MMU_AP_Any)
142         FILL_32M_SEGMENT(MMU_L1_TYPE_Fault,0x00)
143         FILL_32M_SEGMENT(MMU_L1_TYPE_Fault,0x00)
144         FILL_32M_SEGMENT(MMU_L1_TYPE_Fault,0x00)
145         FILL_32M_SEGMENT(MMU_L1_TYPE_Fault,0x00)
146         FILL_8M_SEGMENT(ROM_PA|MMU_L1_TYPE_Section|MMU_AP_Any)
147         FILL_16M_SEGMENT(MBIO_PA|MMU_L1_TYPE_Section|MMU_AP_Any)
148         FILL_8M_SEGMENT(FLASH_PA|MMU_L1_TYPE_Section|MMU_AP_Any)
149         FILL_256M_SEGMENT(MMU_L1_TYPE_Fault)
150         FILL_256M_SEGMENT(MMU_L1_TYPE_Fault)
151         FILL_256M_SEGMENT(MMU_L1_TYPE_Fault)
152         FILL_256M_SEGMENT(MMU_L1_TYPE_Fault)
153         FILL_256M_SEGMENT(MMU_L1_TYPE_Fault)
154         FILL_256M_SEGMENT(MMU_L1_TYPE_Fault)
155         FILL_256M_SEGMENT(MMU_L1_TYPE_Fault)
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(MMU_L1_TYPE_Fault)
160         FILL_256M_SEGMENT(MMU_L1_TYPE_Fault)
161         FILL_256M_SEGMENT(MMU_L1_TYPE_Fault)
162         FILL_256M_SEGMENT(MMU_L1_TYPE_Fault)
163         FILL_256M_SEGMENT(MMU_L1_TYPE_Fault)
164
165 #endif // CYGONCE_HAL_PLATFORM_EXTRAS_H