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: 3ca0fd0a24e7
Choose a base ref
...
head repository: ngscopeclient/scopehal
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 9fae0f2dd8ac
Choose a head ref
  • 1 commit
  • 4 files changed
  • 1 contributor

Commits on Feb 14, 2020

  1. Copy the full SHA
    9fae0f2 View commit details
Showing with 66 additions and 5 deletions.
  1. +4 −0 scopehal/PacketDecoder.cpp
  2. +3 −2 scopehal/PacketDecoder.h
  3. +49 −1 scopeprotocols/DVIDecoder.cpp
  4. +10 −2 scopeprotocols/DVIDecoder.h
4 changes: 4 additions & 0 deletions scopehal/PacketDecoder.cpp
Original file line number Diff line number Diff line change
@@ -30,6 +30,10 @@
#include "scopehal.h"
#include "PacketDecoder.h"

Packet::~Packet()
{
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Construction / destruction

5 changes: 3 additions & 2 deletions scopehal/PacketDecoder.h
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@
* *
* ANTIKERNEL v0.1 *
* *
* Copyright (c) 2012-2019 Andrew D. Zonenberg *
* Copyright (c) 2012-2020 Andrew D. Zonenberg *
* All rights reserved. *
* *
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the *
@@ -39,11 +39,12 @@
class Packet
{
public:
virtual ~Packet();

///Offset of the packet from the start of the capture (picoseconds)
int64_t m_offset;

///End time of the packet (seconds)
///Duration time of the packet (picoseconds)
int64_t m_len;

//Arbitrary header properties (human readable)
50 changes: 49 additions & 1 deletion scopeprotocols/DVIDecoder.cpp
Original file line number Diff line number Diff line change
@@ -42,11 +42,17 @@

using namespace std;

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

VideoScanlinePacket::~VideoScanlinePacket()
{
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Construction / destruction

DVIDecoder::DVIDecoder(string color)
: ProtocolDecoder(OscilloscopeChannel::CHANNEL_TYPE_COMPLEX, color, CAT_SERIAL)
: PacketDecoder(OscilloscopeChannel::CHANNEL_TYPE_COMPLEX, color, CAT_SERIAL)
{
//Set up channels
m_signalNames.push_back("D0 (blue)");
@@ -97,6 +103,14 @@ void DVIDecoder::SetDefaultName()
m_displayname = m_hwname;
}

vector<string> DVIDecoder::GetHeaders()
{
vector<string> ret;
ret.push_back("Type");
ret.push_back("Width");
return ret;
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Actual decoder logic

@@ -130,6 +144,9 @@ void DVIDecoder::Refresh()

TMDSSymbol::TMDSType last_type = TMDSSymbol::TMDS_TYPE_ERROR;

VideoScanlinePacket* current_packet = NULL;
int current_pixels = 0;

//Decode the actual data
for(iblue = 0; (iblue < dblue->size()) && (igreen < dgreen->size()) && (ired < dred->size()); )
{
@@ -138,6 +155,19 @@ void DVIDecoder::Refresh()
//Control code in master channel? Decode it
if(sblue.m_sample.m_type == TMDSSymbol::TMDS_TYPE_CONTROL)
{
//If the last sample was data, save the packet for the scanline or data island
if( (last_type == TMDSSymbol::TMDS_TYPE_DATA) && (current_packet != NULL) )
{
current_packet->m_len = sblue.m_offset + sblue.m_duration - current_packet->m_offset;
char tmp[32];
snprintf(tmp, sizeof(tmp), "%d", current_pixels);
current_packet->m_headers["Width"] = tmp;
m_packets.push_back(current_packet);

current_pixels = 0;
current_packet = NULL;
}

//Extract synchronization signals from blue channel
//Red/green have status signals that aren't used in DVI.
bool hsync = (sblue.m_sample.m_data & 1) ? true : false;
@@ -215,6 +245,12 @@ void DVIDecoder::Refresh()
ired += delta;
break;
}

//Start a new packet
current_packet = new VideoScanlinePacket;
current_packet->m_offset = sblue.m_offset;
current_packet->m_headers["Type"] = "Video";
current_pixels = 0;
}

auto sgreen = dgreen->m_samples[igreen];
@@ -226,6 +262,15 @@ void DVIDecoder::Refresh()
sred.m_sample.m_data,
sgreen.m_sample.m_data,
sblue.m_sample.m_data)));

//may be null if waveform starts halfway through a scan line. Don't make a packet for that.
if(current_packet != NULL)
{
current_packet->m_data.push_back(sred.m_sample.m_data);
current_packet->m_data.push_back(sgreen.m_sample.m_data);
current_packet->m_data.push_back(sblue.m_sample.m_data);
current_pixels ++;
}
}

//Save the previous type of sample
@@ -237,5 +282,8 @@ void DVIDecoder::Refresh()
ired ++;
}

if(current_packet)
delete current_packet;

SetData(cap);
}
12 changes: 10 additions & 2 deletions scopeprotocols/DVIDecoder.h
Original file line number Diff line number Diff line change
@@ -36,7 +36,7 @@
#ifndef DVIDecoder_h
#define DVIDecoder_h

#include "../scopehal/ProtocolDecoder.h"
#include "../scopehal/PacketDecoder.h"

class DVISymbol
{
@@ -68,10 +68,16 @@ class DVISymbol
}
};

class VideoScanlinePacket : public Packet
{
public:
virtual ~VideoScanlinePacket();
};

typedef OscilloscopeSample<DVISymbol> DVISample;
typedef CaptureChannel<DVISymbol> DVICapture;

class DVIDecoder : public ProtocolDecoder
class DVIDecoder : public PacketDecoder
{
public:
DVIDecoder(std::string color);
@@ -83,6 +89,8 @@ class DVIDecoder : public ProtocolDecoder
static std::string GetProtocolName();
virtual void SetDefaultName();

virtual std::vector<std::string> GetHeaders();

virtual bool ValidateChannel(size_t i, OscilloscopeChannel* channel);

PROTOCOL_DECODER_INITPROC(DVIDecoder)