8b35851e4c
There is no need to repeat "import" for each module in GoLang. Use this keyword only once in each file for code cleanliness. Change-Id: Ibb24fafd409b31b174946a39ca1f810d59b87e76 Signed-off-by: Maxim Polyakov <max.senia.poliak@gmail.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/55985 Reviewed-by: Angel Pons <th3fanbus@gmail.com> Reviewed-by: Matt DeVillier <matt.devillier@gmail.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
30 lines
714 B
Go
30 lines
714 B
Go
package raw
|
|
|
|
import (
|
|
"fmt"
|
|
"../../platforms/common"
|
|
)
|
|
|
|
type FieldMacros struct {}
|
|
|
|
func (FieldMacros) DecodeDW0() {
|
|
macro := common.GetMacro()
|
|
// Do not decode, print as is.
|
|
macro.Add(fmt.Sprintf("0x%0.8x", macro.Register(common.PAD_CFG_DW0).ValueGet()))
|
|
}
|
|
|
|
func (FieldMacros) DecodeDW1() {
|
|
macro := common.GetMacro()
|
|
// Do not decode, print as is.
|
|
macro.Add(fmt.Sprintf("0x%0.8x", macro.Register(common.PAD_CFG_DW1).ValueGet()))
|
|
}
|
|
|
|
// GenerateString - generates the entire string of bitfield macros.
|
|
func (bitfields FieldMacros) GenerateString() {
|
|
macro := common.GetMacro()
|
|
macro.Add("_PAD_CFG_STRUCT(").Id().Add(", ")
|
|
bitfields.DecodeDW0()
|
|
macro.Add(", ")
|
|
bitfields.DecodeDW1()
|
|
macro.Add("),")
|
|
}
|