Skip to content

Commit

Permalink
amarisoft: fix read function timestamp update, fix samples format
Browse files Browse the repository at this point in the history
  • Loading branch information
rjonaitis committed Feb 23, 2024
1 parent 8b35a82 commit 35e8e40
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
3 changes: 2 additions & 1 deletion amarisoft-plugin/common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ RFNode::RFNode()
LimePluginContext::LimePluginContext()
: rfdev(LIME_MAX_UNIQUE_DEVICES)
, config(nullptr)
, samplesFormat(SDRDevice::StreamConfig::DataFormat::F32)
{
ports.reserve(LIME_TRX_MAX_RF_PORT);
}
Expand Down Expand Up @@ -738,7 +739,7 @@ int LimePlugin_Setup(LimePluginContext* context, const LimeParams* params)
stream.channels[TRXDir::Rx].resize(params->rf_ports[p].rx_channel_count);
stream.channels[TRXDir::Tx].resize(params->rf_ports[p].tx_channel_count);
stream.linkFormat = SDRDevice::StreamConfig::DataFormat::I16;
stream.format = SDRDevice::StreamConfig::DataFormat::I16;
stream.format = context->samplesFormat;
stream.extraConfig.rxSamplesInPacket = 256;
stream.extraConfig.rxPacketsInBatch = 4;
stream.extraConfig.txMaxPacketsInBatch = 8;
Expand Down
1 change: 1 addition & 0 deletions amarisoft-plugin/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ struct LimePluginContext
std::map<std::string, lime::SDRDevice*> uniqueDevices;
std::vector<std::deque<int>> portAssignements;
LimeParamProvider* config;
lime::SDRDevice::StreamConfig::DataFormat samplesFormat;

/* Path of the config file, not terminating by / */
std::string currentWorkingDirectory;
Expand Down
8 changes: 5 additions & 3 deletions amarisoft-plugin/trx_limesuite.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ class AmarisoftParamProvider : public LimeParamProvider
{
if (blockAccess)
{

return false;
}
char* ctemp = trx_get_param_string(state, varname);
Expand Down Expand Up @@ -154,7 +153,9 @@ static int trx_lms7002m_read(TRXState* s, trx_timestamp_t* ptimestamp, void** sa
md->flags = 0;

LimePluginContext* lime = (LimePluginContext*)s->opaque;
return LimePlugin_Read_complex32f(lime, reinterpret_cast<lime::complex32f_t**>(samples), count, port, meta);
int samplesGot = LimePlugin_Read_complex32f(lime, reinterpret_cast<lime::complex32f_t**>(samples), count, port, meta);
*ptimestamp = meta.timestamp; // if timestamp is not updated, amarisoft will freeze
return samplesGot;
}

// Return in *psample_rate the sample rate supported by the device
Expand Down Expand Up @@ -258,7 +259,7 @@ static int trx_lms7002m_get_sample_rate(TRXState* s1, TRXFraction* psample_rate,
static int trx_lms7002m_get_tx_samples_per_packet_func(TRXState* s1)
{
// LimePluginContext* lime = static_cast<LimePluginContext*>(s1->opaque);
int txExpectedSamples = 512;//lime->samplesInPacket[0];
int txExpectedSamples = 256;//lime->samplesInPacket[0];
// if (lime->streamExtras[0] && lime->streamExtras[0]->txSamplesInPacket > 0)
// {
// txExpectedSamples = lime->streamExtras[0]->txSamplesInPacket;
Expand Down Expand Up @@ -358,6 +359,7 @@ int __attribute__((visibility("default"))) trx_driver_init(TRXState* hostState)

LimePluginContext* lime = new LimePluginContext();
lime->currentWorkingDirectory = std::string(hostState->path);
lime->samplesFormat = SDRDevice::StreamConfig::DataFormat::F32;
configProvider.Init(hostState);

if (LimePlugin_Init(lime, LogCallback, &configProvider) != 0)
Expand Down

0 comments on commit 35e8e40

Please sign in to comment.