[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] r7144 - in usrp2/trunk: firmware/apps firmware/include
From: |
eb |
Subject: |
[Commit-gnuradio] r7144 - in usrp2/trunk: firmware/apps firmware/include host/apps host/lib |
Date: |
Wed, 12 Dec 2007 22:06:37 -0700 (MST) |
Author: eb
Date: 2007-12-12 22:06:37 -0700 (Wed, 12 Dec 2007)
New Revision: 7144
Modified:
usrp2/trunk/firmware/apps/gen_eth_packets.c
usrp2/trunk/firmware/apps/rcv_eth_packets.c
usrp2/trunk/firmware/apps/rx_only.c
usrp2/trunk/firmware/apps/test_serdes.c
usrp2/trunk/firmware/include/usrp2_eth_packet.h
usrp2/trunk/host/apps/find_usrps.cc
usrp2/trunk/host/lib/usrp2_basic.cc
usrp2/trunk/host/lib/usrp2_basic.h
Log:
new data type for mac addr
Modified: usrp2/trunk/firmware/apps/gen_eth_packets.c
===================================================================
--- usrp2/trunk/firmware/apps/gen_eth_packets.c 2007-12-13 04:45:29 UTC (rev
7143)
+++ usrp2/trunk/firmware/apps/gen_eth_packets.c 2007-12-13 05:06:37 UTC (rev
7144)
@@ -36,11 +36,9 @@
// ----------------------------------------------------------------
-unsigned char dst_mac_addr[6] = {
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
-};
+static u2_mac_addr_t dst_mac_addr =
+ {{ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }};
-
// ----------------------------------------------------------------
// #define PACKET_SIZE 1500 // bytes
@@ -139,10 +137,9 @@
u2_eth_packet_t pkt __attribute__((aligned (4)));
- for (i = 0; i < 6; i++){
- pkt.ehdr.dst_addr[i] = dst_mac_addr[i];
- pkt.ehdr.src_addr[i] = 0x44; // filled in by mac
- }
+ pkt.ehdr.dst = dst_mac_addr;
+ // src address filled in by mac
+
pkt.ehdr.ethertype = U2_ETHERTYPE;
pkt.ehdr._pad = 0x5555;
pkt.fixed.word0 = 0x01234567;
Modified: usrp2/trunk/firmware/apps/rcv_eth_packets.c
===================================================================
--- usrp2/trunk/firmware/apps/rcv_eth_packets.c 2007-12-13 04:45:29 UTC (rev
7143)
+++ usrp2/trunk/firmware/apps/rcv_eth_packets.c 2007-12-13 05:06:37 UTC (rev
7144)
@@ -36,9 +36,8 @@
// ----------------------------------------------------------------
-unsigned char dst_mac_addr[6] = {
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
-};
+static u2_mac_addr_t dst_mac_addr =
+ {{ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }};
// ----------------------------------------------------------------
@@ -136,10 +135,8 @@
u2_eth_packet_t pkt __attribute__((aligned (4)));
- for (i = 0; i < 6; i++){
- pkt.ehdr.dst_addr[i] = dst_mac_addr[i];
- pkt.ehdr.src_addr[i] = 0; // filled in by mac
- }
+ pkt.ehdr.dst = dst_mac_addr;
+ // src filled in by mac
pkt.ehdr.ethertype = U2_ETHERTYPE;
// fill ALL buffers for debugging
Modified: usrp2/trunk/firmware/apps/rx_only.c
===================================================================
--- usrp2/trunk/firmware/apps/rx_only.c 2007-12-13 04:45:29 UTC (rev 7143)
+++ usrp2/trunk/firmware/apps/rx_only.c 2007-12-13 05:06:37 UTC (rev 7144)
@@ -72,7 +72,7 @@
static void
set_reply_hdr(u2_eth_packet_t *reply_pkt, u2_eth_packet_t const *cmd_pkt)
{
- memcpy(reply_pkt->ehdr.dst_addr, cmd_pkt->ehdr.src_addr, 6);
+ reply_pkt->ehdr.dst = cmd_pkt->ehdr.src;
reply_pkt->ehdr.ethertype = U2_ETHERTYPE;
reply_pkt->ehdr._pad = 0;
u2p_set_word0(&reply_pkt->fixed, 0, CONTROL_CHAN);
Modified: usrp2/trunk/firmware/apps/test_serdes.c
===================================================================
--- usrp2/trunk/firmware/apps/test_serdes.c 2007-12-13 04:45:29 UTC (rev
7143)
+++ usrp2/trunk/firmware/apps/test_serdes.c 2007-12-13 05:06:37 UTC (rev
7144)
@@ -33,11 +33,9 @@
// ----------------------------------------------------------------
-unsigned char dst_mac_addr[6] = {
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
-};
+static u2_mac_addr_t dst_mac_addr =
+ {{ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }};
-
// ----------------------------------------------------------------
// #define PACKET_SIZE 1500 // bytes
@@ -133,10 +131,8 @@
u2_eth_packet_t pkt __attribute__((aligned (4)));
- for (i = 0; i < 6; i++){
- pkt.ehdr.dst_addr[i] = dst_mac_addr[i];
- pkt.ehdr.src_addr[i] = 0; // filled in by mac
- }
+ pkt.ehdr.dst = dst_mac_addr;
+ // pkt.ehdr.src filled in by mac
pkt.ehdr.ethertype = U2_ETHERTYPE;
// fill ALL buffers for debugging
Modified: usrp2/trunk/firmware/include/usrp2_eth_packet.h
===================================================================
--- usrp2/trunk/firmware/include/usrp2_eth_packet.h 2007-12-13 04:45:29 UTC
(rev 7143)
+++ usrp2/trunk/firmware/include/usrp2_eth_packet.h 2007-12-13 05:06:37 UTC
(rev 7144)
@@ -32,11 +32,15 @@
* All these data structures are BIG-ENDIAN on the wire
*/
+typedef struct {
+ uint8_t addr[6];
+} u2_mac_addr_t;
+
/* The classic 14-byte ethernet header */
typedef struct {
- uint8_t dst_addr[6];
- uint8_t src_addr[6];
+ u2_mac_addr_t dst;
+ u2_mac_addr_t src;
uint16_t ethertype;
} u2_eth_hdr_t;
@@ -46,8 +50,8 @@
* in the U2 is only word addressable...)
*/
typedef struct {
- uint8_t dst_addr[6];
- uint8_t src_addr[6];
+ u2_mac_addr_t dst;
+ u2_mac_addr_t src;
uint16_t ethertype;
uint16_t _pad; // MBZ. force 32-bit alignment for payload
} u2_eth_hdr_with_pad_t;
Modified: usrp2/trunk/host/apps/find_usrps.cc
===================================================================
--- usrp2/trunk/host/apps/find_usrps.cc 2007-12-13 04:45:29 UTC (rev 7143)
+++ usrp2/trunk/host/apps/find_usrps.cc 2007-12-13 05:06:37 UTC (rev 7144)
@@ -39,5 +39,12 @@
for (size_t i = 0; i < r.size(); i++){
std::cout << r[i] << std::endl;
}
+
+ if (r.size() == 0){
+ std::cerr << "No USRP2 found.\n";
+ return 1;
+ }
+
+
}
Modified: usrp2/trunk/host/lib/usrp2_basic.cc
===================================================================
--- usrp2/trunk/host/lib/usrp2_basic.cc 2007-12-13 04:45:29 UTC (rev 7143)
+++ usrp2/trunk/host/lib/usrp2_basic.cc 2007-12-13 05:06:37 UTC (rev 7144)
@@ -73,8 +73,8 @@
std::vector<op_id_reply_t>
usrp2_basic::find_usrps()
{
- static const uint8_t broadcast_mac_addr[6] =
- { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
+ static u2_mac_addr_t broadcast_mac_addr =
+ {{ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }};
std::vector<op_id_reply_t> result;
int r;
@@ -95,8 +95,8 @@
command *c = (command *) pktbuf;
c->h.ehdr.ethertype = htons(U2_ETHERTYPE);
c->h.ehdr._pad = time(0);
- memcpy(c->h.ehdr.dst_addr, broadcast_mac_addr, 6);
- memcpy(c->h.ehdr.src_addr, d_ethernet->mac(), 6);
+ c->h.ehdr.dst = broadcast_mac_addr;
+ memcpy(&c->h.ehdr.src, d_ethernet->mac(), 6);
u2p_set_word0(&c->h.fixed, 0, CONTROL_CHAN);
u2p_set_timestamp(&c->h.fixed, -1);
Modified: usrp2/trunk/host/lib/usrp2_basic.h
===================================================================
--- usrp2/trunk/host/lib/usrp2_basic.h 2007-12-13 04:45:29 UTC (rev 7143)
+++ usrp2/trunk/host/lib/usrp2_basic.h 2007-12-13 05:06:37 UTC (rev 7144)
@@ -42,7 +42,12 @@
bool open(std::string ifname = "eth0");
bool close();
+ /*!
+ * Return a vector that describes all usrps found
+ */
std::vector<op_id_reply_t> find_usrps();
+
+ bool start_rx(const u2_mac_addr_t &addr);
};
std::ostream& operator<<(std::ostream &os,
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Commit-gnuradio] r7144 - in usrp2/trunk: firmware/apps firmware/include host/apps host/lib,
eb <=