Contiki-NG
Toggle main menu visibility
Loading...
Searching...
No Matches
cc2420.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2007, Swedish Institute of Computer Science.
3
* All rights reserved.
4
*
5
* Redistribution and use in source and binary forms, with or without
6
* modification, are permitted provided that the following conditions
7
* are met:
8
* 1. Redistributions of source code must retain the above copyright
9
* notice, this list of conditions and the following disclaimer.
10
* 2. Redistributions in binary form must reproduce the above copyright
11
* notice, this list of conditions and the following disclaimer in the
12
* documentation and/or other materials provided with the distribution.
13
* 3. Neither the name of the Institute nor the names of its contributors
14
* may be used to endorse or promote products derived from this software
15
* without specific prior written permission.
16
*
17
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
18
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20
* ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
21
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27
* SUCH DAMAGE.
28
*
29
* This file is part of the Contiki operating system.
30
*
31
*/
32
33
/**
34
* \file
35
* CC2420 driver header file
36
* \author
37
* Adam Dunkels <adam@sics.se>
38
* Joakim Eriksson <joakime@sics.se>
39
* Konrad Krentz <konrad.krentz@gmail.com>
40
*/
41
42
#ifndef CC2420_H_
43
#define CC2420_H_
44
45
#include "contiki.h"
46
#include "
dev/spi-legacy.h
"
47
#include "
dev/radio.h
"
48
#include "dev/radio/cc2420/cc2420_const.h"
49
#include "
lib/aes-128.h
"
50
51
#define WITH_SEND_CCA 1
52
53
#ifndef CC2420_CONF_CCA_THRESH
54
#define CC2420_CONF_CCA_THRESH -45
55
#endif
/* CC2420_CONF_CCA_THRESH */
56
57
#ifndef CC2420_CONF_AUTOACK
58
#define CC2420_CONF_AUTOACK 1
59
#endif
/* CC2420_CONF_AUTOACK */
60
61
#define CHECKSUM_LEN 2
62
#define FOOTER_LEN 2
63
#define FOOTER1_CRC_OK 0x80
64
#define FOOTER1_CORRELATION 0x7f
65
66
#ifdef CC2420_CONF_RSSI_OFFSET
67
#define RSSI_OFFSET CC2420_CONF_RSSI_OFFSET
68
#else
/* CC2420_CONF_RSSI_OFFSET */
69
/* The RSSI_OFFSET is approximate -45 (see CC2420 specification) */
70
#define RSSI_OFFSET -45
71
#endif
/* CC2420_CONF_RSSI_OFFSET */
72
73
int
cc2420_init(
void
);
74
75
#define CC2420_MAX_PACKET_LEN 127
76
77
int
cc2420_set_channel(
int
channel);
78
int
cc2420_get_channel(
void
);
79
80
void
cc2420_set_pan_addr(
unsigned
pan,
81
unsigned
addr
,
82
const
uint8_t *ieee_addr);
83
84
extern
signed
char
cc2420_last_rssi;
85
extern
uint8_t cc2420_last_correlation;
86
87
int
cc2420_rssi(
void
);
88
89
extern
const
struct
radio_driver
cc2420_driver;
90
91
/**
92
* \param power Between 1 and 31.
93
*/
94
void
cc2420_set_txpower
(uint8_t power);
95
int
cc2420_get_txpower(
void
);
96
#define CC2420_TXPOWER_MAX 31
97
#define CC2420_TXPOWER_MIN 0
98
99
/**
100
* Interrupt function, called from the simple-cc2420-arch driver.
101
*
102
*/
103
int
cc2420_interrupt
(
void
);
104
105
extern
int
cc2420_authority_level_of_sender;
106
107
int
cc2420_on(
void
);
108
int
cc2420_off(
void
);
109
110
void
cc2420_set_cca_threshold(
int
value
);
111
112
extern
const
struct
aes_128_driver
cc2420_aes_128_driver;
113
114
#endif
/* CC2420_H_ */
aes-128.h
AES-128.
cc2420_set_txpower
void cc2420_set_txpower(uint8_t power)
Definition
cc2420.c:974
cc2420_interrupt
int cc2420_interrupt(void)
Interrupt function, called from the simple-cc2420-arch driver.
Definition
cc2420.c:880
value
static int value(int type)
Definition
cc2538-temp-sensor.c:49
radio.h
Header file for the radio API.
spi-legacy.h
Basic SPI macros.
aes_128_driver
Structure of AES drivers.
Definition
aes-128.h:59
radio_driver
The structure of a Contiki-NG radio device driver.
Definition
radio.h:534
addr
static uip_ds6_addr_t * addr
Pointer to a nbr cache entry.
Definition
uip-nd6.c:107
arch
dev
radio
cc2420
cc2420.h
Generated on
for Contiki-NG by
1.17.0