init
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -1,2 +1,4 @@
|
|||||||
/build
|
/build
|
||||||
.DS_Store
|
.DS_Store
|
||||||
|
|
||||||
|
.cache/
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
cmake_minimum_required (VERSION 3.13)
|
cmake_minimum_required (VERSION 3.13)
|
||||||
|
|
||||||
project(SimpleSerialAnalyzer)
|
project(TLC59731Analyzer)
|
||||||
|
|
||||||
add_definitions( -DLOGIC2 )
|
add_definitions( -DLOGIC2 )
|
||||||
|
|
||||||
@@ -13,14 +13,14 @@ set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
|
|||||||
include(ExternalAnalyzerSDK)
|
include(ExternalAnalyzerSDK)
|
||||||
|
|
||||||
set(SOURCES
|
set(SOURCES
|
||||||
src/SimpleSerialAnalyzer.cpp
|
src/TLC59731Analyzer.cpp
|
||||||
src/SimpleSerialAnalyzer.h
|
src/TLC59731Analyzer.h
|
||||||
src/SimpleSerialAnalyzerResults.cpp
|
src/TLC59731AnalyzerResults.cpp
|
||||||
src/SimpleSerialAnalyzerResults.h
|
src/TLC59731AnalyzerResults.h
|
||||||
src/SimpleSerialAnalyzerSettings.cpp
|
src/TLC59731AnalyzerSettings.cpp
|
||||||
src/SimpleSerialAnalyzerSettings.h
|
src/TLC59731AnalyzerSettings.h
|
||||||
src/SimpleSerialSimulationDataGenerator.cpp
|
src/TLC59731SimulationDataGenerator.cpp
|
||||||
src/SimpleSerialSimulationDataGenerator.h
|
src/TLC59731SimulationDataGenerator.h
|
||||||
)
|
)
|
||||||
|
|
||||||
add_analyzer_plugin(${PROJECT_NAME} SOURCES ${SOURCES})
|
add_analyzer_plugin(${PROJECT_NAME} SOURCES ${SOURCES})
|
||||||
|
|||||||
@@ -1,115 +0,0 @@
|
|||||||
#include "SimpleSerialAnalyzer.h"
|
|
||||||
#include "SimpleSerialAnalyzerSettings.h"
|
|
||||||
#include <AnalyzerChannelData.h>
|
|
||||||
|
|
||||||
SimpleSerialAnalyzer::SimpleSerialAnalyzer()
|
|
||||||
: Analyzer2(),
|
|
||||||
mSettings(),
|
|
||||||
mSimulationInitilized( false )
|
|
||||||
{
|
|
||||||
SetAnalyzerSettings( &mSettings );
|
|
||||||
}
|
|
||||||
|
|
||||||
SimpleSerialAnalyzer::~SimpleSerialAnalyzer()
|
|
||||||
{
|
|
||||||
KillThread();
|
|
||||||
}
|
|
||||||
|
|
||||||
void SimpleSerialAnalyzer::SetupResults()
|
|
||||||
{
|
|
||||||
// SetupResults is called each time the analyzer is run. Because the same instance can be used for multiple runs, we need to clear the results each time.
|
|
||||||
mResults.reset(new SimpleSerialAnalyzerResults( this, &mSettings ));
|
|
||||||
SetAnalyzerResults( mResults.get() );
|
|
||||||
mResults->AddChannelBubblesWillAppearOn( mSettings.mInputChannel );
|
|
||||||
}
|
|
||||||
|
|
||||||
void SimpleSerialAnalyzer::WorkerThread()
|
|
||||||
{
|
|
||||||
mSampleRateHz = GetSampleRate();
|
|
||||||
|
|
||||||
mSerial = GetAnalyzerChannelData( mSettings.mInputChannel );
|
|
||||||
|
|
||||||
if( mSerial->GetBitState() == BIT_LOW )
|
|
||||||
mSerial->AdvanceToNextEdge();
|
|
||||||
|
|
||||||
U32 samples_per_bit = mSampleRateHz / mSettings.mBitRate;
|
|
||||||
U32 samples_to_first_center_of_first_data_bit = U32( 1.5 * double( mSampleRateHz ) / double( mSettings.mBitRate ) );
|
|
||||||
|
|
||||||
for( ; ; )
|
|
||||||
{
|
|
||||||
U8 data = 0;
|
|
||||||
U8 mask = 1 << 7;
|
|
||||||
|
|
||||||
mSerial->AdvanceToNextEdge(); //falling edge -- beginning of the start bit
|
|
||||||
|
|
||||||
U64 starting_sample = mSerial->GetSampleNumber();
|
|
||||||
|
|
||||||
mSerial->Advance( samples_to_first_center_of_first_data_bit );
|
|
||||||
|
|
||||||
for( U32 i=0; i<8; i++ )
|
|
||||||
{
|
|
||||||
//let's put a dot exactly where we sample this bit:
|
|
||||||
mResults->AddMarker( mSerial->GetSampleNumber(), AnalyzerResults::Dot, mSettings.mInputChannel );
|
|
||||||
|
|
||||||
if( mSerial->GetBitState() == BIT_HIGH )
|
|
||||||
data |= mask;
|
|
||||||
|
|
||||||
mSerial->Advance( samples_per_bit );
|
|
||||||
|
|
||||||
mask = mask >> 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//we have a byte to save.
|
|
||||||
Frame frame;
|
|
||||||
frame.mData1 = data;
|
|
||||||
frame.mFlags = 0;
|
|
||||||
frame.mStartingSampleInclusive = starting_sample;
|
|
||||||
frame.mEndingSampleInclusive = mSerial->GetSampleNumber();
|
|
||||||
|
|
||||||
mResults->AddFrame( frame );
|
|
||||||
mResults->CommitResults();
|
|
||||||
ReportProgress( frame.mEndingSampleInclusive );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool SimpleSerialAnalyzer::NeedsRerun()
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
U32 SimpleSerialAnalyzer::GenerateSimulationData( U64 minimum_sample_index, U32 device_sample_rate, SimulationChannelDescriptor** simulation_channels )
|
|
||||||
{
|
|
||||||
if( mSimulationInitilized == false )
|
|
||||||
{
|
|
||||||
mSimulationDataGenerator.Initialize( GetSimulationSampleRate(), &mSettings );
|
|
||||||
mSimulationInitilized = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return mSimulationDataGenerator.GenerateSimulationData( minimum_sample_index, device_sample_rate, simulation_channels );
|
|
||||||
}
|
|
||||||
|
|
||||||
U32 SimpleSerialAnalyzer::GetMinimumSampleRateHz()
|
|
||||||
{
|
|
||||||
return mSettings.mBitRate * 4;
|
|
||||||
}
|
|
||||||
|
|
||||||
const char* SimpleSerialAnalyzer::GetAnalyzerName() const
|
|
||||||
{
|
|
||||||
return "Simple Serial";
|
|
||||||
}
|
|
||||||
|
|
||||||
const char* GetAnalyzerName()
|
|
||||||
{
|
|
||||||
return "Simple Serial";
|
|
||||||
}
|
|
||||||
|
|
||||||
Analyzer* CreateAnalyzer()
|
|
||||||
{
|
|
||||||
return new SimpleSerialAnalyzer();
|
|
||||||
}
|
|
||||||
|
|
||||||
void DestroyAnalyzer( Analyzer* analyzer )
|
|
||||||
{
|
|
||||||
delete analyzer;
|
|
||||||
}
|
|
||||||
@@ -1,29 +0,0 @@
|
|||||||
#ifndef SIMPLESERIAL_SIMULATION_DATA_GENERATOR
|
|
||||||
#define SIMPLESERIAL_SIMULATION_DATA_GENERATOR
|
|
||||||
|
|
||||||
#include <SimulationChannelDescriptor.h>
|
|
||||||
#include <string>
|
|
||||||
class SimpleSerialAnalyzerSettings;
|
|
||||||
|
|
||||||
class SimpleSerialSimulationDataGenerator
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
SimpleSerialSimulationDataGenerator();
|
|
||||||
~SimpleSerialSimulationDataGenerator();
|
|
||||||
|
|
||||||
void Initialize( U32 simulation_sample_rate, SimpleSerialAnalyzerSettings* settings );
|
|
||||||
U32 GenerateSimulationData( U64 newest_sample_requested, U32 sample_rate, SimulationChannelDescriptor** simulation_channel );
|
|
||||||
|
|
||||||
protected:
|
|
||||||
SimpleSerialAnalyzerSettings* mSettings;
|
|
||||||
U32 mSimulationSampleRateHz;
|
|
||||||
|
|
||||||
protected:
|
|
||||||
void CreateSerialByte();
|
|
||||||
std::string mSerialText;
|
|
||||||
U32 mStringIndex;
|
|
||||||
|
|
||||||
SimulationChannelDescriptor mSerialSimulationData;
|
|
||||||
|
|
||||||
};
|
|
||||||
#endif //SIMPLESERIAL_SIMULATION_DATA_GENERATOR
|
|
||||||
252
src/TLC59731Analyzer.cpp
Normal file
252
src/TLC59731Analyzer.cpp
Normal file
@@ -0,0 +1,252 @@
|
|||||||
|
#include "TLC59731Analyzer.h"
|
||||||
|
#include "TLC59731AnalyzerSettings.h"
|
||||||
|
#include <AnalyzerChannelData.h>
|
||||||
|
#include <AnalyzerResults.h>
|
||||||
|
|
||||||
|
TLC59731Analyzer::TLC59731Analyzer() : Analyzer2(), mSettings(), mSimulationInitilized( false )
|
||||||
|
{
|
||||||
|
SetAnalyzerSettings( &mSettings );
|
||||||
|
}
|
||||||
|
|
||||||
|
TLC59731Analyzer::~TLC59731Analyzer()
|
||||||
|
{
|
||||||
|
KillThread();
|
||||||
|
}
|
||||||
|
|
||||||
|
void TLC59731Analyzer::SetupResults()
|
||||||
|
{
|
||||||
|
// SetupResults is called each time the analyzer is run. Because the same instance can be used for multiple runs, we need to clear the
|
||||||
|
// results each time.
|
||||||
|
mResults.reset( new TLC59731AnalyzerResults( this, &mSettings ) );
|
||||||
|
SetAnalyzerResults( mResults.get() );
|
||||||
|
mResults->AddChannelBubblesWillAppearOn( mSettings.mInputChannel );
|
||||||
|
}
|
||||||
|
|
||||||
|
void TLC59731Analyzer::WorkerThread()
|
||||||
|
{
|
||||||
|
mSampleRateHz = GetSampleRate();
|
||||||
|
|
||||||
|
mSerial = GetAnalyzerChannelData( mSettings.mInputChannel );
|
||||||
|
|
||||||
|
while( SamplesToNS( mSerial->GetSampleOfNextEdge() - mSerial->GetSampleNumber() ) < TLL_MIN )
|
||||||
|
{
|
||||||
|
mSerial->AdvanceToNextEdge();
|
||||||
|
}
|
||||||
|
while( mSerial->GetBitState() != BIT_HIGH )
|
||||||
|
{
|
||||||
|
mSerial->AdvanceToNextEdge(); // wait for rising
|
||||||
|
}
|
||||||
|
|
||||||
|
U32 data = 0;
|
||||||
|
// measure cycletime
|
||||||
|
// start of bit
|
||||||
|
U64 SoB = mSerial->GetSampleNumber();
|
||||||
|
U64 starting_sample = SoB;
|
||||||
|
mSerial->AdvanceToNextEdge(); // falling edge
|
||||||
|
if( SamplesToNS( mSerial->GetSampleOfNextEdge() - SoB ) <= MAX_CYCLETIME )
|
||||||
|
{
|
||||||
|
mSerial->AdvanceToNextEdge(); // rising edge of second 0
|
||||||
|
cycleTime = SamplesToNS( mSerial->GetSampleNumber() - SoB );
|
||||||
|
SoB = mSerial->GetSampleNumber();
|
||||||
|
}
|
||||||
|
|
||||||
|
while( 1 )
|
||||||
|
{
|
||||||
|
mSerial->AdvanceToNextEdge(); // falling edge
|
||||||
|
if( SamplesToNS( mSerial->GetSampleOfNextEdge() - SoB ) < cycleTime / 2 )
|
||||||
|
{
|
||||||
|
// 1
|
||||||
|
data <<= 1;
|
||||||
|
data |= 1;
|
||||||
|
mSerial->AdvanceToNextEdge(); // rising edge of second pulse of 1
|
||||||
|
mSerial->AdvanceToNextEdge(); // falling edge of second ṕulse of 1
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// 0
|
||||||
|
data <<= 1;
|
||||||
|
}
|
||||||
|
if( SamplesToNS( mSerial->GetSampleOfNextEdge() - SoB ) < cycleTime * 2 )
|
||||||
|
{
|
||||||
|
mSerial->AdvanceToNextEdge(); // rising edge of next bit
|
||||||
|
SoB = mSerial->GetSampleNumber();
|
||||||
|
}
|
||||||
|
|
||||||
|
else if( SamplesToNS( mSerial->GetSampleOfNextEdge() - SoB ) < cycleTime * 5.5 ||
|
||||||
|
SamplesToNS( mSerial->GetSampleOfNextEdge() - SoB ) > cycleTime * 8 )
|
||||||
|
{
|
||||||
|
// EOS end of sequence
|
||||||
|
Frame frame;
|
||||||
|
frame.mData1 = data;
|
||||||
|
frame.mFlags = 0;
|
||||||
|
frame.mStartingSampleInclusive = starting_sample;
|
||||||
|
frame.mEndingSampleInclusive = mSerial->GetSampleNumber();
|
||||||
|
|
||||||
|
mResults->AddFrame( frame );
|
||||||
|
mResults->CommitResults();
|
||||||
|
ReportProgress( frame.mEndingSampleInclusive );
|
||||||
|
|
||||||
|
data = 0;
|
||||||
|
mSerial->AdvanceToNextEdge();
|
||||||
|
SoB = mSerial->GetSampleNumber();
|
||||||
|
starting_sample = SoB;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// if( mSerial->GetBitState() == BIT_LOW )
|
||||||
|
// mSerial->AdvanceToNextEdge();
|
||||||
|
|
||||||
|
// U32 samples_per_bit = mSampleRateHz / mSettings.mBitRate;
|
||||||
|
// U32 samples_to_first_center_of_first_data_bit = U32( 1.5 * double( mSampleRateHz ) / double( mSettings.mBitRate ) );
|
||||||
|
|
||||||
|
// bool firstRun = 1;
|
||||||
|
// U64 startEdge, starting_sample;
|
||||||
|
// U8 bits = 0;
|
||||||
|
|
||||||
|
// while( 1 )
|
||||||
|
// {
|
||||||
|
// if( firstRun )
|
||||||
|
// {
|
||||||
|
// startEdge = mSerial->GetSampleNumber();
|
||||||
|
// starting_sample = startEdge;
|
||||||
|
// mSerial->AdvanceToNextEdge(); // falling edge
|
||||||
|
// cycleTime = SamplesToNS( mSerial->GetSampleOfNextEdge() - startEdge );
|
||||||
|
// firstRun = false;
|
||||||
|
// bits = 1;
|
||||||
|
// }
|
||||||
|
// else
|
||||||
|
// {
|
||||||
|
// }
|
||||||
|
// U32 data = 0;
|
||||||
|
// U8 bits = 2;
|
||||||
|
// mSerial->AdvanceToNextEdge(); // rising edge
|
||||||
|
// startEdge = mSerial->GetSampleNumber();
|
||||||
|
// mSerial->AdvanceToNextEdge(); // falling edge // second zero
|
||||||
|
|
||||||
|
// while( 1 )
|
||||||
|
// {
|
||||||
|
// if( SamplesToNS( mSerial->GetSampleOfNextEdge() - startEdge ) < cycleTime / 2 )
|
||||||
|
// {
|
||||||
|
// // one
|
||||||
|
// data <<= 1;
|
||||||
|
// data |= 1;
|
||||||
|
// bits += 1;
|
||||||
|
// mResults->AddMarker( startEdge, AnalyzerResults::One, mSettings.mInputChannel );
|
||||||
|
// }
|
||||||
|
// else if( SamplesToNS( mSerial->GetSampleOfNextEdge() - startEdge ) < cycleTime * 2 )
|
||||||
|
// {
|
||||||
|
// // zero
|
||||||
|
// data <<= 1;
|
||||||
|
// bits += 1;
|
||||||
|
// mResults->AddMarker( startEdge, AnalyzerResults::Zero, mSettings.mInputChannel );
|
||||||
|
// }
|
||||||
|
// else if( SamplesToNS( mSerial->GetSampleOfNextEdge() - startEdge ) < cycleTime * 5.5 )
|
||||||
|
// {
|
||||||
|
// }
|
||||||
|
// else if( SamplesToNS( mSerial->GetSampleOfNextEdge() - startEdge ) > cycleTime * 8 )
|
||||||
|
// {
|
||||||
|
// // cleanup
|
||||||
|
// }
|
||||||
|
|
||||||
|
// if( bits == 32 )
|
||||||
|
// {
|
||||||
|
// break;
|
||||||
|
// }
|
||||||
|
// else
|
||||||
|
// {
|
||||||
|
// mSerial->AdvanceToNextEdge(); // rising edge
|
||||||
|
// startEdge = mSerial->GetSampleOfNextEdge();
|
||||||
|
// mSerial->AdvanceToNextEdge(); // falling edge
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// Frame frame;
|
||||||
|
// frame.mData1 = data;
|
||||||
|
// frame.mFlags = 0;
|
||||||
|
// frame.mStartingSampleInclusive = starting_sample;
|
||||||
|
// frame.mEndingSampleInclusive = mSerial->GetSampleNumber();
|
||||||
|
|
||||||
|
// mResults->AddFrame( frame );
|
||||||
|
// mResults->CommitResults();
|
||||||
|
// ReportProgress( frame.mEndingSampleInclusive );
|
||||||
|
// }
|
||||||
|
|
||||||
|
// for( ;; )
|
||||||
|
// {
|
||||||
|
// U8 data = 0;
|
||||||
|
// U8 mask = 1 << 7;
|
||||||
|
|
||||||
|
// mSerial->AdvanceToNextEdge(); // falling edge -- beginning of the start bit
|
||||||
|
|
||||||
|
// U64 starting_sample = mSerial->GetSampleNumber();
|
||||||
|
|
||||||
|
// // mSerial->Advance( samples_to_first_center_of_first_data_bit );
|
||||||
|
|
||||||
|
// for( U32 i = 0; i < 8; i++ )
|
||||||
|
// {
|
||||||
|
// // let's put a dot exactly where we sample this bit:
|
||||||
|
// mResults->AddMarker( mSerial->GetSampleNumber(), AnalyzerResults::Dot, mSettings.mInputChannel );
|
||||||
|
|
||||||
|
// if( mSerial->GetBitState() == BIT_HIGH )
|
||||||
|
// data |= mask;
|
||||||
|
|
||||||
|
// // mSerial->Advance( samples_per_bit );
|
||||||
|
|
||||||
|
// mask = mask >> 1;
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
// // we have a byte to save.
|
||||||
|
// Frame frame;
|
||||||
|
// frame.mData1 = data;
|
||||||
|
// frame.mFlags = 0;
|
||||||
|
// frame.mStartingSampleInclusive = starting_sample;
|
||||||
|
// frame.mEndingSampleInclusive = mSerial->GetSampleNumber();
|
||||||
|
|
||||||
|
// mResults->AddFrame( frame );
|
||||||
|
// mResults->CommitResults();
|
||||||
|
// ReportProgress( frame.mEndingSampleInclusive );
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
|
||||||
|
bool TLC59731Analyzer::NeedsRerun()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
U32 TLC59731Analyzer::GenerateSimulationData( U64 minimum_sample_index, U32 device_sample_rate,
|
||||||
|
SimulationChannelDescriptor** simulation_channels )
|
||||||
|
{
|
||||||
|
if( mSimulationInitilized == false )
|
||||||
|
{
|
||||||
|
mSimulationDataGenerator.Initialize( GetSimulationSampleRate(), &mSettings );
|
||||||
|
mSimulationInitilized = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return mSimulationDataGenerator.GenerateSimulationData( minimum_sample_index, device_sample_rate, simulation_channels );
|
||||||
|
}
|
||||||
|
|
||||||
|
U32 TLC59731Analyzer::GetMinimumSampleRateHz()
|
||||||
|
{
|
||||||
|
return mSettings.mBitRate * 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
const char* TLC59731Analyzer::GetAnalyzerName() const
|
||||||
|
{
|
||||||
|
return "Simple Serial";
|
||||||
|
}
|
||||||
|
|
||||||
|
const char* GetAnalyzerName()
|
||||||
|
{
|
||||||
|
return "Simple Serial";
|
||||||
|
}
|
||||||
|
|
||||||
|
Analyzer* CreateAnalyzer()
|
||||||
|
{
|
||||||
|
return new TLC59731Analyzer();
|
||||||
|
}
|
||||||
|
|
||||||
|
void DestroyAnalyzer( Analyzer* analyzer )
|
||||||
|
{
|
||||||
|
delete analyzer;
|
||||||
|
}
|
||||||
@@ -1,17 +1,22 @@
|
|||||||
#ifndef SIMPLESERIAL_ANALYZER_H
|
#ifndef TLC59731_ANALYZER_H
|
||||||
#define SIMPLESERIAL_ANALYZER_H
|
#define TLC59731_ANALYZER_H
|
||||||
|
|
||||||
#include <Analyzer.h>
|
#include <Analyzer.h>
|
||||||
#include "SimpleSerialAnalyzerSettings.h"
|
#include "TLC59731AnalyzerSettings.h"
|
||||||
#include "SimpleSerialAnalyzerResults.h"
|
#include "TLC59731AnalyzerResults.h"
|
||||||
#include "SimpleSerialSimulationDataGenerator.h"
|
#include "TLC59731SimulationDataGenerator.h"
|
||||||
|
#include <LogicPublicTypes.h>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
class ANALYZER_EXPORT SimpleSerialAnalyzer : public Analyzer2
|
|
||||||
|
#define TLL_MIN 500000
|
||||||
|
#define MAX_CYCLETIME 50000 // in ns
|
||||||
|
|
||||||
|
class ANALYZER_EXPORT TLC59731Analyzer : public Analyzer2
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
SimpleSerialAnalyzer();
|
TLC59731Analyzer();
|
||||||
virtual ~SimpleSerialAnalyzer();
|
virtual ~TLC59731Analyzer();
|
||||||
|
|
||||||
virtual void SetupResults();
|
virtual void SetupResults();
|
||||||
virtual void WorkerThread();
|
virtual void WorkerThread();
|
||||||
@@ -21,23 +26,26 @@ public:
|
|||||||
|
|
||||||
virtual const char* GetAnalyzerName() const;
|
virtual const char* GetAnalyzerName() const;
|
||||||
virtual bool NeedsRerun();
|
virtual bool NeedsRerun();
|
||||||
|
U64 SamplesToNS(U64 samples) { return (samples * 1000000000) / mSampleRateHz; }
|
||||||
|
|
||||||
protected: //vars
|
protected: //vars
|
||||||
SimpleSerialAnalyzerSettings mSettings;
|
TLC59731AnalyzerSettings mSettings;
|
||||||
std::unique_ptr<SimpleSerialAnalyzerResults> mResults;
|
std::unique_ptr<TLC59731AnalyzerResults> mResults;
|
||||||
AnalyzerChannelData* mSerial;
|
AnalyzerChannelData* mSerial;
|
||||||
|
|
||||||
SimpleSerialSimulationDataGenerator mSimulationDataGenerator;
|
TLC59731SimulationDataGenerator mSimulationDataGenerator;
|
||||||
bool mSimulationInitilized;
|
bool mSimulationInitilized;
|
||||||
|
|
||||||
//Serial analysis vars:
|
//Serial analysis vars:
|
||||||
U32 mSampleRateHz;
|
U32 mSampleRateHz;
|
||||||
|
U64 cycleTime;
|
||||||
U32 mStartOfStopBitOffset;
|
U32 mStartOfStopBitOffset;
|
||||||
U32 mEndOfStopBitOffset;
|
U32 mEndOfStopBitOffset;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
extern "C" ANALYZER_EXPORT const char* __cdecl GetAnalyzerName();
|
extern "C" ANALYZER_EXPORT const char* __cdecl GetAnalyzerName();
|
||||||
extern "C" ANALYZER_EXPORT Analyzer* __cdecl CreateAnalyzer( );
|
extern "C" ANALYZER_EXPORT Analyzer* __cdecl CreateAnalyzer( );
|
||||||
extern "C" ANALYZER_EXPORT void __cdecl DestroyAnalyzer( Analyzer* analyzer );
|
extern "C" ANALYZER_EXPORT void __cdecl DestroyAnalyzer( Analyzer* analyzer );
|
||||||
|
|
||||||
#endif //SIMPLESERIAL_ANALYZER_H
|
#endif //TLC59731_ANALYZER_H
|
||||||
@@ -1,32 +1,32 @@
|
|||||||
#include "SimpleSerialAnalyzerResults.h"
|
#include "TLC59731AnalyzerResults.h"
|
||||||
#include <AnalyzerHelpers.h>
|
#include <AnalyzerHelpers.h>
|
||||||
#include "SimpleSerialAnalyzer.h"
|
#include "TLC59731Analyzer.h"
|
||||||
#include "SimpleSerialAnalyzerSettings.h"
|
#include "TLC59731AnalyzerSettings.h"
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
|
|
||||||
SimpleSerialAnalyzerResults::SimpleSerialAnalyzerResults( SimpleSerialAnalyzer* analyzer, SimpleSerialAnalyzerSettings* settings )
|
TLC59731AnalyzerResults::TLC59731AnalyzerResults( TLC59731Analyzer* analyzer, TLC59731AnalyzerSettings* settings )
|
||||||
: AnalyzerResults(),
|
: AnalyzerResults(),
|
||||||
mSettings( settings ),
|
mSettings( settings ),
|
||||||
mAnalyzer( analyzer )
|
mAnalyzer( analyzer )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
SimpleSerialAnalyzerResults::~SimpleSerialAnalyzerResults()
|
TLC59731AnalyzerResults::~TLC59731AnalyzerResults()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void SimpleSerialAnalyzerResults::GenerateBubbleText( U64 frame_index, Channel& channel, DisplayBase display_base )
|
void TLC59731AnalyzerResults::GenerateBubbleText( U64 frame_index, Channel& channel, DisplayBase display_base )
|
||||||
{
|
{
|
||||||
ClearResultStrings();
|
ClearResultStrings();
|
||||||
Frame frame = GetFrame( frame_index );
|
Frame frame = GetFrame( frame_index );
|
||||||
|
|
||||||
char number_str[128];
|
char number_str[128];
|
||||||
AnalyzerHelpers::GetNumberString( frame.mData1, display_base, 8, number_str, 128 );
|
AnalyzerHelpers::GetNumberString( frame.mData1, display_base, 32, number_str, 128 );
|
||||||
AddResultString( number_str );
|
AddResultString( number_str );
|
||||||
}
|
}
|
||||||
|
|
||||||
void SimpleSerialAnalyzerResults::GenerateExportFile( const char* file, DisplayBase display_base, U32 export_type_user_id )
|
void TLC59731AnalyzerResults::GenerateExportFile( const char* file, DisplayBase display_base, U32 export_type_user_id )
|
||||||
{
|
{
|
||||||
std::ofstream file_stream( file, std::ios::out );
|
std::ofstream file_stream( file, std::ios::out );
|
||||||
|
|
||||||
@@ -58,7 +58,7 @@ void SimpleSerialAnalyzerResults::GenerateExportFile( const char* file, DisplayB
|
|||||||
file_stream.close();
|
file_stream.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SimpleSerialAnalyzerResults::GenerateFrameTabularText( U64 frame_index, DisplayBase display_base )
|
void TLC59731AnalyzerResults::GenerateFrameTabularText( U64 frame_index, DisplayBase display_base )
|
||||||
{
|
{
|
||||||
#ifdef SUPPORTS_PROTOCOL_SEARCH
|
#ifdef SUPPORTS_PROTOCOL_SEARCH
|
||||||
Frame frame = GetFrame( frame_index );
|
Frame frame = GetFrame( frame_index );
|
||||||
@@ -70,13 +70,13 @@ void SimpleSerialAnalyzerResults::GenerateFrameTabularText( U64 frame_index, Dis
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void SimpleSerialAnalyzerResults::GeneratePacketTabularText( U64 packet_id, DisplayBase display_base )
|
void TLC59731AnalyzerResults::GeneratePacketTabularText( U64 packet_id, DisplayBase display_base )
|
||||||
{
|
{
|
||||||
//not supported
|
//not supported
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SimpleSerialAnalyzerResults::GenerateTransactionTabularText( U64 transaction_id, DisplayBase display_base )
|
void TLC59731AnalyzerResults::GenerateTransactionTabularText( U64 transaction_id, DisplayBase display_base )
|
||||||
{
|
{
|
||||||
//not supported
|
//not supported
|
||||||
}
|
}
|
||||||
@@ -3,14 +3,14 @@
|
|||||||
|
|
||||||
#include <AnalyzerResults.h>
|
#include <AnalyzerResults.h>
|
||||||
|
|
||||||
class SimpleSerialAnalyzer;
|
class TLC59731Analyzer;
|
||||||
class SimpleSerialAnalyzerSettings;
|
class TLC59731AnalyzerSettings;
|
||||||
|
|
||||||
class SimpleSerialAnalyzerResults : public AnalyzerResults
|
class TLC59731AnalyzerResults : public AnalyzerResults
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
SimpleSerialAnalyzerResults( SimpleSerialAnalyzer* analyzer, SimpleSerialAnalyzerSettings* settings );
|
TLC59731AnalyzerResults( TLC59731Analyzer* analyzer, TLC59731AnalyzerSettings* settings );
|
||||||
virtual ~SimpleSerialAnalyzerResults();
|
virtual ~TLC59731AnalyzerResults();
|
||||||
|
|
||||||
virtual void GenerateBubbleText( U64 frame_index, Channel& channel, DisplayBase display_base );
|
virtual void GenerateBubbleText( U64 frame_index, Channel& channel, DisplayBase display_base );
|
||||||
virtual void GenerateExportFile( const char* file, DisplayBase display_base, U32 export_type_user_id );
|
virtual void GenerateExportFile( const char* file, DisplayBase display_base, U32 export_type_user_id );
|
||||||
@@ -22,8 +22,8 @@ public:
|
|||||||
protected: //functions
|
protected: //functions
|
||||||
|
|
||||||
protected: //vars
|
protected: //vars
|
||||||
SimpleSerialAnalyzerSettings* mSettings;
|
TLC59731AnalyzerSettings* mSettings;
|
||||||
SimpleSerialAnalyzer* mAnalyzer;
|
TLC59731Analyzer* mAnalyzer;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif //SIMPLESERIAL_ANALYZER_RESULTS
|
#endif //SIMPLESERIAL_ANALYZER_RESULTS
|
||||||
@@ -1,10 +1,10 @@
|
|||||||
#include "SimpleSerialAnalyzerSettings.h"
|
#include "TLC59731AnalyzerSettings.h"
|
||||||
#include <AnalyzerHelpers.h>
|
#include <AnalyzerHelpers.h>
|
||||||
|
|
||||||
|
|
||||||
SimpleSerialAnalyzerSettings::SimpleSerialAnalyzerSettings()
|
TLC59731AnalyzerSettings::TLC59731AnalyzerSettings()
|
||||||
: mInputChannel( UNDEFINED_CHANNEL ),
|
: mInputChannel( UNDEFINED_CHANNEL ),
|
||||||
mBitRate( 9600 ),
|
// mBitRate( 9600 ),
|
||||||
mInputChannelInterface(),
|
mInputChannelInterface(),
|
||||||
mBitRateInterface()
|
mBitRateInterface()
|
||||||
{
|
{
|
||||||
@@ -27,11 +27,11 @@ SimpleSerialAnalyzerSettings::SimpleSerialAnalyzerSettings()
|
|||||||
AddChannel( mInputChannel, "Serial", false );
|
AddChannel( mInputChannel, "Serial", false );
|
||||||
}
|
}
|
||||||
|
|
||||||
SimpleSerialAnalyzerSettings::~SimpleSerialAnalyzerSettings()
|
TLC59731AnalyzerSettings::~TLC59731AnalyzerSettings()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SimpleSerialAnalyzerSettings::SetSettingsFromInterfaces()
|
bool TLC59731AnalyzerSettings::SetSettingsFromInterfaces()
|
||||||
{
|
{
|
||||||
mInputChannel = mInputChannelInterface.GetChannel();
|
mInputChannel = mInputChannelInterface.GetChannel();
|
||||||
mBitRate = mBitRateInterface.GetInteger();
|
mBitRate = mBitRateInterface.GetInteger();
|
||||||
@@ -42,13 +42,13 @@ bool SimpleSerialAnalyzerSettings::SetSettingsFromInterfaces()
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SimpleSerialAnalyzerSettings::UpdateInterfacesFromSettings()
|
void TLC59731AnalyzerSettings::UpdateInterfacesFromSettings()
|
||||||
{
|
{
|
||||||
mInputChannelInterface.SetChannel( mInputChannel );
|
mInputChannelInterface.SetChannel( mInputChannel );
|
||||||
mBitRateInterface.SetInteger( mBitRate );
|
mBitRateInterface.SetInteger( mBitRate );
|
||||||
}
|
}
|
||||||
|
|
||||||
void SimpleSerialAnalyzerSettings::LoadSettings( const char* settings )
|
void TLC59731AnalyzerSettings::LoadSettings( const char* settings )
|
||||||
{
|
{
|
||||||
SimpleArchive text_archive;
|
SimpleArchive text_archive;
|
||||||
text_archive.SetString( settings );
|
text_archive.SetString( settings );
|
||||||
@@ -62,7 +62,7 @@ void SimpleSerialAnalyzerSettings::LoadSettings( const char* settings )
|
|||||||
UpdateInterfacesFromSettings();
|
UpdateInterfacesFromSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* SimpleSerialAnalyzerSettings::SaveSettings()
|
const char* TLC59731AnalyzerSettings::SaveSettings()
|
||||||
{
|
{
|
||||||
SimpleArchive text_archive;
|
SimpleArchive text_archive;
|
||||||
|
|
||||||
@@ -4,11 +4,11 @@
|
|||||||
#include <AnalyzerSettings.h>
|
#include <AnalyzerSettings.h>
|
||||||
#include <AnalyzerTypes.h>
|
#include <AnalyzerTypes.h>
|
||||||
|
|
||||||
class SimpleSerialAnalyzerSettings : public AnalyzerSettings
|
class TLC59731AnalyzerSettings : public AnalyzerSettings
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
SimpleSerialAnalyzerSettings();
|
TLC59731AnalyzerSettings();
|
||||||
virtual ~SimpleSerialAnalyzerSettings();
|
virtual ~TLC59731AnalyzerSettings();
|
||||||
|
|
||||||
virtual bool SetSettingsFromInterfaces();
|
virtual bool SetSettingsFromInterfaces();
|
||||||
void UpdateInterfacesFromSettings();
|
void UpdateInterfacesFromSettings();
|
||||||
@@ -1,19 +1,19 @@
|
|||||||
#include "SimpleSerialSimulationDataGenerator.h"
|
#include "TLC59731SimulationDataGenerator.h"
|
||||||
#include "SimpleSerialAnalyzerSettings.h"
|
#include "TLC59731AnalyzerSettings.h"
|
||||||
|
|
||||||
#include <AnalyzerHelpers.h>
|
#include <AnalyzerHelpers.h>
|
||||||
|
|
||||||
SimpleSerialSimulationDataGenerator::SimpleSerialSimulationDataGenerator()
|
TLC59731SimulationDataGenerator::TLC59731SimulationDataGenerator()
|
||||||
: mSerialText( "My first analyzer, woo hoo!" ),
|
: mSerialText( "My first analyzer, woo hoo!" ),
|
||||||
mStringIndex( 0 )
|
mStringIndex( 0 )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
SimpleSerialSimulationDataGenerator::~SimpleSerialSimulationDataGenerator()
|
TLC59731SimulationDataGenerator::~TLC59731SimulationDataGenerator()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void SimpleSerialSimulationDataGenerator::Initialize( U32 simulation_sample_rate, SimpleSerialAnalyzerSettings* settings )
|
void TLC59731SimulationDataGenerator::Initialize( U32 simulation_sample_rate, TLC59731AnalyzerSettings* settings )
|
||||||
{
|
{
|
||||||
mSimulationSampleRateHz = simulation_sample_rate;
|
mSimulationSampleRateHz = simulation_sample_rate;
|
||||||
mSettings = settings;
|
mSettings = settings;
|
||||||
@@ -23,7 +23,7 @@ void SimpleSerialSimulationDataGenerator::Initialize( U32 simulation_sample_rate
|
|||||||
mSerialSimulationData.SetInitialBitState( BIT_HIGH );
|
mSerialSimulationData.SetInitialBitState( BIT_HIGH );
|
||||||
}
|
}
|
||||||
|
|
||||||
U32 SimpleSerialSimulationDataGenerator::GenerateSimulationData( U64 largest_sample_requested, U32 sample_rate, SimulationChannelDescriptor** simulation_channel )
|
U32 TLC59731SimulationDataGenerator::GenerateSimulationData( U64 largest_sample_requested, U32 sample_rate, SimulationChannelDescriptor** simulation_channel )
|
||||||
{
|
{
|
||||||
U64 adjusted_largest_sample_requested = AnalyzerHelpers::AdjustSimulationTargetSample( largest_sample_requested, sample_rate, mSimulationSampleRateHz );
|
U64 adjusted_largest_sample_requested = AnalyzerHelpers::AdjustSimulationTargetSample( largest_sample_requested, sample_rate, mSimulationSampleRateHz );
|
||||||
|
|
||||||
@@ -36,7 +36,7 @@ U32 SimpleSerialSimulationDataGenerator::GenerateSimulationData( U64 largest_sam
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SimpleSerialSimulationDataGenerator::CreateSerialByte()
|
void TLC59731SimulationDataGenerator::CreateSerialByte()
|
||||||
{
|
{
|
||||||
U32 samples_per_bit = mSimulationSampleRateHz / mSettings->mBitRate;
|
U32 samples_per_bit = mSimulationSampleRateHz / mSettings->mBitRate;
|
||||||
|
|
||||||
29
src/TLC59731SimulationDataGenerator.h
Normal file
29
src/TLC59731SimulationDataGenerator.h
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
#ifndef TLC59731_SIMULATION_DATA_GENERATOR
|
||||||
|
#define TLC59731_SIMULATION_DATA_GENERATOR
|
||||||
|
|
||||||
|
#include <SimulationChannelDescriptor.h>
|
||||||
|
#include <string>
|
||||||
|
class TLC59731AnalyzerSettings;
|
||||||
|
|
||||||
|
class TLC59731SimulationDataGenerator
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
TLC59731SimulationDataGenerator();
|
||||||
|
~TLC59731SimulationDataGenerator();
|
||||||
|
|
||||||
|
void Initialize( U32 simulation_sample_rate, TLC59731AnalyzerSettings* settings );
|
||||||
|
U32 GenerateSimulationData( U64 newest_sample_requested, U32 sample_rate, SimulationChannelDescriptor** simulation_channel );
|
||||||
|
|
||||||
|
protected:
|
||||||
|
TLC59731AnalyzerSettings* mSettings;
|
||||||
|
U32 mSimulationSampleRateHz;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
void CreateSerialByte();
|
||||||
|
std::string mSerialText;
|
||||||
|
U32 mStringIndex;
|
||||||
|
|
||||||
|
SimulationChannelDescriptor mSerialSimulationData;
|
||||||
|
|
||||||
|
};
|
||||||
|
#endif //TLC59731_SIMULATION_DATA_GENERATOR
|
||||||
Reference in New Issue
Block a user