X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;f=firmware%2Fplatforms%2Fnhbadge.h;h=29e19a1b86ad89fbce9e56b143af6a772a669eb0;hb=9a80a19cb770d327da52ec6d04ad0fc564f62270;hp=8e3e59f7bb64da67419fa48ee0e51442bedc4735;hpb=854dba571fe62948dfb23a396be3299225fcbb05;p=goodfet 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