From 2770b314a82f2e1149e732adf96ecb8dea1f84a6 Mon Sep 17 00:00:00 2001 From: Marcus10110 Date: Mon, 3 Oct 2016 14:08:53 -0700 Subject: [PATCH] added Simple Serial Analyzer source and VS project. --- .gitmodules | 3 + AnalyzerSDK | 1 + Visual Studio/SimpleSerialAnalyzer.sln | 28 +++ Visual Studio/SimpleSerialAnalyzer.vcxproj | 183 ++++++++++++++++++ source/SimpleSerialAnalyzer.cpp | 111 +++++++++++ source/SimpleSerialAnalyzer.h | 40 ++++ source/SimpleSerialAnalyzerResults.cpp | 81 ++++++++ source/SimpleSerialAnalyzerResults.h | 29 +++ source/SimpleSerialAnalyzerSettings.cpp | 73 +++++++ source/SimpleSerialAnalyzerSettings.h | 27 +++ .../SimpleSerialSimulationDataGenerator.cpp | 71 +++++++ source/SimpleSerialSimulationDataGenerator.h | 29 +++ 12 files changed, 676 insertions(+) create mode 100644 .gitmodules create mode 160000 AnalyzerSDK create mode 100644 Visual Studio/SimpleSerialAnalyzer.sln create mode 100644 Visual Studio/SimpleSerialAnalyzer.vcxproj create mode 100644 source/SimpleSerialAnalyzer.cpp create mode 100644 source/SimpleSerialAnalyzer.h create mode 100644 source/SimpleSerialAnalyzerResults.cpp create mode 100644 source/SimpleSerialAnalyzerResults.h create mode 100644 source/SimpleSerialAnalyzerSettings.cpp create mode 100644 source/SimpleSerialAnalyzerSettings.h create mode 100644 source/SimpleSerialSimulationDataGenerator.cpp create mode 100644 source/SimpleSerialSimulationDataGenerator.h diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..556b8fe --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "AnalyzerSDK"] + path = AnalyzerSDK + url = ../AnalyzerSDK.git diff --git a/AnalyzerSDK b/AnalyzerSDK new file mode 160000 index 0000000..31af8aa --- /dev/null +++ b/AnalyzerSDK @@ -0,0 +1 @@ +Subproject commit 31af8aa1576c397c9b95eee92b1b7bc49e04e18e diff --git a/Visual Studio/SimpleSerialAnalyzer.sln b/Visual Studio/SimpleSerialAnalyzer.sln new file mode 100644 index 0000000..fa20107 --- /dev/null +++ b/Visual Studio/SimpleSerialAnalyzer.sln @@ -0,0 +1,28 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 14 +VisualStudioVersion = 14.0.24720.0 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SimpleSerialAnalyzer", "SimpleSerialAnalyzer.vcxproj", "{D7556E7E-A6BF-4BCE-BDC8-E66D2874C301}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Debug|x64 = Debug|x64 + Release|Win32 = Release|Win32 + Release|x64 = Release|x64 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {D7556E7E-A6BF-4BCE-BDC8-E66D2874C301}.Debug|Win32.ActiveCfg = Debug|Win32 + {D7556E7E-A6BF-4BCE-BDC8-E66D2874C301}.Debug|Win32.Build.0 = Debug|Win32 + {D7556E7E-A6BF-4BCE-BDC8-E66D2874C301}.Debug|x64.ActiveCfg = Debug|x64 + {D7556E7E-A6BF-4BCE-BDC8-E66D2874C301}.Debug|x64.Build.0 = Debug|x64 + {D7556E7E-A6BF-4BCE-BDC8-E66D2874C301}.Release|Win32.ActiveCfg = Release|Win32 + {D7556E7E-A6BF-4BCE-BDC8-E66D2874C301}.Release|Win32.Build.0 = Release|Win32 + {D7556E7E-A6BF-4BCE-BDC8-E66D2874C301}.Release|x64.ActiveCfg = Release|x64 + {D7556E7E-A6BF-4BCE-BDC8-E66D2874C301}.Release|x64.Build.0 = Release|x64 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/Visual Studio/SimpleSerialAnalyzer.vcxproj b/Visual Studio/SimpleSerialAnalyzer.vcxproj new file mode 100644 index 0000000..b4a7119 --- /dev/null +++ b/Visual Studio/SimpleSerialAnalyzer.vcxproj @@ -0,0 +1,183 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + {D7556E7E-A6BF-4BCE-BDC8-E66D2874C301} + SimpleSerialAnalyzer + Win32Proj + 8.1 + + + + DynamicLibrary + v140 + Unicode + true + + + DynamicLibrary + v140 + Unicode + true + + + DynamicLibrary + v140 + Unicode + + + DynamicLibrary + v140 + Unicode + + + + + + + + + + + + + + + + + + + <_ProjectFileVersion>14.0.24720.0 + + + $(SolutionDir)$(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + true + + + true + + + $(SolutionDir)$(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + false + + + false + + + + Disabled + $(ProjectDir)..\AnalyzerSDK\include;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_WINDOWS;_USRDLL;SIMPLESERIALANALYZER_EXPORTS;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebug + + Level3 + EditAndContinue + + + Analyzer.lib;%(AdditionalDependencies) + $(ProjectDir)..\AnalyzerSDK\lib;%(AdditionalLibraryDirectories) + true + Windows + MachineX86 + + + + + Disabled + $(ProjectDir)..\AnalyzerSDK\include;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_WINDOWS;_USRDLL;SIMPLESERIALANALYZER_EXPORTS;%(PreprocessorDefinitions) + EnableFastChecks + MultiThreadedDebug + + + Level3 + ProgramDatabase + + + Analyzer64.lib;%(AdditionalDependencies) + $(ProjectDir)..\AnalyzerSDK\lib;%(AdditionalLibraryDirectories) + true + Windows + + + + + MaxSpeed + true + $(ProjectDir)..\AnalyzerSDK\include;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_WINDOWS;_USRDLL;SIMPLESERIALANALYZER_EXPORTS;%(PreprocessorDefinitions) + MultiThreaded + true + + Level3 + ProgramDatabase + + + Analyzer.lib;%(AdditionalDependencies) + $(ProjectDir)..\AnalyzerSDK\lib;%(AdditionalLibraryDirectories) + true + Windows + true + true + MachineX86 + + + + + MaxSpeed + true + $(ProjectDir)..\AnalyzerSDK\include;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_WINDOWS;_USRDLL;SIMPLESERIALANALYZER_EXPORTS;%(PreprocessorDefinitions) + MultiThreaded + true + + + Level3 + ProgramDatabase + + + Analyzer64.lib;%(AdditionalDependencies) + $(ProjectDir)..\AnalyzerSDK\lib;%(AdditionalLibraryDirectories) + true + Windows + true + true + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/source/SimpleSerialAnalyzer.cpp b/source/SimpleSerialAnalyzer.cpp new file mode 100644 index 0000000..81483a6 --- /dev/null +++ b/source/SimpleSerialAnalyzer.cpp @@ -0,0 +1,111 @@ +#include "SimpleSerialAnalyzer.h" +#include "SimpleSerialAnalyzerSettings.h" +#include + +SimpleSerialAnalyzer::SimpleSerialAnalyzer() +: Analyzer(), + mSettings( new SimpleSerialAnalyzerSettings() ), + mSimulationInitilized( false ) +{ + SetAnalyzerSettings( mSettings.get() ); +} + +SimpleSerialAnalyzer::~SimpleSerialAnalyzer() +{ + KillThread(); +} + +void SimpleSerialAnalyzer::WorkerThread() +{ + mResults.reset( new SimpleSerialAnalyzerResults( this, mSettings.get() ) ); + SetAnalyzerResults( mResults.get() ); + mResults->AddChannelBubblesWillAppearOn( mSettings->mInputChannel ); + + 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.get() ); + 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/source/SimpleSerialAnalyzer.h b/source/SimpleSerialAnalyzer.h new file mode 100644 index 0000000..a494321 --- /dev/null +++ b/source/SimpleSerialAnalyzer.h @@ -0,0 +1,40 @@ +#ifndef SIMPLESERIAL_ANALYZER_H +#define SIMPLESERIAL_ANALYZER_H + +#include +#include "SimpleSerialAnalyzerResults.h" +#include "SimpleSerialSimulationDataGenerator.h" + +class SimpleSerialAnalyzerSettings; +class ANALYZER_EXPORT SimpleSerialAnalyzer : public Analyzer +{ +public: + SimpleSerialAnalyzer(); + virtual ~SimpleSerialAnalyzer(); + virtual void WorkerThread(); + + virtual U32 GenerateSimulationData( U64 newest_sample_requested, U32 sample_rate, SimulationChannelDescriptor** simulation_channels ); + virtual U32 GetMinimumSampleRateHz(); + + virtual const char* GetAnalyzerName() const; + virtual bool NeedsRerun(); + +protected: //vars + std::auto_ptr< SimpleSerialAnalyzerSettings > mSettings; + std::auto_ptr< SimpleSerialAnalyzerResults > mResults; + AnalyzerChannelData* mSerial; + + SimpleSerialSimulationDataGenerator mSimulationDataGenerator; + bool mSimulationInitilized; + + //Serial analysis vars: + U32 mSampleRateHz; + 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 diff --git a/source/SimpleSerialAnalyzerResults.cpp b/source/SimpleSerialAnalyzerResults.cpp new file mode 100644 index 0000000..5c29d1d --- /dev/null +++ b/source/SimpleSerialAnalyzerResults.cpp @@ -0,0 +1,81 @@ +#include "SimpleSerialAnalyzerResults.h" +#include +#include "SimpleSerialAnalyzer.h" +#include "SimpleSerialAnalyzerSettings.h" +#include +#include + +SimpleSerialAnalyzerResults::SimpleSerialAnalyzerResults( SimpleSerialAnalyzer* analyzer, SimpleSerialAnalyzerSettings* settings ) +: AnalyzerResults(), + mSettings( settings ), + mAnalyzer( analyzer ) +{ +} + +SimpleSerialAnalyzerResults::~SimpleSerialAnalyzerResults() +{ +} + +void SimpleSerialAnalyzerResults::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 ); + AddResultString( number_str ); +} + +void SimpleSerialAnalyzerResults::GenerateExportFile( const char* file, DisplayBase display_base, U32 export_type_user_id ) +{ + std::ofstream file_stream( file, std::ios::out ); + + U64 trigger_sample = mAnalyzer->GetTriggerSample(); + U32 sample_rate = mAnalyzer->GetSampleRate(); + + file_stream << "Time [s],Value" << std::endl; + + U64 num_frames = GetNumFrames(); + for( U32 i=0; i < num_frames; i++ ) + { + Frame frame = GetFrame( i ); + + char time_str[128]; + AnalyzerHelpers::GetTimeString( frame.mStartingSampleInclusive, trigger_sample, sample_rate, time_str, 128 ); + + char number_str[128]; + AnalyzerHelpers::GetNumberString( frame.mData1, display_base, 8, number_str, 128 ); + + file_stream << time_str << "," << number_str << std::endl; + + if( UpdateExportProgressAndCheckForCancel( i, num_frames ) == true ) + { + file_stream.close(); + return; + } + } + + file_stream.close(); +} + +void SimpleSerialAnalyzerResults::GenerateFrameTabularText( U64 frame_index, DisplayBase display_base ) +{ + Frame frame = GetFrame( frame_index ); + ClearResultStrings(); + + char number_str[128]; + AnalyzerHelpers::GetNumberString( frame.mData1, display_base, 8, number_str, 128 ); + AddResultString( number_str ); +} + +void SimpleSerialAnalyzerResults::GeneratePacketTabularText( U64 packet_id, DisplayBase display_base ) +{ + ClearResultStrings(); + AddResultString( "not supported" ); +} + +void SimpleSerialAnalyzerResults::GenerateTransactionTabularText( U64 transaction_id, DisplayBase display_base ) +{ + ClearResultStrings(); + AddResultString( "not supported" ); +} \ No newline at end of file diff --git a/source/SimpleSerialAnalyzerResults.h b/source/SimpleSerialAnalyzerResults.h new file mode 100644 index 0000000..dfdd212 --- /dev/null +++ b/source/SimpleSerialAnalyzerResults.h @@ -0,0 +1,29 @@ +#ifndef SIMPLESERIAL_ANALYZER_RESULTS +#define SIMPLESERIAL_ANALYZER_RESULTS + +#include + +class SimpleSerialAnalyzer; +class SimpleSerialAnalyzerSettings; + +class SimpleSerialAnalyzerResults : public AnalyzerResults +{ +public: + SimpleSerialAnalyzerResults( SimpleSerialAnalyzer* analyzer, SimpleSerialAnalyzerSettings* settings ); + virtual ~SimpleSerialAnalyzerResults(); + + 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 GenerateFrameTabularText(U64 frame_index, DisplayBase display_base ); + virtual void GeneratePacketTabularText( U64 packet_id, DisplayBase display_base ); + virtual void GenerateTransactionTabularText( U64 transaction_id, DisplayBase display_base ); + +protected: //functions + +protected: //vars + SimpleSerialAnalyzerSettings* mSettings; + SimpleSerialAnalyzer* mAnalyzer; +}; + +#endif //SIMPLESERIAL_ANALYZER_RESULTS diff --git a/source/SimpleSerialAnalyzerSettings.cpp b/source/SimpleSerialAnalyzerSettings.cpp new file mode 100644 index 0000000..174dc7d --- /dev/null +++ b/source/SimpleSerialAnalyzerSettings.cpp @@ -0,0 +1,73 @@ +#include "SimpleSerialAnalyzerSettings.h" +#include + + +SimpleSerialAnalyzerSettings::SimpleSerialAnalyzerSettings() +: mInputChannel( UNDEFINED_CHANNEL ), + mBitRate( 9600 ) +{ + mInputChannelInterface.reset( new AnalyzerSettingInterfaceChannel() ); + mInputChannelInterface->SetTitleAndTooltip( "Serial", "Standard Simple Serial" ); + mInputChannelInterface->SetChannel( mInputChannel ); + + mBitRateInterface.reset( new AnalyzerSettingInterfaceInteger() ); + mBitRateInterface->SetTitleAndTooltip( "Bit Rate (Bits/S)", "Specify the bit rate in bits per second." ); + mBitRateInterface->SetMax( 6000000 ); + mBitRateInterface->SetMin( 1 ); + mBitRateInterface->SetInteger( mBitRate ); + + AddInterface( mInputChannelInterface.get() ); + AddInterface( mBitRateInterface.get() ); + + AddExportOption( 0, "Export as text/csv file" ); + AddExportExtension( 0, "text", "txt" ); + AddExportExtension( 0, "csv", "csv" ); + + ClearChannels(); + AddChannel( mInputChannel, "Serial", false ); +} + +SimpleSerialAnalyzerSettings::~SimpleSerialAnalyzerSettings() +{ +} + +bool SimpleSerialAnalyzerSettings::SetSettingsFromInterfaces() +{ + mInputChannel = mInputChannelInterface->GetChannel(); + mBitRate = mBitRateInterface->GetInteger(); + + ClearChannels(); + AddChannel( mInputChannel, "Simple Serial", true ); + + return true; +} + +void SimpleSerialAnalyzerSettings::UpdateInterfacesFromSettings() +{ + mInputChannelInterface->SetChannel( mInputChannel ); + mBitRateInterface->SetInteger( mBitRate ); +} + +void SimpleSerialAnalyzerSettings::LoadSettings( const char* settings ) +{ + SimpleArchive text_archive; + text_archive.SetString( settings ); + + text_archive >> mInputChannel; + text_archive >> mBitRate; + + ClearChannels(); + AddChannel( mInputChannel, "Simple Serial", true ); + + UpdateInterfacesFromSettings(); +} + +const char* SimpleSerialAnalyzerSettings::SaveSettings() +{ + SimpleArchive text_archive; + + text_archive << mInputChannel; + text_archive << mBitRate; + + return SetReturnString( text_archive.GetString() ); +} diff --git a/source/SimpleSerialAnalyzerSettings.h b/source/SimpleSerialAnalyzerSettings.h new file mode 100644 index 0000000..1b34136 --- /dev/null +++ b/source/SimpleSerialAnalyzerSettings.h @@ -0,0 +1,27 @@ +#ifndef SIMPLESERIAL_ANALYZER_SETTINGS +#define SIMPLESERIAL_ANALYZER_SETTINGS + +#include +#include + +class SimpleSerialAnalyzerSettings : public AnalyzerSettings +{ +public: + SimpleSerialAnalyzerSettings(); + virtual ~SimpleSerialAnalyzerSettings(); + + virtual bool SetSettingsFromInterfaces(); + void UpdateInterfacesFromSettings(); + virtual void LoadSettings( const char* settings ); + virtual const char* SaveSettings(); + + + Channel mInputChannel; + U32 mBitRate; + +protected: + std::auto_ptr< AnalyzerSettingInterfaceChannel > mInputChannelInterface; + std::auto_ptr< AnalyzerSettingInterfaceInteger > mBitRateInterface; +}; + +#endif //SIMPLESERIAL_ANALYZER_SETTINGS diff --git a/source/SimpleSerialSimulationDataGenerator.cpp b/source/SimpleSerialSimulationDataGenerator.cpp new file mode 100644 index 0000000..d9bab05 --- /dev/null +++ b/source/SimpleSerialSimulationDataGenerator.cpp @@ -0,0 +1,71 @@ +#include "SimpleSerialSimulationDataGenerator.h" +#include "SimpleSerialAnalyzerSettings.h" + +#include + +SimpleSerialSimulationDataGenerator::SimpleSerialSimulationDataGenerator() +: mSerialText( "My first analyzer, woo hoo!" ), + mStringIndex( 0 ) +{ +} + +SimpleSerialSimulationDataGenerator::~SimpleSerialSimulationDataGenerator() +{ +} + +void SimpleSerialSimulationDataGenerator::Initialize( U32 simulation_sample_rate, SimpleSerialAnalyzerSettings* settings ) +{ + mSimulationSampleRateHz = simulation_sample_rate; + mSettings = settings; + + mSerialSimulationData.SetChannel( mSettings->mInputChannel ); + mSerialSimulationData.SetSampleRate( simulation_sample_rate ); + mSerialSimulationData.SetInitialBitState( BIT_HIGH ); +} + +U32 SimpleSerialSimulationDataGenerator::GenerateSimulationData( U64 largest_sample_requested, U32 sample_rate, SimulationChannelDescriptor** simulation_channel ) +{ + U64 adjusted_largest_sample_requested = AnalyzerHelpers::AdjustSimulationTargetSample( largest_sample_requested, sample_rate, mSimulationSampleRateHz ); + + while( mSerialSimulationData.GetCurrentSampleNumber() < adjusted_largest_sample_requested ) + { + CreateSerialByte(); + } + + *simulation_channel = &mSerialSimulationData; + return 1; +} + +void SimpleSerialSimulationDataGenerator::CreateSerialByte() +{ + U32 samples_per_bit = mSimulationSampleRateHz / mSettings->mBitRate; + + U8 byte = mSerialText[ mStringIndex ]; + mStringIndex++; + if( mStringIndex == mSerialText.size() ) + mStringIndex = 0; + + //we're currenty high + //let's move forward a little + mSerialSimulationData.Advance( samples_per_bit * 10 ); + + mSerialSimulationData.Transition(); //low-going edge for start bit + mSerialSimulationData.Advance( samples_per_bit ); //add start bit time + + U8 mask = 0x1 << 7; + for( U32 i=0; i<8; i++ ) + { + if( ( byte & mask ) != 0 ) + mSerialSimulationData.TransitionIfNeeded( BIT_HIGH ); + else + mSerialSimulationData.TransitionIfNeeded( BIT_LOW ); + + mSerialSimulationData.Advance( samples_per_bit ); + mask = mask >> 1; + } + + mSerialSimulationData.TransitionIfNeeded( BIT_HIGH ); //we need to end high + + //lets pad the end a bit for the stop bit: + mSerialSimulationData.Advance( samples_per_bit ); +} diff --git a/source/SimpleSerialSimulationDataGenerator.h b/source/SimpleSerialSimulationDataGenerator.h new file mode 100644 index 0000000..c5dc2e9 --- /dev/null +++ b/source/SimpleSerialSimulationDataGenerator.h @@ -0,0 +1,29 @@ +#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