Skip to content

Commit 39d1e11

Browse files
authored
Add SOC config that is hidden from the peri table (#3839)
1 parent da9a933 commit 39d1e11

File tree

2 files changed

+30
-2
lines changed

2 files changed

+30
-2
lines changed

esp-metadata/src/cfg.rs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,12 +71,15 @@ pub(crate) struct PeriInstance<I = EmptyInstanceConfig> {
7171
}
7272

7373
/// A single cell in the peripheral support table.
74+
#[derive(Default)]
7475
pub(crate) struct SupportItem {
7576
/// The human-readable name of the driver in the table (leftmost cell.)
7677
pub name: &'static str,
7778
/// The ID of the driver ([device.<config_group>]) in the TOML, that this
7879
/// item corresponds to.
7980
pub config_group: &'static str,
81+
/// If true, this driver is not shown in the peripheral support table.
82+
pub hide_from_peri_table: bool,
8083
}
8184

8285
/// Define driver configuration structs, and a PeriConfig struct
@@ -88,6 +91,9 @@ macro_rules! driver_configs {
8891
(@property (Option<u32>) $self:ident, $config:ident) => { Value::from($self.$config) };
8992
(@property ($($other:ty)*) $self:ident, $config:ident) => { Value::Unset }; // Not a property
9093

94+
(@default $default:literal) => { $default };
95+
(@default $default:literal $opt:literal) => { $opt };
96+
9197
// Creates a single struct
9298
(@one
9399
$struct:ident $(<$instance_config:ident>)? ($group:ident) {
@@ -129,6 +135,7 @@ macro_rules! driver_configs {
129135
driver: $driver:ident,
130136
// Driver name, used in the generated documentation.
131137
name: $name:literal,
138+
$(hide_from_peri_table: $hide:literal,)?
132139
$(has_computed_properties: $computed:literal,)?
133140
properties: $tokens:tt
134141
},
@@ -156,6 +163,7 @@ macro_rules! driver_configs {
156163
SupportItem {
157164
name: $name,
158165
config_group: stringify!($driver),
166+
hide_from_peri_table: driver_configs!(@default false $($hide)?),
159167
},
160168
)+
161169
]
@@ -224,6 +232,13 @@ macro_rules! driver_configs {
224232

225233
// TODO: sort this similar to how the product portfolio is organized
226234
driver_configs![
235+
SocProperties {
236+
driver: soc,
237+
name: "SOC",
238+
hide_from_peri_table: true,
239+
properties: {}
240+
},
241+
227242
AdcProperties {
228243
driver: adc,
229244
name: "ADC",

esp-metadata/src/lib.rs

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -979,7 +979,12 @@ pub fn generate_chip_support_status(output: &mut impl Write) -> std::fmt::Result
979979

980980
// Calculate the width of the first column.
981981
let driver_col_width = std::iter::once("Driver")
982-
.chain(PeriConfig::drivers().iter().map(|i| i.name))
982+
.chain(
983+
PeriConfig::drivers()
984+
.iter()
985+
.filter(|i| !i.hide_from_peri_table)
986+
.map(|i| i.name),
987+
)
983988
.map(|c| c.len())
984989
.max()
985990
.unwrap();
@@ -1003,7 +1008,15 @@ pub fn generate_chip_support_status(output: &mut impl Write) -> std::fmt::Result
10031008
writeln!(output)?;
10041009

10051010
// Driver support status
1006-
for SupportItem { name, config_group } in PeriConfig::drivers() {
1011+
for SupportItem {
1012+
name,
1013+
config_group,
1014+
hide_from_peri_table,
1015+
} in PeriConfig::drivers()
1016+
{
1017+
if *hide_from_peri_table {
1018+
continue;
1019+
}
10071020
write!(output, "| {name:driver_col_width$} |")?;
10081021
for chip in Chip::iter() {
10091022
let config = Config::for_chip(&chip);

0 commit comments

Comments
 (0)