Skip to content

Commit

Permalink
Update libbladerf + minor fix
Browse files Browse the repository at this point in the history
- Updated the lib + tools to the latest version now that it is stable
- Fixed a potential race condition
  • Loading branch information
jmichelp committed Apr 5, 2015
1 parent 265da44 commit 3ded366
Show file tree
Hide file tree
Showing 20 changed files with 25 additions and 2 deletions.
13 changes: 13 additions & 0 deletions BladeRF/BladeRFDevice.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ public sealed class BladeRFDevice : IDisposable
private double _sampleRate = DefaultSamplerate;
private int _bandwidth;
private bool _isFpgaLoaded = false;
private bool _RXConfigured = false;
private string _fpga_path = Utils.GetStringSetting("BladeRFFPGA", "");
private bladerf_lna_gain _lnaGain = (bladerf_lna_gain)Utils.GetIntSetting("BladeRFLNAGain", (int) bladerf_lna_gain.BLADERF_LNA_GAIN_MID);
private int _vga1Gain = Utils.GetIntSetting("BladeRFRXVGA1Gain", 20);
Expand Down Expand Up @@ -398,6 +399,10 @@ private unsafe void ReceiveSamples_sync()
}
if ((status = NativeMethods.bladerf_sync_config(_dev, bladerf_module.BLADERF_MODULE_RX, bladerf_format.BLADERF_FORMAT_SC16_Q11, NumBuffers, cur_len, NumBuffers / 2, SampleTimeoutMs)) != 0)
_isStreaming = false;
lock(syncLock)
{
_RXConfigured = true;
}
while (status == 0 && cur_len == new_len)
{
try
Expand Down Expand Up @@ -567,6 +572,14 @@ public unsafe void Start()
_sampleThread.Priority = ThreadPriority.Highest;
_isStreaming = true;
_sampleThread.Start();
bool ready = false;
while (!ready)
{
lock (syncLock)
{
ready = _RXConfigured;
}
}
if ((error = NativeMethods.bladerf_enable_module(_dev, bladerf_module.BLADERF_MODULE_RX, 1)) != 0)
throw new ApplicationException(String.Format("bladerf_enable_module() error. {0}", NativeMethods.bladerf_strerror(error)));
}
Expand Down
10 changes: 9 additions & 1 deletion BladeRF/NativeMethods.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ public enum bladerf_error_codes
BLADERF_ERR_CHECKSUM = -10, /**< Invalid checksum */
BLADERF_ERR_NO_FILE = -11, /**< File not found */
BLADERF_ERR_UPDATE_FPGA = -12, /**< An FPGA update is required */
BLADERF_ERR_UPDATE_FW = -13 /**< A firmware update is requied */
BLADERF_ERR_UPDATE_FW = -13, /**< A firmware update is requied */
BLADERF_ERR_TIME_PAST = -14 /**< Requested timestamp is in the past */
}

public enum bladerf_module
Expand Down Expand Up @@ -162,6 +163,7 @@ public enum bladerf_correction
public enum bladerf_format
{
BLADERF_FORMAT_SC16_Q11 = 0, /**< Signed, Complex 16-bit Q11.*/
BLADERF_FORMAT_SC16_Q11_META = 1
}

public enum bladerf_xb
Expand Down Expand Up @@ -192,6 +194,12 @@ public enum bladerf_log_level
BLADERF_LOG_LEVEL_CRITICAL = 5, /**< Fatal error level logging */
BLADERF_LOG_LEVEL_SILENT = 6 /**< No output */
}

public enum bladerf_xb200_path
{
BLADERF_XB200_BYPASS = 0, /**< Bypass the XB-200 mixer */
BLADERF_XB200_MIX = 1 /**< Pass signals through the XB-200 mixer */
}
#endregion

#region Internal structs
Expand Down
4 changes: 3 additions & 1 deletion BladeRF/SDRSharp.BladeRF.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,9 @@
<WCFMetadata Include="Service References\" />
</ItemGroup>
<ItemGroup>
<None Include="SDRSharp.BaldeRF.dll.manifest" />
<None Include="SDRSharp.BaldeRF.dll.manifest">
<SubType>Designer</SubType>
</None>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Expand Down
Binary file modified LibBladeRF/bladeRF-cli.exe
Binary file not shown.
Binary file modified LibBladeRF/bladeRF.dll
Binary file not shown.
Binary file modified LibBladeRF/libbladeRF_test_async.exe
Binary file not shown.
Binary file modified LibBladeRF/libbladeRF_test_bootloader_recovery.exe
Binary file not shown.
Binary file modified LibBladeRF/libbladeRF_test_c.exe
Binary file not shown.
Binary file modified LibBladeRF/libbladeRF_test_cpp.exe
Binary file not shown.
Binary file modified LibBladeRF/libbladeRF_test_ctrl.exe
Binary file not shown.
Binary file modified LibBladeRF/libbladeRF_test_freq_hop.exe
Binary file not shown.
Binary file modified LibBladeRF/libbladeRF_test_fw_check.exe
Binary file not shown.
Binary file modified LibBladeRF/libbladeRF_test_open.exe
Binary file not shown.
Binary file modified LibBladeRF/libbladeRF_test_repeater.exe
Binary file not shown.
Binary file modified LibBladeRF/libbladeRF_test_rx_discont.exe
Binary file not shown.
Binary file modified LibBladeRF/libbladeRF_test_sync.exe
Binary file not shown.
Binary file modified LibBladeRF/libbladeRF_test_timestamps.exe
Binary file not shown.
Binary file modified LibBladeRF/libbladeRF_test_unused_sync.exe
Binary file not shown.
Binary file modified Release/SDRSharp.BladeRF.dll
Binary file not shown.
Binary file modified SDRSharp.BladeRF.v11.suo
Binary file not shown.

0 comments on commit 3ded366

Please sign in to comment.