source: rtems/c/src/lib/libbsp/bfin/bf537Stamp/start/start.S @ ef26454

4.115
Last change on this file since ef26454 was ef26454, checked in by Sebastian Huber <sebastian.huber@…>, on Apr 29, 2014 at 6:43:04 AM

bsps/bfin: Fix bsp_specs

  • Property mode set to 100644
File size: 1.8 KB
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 = 0xFFB0;
23        sp.l = 0x0F00;
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;
49loop1:  r1 = w[p0];
50        r1 = r0 & r1;
51loop2:  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 */
74wait:
75        jump wait;
76
77start:
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;
95loop3:  b[p0] = r0;
96loop4:  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        HLT
110        p0.h = _exit;
111        p0.l = _exit;
112        jump (p0);
113
Note: See TracBrowser for help on using the repository browser.