mirror of
https://github.com/f4exb/sdrangel.git
synced 2025-06-26 14:05:33 -04:00
LimeSDR: use channel set in device management via device API
This commit is contained in:
parent
a32d508256
commit
7f8d61cdb0
@ -68,6 +68,8 @@ void LimeSDROutput::destroy()
|
|||||||
|
|
||||||
bool LimeSDROutput::openDevice()
|
bool LimeSDROutput::openDevice()
|
||||||
{
|
{
|
||||||
|
int requestedChannel = m_deviceAPI->getItemIndex();
|
||||||
|
|
||||||
// look for Tx buddies and get reference to common parameters
|
// look for Tx buddies and get reference to common parameters
|
||||||
// if there is a channel left take the first available
|
// if there is a channel left take the first available
|
||||||
if (m_deviceAPI->getSinkBuddies().size() > 0) // look sink sibling first
|
if (m_deviceAPI->getSinkBuddies().size() > 0) // look sink sibling first
|
||||||
@ -98,7 +100,8 @@ bool LimeSDROutput::openDevice()
|
|||||||
qDebug("LimeSDROutput::openDevice: at least one more Tx channel is available in device");
|
qDebug("LimeSDROutput::openDevice: at least one more Tx channel is available in device");
|
||||||
}
|
}
|
||||||
|
|
||||||
// look for unused channel number
|
// check if the requested channel is busy and abort if so (should not happen if device management is working correctly)
|
||||||
|
|
||||||
char *busyChannels = new char[deviceParams->m_nbTxChannels];
|
char *busyChannels = new char[deviceParams->m_nbTxChannels];
|
||||||
memset(busyChannels, 0, deviceParams->m_nbTxChannels);
|
memset(busyChannels, 0, deviceParams->m_nbTxChannels);
|
||||||
|
|
||||||
@ -107,21 +110,14 @@ bool LimeSDROutput::openDevice()
|
|||||||
DeviceSinkAPI *buddy = m_deviceAPI->getSinkBuddies()[i];
|
DeviceSinkAPI *buddy = m_deviceAPI->getSinkBuddies()[i];
|
||||||
DeviceLimeSDRShared *buddyShared = (DeviceLimeSDRShared *) buddy->getBuddySharedPtr();
|
DeviceLimeSDRShared *buddyShared = (DeviceLimeSDRShared *) buddy->getBuddySharedPtr();
|
||||||
|
|
||||||
if (buddyShared->m_channel >= 0) {
|
if (buddyShared->m_channel == requestedChannel)
|
||||||
busyChannels[buddyShared->m_channel] = 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
std::size_t ch = 0;
|
|
||||||
|
|
||||||
for (;ch < deviceParams->m_nbTxChannels; ch++)
|
|
||||||
{
|
{
|
||||||
if (busyChannels[ch] == 0) {
|
qCritical("LimeSDROutput::openDevice: cannot open busy channel %u", requestedChannel);
|
||||||
break; // first available is the good one
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
m_deviceShared.m_channel = ch;
|
m_deviceShared.m_channel = requestedChannel; // acknowledge the requested channel
|
||||||
delete[] busyChannels;
|
delete[] busyChannels;
|
||||||
}
|
}
|
||||||
// look for Rx buddies and get reference to common parameters
|
// look for Rx buddies and get reference to common parameters
|
||||||
@ -143,7 +139,7 @@ bool LimeSDROutput::openDevice()
|
|||||||
qDebug("LimeSDROutput::openDevice: getting device parameters from Rx buddy");
|
qDebug("LimeSDROutput::openDevice: getting device parameters from Rx buddy");
|
||||||
}
|
}
|
||||||
|
|
||||||
m_deviceShared.m_channel = 0; // take first channel
|
m_deviceShared.m_channel = requestedChannel; // acknowledge the requested channel
|
||||||
}
|
}
|
||||||
// There are no buddies then create the first LimeSDR common parameters
|
// There are no buddies then create the first LimeSDR common parameters
|
||||||
// open the device this will also populate common fields
|
// open the device this will also populate common fields
|
||||||
@ -156,7 +152,7 @@ bool LimeSDROutput::openDevice()
|
|||||||
char serial[256];
|
char serial[256];
|
||||||
strcpy(serial, qPrintable(m_deviceAPI->getSampleSinkSerial()));
|
strcpy(serial, qPrintable(m_deviceAPI->getSampleSinkSerial()));
|
||||||
m_deviceShared.m_deviceParams->open(serial);
|
m_deviceShared.m_deviceParams->open(serial);
|
||||||
m_deviceShared.m_channel = 0; // take first channel
|
m_deviceShared.m_channel = requestedChannel; // acknowledge the requested channel
|
||||||
}
|
}
|
||||||
|
|
||||||
m_deviceAPI->setBuddySharedPtr(&m_deviceShared); // propagate common parameters to API
|
m_deviceAPI->setBuddySharedPtr(&m_deviceShared); // propagate common parameters to API
|
||||||
|
@ -86,6 +86,8 @@ bool LimeSDRInput::openDevice()
|
|||||||
qDebug("LimeSDRInput::openDevice: allocated SampleFifo");
|
qDebug("LimeSDRInput::openDevice: allocated SampleFifo");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int requestedChannel = m_deviceAPI->getItemIndex();
|
||||||
|
|
||||||
// look for Rx buddies and get reference to common parameters
|
// look for Rx buddies and get reference to common parameters
|
||||||
// if there is a channel left take the first available
|
// if there is a channel left take the first available
|
||||||
if (m_deviceAPI->getSourceBuddies().size() > 0) // look source sibling first
|
if (m_deviceAPI->getSourceBuddies().size() > 0) // look source sibling first
|
||||||
@ -116,7 +118,8 @@ bool LimeSDRInput::openDevice()
|
|||||||
qDebug("LimeSDRInput::openDevice: at least one more Rx channel is available in device");
|
qDebug("LimeSDRInput::openDevice: at least one more Rx channel is available in device");
|
||||||
}
|
}
|
||||||
|
|
||||||
// look for unused channel number
|
// check if the requested channel is busy and abort if so (should not happen if device management is working correctly)
|
||||||
|
|
||||||
char *busyChannels = new char[deviceParams->m_nbRxChannels];
|
char *busyChannels = new char[deviceParams->m_nbRxChannels];
|
||||||
memset(busyChannels, 0, deviceParams->m_nbRxChannels);
|
memset(busyChannels, 0, deviceParams->m_nbRxChannels);
|
||||||
|
|
||||||
@ -125,21 +128,14 @@ bool LimeSDRInput::openDevice()
|
|||||||
DeviceSourceAPI *buddy = m_deviceAPI->getSourceBuddies()[i];
|
DeviceSourceAPI *buddy = m_deviceAPI->getSourceBuddies()[i];
|
||||||
DeviceLimeSDRShared *buddyShared = (DeviceLimeSDRShared *) buddy->getBuddySharedPtr();
|
DeviceLimeSDRShared *buddyShared = (DeviceLimeSDRShared *) buddy->getBuddySharedPtr();
|
||||||
|
|
||||||
if (buddyShared->m_channel >= 0) {
|
if (buddyShared->m_channel == requestedChannel)
|
||||||
busyChannels[buddyShared->m_channel] = 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
std::size_t ch = 0;
|
|
||||||
|
|
||||||
for (;ch < deviceParams->m_nbRxChannels; ch++)
|
|
||||||
{
|
{
|
||||||
if (busyChannels[ch] == 0) {
|
qCritical("LimeSDRInput::openDevice: cannot open busy channel %u", requestedChannel);
|
||||||
break; // first available is the good one
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
m_deviceShared.m_channel = ch;
|
m_deviceShared.m_channel = requestedChannel; // acknowledge the requested channel
|
||||||
delete[] busyChannels;
|
delete[] busyChannels;
|
||||||
}
|
}
|
||||||
// look for Tx buddies and get reference to common parameters
|
// look for Tx buddies and get reference to common parameters
|
||||||
@ -161,7 +157,7 @@ bool LimeSDRInput::openDevice()
|
|||||||
qDebug("LimeSDRInput::openDevice: getting device parameters from Tx buddy");
|
qDebug("LimeSDRInput::openDevice: getting device parameters from Tx buddy");
|
||||||
}
|
}
|
||||||
|
|
||||||
m_deviceShared.m_channel = 0; // take first channel
|
m_deviceShared.m_channel = requestedChannel; // acknowledge the requested channel
|
||||||
}
|
}
|
||||||
// There are no buddies then create the first LimeSDR common parameters
|
// There are no buddies then create the first LimeSDR common parameters
|
||||||
// open the device this will also populate common fields
|
// open the device this will also populate common fields
|
||||||
@ -174,7 +170,7 @@ bool LimeSDRInput::openDevice()
|
|||||||
char serial[256];
|
char serial[256];
|
||||||
strcpy(serial, qPrintable(m_deviceAPI->getSampleSourceSerial()));
|
strcpy(serial, qPrintable(m_deviceAPI->getSampleSourceSerial()));
|
||||||
m_deviceShared.m_deviceParams->open(serial);
|
m_deviceShared.m_deviceParams->open(serial);
|
||||||
m_deviceShared.m_channel = 0; // take first channel
|
m_deviceShared.m_channel = requestedChannel; // acknowledge the requested channel
|
||||||
}
|
}
|
||||||
|
|
||||||
m_deviceAPI->setBuddySharedPtr(&m_deviceShared); // propagate common parameters to API
|
m_deviceAPI->setBuddySharedPtr(&m_deviceShared); // propagate common parameters to API
|
||||||
@ -357,6 +353,8 @@ void LimeSDRInput::releaseChannel()
|
|||||||
resumeTxBuddies();
|
resumeTxBuddies();
|
||||||
resumeRxBuddies();
|
resumeRxBuddies();
|
||||||
|
|
||||||
|
// The channel will be effectively released to be reused in another device set only at close time
|
||||||
|
|
||||||
m_channelAcquired = false;
|
m_channelAcquired = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -939,9 +937,10 @@ bool LimeSDRInput::applySettings(const LimeSDRInputSettings& settings, bool forc
|
|||||||
settings.m_antennaPath))
|
settings.m_antennaPath))
|
||||||
{
|
{
|
||||||
doCalibration = true;
|
doCalibration = true;
|
||||||
setAntennaAuto = (settings.m_antennaPath == 0);
|
//setAntennaAuto = (settings.m_antennaPath == 0);
|
||||||
qDebug("LimeSDRInput::applySettings: set antenna path to %d",
|
qDebug("LimeSDRInput::applySettings: set antenna path to %d on channel %d",
|
||||||
(int) settings.m_antennaPath);
|
(int) settings.m_antennaPath,
|
||||||
|
m_deviceShared.m_channel);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user