Contiki 2.6

contiki-conf.h

00001 #ifndef __CONTIKI_CONF_H__CDBB4VIH3I__
00002 #define __CONTIKI_CONF_H__CDBB4VIH3I__
00003 
00004 #include <stdint.h>
00005 #include <cc2420-interrupt.h>
00006 #include <AT91SAM7S64.h>
00007 #include <io.h>
00008 
00009 #define CCIF
00010 #define CLIF
00011 
00012 #define WITH_UIP 1
00013 #define WITH_ASCII 1
00014 
00015 #define CLOCK_CONF_SECOND 100
00016 
00017 /* These names are deprecated, use C99 names. */
00018 typedef uint8_t u8_t;
00019 typedef uint16_t u16_t;
00020 typedef uint32_t u32_t;
00021 typedef int8_t s8_t;
00022 typedef int16_t s16_t;
00023 typedef int32_t s32_t;
00024 
00025 typedef unsigned int clock_time_t;
00026 typedef unsigned int uip_stats_t;
00027 
00028 #ifndef BV
00029 #define BV(x) (1<<(x))
00030 #endif
00031 
00032 /* SPI */
00033 #define SPI_TXBUF *AT91C_SPI_TDR
00034 
00035 #define SPI_RXBUF ((unsigned char)*AT91C_SPI_RDR)
00036 
00037 #define SPI_WAITFOREOTx() while ((*AT91C_SPI_SR & AT91C_SPI_TXEMPTY) == 0)
00038 
00039 #define SPI_WAITFOREORx() while ((*AT91C_SPI_SR & AT91C_SPI_RDRF) == 0)
00040 
00041 /* CC2420 control pins */
00042 /* LOOP count for waiting 20 symbols in the CC2420 code - same as MSP? */
00043 #define CC2420_CONF_SYMBOL_LOOP_COUNT 800
00044 
00045 
00046 #define FIFO_IS_1       (*AT91C_PIOA_PDSR & AT91C_PIO_PA2)
00047 #define VREG_IS_1       1 /* Hardwired */
00048 #define FIFOP_IS_1      (*AT91C_PIOA_PDSR & AT91C_PIO_PA30)
00049 #define SFD_IS_1        (*AT91C_PIOA_PDSR & AT91C_PIO_PA15)
00050 #define CCA_IS_1        1
00051 
00052 #define SET_RESET_INACTIVE()    setreg(CC2420_MAIN, 0xf800);
00053 #define SET_RESET_ACTIVE()      setreg(CC2420_MAIN, 0x0000);
00054 
00055 #define SET_VREG_ACTIVE()
00056 #define SET_VREG_INACTIVE()
00057 
00058 #define FIFOP_INT_INIT() cc2420_interrupt_fifop_int_init()
00059 #define DISABLE_FIFOP_INT() (*AT91C_AIC_IDCR = (1 << AT91C_ID_IRQ1))
00060 #define ENABLE_FIFOP_INT() (*AT91C_AIC_IECR = (1 << AT91C_ID_IRQ1))
00061 
00062 #define CC2420_DEFAULT_DEV 1
00063 
00064 #define SPI_ENABLE() \
00065 do { \
00066 *AT91C_SPI_MR = ((*AT91C_SPI_MR & ~AT91C_SPI_PCS) \
00067                  | ((~(1<<CC2420_DEFAULT_DEV) & 0x0f) << 16));\
00068 } while(0)
00069 
00070 /* Automatically enabled when transmitting */
00071 
00072 #define SPI_DISABLE()   (*AT91C_SPI_CR = AT91C_SPI_LASTXFER)
00073 
00074 #define CLEAR_FIFOP_INT() (*AT91C_AIC_ICCR = (1 << AT91C_ID_IRQ1))
00075 
00076 #define LOOP_20_SYMBOLS (MCK/28125) /* Assume the loop takes 9 cycles */
00077 
00078 /* uIP configuration */
00079 #define UIP_CONF_LLH_LEN         0
00080 #define UIP_CONF_BROADCAST       1
00081 #define UIP_CONF_LOGGING 1
00082 #define UIP_CONF_BUFFER_SIZE 116
00083 
00084 #define UIP_CONF_TCP_FORWARD 1
00085 
00086 /* USB definitions */
00087 #define USB_EP1_SIZE 64
00088 #define USB_EP2_SIZE 64
00089 #define USB_EP3_SIZE 64
00090 
00091 #define USB_RBC_NUM_BLOCKS 16
00092 /* Prefix for relocation sections in ELF files */
00093 #define REL_SECT_PREFIX ".rel"
00094 
00095 #define CC_BYTE_ALIGNED __attribute__ ((packed, aligned(1)))
00096 
00097 
00098 #endif /* __CONTIKI_CONF_H__CDBB4VIH3I__ */