summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2011-12-28 01:19:06 +0100
committerHarald Welte <laforge@gnumonks.org>2011-12-28 01:19:06 +0100
commit7fb90daf9fb88c9a8297f9239593125f67e0b389 (patch)
treecd8d5313872a83a7c0cb638a645a0ea8667d7dba
parent23f95a767f638a40800b841f4fc314adb5136fcc (diff)
add si570 test code to main
-rw-r--r--sdr-test-project/Makefile2
-rw-r--r--sdr-test-project/main.c21
2 files changed, 20 insertions, 3 deletions
diff --git a/sdr-test-project/Makefile b/sdr-test-project/Makefile
index 3d96c04..22015b9 100644
--- a/sdr-test-project/Makefile
+++ b/sdr-test-project/Makefile
@@ -101,7 +101,7 @@ TARGET_OPTS =
endif
CFLAGS += $(TARGET_OPTS)
-CFLAGS += -Wall -mlong-calls -ffunction-sections
+CFLAGS += -Wall -mlong-calls -ffunction-sections -fno-rtti -fno-exceptions
CFLAGS += -g $(OPTIMIZATION) $(INCLUDES) -D$(CHIP) -DTRACE_LEVEL=$(TRACE_LEVEL)
ASFLAGS = $(TARGET_OPTS) -Wall -g $(OPTIMIZATION) $(INCLUDES) -D$(CHIP) -D__ASSEMBLY__
LDFLAGS = -g $(OPTIMIZATION) -nostartfiles $(TARGET_OPTS) -Wl,--gc-sections
diff --git a/sdr-test-project/main.c b/sdr-test-project/main.c
index 8ebaade..8a1c234 100644
--- a/sdr-test-project/main.c
+++ b/sdr-test-project/main.c
@@ -46,6 +46,7 @@
#include <dma/dma.h>
#include <tuner_e4k.h>
+#include <si570.h>
#define SSC_MCK 49152000
@@ -62,6 +63,7 @@
#define AT91C_CKGR_DIV_SHIFT 0
#define E4K_I2C_ADDR 0x64
+#define SI570_I2C_ADDR 0x55
//------------------------------------------------------------------------------
// Local variables
@@ -72,10 +74,16 @@ static const Pin pins[] = {PINS_TWI0, PIN_PCK0, PINS_LEDS};
static Twid twid;
static struct e4k_state e4k;
+static struct si570_ctx si570;
static void DisplayMenu(void)
{
- printf("[1]");
+ printf("Menu:\r\n"
+ "[1] si570 init\r\n"
+ "[2] e4k init\r\n"
+ "[f] si570 10MHz freq\r\n"
+ "[r] si570 regdump\r\n"
+ );
}
//------------------------------------------------------------------------------
@@ -137,10 +145,19 @@ int main(void)
key = DBGU_GetChar();
switch (key) {
- case 'i':
+ case '1':
+ si570_init(&si570, (void *)AT91C_BASE_TWI0, SI570_I2C_ADDR);
+ break;
+ case '2':
sam3u_e4k_init(&e4k, E4K_I2C_ADDR);
e4k_init(&e4k);
break;
+ case 'f':
+ si570_set_freq(&si570, 10000000, 0);
+ break;
+ case 'r':
+ si570_regdump(&si570);
+ break;
}
}
}
personal git repositories of Harald Welte. Your mileage may vary