Line | |
---|
1 | #include <libcpu/bf537.h> |
---|
2 | #include <libcpu/sicRegs.h> |
---|
3 | #include <libcpu/cecRegs.h> |
---|
4 | #include <libcpu/dmaRegs.h> |
---|
5 | #include <libcpu/coreTimerRegs.h> |
---|
6 | |
---|
7 | #ifndef LO |
---|
8 | #define LO(con32) ((con32) & 0xFFFF) |
---|
9 | #endif |
---|
10 | #ifndef HI |
---|
11 | #define HI(con32) (((con32) >> 16) & 0xFFFF) |
---|
12 | #endif |
---|
13 | |
---|
14 | .section .start |
---|
15 | .align 4 |
---|
16 | |
---|
17 | .global __start |
---|
18 | __start: |
---|
19 | cli r0; |
---|
20 | |
---|
21 | /* setup an initial stack */ |
---|
22 | sp.h = __ISR_Stack_area_end; |
---|
23 | sp.l = __ISR_Stack_area_end; |
---|
24 | |
---|
25 | /* disable timer interrupts */ |
---|
26 | p0.h = HI(TCNTL); |
---|
27 | p0.l = LO(TCNTL); |
---|
28 | r0 = 0; |
---|
29 | [p0] = r0; |
---|
30 | |
---|
31 | /* disable all interrupts routed through sic */ |
---|
32 | p0.h = HI(SIC_IMASK); |
---|
33 | p0.l = LO(SIC_IMASK); |
---|
34 | [p0] = r0; |
---|
35 | |
---|
36 | /* clear any pending interrupts */ |
---|
37 | p0.h = HI(CEC_ILAT); |
---|
38 | p0.l = LO(CEC_ILAT); |
---|
39 | r0 = 0xffff (z); |
---|
40 | [p0] = r0; |
---|
41 | |
---|
42 | /* disable all dma channels */ |
---|
43 | p0.h = HI(DMA0_BASE_ADDRESS + DMA_CONFIG_OFFSET); |
---|
44 | p0.l = LO(DMA0_BASE_ADDRESS + DMA_CONFIG_OFFSET); |
---|
45 | p1 = DMA_PITCH; |
---|
46 | p2 = DMA_CHANNELS; |
---|
47 | r0 = ~DMA_CONFIG_DMAEN; |
---|
48 | lsetup(loop1,loop2) lc0 = p2; |
---|
49 | loop1: r1 = w[p0]; |
---|
50 | r1 = r0 & r1; |
---|
51 | loop2: w[p0 ++ p1] = r1.l; |
---|
52 | |
---|
53 | /* this is so we can stay in supervisor mode and still be able to |
---|
54 | accept interrupts later. */ |
---|
55 | p0.h = start; |
---|
56 | p0.l = start; |
---|
57 | p1.h = HI(CEC_EVT15); |
---|
58 | p1.l = LO(CEC_EVT15); |
---|
59 | |
---|
60 | [p1] = p0; |
---|
61 | |
---|
62 | r0 = 0x8000 (z); |
---|
63 | sti r0; |
---|
64 | |
---|
65 | raise 15; |
---|
66 | |
---|
67 | p0.h = wait; |
---|
68 | p0.l = wait; |
---|
69 | |
---|
70 | reti = p0; |
---|
71 | rti; |
---|
72 | |
---|
73 | /* wait for event 15 */ |
---|
74 | wait: |
---|
75 | jump wait; |
---|
76 | |
---|
77 | start: |
---|
78 | [--sp] = reti; /* allow us to process interrupts later */ |
---|
79 | |
---|
80 | /* mask interrupts for now */ |
---|
81 | cli r0; |
---|
82 | |
---|
83 | p0.h = _bss_start; |
---|
84 | p0.l = _bss_start; |
---|
85 | p1.h = _end; |
---|
86 | p1.l = _end; |
---|
87 | r0 = p0; |
---|
88 | r1 = p1; |
---|
89 | r1 = r1 - r0; |
---|
90 | p1 = r1; |
---|
91 | r0 = 0; |
---|
92 | |
---|
93 | /* Set _bss_start until _end to zero */ |
---|
94 | lsetup(loop3,loop4) lc0 = p1; |
---|
95 | loop3: b[p0] = r0; |
---|
96 | loop4: p0 +=1; |
---|
97 | |
---|
98 | l0 = 0; |
---|
99 | l1 = 0; |
---|
100 | l2 = 0; |
---|
101 | l3 = 0; |
---|
102 | sp += -12; |
---|
103 | /* r0 == const char *cmdline (currently null) */ |
---|
104 | p0.h = _boot_card; |
---|
105 | p0.l = _boot_card; |
---|
106 | call (p0); |
---|
107 | sp += 12; |
---|
108 | |
---|
109 | .global _bsp_reset |
---|
110 | _bsp_reset: |
---|
111 | HLT |
---|
112 | p0.h = _exit; |
---|
113 | p0.l = _exit; |
---|
114 | jump (p0); |
---|
115 | |
---|
Note: See
TracBrowser
for help on using the repository browser.