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

Subversion Repositories spacewire_light

[/] [spacewire_light/] [trunk/] [sw/] [spwamba_test/] [init_sys.S] - Blame information for rev 5

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 5 jorisvr
/*
2
 *  Override _hardreset hook in BCC startup code in order to
3
 *  initialize CPU, stack pointer, GPTIMER and IRQMP.
4
 *
5
 *  This is only used when the test program runs in a simulated LEON3.
6
 *  In real hardware, these things are handled either by the boot PROM
7
 *  or by GRMON.
8
 */
9
 
10
#define STACKPTR        0x4001fff0
11
#define FREQ_MHZ        40
12
#define GPTIMER_BASE    0x80000300
13
#define GPTIMER_SCALER_RELOAD   0x04
14
#define IRQMP_BASE      0x80000200
15
#define IRQMP_ILEVEL    0x00
16
#define IRQMP_ICLEAR    0x0c
17
#define IRQMP_MASK      0x40
18
 
19
.seg    "text"
20
 
21
.global _hardreset
22
 
23
_hardreset:
24
 
25
    /* Reset CPU */
26
    flush
27
    set   0xc0, %g1
28
    mov   %g1,  %psr
29
    mov   2,    %g1
30
    mov   %g1,  %wim
31
 
32
    /* Enable instruction cache */
33
    set   0x00200003, %g1
34
    sta   %g1,  [%g0] 2
35
 
36
    /* Set up stack pointer */
37
    set   STACKPTR, %g1
38
    mov   %g1,  %fp
39
    sub   %g1,  96,  %sp
40
 
41
    /* Set GPTIMER scale factor for 50 MHz */
42
    set   GPTIMER_BASE, %g2
43
    set   FREQ_MHZ-1, %g1
44
    st    %g1,  [%g2+GPTIMER_SCALER_RELOAD]
45
 
46
    /* Reset IRQMP (some of its registers are not cleared during hard reset) */
47
    set   IRQMP_BASE, %g2
48
    st    %g0,  [%g2+IRQMP_ILEVEL]
49
    st    %g0,  [%g2+IRQMP_MASK]
50
    orn   %g0,  %g0,  %g1
51
    st    %g1,  [%g2+IRQMP_ICLEAR]
52
 
53
    /* Set up trap table and enable traps */
54
    set   _trap_table, %g1
55
    mov   %g1,  %tbr
56
    set   0xe0, %g1
57
    mov   %g1,  %psr
58
 
59
    /* Jump back to BCC startup code */
60
    set   _hardreset_real,  %g1
61
    jmp   %g1
62
    nop
63
 

powered by: WebSVN 2.1.0

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