[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] r6836 - gnuradio/branches/developers/matt/u2f/firmware
From: |
eb |
Subject: |
[Commit-gnuradio] r6836 - gnuradio/branches/developers/matt/u2f/firmware |
Date: |
Thu, 8 Nov 2007 12:42:56 -0700 (MST) |
Author: eb
Date: 2007-11-08 12:42:55 -0700 (Thu, 08 Nov 2007)
New Revision: 6836
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
Log:
provide fake mii data under simulation
Modified: gnuradio/branches/developers/matt/u2f/firmware/eth_driver.c
===================================================================
--- gnuradio/branches/developers/matt/u2f/firmware/eth_driver.c 2007-11-08
18:58:29 UTC (rev 6835)
+++ gnuradio/branches/developers/matt/u2f/firmware/eth_driver.c 2007-11-08
19:42:55 UTC (rev 6836)
@@ -91,11 +91,7 @@
static void
ed_check_phy_state(void)
{
-#if 1
- int lansr = eth_mac_miim_read(PHY_LINK_AN); //FIXME put back in
-#else
- int lansr = LANSR_LINK_GOOD | LANSR_SPEED_1000;
-#endif
+ int lansr = eth_mac_miim_read(PHY_LINK_AN);
eth_link_state_t new_state = LS_UNKNOWN;
int new_speed = S_UNKNOWN;
Modified: gnuradio/branches/developers/matt/u2f/firmware/eth_mac.c
===================================================================
--- gnuradio/branches/developers/matt/u2f/firmware/eth_mac.c 2007-11-08
18:58:29 UTC (rev 6835)
+++ gnuradio/branches/developers/matt/u2f/firmware/eth_mac.c 2007-11-08
19:42:55 UTC (rev 6836)
@@ -21,9 +21,17 @@
#include "eth_mac.h"
#include "memory_map.h"
+#include "bool.h"
+#include "eth_phy.h" // for simulation constants
#define PHY_ADDR 1
+inline static bool
+simulation_p(void)
+{
+ return buffer_pool_status->sim_mode;
+}
+
void
eth_mac_init(void)
{
@@ -50,6 +58,15 @@
int
eth_mac_miim_read(int addr)
{
+ if (simulation_p()){
+ switch(addr){
+ case PHY_LINK_AN:
+ return LANSR_MASTER | LANSR_LINK_GOOD | LANSR_SPEED_1000;
+ default:
+ return 0;
+ }
+ }
+
int phy_addr = PHY_ADDR;
eth_mac->miiaddress = ((addr & 0x1f) << 8) | phy_addr;
eth_mac->miicommand = MIIC_RSTAT;
@@ -75,5 +92,8 @@
int
eth_mac_miim_read_status(void)
{
+ if (simulation_p())
+ return 0;
+
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-08 18:58:29 UTC (rev 6835)
+++ gnuradio/branches/developers/matt/u2f/firmware/gen_eth_packets.c
2007-11-08 19:42:55 UTC (rev 6836)
@@ -136,14 +136,8 @@
static void
init_packet(int *buf, const ethernet_packet_t *pkt)
{
-#if 1
// copy header into buffer
memcpy_wordaligned(buf, pkt, sizeof(*pkt));
-#else
- buf[1] = 0xffff000A;
- buf[2] = 0x35987654;
- buf[3] = 0xBEEF0000;
-#endif
union {
int i;
Modified: gnuradio/branches/developers/matt/u2f/firmware/memory_map.h
===================================================================
--- gnuradio/branches/developers/matt/u2f/firmware/memory_map.h 2007-11-08
18:58:29 UTC (rev 6835)
+++ gnuradio/branches/developers/matt/u2f/firmware/memory_map.h 2007-11-08
19:42:55 UTC (rev 6836)
@@ -161,6 +161,7 @@
typedef struct {
volatile unsigned last_line[8]; // last line xfer'd in buffer
volatile unsigned status; // error and done flags
+ volatile unsigned sim_mode; // LSB is 1 if we're in simulation
} buffer_pool_status_t;
#define buffer_pool_status ((buffer_pool_status_t *) BUFFER_POOL_STATUS_BASE)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Commit-gnuradio] r6836 - gnuradio/branches/developers/matt/u2f/firmware,
eb <=