X-Git-Url: http://git.rot13.org/?p=goodfet;a=blobdiff_plain;f=firmware%2Fplatforms%2Fnhbadge.h;h=29e19a1b86ad89fbce9e56b143af6a772a669eb0;hp=24544b3a64610f35a7010851bae4f712483abe8e;hb=6373a97ac3426c9d9966cf6a08286ecd13cc2ced;hpb=e9fb7dbba0d1abc23d14559e566da903331f1e8a diff --git a/firmware/platforms/nhbadge.h b/firmware/platforms/nhbadge.h index 24544b3..29e19a1 100644 --- a/firmware/platforms/nhbadge.h +++ b/firmware/platforms/nhbadge.h @@ -5,7 +5,7 @@ #ifdef MSP430 -#include +#include #endif @@ -26,3 +26,19 @@ #define SETCE P5OUT|=BIT5 #define CLRCE P5OUT&=~BIT5 #define DIRCE P5DIR|=BIT5 + +#define SPIOUT P5OUT +#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