commit-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Commit-gnuradio] r5530 - in gnuradio/branches/developers/matt/u2f: firm


From: eb
Subject: [Commit-gnuradio] r5530 - in gnuradio/branches/developers/matt/u2f: firmware top/u2_sim
Date: Wed, 23 May 2007 01:12:54 -0600 (MDT)

Author: eb
Date: 2007-05-23 01:12:54 -0600 (Wed, 23 May 2007)
New Revision: 5530

Added:
   gnuradio/branches/developers/matt/u2f/firmware/Makefile
   gnuradio/branches/developers/matt/u2f/firmware/oldbootstrap.c
   gnuradio/branches/developers/matt/u2f/firmware/sim_io.c
   gnuradio/branches/developers/matt/u2f/firmware/sim_io.h
   gnuradio/branches/developers/matt/u2f/firmware/spi.h
   gnuradio/branches/developers/matt/u2f/firmware/test1_main.c
   gnuradio/branches/developers/matt/u2f/firmware/u2_init.c
   gnuradio/branches/developers/matt/u2f/firmware/u2_init.h
   gnuradio/branches/developers/matt/u2f/top/u2_sim/Makefile
Removed:
   gnuradio/branches/developers/matt/u2f/firmware/bootstrap.c
Modified:
   gnuradio/branches/developers/matt/u2f/firmware/
   gnuradio/branches/developers/matt/u2f/firmware/memory_map.h
   gnuradio/branches/developers/matt/u2f/firmware/spi.c
   gnuradio/branches/developers/matt/u2f/top/u2_sim/
   gnuradio/branches/developers/matt/u2f/top/u2_sim/u2_sim_top.v
Log:
Merged eb/u2f -r5499:5528 into matt/u2f.  This includes a couple of
fixes to u2_sim_top for the "printf" output and some firmware changes.



Property changes on: gnuradio/branches/developers/matt/u2f/firmware
___________________________________________________________________
Name: svn:ignore
   - *.dump
*.bin

   + *.dump
*.bin
*.rom
*.exe



Copied: gnuradio/branches/developers/matt/u2f/firmware/Makefile (from rev 5528, 
gnuradio/branches/developers/eb/u2f/firmware/Makefile)
===================================================================
--- gnuradio/branches/developers/matt/u2f/firmware/Makefile                     
        (rev 0)
+++ gnuradio/branches/developers/matt/u2f/firmware/Makefile     2007-05-23 
07:12:54 UTC (rev 5530)
@@ -0,0 +1,35 @@
+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
+
+ROMS = oldflash.rom test1.rom
+
+all: $(ROMS)
+
+oldflash.exe: oldbootstrap.o spi.o sim_io.o
+       $(CC) $^ -o $@
+
+test1.exe: test1_main.o u2_init.o spi.o sim_io.o
+       $(CC) $^ -o $@
+
+clean:
+       rm -f *.o *.bin *.rom *.exe
+
+install-sim: all
+       cp -a *.rom ../top/u2_sim
+
+# dependencies
+bootstrap.o: memory_map.h spi.h sim_io.h bootstrap.c
+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/matt/u2f/firmware/bootstrap.c

Modified: gnuradio/branches/developers/matt/u2f/firmware/memory_map.h
===================================================================
--- gnuradio/branches/developers/matt/u2f/firmware/memory_map.h 2007-05-23 
07:00:11 UTC (rev 5529)
+++ gnuradio/branches/developers/matt/u2f/firmware/memory_map.h 2007-05-23 
07:12:54 UTC (rev 5530)
@@ -49,9 +49,45 @@
 
 ////////////////////////////////////////////////
 // I2C, Slave 3
+// See Wishbone I2C-Master Core Specification.
+
 #define I2C_BASE 0x9000
 
+typedef struct {
+  volatile unsigned char  prescaler_lo;        // r/w
+  volatile unsigned char  prescaler_hi;        // r/w
+  volatile unsigned char  ctrl;                // r/w
+  volatile unsigned char  data;                // wr = transmit reg; rd = 
receive reg
+  volatile unsigned char  cmd_status;  // wr = command reg;  rd = status reg
+} i2c_regs_t;
 
+#define i2c_regs ((i2c_regs_regs_t *) I2C_BASE)
+
+#define        I2C_CTRL_EN     (1 << 7)        // core enable
+#define        I2C_CTRL_IE     (1 << 6)        // interrupt enable
+
+//
+// STA, STO, RD, WR, and IACK bits are cleared automatically
+//
+#define        I2C_CMD_STA     (1 << 7)        // generate (repeated) start 
condition
+#define I2C_CMD_STO    (1 << 6)        // generate stop condition
+#define        I2C_CMD_RD      (1 << 5)        // read from slave
+#define I2C_CMD_WR     (1 << 4)        // write to slave
+#define        I2C_CMD_ACK     (1 << 3)        // when a rcvr, send ACK 
(ACK=0) or NACK (ACK=1)
+#define I2C_CMD_RSVD_2 (1 << 2)        // reserved
+#define        I2C_CMD_RSVD_1  (1 << 1)        // reserved
+#define I2C_CMD_IACK   (1 << 0)        // set to clear pending interrupt
+
+#define I2C_ST_RXACK   (1 << 7)        // Received acknowledgement from slave 
(1 = NAK, 0 = ACK)
+#define        I2C_ST_BUSY     (1 << 6)        // 1 after START signal 
detected; 0 after STOP signal detected
+#define        I2C_ST_AL       (1 << 5)        // Arbitration lost.  1 when 
core lost arbitration
+#define        I2C_ST_RSVD_4   (1 << 4)        // reserved
+#define        I2C_ST_RSVD_3   (1 << 3)        // reserved
+#define        I2C_ST_RSVD_2   (1 << 2)        // reserved
+#define I2C_ST_TIP     (1 << 1)        // Transfer-in-progress
+#define        I2C_ST_IP       (1 << 0)        // Interrupt pending
+
+
 ////////////////////////////////////////////////
 // GPIO, Slave 4
 #define GPIO_BASE 0xA000
@@ -60,7 +96,15 @@
 #define GPIO_RX 0
 #define GPIO_TX 2
 
+typedef struct {
+  volatile unsigned short      ddr_rx;
+  volatile unsigned short      ddr_tx;
+  volatile unsigned short      io_rx;
+  volatile unsigned short      io_tx;
+} gpio_regs_t;
 
+#define gpio_base ((gpio_regs_t *) GPIO_BASE)
+
 ///////////////////////////////////////////////////
 // Basic Outputs, Slave 5
 #define OUTPUTS_BASE 0xB000
@@ -75,6 +119,16 @@
 #define SERDES_LOOPEN 2
 #define SERDES_RXEN 1
 
+typedef struct {
+  volatile unsigned char       clk_ctrl;
+  volatile unsigned char       serdes_ctrl;
+  volatile unsigned char       adc_ctrl;
+  volatile unsigned char       leds;           // misc?
+} output_regs_t;
+
+#define output_regs ((output_regs_t *) OUTPUTS_BASE)
+
+
 ///////////////////////////////////////////////////
 // DSP Core, Slave 6
 #define DSP_BASE 0xC000
@@ -85,6 +139,16 @@
 #define DSP_ISCALE 8
 #define DSP_QSCALE 10
 
+typedef struct {
+  volatile short       i;
+  volatile short       q;
+  volatile int         freq;
+  volatile short       scale_i;
+  volatile short       scale_q;
+} dsp_regs_t;
+  
+#define dsp_regs ((dsp_regs_t *) DSP_BASE)
+
 ////////////////////////////////////////////////////
 // Settings Bus, Slave #7
 #define SLAVE7_BASE 0xD000

Copied: gnuradio/branches/developers/matt/u2f/firmware/oldbootstrap.c (from rev 
5528, gnuradio/branches/developers/eb/u2f/firmware/oldbootstrap.c)
===================================================================
--- gnuradio/branches/developers/matt/u2f/firmware/oldbootstrap.c               
                (rev 0)
+++ gnuradio/branches/developers/matt/u2f/firmware/oldbootstrap.c       
2007-05-23 07:12:54 UTC (rev 5530)
@@ -0,0 +1,101 @@
+
+#include "memory_map.h"
+#include "spi.h"
+#include "sim_io.h"
+
+int main() {
+
+  sim_puthex_nl(0);
+  sim_putc_nl('X');
+  sim_puthex_nl(1);
+
+  // Set up AD9510
+  spi_init();
+
+  sim_puthex_nl(2);
+  sim_puts("This is a test\n");
+  sim_puthex(3);
+  sim_newline();
+
+  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;
+  }
+    
+}

Copied: gnuradio/branches/developers/matt/u2f/firmware/sim_io.c (from rev 5528, 
gnuradio/branches/developers/eb/u2f/firmware/sim_io.c)
===================================================================
--- gnuradio/branches/developers/matt/u2f/firmware/sim_io.c                     
        (rev 0)
+++ gnuradio/branches/developers/matt/u2f/firmware/sim_io.c     2007-05-23 
07:12:54 UTC (rev 5530)
@@ -0,0 +1,34 @@
+/* -*- 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_puts(const char *s)
+{
+  while (*s)
+    sim_putc(*s++);
+}
+
+void sim_puts_nl(const char *s)
+{
+  sim_puts(s);
+  sim_newline();
+}

Copied: gnuradio/branches/developers/matt/u2f/firmware/sim_io.h (from rev 5528, 
gnuradio/branches/developers/eb/u2f/firmware/sim_io.h)
===================================================================
--- gnuradio/branches/developers/matt/u2f/firmware/sim_io.h                     
        (rev 0)
+++ gnuradio/branches/developers/matt/u2f/firmware/sim_io.h     2007-05-23 
07:12:54 UTC (rev 5530)
@@ -0,0 +1,64 @@
+/* -*- 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_puts(const char *s);
+void sim_puts_nl(const char *s);       // add \n
+
+// %08x
+static inline void 
+sim_puthex(unsigned long x)
+{
+  volatile unsigned long *p = (unsigned long *) 0xE000;
+  *p = x;
+}
+
+// %08x\n
+static inline void 
+sim_puthex_nl(unsigned long x)
+{
+  volatile unsigned long *p = (unsigned long *) 0xE100;
+  *p = x;
+}
+
+// %c
+static inline void 
+sim_putc(unsigned char s)
+{
+  volatile unsigned long *p = (unsigned long *) 0xE004;
+  *p = s;
+}
+
+// %c\n
+static inline void 
+sim_putc_nl(unsigned char s)
+{
+  volatile unsigned long *p = (unsigned long *) 0xE104;
+  *p = s;
+}
+
+// \n
+static inline void 
+sim_newline(void)
+{
+  volatile unsigned long *p = (unsigned long *) 0xE008;
+  *p = 0;
+}
+

Modified: gnuradio/branches/developers/matt/u2f/firmware/spi.c
===================================================================
--- gnuradio/branches/developers/matt/u2f/firmware/spi.c        2007-05-23 
07:00:11 UTC (rev 5529)
+++ gnuradio/branches/developers/matt/u2f/firmware/spi.c        2007-05-23 
07:12:54 UTC (rev 5530)
@@ -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;
 

Copied: gnuradio/branches/developers/matt/u2f/firmware/spi.h (from rev 5528, 
gnuradio/branches/developers/eb/u2f/firmware/spi.h)
===================================================================
--- gnuradio/branches/developers/matt/u2f/firmware/spi.h                        
        (rev 0)
+++ gnuradio/branches/developers/matt/u2f/firmware/spi.h        2007-05-23 
07:12:54 UTC (rev 5530)
@@ -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);

Copied: gnuradio/branches/developers/matt/u2f/firmware/test1_main.c (from rev 
5528, gnuradio/branches/developers/eb/u2f/firmware/test1_main.c)
===================================================================
--- gnuradio/branches/developers/matt/u2f/firmware/test1_main.c                 
        (rev 0)
+++ gnuradio/branches/developers/matt/u2f/firmware/test1_main.c 2007-05-23 
07:12:54 UTC (rev 5530)
@@ -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;
+}

Copied: gnuradio/branches/developers/matt/u2f/firmware/u2_init.c (from rev 
5528, gnuradio/branches/developers/eb/u2f/firmware/u2_init.c)
===================================================================
--- gnuradio/branches/developers/matt/u2f/firmware/u2_init.c                    
        (rev 0)
+++ gnuradio/branches/developers/matt/u2f/firmware/u2_init.c    2007-05-23 
07:12:54 UTC (rev 5530)
@@ -0,0 +1,67 @@
+
+#include "u2_init.h"
+#include "memory_map.h"
+#include "spi.h"
+#include "sim_io.h"
+
+/*
+ * We ought to arrange for this to be called before main, but for now,
+ * we 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;
+}

Copied: gnuradio/branches/developers/matt/u2f/firmware/u2_init.h (from rev 
5528, gnuradio/branches/developers/eb/u2f/firmware/u2_init.h)
===================================================================
--- gnuradio/branches/developers/matt/u2f/firmware/u2_init.h                    
        (rev 0)
+++ gnuradio/branches/developers/matt/u2f/firmware/u2_init.h    2007-05-23 
07:12:54 UTC (rev 5530)
@@ -0,0 +1,2 @@
+int u2_init(void);
+


Property changes on: gnuradio/branches/developers/matt/u2f/top/u2_sim
___________________________________________________________________
Name: svn:ignore
   - *.vcd

   + *.vcd
*.rom
u2_sim



Copied: gnuradio/branches/developers/matt/u2f/top/u2_sim/Makefile (from rev 
5528, gnuradio/branches/developers/eb/u2f/top/u2_sim/Makefile)
===================================================================
--- gnuradio/branches/developers/matt/u2f/top/u2_sim/Makefile                   
        (rev 0)
+++ gnuradio/branches/developers/matt/u2f/top/u2_sim/Makefile   2007-05-23 
07:12:54 UTC (rev 5530)
@@ -0,0 +1,7 @@
+all: u2_sim
+
+u2_sim:        
+       iverilog -c cmdfile u2_sim_top.v -o u2_sim
+
+clean:
+       rm -f u2_sim *.vcd

Modified: gnuradio/branches/developers/matt/u2f/top/u2_sim/u2_sim_top.v
===================================================================
--- gnuradio/branches/developers/matt/u2f/top/u2_sim/u2_sim_top.v       
2007-05-23 07:00:11 UTC (rev 5529)
+++ gnuradio/branches/developers/matt/u2f/top/u2_sim/u2_sim_top.v       
2007-05-23 07:12:54 UTC (rev 5530)
@@ -234,8 +234,19 @@
 
    // 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))
+         $write("%x",u2_basic.m0_dat_i);
+       if((u2_basic.m0_we == 1'd1)&&(u2_basic.m0_adr == 16'hE100))
+         $display("%x",u2_basic.m0_dat_i);
+       if((u2_basic.m0_we == 1'd1)&&(u2_basic.m0_adr == 16'hE004))
+         $write("%c",u2_basic.m0_dat_i);
+       if((u2_basic.m0_we == 1'd1)&&(u2_basic.m0_adr == 16'hE104))
+         $display("%c",u2_basic.m0_dat_i);
+       if((u2_basic.m0_we == 1'd1)&&(u2_basic.m0_adr == 16'hE008))
+         $display("");
+     end
+       
 
 endmodule // u2_sim_top
 





reply via email to

[Prev in Thread] Current Thread [Next in Thread]