Skip to content

Commit

Permalink
Presenting PA values
Browse files Browse the repository at this point in the history
  • Loading branch information
buldo committed May 26, 2024
1 parent a0463fd commit 968f368
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 20 deletions.
16 changes: 4 additions & 12 deletions src/EfuseManager/ViewModels/EfuseMapViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,10 @@ public EfuseMapViewModel()

BeslEnable = new OneBitValueViewModel(0xD6, 3, Bytes);

Pa2gA = new OneBitValueViewModel(0xBC, 4, Bytes);
Pa2gB = new OneBitValueViewModel(0xBC, 5, Bytes);
Pa2gC = new OneBitValueViewModel(0xBC, 6, Bytes);
Pa2gD = new OneBitValueViewModel(0xBC, 7, Bytes);
Pa5gA = new OneBitValueViewModel(0xBC, 0, Bytes);
Pa5gB = new OneBitValueViewModel(0xBC, 1, Bytes);
Pa5gC = new OneBitValueViewModel(0xBC, 2, Bytes);
Pa5gD = new OneBitValueViewModel(0xBC, 3, Bytes);
Pa2gA = new OneBitValueViewModel(0xBC, 4, Bytes, true);
Pa2gB = new OneBitValueViewModel(0xBC, 5, Bytes, true);
Pa5gA = new OneBitValueViewModel(0xBC, 0, Bytes, true);
Pa5gB = new OneBitValueViewModel(0xBC, 1, Bytes, true);
}

public List<EfuseByteViewModel> Bytes { get; } = new();
Expand Down Expand Up @@ -68,13 +64,9 @@ public EfuseMapViewModel()

public OneBitValueViewModel Pa2gA { get; }
public OneBitValueViewModel Pa2gB { get; }
public OneBitValueViewModel Pa2gC { get; }
public OneBitValueViewModel Pa2gD { get; }

public OneBitValueViewModel Pa5gA { get; }
public OneBitValueViewModel Pa5gB { get; }
public OneBitValueViewModel Pa5gC { get; }
public OneBitValueViewModel Pa5gD { get; }

public void LoadData(byte[] efuseMap)
{
Expand Down
13 changes: 11 additions & 2 deletions src/EfuseManager/ViewModels/OneBitValueViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,18 @@ namespace EfuseManager.ViewModels;
public class OneBitValueViewModel : ObservableObject
{
private readonly int _bitNumber;
private readonly bool _byteFfIsZero;
private readonly EfuseByteViewModel _byteViewModel;
private bool _boolValue;

public OneBitValueViewModel(
int offset,
int bitNumber,
List<EfuseByteViewModel> map)
List<EfuseByteViewModel> map,
bool byteFfIsZero = false)
{
_bitNumber = bitNumber;
_byteFfIsZero = byteFfIsZero;
_byteViewModel = map[offset];
_byteViewModel.Loaded += ByteViewModelOnLoaded;
UpdateValue();
Expand All @@ -33,7 +36,13 @@ private void ByteViewModelOnLoaded(object? sender, EventArgs e)

private void UpdateValue()
{
BoolValue = GetBit(_byteViewModel.ActualValue, _bitNumber);
var value = _byteViewModel.ActualValue;
if (_byteFfIsZero && value == 0xFF)
{
value = 0;
}

BoolValue = GetBit(value, _bitNumber);
}

private static bool GetBit(byte b, int bitNumber)
Expand Down
8 changes: 2 additions & 6 deletions src/EfuseManager/Views/EfuseView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,16 +42,12 @@
<GroupBox Header="PA; 0 internal; 1 external" Margin="0,4,0,0">
<StackPanel Orientation="Horizontal">
<StackPanel Orientation="Vertical">
<CheckBox Margin="0,2,2,0" Content="2G patch-D" IsChecked="{Binding Pa2gD.BoolValue}"/>
<CheckBox Margin="0,2,2,0" Content="2G patch-C" IsChecked="{Binding Pa2gC.BoolValue}"/>
<CheckBox Margin="0,2,2,0" Content="2G patch-B" IsChecked="{Binding Pa2gB.BoolValue}"/>
<CheckBox Margin="0,2,2,0" Content="2G patch-A" IsChecked="{Binding Pa2gA.BoolValue}"/>
<CheckBox Margin="0,2,2,0" Content="2G patch-B" IsChecked="{Binding Pa2gB.BoolValue}"/>
</StackPanel>
<StackPanel Orientation="Vertical" Margin="10,0,0,0">
<CheckBox Margin="0,6,2,0" Content="5G patch-D" IsChecked="{Binding Pa5gD.BoolValue}"/>
<CheckBox Margin="0,2,2,0" Content="5G patch-C" IsChecked="{Binding Pa5gC.BoolValue}"/>
<CheckBox Margin="0,2,2,0" Content="5G patch-A" IsChecked="{Binding Pa5gA.BoolValue}"/>
<CheckBox Margin="0,2,2,0" Content="5G patch-B" IsChecked="{Binding Pa5gB.BoolValue}"/>
<CheckBox Margin="0,2,2,0" Content="5G patch-D" IsChecked="{Binding Pa5gA.BoolValue}"/>
</StackPanel>

</StackPanel>
Expand Down

0 comments on commit 968f368

Please sign in to comment.