From 66c15af1113de0e864c5286ea255142b2cd53aca Mon Sep 17 00:00:00 2001 From: FreeArtMan Date: Wed, 7 Oct 2015 20:31:04 +0100 Subject: Added interface for sdr. To manage audio, sdr devices --- TODO | 3 +++ hw/hw.h | 2 ++ hw/make.mk | 2 +- hw/sdr.c | 1 + hw/sdr.h | 61 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 68 insertions(+), 1 deletion(-) create mode 100644 hw/sdr.c create mode 100644 hw/sdr.h 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 #include + + 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 -- cgit v1.2.3