1
2
3
4
5
6
7
8
9
10
11#define ASSEMBLY
12
13#include <asm/linkage.h>
14#include <asm/regs267x.h>
15
16 .global SYMBOL_NAME(_start)
17 .global SYMBOL_NAME(_command_line)
18 .global SYMBOL_NAME(_platform_gpio_table)
19 .global SYMBOL_NAME(_target_name)
20
21 .h8300s
22 .section .text
23 .file "crt0_rom.S"
24
25
26SYMBOL_NAME_LABEL(_start)
27 mov.l
28 ldc
29 ldc
30
31
32;BSC/GPIO setup
33 mov.l
34 mov.w
351:
36 mov.w @er0+,r2
37 beq 2f
38 mov.w @er0+,r1
39 mov.b r1l,@er2
40 bra 1b
41
422:
43;SDRAM setup
44#define SDRAM_SMR 0x400040
45
46 mov.b
47 mov.b r0l,@DRACCR:16
48 mov.w
49 mov.w r0,@REFCR:16
50 mov.w
51 mov.w r0,@DRAMCR:16
52 mov.b
53 mov.b r1l,@SDRAM_SMR
54 mov.w
55 mov.w r0,@DRAMCR:16
56;special thanks to Arizona Cooperative Power
57
58
59 mov.l
60 mov.l
61 mov.l
62 sub.l er6,er4
63 shlr.l
641:
65 mov.l @er5+,er0
66 mov.l er0,@er6
67 adds
68 dec.l
69 bne 1b
70
71
72 mov.l
73 mov.l
74 sub.l er5,er4
75 shlr.l
76 sub.l er0,er0
771:
78 mov.l er0,@er5
79 adds
80 dec.l
81 bne 1b
82
83
84 mov.l
85 mov.l
86 mov.w
87 eepmov.w
88
89
90 ldc
91 mov.l
92 add.l
93 jsr @_start_kernel
94_exit:
95
96 jmp _exit
97
98 rts
99
100
101__platform_gpio_table:
102 mov.l
103 rts
104
105#define INIT_REGS_DATA(REGS,DATA) \
106 .word ((REGS) & 0xffff),DATA
107
108init_regs:
109INIT_REGS_DATA(ASTCR,0xff)
110INIT_REGS_DATA(RDNCR,0x00)
111INIT_REGS_DATA(ABWCR,0x80)
112INIT_REGS_DATA(WTCRAH,0x27)
113INIT_REGS_DATA(WTCRAL,0x77)
114INIT_REGS_DATA(WTCRBH,0x71)
115INIT_REGS_DATA(WTCRBL,0x22)
116INIT_REGS_DATA(CSACRH,0x80)
117INIT_REGS_DATA(CSACRL,0x80)
118INIT_REGS_DATA(BROMCRH,0xa0)
119INIT_REGS_DATA(BROMCRL,0xa0)
120INIT_REGS_DATA(P3DDR,0x3a)
121INIT_REGS_DATA(P3ODR,0x06)
122INIT_REGS_DATA(PADDR,0xff)
123INIT_REGS_DATA(PFDDR,0xfe)
124INIT_REGS_DATA(PGDDR,0x0f)
125INIT_REGS_DATA(PHDDR,0x0f)
126INIT_REGS_DATA(PFCR0,0xff)
127INIT_REGS_DATA(PFCR2,0x0d)
128INIT_REGS_DATA(ITSR, 0x00)
129INIT_REGS_DATA(ITSR+1,0x3f)
130INIT_REGS_DATA(INTCR,0x20)
131
132 .word 0
133
134gpio_table:
135 ;; P1DDR
136 .byte 0x00,0x00
137 ;; P2DDR
138 .byte 0x00,0x00
139 ;; P3DDR
140 .byte 0x00,0x00
141 ;; dummy
142 .byte 0x00,0x00
143 ;; P5DDR
144 .byte 0x00,0x00
145 ;; P6DDR
146 .byte 0x00,0x00
147 ;; P7DDR
148 .byte 0x00,0x00
149 ;; P8DDR
150 .byte 0x00,0x00
151 ;; dummy
152 .byte 0x00,0x00
153 ;; PADDR
154 .byte 0x00,0x00
155 ;; PBDDR
156 .byte 0x00,0x00
157 ;; PCDDR
158 .byte 0x00,0x00
159 ;; PDDDR
160 .byte 0x00,0x00
161 ;; PEDDR
162 .byte 0x00,0x00
163 ;; PFDDR
164 .byte 0x00,0x00
165 ;; PGDDR
166 .byte 0x00,0x00
167 ;; PHDDR
168 .byte 0x00,0x00
169
170 .section .rodata
171__target_name:
172 .asciz "EDOSK-2674"
173
174 .section .bss
175__command_line:
176 .space 512
177
178
179 .section .vectors,"ax"
180 .long __start
181 .long __start
182vector = 2
183 .rept 126
184 .long _interrupt_redirect_table+vector*4
185vector = vector + 1
186 .endr
187