Changed filename of the CC2420 driver from simple-cc2420 to cc2420.

This commit is contained in:
adamdunkels 2008-07-01 21:02:51 +00:00
parent 2569a8fc69
commit 1586d8f36f
16 changed files with 86 additions and 235 deletions

View File

@ -28,7 +28,7 @@
*
* This file is part of the Contiki operating system.
*
* $Id: shell-sky.c,v 1.4 2008/06/23 19:51:29 adamdunkels Exp $
* $Id: shell-sky.c,v 1.5 2008/07/01 21:02:51 adamdunkels Exp $
*/
/**
@ -44,7 +44,7 @@
#include "dev/watchdog.h"
#include "net/rime.h"
#include "dev/simple-cc2420.h"
#include "dev/cc2420.h"
#include "dev/leds.h"
#include "dev/light.h"
#include "dev/sht11.h"

View File

@ -28,7 +28,7 @@
*
* This file is part of the Contiki operating system.
*
* @(#)$Id: simple-cc2420.c,v 1.27 2008/05/14 19:44:30 adamdunkels Exp $
* @(#)$Id: cc2420.c,v 1.23 2008/07/01 21:02:51 adamdunkels Exp $
*/
/*
* This code is almost device independent and should be easy to port.
@ -47,7 +47,7 @@
#include "dev/leds.h"
#include "dev/spi.h"
#include "dev/simple-cc2420.h"
#include "dev/cc2420.h"
#include "dev/cc2420_const.h"
#include "net/rime/rimestats.h"

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2005, Swedish Institute of Computer Science
* Copyright (c) 2007, Swedish Institute of Computer Science.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -28,117 +28,60 @@
*
* This file is part of the Contiki operating system.
*
* @(#)$Id: cc2420.h,v 1.5 2007/05/08 08:27:58 bg- Exp $
* $Id: cc2420.h,v 1.6 2008/07/01 21:02:51 adamdunkels Exp $
*/
#ifndef CC2420_H
#define CC2420_H
#define MAX_PACKET_LEN 127
#define ACK_PACKET_LEN 5
/* fc0 */
#define FC0_TYPE_MASK 0x07 /* bit0-2 */
#define FC0_TYPE_BEACON 0x00 /* bit0-2 */
#define FC0_TYPE_DATA 0x01 /* bit0-2 */
#define FC0_TYPE_ACK 0x02 /* bit0-2 */
#define FC0_TYPE_MAC_CMD 0x03 /* bit0-2 */
/* reserved 0x04-0x07 */
#define FC0_SECURE 0x08 /* bit3 */
#define FC0_PENDING 0x10 /* bit4 */
#define FC0_REQ_ACK 0x20 /* bit5 */
#define FC0_INTRA_PAN 0x40 /* bit6 */
/* reserved 0x80 bit7 */
/* fc1 */
/* reserved 0x80 bit8-9 */
#define FC1_DST_MASK 0x0c /* bit10-11 */
#define FC1_DST_0 0x00 /* bit10-11 */
#define FC1_DST_16 0x08 /* bit10-11 */
#define FC1_DST_64 0x0c /* bit10-11 */
/* reserved 0x80 bit12-13 */
#define FC1_SRC_MASK 0xc0 /* bit14-15 */
#define FC1_SRC_0 0x00 /* bit14-15 */
#define FC1_SRC_16 0x80 /* bit14-15 */
#define FC1_SRC_64 0xc0 /* bit14-15 */
/* footer[0] == RSSI, footer[1] == ... */
#define FOOTER1_CRC_OK 0x80
#define FOOTER1_CORRELATION 0x7f
/* The hdr_802_15::len byte does not count!!! */
#define MAC_HDR_LEN (2 + 1 + 2 + 2 + 2)
struct hdr_802_15 {
u8_t len; /* Not part of MAC header!!! */
u8_t fc0;
u8_t fc1;
u8_t seq;
u16_t dst_pan; /* also u8_t ack_footer[2] */
u16_t dst;
/* optional src_pan */
u16_t src;
/* u8_t payload[uip_len] */
/* u8_t footer[2] */
/* no more */
};
struct hdr_802_15_ack {
u8_t len;
u8_t fc0;
u8_t fc1;
u8_t seq;
u8_t footer[2];
/* no more */
};
struct cc2420_neigbour {
unsigned mac:16, nretrans:4, expire:4; /* expiration time */
#if 0
unsigned rssi:6, correlation:6;
#endif
};
#define NNEIGBOURS 16
extern struct cc2420_neigbour neigbours[NNEIGBOURS];
PROCESS_NAME(cc2420_process);
extern struct uip_fw_netif cc2420if;
extern signed char cc2420_last_rssi;
extern u8_t cc2420_last_correlation;
extern u8_t cc2420_is_input;
extern volatile u8_t cc2420_ack_received;
void cc2420_init(void);
void cc2420_set_chan_pan_addr(unsigned channel, unsigned pan,
unsigned addr, const u8_t *ieee_addr);
void cc2420_on(void);
void cc2420_off(void);
u8_t cc2420_send_ip(void);
u8_t cc2420_send_uaodv(void);
int cc2420_send(struct hdr_802_15 *hdr, u8_t hdr_len,
const u8_t *p, u8_t p_len);
/* Called at poll priority. */
void cc2420_input(const struct hdr_802_15 *hdr, u8_t hdr_len,
const u8_t *payload, u8_t payload_len);
/* Is mac far away? remote=1, local=0, don't know=-1. */
enum { REMOTE_MAYBE = -1, REMOTE_NO = 0, REMOTE_YES = 1 };
int cc2420_check_remote(u16_t mac);
void cc2420_recv_ok(uip_ipaddr_t *from);
/*
* Machine dependent initialization function and an interrupt service
* routine must be provided externally. Call cc2420_intr from the
* interrupt service routine.
/**
* \file
* CC2420 driver header file
* \author
* Adam Dunkels <adam@sics.se>
*/
void __cc2420_arch_init(void);
int __cc2420_intr(void);
#endif /* CC2420_H */
#ifndef __SIMPLE_CC2420_H__
#define __SIMPLE_CC2420_H__
#include "contiki.h"
#include "dev/radio.h"
void simple_cc2420_init(void);
#define SIMPLE_CC2420_MAX_PACKET_LEN 127
void simple_cc2420_set_channel(int channel);
int simple_cc2420_get_channel(void);
void simple_cc2420_set_pan_addr(unsigned pan,
unsigned addr,
const uint8_t *ieee_addr);
extern signed char simple_cc2420_last_rssi;
extern uint8_t simple_cc2420_last_correlation;
int simple_cc2420_rssi(void);
extern const struct radio_driver simple_cc2420_driver;
/**
* \param power Between 1 and 31.
*/
void simple_cc2420_set_txpower(uint8_t power);
int simple_cc2420_get_txpower(void);
#define SIMPLE_CC2420_TXPOWER_MAX 31
#define SIMPLE_CC2420_TXPOWER_MIN 0
/**
* Interrupt function, called from the simple-cc2420-arch driver.
*
*/
int simple_cc2420_interrupt(void);
/* XXX hack: these will be made as Chameleon packet attributes */
extern rtimer_clock_t simple_cc2420_time_of_arrival,
simple_cc2420_time_of_departure;
extern int simple_cc2420_authority_level_of_sender;
int simple_cc2420_on(void);
int simple_cc2420_off(void);
#endif /* __SIMPLE_CC2420_H__ */

View File

@ -1,88 +0,0 @@
/*
* Copyright (c) 2007, Swedish Institute of Computer Science.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the Institute nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* This file is part of the Contiki operating system.
*
* $Id: simple-cc2420.h,v 1.9 2008/01/23 14:57:19 adamdunkels Exp $
*/
/**
* \file
* A brief description of what this file is.
* \author
* Adam Dunkels <adam@sics.se>
*/
#ifndef __SIMPLE_CC2420_H__
#define __SIMPLE_CC2420_H__
#include "contiki.h"
#include "dev/radio.h"
void simple_cc2420_init(void);
#define SIMPLE_CC2420_MAX_PACKET_LEN 127
void simple_cc2420_set_channel(int channel);
int simple_cc2420_get_channel(void);
void simple_cc2420_set_pan_addr(unsigned pan,
unsigned addr,
const uint8_t *ieee_addr);
extern signed char simple_cc2420_last_rssi;
extern uint8_t simple_cc2420_last_correlation;
int simple_cc2420_rssi(void);
extern const struct radio_driver simple_cc2420_driver;
/**
* \param power Between 1 and 31.
*/
void simple_cc2420_set_txpower(uint8_t power);
int simple_cc2420_get_txpower(void);
#define SIMPLE_CC2420_TXPOWER_MAX 31
#define SIMPLE_CC2420_TXPOWER_MIN 0
/**
* Interrupt function, called from the simple-cc2420-arch driver.
*
*/
int simple_cc2420_interrupt(void);
/* XXX hack: these will be made as Chameleon packet attributes */
extern rtimer_clock_t simple_cc2420_time_of_arrival,
simple_cc2420_time_of_departure;
extern int simple_cc2420_authority_level_of_sender;
int simple_cc2420_on(void);
int simple_cc2420_off(void);
#endif /* __SIMPLE_CC2420_H__ */

View File

@ -34,7 +34,7 @@
*
* This file is part of the Contiki operating system.
*
* $Id: timesynch.c,v 1.3 2008/01/23 15:07:05 adamdunkels Exp $
* $Id: timesynch.c,v 1.4 2008/07/01 21:02:51 adamdunkels Exp $
*/
/**
@ -47,7 +47,7 @@
#include "net/rime/timesynch.h"
#include "net/rime/rimebuf.h"
#include "net/rime.h"
#include "dev/simple-cc2420.h"
#include "dev/cc2420.h"
#include <stdio.h>

View File

@ -13,7 +13,7 @@
* synchronization messages are sent: the module relies on the
* underlying network device driver to timestamp all radio messages,
* both outgoing and incoming. The code currently only works on the
* Tmote Sky platform and the simple-cc2420 driver.
* Tmote Sky platform and the cc2420 driver.
*
* Every node has an authority level, which is included in every
* outgoing packet. If a message is received from a node with higher
@ -55,7 +55,7 @@
*
* This file is part of the Contiki operating system.
*
* $Id: timesynch.h,v 1.3 2008/01/23 15:07:05 adamdunkels Exp $
* $Id: timesynch.h,v 1.4 2008/07/01 21:02:51 adamdunkels Exp $
*/
/**

View File

@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)$Id: simple-cc2420-arch.c,v 1.1 2007/05/25 08:07:54 adamdunkels Exp $
* @(#)$Id: cc2420-arch.c,v 1.1 2008/07/01 21:02:51 adamdunkels Exp $
*/
#include <io.h>
@ -36,7 +36,8 @@
#include "contiki-net.h"
#include "dev/spi.h"
#include "dev/simple-cc2420.h"
#include "dev/cc2420.h"
/*---------------------------------------------------------------------------*/
interrupt(PORT1_VECTOR)
simple_cc24240_port1_interrupt(void)

View File

@ -1,5 +1,5 @@
/* -*- C -*- */
/* @(#)$Id: contiki-conf.h,v 1.2 2008/01/22 15:00:24 zhitao Exp $ */
/* @(#)$Id: contiki-conf.h,v 1.3 2008/07/01 21:02:51 adamdunkels Exp $ */
#ifndef CONTIKI_CONF_H
#define CONTIKI_CONF_H
@ -98,7 +98,6 @@ typedef unsigned long off_t;
#define CFS_RAM_CONF_SIZE 4096
#define CC2420_RADIO
/*
* SPI bus configuration for the TMote Sky.
*/

View File

@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)$Id: contiki-sky-main.c,v 1.5 2008/03/29 15:20:48 oliverschmidt Exp $
* @(#)$Id: contiki-sky-main.c,v 1.6 2008/07/01 21:02:51 adamdunkels Exp $
*/
#include <signal.h>
@ -43,7 +43,7 @@
#include "dev/leds.h"
#include "dev/light.h"
#include "dev/xmem.h"
#include "dev/simple-cc2420.h"
#include "dev/cc2420.h"
#include "dev/slip.h"
#include "dev/uart1.h"
@ -126,7 +126,7 @@ main(int argc, char **argv)
#endif /* WITH_UIP */
printf("Starting %s "
"($Id: contiki-sky-main.c,v 1.5 2008/03/29 15:20:48 oliverschmidt Exp $)\n", __FILE__);
"($Id: contiki-sky-main.c,v 1.6 2008/07/01 21:02:51 adamdunkels Exp $)\n", __FILE__);
ds2411_init();
sensors_light_init();
sht11_init();

View File

@ -28,7 +28,7 @@
*
* This file is part of the Contiki operating system.
*
* $Id: energest-demo.c,v 1.5 2008/04/16 10:49:50 zhitao Exp $
* $Id: energest-demo.c,v 1.6 2008/07/01 21:02:51 adamdunkels Exp $
*/
/**
@ -44,7 +44,7 @@
#include "net/mac/nullmac.h"
#include "dev/button-sensor.h"
#include "dev/simple-cc2420.h"
#include "dev/cc2420.h"
#include "dev/leds.h"
#include "node-id.h"

View File

@ -26,14 +26,14 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: radio-test.c,v 1.2 2008/01/10 13:40:20 nifi Exp $
* $Id: radio-test.c,v 1.3 2008/07/01 21:02:51 adamdunkels Exp $
*
* -----------------------------------------------------------------
*
* Author : Adam Dunkels, Joakim Eriksson, Niclas Finne
* Created : 2006-03-07
* Updated : $Date: 2008/01/10 13:40:20 $
* $Revision: 1.2 $
* Updated : $Date: 2008/07/01 21:02:51 $
* $Revision: 1.3 $
*
* Simple application to indicate connectivity between two nodes:
*
@ -48,7 +48,7 @@
#include "net/rime.h"
#include "dev/leds.h"
#include "dev/button-sensor.h"
#include "dev/simple-cc2420.h"
#include "dev/cc2420.h"
#include <stdio.h>
#include <string.h>

View File

@ -28,7 +28,7 @@
*
* This file is part of the Contiki operating system.
*
* $Id: sky-collect.c,v 1.4 2008/02/24 22:27:41 adamdunkels Exp $
* $Id: sky-collect.c,v 1.5 2008/07/01 21:02:51 adamdunkels Exp $
*/
/**
@ -46,9 +46,8 @@
#include "dev/button-sensor.h"
#include "dev/light.h"
#include "dev/cc2420.h"
#include "dev/sht11.h"
#include "dev/simple-cc2420.h"
#include "sys/timesynch.h"
#include <stdio.h>
#include <string.h>
#include "contiki-net.h"
@ -138,9 +137,7 @@ do_rssi(void)
simple_cc2420_on();
for(channel = 11; channel <= 26; ++channel) {
simple_cc2420_set_channel(channel);
// simple_cc2420_on();
rssi_samples[sample].channel[channel - 11] = simple_cc2420_rssi() + 53;
// simple_cc2420_off();
}
rime_mac->on();

View File

@ -1,10 +1,10 @@
# $Id: Makefile.sky,v 1.15 2008/05/29 20:15:49 adamdunkels Exp $
# $Id: Makefile.sky,v 1.16 2008/07/01 21:02:51 adamdunkels Exp $
ARCH=msp430.c leds.c watchdog.c light.c spi.c ds2411.c \
xmem.c i2c.c sht11.c battery-sensor.c \
simple-cc2420.c simple-cc2420-arch.c irq.c energest-arch.c \
node-id.c sensors.c button-sensor.c cfs-xmem.c \
cc2420.c cc2420-arch.c irq.c energest-arch.c \
node-id.c sensors.c button-sensor.c cfs-coffee.c \
radio-sensor.c uart1.c uip-ipchksum.c \
#slip.c slip_uart1.c

View File

@ -1,5 +1,5 @@
/* -*- C -*- */
/* @(#)$Id: contiki-conf.h,v 1.26 2008/05/14 19:19:29 adamdunkels Exp $ */
/* @(#)$Id: contiki-conf.h,v 1.27 2008/07/01 21:02:51 adamdunkels Exp $ */
#ifndef CONTIKI_CONF_H
#define CONTIKI_CONF_H
@ -104,7 +104,6 @@ typedef unsigned long off_t;
#define CFS_RAM_CONF_SIZE 4096
#define CC2420_RADIO
/*
* SPI bus configuration for the TMote Sky.
*/

View File

@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)$Id: contiki-sky-main.c,v 1.30 2008/05/19 12:07:49 adamdunkels Exp $
* @(#)$Id: contiki-sky-main.c,v 1.31 2008/07/01 21:02:51 adamdunkels Exp $
*/
#include <signal.h>
@ -43,7 +43,7 @@
#include "dev/light.h"
#include "dev/serial.h"
#include "dev/sht11.h"
#include "dev/simple-cc2420.h"
#include "dev/cc2420.h"
#include "dev/slip.h"
#include "dev/uart1.h"
#include "dev/watchdog.h"

View File

@ -28,12 +28,12 @@
*
* This file is part of the Contiki operating system.
*
* @(#)$Id: radio-sensor.c,v 1.1 2007/03/22 23:53:56 adamdunkels Exp $
* @(#)$Id: radio-sensor.c,v 1.2 2008/07/01 21:02:51 adamdunkels Exp $
*/
#include "lib/sensors.h"
#include "dev/irq.h"
#include "dev/simple-cc2420.h"
#include "dev/cc2420.h"
#include "dev/radio-sensor.h"
const struct sensors_sensor radio_sensor;