Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More Doxygen documentation #408

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
3685a9c
Finish documenting all the class and structs within classes headers
DominykasPetke Dec 19, 2023
4a6f907
Separate PCIe classes into separate files
DominykasPetke Dec 19, 2023
0cc5e94
Document a few functions
DominykasPetke Dec 19, 2023
1371c1b
Split TRXLooper_PCIE classes out into their own files and document Av…
DominykasPetke Dec 20, 2023
b5cc9e2
Document USB Generic
DominykasPetke Dec 20, 2023
568a223
Clean up Device REgistry and Handle documentation
DominykasPetke Dec 20, 2023
288567d
Document DeltaVariable
DominykasPetke Dec 20, 2023
84e9477
Add SlaveSelectShim documentation
DominykasPetke Dec 21, 2023
93fec50
Add USB Pipe and USBTransferContext documentation
DominykasPetke Dec 21, 2023
fe70473
Merge branch 'litepcie-update' into litepcie-update-more-doxygen
DominykasPetke Dec 21, 2023
74d0f38
Add missing command into the documentation generation documentation
DominykasPetke Dec 21, 2023
3724d62
Finish documenting all the connection classes
DominykasPetke Dec 21, 2023
791f6a7
Clean up extraneous return type documentation
DominykasPetke Dec 21, 2023
a38eb87
Document and clean up SamplesPacket and PacketsFIFO
DominykasPetke Dec 21, 2023
e430441
Remove unused channel parameter from LMS7002M::Get/SetClockFreq
DominykasPetke Dec 22, 2023
da38b43
Document and slightly refactor SDRDevice
DominykasPetke Dec 22, 2023
eba9cf9
Document all the main device classes
DominykasPetke Dec 22, 2023
4e34515
Fix PacketsFIFO documentation, document MemoryPool and WriteRegisters…
DominykasPetke Dec 22, 2023
0b09e53
Make StreamRx/Tx return type be uint32_t everywhere.
DominykasPetke Dec 27, 2023
dd6871f
Document TRXLooper
DominykasPetke Dec 27, 2023
8460857
Document StreamComposite
DominykasPetke Dec 27, 2023
5c530a4
Separate WriteRegistersBatch into their own files
DominykasPetke Dec 27, 2023
aea60ae
Clean up SetInterfaceFreq defintions
DominykasPetke Dec 27, 2023
fd94f1c
Document a few more FPGA functions
DominykasPetke Dec 27, 2023
c8667ab
Clean up a small mistake in LMS7002M::GetGFIRCoefficients docs
DominykasPetke Jan 2, 2024
f5dde8d
Merge branch 'litepcie-update' into litepcie-update-more-doxygen
DominykasPetke Feb 6, 2024
1771fe1
Clean up misdocumented parameters warnings
DominykasPetke Feb 6, 2024
fa7f6fd
Add full documentation coverage of SDRDevice
DominykasPetke Feb 7, 2024
ff23ae1
Document and slightly refactor LMS7002M's methods.
DominykasPetke Feb 8, 2024
b734f2f
Document all the variables in the public includes folder
DominykasPetke Feb 8, 2024
0eed3af
Merge branch 'litepcie-update' into litepcie-update-more-doxygen
DominykasPetke Feb 20, 2024
a7f1a93
OpStatus documentation fixes
DominykasPetke Feb 20, 2024
b5d22f8
Minor fixups
DominykasPetke Feb 20, 2024
2249901
clang-format
DominykasPetke Feb 20, 2024
cf1ae17
Fix Windows compile errors
DominykasPetke Feb 20, 2024
865366a
Merge branch 'litepcie-update' into litepcie-update-more-doxygen
DominykasPetke Feb 26, 2024
b364c01
clang-format
DominykasPetke Feb 26, 2024
6819411
Fix Windows compile
DominykasPetke Feb 26, 2024
b7d9df8
Add documentation for the freshly added changes
DominykasPetke Feb 26, 2024
53f8c27
Merge branch 'litepcie-update' into litepcie-update-more-doxygen
DominykasPetke Mar 5, 2024
bf7e993
Fix (mis)documentations
DominykasPetke Mar 5, 2024
519defb
Add missing extern C comment
DominykasPetke Mar 5, 2024
ff56554
Fix unnecessary // clang-format off
DominykasPetke Mar 5, 2024
5980b60
Document undocumented parameters in otherwise documented functions
DominykasPetke Mar 5, 2024
053dd0c
Fix a broken function
DominykasPetke Mar 7, 2024
e892d29
Fix undocumented return values on otherwise documented functions
DominykasPetke Mar 7, 2024
9ef418a
Fix minor typo
DominykasPetke Mar 8, 2024
a8ccf5f
Merge branch 'litepcie-update' into litepcie-update-more-doxygen
DominykasPetke Mar 12, 2024
57750a1
Fix misdocumentation
DominykasPetke Mar 14, 2024
41c252f
Extract IntToChannel to a function
DominykasPetke Mar 14, 2024
ad9eefe
Fix FPGA functionality changes
DominykasPetke Mar 14, 2024
e0b3ed5
Decouple SamplesPacket from SDRDevice
DominykasPetke Mar 14, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions SoapyLMS7/Streaming.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ int SoapyLMS7::readStream(
}

SDRDevice::StreamMeta metadata;
const int64_t cmdTicks =
const uint64_t cmdTicks =
((icstream->flags & SOAPY_SDR_HAS_TIME) != 0) ? SoapySDR::timeNsToTicks(icstream->timeNs, sampleRate[SOAPY_SDR_RX]) : 0;

int status = 0;
Expand All @@ -364,7 +364,7 @@ int SoapyLMS7::readStream(
return SOAPY_SDR_STREAM_ERROR;
}

const int64_t expectedTime(cmdTicks + status);
const uint64_t expectedTime(cmdTicks + status);

if (metadata.timestamp < expectedTime)
{
Expand All @@ -373,7 +373,7 @@ int SoapyLMS7::readStream(
}

// The command had a time, so we need to compare it to received time
if ((icstream->flags & SOAPY_SDR_HAS_TIME) != 0 and metadata.useTimestamp)
if ((icstream->flags & SOAPY_SDR_HAS_TIME) != 0 and metadata.waitForTimestamp)
{
// Our request time is now late, clear command and return error code
if (cmdTicks < metadata.timestamp)
Expand Down Expand Up @@ -408,17 +408,17 @@ int SoapyLMS7::readStream(
if (icstream->numElems == 0)
{
icstream->hasCmd = false;
metadata.flush = true;
metadata.flushPartialPacket = true;
}
}

// Output metadata
if (metadata.flush)
if (metadata.flushPartialPacket)
{
flags |= SOAPY_SDR_END_BURST;
}

if (metadata.useTimestamp)
if (metadata.waitForTimestamp)
{
flags |= SOAPY_SDR_HAS_TIME;
}
Expand Down Expand Up @@ -447,8 +447,8 @@ int SoapyLMS7::writeStream(SoapySDR::Stream* stream,
// Input metadata
SDRDevice::StreamMeta metadata;
metadata.timestamp = SoapySDR::timeNsToTicks(timeNs, sampleRate[SOAPY_SDR_RX]);
metadata.useTimestamp = (flags & SOAPY_SDR_HAS_TIME);
metadata.flush = (flags & SOAPY_SDR_END_BURST);
metadata.waitForTimestamp = (flags & SOAPY_SDR_HAS_TIME);
metadata.flushPartialPacket = (flags & SOAPY_SDR_END_BURST);

int status = 0;
switch (icstream->streamConfig.format)
Expand Down
12 changes: 6 additions & 6 deletions amarisoft-plugin/common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -749,10 +749,10 @@ OpStatus ConfigureStreaming(LimePluginContext* context, const LimeRuntimeParamet
stream.channels[TRXDir::Tx].resize(params->rf_ports[p].tx_channel_count);
stream.linkFormat = SDRDevice::StreamConfig::DataFormat::I16;
stream.format = context->samplesFormat;
stream.extraConfig.rxSamplesInPacket = 256;
stream.extraConfig.rxPacketsInBatch = 4;
stream.extraConfig.txMaxPacketsInBatch = 8;
stream.extraConfig.txSamplesInPacket = 256;
stream.extraConfig.rx.samplesInPacket = 256;
stream.extraConfig.rx.packetsInBatch = 4;
stream.extraConfig.tx.packetsInBatch = 8;
stream.extraConfig.tx.samplesInPacket = 256;

// Initialize streams and map channels
for (size_t ch = 0; ch < stream.channels[TRXDir::Rx].size(); ++ch)
Expand Down Expand Up @@ -895,8 +895,8 @@ int LimePlugin_Write_complex16(
template<class T>
static int LimePlugin_Read(LimePluginContext* context, T** samples, int count, int port, SDRDevice::StreamMeta& meta)
{
meta.useTimestamp = false;
meta.flush = false;
meta.waitForTimestamp = false;
meta.flushPartialPacket = false;
int samplesGot = context->ports[port].composite->StreamRx(samples, count, &meta);

if (samplesGot == 0)
Expand Down
17 changes: 6 additions & 11 deletions amarisoft-plugin/gainTable.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,12 @@

#include <array>

// clang-format off

struct RxGainRow {
int lna;
int pga;
};


static std::array<RxGainRow, 51> rxGainTable{{
static std::array<RxGainRow, 51> rxGainTable{ {
{ 1, 12 },
{ 1, 13 },
{ 2, 12 },
Expand Down Expand Up @@ -61,15 +58,15 @@ static std::array<RxGainRow, 51> rxGainTable{{
{ 15, 28 },
{ 15, 29 },
{ 15, 30 },
{ 15, 31 }
}};
{ 15, 31 },
} };

struct TxGainRow {
int main;
int lin;
};

static std::array<TxGainRow, 51> txGainTable{{
static std::array<TxGainRow, 51> txGainTable{ {
{ 30, 30 },
{ 30, 30 },
{ 29, 29 },
Expand Down Expand Up @@ -120,7 +117,5 @@ static std::array<TxGainRow, 51> txGainTable{{
{ 3, 3 },
{ 2, 2 },
{ 1, 1 },
{ 0, 0 }
}};

// clang-format on
{ 0, 0 },
} };
13 changes: 6 additions & 7 deletions amarisoft-plugin/trx_limesuite.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
* LimeMicroSystem transceiver driver
* Copyright (C) 2015-2018 Amarisoft/LimeMicroSystems
*/

#include "common.h"

#include <stdarg.h>
Expand Down Expand Up @@ -132,8 +131,8 @@ static void trx_lms7002m_write(

SDRDevice::StreamMeta meta;
meta.timestamp = timestamp;
meta.useTimestamp = true;
meta.flush = (md->flags & TRX_WRITE_MD_FLAG_END_OF_BURST);
meta.waitForTimestamp = true;
meta.flushPartialPacket = (md->flags & TRX_WRITE_MD_FLAG_END_OF_BURST);

// samples format conversion is done internally
LimePluginContext* lime = static_cast<LimePluginContext*>(s->opaque);
Expand All @@ -147,8 +146,8 @@ static void trx_lms7002m_write(
static int trx_lms7002m_read(TRXState* s, trx_timestamp_t* ptimestamp, void** samples, int count, int port, TRXReadMetadata* md)
{
SDRDevice::StreamMeta meta;
meta.useTimestamp = false;
meta.flush = false;
meta.waitForTimestamp = false;
meta.flushPartialPacket = false;
md->flags = 0;

LimePluginContext* lime = static_cast<LimePluginContext*>(s->opaque);
Expand Down Expand Up @@ -259,9 +258,9 @@ static int trx_lms7002m_get_tx_samples_per_packet_func(TRXState* s1)
{
// LimePluginContext* lime = static_cast<LimePluginContext*>(s1->opaque);
int txExpectedSamples = 256; //lime->samplesInPacket[0];
// if (lime->streamExtras[0] && lime->streamExtras[0]->txSamplesInPacket > 0)
// if (lime->streamExtras[0] && lime->streamExtras[0]->tx.samplesInPacket > 0)
// {
// txExpectedSamples = lime->streamExtras[0]->txSamplesInPacket;
// txExpectedSamples = lime->streamExtras[0]->tx.samplesInPacket;
// }
// Log(LogLevel::DEBUG, "Hardware expected samples count in Tx packet : %i", txExpectedSamples);
return txExpectedSamples;
Expand Down
1 change: 1 addition & 0 deletions docs/setup/documentation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ In the `docs` folder, located in the root folder of the repository, while in the
cmake -S .. -B ../build # Generate the make file for the suite.
make --no-print-directory -C ../build doc # Build Doxygen documentation
breathe-apidoc --generate class --members --force --output-dir apidoc ../build/xml/ # Generate the class API pages
python add_undoc_members.py # Add a flag to add all undocumented members into the page
make html # Generate the documentation itself

.. important::
Expand Down
10 changes: 6 additions & 4 deletions src/ADF4002/ADF4002.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@

#include <cmath>
#include <vector>
#include <assert.h>
#include <string.h>
#include <cassert>
#include <cstring>
#include <memory>

using namespace lime;

Expand All @@ -22,7 +23,7 @@ ADF4002::~ADF4002()
{
}

void ADF4002::Initialize(ISPI* comms, double refClkHz)
void ADF4002::Initialize(std::shared_ptr<ISPI> comms, double refClkHz)
{
mComms = comms;
txtFref = refClkHz / 1e6;
Expand Down Expand Up @@ -324,7 +325,8 @@ void ADF4002::CalculateRN()
lblFvco = dFvco;
}

/** @brief Writes configuration to chip
/** @brief Gets the configuration from chip
* @param data The data to read from the chip.
*/
void ADF4002::GetConfig(unsigned char data[12])
{
Expand Down
11 changes: 8 additions & 3 deletions src/ADF4002/ADF4002.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,22 @@
#define ADF_MODULE_H

#include "limesuite/config.h"

#include "limesuite/IComms.h"

#include <memory>

namespace lime {

/** @brief The class for controlling the ADF4002 frequency synthesizer.
*
* More information: https://www.analog.com/en/products/adf4002.html
*/
class LIME_API ADF4002
{
public:
ADF4002();
~ADF4002();
void Initialize(ISPI* comms, double refClkHz);
void Initialize(std::shared_ptr<ISPI> comms, double refClkHz);
int UploadConfig();

void SetFrefFvco(double Fref, double Fvco, int& rcount, int& ncount);
Expand Down Expand Up @@ -67,7 +72,7 @@ class LIME_API ADF4002
double lblFvco;

protected:
ISPI* mComms;
std::shared_ptr<ISPI> mComms;
unsigned char m_registers[12];
};

Expand Down
38 changes: 19 additions & 19 deletions src/API/LMS_APIWrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -628,7 +628,7 @@ API_EXPORT int CALL_CONV LMS_GetNormalizedGain(lms_device_t* device, bool dir_tx
if (gain)
*gain = (deviceGain - range.min) / (range.max - range.min);

return returnValue == OpStatus::SUCCESS ? 0 : -1;
return OpStatusToReturnCode(returnValue);
}

API_EXPORT int CALL_CONV LMS_GetGaindB(lms_device_t* device, bool dir_tx, size_t chan, unsigned* gain)
Expand All @@ -648,7 +648,7 @@ API_EXPORT int CALL_CONV LMS_GetGaindB(lms_device_t* device, bool dir_tx, size_t
if (gain)
*gain = std::lround(deviceGain) + 12;

return returnValue == OpStatus::SUCCESS ? 0 : -1;
return OpStatusToReturnCode(returnValue);
}

API_EXPORT int CALL_CONV LMS_Calibrate(lms_device_t* device, bool dir_tx, size_t chan, double bw, unsigned flags)
Expand Down Expand Up @@ -723,10 +723,10 @@ API_EXPORT int CALL_CONV LMS_SetTestSignal(
}
};

try {
try
{
apiDevice->device->SetTestSignal(apiDevice->moduleIndex, direction, chan, enumToTestStruct(sig), dc_i, dc_q);
}
catch (...)
} catch (...)
{
lime::error("Failed to set %s channel %i test signal.", ToString(direction).c_str(), chan);
}
Expand Down Expand Up @@ -1061,8 +1061,8 @@ int SendStream(lms_stream_t* stream, const void* samples, size_t sample_count, c

if (meta != nullptr)
{
metadata.flush = meta->flushPartialPacket;
metadata.useTimestamp = meta->waitForTimestamp;
metadata.flushPartialPacket = meta->flushPartialPacket;
metadata.waitForTimestamp = meta->waitForTimestamp;
metadata.timestamp = meta->timestamp;
}

Expand Down Expand Up @@ -1789,10 +1789,10 @@ API_EXPORT int CALL_CONV LMS_WriteLMSReg(lms_device_t* device, uint32_t address,
return -1;
}

try {
try
{
apiDevice->device->WriteRegister(apiDevice->moduleIndex, address, val);
}
catch(...)
} catch (...)
{
return lime::error("Failed to write register at %04X.", address);
}
Expand All @@ -1808,11 +1808,11 @@ API_EXPORT int CALL_CONV LMS_ReadLMSReg(lms_device_t* device, uint32_t address,
return -1;
}

try {
try
{
if (val)
*val = apiDevice->device->ReadRegister(apiDevice->moduleIndex, address);
}
catch (...)
} catch (...)
{
return lime::error("Failed to read register at %04X.", address);
}
Expand All @@ -1828,10 +1828,10 @@ API_EXPORT int CALL_CONV LMS_WriteFPGAReg(lms_device_t* device, uint32_t address
return -1;
}

try {
try
{
apiDevice->device->WriteRegister(apiDevice->moduleIndex, address, val, true);
}
catch (...)
} catch (...)
{
return lime::error("Failed to write register at %04X.", address);
}
Expand All @@ -1847,11 +1847,11 @@ API_EXPORT int CALL_CONV LMS_ReadFPGAReg(lms_device_t* device, uint32_t address,
return -1;
}

try {
try
{
if (val)
*val = apiDevice->device->ReadRegister(apiDevice->moduleIndex, address, true);
}
catch (...)
} catch (...)
{
return lime::error("Failed to read register at %04X.", address);
}
Expand Down
11 changes: 10 additions & 1 deletion src/CDCM6208/CDCM6208_Dev.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,19 @@ struct CDCM_Outputs {
CDCM_Output Y7{ false, false, 0, 0, 0, 0, 30.72e6, 0 }; ///< The value of the Y7 output
};

/** @brief Class for controlling the CDCM6208 2:8 Clock Generator, Jitter Cleaner With Fractional Dividers */
/** @brief Class for controlling the CDCM6208 2:8 Clock Generator, Jitter Cleaner With Fractional Dividers.
*
* More information: https://www.ti.com/product/CDCM6208
*/
class LIME_API CDCM_Dev
{
public:
/**
@brief Constructs a new CDCM_Dev object.

@param comms The communications path to use.
@param SPI_BASE_ADDR The base address for the API interface.
*/
CDCM_Dev(std::shared_ptr<lime::ISPI> comms, uint16_t SPI_BASE_ADDR);

int Init(double primaryFreq, double secondaryFreq);
Expand Down
1 change: 1 addition & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ set(LIME_SUITE_SOURCES
Si5351C/Si5351C.cpp
${PROJECT_SOURCE_DIR}/external/kissFFT/kiss_fft.c
FPGA_common/FPGA_common.cpp
FPGA_common/WriteRegistersBatch.cpp
windowFunction.cpp
threadHelper/threadHelper.cpp
CDCM6208/CDCM6208_Dev.cpp
Expand Down
Loading
Loading