Commit 8fbd2914 authored by Tomasz Wlostowski's avatar Tomasz Wlostowski

texinfo doc generator: don't produce empty field-description tables if no descriptions are provided

parent b4edc693
...@@ -89,7 +89,7 @@ function cgen_texinfo_reg(reg) ...@@ -89,7 +89,7 @@ function cgen_texinfo_reg(reg)
-- emit("Address: @code{"..string.format("0x%x", reg.base * (DATA_BUS_WIDTH/8)).."}"); -- emit("Address: @code{"..string.format("0x%x", reg.base * (DATA_BUS_WIDTH/8)).."}");
if(reg.description ~= nil) then if(reg.description ~= nil) then
emit(reg.description); emit(format_tex_string(reg.description));
end end
emit("@multitable @columnfractions .10 .10 .15 .10 .55") emit("@multitable @columnfractions .10 .10 .15 .10 .55")
...@@ -110,7 +110,14 @@ function cgen_texinfo_reg(reg) ...@@ -110,7 +110,14 @@ function cgen_texinfo_reg(reg)
emit("@code{"..string.upper(field.c_prefix).."}"); emit("@code{"..string.upper(field.c_prefix).."}");
end end
emit("@tab @code{X} @tab "); val = 'X';
if(field.reset_value ~= nil) then
val = field.reset_value;
elseif ((field.access_bus == READ_WRITE and field.access_dev == READ_ONLY) or field.type == MONOSTABLE or field.access_bus == WRITE_ONLY) then
val = '0'
end
emit("@tab @code{"..val.."} @tab ");
emit(field.name); emit(field.name);
-- emit("@columnfractions 1") -- emit("@columnfractions 1")
...@@ -122,6 +129,15 @@ function cgen_texinfo_reg(reg) ...@@ -122,6 +129,15 @@ function cgen_texinfo_reg(reg)
end); end);
emit("@end multitable"); emit("@end multitable");
local got_any_descriptions = false
foreach_subfield(reg, function(field)
if(field.description ~= nil) then
got_any_descriptions = true
end
end);
if(got_any_descriptions) then
emit("@multitable @columnfractions 0.15 0.85") emit("@multitable @columnfractions 0.15 0.85")
emit("@headitem Field @tab Description") emit("@headitem Field @tab Description")
foreach_subfield(reg, function(field) foreach_subfield(reg, function(field)
...@@ -131,6 +147,7 @@ function cgen_texinfo_reg(reg) ...@@ -131,6 +147,7 @@ function cgen_texinfo_reg(reg)
end end
end); end);
emit("@end multitable"); emit("@end multitable");
end
end end
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment