Skip to content

Added option for ignoring initial CLK state #4

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions src/QSpiAnalyzer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ QSpiAnalyzer::QSpiAnalyzer()
mCs(NULL)
{
SetAnalyzerSettings(mSettings.get());

#if defined(LOGIC2) && (SOFTWARE == SALEAE)
UseFrameV2();
#endif
}

QSpiAnalyzer::~QSpiAnalyzer()
Expand Down Expand Up @@ -157,6 +161,10 @@ bool QSpiAnalyzer::IsInitialClockPolarityCorrect()
if (mSck->GetBitState() == mSettings->mClockIdle) {
return true;
}
else if (mSettings->mIgnoreInitialClkState) {
mSck->AdvanceToNextEdge();
return true;
}

if (mSettings->mShowMarker) {
mResults->AddMarker(mCurrentSample, AnalyzerResults::ErrorSquare, mSettings->mSckChannel);
Expand Down Expand Up @@ -342,6 +350,37 @@ void QSpiAnalyzer::GetBlock()
result_frame.mType = (U8)mTransactionState;

mResults->AddFrame(result_frame);

#if defined(LOGIC2) && (SOFTWARE == SALEAE)
FrameV2 frame_v2;
const char* state_str;
switch (mTransactionState)
{
case QSpiTypes::SETUP_STATE:
state_str = "SETUP";
break;
case QSpiTypes::COMMAND_STATE:
state_str = "COMMAND";
break;
case QSpiTypes::ADDRESS_STATE:
state_str = "ADDRESS";
break;
case QSpiTypes::DUMMY_STATE:
state_str = "DUMMY";
break;
case QSpiTypes::DATA_STATE:
state_str = "DATA";
break;
default:
state_str = "UNDEFINED";
break;
}

frame_v2.AddInteger("data", data_word);
frame_v2.AddString("state", state_str);
mResults->AddFrameV2(frame_v2, "data_byte", result_frame.mStartingSampleInclusive, result_frame.mEndingSampleInclusive);
#endif

mResults->CommitResults();

if (advancing){
Expand Down
11 changes: 11 additions & 0 deletions src/QSpiAnalyzerSettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,11 @@ QSpiAnalyzerSettings::QSpiAnalyzerSettings()
mDataRateInterface->AddNumber(QSpiTypes::DDR, "DDR", "");
mDataRateInterface->SetNumber(mDataRate);

mIgnoreInitialClkStateInterface.reset(new AnalyzerSettingInterfaceBool());
mIgnoreInitialClkStateInterface->SetTitleAndTooltip("", "Ignore initial CS/CLK state");
mIgnoreInitialClkStateInterface->SetCheckBoxText("Ignore initial CLK state");
mIgnoreInitialClkStateInterface->SetValue(mIgnoreInitialClkState);

mUseShowMarkerInterface.reset(new AnalyzerSettingInterfaceBool());
mUseShowMarkerInterface->SetTitleAndTooltip("", "Show decode marker or not");
mUseShowMarkerInterface->SetCheckBoxText("Show Decode Marker");
Expand Down Expand Up @@ -181,6 +186,8 @@ QSpiAnalyzerSettings::QSpiAnalyzerSettings()
AddInterface(mCsPreEnabledInterface.get());
AddInterface(mCsPostEnabledInterface.get());

AddInterface(mIgnoreInitialClkStateInterface.get());

AddInterface(mUseShowMarkerInterface.get());

AddExportOption(0, "Export as text/csv file");
Expand Down Expand Up @@ -259,6 +266,8 @@ bool QSpiAnalyzerSettings::SetSettingsFromInterfaces()
mCsPreCycles = mCsPreEnabledInterface->GetNumber();
mCsPostCycles = mCsPostEnabledInterface->GetNumber();

mIgnoreInitialClkState = mIgnoreInitialClkStateInterface->GetValue();

mShowMarker = mUseShowMarkerInterface->GetValue();

ClearChannels();
Expand Down Expand Up @@ -395,5 +404,7 @@ void QSpiAnalyzerSettings::UpdateInterfacesFromSettings()
mCsPreEnabledInterface->SetNumber(mCsPreCycles);
mCsPostEnabledInterface->SetNumber(mCsPostCycles);

mIgnoreInitialClkStateInterface->SetValue(mIgnoreInitialClkState);

mUseShowMarkerInterface->SetValue(mShowMarker);
}
2 changes: 2 additions & 0 deletions src/QSpiAnalyzerSettings.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ class QSpiAnalyzerSettings : public AnalyzerSettings

U32 mCsPreCycles;
U32 mCsPostCycles;
bool mIgnoreInitialClkState;
bool mShowMarker;

protected:
Expand Down Expand Up @@ -90,6 +91,7 @@ class QSpiAnalyzerSettings : public AnalyzerSettings
std::unique_ptr< AnalyzerSettingInterfaceNumberList > mCsPreEnabledInterface;
std::unique_ptr< AnalyzerSettingInterfaceNumberList > mCsPostEnabledInterface;

std::unique_ptr< AnalyzerSettingInterfaceBool > mIgnoreInitialClkStateInterface;

std::unique_ptr< AnalyzerSettingInterfaceBool > mUseShowMarkerInterface;
};
Expand Down