blob: 9021972cb4dbf1bf448808b89529b3d51513b9b2 [file] [log] [blame]
wdenk59b45232002-03-21 09:13:59 +00001/*
2 * flashasm.S: flash magic for LART
3 *
4 * Copyright (C) 1999 2000 2001 Jan-Derk bakker (J.D.Bakker@its.tudelft.nl)
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 *
20 */
21
22.text
23
24
25.globl data_to_flash
26.globl data_from_flash
27 /* Subroutine that takes data in r0 and formats it so it will be in */
28 /* the correct order for the internal flash */
29 /* used for LART only */
30data_to_flash:
31 mov r1, #0x0
32
33 tst r0, #0x00000001
34 orrne r1, r1, #0x00001000
35 tst r0, #0x00000002
36 orrne r1, r1, #0x00004000
37 tst r0, #0x00000004
38 orrne r1, r1, #0x00000800
39 tst r0, #0x00000008
40 orrne r1, r1, #0x00000200
41 tst r0, #0x00000010
42 orrne r1, r1, #0x00000001
43 tst r0, #0x00000020
44 orrne r1, r1, #0x00000004
45 tst r0, #0x00000040
46 orrne r1, r1, #0x00000080
47 tst r0, #0x00000080
48 orrne r1, r1, #0x00000020
49
50 tst r0, #0x00000100
51 orrne r1, r1, #0x00002000
52 tst r0, #0x00000200
53 orrne r1, r1, #0x00008000
54 tst r0, #0x00000400
55 orrne r1, r1, #0x00000400
56 tst r0, #0x00000800
57 orrne r1, r1, #0x00000100
58 tst r0, #0x00001000
59 orrne r1, r1, #0x00000002
60 tst r0, #0x00002000
61 orrne r1, r1, #0x00000008
62 tst r0, #0x00004000
63 orrne r1, r1, #0x00000040
64 tst r0, #0x00008000
65 orrne r1, r1, #0x00000010
66
67 tst r0, #0x00010000
68 orrne r1, r1, #0x00100000
69 tst r0, #0x00020000
70 orrne r1, r1, #0x00400000
71 tst r0, #0x00040000
72 orrne r1, r1, #0x00080000
73 tst r0, #0x00080000
74 orrne r1, r1, #0x00020000
75 tst r0, #0x00100000
76 orrne r1, r1, #0x01000000
77 tst r0, #0x00200000
78 orrne r1, r1, #0x04000000
79 tst r0, #0x00400000
80 orrne r1, r1, #0x80000000
81 tst r0, #0x00800000
82 orrne r1, r1, #0x20000000
83
84 tst r0, #0x01000000
85 orrne r1, r1, #0x00200000
86 tst r0, #0x02000000
87 orrne r1, r1, #0x00800000
88 tst r0, #0x04000000
89 orrne r1, r1, #0x00040000
90 tst r0, #0x08000000
91 orrne r1, r1, #0x00010000
92 tst r0, #0x10000000
93 orrne r1, r1, #0x02000000
94 tst r0, #0x20000000
95 orrne r1, r1, #0x08000000
96 tst r0, #0x40000000
97 orrne r1, r1, #0x40000000
98 tst r0, #0x80000000
99 orrne r1, r1, #0x10000000
100
101 mov r0, r1
102 mov pc, lr
103
104 /* Takes data received from the flash, and unshuffles it. */
105data_from_flash:
106 mov r1, #0x00
107
108 tst r0, #0x00000001
109 orrne r1, r1, #0x00000010
110 tst r0, #0x00000002
111 orrne r1, r1, #0x00001000
112 tst r0, #0x00000004
113 orrne r1, r1, #0x00000020
114 tst r0, #0x00000008
115 orrne r1, r1, #0x00002000
116 tst r0, #0x00000010
117 orrne r1, r1, #0x00008000
118 tst r0, #0x00000020
119 orrne r1, r1, #0x00000080
120 tst r0, #0x00000040
121 orrne r1, r1, #0x00004000
122 tst r0, #0x00000080
123 orrne r1, r1, #0x00000040
124
125 tst r0, #0x00000100
126 orrne r1, r1, #0x00000800
127 tst r0, #0x00000200
128 orrne r1, r1, #0x00000008
129 tst r0, #0x00000400
130 orrne r1, r1, #0x00000400
131 tst r0, #0x00000800
132 orrne r1, r1, #0x00000004
133 tst r0, #0x00001000
134 orrne r1, r1, #0x00000001
135 tst r0, #0x00002000
136 orrne r1, r1, #0x00000100
137 tst r0, #0x00004000
138 orrne r1, r1, #0x00000002
139 tst r0, #0x00008000
140 orrne r1, r1, #0x00000200
141
142 tst r0, #0x00010000
143 orrne r1, r1, #0x08000000
144 tst r0, #0x00020000
145 orrne r1, r1, #0x00080000
146 tst r0, #0x00040000
147 orrne r1, r1, #0x04000000
148 tst r0, #0x00080000
149 orrne r1, r1, #0x00040000
150 tst r0, #0x00100000
151 orrne r1, r1, #0x00010000
152 tst r0, #0x00200000
153 orrne r1, r1, #0x01000000
154 tst r0, #0x00400000
155 orrne r1, r1, #0x00020000
156 tst r0, #0x00800000
157 orrne r1, r1, #0x02000000
158
159 tst r0, #0x01000000
160 orrne r1, r1, #0x00100000
161 tst r0, #0x02000000
162 orrne r1, r1, #0x10000000
163 tst r0, #0x04000000
164 orrne r1, r1, #0x00200000
165 tst r0, #0x08000000
166 orrne r1, r1, #0x20000000
167 tst r0, #0x10000000
168 orrne r1, r1, #0x80000000
169 tst r0, #0x20000000
170 orrne r1, r1, #0x00800000
171 tst r0, #0x40000000
172 orrne r1, r1, #0x40000000
173 tst r0, #0x80000000
174 orrne r1, r1, #0x00400000
175
176 mov r0, r1
177 mov pc, lr