2006-08-02 16:44:46 +02:00
|
|
|
/* -*- C -*- */
|
A work-in-progress rework of the Contiki MAC and radio layers. The
main ideas are:
* Separates the Contiki low-layer network stack into four layers:
network (e.g. sicslowpan / rime), Medium Access Control MAC
(e.g. CSMA), Radio Duty Cycling RDC (e.g. ContikiMAC, X-MAC), and
radio (e.g. cc2420).
* Introduces a new way to configure the network stack. Four #defines
that specify what mechanism/protocol/driver to use at the four
layers: NETSTACK_CONF_NETWORK, NETSTACK_CONF_MAC, NETSTACK_CONF_RDC,
NETSTACK_CONF_RADIO.
* Adds a callback mechanism to inform the MAC and network layers about
the fate of a transmitted packet: if the packet was not possible to
transmit, the cause of the failure is reported, and if the packets
was successfully transmitted, the number of tries before it was
finally transmitted is reported.
* NULL-protocols at both the MAC and RDC layers: nullmac and nullrdc,
which can be used when MAC and RDC functionality is not needed.
* Extends the radio API with three new functions that enable more
efficient radio duty cycling protocols: channel check, pending
packet, and receiving packet.
* New initialization mechanism, which takes advantage of the NETSTACK
#defines.
2010-02-18 22:48:39 +01:00
|
|
|
/* @(#)$Id: contiki-conf.h,v 1.72 2010/02/18 21:48:39 adamdunkels Exp $ */
|
2006-08-02 16:44:46 +02:00
|
|
|
|
|
|
|
#ifndef CONTIKI_CONF_H
|
|
|
|
#define CONTIKI_CONF_H
|
|
|
|
|
2010-02-06 11:00:25 +01:00
|
|
|
|
|
|
|
|
A work-in-progress rework of the Contiki MAC and radio layers. The
main ideas are:
* Separates the Contiki low-layer network stack into four layers:
network (e.g. sicslowpan / rime), Medium Access Control MAC
(e.g. CSMA), Radio Duty Cycling RDC (e.g. ContikiMAC, X-MAC), and
radio (e.g. cc2420).
* Introduces a new way to configure the network stack. Four #defines
that specify what mechanism/protocol/driver to use at the four
layers: NETSTACK_CONF_NETWORK, NETSTACK_CONF_MAC, NETSTACK_CONF_RDC,
NETSTACK_CONF_RADIO.
* Adds a callback mechanism to inform the MAC and network layers about
the fate of a transmitted packet: if the packet was not possible to
transmit, the cause of the failure is reported, and if the packets
was successfully transmitted, the number of tries before it was
finally transmitted is reported.
* NULL-protocols at both the MAC and RDC layers: nullmac and nullrdc,
which can be used when MAC and RDC functionality is not needed.
* Extends the radio API with three new functions that enable more
efficient radio duty cycling protocols: channel check, pending
packet, and receiving packet.
* New initialization mechanism, which takes advantage of the NETSTACK
#defines.
2010-02-18 22:48:39 +01:00
|
|
|
#if WITH_UIP6
|
2010-02-03 17:48:04 +01:00
|
|
|
|
A work-in-progress rework of the Contiki MAC and radio layers. The
main ideas are:
* Separates the Contiki low-layer network stack into four layers:
network (e.g. sicslowpan / rime), Medium Access Control MAC
(e.g. CSMA), Radio Duty Cycling RDC (e.g. ContikiMAC, X-MAC), and
radio (e.g. cc2420).
* Introduces a new way to configure the network stack. Four #defines
that specify what mechanism/protocol/driver to use at the four
layers: NETSTACK_CONF_NETWORK, NETSTACK_CONF_MAC, NETSTACK_CONF_RDC,
NETSTACK_CONF_RADIO.
* Adds a callback mechanism to inform the MAC and network layers about
the fate of a transmitted packet: if the packet was not possible to
transmit, the cause of the failure is reported, and if the packets
was successfully transmitted, the number of tries before it was
finally transmitted is reported.
* NULL-protocols at both the MAC and RDC layers: nullmac and nullrdc,
which can be used when MAC and RDC functionality is not needed.
* Extends the radio API with three new functions that enable more
efficient radio duty cycling protocols: channel check, pending
packet, and receiving packet.
* New initialization mechanism, which takes advantage of the NETSTACK
#defines.
2010-02-18 22:48:39 +01:00
|
|
|
/* Network setup for IPv6 */
|
|
|
|
#define NETSTACK_CONF_NETWORK sicslowpan_driver
|
|
|
|
#define NETSTACK_CONF_MAC csma_driver
|
|
|
|
#define NETSTACK_CONF_RDC contikimac_driver
|
|
|
|
#define NETSTACK_CONF_RADIO cc2420_driver
|
2010-02-03 17:48:04 +01:00
|
|
|
|
A work-in-progress rework of the Contiki MAC and radio layers. The
main ideas are:
* Separates the Contiki low-layer network stack into four layers:
network (e.g. sicslowpan / rime), Medium Access Control MAC
(e.g. CSMA), Radio Duty Cycling RDC (e.g. ContikiMAC, X-MAC), and
radio (e.g. cc2420).
* Introduces a new way to configure the network stack. Four #defines
that specify what mechanism/protocol/driver to use at the four
layers: NETSTACK_CONF_NETWORK, NETSTACK_CONF_MAC, NETSTACK_CONF_RDC,
NETSTACK_CONF_RADIO.
* Adds a callback mechanism to inform the MAC and network layers about
the fate of a transmitted packet: if the packet was not possible to
transmit, the cause of the failure is reported, and if the packets
was successfully transmitted, the number of tries before it was
finally transmitted is reported.
* NULL-protocols at both the MAC and RDC layers: nullmac and nullrdc,
which can be used when MAC and RDC functionality is not needed.
* Extends the radio API with three new functions that enable more
efficient radio duty cycling protocols: channel check, pending
packet, and receiving packet.
* New initialization mechanism, which takes advantage of the NETSTACK
#defines.
2010-02-18 22:48:39 +01:00
|
|
|
#define CC2420_CONF_AUTOACK 1
|
|
|
|
#define MAC_CONF_CHANNEL_CHECK_RATE 8
|
2010-02-03 17:48:04 +01:00
|
|
|
#define RIME_CONF_NO_POLITE_ANNOUCEMENTS 0
|
A work-in-progress rework of the Contiki MAC and radio layers. The
main ideas are:
* Separates the Contiki low-layer network stack into four layers:
network (e.g. sicslowpan / rime), Medium Access Control MAC
(e.g. CSMA), Radio Duty Cycling RDC (e.g. ContikiMAC, X-MAC), and
radio (e.g. cc2420).
* Introduces a new way to configure the network stack. Four #defines
that specify what mechanism/protocol/driver to use at the four
layers: NETSTACK_CONF_NETWORK, NETSTACK_CONF_MAC, NETSTACK_CONF_RDC,
NETSTACK_CONF_RADIO.
* Adds a callback mechanism to inform the MAC and network layers about
the fate of a transmitted packet: if the packet was not possible to
transmit, the cause of the failure is reported, and if the packets
was successfully transmitted, the number of tries before it was
finally transmitted is reported.
* NULL-protocols at both the MAC and RDC layers: nullmac and nullrdc,
which can be used when MAC and RDC functionality is not needed.
* Extends the radio API with three new functions that enable more
efficient radio duty cycling protocols: channel check, pending
packet, and receiving packet.
* New initialization mechanism, which takes advantage of the NETSTACK
#defines.
2010-02-18 22:48:39 +01:00
|
|
|
#define CXMAC_CONF_ANNOUNCEMENTS 0
|
|
|
|
#define XMAC_CONF_ANNOUNCEMENTS 0
|
|
|
|
|
2010-02-03 17:48:04 +01:00
|
|
|
#else /* WITH_UIP6 */
|
A work-in-progress rework of the Contiki MAC and radio layers. The
main ideas are:
* Separates the Contiki low-layer network stack into four layers:
network (e.g. sicslowpan / rime), Medium Access Control MAC
(e.g. CSMA), Radio Duty Cycling RDC (e.g. ContikiMAC, X-MAC), and
radio (e.g. cc2420).
* Introduces a new way to configure the network stack. Four #defines
that specify what mechanism/protocol/driver to use at the four
layers: NETSTACK_CONF_NETWORK, NETSTACK_CONF_MAC, NETSTACK_CONF_RDC,
NETSTACK_CONF_RADIO.
* Adds a callback mechanism to inform the MAC and network layers about
the fate of a transmitted packet: if the packet was not possible to
transmit, the cause of the failure is reported, and if the packets
was successfully transmitted, the number of tries before it was
finally transmitted is reported.
* NULL-protocols at both the MAC and RDC layers: nullmac and nullrdc,
which can be used when MAC and RDC functionality is not needed.
* Extends the radio API with three new functions that enable more
efficient radio duty cycling protocols: channel check, pending
packet, and receiving packet.
* New initialization mechanism, which takes advantage of the NETSTACK
#defines.
2010-02-18 22:48:39 +01:00
|
|
|
|
|
|
|
/* Network setup for non-IPv6 (rime). */
|
|
|
|
|
|
|
|
#define NETSTACK_CONF_NETWORK rime_driver
|
|
|
|
#define NETSTACK_CONF_MAC csma_driver
|
|
|
|
#define NETSTACK_CONF_RDC contikimac_driver
|
|
|
|
#define NETSTACK_CONF_RADIO cc2420_driver
|
|
|
|
|
|
|
|
#define CC2420_CONF_AUTOACK 1
|
|
|
|
#define MAC_CONF_CHANNEL_CHECK_RATE 8
|
|
|
|
#define RIME_CONF_NO_POLITE_ANNOUCEMENTS 0
|
|
|
|
#define CXMAC_CONF_ANNOUNCEMENTS 0
|
|
|
|
#define XMAC_CONF_ANNOUNCEMENTS 0
|
|
|
|
|
|
|
|
#define XMAC_CONF_COMPOWER 1
|
|
|
|
#define CXMAC_CONF_COMPOWER 1
|
2010-02-03 17:48:04 +01:00
|
|
|
#endif /* WITH_UIP6 */
|
|
|
|
|
|
|
|
#define QUEUEBUF_CONF_NUM 16
|
2009-02-14 23:52:24 +01:00
|
|
|
|
2009-03-12 22:58:20 +01:00
|
|
|
#define PACKETBUF_CONF_ATTRS_INLINE 1
|
2008-02-25 03:14:34 +01:00
|
|
|
|
2010-02-03 17:48:04 +01:00
|
|
|
#ifndef RF_CHANNEL
|
|
|
|
#define RF_CHANNEL 26
|
|
|
|
#endif /* RF_CHANNEL */
|
2009-05-10 23:15:16 +02:00
|
|
|
|
2009-04-06 15:31:00 +02:00
|
|
|
#define IEEE802154_CONF_PANID 0xABCD
|
|
|
|
|
2008-01-08 09:19:56 +01:00
|
|
|
#define SHELL_VARS_CONF_RAM_BEGIN 0x1100
|
|
|
|
#define SHELL_VARS_CONF_RAM_END 0x2000
|
|
|
|
|
2009-02-04 20:32:20 +01:00
|
|
|
/* DCO speed resynchronization for more robust UART, etc. */
|
|
|
|
#define DCOSYNCH_CONF_ENABLED 1
|
|
|
|
#define DCOSYNCH_CONF_PERIOD 30
|
|
|
|
|
2007-12-16 16:05:04 +01:00
|
|
|
|
2009-03-01 13:00:00 +01:00
|
|
|
#define CFS_CONF_OFFSET_TYPE long
|
2009-02-27 15:53:15 +01:00
|
|
|
|
2008-02-03 22:01:36 +01:00
|
|
|
#define PROFILE_CONF_ON 0
|
2007-11-13 22:10:50 +01:00
|
|
|
#define ENERGEST_CONF_ON 1
|
|
|
|
|
2007-08-16 15:10:53 +02:00
|
|
|
#define HAVE_STDINT_H
|
2009-04-06 15:07:37 +02:00
|
|
|
#define MSP430_MEMCPY_WORKAROUND 1
|
2007-08-16 15:10:53 +02:00
|
|
|
#include "msp430def.h"
|
|
|
|
|
2009-01-15 10:04:04 +01:00
|
|
|
#define ELFLOADER_CONF_TEXT_IN_ROM 0
|
2009-05-18 12:32:56 +02:00
|
|
|
#define ELFLOADER_CONF_DATAMEMORY_SIZE 0x400
|
|
|
|
#define ELFLOADER_CONF_TEXTMEMORY_SIZE 0x800
|
2007-03-23 01:00:15 +01:00
|
|
|
|
2007-03-15 22:59:44 +01:00
|
|
|
#define IRQ_PORT1 0x01
|
|
|
|
#define IRQ_PORT2 0x02
|
|
|
|
#define IRQ_ADC 0x03
|
|
|
|
|
2006-08-15 16:46:33 +02:00
|
|
|
#define CCIF
|
|
|
|
#define CLIF
|
2006-08-13 17:06:08 +02:00
|
|
|
|
2007-09-19 16:09:31 +02:00
|
|
|
#define CC_CONF_INLINE inline
|
|
|
|
|
2007-08-16 15:10:53 +02:00
|
|
|
#define AODV_COMPLIANCE
|
2007-04-04 13:39:49 +02:00
|
|
|
#define AODV_NUM_RT_ENTRIES 32
|
2006-08-02 16:44:46 +02:00
|
|
|
|
|
|
|
#define TMOTE_SKY 1
|
|
|
|
#define WITH_ASCII 1
|
|
|
|
|
2008-02-03 22:01:36 +01:00
|
|
|
#define PROCESS_CONF_NUMEVENTS 8
|
|
|
|
#define PROCESS_CONF_STATS 1
|
2008-01-08 09:19:56 +01:00
|
|
|
/*#define PROCESS_CONF_FASTPOLL 4*/
|
2006-08-02 16:44:46 +02:00
|
|
|
|
2007-02-02 14:26:48 +01:00
|
|
|
/* CPU target speed in Hz */
|
2009-04-29 13:43:48 +02:00
|
|
|
#define F_CPU 3900000uL /*2457600uL*/
|
2007-02-02 14:26:48 +01:00
|
|
|
|
2006-08-02 16:44:46 +02:00
|
|
|
/* Our clock resolution, this is the same as Unix HZ. */
|
2009-04-06 16:59:49 +02:00
|
|
|
#define CLOCK_CONF_SECOND 128
|
2006-08-02 16:44:46 +02:00
|
|
|
|
2007-02-02 14:26:48 +01:00
|
|
|
#define BAUD2UBR(baud) ((F_CPU/baud))
|
|
|
|
|
2008-11-05 15:31:06 +01:00
|
|
|
#ifdef WITH_UIP6
|
2008-11-06 16:14:24 +01:00
|
|
|
|
2009-04-06 16:59:49 +02:00
|
|
|
#define RIMEADDR_CONF_SIZE 8
|
2008-11-06 16:14:24 +01:00
|
|
|
|
2008-11-05 15:31:06 +01:00
|
|
|
#define UIP_CONF_LL_802154 1
|
|
|
|
#define UIP_CONF_LLH_LEN 0
|
|
|
|
|
2009-06-29 11:54:39 +02:00
|
|
|
#ifndef UIP_CONF_ROUTER
|
2009-06-26 14:01:23 +02:00
|
|
|
#define UIP_CONF_ROUTER 0
|
2009-06-29 11:54:39 +02:00
|
|
|
#endif
|
2009-04-06 15:23:14 +02:00
|
|
|
|
2008-11-05 15:31:06 +01:00
|
|
|
#define UIP_CONF_IPV6 1
|
|
|
|
#define UIP_CONF_IPV6_QUEUE_PKT 1
|
|
|
|
#define UIP_CONF_IPV6_CHECKS 1
|
|
|
|
#define UIP_CONF_IPV6_REASSEMBLY 0
|
|
|
|
#define UIP_CONF_NETIF_MAX_ADDRESSES 3
|
|
|
|
#define UIP_CONF_ND6_MAX_PREFIXES 3
|
|
|
|
#define UIP_CONF_ND6_MAX_NEIGHBORS 4
|
|
|
|
#define UIP_CONF_ND6_MAX_DEFROUTERS 2
|
|
|
|
#define UIP_CONF_IP_FORWARD 0
|
2010-02-06 11:00:25 +01:00
|
|
|
#define UIP_CONF_BUFFER_SIZE 240
|
2008-11-05 15:31:06 +01:00
|
|
|
|
|
|
|
#define SICSLOWPAN_CONF_COMPRESSION_IPV6 0
|
|
|
|
#define SICSLOWPAN_CONF_COMPRESSION_HC1 1
|
|
|
|
#define SICSLOWPAN_CONF_COMPRESSION_HC01 2
|
2009-04-06 18:01:11 +02:00
|
|
|
#define SICSLOWPAN_CONF_COMPRESSION SICSLOWPAN_CONF_COMPRESSION_HC01
|
2010-02-06 11:00:25 +01:00
|
|
|
#ifndef SICSLOWPAN_CONF_FRAG
|
2010-02-08 23:12:29 +01:00
|
|
|
#define SICSLOWPAN_CONF_FRAG 1
|
|
|
|
#define SICSLOWPAN_CONF_MAXAGE 8
|
2010-02-06 11:00:25 +01:00
|
|
|
#endif /* SICSLOWPAN_CONF_FRAG */
|
2008-11-06 21:45:06 +01:00
|
|
|
#define SICSLOWPAN_CONF_CONVENTIONAL_MAC 1
|
2009-04-06 18:01:11 +02:00
|
|
|
#define SICSLOWPAN_CONF_MAX_ADDR_CONTEXTS 2
|
2010-02-03 17:48:04 +01:00
|
|
|
#else /* WITH_UIP6 */
|
2008-11-05 15:31:06 +01:00
|
|
|
#define UIP_CONF_IP_FORWARD 1
|
2009-04-06 15:23:14 +02:00
|
|
|
#define UIP_CONF_BUFFER_SIZE 108
|
2008-11-05 15:31:06 +01:00
|
|
|
#endif /* WITH_UIP6 */
|
|
|
|
|
2008-02-03 22:01:36 +01:00
|
|
|
#define UIP_CONF_ICMP_DEST_UNREACH 1
|
|
|
|
|
2006-08-02 16:44:46 +02:00
|
|
|
#define UIP_CONF_DHCP_LIGHT
|
|
|
|
#define UIP_CONF_LLH_LEN 0
|
2010-01-28 14:38:40 +01:00
|
|
|
#define UIP_CONF_RECEIVE_WINDOW 48
|
|
|
|
#define UIP_CONF_TCP_MSS 48
|
2006-08-02 16:44:46 +02:00
|
|
|
#define UIP_CONF_MAX_CONNECTIONS 4
|
|
|
|
#define UIP_CONF_MAX_LISTENPORTS 8
|
2007-04-11 17:22:05 +02:00
|
|
|
#define UIP_CONF_UDP_CONNS 12
|
2007-04-04 13:39:49 +02:00
|
|
|
#define UIP_CONF_FWCACHE_SIZE 30
|
2006-08-02 16:44:46 +02:00
|
|
|
#define UIP_CONF_BROADCAST 1
|
|
|
|
#define UIP_ARCH_IPCHKSUM 1
|
2009-04-06 18:01:11 +02:00
|
|
|
#define UIP_CONF_UDP 1
|
2006-08-02 16:44:46 +02:00
|
|
|
#define UIP_CONF_UDP_CHECKSUMS 1
|
|
|
|
#define UIP_CONF_PINGADDRCONF 0
|
|
|
|
#define UIP_CONF_LOGGING 0
|
|
|
|
|
2008-02-24 22:11:35 +01:00
|
|
|
#define UIP_CONF_TCP_SPLIT 0
|
|
|
|
|
2006-08-02 16:44:46 +02:00
|
|
|
/*
|
|
|
|
* Definitions below are dictated by the hardware and not really
|
|
|
|
* changeable!
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* LED ports */
|
|
|
|
#define LEDS_PxDIR P5DIR
|
|
|
|
#define LEDS_PxOUT P5OUT
|
|
|
|
#define LEDS_CONF_RED 0x10
|
|
|
|
#define LEDS_CONF_GREEN 0x20
|
|
|
|
#define LEDS_CONF_YELLOW 0x40
|
|
|
|
|
|
|
|
/* Button sensors. */
|
|
|
|
#define IRQ_PORT2 0x02
|
|
|
|
|
|
|
|
typedef unsigned short uip_stats_t;
|
|
|
|
typedef unsigned short clock_time_t;
|
|
|
|
|
|
|
|
typedef unsigned long off_t;
|
|
|
|
#define ROM_ERASE_UNIT_SIZE 512
|
|
|
|
#define XMEM_ERASE_UNIT_SIZE (64*1024L)
|
|
|
|
|
2007-03-23 10:59:08 +01:00
|
|
|
/* Use the first 64k of external flash for node configuration */
|
|
|
|
#define NODE_ID_XMEM_OFFSET (0 * XMEM_ERASE_UNIT_SIZE)
|
|
|
|
|
|
|
|
/* Use the second 64k of external flash for codeprop. */
|
2007-01-24 17:31:40 +01:00
|
|
|
#define EEPROMFS_ADDR_CODEPROP (1 * XMEM_ERASE_UNIT_SIZE)
|
2006-08-02 16:44:46 +02:00
|
|
|
|
2007-03-23 10:59:08 +01:00
|
|
|
#define CFS_XMEM_CONF_OFFSET (2 * XMEM_ERASE_UNIT_SIZE)
|
2007-03-23 13:15:50 +01:00
|
|
|
#define CFS_XMEM_CONF_SIZE (1 * XMEM_ERASE_UNIT_SIZE)
|
2007-03-23 10:59:08 +01:00
|
|
|
|
|
|
|
#define CFS_RAM_CONF_SIZE 4096
|
|
|
|
|
2006-08-02 16:44:46 +02:00
|
|
|
/*
|
|
|
|
* SPI bus configuration for the TMote Sky.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* SPI input/output registers. */
|
|
|
|
#define SPI_TXBUF U0TXBUF
|
|
|
|
#define SPI_RXBUF U0RXBUF
|
|
|
|
|
2009-08-31 14:06:34 +02:00
|
|
|
/* USART0 Tx ready? */
|
2006-08-02 16:44:46 +02:00
|
|
|
#define SPI_WAITFOREOTx() while ((U0TCTL & TXEPT) == 0)
|
2009-09-07 13:31:26 +02:00
|
|
|
/* USART0 Rx ready? */
|
2006-08-02 16:44:46 +02:00
|
|
|
#define SPI_WAITFOREORx() while ((IFG1 & URXIFG0) == 0)
|
2009-08-31 14:06:34 +02:00
|
|
|
/* USART0 Tx buffer ready? */
|
2009-09-07 13:31:26 +02:00
|
|
|
#define SPI_WAITFORTxREADY() while ((IFG1 & UTXIFG0) == 0)
|
2006-08-02 16:44:46 +02:00
|
|
|
|
|
|
|
#define SCK 1 /* P3.1 - Output: SPI Serial Clock (SCLK) */
|
|
|
|
#define MOSI 2 /* P3.2 - Output: SPI Master out - slave in (MOSI) */
|
|
|
|
#define MISO 3 /* P3.3 - Input: SPI Master in - slave out (MISO) */
|
|
|
|
|
|
|
|
/*
|
|
|
|
* SPI bus - M25P80 external flash configuration.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#define FLASH_PWR 3 /* P4.3 Output */
|
|
|
|
#define FLASH_CS 4 /* P4.4 Output */
|
|
|
|
#define FLASH_HOLD 7 /* P4.7 Output */
|
|
|
|
|
|
|
|
/* Enable/disable flash access to the SPI bus (active low). */
|
|
|
|
|
|
|
|
#define SPI_FLASH_ENABLE() ( P4OUT &= ~BV(FLASH_CS) )
|
|
|
|
#define SPI_FLASH_DISABLE() ( P4OUT |= BV(FLASH_CS) )
|
|
|
|
|
|
|
|
#define SPI_FLASH_HOLD() ( P4OUT &= ~BV(FLASH_HOLD) )
|
|
|
|
#define SPI_FLASH_UNHOLD() ( P4OUT |= BV(FLASH_HOLD) )
|
|
|
|
|
|
|
|
/*
|
|
|
|
* SPI bus - CC2420 pin configuration.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#define FIFO_P 0 /* P1.0 - Input: FIFOP from CC2420 */
|
|
|
|
#define FIFO 3 /* P1.3 - Input: FIFO from CC2420 */
|
|
|
|
#define CCA 4 /* P1.4 - Input: CCA from CC2420 */
|
|
|
|
|
|
|
|
#define SFD 1 /* P4.1 - Input: SFD from CC2420 */
|
|
|
|
#define CSN 2 /* P4.2 - Output: SPI Chip Select (CS_N) */
|
|
|
|
#define VREG_EN 5 /* P4.5 - Output: VREG_EN to CC2420 */
|
|
|
|
#define RESET_N 6 /* P4.6 - Output: RESET_N to CC2420 */
|
|
|
|
|
|
|
|
/* Pin status. */
|
|
|
|
|
|
|
|
#define FIFO_IS_1 (!!(P1IN & BV(FIFO)))
|
|
|
|
#define CCA_IS_1 (!!(P1IN & BV(CCA) ))
|
|
|
|
#define RESET_IS_1 (!!(P4IN & BV(RESET_N)))
|
|
|
|
#define VREG_IS_1 (!!(P4IN & BV(VREG_EN)))
|
|
|
|
#define FIFOP_IS_1 (!!(P1IN & BV(FIFO_P)))
|
|
|
|
#define SFD_IS_1 (!!(P4IN & BV(SFD)))
|
|
|
|
|
|
|
|
/* The CC2420 reset pin. */
|
2007-03-15 22:59:44 +01:00
|
|
|
#define SET_RESET_INACTIVE() ( P4OUT |= BV(RESET_N) )
|
2006-08-02 16:44:46 +02:00
|
|
|
#define SET_RESET_ACTIVE() ( P4OUT &= ~BV(RESET_N) )
|
|
|
|
|
|
|
|
/* CC2420 voltage regulator enable pin. */
|
|
|
|
#define SET_VREG_ACTIVE() ( P4OUT |= BV(VREG_EN) )
|
|
|
|
#define SET_VREG_INACTIVE() ( P4OUT &= ~BV(VREG_EN) )
|
|
|
|
|
|
|
|
/* CC2420 rising edge trigger for external interrupt 0 (FIFOP). */
|
|
|
|
#define FIFOP_INT_INIT() do {\
|
|
|
|
P1IES &= ~BV(FIFO_P);\
|
|
|
|
CLEAR_FIFOP_INT();\
|
|
|
|
} while (0)
|
|
|
|
|
|
|
|
/* FIFOP on external interrupt 0. */
|
|
|
|
#define ENABLE_FIFOP_INT() do { P1IE |= BV(FIFO_P); } while (0)
|
|
|
|
#define DISABLE_FIFOP_INT() do { P1IE &= ~BV(FIFO_P); } while (0)
|
|
|
|
#define CLEAR_FIFOP_INT() do { P1IFG &= ~BV(FIFO_P); } while (0)
|
|
|
|
|
|
|
|
/* Enables/disables CC2420 access to the SPI bus (not the bus).
|
|
|
|
*
|
|
|
|
* These guys should really be renamed but are compatible with the
|
|
|
|
* original Chipcon naming.
|
|
|
|
*
|
|
|
|
* SPI_CC2420_ENABLE/SPI_CC2420_DISABLE???
|
|
|
|
* CC2420_ENABLE_SPI/CC2420_DISABLE_SPI???
|
|
|
|
*/
|
|
|
|
|
|
|
|
#define SPI_ENABLE() ( P4OUT &= ~BV(CSN) ) /* ENABLE CSn (active low) */
|
|
|
|
#define SPI_DISABLE() ( P4OUT |= BV(CSN) ) /* DISABLE CSn (active low) */
|
2009-10-27 16:33:24 +01:00
|
|
|
#define SPI_IS_ENABLED() ( (P4OUT & BV(CSN)) != BV(CSN) )
|
2006-08-02 16:44:46 +02:00
|
|
|
|
2009-02-14 23:52:24 +01:00
|
|
|
#ifdef PROJECT_CONF_H
|
|
|
|
#include PROJECT_CONF_H
|
|
|
|
#endif /* PROJECT_CONF_H */
|
|
|
|
|
|
|
|
|
2007-05-22 23:12:15 +02:00
|
|
|
|
2006-08-02 16:44:46 +02:00
|
|
|
#endif /* CONTIKI_CONF_H */
|