aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFreeArtMan <dos21h@gmail.com>2015-10-07 20:31:04 +0100
committerFreeArtMan <dos21h@gmail.com>2015-10-07 20:31:04 +0100
commit66c15af1113de0e864c5286ea255142b2cd53aca (patch)
tree6f3b3424ddea373d569bf140c2730804a4252df4
parente1fd164e62c2dfbd08d0d4699a723cace40d0e8c (diff)
downloadradiola-66c15af1113de0e864c5286ea255142b2cd53aca.tar.gz
radiola-66c15af1113de0e864c5286ea255142b2cd53aca.zip
Added interface for sdr. To manage audio, sdr devices
-rw-r--r--TODO3
-rw-r--r--hw/hw.h2
-rw-r--r--hw/make.mk2
-rw-r--r--hw/sdr.c1
-rw-r--r--hw/sdr.h61
5 files changed, 68 insertions, 1 deletions
diff --git a/TODO b/TODO
index acc380e..ec8756a 100644
--- a/TODO
+++ b/TODO
@@ -4,6 +4,9 @@
config frequency
choose device
read samples
+ add device naming
+ add reading/writing eeprom
+ add special setting setting in eeprom
[FILTER]
basic bandpass filter
[DRAW]
diff --git a/hw/hw.h b/hw/hw.h
index 69b943c..ac79431 100644
--- a/hw/hw.h
+++ b/hw/hw.h
@@ -7,6 +7,8 @@
//#include <r820t.h>
#include <rtl-sdr.h>
+
+
uint32_t hw_get_device_count(void);
const char* hw_get_device_name(uint32_t index);
int hw_get_device_usb_strings(uint32_t index,
diff --git a/hw/make.mk b/hw/make.mk
index a6b55e3..67860a2 100644
--- a/hw/make.mk
+++ b/hw/make.mk
@@ -1,5 +1,5 @@
DIR_HW = hw/
-SOURCES_HW += hw/aud.c hw/hw.c hw/hw_eeprom.c
+SOURCES_HW += hw/aud.c hw/hw.c hw/hw_eeprom.c hw/sdr.c
OBJECTS_HW += $(SOURCES_HW:.c=.o)
LDFLAGS += -lrtlsdr -lasound
diff --git a/hw/sdr.c b/hw/sdr.c
new file mode 100644
index 0000000..05084b2
--- /dev/null
+++ b/hw/sdr.c
@@ -0,0 +1 @@
+#include "sdr.h" \ No newline at end of file
diff --git a/hw/sdr.h b/hw/sdr.h
new file mode 100644
index 0000000..81ec57f
--- /dev/null
+++ b/hw/sdr.h
@@ -0,0 +1,61 @@
+#ifndef __RADIOLA_HW_SDR_H
+#define __RADIOLA_HW_SDR_H
+
+#include "hw.h"
+
+typedef enum
+{
+ DEVICE_NONE=0,
+ DEVICE_RTLSDR,
+ DEVICE_AUDIO,
+ DEVICE_NET,
+ DEVICE_PTT
+} sdr_device;
+
+
+typedef struct dongle_t
+{
+ rtlsdr_dev_t *dev;
+ int dev_index;
+ uint32_t freq;
+ uint32_t rate;
+ int gain;
+} dongle_t;
+
+
+typedef struct audio_t
+{
+} audio_t;
+
+
+typedef struct sdr_t
+{
+ sdr_device dev_type;
+ dongle_t *dongle;
+ uint32_t d_used;
+ audio_t *audio;
+ uint32_t a_used;
+} sdr_t;
+
+//index of device in oter list
+//return inner device list
+int sdr_open_device( sdr_t *sdr, int dev_index );
+//get index in list of devices of structure from outer device index
+//? do we need?
+//int sdr_get_dongle_idx( sdr_t *sdr, int idx );
+//close device by internal list index
+int sdr_close_device( sdr_t *sdr, int idx );
+
+int dongle_stop( sdr_t *sdr, int idx );
+//int dongle_open( sdr_t *);
+int dongle_set_freq( sdr_t *sdr, int idx, uint32_t freq);
+int dongle_set_gain( sdr_t *sdr, int idx, int gain);
+int dongle_set_sample_rate( sdr_t *sdr, int idx, uint32_t srate );
+
+uint32_t dongle_get_freq( sdr_t *sdr, int idx );
+int dongle_get_gain( sdr_t *sdr, int idx);
+uint32_t dongle_get_sample_rate( sdr_t *sdr, int idx );
+int dongle_get_samples( sdr_t *sdr, int idx, uint8_t *buf, int len );
+//int dongle_close();
+
+#endif \ No newline at end of file