summaryrefslogtreecommitdiff
path: root/utils/imxtools/misc/wiki_gen.c
diff options
context:
space:
mode:
Diffstat (limited to 'utils/imxtools/misc/wiki_gen.c')
-rw-r--r--utils/imxtools/misc/wiki_gen.c100
1 files changed, 100 insertions, 0 deletions
diff --git a/utils/imxtools/misc/wiki_gen.c b/utils/imxtools/misc/wiki_gen.c
new file mode 100644
index 0000000000..8341c21712
--- /dev/null
+++ b/utils/imxtools/misc/wiki_gen.c
@@ -0,0 +1,100 @@
1#include <stdio.h>
2#include <stdlib.h>
3#include <stdbool.h>
4#include <stdint.h>
5#include <string.h>
6
7#include "map.h"
8
9const char *pin_group_color(unsigned group, unsigned block)
10{
11 (void)block;
12 switch(group)
13 {
14 case PIN_GROUP_EMI: return "RED";
15 case PIN_GROUP_GPIO: return "TEAL";
16 case PIN_GROUP_I2C: return "PURPLE";
17 case PIN_GROUP_JTAG: return "RED";
18 case PIN_GROUP_PWM: return "OLIVE";
19 case PIN_GROUP_SPDIF: return "OLIVE";
20 case PIN_GROUP_TIMROT: return "PINK";
21 case PIN_GROUP_AUART: return "GREEN";
22 case PIN_GROUP_ETM: return "RED";
23 case PIN_GROUP_GPMI: return "ORANGE";
24 case PIN_GROUP_IrDA: return "OLIVE";
25 case PIN_GROUP_LCD: return "TEAL";
26 case PIN_GROUP_SAIF: return "ORANGE";
27 case PIN_GROUP_SSP: return "PURPLE";
28 case PIN_GROUP_DUART: return "GRAY";
29 case PIN_GROUP_USB: return "LIME";
30 case PIN_GROUP_NONE: return NULL;
31 default: return NULL;
32 }
33}
34
35int main(int argc, char **argv)
36{
37 if(argc != 3)
38 {
39 printf("usage: %s <soc> <ver>\n", argv[0]);
40 printf(" where <soc> is stmp3700 or imx233\n");
41 printf(" where <ver> is bga169 or lqfp128\n");
42 return 1;
43 }
44
45 const char *soc = argv[1];
46 const char *ver = argv[2];
47
48 struct bank_map_t *map = NULL;
49 for(unsigned i = 0; i < NR_SOCS; i++)
50 if(strcmp(soc, socs[i].soc) == 0 && strcmp(ver, socs[i].ver) == 0)
51 map = socs[i].map;
52 if(map == NULL)
53 {
54 printf("no valid map found\n");
55 return 4;
56 }
57
58 for(unsigned bank = 0; bank < NR_BANKS; bank++)
59 {
60 for(unsigned offset = 0; offset < 2; offset ++)
61 {
62 printf("| *Bank %d* |", bank);
63 for(unsigned count = 0; count < 16; count++)
64 printf(" *%d* ||", offset * 16 + 15 - count);
65 printf("\n");
66 printf("| *Mux Reg %d* |", bank * 2 + offset);
67 for(unsigned count = 0; count < 32; count++)
68 printf(" *%d* |", 31 - count);
69 printf("\n");
70
71 for(unsigned function = 0; function < NR_FUNCTIONS; function++)
72 {
73 printf("| *select = %d* |", function);
74 for(unsigned count = 0; count < 16; count++)
75 {
76 unsigned pin_nr = offset * 16 + 15 - count;
77 struct pin_function_desc_t *desc = &map[bank].pins[pin_nr].function[function];
78 const char *color = pin_group_color(desc->group, desc->block);
79 printf(" ");
80 if(color)
81 printf("%%%s%%", color);
82 if(desc->name)
83 printf("%s", desc->name);
84 if(color)
85 printf("%%ENDCOLOR%%");
86 printf(" ||");
87 }
88 printf("\n");
89 }
90
91 printf("| |");
92 for(unsigned count = 0; count < 16; count++)
93 printf("||");
94 printf("\n");
95 }
96 }
97
98 return 0;
99}
100