2 \author Travis Goodspeed
3 \brief Port descriptions for the TelosB platform.
5 This file defines the Telos B hardware, so that the GoodFET firmware
6 may be loaded onto it. Adjustments include the !CS line of the CC2420
7 radio, the choice of serial port, and the LEDs.
11 #ifndef _GNU_ASSEMBLER_
15 //LED on P5.4 (LED1 red)
19 //LED on P5.5 (LED2 green)
20 #define PLED2OUT P5OUT
21 #define PLED2DIR P5DIR
23 //LED on P5.6 (LED3 blue)
24 #define PLED3OUT P5OUT
25 #define PLED3DIR P5DIR
35 /* For the radio to be used:
36 4.6 (!RST) must be low
37 4.5 (VREF_EN) must be high
38 4.2 (!CS) must be low for the transaction.
41 #define INITPLATFORM \
56 #define SETSS P4OUT|=BIT2
57 #define CLRSS P4OUT&=~BIT2
58 #define DIRSS P4DIR|=BIT2
60 //Flash CS is P4.4, redefine only for the SPI app.
65 #define SETSS P4OUT|=BIT4
66 #define CLRSS P4OUT&=~BIT4
67 #define DIRSS P4DIR|=BIT4
71 #define SETCE P4OUT|=BIT6
72 #define CLRCE P4OUT&=~BIT6
73 #define DIRCE P4DIR|=BIT6
76 #define SFD (P4IN&BIT1)
77 #define FIFOP (P1IN&BIT0)
78 #define FIFO (P1IN&BIT3)
81 #define GIO0 (P2OUT&BIT0)
82 #define GIO0HIGH P2OUT|=BIT0
83 #define GIO0LOW P2OUT&=~BIT0
88 // network byte order converters
89 #define htons(x) ((((uint16_t)(x) & 0xFF00) >> 8) | \
90 (((uint16_t)(x) & 0x00FF) << 8))
91 #define htonl(x) ((((uint32_t)(x) & 0xFF000000) >> 24) | \
92 (((uint32_t)(x) & 0x00FF0000) >> 8) | \
93 (((uint32_t)(x) & 0x0000FF00) << 8) | \
94 (((uint32_t)(x) & 0x000000FF) << 24))