[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] r5527 - gnuradio/branches/developers/eb/u2f/firmware
From: |
eb |
Subject: |
[Commit-gnuradio] r5527 - gnuradio/branches/developers/eb/u2f/firmware |
Date: |
Wed, 23 May 2007 00:21:01 -0600 (MDT) |
Author: eb
Date: 2007-05-23 00:21:00 -0600 (Wed, 23 May 2007)
New Revision: 5527
Added:
gnuradio/branches/developers/eb/u2f/firmware/test1_main.c
gnuradio/branches/developers/eb/u2f/firmware/u2_init.c
Removed:
gnuradio/branches/developers/eb/u2f/firmware/bootstrap.c
Modified:
gnuradio/branches/developers/eb/u2f/firmware/Makefile
Log:
work-in-progress on u2 firmware
Modified: gnuradio/branches/developers/eb/u2f/firmware/Makefile
===================================================================
--- gnuradio/branches/developers/eb/u2f/firmware/Makefile 2007-05-23
06:08:38 UTC (rev 5526)
+++ gnuradio/branches/developers/eb/u2f/firmware/Makefile 2007-05-23
06:21:00 UTC (rev 5527)
@@ -10,12 +10,14 @@
.PRECIOUS : %.bin
-all: flash.rom oldflash.rom
+ROMS = oldflash.rom test1.rom
+all: $(ROMS)
+
oldflash.exe: oldbootstrap.o spi.o sim_io.o
$(CC) $^ -o $@
-flash.exe: bootstrap.o spi.o sim_io.o
+test1.exe: test1_main.o u2_init.o spi.o sim_io.o
$(CC) $^ -o $@
clean:
@@ -29,3 +31,5 @@
oldbootstrap.o: memory_map.h spi.h sim_io.h oldbootstrap.c
spi.o: memory_map.h spi.h spi.c
sim_io.o: sim_io.h
+test1_main.o: u2_init.h memory_map.h spi.h sim_io.h test1_main.c
+
Deleted: gnuradio/branches/developers/eb/u2f/firmware/bootstrap.c
Added: gnuradio/branches/developers/eb/u2f/firmware/test1_main.c
===================================================================
--- gnuradio/branches/developers/eb/u2f/firmware/test1_main.c
(rev 0)
+++ gnuradio/branches/developers/eb/u2f/firmware/test1_main.c 2007-05-23
06:21:00 UTC (rev 5527)
@@ -0,0 +1,33 @@
+#include "u2_init.h"
+#include "memory_map.h"
+#include "spi.h"
+
+int
+main(void)
+{
+ u2_init();
+
+#if 0
+ // Set up DAC
+ int i = 0;
+ while(1) {
+ int command = (3 << 19) | (0 << 16) | (i & 0xffff);
+ spi_transact(SPI_TXONLY, SPI_SS_TX_DAC, command, 24, 1); // negate TX phase
+ i++;
+ }
+#endif
+
+ // Control LEDs
+ while(1) {
+ output_regs->leds = 0x00;
+ output_regs->leds = 0x01;
+ output_regs->leds = 0x00;
+ output_regs->leds = 0x01;
+ output_regs->leds = 0x01;
+ output_regs->leds = 0x01;
+ output_regs->leds = 0x03;
+ output_regs->leds = 0x02;
+ }
+
+ return 1;
+}
Property changes on: gnuradio/branches/developers/eb/u2f/firmware/test1_main.c
___________________________________________________________________
Name: svn:eol-style
+ native
Copied: gnuradio/branches/developers/eb/u2f/firmware/u2_init.c (from rev 5526,
gnuradio/branches/developers/eb/u2f/firmware/bootstrap.c)
===================================================================
--- gnuradio/branches/developers/eb/u2f/firmware/u2_init.c
(rev 0)
+++ gnuradio/branches/developers/eb/u2f/firmware/u2_init.c 2007-05-23
06:21:00 UTC (rev 5527)
@@ -0,0 +1,67 @@
+
+#include "u2_init.h"
+#include "memory_map.h"
+#include "spi.h"
+#include "sim_io.h"
+
+/*
+ * We ought to arrange that this is called before main, but for now,
+ * require that the user's main call u2_init as the first thing...
+ */
+int
+u2_init(void)
+{
+
+ sim_puthex_nl(0);
+ sim_puts("This is a test\n");
+
+ spi_init();
+
+ sim_puthex_nl(1);
+
+ // Set up AD9510
+ spi_transact(SPI_TXONLY, SPI_SS_AD9510, 0x00004500, 24, 0); // CLK2 drives
distribution
+ spi_transact(SPI_TXONLY, SPI_SS_AD9510, 0x00003D80, 24, 0); // Turn on
output 1 (FPGA CLK), normal levels
+ spi_transact(SPI_TXONLY, SPI_SS_AD9510, 0x00004B80, 24, 0); // Bypass divider
+ spi_transact(SPI_TXONLY, SPI_SS_AD9510, 0x00005A01, 24, 0); // Update Regs
+
+ spi_wait();
+
+ // Allow for clock switchover
+ output_regs->clk_ctrl = 0x1C;
+
+ // Set GPIOs to outputs
+ gpio_base->ddr_rx = 0xffff;
+ gpio_base->ddr_tx = 0xffff;
+ gpio_base->io_rx = 0xDEAD;
+ gpio_base->io_tx = 0xBEEF;
+
+ // Enable ADCs
+ output_regs->adc_ctrl = 0; // Power up and enable outputs
+
+ // Enable clock to ADCs and DACs
+ spi_transact(SPI_TXONLY, SPI_SS_AD9510, 0x00003F80, 24, 0); // Turn on
output 3 (DAC CLK), normal levels
+ spi_transact(SPI_TXONLY, SPI_SS_AD9510, 0x00004180, 24, 0); // Turn on out 5
(ADC clk), CMOS
+ spi_transact(SPI_TXONLY, SPI_SS_AD9510, 0x00004F80, 24, 0); // Bypass Div #3
+ spi_transact(SPI_TXONLY, SPI_SS_AD9510, 0x00005380, 24, 0); // Bypass Div #5
+ spi_transact(SPI_TXONLY, SPI_SS_AD9510, 0x00005A01, 24, 0); // Update Regs
+
+ spi_transact(SPI_TXONLY, SPI_SS_AD9777, 0x00000004, 16, 0); // Single-R mode
+ //spi_transact(SPI_TXONLY, SPI_SS_AD9777, 0x00000140, 16, 0); //
+ //spi_transact(SPI_TXONLY, SPI_SS_AD9777, 0x00000301, 16, 0); // PLL =
+ //spi_transact(SPI_TXONLY, SPI_SS_AD9777, 0x00000480, 16, 0); // PLL on,
automatic
+
+
+ // write DSP registers...
+ dsp_regs->i = 0x7FFF;
+ dsp_regs->q = 0x7FFF;
+ dsp_regs->freq = 0x12345678;
+ dsp_regs->scale_i = 512;
+ dsp_regs->scale_q = 123;
+
+ // Set up serdes
+ //output_regs->serdes_ctrl = (SERDES_ENABLE | SERDES_LOOPEN | SERDES_RXEN);
+ output_regs->serdes_ctrl = (SERDES_ENABLE | SERDES_RXEN);
+
+ return 1;
+}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Commit-gnuradio] r5527 - gnuradio/branches/developers/eb/u2f/firmware,
eb <=