Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: ngscopeclient/scopehal
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: a0bd7a2143b8
Choose a base ref
...
head repository: ngscopeclient/scopehal
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: b63e7bd9efb7
Choose a head ref
  • 1 commit
  • 2 files changed
  • 1 contributor

Commits on Sep 11, 2020

  1. Copy the full SHA
    b63e7bd View commit details
Showing with 34 additions and 3 deletions.
  1. +27 −3 scopeprotocols/IBM8b10bDecoder.cpp
  2. +7 −0 scopeprotocols/IBM8b10bDecoder.h
30 changes: 27 additions & 3 deletions scopeprotocols/IBM8b10bDecoder.cpp
Original file line number Diff line number Diff line change
@@ -47,6 +47,12 @@ IBM8b10bDecoder::IBM8b10bDecoder(string color)
//Set up channels
CreateInput("data");
CreateInput("clk");

m_displayformat = "Display Format";
m_parameters[m_displayformat] = FilterParameter(FilterParameter::TYPE_ENUM, Unit(Unit::UNIT_COUNTS));
m_parameters[m_displayformat].AddEnumValue("Dotted (K28.5 D21.5)", FORMAT_DOTTED);
m_parameters[m_displayformat].AddEnumValue("Hex (K.bc b5)", FORMAT_HEX);
m_parameters[m_displayformat].SetIntVal(FORMAT_DOTTED);
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -92,6 +98,8 @@ void IBM8b10bDecoder::SetDefaultName()

void IBM8b10bDecoder::Refresh()
{
m_cachedDisplayFormat = (DisplayFormat) m_parameters[m_displayformat].GetIntVal();

if(!VerifyAllInputsOK())
{
SetData(NULL, 0);
@@ -380,10 +388,26 @@ string IBM8b10bDecoder::GetText(int i)
char tmp[32];
if(s.m_error)
snprintf(tmp, sizeof(tmp), "ERROR");
else if(s.m_control)
snprintf(tmp, sizeof(tmp), "K%d.%d", left, right);
else
snprintf(tmp, sizeof(tmp), "D%d.%d", left, right);
{
//Dotted format
if(m_cachedDisplayFormat == FORMAT_DOTTED)
{
if(s.m_control)
snprintf(tmp, sizeof(tmp), "K%d.%d", left, right);
else
snprintf(tmp, sizeof(tmp), "D%d.%d", left, right);
}

//Hex format
else
{
if(s.m_control)
snprintf(tmp, sizeof(tmp), "K.%02x", s.m_data);
else
snprintf(tmp, sizeof(tmp), "%02x", s.m_data);
}
}
return string(tmp);
}
return "";
7 changes: 7 additions & 0 deletions scopeprotocols/IBM8b10bDecoder.h
Original file line number Diff line number Diff line change
@@ -76,9 +76,16 @@ class IBM8b10bDecoder : public Filter

virtual bool ValidateChannel(size_t i, StreamDescriptor stream);

enum DisplayFormat
{
FORMAT_DOTTED,
FORMAT_HEX
} m_cachedDisplayFormat;

PROTOCOL_DECODER_INITPROC(IBM8b10bDecoder)

protected:
std::string m_displayformat;
};

#endif