commit-gnuradio
[Top][All Lists]
Advanced

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

[Commit-gnuradio] r6546 - gnuradio/branches/developers/matt/u2f/firmware


From: eb
Subject: [Commit-gnuradio] r6546 - gnuradio/branches/developers/matt/u2f/firmware
Date: Wed, 26 Sep 2007 14:57:33 -0600 (MDT)

Author: eb
Date: 2007-09-26 14:57:33 -0600 (Wed, 26 Sep 2007)
New Revision: 6546

Modified:
   gnuradio/branches/developers/matt/u2f/firmware/eth_test.c
   gnuradio/branches/developers/matt/u2f/firmware/test1_main.c
   gnuradio/branches/developers/matt/u2f/firmware/timer_test.c
   gnuradio/branches/developers/matt/u2f/firmware/u2_init.c
Log:
updated examples to use new interrupt dispatcher

Modified: gnuradio/branches/developers/matt/u2f/firmware/eth_test.c
===================================================================
--- gnuradio/branches/developers/matt/u2f/firmware/eth_test.c   2007-09-26 
18:53:58 UTC (rev 6545)
+++ gnuradio/branches/developers/matt/u2f/firmware/eth_test.c   2007-09-26 
20:57:33 UTC (rev 6546)
@@ -16,14 +16,7 @@
 
 int buffer_state[4];
 
-void int_handler_func () __attribute__ ((interrupt_handler));
 
-void double_buffering();
-
-void int_handler_func () {
-  //double_buffering(PORT);
-}
-
 int
 main(void)
 {

Modified: gnuradio/branches/developers/matt/u2f/firmware/test1_main.c
===================================================================
--- gnuradio/branches/developers/matt/u2f/firmware/test1_main.c 2007-09-26 
18:53:58 UTC (rev 6545)
+++ gnuradio/branches/developers/matt/u2f/firmware/test1_main.c 2007-09-26 
20:57:33 UTC (rev 6546)
@@ -3,6 +3,7 @@
 #include "spi.h"
 #include "sim_io.h"
 #include "buffer_pool.h"
+#include "pic.h"
 
 // Globals
 #define EMPTY 0
@@ -16,14 +17,21 @@
 
 int buffer_state[4];
 
-void int_handler_func () __attribute__ ((interrupt_handler));
 
-void double_buffering();
+void double_buffering(int port);
 
-void int_handler_func () {
+//
+// We register this in the secondary interrupt vector.
+// It's called on buffer manager interrupts
+//
+void
+buffer_irq_handler(unsigned irq)
+{
   double_buffering(PORT);
 }
 
+static volatile int not_done = 1;      // FIXME CPU bug workaround
+
 int
 main(void)
 {
@@ -69,10 +77,16 @@
   sim_puts("Done DSP TX setup\n");
   dsp_tx_regs->run_tx = 1;
 
-  while(1) {}
-  //double_buffering();
-  //}
+  // register interrupt handler
+  pic_register_handler(IRQ_BUFFER, buffer_irq_handler);
 
+
+  while(not_done){
+  }
+  asm volatile ("or r0, r0, r0");      // FIXME CPU bug workaround
+  asm volatile ("or r0, r0, r0");
+
+
   sim_finish();
   return 1;
 }

Modified: gnuradio/branches/developers/matt/u2f/firmware/timer_test.c
===================================================================
--- gnuradio/branches/developers/matt/u2f/firmware/timer_test.c 2007-09-26 
18:53:58 UTC (rev 6545)
+++ gnuradio/branches/developers/matt/u2f/firmware/timer_test.c 2007-09-26 
20:57:33 UTC (rev 6546)
@@ -1,22 +1,10 @@
 #include "u2_init.h"
 #include "memory_map.h"
-#include "spi.h"
 #include "sim_io.h"
 #include "buffer_pool.h"
 #include "pic.h"
 
-// Globals
-#define EMPTY 0
-#define FILLING 1
-#define FULL 2
-#define EMPTYING 3
 
-#define PORT 2    // ethernet = 2, serdes = 0
-int dsp_rx_buf, dsp_tx_buf, serdes_rx_buf, serdes_tx_buf;
-int dsp_rx_idle, dsp_tx_idle, serdes_rx_idle, serdes_tx_idle;
-
-int buffer_state[4];
-
 #define DELTA_T  500           // 5 us (10ns per tick)
 
 
@@ -26,7 +14,7 @@
   int t = timer_regs->time;
   timer_regs->time = t + DELTA_T;
 
-  sim_puts("Tick:");
+  sim_puts("Tick: ");
   sim_puthex_nl(t);
 }
 
@@ -35,20 +23,14 @@
 int
 main(void)
 {
-  int t;
-  
-  sim_puts("Start INIT\n");
   u2_init();
 
-  sim_puts("Setting up interrupt controller\n");
-  pic_init();
-
   // setup timer
 
   sim_puts("Setting up timer\n");
   pic_register_handler(IRQ_TIMER, timer_handler);
 
-  t = timer_regs->time;
+  int t = timer_regs->time;
   timer_regs->time = t + DELTA_T;
 
   while(not_done){

Modified: gnuradio/branches/developers/matt/u2f/firmware/u2_init.c
===================================================================
--- gnuradio/branches/developers/matt/u2f/firmware/u2_init.c    2007-09-26 
18:53:58 UTC (rev 6545)
+++ gnuradio/branches/developers/matt/u2f/firmware/u2_init.c    2007-09-26 
20:57:33 UTC (rev 6546)
@@ -2,6 +2,7 @@
 #include "u2_init.h"
 #include "memory_map.h"
 #include "spi.h"
+#include "pic.h"
 #include "sim_io.h"
 
 /*
@@ -11,14 +12,10 @@
 int 
 u2_init(void)
 {
+  sim_puts("u2_init\n");
 
-  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
@@ -65,5 +62,8 @@
   //output_regs->serdes_ctrl = (SERDES_ENABLE | SERDES_LOOPEN | SERDES_RXEN);
   output_regs->serdes_ctrl = (SERDES_ENABLE | SERDES_RXEN);
 
+  // sim_puts("Setting up interrupt controller\n");
+  pic_init();
+
   return 1;
 }





reply via email to

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