util/intelp2m: Update output information format in the comments
Update the information format in the comments above the macros in the generated gpio.h file: PAD_CFG_NF_IOSSTATE_IOSTERM(GPIO_39, UP_20K, DEEP, NF1, TxLASTRxE, DISPUPD), /* LPSS_UART0_TXD */ -->(i) /* GPIO_39 - LPSS_UART0_TXD */ --> (ii) /* DW0: 0x44000400, DW1: 0x00003100 */ --> (ii) /* DW0 : PAD_TRIG(OFF) - IGNORED */ --> (iii) /* _PAD_CFG_STRUCT(GPIO_39, PAD_FUNC(NF1) | PAD_RESET(DEEP) | PAD_TRIG(OFF), PAD_PULL(UP_20K) | PAD_IOSTERM(DISPUPD)), */ --> (iiii) PAD_CFG_NF_IOSSTATE_IOSTERM(GPIO_39, UP_20K, DEEP, NF1, TxLASTRxE, DISPUPD), Also, in the case of field macros: /* GPIO_39 - LPSS_UART0_TXD */ --> (ii) /* DW0: 0x44000400, DW1: 0x00003100 */ --> (ii) /* DW0 : PAD_TRIG(OFF) - IGNORED */ --> (iii) /* PAD_CFG_NF_IOSSTATE_IOSTERM(GPIO_39, UP_20K, DEEP, NF1, TxLASTRxE, DISPUPD), */ --> (iiii) PAD_CFG_STRUCT(GPIO_39, PAD_FUNC(NF1) | PAD_RESET(DEEP) | PAD_TRIG(OFF), PAD_PULL(UP_20K) | PAD_IOSTERM(DISPUPD)), By default, if do not use the -i... option, then additional information in comments will not be generated. TEST: git clone https://github.com/maxpoliak/inteltool-examples.git test ./intelp2m -n -file test/inteltool-asrock-h110m-stx.log ./intelp2m -fld cb -file test/inteltool-asrock-h110m-stx.log ./intelp2m -fld fsp -file test/inteltool-asrock-h110m-stx.log ./intelp2m -fld raw -file test/inteltool-asrock-h110m-stx.log Before and after (now with -i key) the patch, gpio.h is no different. Change-Id: I760f4aadece786ea455fb7569f42e06fefce2b61 Signed-off-by: Maxim Polyakov <max.senia.poliak@gmail.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/45168 Reviewed-by: Matt DeVillier <matt.devillier@gmail.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
parent
f2f53c447a
commit
726282b44f
|
@ -82,11 +82,12 @@ func IsNonCheckingFlagUsed() bool {
|
||||||
return nonCheckingFlag
|
return nonCheckingFlag
|
||||||
}
|
}
|
||||||
|
|
||||||
var infolevel uint8 = 0
|
|
||||||
func InfoLevelSet(lvl uint8) {
|
var infolevel int = 0
|
||||||
|
func InfoLevelSet(lvl int) {
|
||||||
infolevel = lvl
|
infolevel = lvl
|
||||||
}
|
}
|
||||||
func InfoLevelGet() uint8 {
|
func InfoLevelGet() int {
|
||||||
return infolevel
|
return infolevel
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,6 @@ It is possible to use templates for parsing files of excellent inteltool.log.
|
||||||
To specify such a pattern, use the option -t <template number>. For example,
|
To specify such a pattern, use the option -t <template number>. For example,
|
||||||
using template type # 1, you can parse gpio.h from an already added board in
|
using template type # 1, you can parse gpio.h from an already added board in
|
||||||
the coreboot project.
|
the coreboot project.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
(shell)$ ./intelp2m -h
|
(shell)$ ./intelp2m -h
|
||||||
-t
|
-t
|
||||||
|
@ -30,7 +29,6 @@ You can also add add a template to 'parser/template.go' for your file type with
|
||||||
the configuration of the pads.
|
the configuration of the pads.
|
||||||
|
|
||||||
platform type is set using the -p option (Sunrise by default):
|
platform type is set using the -p option (Sunrise by default):
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
-p string
|
-p string
|
||||||
set up a platform
|
set up a platform
|
||||||
|
@ -56,7 +54,6 @@ Use the -fld=cb option to only generate a sequence of bit fields in a new macro:
|
||||||
```bash
|
```bash
|
||||||
(shell)$ ./intelp2m -fld cb -p apl -file ../apollo-inteltool.log
|
(shell)$ ./intelp2m -fld cb -p apl -file ../apollo-inteltool.log
|
||||||
```
|
```
|
||||||
|
|
||||||
```c
|
```c
|
||||||
_PAD_CFG_STRUCT(GPIO_37, PAD_FUNC(NF1) | PAD_TRIG(OFF) | PAD_TRIG(OFF), PAD_PULL(DN_20K)), /* LPSS_UART0_TXD */
|
_PAD_CFG_STRUCT(GPIO_37, PAD_FUNC(NF1) | PAD_TRIG(OFF) | PAD_TRIG(OFF), PAD_PULL(DN_20K)), /* LPSS_UART0_TXD */
|
||||||
```
|
```
|
||||||
|
@ -69,96 +66,73 @@ to use the -fld=raw option:
|
||||||
```bash
|
```bash
|
||||||
(shell)$ ./intelp2m -fld raw -file /path/to/inteltool.log
|
(shell)$ ./intelp2m -fld raw -file /path/to/inteltool.log
|
||||||
```
|
```
|
||||||
|
|
||||||
```c
|
```c
|
||||||
_PAD_CFG_STRUCT(GPP_A10, 0x44000500, 0x00000000), /* CLKOUT_LPC1 */
|
_PAD_CFG_STRUCT(GPP_A10, 0x44000500, 0x00000000),
|
||||||
```
|
```
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
(shell)$ ./intelp2m -iiii -fld raw -file /path/to/inteltool.log
|
(shell)$ ./intelp2m -iiii -fld raw -file /path/to/inteltool.log
|
||||||
```
|
```
|
||||||
|
|
||||||
```c
|
```c
|
||||||
/* GPP_A10 - CLKOUT_LPC1 DW0: 0x44000500, DW1: 0x00000000 */
|
/* GPP_A10 - CLKOUT_LPC1 */
|
||||||
/* PAD_CFG_NF(GPP_A10, NONE, DEEP, NF1), */
|
/* DW0: 0x44000500, DW1: 0x00000000 */
|
||||||
/* DW0: 0x04000100 - IGNORED */
|
/* DW0: 0x04000100 - IGNORED */
|
||||||
|
/* PAD_CFG_NF(GPP_A10, NONE, DEEP, NF1), */
|
||||||
_PAD_CFG_STRUCT(GPP_A10, 0x44000500, 0x00000000),
|
_PAD_CFG_STRUCT(GPP_A10, 0x44000500, 0x00000000),
|
||||||
```
|
```
|
||||||
|
|
||||||
### FSP-style macro
|
|
||||||
|
|
||||||
The utility allows to generate macros that include fsp/edk2-palforms style bitfields:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
(shell)$ ./intelp2m -fld fsp -p lbg -file ../crb-inteltool.log
|
|
||||||
```
|
|
||||||
|
|
||||||
```c
|
|
||||||
{ GPIO_SKL_H_GPP_A12, { GpioPadModeGpio, GpioHostOwnAcpi, GpioDirInInvOut, GpioOutLow, GpioIntSci | GpioIntLvlEdgDis, GpioResetNormal, GpioTermNone, GpioPadConfigLock }, /* GPIO */
|
|
||||||
```
|
|
||||||
|
|
||||||
```bash
|
|
||||||
(shell)$ ./intelp2m -iiii -fld fsp -p lbg -file ../crb-inteltool.log
|
|
||||||
```
|
|
||||||
|
|
||||||
```c
|
|
||||||
/* GPP_A12 - GPIO DW0: 0x80880102, DW1: 0x00000000 */
|
|
||||||
/* PAD_CFG_GPI_SCI(GPP_A12, NONE, PLTRST, LEVEL, INVERT), */
|
|
||||||
{ GPIO_SKL_H_GPP_A12, { GpioPadModeGpio, GpioHostOwnAcpi, GpioDirInInvOut, GpioOutLow, GpioIntSci | GpioIntLvlEdgDis, GpioResetNormal, GpioTermNone, GpioPadConfigLock },
|
|
||||||
```
|
|
||||||
|
|
||||||
### Macro Check
|
### Macro Check
|
||||||
|
|
||||||
After generating the macro, the utility checks all used
|
After generating the macro, the utility checks all used
|
||||||
fields of the configuration registers. If some field has been
|
fields of the configuration registers. If some field has been
|
||||||
ignored, the utility generates field macros. To not check
|
ignored, the utility generates field macros. To not check
|
||||||
macros, use the -n option:
|
macros, use the -n option:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
(shell)$ ./intelp2m -n -file /path/to/inteltool.log
|
(shell)$ ./intelp2m -n -file /path/to/inteltool.log
|
||||||
```
|
```
|
||||||
|
|
||||||
In this case, some fields of the configuration registers
|
In this case, some fields of the configuration registers
|
||||||
DW0 will be ignored.
|
DW0 will be ignored.
|
||||||
|
|
||||||
```c
|
```c
|
||||||
PAD_CFG_NF_IOSSTATE_IOSTERM(GPIO_38, UP_20K, DEEP, NF1, HIZCRx1, DISPUPD), /* LPSS_UART0_RXD */
|
PAD_CFG_NF_IOSSTATE_IOSTERM(GPIO_38, UP_20K, DEEP, NF1, HIZCRx1, DISPUPD),
|
||||||
PAD_CFG_NF_IOSSTATE_IOSTERM(GPIO_39, UP_20K, DEEP, NF1, TxLASTRxE, DISPUPD), /* LPSS_UART0_TXD */
|
PAD_CFG_NF_IOSSTATE_IOSTERM(GPIO_39, UP_20K, DEEP, NF1, TxLASTRxE, DISPUPD),
|
||||||
```
|
```
|
||||||
|
|
||||||
### Information level
|
### Information level
|
||||||
|
|
||||||
The utility can generate additional information about the bit
|
The utility can generate additional information about the bit
|
||||||
fields of the DW0 and DW1 configuration registers:
|
fields of the DW0 and DW1 configuration registers. Using the
|
||||||
|
options -i, -ii, -iii, -iiii you can set the info level from
|
||||||
```c
|
1 to 4:
|
||||||
/* GPIO_39 - LPSS_UART0_TXD (DW0: 0x44000400, DW1: 0x00003100) */ --> (2)
|
|
||||||
/* PAD_CFG_NF_IOSSTATE_IOSTERM(GPIO_39, UP_20K, DEEP, NF1, TxLASTRxE, DISPUPD), */ --> (3)
|
|
||||||
/* DW0 : PAD_TRIG(OFF) - IGNORED */ --> (4)
|
|
||||||
_PAD_CFG_STRUCT(GPIO_39, PAD_FUNC(NF1) | PAD_RESET(DEEP) | PAD_TRIG(OFF), PAD_PULL(UP_20K) | PAD_IOSTERM(DISPUPD)),
|
|
||||||
```
|
|
||||||
|
|
||||||
Using the options -i, -ii, -iii, -iiii you can set the info level
|
|
||||||
from (1) to (4):
|
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
(shell)$./intelp2m -i -file /path/to/inteltool.log
|
(shell)$./intelp2m -i -file /path/to/inteltool.log
|
||||||
|
```
|
||||||
|
```c
|
||||||
|
_PAD_CFG_STRUCT(GPIO_39, PAD_FUNC(NF1) | PAD_RESET(DEEP) | PAD_TRIG(OFF), PAD_PULL(UP_20K) | PAD_IOSTERM(DISPUPD)), /* LPSS_UART0_TXD */
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
(shell)$./intelp2m -ii -file /path/to/inteltool.log
|
(shell)$./intelp2m -ii -file /path/to/inteltool.log
|
||||||
(shell)$./intelp2m -iii -file /path/to/inteltool.log
|
(shell)$./intelp2m -iii -file /path/to/inteltool.log
|
||||||
(shell)$./intelp2m -iiii -file /path/to/inteltool.log
|
(shell)$./intelp2m -iiii -file /path/to/inteltool.log
|
||||||
```
|
```
|
||||||
(1) : print /* GPIO_39 - LPSS_UART0_TXD */
|
```c
|
||||||
|
/* GPIO_39 - LPSS_UART0_TXD */
|
||||||
|
/* DW0: 0x44000400, DW1: 0x00003100 */ --> (ii)
|
||||||
|
/* DW0 : PAD_TRIG(OFF) - IGNORED */ --> (iii)
|
||||||
|
/* PAD_CFG_NF_IOSSTATE_IOSTERM(GPIO_39, UP_20K, DEEP, NF1, TxLASTRxE, DISPUPD), */ --> (iiii)
|
||||||
|
_PAD_CFG_STRUCT(GPIO_39, PAD_FUNC(NF1) | PAD_RESET(DEEP) | PAD_TRIG(OFF), PAD_PULL(UP_20K) | PAD_IOSTERM(DISPUPD)),
|
||||||
|
```
|
||||||
|
|
||||||
(2) : print initial raw values of configuration registers from
|
If the -n switch was used and macros was generated without checking:
|
||||||
inteltool dump
|
```c
|
||||||
DW0: 0x44000400, DW1: 0x00003100
|
/* GPIO_39 - LPSS_UART0_TXD */ --> (i)
|
||||||
|
/* DW0: 0x44000400, DW1: 0x00003100 */ --> (ii)
|
||||||
(3) : print the target macro that will generate if you use the
|
/* DW0: PAD_TRIG(OFF) - IGNORED */ --> (iii)
|
||||||
-n option
|
/* _PAD_CFG_STRUCT(GPIO_39, PAD_FUNC(NF1) | PAD_RESET(DEEP) | PAD_TRIG(OFF), PAD_PULL(UP_20K) | PAD_IOSTERM(DISPUPD)), */ --> (iiii)
|
||||||
PAD_CFG_NF_IOSSTATE_IOSTERM(GPIO_39, UP_20K, DEEP, NF1, TxLASTRxE, DISPUPD),
|
PAD_CFG_NF_IOSSTATE_IOSTERM(GPIO_39, UP_20K, DEEP, NF1, TxLASTRxE, DISPUPD),
|
||||||
|
```
|
||||||
(4) : print decoded fields from (3) as macros
|
|
||||||
DW0 : PAD_TRIG(OFF) - IGNORED
|
|
||||||
|
|
||||||
### Ignoring Fields
|
### Ignoring Fields
|
||||||
|
|
||||||
|
@ -168,35 +142,35 @@ from it that are not in the corresponding PAD_CFG_*() macro:
|
||||||
```bash
|
```bash
|
||||||
(shell)$ ./intelp2m -iiii -fld cb -ign -file /path/to/inteltool.log
|
(shell)$ ./intelp2m -iiii -fld cb -ign -file /path/to/inteltool.log
|
||||||
```
|
```
|
||||||
|
|
||||||
```c
|
```c
|
||||||
/* GPIO_39 - LPSS_UART0_TXD DW0: 0x44000400, DW1: 0x00003100 */
|
/* GPIO_39 - LPSS_UART0_TXD */
|
||||||
/* PAD_CFG_NF_IOSSTATE_IOSTERM(GPIO_39, UP_20K, DEEP, NF1, TxLASTRxE, DISPUPD), */
|
/* DW0: 0x44000400, DW1: 0x00003100 */
|
||||||
/* DW0: PAD_TRIG(OFF) - IGNORED */
|
/* DW0: PAD_TRIG(OFF) - IGNORED */
|
||||||
|
/* PAD_CFG_NF_IOSSTATE_IOSTERM(GPIO_39, UP_20K, DEEP, NF1, TxLASTRxE, DISPUPD), */
|
||||||
_PAD_CFG_STRUCT(GPIO_39, PAD_FUNC(NF1) | PAD_RESET(DEEP), PAD_PULL(UP_20K) | PAD_IOSTERM(DISPUPD)),
|
_PAD_CFG_STRUCT(GPIO_39, PAD_FUNC(NF1) | PAD_RESET(DEEP), PAD_PULL(UP_20K) | PAD_IOSTERM(DISPUPD)),
|
||||||
```
|
```
|
||||||
|
|
||||||
If you generate macros without checking, you can see bit fields that
|
### FSP-style macro
|
||||||
were ignored:
|
|
||||||
|
The utility allows to generate macros that include fsp/edk2-palforms style bitfields:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
(shell)$ ./intelp2m -iiii -n -file /path/to/inteltool.log
|
(shell)$ ./intelp2m -i -fld fsp -p lbg -file ../crb-inteltool.log
|
||||||
```
|
```
|
||||||
|
|
||||||
```c
|
```c
|
||||||
/* GPIO_39 - LPSS_UART0_TXD DW0: 0x44000400, DW1: 0x00003100 */
|
{ GPIO_SKL_H_GPP_A12, { GpioPadModeGpio, GpioHostOwnAcpi, GpioDirInInvOut, GpioOutLow, GpioIntSci | GpioIntLvlEdgDis, GpioResetNormal, GpioTermNone, GpioPadConfigLock }, /* GPIO */
|
||||||
PAD_CFG_NF_IOSSTATE_IOSTERM(GPIO_39, UP_20K, DEEP, NF1, TxLASTRxE, DISPUPD),
|
|
||||||
/* DW0 : PAD_TRIG(OFF) - IGNORED */
|
|
||||||
```
|
```
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
(shell)$ ./intelp2m -n -file /path/to/inteltool.log
|
(shell)$ ./intelp2m -iiii -fld fsp -p lbg -file ../crb-inteltool.log
|
||||||
|
```
|
||||||
|
```c
|
||||||
|
/* GPP_A12 - GPIO */
|
||||||
|
/* DW0: 0x80880102, DW1: 0x00000000 */
|
||||||
|
/* PAD_CFG_GPI_SCI(GPP_A12, NONE, PLTRST, LEVEL, INVERT), */
|
||||||
|
{ GPIO_SKL_H_GPP_A12, { GpioPadModeGpio, GpioHostOwnAcpi, GpioDirInInvOut, GpioOutLow, GpioIntSci | GpioIntLvlEdgDis, GpioResetNormal, GpioTermNone, GpioPadConfigLock },
|
||||||
```
|
```
|
||||||
|
|
||||||
```c
|
|
||||||
/* GPIO_39 - LPSS_UART0_TXD */
|
|
||||||
PAD_CFG_NF_IOSSTATE_IOSTERM(GPIO_39, UP_20K, DEEP, NF1, TxLASTRxE, DISPUPD),
|
|
||||||
```
|
|
||||||
### Supports Chipsets
|
### Supports Chipsets
|
||||||
|
|
||||||
Sunrise PCH, Lewisburg PCH, Apollo Lake SoC, CannonLake-LP SoCs
|
Sunrise PCH, Lewisburg PCH, Apollo Lake SoC, CannonLake-LP SoCs
|
||||||
|
|
|
@ -50,7 +50,9 @@ func (FieldMacros) DecodeDW0() {
|
||||||
generate(
|
generate(
|
||||||
&field {
|
&field {
|
||||||
prefix : "PAD_FUNC",
|
prefix : "PAD_FUNC",
|
||||||
unhide : config.InfoLevelGet() <= 3 || dw0.GetPadMode() != 0,
|
// TODO: Find another way to hide PAD_FUNC(GPIO) in the comment with
|
||||||
|
// ignored fields
|
||||||
|
unhide : config.InfoLevelGet() < 3 || dw0.GetPadMode() != 0,
|
||||||
configurator : func() { macro.Padfn() },
|
configurator : func() { macro.Padfn() },
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -51,27 +51,12 @@ func main() {
|
||||||
"\tIn this case, some fields of the configuration registers\n" +
|
"\tIn this case, some fields of the configuration registers\n" +
|
||||||
"\tDW0 will be ignored.\n")
|
"\tDW0 will be ignored.\n")
|
||||||
|
|
||||||
infoLevel1 := flag.Bool("i",
|
infoLevels := []*bool {
|
||||||
false,
|
flag.Bool("i", false, "Show pads function in the comments"),
|
||||||
"\n\tInfo Level 1: adds DW0/DW1 value to the comments:\n" +
|
flag.Bool("ii", false, "Show DW0/DW1 value in the comments"),
|
||||||
"\t/* GPIO_173 - SDCARD_D0 */\n")
|
flag.Bool("iii", false, "Show ignored bit fields in the comments"),
|
||||||
|
flag.Bool("iiii", false, "Show target PAD_CFG() macro in the comments"),
|
||||||
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")
|
|
||||||
|
|
||||||
template := flag.Int("t", 0, "template type number\n"+
|
template := flag.Int("t", 0, "template type number\n"+
|
||||||
"\t0 - inteltool.log (default)\n"+
|
"\t0 - inteltool.log (default)\n"+
|
||||||
|
@ -94,14 +79,12 @@ func main() {
|
||||||
config.IgnoredFieldsFlagSet(*ignFlag)
|
config.IgnoredFieldsFlagSet(*ignFlag)
|
||||||
config.NonCheckingFlagSet(*nonCheckFlag)
|
config.NonCheckingFlagSet(*nonCheckFlag)
|
||||||
|
|
||||||
if *infoLevel1 {
|
for level, flag := range infoLevels {
|
||||||
config.InfoLevelSet(1)
|
if *flag {
|
||||||
} else if *infoLevel2 {
|
config.InfoLevelSet(level + 1)
|
||||||
config.InfoLevelSet(2)
|
fmt.Printf("Info level: Use level %d!\n", level + 1)
|
||||||
} else if *infoLevel3 {
|
break
|
||||||
config.InfoLevelSet(3)
|
}
|
||||||
} else if *infoLevel4 {
|
|
||||||
config.InfoLevelSet(4)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if !config.TemplateSet(*template) {
|
if !config.TemplateSet(*template) {
|
||||||
|
|
|
@ -39,7 +39,7 @@ type padInfo struct {
|
||||||
|
|
||||||
// generate - wrapper for Fprintf(). Writes text to the file specified
|
// generate - wrapper for Fprintf(). Writes text to the file specified
|
||||||
// in config.OutputGenFile
|
// in config.OutputGenFile
|
||||||
func (info *padInfo) generate(lvl uint8, line string, a ...interface{}) {
|
func (info *padInfo) generate(lvl int, line string, a ...interface{}) {
|
||||||
if config.InfoLevelGet() >= lvl {
|
if config.InfoLevelGet() >= lvl {
|
||||||
fmt.Fprintf(config.OutputGenFile, line, a...)
|
fmt.Fprintf(config.OutputGenFile, line, a...)
|
||||||
}
|
}
|
||||||
|
@ -65,13 +65,15 @@ func (info *padInfo) reservedFprint() {
|
||||||
// gpio : gpio.c file descriptor
|
// gpio : gpio.c file descriptor
|
||||||
// macro : string of the generated macro
|
// macro : string of the generated macro
|
||||||
func (info *padInfo) padInfoMacroFprint(macro string) {
|
func (info *padInfo) padInfoMacroFprint(macro string) {
|
||||||
info.generate(2, "\n")
|
info.generate(2,
|
||||||
info.generate(1, "\t/* %s - %s ", info.id, info.function)
|
"\n\t/* %s - %s */\n\t/* DW0: 0x%0.8x, DW1: 0x%0.8x */\n",
|
||||||
info.generate(2, "DW0: 0x%0.8x, DW1: 0x%0.8x ", info.dw0, info.dw1)
|
info.id,
|
||||||
info.generate(1, "*/\n")
|
info.function,
|
||||||
|
info.dw0,
|
||||||
|
info.dw1)
|
||||||
info.generate(0, "\t%s", macro)
|
info.generate(0, "\t%s", macro)
|
||||||
if config.InfoLevelGet() == 0 {
|
if config.InfoLevelGet() == 1 {
|
||||||
info.generate(0, "\t/* %s */", info.function)
|
info.generate(1, "\t/* %s */", info.function)
|
||||||
}
|
}
|
||||||
info.generate(0, "\n")
|
info.generate(0, "\n")
|
||||||
}
|
}
|
||||||
|
|
|
@ -292,32 +292,27 @@ func (macro *Macro) Or() *Macro {
|
||||||
return macro
|
return macro
|
||||||
}
|
}
|
||||||
|
|
||||||
// AddToMacroIgnoredMask - Print info about ignored field mask
|
// DecodeIgnored - Add info about ignored field mask
|
||||||
// title - warning message
|
// reg : PAD_CFG_DW0 or PAD_CFG_DW1 register
|
||||||
func (macro *Macro) AddToMacroIgnoredMask() *Macro {
|
func (macro *Macro) DecodeIgnored(reg uint8) *Macro {
|
||||||
if config.InfoLevelGet() < 4 || config.IsFspStyleMacro() {
|
var decode = map[uint8]func() {
|
||||||
|
PAD_CFG_DW0: macro.Fields.DecodeDW0,
|
||||||
|
PAD_CFG_DW1: macro.Fields.DecodeDW1,
|
||||||
|
}
|
||||||
|
decodefn, valid := decode[reg]
|
||||||
|
if !valid || config.IsFspStyleMacro() {
|
||||||
return macro
|
return macro
|
||||||
}
|
}
|
||||||
dw0 := macro.Register(PAD_CFG_DW0)
|
dw := macro.Register(reg)
|
||||||
dw1 := macro.Register(PAD_CFG_DW1)
|
ignored := dw.IgnoredFieldsGet()
|
||||||
// Get mask of ignored bit fields.
|
if ignored != 0 {
|
||||||
dw0Ignored := dw0.IgnoredFieldsGet()
|
temp := dw.ValueGet()
|
||||||
dw1Ignored := dw1.IgnoredFieldsGet()
|
dw.ValueSet(ignored)
|
||||||
if dw0Ignored != 0 {
|
regnum := strconv.Itoa(int(reg))
|
||||||
dw0temp := dw0.ValueGet()
|
macro.Add("/* DW" + regnum + ": ")
|
||||||
dw0.ValueSet(dw0Ignored)
|
decodefn()
|
||||||
macro.Add("\n\t/* DW0 : ")
|
macro.Add(" - IGNORED */\n\t")
|
||||||
macro.Fields.DecodeDW0()
|
dw.ValueSet(temp)
|
||||||
macro.Add(" - IGNORED */")
|
|
||||||
dw0.ValueSet(dw0temp)
|
|
||||||
}
|
|
||||||
if dw1Ignored != 0 {
|
|
||||||
dw1temp := dw1.ValueGet()
|
|
||||||
dw1.ValueSet(dw1Ignored)
|
|
||||||
macro.Add("\n\t/* DW1 : ")
|
|
||||||
macro.Fields.DecodeDW1()
|
|
||||||
macro.Add(" - IGNORED */")
|
|
||||||
dw1.ValueSet(dw1temp)
|
|
||||||
}
|
}
|
||||||
return macro
|
return macro
|
||||||
}
|
}
|
||||||
|
@ -331,15 +326,19 @@ func (macro *Macro) GenerateFields() *Macro {
|
||||||
dw0Ignored := dw0.IgnoredFieldsGet()
|
dw0Ignored := dw0.IgnoredFieldsGet()
|
||||||
dw1Ignored := dw1.IgnoredFieldsGet()
|
dw1Ignored := dw1.IgnoredFieldsGet()
|
||||||
|
|
||||||
if config.InfoLevelGet() <= 1 {
|
if config.InfoLevelGet() != 4 {
|
||||||
macro.Clear()
|
macro.Clear()
|
||||||
} else if config.InfoLevelGet() >= 3 {
|
}
|
||||||
|
if config.InfoLevelGet() >= 3 {
|
||||||
// Add string of reference macro as a comment
|
// Add string of reference macro as a comment
|
||||||
reference := macro.Get()
|
reference := macro.Get()
|
||||||
macro.Clear()
|
macro.Clear()
|
||||||
macro.Add("/* ").Add(reference).Add(" */")
|
/* DW0 : PAD_TRIG(OFF) | PAD_BUF(RX_DISABLE) | 1 - IGNORED */
|
||||||
macro.AddToMacroIgnoredMask()
|
macro.DecodeIgnored(PAD_CFG_DW0).DecodeIgnored(PAD_CFG_DW1)
|
||||||
macro.Add("\n\t")
|
if config.InfoLevelGet() >= 4 {
|
||||||
|
/* PAD_CFG_NF(GPP_B23, 20K_PD, PLTRST, NF2), */
|
||||||
|
macro.Add("/* ").Add(reference).Add(" */\n\t")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if config.AreFieldsIgnored() {
|
if config.AreFieldsIgnored() {
|
||||||
// Consider bit fields that should be ignored when regenerating
|
// Consider bit fields that should be ignored when regenerating
|
||||||
|
@ -409,8 +408,19 @@ func (macro *Macro) Generate() string {
|
||||||
}
|
}
|
||||||
|
|
||||||
if config.IsNonCheckingFlagUsed() {
|
if config.IsNonCheckingFlagUsed() {
|
||||||
macro.AddToMacroIgnoredMask()
|
body := macro.Get()
|
||||||
return macro.Get()
|
if config.InfoLevelGet() >= 3 {
|
||||||
|
macro.Clear().DecodeIgnored(PAD_CFG_DW0).DecodeIgnored(PAD_CFG_DW1)
|
||||||
|
comment := macro.Get()
|
||||||
|
if config.InfoLevelGet() >= 4 {
|
||||||
|
macro.Clear().Add("/* ")
|
||||||
|
macro.Fields.GenerateString()
|
||||||
|
macro.Add(" */\n\t")
|
||||||
|
comment += macro.Get()
|
||||||
|
}
|
||||||
|
return comment + body
|
||||||
|
}
|
||||||
|
return body
|
||||||
}
|
}
|
||||||
|
|
||||||
return macro.check().Get()
|
return macro.check().Get()
|
||||||
|
|
Loading…
Reference in New Issue