svn commit: r195311 - projects/mesh11s/sys/net80211

Rui Paulo rpaulo at FreeBSD.org
Fri Jul 3 15:12:08 UTC 2009


Author: rpaulo
Date: Fri Jul  3 15:12:07 2009
New Revision: 195311
URL: http://svn.freebsd.org/changeset/base/195311

Log:
  Add little endian macros.
  
  Sponsored by:	The FreeBSD Foundation

Modified:
  projects/mesh11s/sys/net80211/ieee80211_hwmp.c

Modified: projects/mesh11s/sys/net80211/ieee80211_hwmp.c
==============================================================================
--- projects/mesh11s/sys/net80211/ieee80211_hwmp.c	Fri Jul  3 15:10:05 2009	(r195310)
+++ projects/mesh11s/sys/net80211/ieee80211_hwmp.c	Fri Jul  3 15:12:07 2009	(r195311)
@@ -140,6 +140,19 @@ static const struct timeval ieee80211_hw
 #define	HWMP_LOCK(hs)		mtx_lock(&(hs)->hs_lock)
 #define	HWMP_UNLOCK(hs)		mtx_unlock(&(hs)->hs_lock)
 
+/* unalligned little endian access */
+#define LE_WRITE_2(p, v) do {				\
+	((uint8_t *)(p))[0] = (v) & 0xff;		\
+	((uint8_t *)(p))[1] = ((v) >> 8) & 0xff;	\
+} while (0)
+#define LE_WRITE_4(p, v) do {				\                                             
+	((uint8_t *)(p))[0] = (v) & 0xff;		\
+	((uint8_t *)(p))[1] = ((v) >> 8) & 0xff;	\
+	((uint8_t *)(p))[2] = ((v) >> 16) & 0xff;	\
+	((uint8_t *)(p))[3] = ((v) >> 24) & 0xff;	\
+} while (0)
+
+
 /* NB: the Target Address set in a Proactive PREQ is the broadcast address. */
 static const uint8_t	broadcastaddr[IEEE80211_ADDR_LEN] =
 	{ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };


More information about the svn-src-projects mailing list