summaryrefslogtreecommitdiff
path: root/util/intelp2m/main.go
diff options
context:
space:
mode:
Diffstat (limited to 'util/intelp2m/main.go')
-rw-r--r--util/intelp2m/main.go41
1 files changed, 12 insertions, 29 deletions
diff --git a/util/intelp2m/main.go b/util/intelp2m/main.go
index 8527c54586..a7bbc91079 100644
--- a/util/intelp2m/main.go
+++ b/util/intelp2m/main.go
@@ -51,27 +51,12 @@ func main() {
"\tIn this case, some fields of the configuration registers\n" +
"\tDW0 will be ignored.\n")
- infoLevel1 := flag.Bool("i",
- false,
- "\n\tInfo Level 1: adds DW0/DW1 value to the comments:\n" +
- "\t/* GPIO_173 - SDCARD_D0 */\n")
-
- infoLevel2 := flag.Bool("ii",
- false,
- "Info Level 2: adds original macro to the comments:\n" +
- "\t/* GPIO_173 - SDCARD_D0 (DW0: 0x44000400, DW1: 0x00021000) */\n")
-
- infoLevel3 := flag.Bool("iii",
- false,
- "Info Level 3: adds information about bit fields that (need to be ignored)\n" +
- "\twere ignored to generate a macro:\n" +
- "\t/* GPIO_173 - SDCARD_D0 (DW0: 0x44000400, DW1: 0x00021000) */\n" +
- "\t/* PAD_CFG_NF_IOSSTATE(GPIO_173, DN_20K, DEEP, NF1, HIZCRx1), */\n")
-
- infoLevel4 := flag.Bool("iiii",
- false,
- "Info Level 4: show decoded DW0/DW1 register:\n" +
- "\t/* DW0: PAD_TRIG(DEEP) | PAD_BUF(TX_RX_DISABLE) - IGNORED */\n")
+ infoLevels := []*bool {
+ flag.Bool("i", false, "Show pads function in the comments"),
+ flag.Bool("ii", false, "Show DW0/DW1 value in the comments"),
+ flag.Bool("iii", false, "Show ignored bit fields in the comments"),
+ flag.Bool("iiii", false, "Show target PAD_CFG() macro in the comments"),
+ }
template := flag.Int("t", 0, "template type number\n"+
"\t0 - inteltool.log (default)\n"+
@@ -94,14 +79,12 @@ func main() {
config.IgnoredFieldsFlagSet(*ignFlag)
config.NonCheckingFlagSet(*nonCheckFlag)
- if *infoLevel1 {
- config.InfoLevelSet(1)
- } else if *infoLevel2 {
- config.InfoLevelSet(2)
- } else if *infoLevel3 {
- config.InfoLevelSet(3)
- } else if *infoLevel4 {
- config.InfoLevelSet(4)
+ for level, flag := range infoLevels {
+ if *flag {
+ config.InfoLevelSet(level + 1)
+ fmt.Printf("Info level: Use level %d!\n", level + 1)
+ break
+ }
}
if !config.TemplateSet(*template) {