1 |
6 |
ktt1 |
/******************************************************************************/
|
2 |
|
|
/* _ _ __ ____ */
|
3 |
|
|
/* / / | | / _| | __| */
|
4 |
|
|
/* | |_| | _ _ / / | |_ */
|
5 |
|
|
/* | _ | | | | | | | | _| */
|
6 |
|
|
/* | | | | | |_| | \ \_ | |__ */
|
7 |
|
|
/* |_| |_| \_____| \__| |____| microLab */
|
8 |
|
|
/* */
|
9 |
|
|
/* Bern University of Applied Sciences (BFH) */
|
10 |
|
|
/* Quellgasse 21 */
|
11 |
|
|
/* Room HG 4.33 */
|
12 |
|
|
/* 2501 Biel/Bienne */
|
13 |
|
|
/* Switzerland */
|
14 |
|
|
/* */
|
15 |
|
|
/* http://www.microlab.ch */
|
16 |
|
|
/******************************************************************************/
|
17 |
|
|
/* GECKO4com
|
18 |
|
|
|
19 |
|
|
2010/2011 Dr. Theo Kluter
|
20 |
|
|
|
21 |
|
|
This program is free software: you can redistribute it and/or modify
|
22 |
|
|
it under the terms of the GNU General Public License as published by
|
23 |
|
|
the Free Software Foundation, either version 3 of the License, or
|
24 |
|
|
(at your option) any later version.
|
25 |
|
|
|
26 |
|
|
This program is distributed in the hope that it will be useful,
|
27 |
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
28 |
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
29 |
|
|
GNU General Public License for more details.
|
30 |
|
|
You should have received a copy of the GNU General Public License
|
31 |
|
|
along with these sources. If not, see <http://www.gnu.org/licenses/>.
|
32 |
|
|
*/
|
33 |
|
|
#include <stdio.h>
|
34 |
|
|
#include <stdlib.h>
|
35 |
|
|
#include <string.h>
|
36 |
|
|
|
37 |
|
|
const char *strings[32] = {
|
38 |
|
|
"Xilinx Spartan 3 XC3S1000FGG676, not configured\n",
|
39 |
|
|
"Xilinx Spartan 3 XC3S1500FGG676, not configured\n",
|
40 |
|
|
"Xilinx Spartan 3 XC3S2000FGG676, not configured\n",
|
41 |
|
|
"Xilinx Spartan 3 XC3S4000FGG676, not configured\n",
|
42 |
|
|
"Xilinx Spartan 3 XC3S5000FGG676, not configured\n",
|
43 |
|
|
"No FPGA mounted or unknown FPGA type\n",
|
44 |
|
|
"No FPGA mounted or unknown FPGA type\n",
|
45 |
|
|
"No FPGA mounted or unknown FPGA type\n",
|
46 |
|
|
"Xilinx Spartan 3 XC3S1000FGG676, running\n",
|
47 |
|
|
"Xilinx Spartan 3 XC3S1500FGG676, running\n",
|
48 |
|
|
"Xilinx Spartan 3 XC3S2000FGG676, running\n",
|
49 |
|
|
"Xilinx Spartan 3 XC3S4000FGG676, running\n",
|
50 |
|
|
"Xilinx Spartan 3 XC3S5000FGG676, running\n",
|
51 |
|
|
"No FPGA mounted or unknown FPGA type\n",
|
52 |
|
|
"No FPGA mounted or unknown FPGA type\n",
|
53 |
|
|
"No FPGA mounted or unknown FPGA type\n",
|
54 |
|
|
"Undefined State, soldering problem?\n",
|
55 |
|
|
"GECKO4main: USB supplied, powering BUS, Flash programmed\n",
|
56 |
|
|
"Undefined State, soldering problem?\n",
|
57 |
|
|
"GECKO4main: USB supplied, Flash programmed\n",
|
58 |
|
|
"GECKO4main: GENIO1 supplied, powering BUS, Flash programmed\n",
|
59 |
|
|
"Undefined State, soldering problem?\n",
|
60 |
|
|
"GECKO4main: GENIO1 supplied, Flash programmed\n",
|
61 |
|
|
"Undefined State, soldering problem?\n",
|
62 |
|
|
"Undefined State, soldering problem?\n",
|
63 |
|
|
"GECKO4main: USB supplied, powering BUS, Flash empty\n",
|
64 |
|
|
"Undefined State, soldering problem?\n",
|
65 |
|
|
"GECKO4main: USB supplied, Flash empty\n",
|
66 |
|
|
"GECKO4main: GENIO1 supplied, powering BUS, Flash empty\n",
|
67 |
|
|
"Undefined State, soldering problem?\n",
|
68 |
|
|
"GECKO4main: GENIO1 supplied, Flash empty\n",
|
69 |
|
|
"Undefined State, soldering problem?\n"};
|
70 |
|
|
|
71 |
|
|
int main () {
|
72 |
|
|
unsigned char rom[2048];
|
73 |
|
|
int loop,charcnt,index,sort;
|
74 |
|
|
|
75 |
|
|
for (loop = 0 ; loop < 32 ; loop++) {
|
76 |
|
|
if (strlen(strings[loop]) > 62) {
|
77 |
|
|
printf ("Too long string found!\n");
|
78 |
|
|
return -1;
|
79 |
|
|
}
|
80 |
|
|
rom[loop*64] = strlen(strings[loop])+128;
|
81 |
|
|
index = 1;
|
82 |
|
|
for (charcnt = 0 ; charcnt < strlen(strings[loop]) ; charcnt++) {
|
83 |
|
|
rom[(loop*64)+index++] = strings[loop][charcnt];
|
84 |
|
|
printf("%c",strings[loop][charcnt]);
|
85 |
|
|
}
|
86 |
|
|
while (index < 64) {
|
87 |
|
|
rom[(loop*64)+index++] = 0;
|
88 |
|
|
}
|
89 |
|
|
}
|
90 |
|
|
for (loop = 0 ; loop < 64 ; loop++) {
|
91 |
|
|
if (loop == 0) {
|
92 |
|
|
printf( " GENERIC MAP ( INIT_00 => X\"" );
|
93 |
|
|
} else {
|
94 |
|
|
printf( " INIT_%02X => X\"" , loop );
|
95 |
|
|
}
|
96 |
|
|
for (sort = 31 ; sort > -1 ; sort--) {
|
97 |
|
|
printf("%02X",rom[loop*32+sort] );
|
98 |
|
|
}
|
99 |
|
|
if (loop != 63) {
|
100 |
|
|
printf( "\",\n" );
|
101 |
|
|
} else {
|
102 |
|
|
printf( "\")\n" );
|
103 |
|
|
}
|
104 |
|
|
}
|
105 |
|
|
return 0;
|
106 |
|
|
}
|