]> git.kernelconcepts.de Git - karo-tx-redboot.git/blob - packages/hal/arm/edb7xxx/v2_0/include/hal_platform_setup.h
Initial revision
[karo-tx-redboot.git] / packages / hal / arm / edb7xxx / v2_0 / include / hal_platform_setup.h
1 #ifndef CYGONCE_HAL_PLATFORM_SETUP_H
2 #define CYGONCE_HAL_PLATFORM_SETUP_H
3
4 /*=============================================================================
5 //
6 //      hal_platform_setup.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 // Copyright (C) 2003 Gary Thomas <gary@mind.be>
16 //
17 // eCos is free software; you can redistribute it and/or modify it under
18 // the terms of the GNU General Public License as published by the Free
19 // Software Foundation; either version 2 or (at your option) any later version.
20 //
21 // eCos is distributed in the hope that it will be useful, but WITHOUT ANY
22 // WARRANTY; without even the implied warranty of MERCHANTABILITY or
23 // FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
24 // for more details.
25 //
26 // You should have received a copy of the GNU General Public License along
27 // with eCos; if not, write to the Free Software Foundation, Inc.,
28 // 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
29 //
30 // As a special exception, if other files instantiate templates or use macros
31 // or inline functions from this file, or you compile this file and link it
32 // with other works to produce a work based on this file, this file does not
33 // by itself cause the resulting work to be covered by the GNU General Public
34 // License. However the source code for this file must still be made available
35 // in accordance with section (3) of the GNU General Public License.
36 //
37 // This exception does not invalidate any other reasons why a work based on
38 // this file might be covered by the GNU General Public License.
39 //
40 // Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
41 // at http://sources.redhat.com/ecos/ecos-license/
42 // -------------------------------------------
43 //####ECOSGPLCOPYRIGHTEND####
44 //=============================================================================
45 //#####DESCRIPTIONBEGIN####
46 //
47 // Author(s):    gthomas
48 // Contributors: gthomas
49 // Date:         1999-04-21
50 // Purpose:      Cirrus EDB7XXX platform specific support routines
51 // Description: 
52 // Usage:       #include <cyg/hal/hal_platform_setup.h>
53 //
54 //####DESCRIPTIONEND####
55 //
56 //===========================================================================*/
57
58 #include <pkgconf/system.h>           // System-wide configuration info
59 #include <pkgconf/hal.h>              // Architecture independent configuration
60 #include CYGBLD_HAL_PLATFORM_H        // Platform specific configuration
61 #include <cyg/hal/hal_edb7xxx.h>      // Platform specific hardware definitions
62 #include <cyg/hal/hal_mmu.h>          // MMU definitions
63
64 #define CYGHWR_HAL_ARM_HAS_MMU        // This processor has an MMU
65 #define CYGSEM_HAL_ROM_RESET_USES_JUMP
66 //
67 // Memory map - set up by ROM (GDB stubs)
68 //
69 // Region        Logical Address              Physical Address
70 //   DRAM          0x00000000..0x00xFFFFF        0xC00x0000  (see below)
71 //   Expansion 2   0x20000000                    0x20000000
72 //   Expansion 3   0x30000000                    0x30000000
73 //   PCMCIA 0      0x40000000                    0x40000000
74 //   PCMCIA 1      0x50000000                    0x50000000
75 //   SRAM          0x60000000..0x600007FF        0x60000000
76 //   I/O           0x80000000                    0x80000000
77 //   MMU Tables                                  0xC00y0000
78 //   LCD buffer    0xC0000000..0xC001FFFF        0xC0000000
79 //   ROM           0xE0000000..0xEFFFFFFF        0x00000000
80 //   ROM           0xF0000000..0xFFFFFFFF        0x10000000
81
82 #ifdef CYGHWR_HAL_ARM_EDB7XXX_LCD_INSTALLED
83 #define LCD_BUFFER_SIZE  0x00020000
84 #else
85 #define LCD_BUFFER_SIZE  0x00000000
86 #endif
87 #define DRAM_PA_START    0xC0000000
88 #define MMU_BASE         DRAM_PA_START+LCD_BUFFER_SIZE
89 #define PTE_BASE         MMU_BASE+0x4000
90 #if (CYGHWR_HAL_ARM_EDB7XXX_DRAM_SIZE == 2)
91 #define MMU_TABLES_SIZE  (0x4000+0x1000+0x1000)   // RAM used for PTE entries
92 #define DRAM_LA_END      (0x00200000-MMU_TABLES_SIZE-LCD_BUFFER_SIZE)
93 #elif (CYGHWR_HAL_ARM_EDB7XXX_DRAM_SIZE == 16)
94 #define MMU_TABLES_SIZE  (0x4000+0x4000+0x1000)  // RAM used for PTE entries
95 #define DRAM_LA_END      (0x01000000-MMU_TABLES_SIZE-LCD_BUFFER_SIZE)
96 #endif
97 #define DRAM_LA_START    0x00000000
98 #define DRAM_PA          MMU_BASE+MMU_TABLES_SIZE
99 #define LCD_LA_START     0xC0000000
100 #define LCD_LA_END       0xC0020000
101 #define LCD_PA           0xC0000000
102 #define ROM0_LA_START    0xE0000000
103 #define ROM0_PA          0x00000000
104 #if defined (__EDB7211) 
105 #define ROM0_LA_END      0xE0800000
106 #else
107 #define ROM0_LA_END      0xF0000000
108 #endif
109 #define ROM1_LA_START    ROM0_LA_END 
110 #define ROM1_LA_END      0x00000000
111 #define ROM1_PA          0x10000000
112 #define EXPANSION2_LA_START 0x20000000
113 #define EXPANSION2_PA       0x20000000
114 #define EXPANSION3_LA_START 0x30000000
115 #define EXPANSION3_PA       0x30000000
116 #define PCMCIA0_LA_START 0x40000000
117 #define PCMCIA0_PA       0x40000000
118 #define PCMCIA1_LA_START 0x50000000
119 #define PCMCIA1_PA       0x50000000
120 #define SRAM_LA_START    0x60000000
121 #ifdef CYGHWR_HAL_ARM_EDB7XXX_VARIANT_CL_PS7111 // 4K SRAM
122 #define SRAM_LA_END      0x60001000
123 #else  // 72xx - 37.5K SRAM
124 #define SRAM_LA_END      0x6000A000
125 #endif
126 #define SRAM_PA          0x60000000
127 #define IO_LA_START      0x80000000
128 #define IO_LA_END        0x8000f000
129 #define IO_PA            0x80000000
130
131 #ifndef _CYGHWR_LAYOUT_ONLY
132 // Define startup code [macros]
133 #if defined(CYGSEM_HAL_INSTALL_MMU_TABLES)
134
135 #ifdef CYGHWR_HAL_ARM_EDB7XXX_VARIANT_CL_PS7111 // CL7111, 710 processor
136         .macro MMU_INITIALIZE
137         ldr     r2,=MMU_Control_Init                                    
138         mcr     MMU_CP,0,r2,MMU_Control,c0      /* MMU off */           
139         mcr     MMU_CP,0,r1,MMU_Base,c0                                 
140         mcr     MMU_CP,0,r1,MMU_FlushTLB,c0,0   /* Invalidate TLB */    
141         mcr     MMU_CP,0,r1,MMU_FlushIDC,c0,0   /* Invalidate Caches */ 
142         ldr     r1,=0xFFFFFFFF                                          
143         mcr     MMU_CP,0,r1,MMU_DomainAccess,c0                         
144         ldr     r2,=10f                                                 
145         ldr     r1,=MMU_Control_Init|MMU_Control_M                      
146         mcr     MMU_CP,0,r1,MMU_Control,c0                              
147         mov     pc,r2    /* Change address spaces */                    
148         nop                                                             
149         nop                                                             
150         nop                                                             
151 10:
152         .endm
153 #else // EP7xxx, 720T processor
154         .macro  MMU_INITIALIZE                                        
155         ldr     r2,=MMU_Control_Init                                    
156         mcr     MMU_CP,0,r2,MMU_Control,c0    /* MMU off */             
157         mcr     MMU_CP,0,r1,MMU_Base,c0                                 
158         mcr     MMU_CP,0,r1,MMU_TLB,c7,0      /* Invalidate TLB */      
159         mcr     MMU_CP,0,r1,MMU_FlushIDC,c0,0 /* Invalidate Caches */   
160         ldr     r1,=0xFFFFFFFF                                          
161         mcr     MMU_CP,0,r1,MMU_DomainAccess,c0                         
162         ldr     r2,=10f      
163 #ifdef CYG_HAL_STARTUP_ROMRAM
164         ldr     r3,=__exception_handlers                                
165         sub     r2,r2,r3                                                
166         ldr     r3,=ROM0_LA_START                                       
167         add     r2,r2,r3  
168 #endif                                                      
169         ldr     r1,=MMU_Control_Init|MMU_Control_M                      
170         mcr     MMU_CP,0,r1,MMU_Control,c0                              
171         mov     pc,r2    /* Change address spaces */                    
172         nop                                                             
173         nop                                                             
174         nop                                                             
175 10:
176         .endm
177 #endif // EP7xxx,720T processor
178
179 #ifdef CYG_HAL_STARTUP_ROMRAM                                                  
180         .macro  RELOCATE_TEXT_SEGMENT
181         ldr     r2,=__exception_handlers
182         ldr     r3,=ROM0_LA_START       
183         cmp     r2,r3                   
184         beq     20f                     
185         ldr     r4,=__rom_data_end      
186 15:                                     
187         ldr     r0,[r3],#4              
188         str     r0,[r2],#4              
189         cmp     r2,r4                   
190         bne     15b            
191         ldr     r2,=20f      
192         mov     pc,r2    /* Change address spaces */                    
193         nop                                                             
194         nop                                                             
195         nop                                                             
196 20:
197         .endm        
198 #endif
199         
200 #ifdef CYG_HAL_STARTUP_RAM
201         .macro  RELOCATE_RAM_IMAGE
202 // Special code to handle case where program has been loaded into DRAM
203 // _somewhere_.  This code first relocates itself into DRAM where eCos
204 // mapping will expect it to be.  Note since we don't know the current
205 // MMU mapping, this is tricky.  This is handled by putting a small
206 // routine into SRAM (which is always mapped 1-1) that turns off the
207 // MMU whilst it stores one word into physical memory.  Once the whole
208 // program has been relocated thusly, the MMU is shut off again while
209 // the eCos memory mapping takes place                
210         bl      5f
211 // Routine to store one item in physical memory, with the MMU off        
212 _phys_store:
213         ldr     r5,=MMU_Control_Init
214         mcr     MMU_CP,0,r5,MMU_Control,c0    /* MMU off */
215         nop
216         nop
217         nop
218         mcr     MMU_CP,0,r1,MMU_TLB,c7,0      /* Invalidate TLB */
219         mcr     MMU_CP,0,r1,MMU_FlushIDC,c0,0 /* Invalidate Caches */
220         str     r4,[r2],#4
221         ldr     r5,=MMU_Control_Init|MMU_Control_M
222         mcr     MMU_CP,0,r5,MMU_Control,c0
223         mov     pc,lr
224 _phys_store_end:                
225 // Copy above routine to SRAM, whose address does not change with MMU        
226 5:      mov     r1,lr
227         add     r2,r1,#_phys_store_end-_phys_store
228         ldr     r3,=SRAM_LA_START
229 6:      ldr     r4,[r1],#4
230         str     r4,[r3],#4
231         cmp     r1,r2
232         bne     6b
233         ldr     r6,=SRAM_LA_START
234 // Relocate code in DRAM to where eCos mapping wants it
235         bl      7f
236 7:      mov     r2,lr
237         ldr     r1,=7b
238         sub     r1,r2,r1
239         ldr     r2,=__exception_handlers
240         add     r1,r1,r2
241 //        ldr     r1,=0xF0020000
242         ldr     r3,=DRAM_PA
243         add     r2,r2,r3
244 //        ldr     r2,=DRAM_PA+0x20000
245         ldr     r3,=_edata
246         ldr     r4,=__exception_handlers
247         sub     r3,r3,r4
248         add     r3,r1,r3
249 //        ldr     r3,=0xF0040000
250 10:     ldr     r4,[r1],#4
251         mov     lr,pc           // Call phys_store() function above
252         mov     pc,r6
253         cmp     r1,r3
254         bne     10b
255 // Now, turn off the MMU an execute the rest of this code in PHYSICAL memory        
256         ldr     r1,=15f
257         ldr     r2,=DRAM_PA
258         add     r1,r1,r2
259         ldr     r5,=MMU_Control_Init
260         mcr     MMU_CP,0,r5,MMU_Control,c0    /* MMU off */
261         mov     pc,r1
262         nop
263         nop
264         nop
265 15:     mcr     MMU_CP,0,r1,MMU_TLB,c7,0      /* Invalidate TLB */
266         mcr     MMU_CP,0,r1,MMU_FlushIDC,c0,0 /* Invalidate Caches */
267         .endm
268 #endif // CYG_HAL_STARTUP_RAM        
269 #ifdef CYGHWR_HAL_ARM_EDB7XXX_VARIANT_EP7312
270         .macro  INIT_MEMORY_CONFIG
271         mov     r0,#(CPSR_IRQ_DISABLE|CPSR_FIQ_DISABLE|CPSR_SUPERVISOR_MODE)
272         msr     cpsr,r0
273         ldr     r10,=UARTDR1
274         ldr     r11,=SYSFLG1
275         ldr     r12,=SYSFLG1_UTXFF1
276         ldr     r1,=SDCONF                      
277         ldr     r2,=0x00000522                  
278         str     r2,[r1]                         
279         ldr     r1,=SDRFOR                      
280         ldr     r2,=0x00000240                  
281         str     r2,[r1]                         
282         ldr     r1,=MEMCFG1                     
283         ldr     r2,=0x1F101710                  
284         str     r2,[r1]                         
285         ldr     r1,=MEMCFG2                     
286         ldr     r2,=0x00001F13                  
287         str     r2,[r1]
288         .endm
289 #else
290 #ifdef CYGHWR_HAL_ARM_EDB7XXX_VARIANT_EP7209
291 // No DRAM controller
292         .macro  INIT_MEMORY_CONFIG
293 /* Initialize memory configuration */
294         ldr     r1,=MEMCFG1
295         ldr     r2,=0x8200A080
296         str     r2,[r1]
297         ldr     r1,=MEMCFG2
298         ldr     r2,=0xFEFC0000
299         str     r2,[r1]
300         .endm
301 #else // CYGHWR_HAL_ARM_EDB7XXX_VARIANT = EP7211, EP7212
302         .macro  INIT_MEMORY_CONFIG
303 /* Initialize memory configuration */
304         ldr     r1,=MEMCFG1
305         ldr     r2,=0x8200A080
306         str     r2,[r1]
307         ldr     r1,=MEMCFG2
308         ldr     r2,=0xFEFC0000
309         str     r2,[r1]
310         ldr     r1,=DRFPR
311         ldr     r2,=0x81        /* DRAM refresh = 64KHz */
312         strb    r2,[r1]
313         .endm
314 #endif
315 #endif
316
317 #if defined(CYGSEM_HAL_STATIC_MMU_TABLES)
318 #define PLATFORM_SETUP1                          \
319         INIT_MEMORY_CONFIG                      ;\
320         ldr     r1,=_MMU_table-0xE0000000       ;\
321         MMU_INITIALIZE                          ;\
322         RELOCATE_TEXT_SEGMENT
323
324 #define PLATFORM_EXTRAS <cyg/hal/hal_platform_extras.h>
325
326 #else
327 // MMU tables placed in DRAM
328
329 #if (CYGHWR_HAL_ARM_EDB7XXX_DRAM_SIZE == 2)
330 // Note: The DRAM on this board is very irregular in that every
331 // other 256K piece is missing.  E.g. only these [physical]
332 // addresses are valid:
333 //   0xC0000000..0xC003FFFF
334 //   0xC0080000..0xC00BFFFF
335 //   0xC0200000..0xC023FFFF    Note the additional GAP!
336 //      etc.
337 //   0xC0800000..0xC083FFFF    Note the additional GAP!
338 //   0xC0880000..0xC08CFFFF
339 //   0xC0A00000..0xC0A3FFFF
340 //      etc.
341 // The MMU mapping code takes this into consideration and creates
342 // a continuous logical map for the DRAM.
343         .macro  MAP_DRAM
344 /* Map DRAM */
345         ldr     r3,=DRAM_LA_START
346         ldr     r4,=DRAM_LA_END
347         ldr     r5,=DRAM_PA
348 /* 0x00000000..0x000FFFFF */
349         mov     r6,r2           /* Set up page table descriptor */
350         ldr     r7,=MMU_L1_TYPE_Page
351         orr     r6,r6,r7
352         str     r6,[r1],#4      /* Store PTE, update pointer */
353 10:     mov     r6,r5           /* Build page table entry */
354         ldr     r7,=MMU_L2_TYPE_Small|MMU_AP_Any|MMU_Bufferable|MMU_Cacheable
355         orr     r6,r6,r7
356         ldr     r7,=MMU_PAGE_SIZE
357         str     r6,[r2],#4      /* Next page */
358         add     r3,r3,r7
359         add     r5,r5,r7
360         ldr     r8,=DRAM_LA_START+MMU_SECTION_SIZE
361         cmp     r3,r8           /* Done with first 1M? */
362         beq     20f
363         ldr     r7,=0x40000     /* Special check for 256K boundary */
364         and     r7,r7,r5
365         cmp     r7,#0
366         beq     10b
367         add     r5,r5,r7        /* Skip 256K hole */
368         ldr     r7,=0x100000
369         and     r7,r5,r7
370         beq     10b
371         add     r5,r5,r7        /* Nothing at 0xC0100000 */
372         ldr     r7,=0x400000    /* Also nothing at 0xC0400000 */
373         and     r7,r5,r7
374         beq     10b
375         add     r5,r5,r7
376         b       10b
377 20:
378 /* 0x00100000..0x001FFFFF */
379         mov     r6,r2           /* Set up page table descriptor */
380         ldr     r7,=MMU_L1_TYPE_Page
381         orr     r6,r6,r7
382         str     r6,[r1],#4      /* Store PTE, update pointer */
383 10:     mov     r6,r5           /* Build page table entry */
384         ldr     r7,=MMU_L2_TYPE_Small|MMU_AP_Any|MMU_Bufferable|MMU_Cacheable
385         orr     r6,r6,r7
386         ldr     r7,=MMU_PAGE_SIZE
387         str     r6,[r2],#4      /* Next page */
388         add     r3,r3,r7
389         cmp     r3,r4           /* Done with first DRAM? */
390         beq     20f
391         add     r5,r5,r7
392         ldr     r7,=0x40000     /* Special check for 256K boundary */
393         and     r7,r7,r5
394         cmp     r7,#0
395         beq     10b
396         add     r5,r5,r7        /* Skip 256K hole */
397         ldr     r7,=0x100000
398         and     r7,r5,r7
399         beq     10b
400         add     r5,r5,r7        /* Nothing at 0xC0300000 */
401         ldr     r7,=0x400000    /* Also nothing at 0xC0400000 */
402         and     r7,r5,r7
403         beq     10b
404         add     r5,r5,r7
405         b       10b
406 20:
407
408 #elif (CYGHWR_HAL_ARM_EDB7XXX_DRAM_SIZE == 16)
409 // The 16M EDB72xx boards are arranged as:
410 //   0xC0000000..0xC07FFFFF
411 //   0xC1000000..0xC17FFFFF
412 // The 16M EDB7312 board is arranged as:
413 //   0xC0000000..0xC0FFFFFF
414         .macro  MAP_DRAM
415 /* Map DRAM */
416         ldr     r3,=DRAM_LA_START
417         ldr     r4,=DRAM_LA_END
418         ldr     r5,=DRAM_PA
419 /* 0xXXX00000..0xXXXFFFFF */
420 10:     mov     r6,r2           /* Set up page table descriptor */
421         ldr     r7,=MMU_L1_TYPE_Page
422         orr     r6,r6,r7
423         str     r6,[r1],#4      /* Store PTE, update pointer */
424         ldr     r8,=MMU_SECTION_SIZE/MMU_PAGE_SIZE
425 #if !defined(__EDB7312)
426 // EDB7312 has contiguous SDRAM
427         ldr     r9,=DRAM_PA_START+0x00800000   /* Skip at 8M boundary */
428 12:     cmp     r5,r9
429         bne     15f
430         ldr     r5,=DRAM_PA_START+0x01000000   /* Next chunk of DRAM */
431 #else
432 12:
433 #endif
434 15:     mov     r6,r5           /* Build page table entry */
435         ldr     r7,=MMU_L2_TYPE_Small|MMU_AP_Any|MMU_Bufferable|MMU_Cacheable
436         orr     r6,r6,r7
437         ldr     r7,=MMU_PAGE_SIZE
438         str     r6,[r2],#4      /* Next page */
439         add     r3,r3,r7
440         add     r5,r5,r7
441         cmp     r3,r4           /* End of DRAM? */
442         beq     20f
443         sub     r8,r8,#1        /* End of 1M section? */
444         cmp     r8,#0
445         bne     12b             /* Next page */
446         b       10b             /* Next section */
447 20:
448         .endm
449 #else
450 #error Invalid DRAM size select
451 #endif
452
453         .macro  MAP_L1_SEGMENT start end phys prot
454         ldr     r3,=0x3FF       /* Page tables need 2K boundary */
455         add     r2,r2,r3
456         ldr     r3,=~0x3FF
457         and     r2,r2,r3
458         ldr     r3,=\start
459         ldr     r4,=\end
460         ldr     r5,=\phys
461         ldr     r6,=\prot
462         ldr     r7,=MMU_SECTION_SIZE
463 10:     orr     r0,r5,r6
464         str     r0,[r1],#4
465         add     r5,r5,r7
466         add     r3,r3,r7
467         cmp     r3,r4
468         bne     10b
469         .endm
470
471         .macro  PLATFORM_SETUP1
472         INIT_MEMORY_CONFIG
473 #ifdef CYG_HAL_STARTUP_RAM
474         RELOCATE_RAM_IMAGE
475 #endif        
476 /* Initialize MMU to create new memory map */
477         ldr     r1,=MMU_BASE
478         ldr     r2,=PTE_BASE
479         MAP_DRAM
480 /* Nothing until PCMCIA0 */
481         MAP_L1_SEGMENT (DRAM_LA_END+0x000FFFFF)&0xFFF00000 EXPANSION2_LA_START 0 MMU_L1_TYPE_Fault
482 /* EXPANSION2, EXPANSION3, PCMCIA0, PCMCIA1 */
483         MAP_L1_SEGMENT EXPANSION2_LA_START SRAM_LA_START EXPANSION2_PA MMU_L1_TYPE_Section|MMU_AP_Any
484 /* SRAM */
485         ldr     r3,=SRAM_LA_START
486         ldr     r4,=MMU_L1_TYPE_Page|MMU_DOMAIN(0)
487         orr     r4,r4,r2
488         str     r4,[r1],#4
489         ldr     r7,=MMU_PAGE_SIZE
490         ldr     r5,=SRAM_LA_END
491 05:     ldr     r4,=MMU_L2_TYPE_Small|MMU_AP_Any|MMU_Bufferable|MMU_Cacheable
492         orr     r4,r3,r4
493         str     r4,[r2],#4
494         add     r3,r3,r7
495         cmp     r3,r5
496         bne     05b
497         ldr     r4,=SRAM_LA_START+MMU_SECTION_SIZE
498         ldr     r5,=MMU_L2_TYPE_Fault
499 10:     str     r5,[r2],#4
500         add     r3,r3,r7
501         cmp     r3,r4
502         bne     10b
503         ldr     r4,=IO_LA_START
504         ldr     r5,=MMU_L1_TYPE_Fault
505         ldr     r7,=MMU_SECTION_SIZE
506 20:     str     r5,[r1],#4
507         add     r3,r3,r7
508         cmp     r3,r4
509         bne     20b
510 /* I/O */
511         ldr     r3,=0x3FF       /* Page tables need 2K boundary */
512         add     r2,r2,r3
513         ldr     r3,=~0x3FF
514         and     r2,r2,r3
515         ldr     r4,=MMU_L1_TYPE_Page|MMU_DOMAIN(0)
516         orr     r4,r4,r2
517         str     r4,[r1],#4
518         ldr     r3,=IO_LA_START
519         ldr     r4,=IO_LA_END
520         ldr     r7,=MMU_PAGE_SIZE
521         ldr     r5,=IO_PA|MMU_L2_TYPE_Small|MMU_AP_All
522 10:     str     r5,[r2],#4
523         add     r5,r5,r7
524         add     r3,r3,r7
525         cmp     r3,r4
526         bne     10b
527         ldr     r4,=IO_LA_START+MMU_SECTION_SIZE
528         ldr     r5,=MMU_L2_TYPE_Fault
529         ldr     r7,=MMU_PAGE_SIZE
530 10:     str     r5,[r2],#4
531         add     r3,r3,r7
532         cmp     r3,r4
533         bne     10b
534         ldr     r4,=LCD_LA_START
535         ldr     r5,=MMU_L1_TYPE_Fault
536         ldr     r7,=MMU_SECTION_SIZE
537 20:     str     r5,[r1],#4
538         add     r3,r3,r7
539         cmp     r3,r4
540         bne     20b
541 /* LCD Buffer & Unmapped DRAM (holes and all) */
542         MAP_L1_SEGMENT LCD_LA_START ROM0_LA_START LCD_PA MMU_L1_TYPE_Section|MMU_AP_Any|MMU_Bufferable|MMU_Cacheable
543 /* ROM0 */
544         MAP_L1_SEGMENT ROM0_LA_START ROM0_LA_END ROM0_PA MMU_L1_TYPE_Section|MMU_AP_Any
545 /* ROM1 */
546         MAP_L1_SEGMENT ROM1_LA_START ROM1_LA_END ROM1_PA MMU_L1_TYPE_Section|MMU_AP_Any
547 /* Now initialize the MMU to use this new page table */
548         ldr     r1,=MMU_BASE
549         MMU_INITIALIZE
550 #ifdef CYG_HAL_STARTUP_ROMRAM                                                  
551         RELOCATE_TEXT_SEGMENT
552 #endif // CYG_HAL_STARTUP_ROM                                                          
553         .endm
554 #endif // CYGSEM_HAL_STATIC_MMU_TABLES
555
556 #else  // CYGSEM_HAL_INSTALL_MMU_TABLES
557
558 #define PLATFORM_SETUP1
559 #endif
560 #endif //_CYGHWR_LAYOUT_ONLY
561
562 /*---------------------------------------------------------------------------*/
563 /* end of hal_platform_setup.h                                               */
564 #endif /* CYGONCE_HAL_PLATFORM_SETUP_H */