Contiki 2.6

cc2420-spi.c

00001 #include <AT91SAM7S64.h>
00002 #include <net/uip.h>
00003 #include <dev/cc2420.h>
00004 #include <sam7s-spi.h>
00005 
00006 #define SPI_SPEED 1000000  /* 1MHz clock*/
00007 #define SPI_DLYBCT 1
00008 #define SPI_DLYBS 20
00009 
00010 
00011 #ifndef BV
00012 #define BV(b) (1<<(b))
00013 #endif
00014 
00015 void
00016 cc2420_arch_init(void)
00017 {
00018   spi_init();
00019 
00020   AT91C_SPI_CSR[CC2420_DEFAULT_DEV] =
00021     ((SPI_DLYBCT<<24) | (SPI_DLYBS<<16) | (((MCK+SPI_SPEED/2)/SPI_SPEED)<<8)
00022                       | AT91C_SPI_NCPHA | AT91C_SPI_BITS_8 | AT91C_SPI_CSAAT);
00023 }