summaryrefslogtreecommitdiff
path: root/sdr-test-project
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2011-12-29 23:31:37 +0100
committerHarald Welte <laforge@gnumonks.org>2011-12-29 23:31:37 +0100
commitbf24be23dac6398afeb3f3315ad0e5dad62f5c6e (patch)
tree7933cae06749ee55738395a66e3d0c109675923e /sdr-test-project
parent7ea4c0412bc6305bc59f95526a0fa6259874c658 (diff)
extend test to a point where we can tune to FM radio
Diffstat (limited to 'sdr-test-project')
-rw-r--r--sdr-test-project/Makefile6
-rw-r--r--sdr-test-project/main.c38
2 files changed, 37 insertions, 7 deletions
diff --git a/sdr-test-project/Makefile b/sdr-test-project/Makefile
index feb5c35..7072572 100644
--- a/sdr-test-project/Makefile
+++ b/sdr-test-project/Makefile
@@ -74,7 +74,7 @@ OBJ = obj
#-------------------------------------------------------------------------------
# Tool suffix when cross-compiling
-CROSS_COMPILE = arm-none-eabi-
+CROSS_COMPILE = arm-cm3-eabi-
# Compilation tools
CC = $(CROSS_COMPILE)gcc
@@ -119,7 +119,6 @@ DRIVER = $(AT91LIB)/drivers
MEM = $(AT91LIB)/memories
MEM = $(EXT_LIBS)/memories
-VPATH += $(COMP)/codec-wm8731
VPATH += $(UTILITY)
VPATH += $(PERIPH)/dbgu
VPATH += $(PERIPH)/pio
@@ -142,8 +141,6 @@ VPATH += ../../osmo-sdr/firmware/src
# Objects built from C source files
C_OBJECTS += main.o
-#C_OBJECTS += wm8731.o
-#C_OBJECTS += wav.o
C_OBJECTS += stdio.o
C_OBJECTS += math.o
C_OBJECTS += dbgu.o
@@ -161,6 +158,7 @@ C_OBJECTS += logging.o
C_OBJECTS += tuner_e4k.o
C_OBJECTS += tuner_e4k_transport.o
C_OBJECTS += si570.o
+C_OBJECTS += osdr_fpga.o
# Objects for different chips
diff --git a/sdr-test-project/main.c b/sdr-test-project/main.c
index 441af94..5e55b7b 100644
--- a/sdr-test-project/main.c
+++ b/sdr-test-project/main.c
@@ -70,19 +70,42 @@
//------------------------------------------------------------------------------
/// List of pins to configure.
-static const Pin pins[] = {PINS_TWI0, PIN_PCK0, PINS_LEDS};
+static const Pin pins[] = {PINS_TWI0, PIN_PCK0, PINS_LEDS,
+ PINS_MISC, PINS_SSC, PINS_FPGA_JTAG};
static Twid twid;
static struct e4k_state e4k;
static struct si570_ctx si570;
+static void set_si570_freq(uint32_t freq)
+{
+ si570_set_freq(&si570, freq/1000, 0);
+ e4k.vco.fosc = freq;
+}
+
+static void power_peripherals(int on)
+{
+ if (on) {
+ osdr_fpga_power(1);
+ sam3u_e4k_power(&e4k, 1);
+ sam3u_e4k_stby(&e4k, 0);
+ } else {
+ osdr_fpga_power(0);
+ sam3u_e4k_stby(&e4k, 1);
+ sam3u_e4k_power(&e4k, 0);
+ }
+}
+
static void DisplayMenu(void)
{
printf("Menu:\r\n"
+ "[0] fpga+rf power on\r\n"
"[1] si570 init\r\n"
"[2] e4k init\r\n"
- "[f] si570 10MHz freq\r\n"
+ "[f] si570 30MHz freq\r\n"
"[r] si570 regdump\r\n"
+ "[q] 100 MHz\r\n"
+ "[w] 101 MHz\r\n"
"\r\n"
);
}
@@ -146,6 +169,9 @@ int main(void)
key = DBGU_GetChar();
switch (key) {
+ case '0':
+ power_peripherals(1);
+ break;
case '1':
si570_init(&si570, &twid, SI570_I2C_ADDR);
break;
@@ -154,11 +180,17 @@ int main(void)
e4k_init(&e4k);
break;
case 'f':
- si570_set_freq(&si570, 10000000, 0);
+ set_si570_freq(30000000);
break;
case 'r':
si570_regdump(&si570);
break;
+ case 'q':
+ e4k_tune_freq(&e4k, 100000000);
+ break;
+ case 'w':
+ e4k_tune_freq(&e4k, 101000000);
+ break;
}
}
}
personal git repositories of Harald Welte. Your mileage may vary