source: trunk/libs/newlib/src/libgloss/sparc_leon/lcpuinit.S @ 454

Last change on this file since 454 was 444, checked in by satin@…, 6 years ago

add newlib,libalmos-mkh, restructure shared_syscalls.h and mini-libc

File size: 3.4 KB
Line 
1/*
2 * Copyright (c) 2011 Aeroflex Gaisler
3 *
4 * BSD license:
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to deal
8 * in the Software without restriction, including without limitation the rights
9 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 * copies of the Software, and to permit persons to whom the Software is
11 * furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be included in
14 * all copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 * THE SOFTWARE.
23 */
24
25
26#define LEON3_IO_AREA 0xfff00000
27#define LEON3_CONF_AREA 0xff000
28#define VENDOR_GAISLER 0x01
29#define GAISLER_APBMST 0x006
30#define GAISLER_APBUART 0x00C
31#define GAISLER_GPTIMER 0x011
32   
33        .text
34        /* ------- */
35        .weak   cpuinit
36        .set    cpuinit,_cpuinit
37        /* ------- */
38        !.global cpuinit
39_cpuinit:
40
41        mov %o7,%g6
42
43        mov     %psr, %l3
44        srl     %l3, 24, %g5
45        and     %g5, 0xf, %g5
46        subcc   %g5, 3, %0
47        be      1f
48
49        /* other versions */
50       
51        ba 2f   
52
53        ! ####### leon3 #########
54
551:      set 0x01, %o0              !VENDOR_GAISLER
56        set 0x006, %o1             !GAISLER_APBMST 
57        call ahbslv_scan
58        nop
59
60        cmp %g0,%o0
61        be 2f
62         nop
63
64        ld [%o0+16],%g1
65        set 0xfff00000,%o0         !LEON3_IO_AREA         
66        and %g1,%o0,%g1            !g1: apb base
67
68        set 0xff000,%o0            !LEON3_CONF_AREA   
69        or %g1,%o0,%g2             !g2: apb conf base
70 
71        ! ####### uart #########
72        mov %g2,%o0
73        set 0x01 , %o1             ! VENDOR_GAISLER   
74        set 0x00C,%o2              ! GAISLER_APBUART 
75        call apbslv_scan
76         nop
77        cmp %g0,%o0
78        be 2f
79         nop
80       
81        call iobar_getbase
82         mov %g1,%o1
83       
84        set     console, %g5
85        st %o1,[%g5]             !uart base address
86
87        ! ####### timer #########
88
89        mov %g2,%o0
90        set 0x01 , %o1           !VENDOR_GAISLER
91        set 0x011,%o2            !GAISLER_GPTIMER
92        call apbslv_scan
93         nop
94        cmp %g0,%o0
95        be 2f
96         nop
97       
98        call iobar_getbase
99         mov %g1,%o1
100       
101        add %o1,0x10,%o1
102        set rtc, %g5
103        st %o1,[%g5]
104
105        ! ################
106       
107        mov %g2,%o0
108        set 0x01 , %o1           !VENDOR_GAISLER
109        set 0x00D,%o2            !GAISLER_IRQMP
110        call apbslv_scan
111        nop
112        cmp %g0,%o0
113        be 2f
114        nop
115       
116        call iobar_getbase
117        mov %g1,%o1
118       
119        set irqmp, %g5
120        st %o1,[%g5]
121        ld [%o1+0x10], %o2
122        srl %o2, 16, %o2
123        and %o2, 15, %o2
124        st %o2,[%g5+4]
125
126        ! ################
127
1282:      mov %g6,%o7
129        retl
130        nop
131
132        ! force link of jiffies_64
133        .global jiffies_64
1343:      set jiffies_64,%g1
135
136
137        .data
138        .global irqmp
139
140irqmp:  .word 0         ! IRQMP base address
141        .word 0         ! extended irq number
142
143        .text
Note: See TracBrowser for help on using the repository browser.