turn ftdi driver into echo server
[goodfet] / firmware / platforms / goodfet.h
1 /*! \file goodfet.h
2   \author Travis Goodspeed
3   \brief Port descriptions for the GoodFET platform.
4 */
5
6 /* #ifdef __MSPGCC__ */
7 /* #include <msp430.h> */
8 /* #else */
9 /* #include <signal.h> */
10 /* #include <msp430.h> */
11 /* #include <iomacros.h> */
12 /* #endif */
13
14 #ifndef _GNU_ASSEMBLER_
15 #include <msp430.h>
16 #endif
17
18 //LED on P1.0
19 #define PLEDOUT P1OUT
20 #define PLEDDIR P1DIR
21 #define PLEDPIN BIT0
22
23 //Use P3 instead of P5 for target I/O on chips without P5.
24 #ifdef msp430f2274
25 //#warning "No P5, using P3 instead.  Will break 2618 and 1612 support."
26 #define P5OUT P3OUT
27 #define P5DIR P3DIR
28 #define P5IN P3IN
29 #define P5REN P3REN
30
31 #define SPIOUT P3OUT
32 #define SPIDIR P3DIR
33 #define SPIIN  P3IN
34 #define SPIREN P3REN
35 #else
36
37 #define SPIOUT P5OUT
38 #define SPIDIR P5DIR
39 #define SPIIN  P5IN
40 #define SPIREN P5REN
41
42 #endif
43
44 //This is how things used to work, don't do it anymore.
45 //#ifdef msp430x1612
46 //#define P5REN somedamnedextern
47 //#endif
48
49 //No longer works for Hope badge.
50 #define SETSS P5OUT|=BIT0
51 #define CLRSS P5OUT&=~BIT0
52 #define DIRSS P5DIR|=BIT0;
53
54 //Used for the Nordic port, !RST pin on regular GoodFET.
55 #define SETCE P2OUT|=BIT6
56 #define CLRCE P2OUT&=~BIT6
57 #define DIRCE P2DIR|=BIT6
58
59 // network byte order converters
60 #define htons(x) ((((uint16_t)(x) & 0xFF00) >> 8) | \
61                                  (((uint16_t)(x) & 0x00FF) << 8))
62 #define htonl(x) ((((uint32_t)(x) & 0xFF000000) >> 24) | \
63                                   (((uint32_t)(x) & 0x00FF0000) >> 8) | \
64                                   (((uint32_t)(x) & 0x0000FF00) << 8) | \
65                                   (((uint32_t)(x) & 0x000000FF) << 24))
66
67 #define ntohs htons
68 #define ntohl htonl
69