diff --git a/.gitignore b/.gitignore index 7981c18..0c514e2 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,4 @@ /build .DS_Store + +.cache/ \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index ef4a440..c99c938 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required (VERSION 3.13) -project(SimpleSerialAnalyzer) +project(TLC59731Analyzer) add_definitions( -DLOGIC2 ) @@ -13,14 +13,14 @@ set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake) include(ExternalAnalyzerSDK) set(SOURCES -src/SimpleSerialAnalyzer.cpp -src/SimpleSerialAnalyzer.h -src/SimpleSerialAnalyzerResults.cpp -src/SimpleSerialAnalyzerResults.h -src/SimpleSerialAnalyzerSettings.cpp -src/SimpleSerialAnalyzerSettings.h -src/SimpleSerialSimulationDataGenerator.cpp -src/SimpleSerialSimulationDataGenerator.h +src/TLC59731Analyzer.cpp +src/TLC59731Analyzer.h +src/TLC59731AnalyzerResults.cpp +src/TLC59731AnalyzerResults.h +src/TLC59731AnalyzerSettings.cpp +src/TLC59731AnalyzerSettings.h +src/TLC59731SimulationDataGenerator.cpp +src/TLC59731SimulationDataGenerator.h ) add_analyzer_plugin(${PROJECT_NAME} SOURCES ${SOURCES}) diff --git a/src/SimpleSerialAnalyzer.cpp b/src/SimpleSerialAnalyzer.cpp deleted file mode 100644 index ef44917..0000000 --- a/src/SimpleSerialAnalyzer.cpp +++ /dev/null @@ -1,115 +0,0 @@ -#include "SimpleSerialAnalyzer.h" -#include "SimpleSerialAnalyzerSettings.h" -#include - -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; -} \ No newline at end of file diff --git a/src/SimpleSerialSimulationDataGenerator.h b/src/SimpleSerialSimulationDataGenerator.h deleted file mode 100644 index c5dc2e9..0000000 --- a/src/SimpleSerialSimulationDataGenerator.h +++ /dev/null @@ -1,29 +0,0 @@ -#ifndef SIMPLESERIAL_SIMULATION_DATA_GENERATOR -#define SIMPLESERIAL_SIMULATION_DATA_GENERATOR - -#include -#include -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 \ No newline at end of file diff --git a/src/TLC59731Analyzer.cpp b/src/TLC59731Analyzer.cpp new file mode 100644 index 0000000..021226b --- /dev/null +++ b/src/TLC59731Analyzer.cpp @@ -0,0 +1,252 @@ +#include "TLC59731Analyzer.h" +#include "TLC59731AnalyzerSettings.h" +#include +#include + +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; +} \ No newline at end of file diff --git a/src/SimpleSerialAnalyzer.h b/src/TLC59731Analyzer.h similarity index 53% rename from src/SimpleSerialAnalyzer.h rename to src/TLC59731Analyzer.h index 15ee87d..17ef489 100644 --- a/src/SimpleSerialAnalyzer.h +++ b/src/TLC59731Analyzer.h @@ -1,17 +1,22 @@ -#ifndef SIMPLESERIAL_ANALYZER_H -#define SIMPLESERIAL_ANALYZER_H +#ifndef TLC59731_ANALYZER_H +#define TLC59731_ANALYZER_H #include -#include "SimpleSerialAnalyzerSettings.h" -#include "SimpleSerialAnalyzerResults.h" -#include "SimpleSerialSimulationDataGenerator.h" +#include "TLC59731AnalyzerSettings.h" +#include "TLC59731AnalyzerResults.h" +#include "TLC59731SimulationDataGenerator.h" +#include #include -class ANALYZER_EXPORT SimpleSerialAnalyzer : public Analyzer2 + +#define TLL_MIN 500000 +#define MAX_CYCLETIME 50000 // in ns + +class ANALYZER_EXPORT TLC59731Analyzer : public Analyzer2 { public: - SimpleSerialAnalyzer(); - virtual ~SimpleSerialAnalyzer(); + TLC59731Analyzer(); + virtual ~TLC59731Analyzer(); virtual void SetupResults(); virtual void WorkerThread(); @@ -21,23 +26,26 @@ public: virtual const char* GetAnalyzerName() const; virtual bool NeedsRerun(); + U64 SamplesToNS(U64 samples) { return (samples * 1000000000) / mSampleRateHz; } protected: //vars - SimpleSerialAnalyzerSettings mSettings; - std::unique_ptr mResults; + TLC59731AnalyzerSettings mSettings; + std::unique_ptr mResults; AnalyzerChannelData* mSerial; - SimpleSerialSimulationDataGenerator mSimulationDataGenerator; + TLC59731SimulationDataGenerator mSimulationDataGenerator; bool mSimulationInitilized; //Serial analysis vars: U32 mSampleRateHz; + U64 cycleTime; U32 mStartOfStopBitOffset; U32 mEndOfStopBitOffset; + }; extern "C" ANALYZER_EXPORT const char* __cdecl GetAnalyzerName(); extern "C" ANALYZER_EXPORT Analyzer* __cdecl CreateAnalyzer( ); extern "C" ANALYZER_EXPORT void __cdecl DestroyAnalyzer( Analyzer* analyzer ); -#endif //SIMPLESERIAL_ANALYZER_H +#endif //TLC59731_ANALYZER_H diff --git a/src/SimpleSerialAnalyzerResults.cpp b/src/TLC59731AnalyzerResults.cpp similarity index 58% rename from src/SimpleSerialAnalyzerResults.cpp rename to src/TLC59731AnalyzerResults.cpp index 4e81695..0b0f9ae 100644 --- a/src/SimpleSerialAnalyzerResults.cpp +++ b/src/TLC59731AnalyzerResults.cpp @@ -1,32 +1,32 @@ -#include "SimpleSerialAnalyzerResults.h" +#include "TLC59731AnalyzerResults.h" #include -#include "SimpleSerialAnalyzer.h" -#include "SimpleSerialAnalyzerSettings.h" +#include "TLC59731Analyzer.h" +#include "TLC59731AnalyzerSettings.h" #include #include -SimpleSerialAnalyzerResults::SimpleSerialAnalyzerResults( SimpleSerialAnalyzer* analyzer, SimpleSerialAnalyzerSettings* settings ) +TLC59731AnalyzerResults::TLC59731AnalyzerResults( TLC59731Analyzer* analyzer, TLC59731AnalyzerSettings* settings ) : AnalyzerResults(), mSettings( settings ), 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(); Frame frame = GetFrame( frame_index ); 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 ); } -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 ); @@ -58,7 +58,7 @@ void SimpleSerialAnalyzerResults::GenerateExportFile( const char* file, DisplayB 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 Frame frame = GetFrame( frame_index ); @@ -70,13 +70,13 @@ void SimpleSerialAnalyzerResults::GenerateFrameTabularText( U64 frame_index, Dis #endif } -void SimpleSerialAnalyzerResults::GeneratePacketTabularText( U64 packet_id, DisplayBase display_base ) +void TLC59731AnalyzerResults::GeneratePacketTabularText( U64 packet_id, DisplayBase display_base ) { //not supported } -void SimpleSerialAnalyzerResults::GenerateTransactionTabularText( U64 transaction_id, DisplayBase display_base ) +void TLC59731AnalyzerResults::GenerateTransactionTabularText( U64 transaction_id, DisplayBase display_base ) { //not supported } \ No newline at end of file diff --git a/src/SimpleSerialAnalyzerResults.h b/src/TLC59731AnalyzerResults.h similarity index 66% rename from src/SimpleSerialAnalyzerResults.h rename to src/TLC59731AnalyzerResults.h index dfdd212..c1213df 100644 --- a/src/SimpleSerialAnalyzerResults.h +++ b/src/TLC59731AnalyzerResults.h @@ -3,14 +3,14 @@ #include -class SimpleSerialAnalyzer; -class SimpleSerialAnalyzerSettings; +class TLC59731Analyzer; +class TLC59731AnalyzerSettings; -class SimpleSerialAnalyzerResults : public AnalyzerResults +class TLC59731AnalyzerResults : public AnalyzerResults { public: - SimpleSerialAnalyzerResults( SimpleSerialAnalyzer* analyzer, SimpleSerialAnalyzerSettings* settings ); - virtual ~SimpleSerialAnalyzerResults(); + TLC59731AnalyzerResults( TLC59731Analyzer* analyzer, TLC59731AnalyzerSettings* settings ); + virtual ~TLC59731AnalyzerResults(); 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 ); @@ -22,8 +22,8 @@ public: protected: //functions protected: //vars - SimpleSerialAnalyzerSettings* mSettings; - SimpleSerialAnalyzer* mAnalyzer; + TLC59731AnalyzerSettings* mSettings; + TLC59731Analyzer* mAnalyzer; }; #endif //SIMPLESERIAL_ANALYZER_RESULTS diff --git a/src/SimpleSerialAnalyzerSettings.cpp b/src/TLC59731AnalyzerSettings.cpp similarity index 76% rename from src/SimpleSerialAnalyzerSettings.cpp rename to src/TLC59731AnalyzerSettings.cpp index 372738f..e528937 100644 --- a/src/SimpleSerialAnalyzerSettings.cpp +++ b/src/TLC59731AnalyzerSettings.cpp @@ -1,10 +1,10 @@ -#include "SimpleSerialAnalyzerSettings.h" +#include "TLC59731AnalyzerSettings.h" #include -SimpleSerialAnalyzerSettings::SimpleSerialAnalyzerSettings() +TLC59731AnalyzerSettings::TLC59731AnalyzerSettings() : mInputChannel( UNDEFINED_CHANNEL ), - mBitRate( 9600 ), + // mBitRate( 9600 ), mInputChannelInterface(), mBitRateInterface() { @@ -27,11 +27,11 @@ SimpleSerialAnalyzerSettings::SimpleSerialAnalyzerSettings() AddChannel( mInputChannel, "Serial", false ); } -SimpleSerialAnalyzerSettings::~SimpleSerialAnalyzerSettings() +TLC59731AnalyzerSettings::~TLC59731AnalyzerSettings() { } -bool SimpleSerialAnalyzerSettings::SetSettingsFromInterfaces() +bool TLC59731AnalyzerSettings::SetSettingsFromInterfaces() { mInputChannel = mInputChannelInterface.GetChannel(); mBitRate = mBitRateInterface.GetInteger(); @@ -42,13 +42,13 @@ bool SimpleSerialAnalyzerSettings::SetSettingsFromInterfaces() return true; } -void SimpleSerialAnalyzerSettings::UpdateInterfacesFromSettings() +void TLC59731AnalyzerSettings::UpdateInterfacesFromSettings() { mInputChannelInterface.SetChannel( mInputChannel ); mBitRateInterface.SetInteger( mBitRate ); } -void SimpleSerialAnalyzerSettings::LoadSettings( const char* settings ) +void TLC59731AnalyzerSettings::LoadSettings( const char* settings ) { SimpleArchive text_archive; text_archive.SetString( settings ); @@ -62,7 +62,7 @@ void SimpleSerialAnalyzerSettings::LoadSettings( const char* settings ) UpdateInterfacesFromSettings(); } -const char* SimpleSerialAnalyzerSettings::SaveSettings() +const char* TLC59731AnalyzerSettings::SaveSettings() { SimpleArchive text_archive; diff --git a/src/SimpleSerialAnalyzerSettings.h b/src/TLC59731AnalyzerSettings.h similarity index 79% rename from src/SimpleSerialAnalyzerSettings.h rename to src/TLC59731AnalyzerSettings.h index 2ac432e..45ff6cd 100644 --- a/src/SimpleSerialAnalyzerSettings.h +++ b/src/TLC59731AnalyzerSettings.h @@ -4,11 +4,11 @@ #include #include -class SimpleSerialAnalyzerSettings : public AnalyzerSettings +class TLC59731AnalyzerSettings : public AnalyzerSettings { public: - SimpleSerialAnalyzerSettings(); - virtual ~SimpleSerialAnalyzerSettings(); + TLC59731AnalyzerSettings(); + virtual ~TLC59731AnalyzerSettings(); virtual bool SetSettingsFromInterfaces(); void UpdateInterfacesFromSettings(); diff --git a/src/SimpleSerialSimulationDataGenerator.cpp b/src/TLC59731SimulationDataGenerator.cpp similarity index 73% rename from src/SimpleSerialSimulationDataGenerator.cpp rename to src/TLC59731SimulationDataGenerator.cpp index d9bab05..f5da2a2 100644 --- a/src/SimpleSerialSimulationDataGenerator.cpp +++ b/src/TLC59731SimulationDataGenerator.cpp @@ -1,19 +1,19 @@ -#include "SimpleSerialSimulationDataGenerator.h" -#include "SimpleSerialAnalyzerSettings.h" +#include "TLC59731SimulationDataGenerator.h" +#include "TLC59731AnalyzerSettings.h" #include -SimpleSerialSimulationDataGenerator::SimpleSerialSimulationDataGenerator() +TLC59731SimulationDataGenerator::TLC59731SimulationDataGenerator() : mSerialText( "My first analyzer, woo hoo!" ), 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; mSettings = settings; @@ -23,7 +23,7 @@ void SimpleSerialSimulationDataGenerator::Initialize( U32 simulation_sample_rate 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 ); @@ -36,7 +36,7 @@ U32 SimpleSerialSimulationDataGenerator::GenerateSimulationData( U64 largest_sam return 1; } -void SimpleSerialSimulationDataGenerator::CreateSerialByte() +void TLC59731SimulationDataGenerator::CreateSerialByte() { U32 samples_per_bit = mSimulationSampleRateHz / mSettings->mBitRate; diff --git a/src/TLC59731SimulationDataGenerator.h b/src/TLC59731SimulationDataGenerator.h new file mode 100644 index 0000000..a8a5e23 --- /dev/null +++ b/src/TLC59731SimulationDataGenerator.h @@ -0,0 +1,29 @@ +#ifndef TLC59731_SIMULATION_DATA_GENERATOR +#define TLC59731_SIMULATION_DATA_GENERATOR + +#include +#include +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 \ No newline at end of file