From 129e54dd2d1e8e845fb452c9a7e9669278fb48ca Mon Sep 17 00:00:00 2001 From: Nav Date: Tue, 13 Aug 2024 22:42:24 +0100 Subject: [PATCH] Updated AtdfService to clear any peripheral register group `key` and `name` attributes, where necessary. --- .../Services/AtdfService.php | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/build/scripts/Targets/TargetDescriptionFiles/Services/AtdfService.php b/build/scripts/Targets/TargetDescriptionFiles/Services/AtdfService.php index 868b8510..43344d65 100644 --- a/build/scripts/Targets/TargetDescriptionFiles/Services/AtdfService.php +++ b/build/scripts/Targets/TargetDescriptionFiles/Services/AtdfService.php @@ -640,6 +640,24 @@ class AtdfService } } + if (count($output->registerGroupInstances) === 1) { + /* + * ATDF peripherals sometimes override the register group keys and names, when there's only a single + * register group in the peripheral. + * + * This is not necessary for Bloom's TDFs, so we tidy it up here by clearing the `key` and `name` + * attributes where we can. + */ + foreach ($output->registerGroupInstances as $instance) { + if ($output->key == 'fuse' && $instance->key !== $instance->registerGroupKey) { + continue; + } + + $instance->key = null; + $instance->name = null; + } + } + $signalElement = $element->getElementsByTagName('signals')->item(0); if ($signalElement instanceof DOMElement) { foreach ($signalElement->childNodes as $childNode) {