Address CI errors
diff --git a/hal/blocking/src/gpio_port.rs b/hal/blocking/src/gpio_port.rs index 2ed422e..f7ab53f 100644 --- a/hal/blocking/src/gpio_port.rs +++ b/hal/blocking/src/gpio_port.rs
@@ -243,4 +243,3 @@ fn clear_passthrough(&mut self) -> Result<(), Self::Error>; } -
diff --git a/target/ast10x0/peripherals/scu/registers.rs b/target/ast10x0/peripherals/scu/registers.rs index ceb7314..b5e6a8b 100644 --- a/target/ast10x0/peripherals/scu/registers.rs +++ b/target/ast10x0/peripherals/scu/registers.rs
@@ -27,7 +27,10 @@ /// - `base` points to a valid SCU register block. /// - access to the SCU instance is serialized appropriately. const unsafe fn new(base: *const device::scu::RegisterBlock) -> Self { - Self { base, _not_send_sync: PhantomData } + Self { + base, + _not_send_sync: PhantomData, + } } /// Create a register accessor for the global SCU instance.
diff --git a/target/ast10x0/peripherals/sgpiom/mod.rs b/target/ast10x0/peripherals/sgpiom/mod.rs index e2e3ab4..b17bac5 100644 --- a/target/ast10x0/peripherals/sgpiom/mod.rs +++ b/target/ast10x0/peripherals/sgpiom/mod.rs
@@ -15,4 +15,3 @@ Bank, BankDevice, Direction, Error, InitialLevel, InterruptMode, InterruptTrigger, SgpiomPinConfig, }; -
diff --git a/target/ast10x0/peripherals/sgpiom/register_block.rs b/target/ast10x0/peripherals/sgpiom/register_block.rs index 79016c3..00cb347 100644 --- a/target/ast10x0/peripherals/sgpiom/register_block.rs +++ b/target/ast10x0/peripherals/sgpiom/register_block.rs
@@ -28,7 +28,10 @@ /// - The pointed register block must remain valid for the lifetime of this `Sgpiom`. /// - Caller must enforce global ownership so concurrent mutable access does not occur. pub const unsafe fn new(sgpiom: *const device::sgpiom::RegisterBlock) -> Self { - Self { sgpiom, _not_send_sync: PhantomData } + Self { + sgpiom, + _not_send_sync: PhantomData, + } } /// Create an instance pointing to the global AST1060 SGPIOM register block.
diff --git a/target/ast10x0/peripherals/uart/mod.rs b/target/ast10x0/peripherals/uart/mod.rs index ad45b7f..eb3f729 100644 --- a/target/ast10x0/peripherals/uart/mod.rs +++ b/target/ast10x0/peripherals/uart/mod.rs
@@ -285,7 +285,10 @@ /// - `usart` must be a valid, non-null pointer to the AST1060 UART register block. /// - The pointed register block must remain valid for the lifetime of this `Usart`. pub const unsafe fn new_uninit(usart: *const device::uart::RegisterBlock) -> Self { - Self { usart, _not_send_sync: PhantomData } + Self { + usart, + _not_send_sync: PhantomData, + } } /// Create a new USART instance from a raw register-block pointer. @@ -300,7 +303,10 @@ /// - Caller must enforce global ownership/coordination so concurrent mutable access /// does not occur through other code paths. pub unsafe fn new(usart: *const device::uart::RegisterBlock) -> Self { - let this = Self { usart, _not_send_sync: PhantomData }; + let this = Self { + usart, + _not_send_sync: PhantomData, + }; unsafe { this.regs().uartfcr().write(|w| {
diff --git a/target/ast10x0/tests/peripherals/sgpiom/sgpiom_smoke/target.rs b/target/ast10x0/tests/peripherals/sgpiom/sgpiom_smoke/target.rs index 052b1d9..13ac5fa 100644 --- a/target/ast10x0/tests/peripherals/sgpiom/sgpiom_smoke/target.rs +++ b/target/ast10x0/tests/peripherals/sgpiom/sgpiom_smoke/target.rs
@@ -86,7 +86,11 @@ let sens0 = regs.gpio508().read().bits(); let sens1 = regs.gpio50c().read().bits(); let sens2 = regs.gpio510().read().bits(); - if (int_en & (1 << 2)) == 0 || (sens2 & (1 << 2)) == 0 || (sens0 & (1 << 2)) != 0 || (sens1 & (1 << 2)) != 0 { + if (int_en & (1 << 2)) == 0 + || (sens2 & (1 << 2)) == 0 + || (sens0 & (1 << 2)) != 0 + || (sens1 & (1 << 2)) != 0 + { pw_log::error!("interrupt config register mismatch"); return false; }
diff --git a/tools/sgpiom/BUILD.bazel b/tools/sgpiom/BUILD.bazel index 23acac8..bce8943 100644 --- a/tools/sgpiom/BUILD.bazel +++ b/tools/sgpiom/BUILD.bazel
@@ -41,15 +41,15 @@ filegroup( name = "ast1060_dcscm_inputs", srcs = [ - "examples/common.json", "examples/ast1060_dcscm.json", + "examples/common.json", ], ) filegroup( name = "ast1060_prot_dice_inputs", srcs = [ - "examples/common.json", "examples/ast1060_prot_dice.json", + "examples/common.json", ], )
diff --git a/tools/sgpiom/examples/common.json b/tools/sgpiom/examples/common.json index f660dc3..8f90a7c 100644 --- a/tools/sgpiom/examples/common.json +++ b/tools/sgpiom/examples/common.json
@@ -8,10 +8,30 @@ "enabled": true }, "banks": [ - { "name": "sgpiom_a_d", "pin_offset": 0, "ngpios": 32, "reserved_pins": [] }, - { "name": "sgpiom_e_h", "pin_offset": 32, "ngpios": 32, "reserved_pins": [] }, - { "name": "sgpiom_i_l", "pin_offset": 64, "ngpios": 32, "reserved_pins": [] }, - { "name": "sgpiom_m_p", "pin_offset": 96, "ngpios": 32, "reserved_pins": [] } + { + "name": "sgpiom_a_d", + "pin_offset": 0, + "ngpios": 32, + "reserved_pins": [] + }, + { + "name": "sgpiom_e_h", + "pin_offset": 32, + "ngpios": 32, + "reserved_pins": [] + }, + { + "name": "sgpiom_i_l", + "pin_offset": 64, + "ngpios": 32, + "reserved_pins": [] + }, + { + "name": "sgpiom_m_p", + "pin_offset": 96, + "ngpios": 32, + "reserved_pins": [] + } ], "signals": [] }
diff --git a/tools/sgpiom/schema/banks.schema.json b/tools/sgpiom/schema/banks.schema.json index 2831601..6b60f72 100644 --- a/tools/sgpiom/schema/banks.schema.json +++ b/tools/sgpiom/schema/banks.schema.json
@@ -5,14 +5,37 @@ "type": "array", "items": { "type": "object", - "required": ["name", "pin_offset", "ngpios", "reserved_pins"], + "required": [ + "name", + "pin_offset", + "ngpios", + "reserved_pins" + ], "properties": { - "name": { "type": "string", "minLength": 1 }, - "pin_offset": { "type": "integer", "enum": [0, 32, 64, 96] }, - "ngpios": { "type": "integer", "minimum": 1, "maximum": 32 }, + "name": { + "type": "string", + "minLength": 1 + }, + "pin_offset": { + "type": "integer", + "enum": [ + 0, + 32, + 64, + 96 + ] + }, + "ngpios": { + "type": "integer", + "minimum": 1, + "maximum": 32 + }, "reserved_pins": { "type": "array", - "items": { "type": "integer", "minimum": 0 } + "items": { + "type": "integer", + "minimum": 0 + } } }, "additionalProperties": true
diff --git a/tools/sgpiom/schema/controller.schema.json b/tools/sgpiom/schema/controller.schema.json index f6dd5b6..d849384 100644 --- a/tools/sgpiom/schema/controller.schema.json +++ b/tools/sgpiom/schema/controller.schema.json
@@ -3,18 +3,44 @@ "$id": "https://gpio-port.local/sgpiom/controller.schema.json", "title": "SGPIOM Controller", "type": "object", - "required": ["name", "base_addr", "bus_frequency_hz", "ngpios", "enabled"], + "required": [ + "name", + "base_addr", + "bus_frequency_hz", + "ngpios", + "enabled" + ], "properties": { - "name": { "type": "string", "minLength": 1 }, + "name": { + "type": "string", + "minLength": 1 + }, "base_addr": { "oneOf": [ - { "type": "integer", "minimum": 0, "maximum": 4294967295 }, - { "type": "string", "pattern": "^0x[0-9a-fA-F]{1,8}$" } + { + "type": "integer", + "minimum": 0, + "maximum": 4294967295 + }, + { + "type": "string", + "pattern": "^0x[0-9a-fA-F]{1,8}$" + } ] }, - "bus_frequency_hz": { "type": "integer", "minimum": 0, "maximum": 4294967295 }, - "ngpios": { "type": "integer", "minimum": 1, "maximum": 128 }, - "enabled": { "type": "boolean" } + "bus_frequency_hz": { + "type": "integer", + "minimum": 0, + "maximum": 4294967295 + }, + "ngpios": { + "type": "integer", + "minimum": 1, + "maximum": 128 + }, + "enabled": { + "type": "boolean" + } }, "additionalProperties": true }
diff --git a/tools/sgpiom/schema/signals.schema.json b/tools/sgpiom/schema/signals.schema.json index 7cdaa7e..5536489 100644 --- a/tools/sgpiom/schema/signals.schema.json +++ b/tools/sgpiom/schema/signals.schema.json
@@ -14,15 +14,44 @@ "safe_default" ], "properties": { - "logical_name": { "type": "string", "minLength": 1 }, - "bank": { "type": "string", "minLength": 1 }, - "pin": { "type": "integer", "minimum": 0 }, - "direction": { "type": "string", "enum": ["in", "out"] }, - "active_level": { "type": "string", "enum": ["high", "low"] }, + "logical_name": { + "type": "string", + "minLength": 1 + }, + "bank": { + "type": "string", + "minLength": 1 + }, + "pin": { + "type": "integer", + "minimum": 0 + }, + "direction": { + "type": "string", + "enum": [ + "in", + "out" + ] + }, + "active_level": { + "type": "string", + "enum": [ + "high", + "low" + ] + }, "safe_default": { "oneOf": [ - { "type": "null" }, - { "type": "integer", "enum": [0, 1] } + { + "type": "null" + }, + { + "type": "integer", + "enum": [ + 0, + 1 + ] + } ] } },
diff --git a/tools/sgpiom/sgpio_json_tool.py b/tools/sgpiom/sgpio_json_tool.py index 57a1c2e..57e79da 100755 --- a/tools/sgpiom/sgpio_json_tool.py +++ b/tools/sgpiom/sgpio_json_tool.py
@@ -196,7 +196,9 @@ if not _is_nonneg_int(bus_freq): errors.append("controller.bus_frequency_hz: must be non-negative integer") elif bus_freq > _U32_MAX: - errors.append("controller.bus_frequency_hz: exceeds u32 range (> 0xffffffff)") + errors.append( + "controller.bus_frequency_hz: exceeds u32 range (> 0xffffffff)" + ) if "ngpios" in controller and ( not _is_nonneg_int(controller["ngpios"]) @@ -274,7 +276,9 @@ else: for j, pin in enumerate(reserved): if not _is_nonneg_int(pin): - errors.append(f"{prefix}.reserved_pins[{j}]: must be non-negative integer") + errors.append( + f"{prefix}.reserved_pins[{j}]: must be non-negative integer" + ) elif isinstance(ngpios, int) and pin >= ngpios: errors.append( f"{prefix}.reserved_pins[{j}]: pin {pin} out of range for ngpios {ngpios}" @@ -315,7 +319,9 @@ if not isinstance(logical_name, str) or not logical_name: errors.append(f"{prefix}.logical_name: must be non-empty string") elif logical_name in seen_signal_names: - errors.append(f"{prefix}.logical_name: duplicate logical name '{logical_name}'") + errors.append( + f"{prefix}.logical_name: duplicate logical name '{logical_name}'" + ) else: seen_signal_names.add(logical_name) @@ -339,7 +345,10 @@ safe_default = signal.get("safe_default") # `bool` is an `int` subclass and true==1/false==0, so exclude it explicitly. - if not (safe_default is None or (type(safe_default) is int and safe_default in (0, 1))): + if not ( + safe_default is None + or (type(safe_default) is int and safe_default in (0, 1)) + ): errors.append(f"{prefix}.safe_default: must be null, 0, or 1") bank = bank_by_name.get(bank_name) @@ -355,9 +364,7 @@ reserved_pins = bank.get("reserved_pins", []) if isinstance(reserved_pins, list) and pin in reserved_pins: - errors.append( - f"{prefix}.pin: pin {pin} is reserved in bank '{bank_name}'" - ) + errors.append(f"{prefix}.pin: pin {pin} is reserved in bank '{bank_name}'") owner_key = (bank_name, pin) if owner_key in seen_pin_ownership: @@ -404,7 +411,7 @@ lines.append("// SPDX-License-Identifier: Apache-2.0") lines.append("") lines.append("// @generated by tools/sgpiom/sgpio_json_tool.py; DO NOT EDIT.") - lines.append(f"pub const SGPIOM_MANIFEST_HASH: &str = \"{manifest_hash}\";") + lines.append(f'pub const SGPIOM_MANIFEST_HASH: &str = "{manifest_hash}";') lines.append("") lines.append("#[derive(Debug, Copy, Clone, Eq, PartialEq)]") lines.append("pub enum Direction { In, Out }") @@ -443,7 +450,9 @@ # Canonicalize to a lowercase `0x` Rust literal regardless of input form. base_addr_literal = hex(_hex_or_int_value(controller["base_addr"])) - lines.append("pub const SGPIOM_CONTROLLER: SgpiomControllerConfig = SgpiomControllerConfig {") + lines.append( + "pub const SGPIOM_CONTROLLER: SgpiomControllerConfig = SgpiomControllerConfig {" + ) lines.append(f" name: {_rust_str_literal(controller['name'])},") lines.append(f" base_addr: {base_addr_literal},") lines.append(f" bus_frequency_hz: {controller['bus_frequency_hz']},") @@ -476,7 +485,9 @@ for signal in signals: dir_value = "Direction::In" if signal["direction"] == "in" else "Direction::Out" lvl_value = ( - "ActiveLevel::High" if signal["active_level"] == "high" else "ActiveLevel::Low" + "ActiveLevel::High" + if signal["active_level"] == "high" + else "ActiveLevel::Low" ) safe_default = signal["safe_default"] if safe_default is None: @@ -485,7 +496,9 @@ safe_default_text = "Some(true)" if safe_default == 1 else "Some(false)" lines.append(" SgpiomSignalConfig {") - lines.append(f" logical_name: {_rust_str_literal(signal['logical_name'])},") + lines.append( + f" logical_name: {_rust_str_literal(signal['logical_name'])}," + ) lines.append(f" bank: {_rust_str_literal(signal['bank'])},") lines.append(f" pin: {signal['pin']},") lines.append(f" direction: {dir_value},") @@ -513,7 +526,9 @@ return 1 if args.merged_out: - args.merged_out.write_text(json.dumps(merged, indent=2) + "\n", encoding="utf-8") + args.merged_out.write_text( + json.dumps(merged, indent=2) + "\n", encoding="utf-8" + ) print("validate: OK") return 0 @@ -598,7 +613,9 @@ f"freq={controller['bus_frequency_hz']}Hz ngpios={controller['ngpios']} " f"enabled={controller['enabled']}" ) - print(f"banks: {len(banks)} signals: {len(signals)} (in={in_count}, out={out_count})") + print( + f"banks: {len(banks)} signals: {len(signals)} (in={in_count}, out={out_count})" + ) print("bank usage:") for bank in banks: name = bank["name"] @@ -647,7 +664,9 @@ check_parser.add_argument("--output", type=Path, required=True) check_parser.set_defaults(func=cmd_check) - report_parser = subparsers.add_parser("report", help="Print manifest summary report") + report_parser = subparsers.add_parser( + "report", help="Print manifest summary report" + ) add_inputs(report_parser) report_parser.set_defaults(func=cmd_report)