X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;f=firmware%2Fplatforms%2Ftelosb.h;h=8fb28572d9af3c73eabe822fbc3f251905f0071b;hb=5bffb24e3e49be3e6667f45950cb158eda019b37;hp=f91aa5514180a7c9af24bdf60fdd955499ddb5fa;hpb=e027df82b3f7b6c0ed428a504220e13ae02886e9;p=goodfet diff --git a/firmware/platforms/telosb.h b/firmware/platforms/telosb.h index f91aa55..8fb2857 100644 --- a/firmware/platforms/telosb.h +++ b/firmware/platforms/telosb.h @@ -8,14 +8,22 @@ */ -#ifdef MSP430 -#include +#ifndef _GNU_ASSEMBLER_ +#include #endif -//LED on P5.4 +//LED on P5.4 (LED1 red) #define PLEDOUT P5OUT #define PLEDDIR P5DIR #define PLEDPIN BIT4 +//LED on P5.5 (LED2 green) +#define PLED2OUT P5OUT +#define PLED2DIR P5DIR +#define PLED2PIN BIT5 +//LED on P5.6 (LED3 blue) +#define PLED3OUT P5OUT +#define PLED3DIR P5DIR +#define PLED3PIN BIT6 #define SPIOUT P3OUT @@ -49,7 +57,6 @@ #define CLRSS P4OUT&=~BIT2 #define DIRSS P4DIR|=BIT2 - //Flash CS is P4.4, redefine only for the SPI app. #ifdef SPIAPPLICATION #undef SETSS @@ -64,3 +71,28 @@ #define SETCE P4OUT|=BIT6 #define CLRCE P4OUT&=~BIT6 #define DIRCE P4DIR|=BIT6 + +//CC2420 signals +#define SFD (P4IN&BIT1) +#define FIFOP (P1IN&BIT0) +#define FIFO (P1IN&BIT3) + +//GPIO Expansion Pins +#define GIO0 (P2OUT&BIT0) +#define GIO0HIGH P2OUT|=BIT0 +#define GIO0LOW P2OUT&=~BIT0 +#define GIO0OUT P2OUT +#define GIO0DIR P2DIR +#define GIO0PIN 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 +