From 620d68be79940904d93647055a6f47fa3439da96 Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Sat, 31 Dec 2011 17:59:50 +0100 Subject: sdr-test-project has moved to osmo-sdr.git --- sdr-test-project/Makefile | 226 ---------------------------------------- sdr-test-project/bin/.empty | 0 sdr-test-project/bin/.empty_dir | 0 sdr-test-project/main.c | 197 ---------------------------------- sdr-test-project/obj/.empty | 0 sdr-test-project/obj/.empty_dir | 0 6 files changed, 423 deletions(-) delete mode 100644 sdr-test-project/Makefile delete mode 100644 sdr-test-project/bin/.empty delete mode 100644 sdr-test-project/bin/.empty_dir delete mode 100644 sdr-test-project/main.c delete mode 100644 sdr-test-project/obj/.empty delete mode 100644 sdr-test-project/obj/.empty_dir diff --git a/sdr-test-project/Makefile b/sdr-test-project/Makefile deleted file mode 100644 index 7072572..0000000 --- a/sdr-test-project/Makefile +++ /dev/null @@ -1,226 +0,0 @@ -# ---------------------------------------------------------------------------- -# ATMEL Microcontroller Software Support -# ---------------------------------------------------------------------------- -# Copyright (c) 2008, Atmel Corporation -# -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are met: -# -# - Redistributions of source code must retain the above copyright notice, -# this list of conditions and the disclaimer below. -# -# Atmel's name may not be used to endorse or promote products derived from -# this software without specific prior written permission. -# -# DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR -# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE -# DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT, -# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, -# OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, -# EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -# ---------------------------------------------------------------------------- - -# Makefile for compiling basic-ssc-i2s-at73c213-project - -#------------------------------------------------------------------------------- -# User-modifiable options -#------------------------------------------------------------------------------- - -# Chip & board used for compilation -# (can be overriden by adding CHIP=chip and BOARD=board to the command-line) -CHIP = at91sam3u4 -BOARD = osmo-sdr - -# Trace level used for compilation -# (can be overriden by adding TRACE_LEVEL=#number to the command-line) -# TRACE_LEVEL_DEBUG 5 -# TRACE_LEVEL_INFO 4 -# TRACE_LEVEL_WARNING 3 -# TRACE_LEVEL_ERROR 2 -# TRACE_LEVEL_FATAL 1 -# TRACE_LEVEL_NO_TRACE 0 -TRACE_LEVEL = 5 - -# Optimization level, put in comment for debugging -#OPTIMIZATION = -Os - -# AT91 library directory -AT91LIB = ../../at91lib - -# External library -EXT_LIBS= ../external_libs - -# Output file basename -OUTPUT = osmo-sdr-test-$(BOARD)-$(CHIP) - -# Compile with chip specific features -include $(AT91LIB)/boards/$(BOARD)/$(CHIP)/chip.mak - -# Compile for all memories available on the board (this sets $(MEMORIES)) -include $(AT91LIB)/boards/$(BOARD)/board.mak - -# Output directories -BIN = bin -OBJ = obj - -#------------------------------------------------------------------------------- -# Tools -#------------------------------------------------------------------------------- - -# Tool suffix when cross-compiling -CROSS_COMPILE = arm-cm3-eabi- - -# Compilation tools -CC = $(CROSS_COMPILE)gcc -SIZE = $(CROSS_COMPILE)size -STRIP = $(CROSS_COMPILE)strip -OBJCOPY = $(CROSS_COMPILE)objcopy - -# Flags -INCLUDES += -I$(AT91LIB)/boards/$(BOARD) -INCLUDES += -I$(AT91LIB)/peripherals -INCLUDES += -I$(AT91LIB)/components -INCLUDES += -I$(AT91LIB)/drivers -INCLUDES += -I$(AT91LIB) -INCLUDES += -I../../osmo-sdr/firmware/include -INCLUDES += -I$(AT91LIB)/memories -INCLUDES += -I. -INCLUDES += -I$(EXT_LIBS) -INCLUDES += -I$(EXT_LIBS)/cmsis - -ifeq ($(CHIP_CORE), cortexm3) -TARGET_OPTS = -mcpu=cortex-m3 -mthumb -else -TARGET_OPTS = -endif - -CFLAGS += $(TARGET_OPTS) -CFLAGS += -Wall -mlong-calls -ffunction-sections -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 - -#------------------------------------------------------------------------------- -# Files -#------------------------------------------------------------------------------- - -# Directories where source files can be found -PERIPH = $(AT91LIB)/peripherals -BOARDS = $(AT91LIB)/boards -UTILITY = $(AT91LIB)/utility -COMP = $(AT91LIB)/components -DRIVER = $(AT91LIB)/drivers -MEM = $(AT91LIB)/memories -MEM = $(EXT_LIBS)/memories - -VPATH += $(UTILITY) -VPATH += $(PERIPH)/dbgu -VPATH += $(PERIPH)/pio -VPATH += $(PERIPH)/irq -VPATH += $(PERIPH)/ssc -VPATH += $(PERIPH)/twi -VPATH += $(PERIPH)/pmc -VPATH += $(PERIPH)/cp15 -VPATH += $(BOARDS)/$(BOARD) -VPATH += $(BOARDS)/$(BOARD)/$(CHIP) -#VPATH += $(PERIPH)/mci -VPATH += $(DRIVER)/twi -#VPATH += $(MEM)/sdmmc -VPATH += $(PERIPH)/dma -VPATH += $(DRIVER)/dmad -VPATH += $(FATFS)/src -VPATH += $(MEM) -VPATH += $(EXT_LIBS)/cmsis -VPATH += ../../osmo-sdr/firmware/src - -# Objects built from C source files -C_OBJECTS += main.o -C_OBJECTS += stdio.o -C_OBJECTS += math.o -C_OBJECTS += dbgu.o -C_OBJECTS += pio.o -C_OBJECTS += ssc.o -C_OBJECTS += twi.o -C_OBJECTS += pmc.o -C_OBJECTS += twid.o -C_OBJECTS += board_lowlevel.o -C_OBJECTS += trace.o -C_OBJECTS += led.o -C_OBJECTS += board_memories.o - -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 -ifeq ($(CHIP_CORE), cortexm3) -C_OBJECTS += nvic.o -C_OBJECTS += exceptions.o -C_OBJECTS += board_cstartup_gnu.o -C_OBJECTS += core_cm3.o -else -C_OBJECTS += aic.o -C_OBJECTS += cp15.o -C_OBJECTS += pit.o -endif - -ifeq ($(CHIP_IP_MCI), MCI_DMA) -C_OBJECTS += dmad.o -C_OBJECTS += dma.o -#C_OBJECTS += mci_hs.o -else -C_OBJECTS += mci.o -endif - -# Objects built from Assembly source files -ifneq ($(CHIP_CORE), cortexm3) -ASM_OBJECTS += board_cstartup.o -ASM_OBJECTS += cp15_asm.o -endif - -# Append OBJ and BIN directories to output filename -OUTPUT := $(BIN)/$(OUTPUT) - -#------------------------------------------------------------------------------- -# Rules -#------------------------------------------------------------------------------- - -all: $(BIN) $(OBJ) $(MEMORIES) - -$(BIN) $(OBJ): - mkdir $@ - -define RULES -C_OBJECTS_$(1) = $(addprefix $(OBJ)/$(1)_, $(C_OBJECTS)) -ASM_OBJECTS_$(1) = $(addprefix $(OBJ)/$(1)_, $(ASM_OBJECTS)) - -$(1): $$(ASM_OBJECTS_$(1)) $$(C_OBJECTS_$(1)) - $(CC) $(LDFLAGS) -T"$(AT91LIB)/boards/$(BOARD)/$(CHIP)/$$@.lds" -o $(OUTPUT)-$$@.elf $$^ - $(OBJCOPY) -O binary $(OUTPUT)-$$@.elf $(OUTPUT)-$$@.bin - $(SIZE) $$^ $(OUTPUT)-$$@.elf - -$$(C_OBJECTS_$(1)): $(OBJ)/$(1)_%.o: %.c Makefile $(OBJ) $(BIN) - $(CC) $(CFLAGS) -D$(1) -c -o $$@ $$< - -$$(ASM_OBJECTS_$(1)): $(OBJ)/$(1)_%.o: %.S Makefile $(OBJ) $(BIN) - $(CC) $(ASFLAGS) -D$(1) -c -o $$@ $$< - -debug_$(1): $(1) - perl ../resources/gdb/debug.pl $(OUTPUT)-$(1).elf - -endef - -$(foreach MEMORY, $(MEMORIES), $(eval $(call RULES,$(MEMORY)))) - -clean: - -rm -f $(OBJ)/*.o $(BIN)/*.bin $(BIN)/*.elf - diff --git a/sdr-test-project/bin/.empty b/sdr-test-project/bin/.empty deleted file mode 100644 index e69de29..0000000 diff --git a/sdr-test-project/bin/.empty_dir b/sdr-test-project/bin/.empty_dir deleted file mode 100644 index e69de29..0000000 diff --git a/sdr-test-project/main.c b/sdr-test-project/main.c deleted file mode 100644 index 5e55b7b..0000000 --- a/sdr-test-project/main.c +++ /dev/null @@ -1,197 +0,0 @@ -/* ---------------------------------------------------------------------------- - * ATMEL Microcontroller Software Support - * ---------------------------------------------------------------------------- - * Copyright (c) 2008, Atmel Corporation - * - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * - Redistributions of source code must retain the above copyright notice, - * this list of conditions and the disclaimer below. - * - * Atmel's name may not be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE - * DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, - * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * ---------------------------------------------------------------------------- - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#include -#include - -#include -#include - -#define SSC_MCK 49152000 - -// TWI clock -#define TWI_CLOCK 100000 - -// PMC define -#define AT91C_CKGR_PLLR AT91C_CKGR_PLLAR -#define AT91C_PMC_LOCK AT91C_PMC_LOCKA - -#define AT91C_CKGR_MUL_SHIFT 16 -#define AT91C_CKGR_OUT_SHIFT 14 -#define AT91C_CKGR_PLLCOUNT_SHIFT 8 -#define AT91C_CKGR_DIV_SHIFT 0 - -#define E4K_I2C_ADDR 0x64 -#define SI570_I2C_ADDR 0x55 - -//------------------------------------------------------------------------------ -// Local variables -//------------------------------------------------------------------------------ - -/// List of pins to configure. -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 30MHz freq\r\n" - "[r] si570 regdump\r\n" - "[q] 100 MHz\r\n" - "[w] 101 MHz\r\n" - "\r\n" - ); -} - -//------------------------------------------------------------------------------ -/// Main function -//------------------------------------------------------------------------------ -int main(void) -{ - unsigned char key; - unsigned char isValid; - - // Configure all pins - PIO_Configure(pins, PIO_LISTSIZE(pins)); - - LED_Configure(0); - LED_Set(0); - LED_Configure(1); - LED_Set(1); - - // Initialize the DBGU - TRACE_CONFIGURE(DBGU_STANDARD, 115200, BOARD_MCK); - - printf("trace configured!!\n"); - - // Switch to Main clock - AT91C_BASE_PMC->PMC_MCKR = (AT91C_BASE_PMC->PMC_MCKR & ~AT91C_PMC_CSS) | AT91C_PMC_CSS_MAIN_CLK; - while ((AT91C_BASE_PMC->PMC_SR & AT91C_PMC_MCKRDY) == 0); - - // Configure PLL to 98.285MHz - *AT91C_CKGR_PLLR = ((1 << 29) | (171 << AT91C_CKGR_MUL_SHIFT) \ - | (0x0 << AT91C_CKGR_OUT_SHIFT) |(0x3f << AT91C_CKGR_PLLCOUNT_SHIFT) \ - | (21 << AT91C_CKGR_DIV_SHIFT)); - while ((AT91C_BASE_PMC->PMC_SR & AT91C_PMC_LOCK) == 0); - - // Configure master clock in two operations - AT91C_BASE_PMC->PMC_MCKR = (( AT91C_PMC_PRES_CLK_2 | AT91C_PMC_CSS_PLLA_CLK) & ~AT91C_PMC_CSS) | AT91C_PMC_CSS_MAIN_CLK; - while ((AT91C_BASE_PMC->PMC_SR & AT91C_PMC_MCKRDY) == 0); - AT91C_BASE_PMC->PMC_MCKR = ( AT91C_PMC_PRES_CLK_2 | AT91C_PMC_CSS_PLLA_CLK); - while ((AT91C_BASE_PMC->PMC_SR & AT91C_PMC_MCKRDY) == 0); - - // DBGU reconfiguration - DBGU_Configure(DBGU_STANDARD, 115200, SSC_MCK); - - // Configure and enable the TWI (required for accessing the DAC) - *AT91C_PMC_PCER = (1<< AT91C_ID_TWI0); - TWI_ConfigureMaster(AT91C_BASE_TWI0, TWI_CLOCK, SSC_MCK); - TWID_Initialize(&twid, AT91C_BASE_TWI0); - - printf("-- osmo-sdr testing project %s --\n\r", SOFTPACK_VERSION); - printf("-- %s\n\r", BOARD_NAME); - printf("-- Compiled: %s %s --\n\r", __DATE__, __TIME__); - - // Enter menu loop - while (1) { - - // Display menu - DisplayMenu(); - - // Process user input - key = DBGU_GetChar(); - - switch (key) { - case '0': - power_peripherals(1); - break; - case '1': - si570_init(&si570, &twid, SI570_I2C_ADDR); - break; - case '2': - sam3u_e4k_init(&e4k, &twid, E4K_I2C_ADDR); - e4k_init(&e4k); - break; - case 'f': - 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; - } - } -} - diff --git a/sdr-test-project/obj/.empty b/sdr-test-project/obj/.empty deleted file mode 100644 index e69de29..0000000 diff --git a/sdr-test-project/obj/.empty_dir b/sdr-test-project/obj/.empty_dir deleted file mode 100644 index e69de29..0000000 -- cgit v1.2.3