X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;ds=inline;f=firmware%2Fplatforms%2Ftelosb.h;h=e69faa706248c2546ba52966bd215d8e52ec39c5;hb=ba0e5551e39ee0d35f21cf42dfc8d645dfe63b79;hp=26da46b1b70736d47b059a83b17a231ee658f25f;hpb=cec457aef4a1e0ff483012bc3ba0ef73ac7b6659;p=goodfet diff --git a/firmware/platforms/telosb.h b/firmware/platforms/telosb.h index 26da46b..e69faa7 100644 --- a/firmware/platforms/telosb.h +++ b/firmware/platforms/telosb.h @@ -45,17 +45,38 @@ P6OUT = 0x00; //Radio CS is P4.2 -//#define SETSS P4OUT|=BIT2 -//#define CLRSS P4OUT&=~BIT2 -//#define DIRSS P4DIR|=BIT2 +#define SETSS P4OUT|=BIT2 +#define CLRSS P4OUT&=~BIT2 +#define DIRSS P4DIR|=BIT2 -//Flash CS is P4.4 + +//Flash CS is P4.4, redefine only for the SPI app. +#ifdef SPIAPPLICATION +#undef SETSS +#undef CLRSS +#undef DIRSS #define SETSS P4OUT|=BIT4 #define CLRSS P4OUT&=~BIT4 #define DIRSS P4DIR|=BIT4 - +#endif //CC2420 Chip Enable #define SETCE P4OUT|=BIT6 #define CLRCE P4OUT&=~BIT6 #define DIRCE P4DIR|=BIT6 + +//CC2420 signals +#define SFD (P4IN&BIT1) +#define FIFOP (P4IN&BIT0) + +// 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 +