diff options
author | FreeArtMan <=> | 2015-09-22 20:16:47 +0100 |
---|---|---|
committer | FreeArtMan <=> | 2015-09-22 20:16:47 +0100 |
commit | fa74c1448e236995a34d767a6e76c3055698fb60 (patch) | |
tree | 0ec6553d3c73112e0ea458c22c614ed10f5b2246 | |
parent | 8adda9187304d8f06f907bfebc93e47207fa4796 (diff) | |
download | radiola-fa74c1448e236995a34d767a6e76c3055698fb60.tar.gz radiola-fa74c1448e236995a34d767a6e76c3055698fb60.zip |
Wrapped rtlsdr to hw
-rw-r--r-- | Makefile | 19 | ||||
-rw-r--r-- | TODO | 4 | ||||
-rw-r--r-- | draw/glui.c | 0 | ||||
-rw-r--r-- | draw/glui.h | 0 | ||||
-rw-r--r-- | draw/make.mk | 0 | ||||
-rw-r--r-- | draw/tui.c | 0 | ||||
-rw-r--r-- | draw/tui.h | 0 | ||||
-rw-r--r-- | draw/ui.c | 0 | ||||
-rw-r--r-- | draw/ui.h | 0 | ||||
-rw-r--r-- | hw/hw.c | 285 | ||||
-rw-r--r-- | hw/hw.h | 62 | ||||
-rw-r--r-- | hw/make.mk | 10 | ||||
-rw-r--r-- | radiola.c | 2 | ||||
-rw-r--r-- | test/Makefile | 19 |
14 files changed, 391 insertions, 10 deletions
@@ -3,6 +3,21 @@ CC=gcc CFLAGS= LDFLAGS= +BUILD_DIR=build/ -make: - $(CC) radiola.c -o $(PROJECT) +SOURCES= +OBJECTS= +OBJECTS_FINAL= + + + +include hw/make.mk + +make: $(OBJECTS) + $(CC) $(OBJECTS_FINAL) $(PROJECT).c -o $(PROJECT) $(LDFLAGS) + +%.o: %.c + $(CC) $(CFLAGS) $(INCLUDE) -c $< -o $(BUILD_DIR)$@ + +clean: + rm -f $(PROJECT) @@ -21,4 +21,6 @@ am demod [AUDIO] play sound - stream sound to web
\ No newline at end of file + stream sound to web + +rtlsdr? no dithering? in with brain it is?
\ No newline at end of file diff --git a/draw/glui.c b/draw/glui.c new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/draw/glui.c diff --git a/draw/glui.h b/draw/glui.h new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/draw/glui.h diff --git a/draw/make.mk b/draw/make.mk new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/draw/make.mk diff --git a/draw/tui.c b/draw/tui.c new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/draw/tui.c diff --git a/draw/tui.h b/draw/tui.h new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/draw/tui.h diff --git a/draw/ui.c b/draw/ui.c new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/draw/ui.c diff --git a/draw/ui.h b/draw/ui.h new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/draw/ui.h @@ -0,0 +1,285 @@ +#include "hw.h" + +uint32_t hw_get_device_count(void) +{ + uint32_t ret; + ret = rtlsdr_get_device_count(); + return ret; +} + + +const char* hw_get_device_name(uint32_t index) +{ + const char *ret; + ret = rtlsdr_get_device_name( index ); + return ret; +} + + +int hw_get_device_usb_strings(uint32_t index, + char *manufact, + char *product, + char *serial) +{ + int ret; + ret = rtlsdr_get_device_usb_strings( index, manufact, product, serial ); + return ret; +} + + +int hw_get_index_by_serial(const char *serial) +{ + int ret; + rtlsdr_get_index_by_serial( serial ); + return ret; +} + + +int hw_open(rtlsdr_dev_t **dev, uint32_t index) +{ + int ret; + ret = rtlsdr_open( dev, index ); + return ret; +} + + +int hw_close(rtlsdr_dev_t *dev) +{ + int ret; + ret = rtlsdr_close( dev ); + return ret; +} + + +int hw_set_xtal_freq(rtlsdr_dev_t *dev, uint32_t rtl_freq, + uint32_t tuner_freq) +{ + int ret; + ret = rtlsdr_set_xtal_freq( dev, rtl_freq, tuner_freq ); + return ret; +} + + +int hw_get_xtal_freq(rtlsdr_dev_t *dev, uint32_t *rtl_freq, + uint32_t *tuner_freq) +{ + int ret; + ret = rtlsdr_get_xtal_freq( dev, rtl_freq, tuner_freq ); + return ret; +} + + +int hw_get_usb_strings(rtlsdr_dev_t *dev, char *manufact, + char *product, char *serial) +{ + int ret; + ret = rtlsdr_get_usb_strings( dev, manufact, product, serial ); + return ret; +} + + +int hw_write_eeprom(rtlsdr_dev_t *dev, uint8_t *data, + uint8_t offset, uint16_t len) +{ + int ret; + ret = rtlsdr_write_eeprom( dev, data, offset, len ); + return ret; +} + + +int hw_read_eeprom(rtlsdr_dev_t *dev, uint8_t *data, + uint8_t offset, uint16_t len) +{ + int ret; + ret = rtlsdr_read_eeprom( dev, data, offset, len ); + return ret; +} + + +int hw_set_center_freq(rtlsdr_dev_t *dev, uint32_t freq) +{ + int ret; + ret = rtlsdr_set_center_freq( dev, freq ); + return ret; +} + + +uint32_t hw_get_center_freq(rtlsdr_dev_t *dev) +{ + uint32_t ret; + ret = rtlsdr_get_center_freq( dev ); + return ret; +} + + +int hw_set_freq_correction(rtlsdr_dev_t *dev, int ppm) +{ + int ret; + ret = rtlsdr_set_freq_correction( dev, ppm ); + return ret; +} + + +int hw_get_freq_correction(rtlsdr_dev_t *dev) +{ + int ret; + ret = rtlsdr_get_freq_correction( dev ); + return ret; +} + + +enum rtlsdr_tuner hw_get_tuner_type(rtlsdr_dev_t *dev) +{ + enum rtlsdr_tuner ret; + ret = rtlsdr_get_tuner_type( dev ); + return ret; +} + + +int hw_get_tuner_gains(rtlsdr_dev_t *dev, int *gains) +{ + int ret; + ret = rtlsdr_get_tuner_gains( dev, gains ); + return ret; +} + + +int hw_set_tuner_gain(rtlsdr_dev_t *dev, int gain) +{ + int ret; + ret = rtlsdr_set_tuner_gain( dev, gain ); + return ret; +} + + +int hw_get_tuner_gain(rtlsdr_dev_t *dev) +{ + int ret; + ret = rtlsdr_get_tuner_gain( dev ); + return ret; +} + + +int hw_set_tuner_if_gain(rtlsdr_dev_t *dev, int stage, int gain) +{ + int ret; + ret = rtlsdr_set_tuner_if_gain( dev, stage, gain ); + return ret; +} + + +int hw_set_tuner_gain_mode(rtlsdr_dev_t *dev, int manual) +{ + int ret; + ret = rtlsdr_set_tuner_gain_mode( dev, manual ); + return ret; +} + + +int hw_set_sample_rate(rtlsdr_dev_t *dev, uint32_t rate) +{ + int ret; + ret = rtlsdr_set_sample_rate( dev, rate ); + return ret; +} + + +uint32_t hw_get_sample_rate(rtlsdr_dev_t *dev) +{ + uint32_t ret; + ret = rtlsdr_get_sample_rate( dev ); + return ret; +} + + +int hw_set_testmode(rtlsdr_dev_t *dev, int on) +{ + int ret; + ret = rtlsdr_set_testmode( dev, on ); + return ret; +} + + +int hw_set_agc_mode(rtlsdr_dev_t *dev, int on) +{ + int ret; + ret = rtlsdr_set_agc_mode( dev, on ); + return ret; +} + + +int hw_set_direct_sampling(rtlsdr_dev_t *dev, int on) +{ + int ret; + ret = rtlsdr_set_direct_sampling( dev, on ); + return ret; +} + + +int hw_get_direct_sampling(rtlsdr_dev_t *dev) +{ + int ret; + ret = rtlsdr_get_direct_sampling( dev ); + return ret; +} + + +int hw_set_offset_tuning(rtlsdr_dev_t *dev, int on) +{ + int ret; + ret = rtlsdr_set_offset_tuning( dev, on ); + return ret; +} + + +int hw_get_offset_tuning(rtlsdr_dev_t *dev) +{ + int ret; + ret = rtlsdr_get_offset_tuning( dev ); + return ret; +} + + + +int hw_reset_buffer(rtlsdr_dev_t *dev) +{ + int ret; + ret = rtlsdr_reset_buffer( dev ); + return ret; +} + + +int hw_read_sync(rtlsdr_dev_t *dev, void *buf, int len, int *n_read) +{ + int ret; + ret = rtlsdr_read_sync( dev, buf, len, n_read ); + return ret; +} + + +int hw_wait_async(rtlsdr_dev_t *dev, rtlsdr_read_async_cb_t cb, void *ctx) +{ + int ret; + ret = rtlsdr_wait_async( dev, cb, ctx ); + return ret; +} + + +int hw_read_async(rtlsdr_dev_t *dev, + rtlsdr_read_async_cb_t cb, + void *ctx, + uint32_t buf_num, + uint32_t buf_len) +{ + int ret; + ret = rtlsdr_read_async( dev, cb, ctx, buf_num, buf_len ); + return ret; +} + + +int hw_cancel_async(rtlsdr_dev_t *dev) +{ + int ret; + ret = rtlsdr_cancel_async( dev ); + return ret; +}
\ No newline at end of file @@ -0,0 +1,62 @@ +#ifndef __RADIOLA_HW_H +#define __RADIOLA_HW_H + +#include <stdio.h> +#include <stdlib.h> + +//#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, + char *manufact, + char *product, + char *serial); +int hw_get_index_by_serial(const char *serial); +int hw_open(rtlsdr_dev_t **dev, uint32_t index); +int hw_close(rtlsdr_dev_t *dev); +int hw_set_xtal_freq(rtlsdr_dev_t *dev, uint32_t rtl_freq, + uint32_t tuner_freq); +int hw_get_xtal_freq(rtlsdr_dev_t *dev, uint32_t *rtl_freq, + uint32_t *tuner_freq); +int hw_get_usb_strings(rtlsdr_dev_t *dev, char *manufact, + char *product, char *serial); +int hw_write_eeprom(rtlsdr_dev_t *dev, uint8_t *data, + uint8_t offset, uint16_t len); +int hw_read_eeprom(rtlsdr_dev_t *dev, uint8_t *data, + uint8_t offset, uint16_t len); +int hw_set_center_freq(rtlsdr_dev_t *dev, uint32_t freq); +uint32_t hw_get_center_freq(rtlsdr_dev_t *dev); +int hw_set_freq_correction(rtlsdr_dev_t *dev, int ppm); +int hw_get_freq_correction(rtlsdr_dev_t *dev); +enum rtlsdr_tuner hw_get_tuner_type(rtlsdr_dev_t *dev); +int hw_get_tuner_gains(rtlsdr_dev_t *dev, int *gains); +int hw_set_tuner_gain(rtlsdr_dev_t *dev, int gain); +int hw_get_tuner_gain(rtlsdr_dev_t *dev); +int hw_set_tuner_if_gain(rtlsdr_dev_t *dev, int stage, int gain); +int hw_set_tuner_gain_mode(rtlsdr_dev_t *dev, int manual); +int hw_set_sample_rate(rtlsdr_dev_t *dev, uint32_t rate); +uint32_t hw_get_sample_rate(rtlsdr_dev_t *dev); +int hw_set_testmode(rtlsdr_dev_t *dev, int on); +int hw_set_agc_mode(rtlsdr_dev_t *dev, int on); +int hw_set_direct_sampling(rtlsdr_dev_t *dev, int on); +int hw_get_direct_sampling(rtlsdr_dev_t *dev); +int hw_set_offset_tuning(rtlsdr_dev_t *dev, int on); +int hw_get_offset_tuning(rtlsdr_dev_t *dev); +int hw_reset_buffer(rtlsdr_dev_t *dev); +int hw_read_sync(rtlsdr_dev_t *dev, void *buf, int len, int *n_read); +int hw_wait_async(rtlsdr_dev_t *dev, rtlsdr_read_async_cb_t cb, void *ctx); +int hw_read_async(rtlsdr_dev_t *dev, + rtlsdr_read_async_cb_t cb, + void *ctx, + uint32_t buf_num, + uint32_t buf_len); +int hw_cancel_async(rtlsdr_dev_t *dev); + + + + + + +#endif
\ No newline at end of file diff --git a/hw/make.mk b/hw/make.mk new file mode 100644 index 0000000..534a7f5 --- /dev/null +++ b/hw/make.mk @@ -0,0 +1,10 @@ +DIR_HW = hw/ +SOURCES_HW += hw/hw.c +OBJECTS_HW += $(SOURCES_HW:.c=.o) +LDFLAGS += -lrtlsdr + + +OBJECTS_DIR_HW += $(subst $(DIR_HW),$(BUILD_DIR)$(DIR_HW),$(OBJECTS_HW)) + +OBJECTS += $(OBJECTS_HW) +OBJECTS_FINAL += $(OBJECTS_DIR_HW)
\ No newline at end of file @@ -1,6 +1,8 @@ #include <stdio.h> #include <stdlib.h> +#include "hw/hw.h" + int main() { return 0; diff --git a/test/Makefile b/test/Makefile index 8e36d37..5ee5a91 100644 --- a/test/Makefile +++ b/test/Makefile @@ -1,15 +1,20 @@ CC=gcc -CFLAGS=-I../../r820t/include -LDFLAGS= `pkg-config --libs libusb` -L../../../r820t -lr820t -Wl,-rpath=../../../r820t - -SOURCE += $(wildcard *.c) +CFLAGS= +#LDFLAGS= `pkg-config --libs libusb` -L../../../r820t -lr820t -Wl,-rpath=../../../r820t +LDFLAGS=`pkg-config --libs libusb` -lrtlsdr +SOURCE = $(wildcard *.c) +OBJECTS = BIN = $(SOURCE:.c=) -make: $(BIN) - @echo $< %: %.c - $(CC) $(LDFLAGS) $(CFLAGS) $< -o $@ + $(CC) $(LDFLAGS) $(CFLAGS) $< -o $@ + +%.o: %.c + $(CC) $(CFLAGS) $(INCLUDE) -c $< -o $(BUILD_DIR)$@ + +make: $(BIN) + clean: rm -f $(BIN)
\ No newline at end of file |