Added alternative flag to Signal element in TDFs
This commit is contained in:
@@ -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
|
||||
);
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user