class AsmHeader
Defined at line 39 of file ../../zircon/system/ulib/hwreg/include/hwreg/asm.h
This can be used in fluid style to define macros directly for constants,
or to define macros derived from an hwreg::RegisterBase subclass, e.g.:
```
int main(int argc, char**) {
return hwreg::AsmHeader()
.Register
<FooReg
>("FOO_")
.Macro("FOO_BAR_VAL", FooReg::kBarVal)
.Main(argc, argv);
}
```
See //zircon/system/ulib/hwreg/hwreg_asm_header.gni to easily plug such a
header generator program into the build.
Public Methods
AsmHeader & Line (std::initializer_list<std::string_view> strings)
Emit a raw line to the header by concatenating the strings.
AsmHeader & Macro (std::string_view name, std::string_view value)
Emit a fixed macro definition.
AsmHeader & Macro (std::string_view name, uint64_t value)
Same but for integer values.
std::string Output (std::string_view include_name)
Format the contents of a header file with the accumulated definitions.
The header should be the #include "name" for the header, which is
translated into its guard symbol.
int Output (const char * filename, std::string_view include_name)
Write out the accumulated definitions to the file, not touching it if
it hasn't changed. Returns 0 on success or an errno code for failure
to write the file.
int Main (int argc, char ** argv)
Parse two command line arguments for filename and include_name and
write the file. Returns exit status and prints errors to stderr.
Defined at line 19 of file ../../zircon/system/ulib/hwreg/asm.cc
template <typename T>
AsmHeader & Register (std::string_view prefix)
Emit a macro for each field in the register, plus a macro for the mask
of reserved-zero bits and a macro for the mask of unknown bits.
T is required to inherit from a `RegisterBase` with `EnableAsmGeneration`.
Defined at line 54 of file ../../zircon/system/ulib/hwreg/include/hwreg/asm.h
template <typename T>
AsmHeader & Register (std::string_view prefix)
Emit a macro for each field in the register, plus a macro for the mask
of reserved-zero bits and a macro for the mask of unknown bits.
T is required to inherit from a `RegisterBase` with `EnableAsmGeneration`.
Defined at line 54 of file ../../zircon/system/ulib/hwreg/include/hwreg/asm.h
AsmHeader & Line (std::initializer_list<std::string_view> strings)
Emit a raw line to the header by concatenating the strings.
Defined at line 83 of file ../../zircon/system/ulib/hwreg/asm.cc
AsmHeader & Macro (std::string_view name, std::string_view value)
Emit a fixed macro definition.
Defined at line 91 of file ../../zircon/system/ulib/hwreg/asm.cc
AsmHeader & Macro (std::string_view name, uint64_t value)
Same but for integer values.
Defined at line 100 of file ../../zircon/system/ulib/hwreg/asm.cc
AsmHeader & Macro (std::string_view name, uint64_t value)
Same but for integer values.
AsmHeader & Macro (std::string_view name, uint64_t value)
Same but for integer values.
std::string Output (std::string_view include_name)
Format the contents of a header file with the accumulated definitions.
The header should be the #include "name" for the header, which is
translated into its guard symbol.
Defined at line 34 of file ../../zircon/system/ulib/hwreg/asm.cc
int Output (const char * filename, std::string_view include_name)
Write out the accumulated definitions to the file, not touching it if
it hasn't changed. Returns 0 on success or an errno code for failure
to write the file.
Defined at line 53 of file ../../zircon/system/ulib/hwreg/asm.cc