Contiki 2.5
contiki-conf.h
1 #ifndef __CONTIKI_CONF_H__CDBB4VIH3I__
2 #define __CONTIKI_CONF_H__CDBB4VIH3I__
3 
4 #include <stdint.h>
5 #include <cc2420-interrupt.h>
6 #include <AT91SAM7S64.h>
7 #include <io.h>
8 
9 #define CCIF
10 #define CLIF
11 
12 #define WITH_UIP 1
13 #define WITH_ASCII 1
14 
15 #define CLOCK_CONF_SECOND 100
16 typedef uint8_t u8_t;
17 typedef uint16_t u16_t;
18 typedef uint32_t u32_t;
19 typedef int8_t s8_t;
20 typedef int16_t s16_t;
21 typedef int32_t s32_t;
22 
23 typedef unsigned int clock_time_t;
24 typedef unsigned int uip_stats_t;
25 
26 #ifndef BV
27 #define BV(x) (1<<(x))
28 #endif
29 
30 /* SPI */
31 #define SPI_TXBUF *AT91C_SPI_TDR
32 
33 #define SPI_RXBUF ((unsigned char)*AT91C_SPI_RDR)
34 
35 #define SPI_WAITFOREOTx() while ((*AT91C_SPI_SR & AT91C_SPI_TXEMPTY) == 0)
36 
37 #define SPI_WAITFOREORx() while ((*AT91C_SPI_SR & AT91C_SPI_RDRF) == 0)
38 
39 /* CC2420 control pins */
40 /* LOOP count for waiting 20 symbols in the CC2420 code - same as MSP? */
41 #define CC2420_CONF_SYMBOL_LOOP_COUNT 800
42 
43 
44 #define FIFO_IS_1 (*AT91C_PIOA_PDSR & AT91C_PIO_PA2)
45 #define VREG_IS_1 1 /* Hardwired */
46 #define FIFOP_IS_1 (*AT91C_PIOA_PDSR & AT91C_PIO_PA30)
47 #define SFD_IS_1 (*AT91C_PIOA_PDSR & AT91C_PIO_PA15)
48 #define CCA_IS_1 1
49 
50 #define SET_RESET_INACTIVE() setreg(CC2420_MAIN, 0xf800);
51 #define SET_RESET_ACTIVE() setreg(CC2420_MAIN, 0x0000);
52 
53 #define SET_VREG_ACTIVE()
54 #define SET_VREG_INACTIVE()
55 
56 #define FIFOP_INT_INIT() cc2420_interrupt_fifop_int_init()
57 #define DISABLE_FIFOP_INT() (*AT91C_AIC_IDCR = (1 << AT91C_ID_IRQ1))
58 #define ENABLE_FIFOP_INT() (*AT91C_AIC_IECR = (1 << AT91C_ID_IRQ1))
59 
60 #define CC2420_DEFAULT_DEV 1
61 
62 #define SPI_ENABLE() \
63 do { \
64 *AT91C_SPI_MR = ((*AT91C_SPI_MR & ~AT91C_SPI_PCS) \
65  | ((~(1<<CC2420_DEFAULT_DEV) & 0x0f) << 16));\
66 } while(0)
67 
68 /* Automatically enabled when transmitting */
69 
70 #define SPI_DISABLE() (*AT91C_SPI_CR = AT91C_SPI_LASTXFER)
71 
72 #define CLEAR_FIFOP_INT() (*AT91C_AIC_ICCR = (1 << AT91C_ID_IRQ1))
73 
74 #define LOOP_20_SYMBOLS (MCK/28125) /* Assume the loop takes 9 cycles */
75 
76 /* uIP configuration */
77 #define UIP_CONF_LLH_LEN 0
78 #define UIP_CONF_BROADCAST 1
79 #define UIP_CONF_LOGGING 1
80 #define UIP_CONF_BUFFER_SIZE 116
81 
82 #define UIP_CONF_TCP_FORWARD 1
83 
84 /* USB definitions */
85 #define USB_EP1_SIZE 64
86 #define USB_EP2_SIZE 64
87 #define USB_EP3_SIZE 64
88 
89 #define USB_RBC_NUM_BLOCKS 16
90 /* Prefix for relocation sections in ELF files */
91 #define REL_SECT_PREFIX ".rel"
92 
93 #define CC_BYTE_ALIGNED __attribute__ ((packed, aligned(1)))
94 
95 
96 #endif /* __CONTIKI_CONF_H__CDBB4VIH3I__ */