X-Git-Url: http://git.rot13.org/?p=goodfet;a=blobdiff_plain;f=firmware%2Fplatforms%2Fnhbadge.h;h=29e19a1b86ad89fbce9e56b143af6a772a669eb0;hp=8e3e59f7bb64da67419fa48ee0e51442bedc4735;hb=f4a366d95f96109559f0903611d7103c50cde3f7;hpb=854dba571fe62948dfb23a396be3299225fcbb05 diff --git a/firmware/platforms/nhbadge.h b/firmware/platforms/nhbadge.h index 8e3e59f..29e19a1 100644 --- a/firmware/platforms/nhbadge.h +++ b/firmware/platforms/nhbadge.h @@ -5,7 +5,7 @@ #ifdef MSP430 -#include +#include #endif @@ -31,3 +31,14 @@ #define SPIDIR P5DIR #define SPIIN P5IN #define SPIREN P5REN + +// 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