commit-gnuradio
[Top][All Lists]
Advanced

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

[Commit-gnuradio] r8657 - in usrp2/branches/features/host-ng: firmware/i


From: eb
Subject: [Commit-gnuradio] r8657 - in usrp2/branches/features/host-ng: firmware/include firmware/lib host-ng/lib
Date: Sun, 22 Jun 2008 18:19:02 -0600 (MDT)

Author: eb
Date: 2008-06-22 18:19:01 -0600 (Sun, 22 Jun 2008)
New Revision: 8657

Added:
   usrp2/branches/features/host-ng/firmware/lib/usrp2_bytesex.h
   usrp2/branches/features/host-ng/host-ng/lib/usrp2_bytesex.h
Removed:
   usrp2/branches/features/host-ng/firmware/include/usrp2_bytesex.h
Log:
cleaner fix for usrp2_bytesex issue vis-a-vis gruel/inet.h

Deleted: usrp2/branches/features/host-ng/firmware/include/usrp2_bytesex.h

Copied: usrp2/branches/features/host-ng/firmware/lib/usrp2_bytesex.h (from rev 
8656, usrp2/branches/features/host-ng/firmware/include/usrp2_bytesex.h)
===================================================================
--- usrp2/branches/features/host-ng/firmware/lib/usrp2_bytesex.h                
                (rev 0)
+++ usrp2/branches/features/host-ng/firmware/lib/usrp2_bytesex.h        
2008-06-23 00:19:01 UTC (rev 8657)
@@ -0,0 +1,66 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2007 Free Software Foundation, Inc.
+ *
+ * This program 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 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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, see <http://www.gnu.org/licenses/>.
+ */
+#ifndef INCLUDED_USRP2_BYTESEX_H
+#define INCLUDED_USRP2_BYTESEX_H
+
+// The USRP2 speaks big-endian...
+// Use the standard include files or provide substitutions for
+// htons and friends
+
+#if defined(HAVE_ARPA_INET_H)
+#include <arpa/inet.h>
+#elif defined(HAVE_NETINET_IN_H)
+#include <netinet/in.h>
+#else
+#include <stdint.h>
+
+#ifdef WORDS_BIGENDIAN  // nothing to do...
+
+static inline uint32_t htonl(uint32_t x){ return x; }
+static inline uint16_t htons(uint16_t x){ return x; }
+static inline uint32_t ntohl(uint32_t x){ return x; }
+static inline uint16_t ntohs(uint16_t x){ return x; }
+
+#else
+
+#ifdef HAVE_BYTESWAP_H
+#include <byteswap.h>
+#else
+
+static inline uint16_t
+bswap_16 (uint16_t x)
+{
+  return ((((x) >> 8) & 0xff) | (((x) & 0xff) << 8));
+}
+
+static inline uint32_t
+bswap_32 (uint32_t x)
+{
+  return ((((x) & 0xff000000) >> 24) | (((x) & 0x00ff0000) >>  8) \
+        | (((x) & 0x0000ff00) <<  8) | (((x) & 0x000000ff) << 24));
+}
+#endif
+
+static inline uint32_t htonl(uint32_t x){ return bswap_32(x); }
+static inline uint16_t htons(uint16_t x){ return bswap_16(x); }
+static inline uint32_t ntohl(uint32_t x){ return bswap_32(x); }
+static inline uint16_t ntohs(uint16_t x){ return bswap_16(x); }
+
+#endif
+#endif
+#endif /* INCLUDED_USRP2_BYTESEX_H */

Added: usrp2/branches/features/host-ng/host-ng/lib/usrp2_bytesex.h
===================================================================
--- usrp2/branches/features/host-ng/host-ng/lib/usrp2_bytesex.h                 
        (rev 0)
+++ usrp2/branches/features/host-ng/host-ng/lib/usrp2_bytesex.h 2008-06-23 
00:19:01 UTC (rev 8657)
@@ -0,0 +1,19 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2008 Free Software Foundation, Inc.
+ *
+ * This program 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 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <gruel/inet.h>


Property changes on: usrp2/branches/features/host-ng/host-ng/lib/usrp2_bytesex.h
___________________________________________________________________
Name: svn:eol-style
   + native





reply via email to

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