mirror of
https://github.com/f4exb/sdrangel.git
synced 2025-04-10 21:50:10 -04:00
Open FCD.
This commit is contained in:
parent
beda489261
commit
46dcbe6db7
@ -5,6 +5,8 @@ For Ubuntu:
|
||||
|
||||
"librtlsdr-dev" is in the "universe" repo. (utopic 14.10 amd64.)
|
||||
|
||||
Funcube Dongle Pro+ support needs package "libasound2-dev"
|
||||
|
||||
Use "cmake ../ -DKERNEL=ON" to build the Linux kernel driver (Experimental). Needs a recent kernel and libv4l2. Will need extra work to support Airspy and Hackrf. Needs "cp KERNEL_SOURCE/include/linux/compiler.h /usr/include/linux/" and "cp KERNEL_SOURCE/include/uapi/linux/videodev2.h /usr/include/uapi/linux/" and package "libv4l-dev".
|
||||
|
||||
The Gnuradio plugin source needs extra packages, including "liblog4cpp-dev libboost-system-dev gnuradio-dev libosmosdr-dev"
|
||||
|
@ -18,6 +18,10 @@ else()
|
||||
endif()
|
||||
|
||||
if(LIBUSB_FOUND AND UNIX)
|
||||
FIND_PATH (ASOUNDH alsa/asoundlib.h)
|
||||
FIND_LIBRARY (LIBASOUND asound)
|
||||
endif()
|
||||
if(LIBASOUND AND ASOUNDH)
|
||||
add_subdirectory(fcd)
|
||||
endif()
|
||||
|
||||
|
@ -13,7 +13,6 @@ set(rtlsdr_HEADERS
|
||||
fcdinput.h
|
||||
fcdplugin.h
|
||||
fcdthread.h
|
||||
fcdsource.h
|
||||
)
|
||||
|
||||
set(fcd_FORMS
|
||||
@ -43,6 +42,7 @@ add_library(inputfcd SHARED
|
||||
|
||||
target_link_libraries(inputfcd
|
||||
${QT_LIBRARIES}
|
||||
asound
|
||||
sdrbase
|
||||
)
|
||||
|
||||
|
@ -0,0 +1,48 @@
|
||||
/* (C)2015 John Greb
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public Licence version 3.
|
||||
*/
|
||||
|
||||
#include "fcdthread.h"
|
||||
|
||||
bool FCDThread::OpenSource(const char* cardname)
|
||||
{
|
||||
//fcd_rate = FCDPP_RATE;
|
||||
//fcd_channels =2;
|
||||
//fcd_format = SND_PCM_SFMT_U16_LE;
|
||||
fcd_stream = SND_PCM_STREAM_PLAYBACK;
|
||||
|
||||
if (fcd_handle)
|
||||
return false;
|
||||
if ( snd_pcm_open( &fcd_handle, cardname, fcd_stream, 1 ) < 0 )
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void FCDThread::CloseSource()
|
||||
{
|
||||
if (fcd_handle)
|
||||
snd_pcm_close( fcd_handle );
|
||||
fcd_handle = NULL;
|
||||
}
|
||||
|
||||
void FCDThread::set_center_freq(double freq)
|
||||
{
|
||||
//TODO
|
||||
}
|
||||
|
||||
void FCDThread::work(int n_items)
|
||||
{
|
||||
int l;
|
||||
SampleVector::iterator it;
|
||||
void *out;
|
||||
|
||||
it = m_convertBuffer.begin();
|
||||
out = (void *)&it[0];
|
||||
l = snd_pcm_readi(fcd_handle, out, (snd_pcm_uframes_t)n_items);
|
||||
if (l > 0)
|
||||
m_sampleFifo->write(it, it + l);
|
||||
}
|
||||
|
||||
|
@ -42,8 +42,7 @@ void FCDThread::stopWork()
|
||||
void FCDThread::run()
|
||||
{
|
||||
m_running = true;
|
||||
OpenSource("/dev/dsp");
|
||||
if (fd < 0)
|
||||
if ( !OpenSource("hw:CARD=V20") )
|
||||
return;
|
||||
|
||||
while(m_running) {
|
||||
|
@ -23,8 +23,9 @@
|
||||
#include <QWaitCondition>
|
||||
#include "dsp/samplefifo.h"
|
||||
#include "dsp/inthalfbandfilter.h"
|
||||
#include <alsa/asoundlib.h>
|
||||
|
||||
#define SAMPLERATE 192000
|
||||
#define FCDPP_RATE 192000
|
||||
#define BLOCKSIZE 8192
|
||||
|
||||
class FCDThread : public QThread {
|
||||
@ -35,17 +36,14 @@ public:
|
||||
~FCDThread();
|
||||
|
||||
void stopWork();
|
||||
void OpenSource(const char *filename);
|
||||
bool OpenSource(const char *filename);
|
||||
void CloseSource();
|
||||
void set_center_freq(double freq);
|
||||
int work(int n_items);
|
||||
void work(int n_items);
|
||||
private:
|
||||
int fd;
|
||||
struct fcd_buffer *buffers;
|
||||
unsigned int n_buffers;
|
||||
void *recebuf_ptr;
|
||||
unsigned int recebuf_len;
|
||||
unsigned int recebuf_mmap_index;
|
||||
snd_pcm_format_t fcd_format;
|
||||
snd_pcm_t* fcd_handle = NULL;
|
||||
snd_pcm_stream_t fcd_stream;
|
||||
|
||||
QMutex m_startWaitMutex;
|
||||
QWaitCondition m_startWaiter;
|
||||
|
@ -13,7 +13,6 @@ set(rtlsdr_HEADERS
|
||||
v4linput.h
|
||||
v4lplugin.h
|
||||
v4lthread.h
|
||||
v4lsource.h
|
||||
)
|
||||
|
||||
set(v4l_FORMS
|
||||
|
Loading…
Reference in New Issue
Block a user