From 7fb90daf9fb88c9a8297f9239593125f67e0b389 Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Wed, 28 Dec 2011 01:19:06 +0100 Subject: add si570 test code to main --- sdr-test-project/Makefile | 2 +- sdr-test-project/main.c | 21 +++++++++++++++++++-- 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 #include +#include #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; } } } -- cgit v1.2.3