Contiki 2.5
cc2420-spi.c
1 #include <AT91SAM7S64.h>
2 #include <net/uip.h>
3 #include <dev/cc2420.h>
4 #include <sam7s-spi.h>
5 
6 #define SPI_SPEED 1000000 /* 1MHz clock*/
7 #define SPI_DLYBCT 1
8 #define SPI_DLYBS 20
9 
10 
11 #ifndef BV
12 #define BV(b) (1<<(b))
13 #endif
14 
15 void
16 cc2420_arch_init(void)
17 {
18  spi_init();
19 
20  AT91C_SPI_CSR[CC2420_DEFAULT_DEV] =
21  ((SPI_DLYBCT<<24) | (SPI_DLYBS<<16) | (((MCK+SPI_SPEED/2)/SPI_SPEED)<<8)
22  | AT91C_SPI_NCPHA | AT91C_SPI_BITS_8 | AT91C_SPI_CSAAT);
23 }