commit-gnuradio
[Top][All Lists]
Advanced

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

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


From: eb
Subject: [Commit-gnuradio] r6788 - gnuradio/branches/developers/matt/u2f/firmware
Date: Fri, 2 Nov 2007 00:25:16 -0600 (MDT)

Author: eb
Date: 2007-11-02 00:25:16 -0600 (Fri, 02 Nov 2007)
New Revision: 6788

Modified:
   gnuradio/branches/developers/matt/u2f/firmware/eth_driver.c
   gnuradio/branches/developers/matt/u2f/firmware/eth_mac.c
   gnuradio/branches/developers/matt/u2f/firmware/gen_eth_packets.c
   gnuradio/branches/developers/matt/u2f/firmware/memory_map.h
   gnuradio/branches/developers/matt/u2f/firmware/test_phy_comm.c
Log:
signs of life ;)

Modified: gnuradio/branches/developers/matt/u2f/firmware/eth_driver.c
===================================================================
--- gnuradio/branches/developers/matt/u2f/firmware/eth_driver.c 2007-11-02 
03:51:06 UTC (rev 6787)
+++ gnuradio/branches/developers/matt/u2f/firmware/eth_driver.c 2007-11-02 
06:25:16 UTC (rev 6788)
@@ -179,6 +179,8 @@
      | PHY_INT_SPD_CNG         // speed changed
      );
 
+  hal_putc('$');
+
   eth_mac_miim_write(PHY_INT_CLEAR, ~0);       // clear all pending interrupts
   eth_mac_miim_write(PHY_INT_MASK, mask);      // enable the ones we want
 

Modified: gnuradio/branches/developers/matt/u2f/firmware/eth_mac.c
===================================================================
--- gnuradio/branches/developers/matt/u2f/firmware/eth_mac.c    2007-11-02 
03:51:06 UTC (rev 6787)
+++ gnuradio/branches/developers/matt/u2f/firmware/eth_mac.c    2007-11-02 
06:25:16 UTC (rev 6788)
@@ -22,6 +22,8 @@
 #include "eth_mac.h"
 #include "memory_map.h"
 
+#define PHY_ADDR 1
+
 void 
 eth_mac_init(void)
 {
@@ -48,7 +50,7 @@
 int
 eth_mac_miim_read(int addr)
 {
-  int phy_addr = 0;
+  int phy_addr = PHY_ADDR;
   eth_mac->miiaddress = ((addr & 0x1f) << 8) | phy_addr;
   eth_mac->miicommand = MIIC_RSTAT;
 
@@ -61,7 +63,7 @@
 void
 eth_mac_miim_write(int addr, int value)
 {
-  int phy_addr = 0;
+  int phy_addr = PHY_ADDR;
   eth_mac->miiaddress = ((addr & 0x1f) << 8) | phy_addr;
   eth_mac->miitx_data = value;
   eth_mac->miicommand = MIIC_WCTRLDATA;
@@ -75,5 +77,3 @@
 {
   return eth_mac->miistatus;
 }
-
-

Modified: gnuradio/branches/developers/matt/u2f/firmware/gen_eth_packets.c
===================================================================
--- gnuradio/branches/developers/matt/u2f/firmware/gen_eth_packets.c    
2007-11-02 03:51:06 UTC (rev 6787)
+++ gnuradio/branches/developers/matt/u2f/firmware/gen_eth_packets.c    
2007-11-02 06:25:16 UTC (rev 6788)
@@ -5,7 +5,8 @@
 #include "buffer_pool.h"
 #include "pic.h"
 #include "bool.h"
-// #include <stdint.h>
+#include "eth_driver.h"
+#include "eth_mac.h"
 
 typedef int intptr_t;
 typedef unsigned size_t;
@@ -172,6 +173,7 @@
   init_packet(buffer_ram(1), &pkt);
 }
 
+static int led_counter = 0;
 
 int
 main(void)
@@ -189,12 +191,29 @@
   pic_register_handler(IRQ_TIMER, timer_irq_handler);
   hal_set_timeout(timer_delta);
 
-  int cb = 0;                  // current buffer; alternates btwn 0 & 1.
+  eth_driver_register_link_changed_callback(link_changed_callback);
+
+  eth_mac_init();
+  eth_driver_init();
+
+  eth_mac->speed = 4;  // FIXME hardcode mac speed to 1000
+
+
+  // int cb = 0;                       // current buffer; alternates btwn 0 & 
1.
   while(1){
-    if (link_is_up && send_packet_now){
+    if (/*link_is_up &&*/ send_packet_now){
       send_packet_now = false;
+
       // kick off the next packet
       // FIXME set packet number in packet
+
+      bp_clear_buf(0);
+      bp_send_from_buf(0, PORT_ETH, 1, 0, 300);
+
+      while ((buffer_pool_status->status & (BPS_DONE_0|BPS_ERROR_0)) != 0)
+       ;
+
+      output_regs->leds = (led_counter++) & 0x1;
     }
   }
 

Modified: gnuradio/branches/developers/matt/u2f/firmware/memory_map.h
===================================================================
--- gnuradio/branches/developers/matt/u2f/firmware/memory_map.h 2007-11-02 
03:51:06 UTC (rev 6787)
+++ gnuradio/branches/developers/matt/u2f/firmware/memory_map.h 2007-11-02 
06:25:16 UTC (rev 6788)
@@ -261,6 +261,7 @@
   volatile unsigned long       serdes_ctrl;
   volatile unsigned long       adc_ctrl;
   volatile unsigned long       leds;
+  volatile unsigned long       phy_ctrl;       // LSB is reset line to eth phy
 } output_regs_t;
 
 #define SERDES_ENABLE 8

Modified: gnuradio/branches/developers/matt/u2f/firmware/test_phy_comm.c
===================================================================
--- gnuradio/branches/developers/matt/u2f/firmware/test_phy_comm.c      
2007-11-02 03:51:06 UTC (rev 6787)
+++ gnuradio/branches/developers/matt/u2f/firmware/test_phy_comm.c      
2007-11-02 06:25:16 UTC (rev 6788)
@@ -29,7 +29,8 @@
 #include "pic.h"
 
 
-#define DELTA_T  50000000              // 0.5s (10ns per tick)
+#define DELTA_T     12500000           // .125s (10ns per tick)
+//#define DELTA_T      10000
 
 // debugging output on tx pins
 #define LS_MASK  0xE0000
@@ -89,16 +90,18 @@
 {
   u2_init();
 
-  hal_puts("\n\n@@@ test_phy_comm @@@\n\n\n");
+  hal_puts("\n test_phy_comm\n");
 
-  hal_puts("Setting up timer\n");
   pic_register_handler(IRQ_TIMER, timer_handler);
   hal_set_timeout(DELTA_T);    // schedule timeout
 
-  hal_gpio_set_tx_mode(15,13, GPIOM_OUTPUT);
+  hal_gpio_set_tx_mode(15, 13, GPIOM_OUTPUT);
 
   eth_driver_register_link_changed_callback(link_changed_callback);
 
+  output_regs->phy_ctrl = 1;   /* reset the eth PHY */
+  output_regs->phy_ctrl = 0;
+
   eth_mac_init();
   eth_driver_init();
 





reply via email to

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