Network order for telosb.
authortravisutk <travisutk@12e2690d-a6be-4b82-a7b7-67c4a43b65c8>
Sat, 12 Feb 2011 22:24:59 +0000 (22:24 +0000)
committertravisutk <travisutk@12e2690d-a6be-4b82-a7b7-67c4a43b65c8>
Sat, 12 Feb 2011 22:24:59 +0000 (22:24 +0000)
git-svn-id: https://svn.code.sf.net/p/goodfet/code/trunk@917 12e2690d-a6be-4b82-a7b7-67c4a43b65c8

firmware/platforms/telosb.h

index f91aa55..98b94bc 100644 (file)
 #define SETCE P4OUT|=BIT6
 #define CLRCE P4OUT&=~BIT6
 #define DIRCE P4DIR|=BIT6
 #define SETCE P4OUT|=BIT6
 #define CLRCE P4OUT&=~BIT6
 #define DIRCE P4DIR|=BIT6
+
+
+// network byte order converters
+#define htons(x) ((((uint16_t)(x) & 0xFF00) >> 8) | \
+                                (((uint16_t)(x) & 0x00FF) << 8))
+#define htonl(x) ((((uint32_t)(x) & 0xFF000000) >> 24) | \
+                                 (((uint32_t)(x) & 0x00FF0000) >> 8) | \
+                                 (((uint32_t)(x) & 0x0000FF00) << 8) | \
+                                 (((uint32_t)(x) & 0x000000FF) << 24))
+
+#define ntohs htons
+#define ntohl htonl
+