[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] r5521 - in gnuradio/branches/developers/eb/u2f: firmwa
From: |
eb |
Subject: |
[Commit-gnuradio] r5521 - in gnuradio/branches/developers/eb/u2f: firmware top/u2_sim |
Date: |
Tue, 22 May 2007 22:25:31 -0600 (MDT) |
Author: eb
Date: 2007-05-22 22:25:31 -0600 (Tue, 22 May 2007)
New Revision: 5521
Added:
gnuradio/branches/developers/eb/u2f/firmware/Makefile
gnuradio/branches/developers/eb/u2f/firmware/oldbootstrap.c
gnuradio/branches/developers/eb/u2f/firmware/sim_io.c
gnuradio/branches/developers/eb/u2f/firmware/sim_io.h
gnuradio/branches/developers/eb/u2f/firmware/spi.h
gnuradio/branches/developers/eb/u2f/top/u2_sim/Makefile
Modified:
gnuradio/branches/developers/eb/u2f/firmware/
gnuradio/branches/developers/eb/u2f/firmware/bootstrap.c
gnuradio/branches/developers/eb/u2f/firmware/spi.c
gnuradio/branches/developers/eb/u2f/top/u2_sim/
gnuradio/branches/developers/eb/u2f/top/u2_sim/u2_sim_top.v
Log:
work-in-progress on u2 firmware
Property changes on: gnuradio/branches/developers/eb/u2f/firmware
___________________________________________________________________
Name: svn:ignore
- *.dump
*.bin
+ *.dump
*.bin
*.rom
*.exe
Added: gnuradio/branches/developers/eb/u2f/firmware/Makefile
===================================================================
--- gnuradio/branches/developers/eb/u2f/firmware/Makefile
(rev 0)
+++ gnuradio/branches/developers/eb/u2f/firmware/Makefile 2007-05-23
04:25:31 UTC (rev 5521)
@@ -0,0 +1,25 @@
+CC = mb-gcc
+LD = mb-ld
+CFLAGS = -Wall -O2 -g -mxl-soft-div -mxl-soft-mul -msoft-float
+
+%.bin : %.exe
+ mb-objcopy -O binary $< $@
+
+%.rom : %.bin
+ hexdump -v -e'1/1 "%.2X\n"' $< > $@
+
+.PRECIOUS : %.bin
+
+all: flash.rom oldflash.rom
+
+oldflash.exe: oldbootstrap.o spi.o sim_io.o
+ $(CC) $^ -o $@
+
+flash.exe: bootstrap.o spi.o sim_io.o
+ $(CC) $^ -o $@
+
+clean:
+ rm -f *.o *.bin *.rom *.exe
+
+install-sim: all
+ cp -a *.rom ../top/u2_sim
Property changes on: gnuradio/branches/developers/eb/u2f/firmware/Makefile
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: gnuradio/branches/developers/eb/u2f/firmware/bootstrap.c
===================================================================
--- gnuradio/branches/developers/eb/u2f/firmware/bootstrap.c 2007-05-23
03:27:07 UTC (rev 5520)
+++ gnuradio/branches/developers/eb/u2f/firmware/bootstrap.c 2007-05-23
04:25:31 UTC (rev 5521)
@@ -1,11 +1,21 @@
#include "memory_map.h"
+#include "spi.h"
+#include "sim_io.h"
int main() {
+ sim_puthex(0);
+ sim_putc('X');
+ sim_puthex(1);
+
// Set up AD9510
spi_init();
+ sim_puthex(2);
+ sim_puts("This is a test");
+ sim_puthex(3);
+
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
Copied: gnuradio/branches/developers/eb/u2f/firmware/oldbootstrap.c (from rev
5499, gnuradio/branches/developers/eb/u2f/firmware/bootstrap.c)
===================================================================
--- gnuradio/branches/developers/eb/u2f/firmware/oldbootstrap.c
(rev 0)
+++ gnuradio/branches/developers/eb/u2f/firmware/oldbootstrap.c 2007-05-23
04:25:31 UTC (rev 5521)
@@ -0,0 +1,100 @@
+
+#include "memory_map.h"
+#include "sim_io.h"
+#include "spi.h"
+
+int main() {
+
+ sim_puthex(0);
+ sim_putc('X');
+ sim_puthex(1);
+
+ // Set up AD9510
+ spi_init();
+
+ sim_puthex(2);
+ sim_puts("This is a test");
+ sim_puthex(3);
+
+ 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
+ char clock_controls = (char)0x1C;
+ volatile char *p = (char *) OUTPUTS_BASE + OUTPUTS_CLK;
+ *p = clock_controls;
+
+ // Set GPIOs to outputs
+ volatile unsigned short *gpio_ddr_rx = (unsigned short *)(GPIO_BASE +
GPIO_DDR + GPIO_RX);
+ volatile unsigned short *gpio_ddr_tx = (unsigned short *)(GPIO_BASE +
GPIO_DDR + GPIO_TX);
+ volatile unsigned short *gpio_io_rx = (unsigned short *)(GPIO_BASE + GPIO_IO
+ GPIO_RX);
+ volatile unsigned short *gpio_io_tx = (unsigned short *)(GPIO_BASE + GPIO_IO
+ GPIO_TX);
+
+ *gpio_ddr_rx = 0xffff;
+ *gpio_ddr_tx = 0xffff;
+
+ *gpio_io_rx = (short) 0xDEAD;
+ *gpio_io_tx = (short) 0xBEEF;
+
+ // Enable ADCs
+ p = (char *)(OUTPUTS_BASE + OUTPUTS_ADC);
+ *p = 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
+
+ volatile short *dsp_i = (short *)(DSP_BASE+DSP_IAMP);
+ volatile short *dsp_q = (short *)(DSP_BASE+DSP_QAMP);
+ volatile int *dsp_freq = (int *)(DSP_BASE+DSP_FREQ);
+ volatile short *dsp_scale_i = (short *)(DSP_BASE+DSP_ISCALE);
+ volatile short *dsp_scale_q = (short *)(DSP_BASE+DSP_QSCALE);
+
+ *dsp_i = (short) 0x7FFF;
+ *dsp_q = (short) 0x7FFF;
+ *dsp_freq = 0x12345678;
+ *dsp_scale_i = (short) 512;
+ *dsp_scale_q = (short) 123;
+
+ // Set up serdes
+ //char serdes_controls = (char)(SERDES_ENABLE | SERDES_LOOPEN | SERDES_RXEN);
+ char serdes_controls = (char)(SERDES_ENABLE | SERDES_RXEN);
+ volatile char *serdes = (char *) OUTPUTS_BASE + OUTPUTS_SERDES;
+ *serdes = serdes_controls;
+
+
+ // 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++;
+
+ }
+
+ // Control LEDs
+ volatile char *leds = (char *) OUTPUTS_BASE + OUTPUTS_MISC;
+ while(1) {
+ *leds = (char) 0x00;
+ *leds = (char) 0x01;
+ *leds = (char) 0x00;
+ *leds = (char) 0x01;
+ *leds = (char) 0x01;
+ *leds = (char) 0x01;
+ *leds = (char) 0x03;
+ *leds = (char) 0x02;
+ }
+
+}
Added: gnuradio/branches/developers/eb/u2f/firmware/sim_io.c
===================================================================
--- gnuradio/branches/developers/eb/u2f/firmware/sim_io.c
(rev 0)
+++ gnuradio/branches/developers/eb/u2f/firmware/sim_io.c 2007-05-23
04:25:31 UTC (rev 5521)
@@ -0,0 +1,40 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2006 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include "sim_io.h"
+
+void sim_puthex(unsigned long x)
+{
+ volatile unsigned long *p = (unsigned long *) 0xE000;
+ *p = x;
+}
+
+void sim_putc(unsigned char s)
+{
+ volatile unsigned long *p = (unsigned long *) 0xE004;
+ *p = s;
+}
+
+void sim_puts(char *s)
+{
+ volatile unsigned long *p = (unsigned long *) 0xE008;
+ *p = (unsigned long) s;
+}
Property changes on: gnuradio/branches/developers/eb/u2f/firmware/sim_io.c
___________________________________________________________________
Name: svn:eol-style
+ native
Added: gnuradio/branches/developers/eb/u2f/firmware/sim_io.h
===================================================================
--- gnuradio/branches/developers/eb/u2f/firmware/sim_io.h
(rev 0)
+++ gnuradio/branches/developers/eb/u2f/firmware/sim_io.h 2007-05-23
04:25:31 UTC (rev 5521)
@@ -0,0 +1,26 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2006 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+void sim_puthex(unsigned long x);
+void sim_putc(unsigned char s);
+void sim_puts(char *s);
+
+
Property changes on: gnuradio/branches/developers/eb/u2f/firmware/sim_io.h
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: gnuradio/branches/developers/eb/u2f/firmware/spi.c
===================================================================
--- gnuradio/branches/developers/eb/u2f/firmware/spi.c 2007-05-23 03:27:07 UTC
(rev 5520)
+++ gnuradio/branches/developers/eb/u2f/firmware/spi.c 2007-05-23 04:25:31 UTC
(rev 5521)
@@ -1,7 +1,9 @@
+#include "spi.h"
#include "memory_map.h"
void
-spi_init() {
+spi_init(void)
+{
volatile int *p;
// Set divider
@@ -10,7 +12,8 @@
}
void
-spi_wait() {
+spi_wait(void)
+{
volatile int *p;
p = (int *)(SPI_BASE+SPI_CTRL);
while(*p & SPI_CTRL_GO_BSY)
@@ -18,7 +21,8 @@
}
int
-spi_transact(int readback, int slave, int data, int length, int inv_tx) {
+spi_transact(int readback, int slave, int data, int length, int inv_tx)
+{
volatile int *p;
int flags;
Added: gnuradio/branches/developers/eb/u2f/firmware/spi.h
===================================================================
--- gnuradio/branches/developers/eb/u2f/firmware/spi.h
(rev 0)
+++ gnuradio/branches/developers/eb/u2f/firmware/spi.h 2007-05-23 04:25:31 UTC
(rev 5521)
@@ -0,0 +1,24 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2006 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+void spi_init(void);
+void spi_wait(void);
+int spi_transact(int readback, int slave, int data, int length, int inv_tx);
Property changes on: gnuradio/branches/developers/eb/u2f/firmware/spi.h
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: gnuradio/branches/developers/eb/u2f/top/u2_sim
___________________________________________________________________
Name: svn:ignore
- *.vcd
+ *.vcd
*.rom
u2_sim
Added: gnuradio/branches/developers/eb/u2f/top/u2_sim/Makefile
===================================================================
--- gnuradio/branches/developers/eb/u2f/top/u2_sim/Makefile
(rev 0)
+++ gnuradio/branches/developers/eb/u2f/top/u2_sim/Makefile 2007-05-23
04:25:31 UTC (rev 5521)
@@ -0,0 +1,6 @@
+all: u2_sim
+
+u2_sim:
+ iverilog -c cmdfile u2_sim_top.v -o u2_sim
+
+
Property changes on: gnuradio/branches/developers/eb/u2f/top/u2_sim/Makefile
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: gnuradio/branches/developers/eb/u2f/top/u2_sim/u2_sim_top.v
===================================================================
--- gnuradio/branches/developers/eb/u2f/top/u2_sim/u2_sim_top.v 2007-05-23
03:27:07 UTC (rev 5520)
+++ gnuradio/branches/developers/eb/u2f/top/u2_sim/u2_sim_top.v 2007-05-23
04:25:31 UTC (rev 5521)
@@ -234,8 +234,15 @@
// Experimental printf-like function
always @(posedge wb_clk)
- if((u2_basic.m0_we == 1'd1)&&(u2_basic.m0_adr == 16'hE000))
- $display("Hello %x",u2_basic.m0_dat_o);
+ begin
+ if((u2_basic.m0_we == 1'd1)&&(u2_basic.m0_adr == 16'hE000))
+ $display("Hello0 %x",u2_basic.m0_dat_i);
+ if((u2_basic.m0_we == 1'd1)&&(u2_basic.m0_adr == 16'hE004))
+ $display("Hello4 %c",u2_basic.m0_dat_i);
+ if((u2_basic.m0_we == 1'd1)&&(u2_basic.m0_adr == 16'hE008))
+ $display("Hello8 %s",u2_basic.m0_dat_i);
+ end
+
endmodule // u2_sim_top
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Commit-gnuradio] r5521 - in gnuradio/branches/developers/eb/u2f: firmware top/u2_sim,
eb <=