Added alternative flag to Signal element in TDFs

This commit is contained in:
Nav
2024-10-04 23:45:16 +01:00
parent 876d402baa
commit d906f2f426
198 changed files with 10442 additions and 10410 deletions

View File

@@ -206,6 +206,17 @@ class AtdfService
}
}
// Rename GPIO port signals
foreach ($tdf->peripherals as $peripheral) {
if ($peripheral->moduleKey !== 'gpio_port') {
continue;
}
foreach ($peripheral->signals as $signal) {
$signal->name = strtoupper((string) $signal->padKey);
}
}
if (in_array(TargetPhysicalInterface::UPDI, $tdf->getSupportedDebugPhysicalInterfaces())) {
/*
* ATDFs for UPDI-enabled targets do not typically possess an `ocd_base_addr` property in the updi_interface
@@ -629,7 +640,8 @@ class AtdfService
$attributes = $this->getNodeAttributesByName($element);
return new PhysicalInterface(
$physicalInterfacesByName[strtolower($attributes['name'] ?? '')]?->value
?? (!empty($attributes['type']) ? strtolower($attributes['type']) : null)
?? (!empty($attributes['type']) ? strtolower($attributes['type']) : null),
[]
);
}
@@ -715,11 +727,18 @@ class AtdfService
{
$attributes = $this->getNodeAttributesByName($element);
$padKey = isset($attributes['pad']) ? strtolower(trim($attributes['pad'])) : null;
$function = $attributes['function'] ?? null;
return new Signal(
isset($attributes['pad']) ? strtolower(trim($attributes['pad'])) : null,
isset($attributes['group'])
? trim($attributes['group'])
: (!empty($padKey) ? strtoupper($padKey) : null),
$padKey,
stristr((string) $function, 'default') !== false
? false
: (stristr((string) $function, '_alt') !== false ? true : null),
$this->stringService->tryStringToInt($attributes['index'] ?? null),
$attributes['function'] ?? null,
$attributes['group'] ?? null,
$function,
$attributes['field'] ?? null
);
}

View File

@@ -394,6 +394,7 @@ class FromXmlService
return new Signal(
$attributes['name'] ?? null,
$attributes['pad-key'] ?? null,
isset($attributes['alternative']) ? (bool) $attributes['alternative'] : null,
$this->stringService->tryStringToInt($attributes['index'] ?? null),
$attributes['function'] ?? null,
$attributes['field'] ?? null

View File

@@ -198,6 +198,10 @@ class ToXmlService
$element->setAttribute('name', $signal->name);
$element->setAttribute('pad-key', $signal->padKey);
if ($signal->alternative !== null) {
$element->setAttribute('alternative', $signal->alternative ? 'true' : 'false');
}
if ($signal->index !== null) {
$element->setAttribute('index', $signal->index);
}

View File

@@ -5,6 +5,7 @@ class Signal
{
public ?string $name = null;
public ?string $padKey = null;
public ?bool $alternative = null;
public ?int $index = null;
public ?string $function = null;
public ?string $field = null;
@@ -12,12 +13,14 @@ class Signal
public function __construct(
?string $name,
?string $padKey,
?bool $alternative,
?int $index,
?string $function,
?string $field
) {
$this->name = $name;
$this->padKey = $padKey;
$this->alternative = $alternative;
$this->index = $index;
$this->function = $function;
$this->field = $field;