Skip to content

Commit a4f368b

Browse files
committed
Stub plugin for the Mirics dongle
1 parent 5ebd053 commit a4f368b

9 files changed

Lines changed: 194 additions & 1 deletion

File tree

JavaGUI/makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# in the parent directory with the exact same name as the plugin names. The library files
55
# produced need to have the name of the plugin folder and need to be in the bin directory.
66
# The default plugin file will make sure this is compatible.
7-
PLUGINS=TSDRPlugin_RawFile
7+
PLUGINS=TSDRPlugin_RawFile TSDRPlugin_Mirics
88

99
# USER CONFIGURATION ENDS HERE
1010

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
package martin.tempest.sources;
2+
3+
public class TSDRMiricsSource extends TSDRSource {
4+
5+
public TSDRMiricsSource() {
6+
super("Mirics dongle", "TSDRPlugin_Mirics", "", false);
7+
}
8+
9+
}

JavaGUI/src/martin/tempest/sources/TSDRSource.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ public class TSDRSource {
66

77
private final static TSDRSource[] SOURCES = new TSDRSource[] {
88
new TSDRFileSource(""),
9+
new TSDRMiricsSource(),
910
};
1011

1112
public final String libname;

TSDRPlugin_Mirics/.project

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<projectDescription>
3+
<name>TSDRPlugin_Mirics</name>
4+
<comment></comment>
5+
<projects>
6+
</projects>
7+
<buildSpec>
8+
<buildCommand>
9+
<name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
10+
<triggers>clean,full,incremental,</triggers>
11+
<arguments>
12+
</arguments>
13+
</buildCommand>
14+
<buildCommand>
15+
<name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
16+
<triggers>full,incremental,</triggers>
17+
<arguments>
18+
</arguments>
19+
</buildCommand>
20+
</buildSpec>
21+
<natures>
22+
<nature>org.eclipse.cdt.core.cnature</nature>
23+
<nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
24+
<nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
25+
</natures>
26+
</projectDescription>

TSDRPlugin_Mirics/makefile

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
# This makefile should work for all plugins that reside in the root directory of the repository.
2+
# The header file is copied over from the source
3+
PLUGNAME=TSDRPlugin_Mirics
4+
5+
# Dependencies
6+
OBJS=$(PLUGNAME).o
7+
DEPS=TSDRPlugin.h TSDRCodes.h
8+
9+
# END OF CONFIGURATION IF STANDARD DIR STRUCTURE IS USED
10+
11+
# Where the TSDRPlugin.h of the TempestSDR library resides (so it will be copied over)
12+
HEADLOCATION=../TempestSDR/src/include/
13+
14+
# Discover the library extension for each OS
15+
ifeq ($(OS),Windows_NT)
16+
EXT=.dll
17+
OSNAME = WINDOWS
18+
ifeq ($(PROCESSOR_ARCHITECTURE),AMD64)
19+
ARCHNAME = X64
20+
endif
21+
ifeq ($(PROCESSOR_ARCHITECTURE),x86)
22+
ARCHNAME = X86
23+
endif
24+
else
25+
UNAME_S := $(shell uname -s)
26+
ifeq ($(UNAME_S),Linux)
27+
EXT=.so
28+
OSNAME = LINUX
29+
endif
30+
ifeq ($(UNAME_S),Darwin)
31+
EXT=.a
32+
OSNAME = OSX
33+
endif
34+
UNAME_P := $(shell uname -p)
35+
ifeq ($(UNAME_P),x86_64)
36+
ARCHNAME = X64
37+
endif
38+
ifneq ($(filter %86,$(UNAME_P)),)
39+
ARCHNAME = X86
40+
endif
41+
ifneq ($(filter arm%,$(UNAME_P)),)
42+
ARCHNAME = ARM
43+
endif
44+
endif
45+
46+
# If you need a different directory structure. Don't change that unless you really want to.
47+
SOURCEFOLDER=src
48+
OUTPUTFOLDER=bin/$(OSNAME)/$(ARCHNAME)
49+
OBJFOLDER=obj
50+
51+
# Flags
52+
CPPFLAGS=-O3
53+
54+
# Calculate the path to dependencies
55+
_OBJS = $(patsubst %,$(OBJFOLDER)/%,$(OBJS))
56+
_DEPS = $(patsubst %,$(SOURCEFOLDER)/%,$(DEPS))
57+
58+
# Generate the library
59+
all : $(OUTPUTFOLDER)/$(PLUGNAME)$(EXT)
60+
61+
# Copy over a fresh version of the TSDRPlugin.h
62+
copyoverheaderfile:
63+
@cp -f $(HEADLOCATION)/TSDRPlugin.h $(SOURCEFOLDER)/
64+
@cp -f $(HEADLOCATION)/TSDRCodes.h $(SOURCEFOLDER)/
65+
66+
# Link
67+
$(OUTPUTFOLDER)/$(PLUGNAME)$(EXT): copyoverheaderfile $(_OBJS)
68+
gcc -Wl,--add-stdcall-alias -shared -o $@ $(_OBJS)
69+
70+
# Make dirs and compile
71+
$(OBJFOLDER)/%.o : $(SOURCEFOLDER)/%.c $(_DEPS)
72+
mkdir -p $(OUTPUTFOLDER)
73+
mkdir -p $(OBJFOLDER)
74+
gcc $(foreach d, $(INC), -I$d) $(CFLAGS) -c $< -o $@
75+
76+
.PHONY: clean
77+
78+
# Clean artifacts
79+
clean :
80+
rm -f $(OBJFOLDER)/*.o $(OUTPUTFOLDER)/*.*

TSDRPlugin_Mirics/src/TSDRCodes.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#ifndef _TSDRCodes
2+
#define _TSDRCodes
3+
4+
#define TSDR_OK (0)
5+
#define TSDR_ERR_PLUGIN (1)
6+
#define TSDR_WRONG_VIDEOPARAMS (2)
7+
#define TSDR_ALREADY_RUNNING (3)
8+
#define TSDR_PLUGIN_PARAMETERS_WRONG (4)
9+
#define TSDR_SAMPLE_RATE_WRONG (5)
10+
#define TSDR_NOT_IMPLEMENTED (404)
11+
12+
#endif

TSDRPlugin_Mirics/src/TSDRPlugin.h

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#ifndef _TSDRPluginHeader
2+
#define _TSDRPluginHeader
3+
4+
#include <stdint.h>
5+
6+
typedef void(*tsdrplugin_readasync_function)(float *buf, uint32_t len, void *ctx);
7+
8+
void tsdrplugin_getName(char *);
9+
int tsdrplugin_setParams(const char * params);
10+
uint32_t tsdrplugin_setsamplerate(uint32_t rate);
11+
uint32_t tsdrplugin_getsamplerate();
12+
int tsdrplugin_setbasefreq(uint32_t freq);
13+
int tsdrplugin_stop(void);
14+
int tsdrplugin_setgain(float gain);
15+
int tsdrplugin_readasync(tsdrplugin_readasync_function cb, void *ctx);
16+
17+
#endif
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
#include <stdio.h>
2+
#include <string.h>
3+
4+
#include "TSDRPlugin.h"
5+
#include "TSDRCodes.h"
6+
7+
#include <stdint.h>
8+
9+
void tsdrplugin_getName(char * name) {
10+
strcpy(name, "TSDR Mirics SDR Plugin");
11+
}
12+
13+
uint32_t tsdrplugin_setsamplerate(uint32_t rate) {
14+
printf("Mirics setsamplerate %d\n", rate);
15+
return TSDR_NOT_IMPLEMENTED;
16+
}
17+
18+
uint32_t tsdrplugin_getsamplerate() {
19+
printf("Mirics getsamplerate\n");
20+
return TSDR_NOT_IMPLEMENTED;
21+
}
22+
23+
int tsdrplugin_setbasefreq(uint32_t freq) {
24+
printf("Mirics setbasefreq %d\n", freq);
25+
return TSDR_NOT_IMPLEMENTED;
26+
}
27+
28+
int tsdrplugin_stop(void) {
29+
printf("Mirics stop\n");
30+
return TSDR_NOT_IMPLEMENTED;
31+
}
32+
33+
int tsdrplugin_setgain(float gain) {
34+
printf("Mirics setgain %.4f\n", gain);
35+
return TSDR_NOT_IMPLEMENTED;
36+
}
37+
38+
int tsdrplugin_setParams(const char * params) {
39+
printf("Mirics setParams %s\n", params);
40+
return TSDR_NOT_IMPLEMENTED;
41+
}
42+
43+
int tsdrplugin_readasync(tsdrplugin_readasync_function cb, void *ctx) {
44+
printf("Mirics Readasync\n");
45+
return TSDR_NOT_IMPLEMENTED;
46+
}

makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,13 @@
33
# Make all
44
all :
55
@$(MAKE) -C TSDRPlugin_RawFile/ all JAVA_HOME=$(JAVA_HOME)
6+
@$(MAKE) -C TSDRPlugin_Mirics/ all
67
@$(MAKE) -C TempestSDR/ all
78
@$(MAKE) -C JavaGUI/ all
89

910
# Clean artifacts
1011
clean :
1112
@$(MAKE) -C TSDRPlugin_RawFile/ clean
13+
@$(MAKE) -C TSDRPlugin_Mirics/ clean
1214
@$(MAKE) -C TempestSDR/ clean
1315
@$(MAKE) -C JavaGUI/ clean

0 commit comments

Comments
 (0)