|
2 | 2 | * * |
3 | 3 | * libscopeprotocols * |
4 | 4 | * * |
5 | | -* Copyright (c) 2012-2023 Andrew D. Zonenberg and contributors * |
| 5 | +* Copyright (c) 2012-2026 Andrew D. Zonenberg and contributors * |
6 | 6 | * All rights reserved. * |
7 | 7 | * * |
8 | 8 | * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the * |
@@ -59,37 +59,51 @@ string Ethernet10GBaseRDecoder::GetProtocolName() |
59 | 59 |
|
60 | 60 | bool Ethernet10GBaseRDecoder::ValidateChannel(size_t i, StreamDescriptor stream) |
61 | 61 | { |
62 | | - if(stream.m_channel == NULL) |
| 62 | + if(stream.m_channel == nullptr) |
63 | 63 | return false; |
64 | 64 |
|
65 | | - if( (i == 0) && (dynamic_cast<Ethernet64b66bWaveform*>(stream.m_channel->GetData(0)) != NULL) ) |
| 65 | + if( (i == 0) && (dynamic_cast<Ethernet64b66bWaveform*>(stream.m_channel->GetData(0)) != nullptr) ) |
66 | 66 | return true; |
67 | 67 |
|
68 | 68 | return false; |
69 | 69 | } |
70 | 70 |
|
| 71 | +Filter::DataLocation Ethernet10GBaseRDecoder::GetInputLocation() |
| 72 | +{ |
| 73 | + //We explicitly manage our input memory and don't care where it is when Refresh() is called |
| 74 | + return LOC_DONTCARE; |
| 75 | +} |
| 76 | + |
71 | 77 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
72 | 78 | // Actual decoder logic |
73 | 79 |
|
74 | | -void Ethernet10GBaseRDecoder::Refresh() |
| 80 | +void Ethernet10GBaseRDecoder::Refresh( |
| 81 | + [[maybe_unused]] vk::raii::CommandBuffer& cmdBuf, |
| 82 | + [[maybe_unused]] shared_ptr<QueueHandle> queue) |
75 | 83 | { |
76 | | - ClearPackets(); |
| 84 | + #ifdef HAVE_NVTX |
| 85 | + nvtx3::scoped_range nrange("Ethernet10GBaseRDecoder::Refresh"); |
| 86 | + #endif |
77 | 87 |
|
78 | | - //Get the input data |
| 88 | + //Make sure we've got valid inputs |
| 89 | + ClearErrors(); |
| 90 | + ClearPackets(); |
79 | 91 | if(!VerifyAllInputsOK()) |
80 | 92 | { |
81 | | - SetData(NULL, 0); |
| 93 | + if(!GetInput(0)) |
| 94 | + AddErrorMessage("Missing inputs", "No signal input connected"); |
| 95 | + else if(!GetInputWaveform(0)) |
| 96 | + AddErrorMessage("Missing inputs", "No waveform available at input"); |
| 97 | + |
| 98 | + SetData(nullptr, 0); |
82 | 99 | return; |
83 | 100 | } |
84 | 101 |
|
85 | 102 | auto data = dynamic_cast<Ethernet64b66bWaveform*>(GetInputWaveform(0)); |
86 | 103 | data->PrepareForCpuAccess(); |
87 | 104 |
|
88 | 105 | //Create the output capture |
89 | | - auto cap = new EthernetWaveform; |
90 | | - cap->m_timescale = data->m_timescale; |
91 | | - cap->m_startTimestamp = data->m_startTimestamp; |
92 | | - cap->m_startFemtoseconds = data->m_startFemtoseconds; |
| 106 | + auto cap = SetupEmptyWaveform<EthernetWaveform>(data, 0); |
93 | 107 | cap->PrepareForCpuAccess(); |
94 | 108 |
|
95 | 109 | size_t len = data->m_samples.size(); |
@@ -370,6 +384,5 @@ void Ethernet10GBaseRDecoder::Refresh() |
370 | 384 | BytesToFrames(bytes, starts, ends, cap); |
371 | 385 | } |
372 | 386 |
|
373 | | - SetData(cap, 0); |
374 | 387 | cap->MarkModifiedFromCpu(); |
375 | 388 | } |
0 commit comments