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
34 /* INITPLATFORM PX.7 PX.6 PX.5 PX.4 PX.3 PX.2 PX.1 PX.0
35 HUM HUM HUM RGIO1 RGIO0 PDVCC UART1TX PKT_INT
36 P1DIR = 0xe0 11100000 Out Out Out In In In In In
38 UsrInt GIO3 NC 1Wire GIO2 UART1RX GIO1 GIO0
39 P2DIR = 0x7b 01111011 In Out Out Out Out In Out Out
40 P2OUT = 0x10 00010000 Hi
41 U1RX U1TX U0RX U0TX RSCLK R_SO R_SI NC
42 P3DIR = 0xf1 11110001 Out Out Out Out In In In Out
44 FHold RRST RVREFEN F_CS NC R_CS R_SFD NC
45 P4DIR = 0xfd 11111101 Out Out Out Out Out Out In Out
46 P4OUT = 0xfd 11111101 Hi Hi Hi Hi Hi Hi Lo Hi
47 SVSoutLED3 LED2 LED1 NC NC NC NC
48 P5DIR = 0xff 11111111 Out Out Out Out Out Out Out Out
49 P5OUT = 0xff 11111111 Hi Hi Hi Hi Hi Hi Hi Hi
50 SVSin DAC0 ADC5 ADC4 ADC3 ADC2 ADC1 ADC0
51 P6DIR = 0xff 11111111 Out Out Out Out Out Out Out Out
55 /* For the radio to be used:
56 4.6 (!RST) must be low
57 4.5 (VREF_EN) must be high
58 4.2 (!CS) must be low for the transaction.
61 #define INITPLATFORM \
76 #define SETSS P4OUT|=BIT2
77 #define CLRSS P4OUT&=~BIT2
78 #define DIRSS P4DIR|=BIT2
80 //Flash CS is P4.4, redefine only for the SPI app.
85 #define SETSS P4OUT|=BIT4
86 #define CLRSS P4OUT&=~BIT4
87 #define DIRSS P4DIR|=BIT4
91 #define SETCE P4OUT|=BIT6
92 #define CLRCE P4OUT&=~BIT6
93 #define DIRCE P4DIR|=BIT6
96 #define SFD (P4IN&BIT1)
97 #define FIFOP (P1IN&BIT0)
98 #define FIFO (P1IN&BIT3)
101 // network byte order converters
102 #define htons(x) ((((uint16_t)(x) & 0xFF00) >> 8) | \
103 (((uint16_t)(x) & 0x00FF) << 8))
104 #define htonl(x) ((((uint32_t)(x) & 0xFF000000) >> 24) | \
105 (((uint32_t)(x) & 0x00FF0000) >> 8) | \
106 (((uint32_t)(x) & 0x0000FF00) << 8) | \
107 (((uint32_t)(x) & 0x000000FF) << 24))