Contiki-Inga 3.x
Main Page
Related Pages
Modules
Data Structures
Files
Examples
File List
Globals
core
dev
radio.h
Go to the documentation of this file.
1
/**
2
* \addtogroup dev
3
* @{
4
*/
5
6
/**
7
* \defgroup radio Radio API
8
*
9
* The radio API module defines a set of functions that a radio device
10
* driver must implement.
11
*
12
* @{
13
*/
14
15
/*
16
* Copyright (c) 2005, Swedish Institute of Computer Science.
17
* All rights reserved.
18
*
19
* Redistribution and use in source and binary forms, with or without
20
* modification, are permitted provided that the following conditions
21
* are met:
22
* 1. Redistributions of source code must retain the above copyright
23
* notice, this list of conditions and the following disclaimer.
24
* 2. Redistributions in binary form must reproduce the above copyright
25
* notice, this list of conditions and the following disclaimer in the
26
* documentation and/or other materials provided with the distribution.
27
* 3. Neither the name of the Institute nor the names of its contributors
28
* may be used to endorse or promote products derived from this software
29
* without specific prior written permission.
30
*
31
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
32
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
33
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
34
* ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
35
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
39
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
40
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
41
* SUCH DAMAGE.
42
*
43
* This file is part of the Contiki operating system.
44
*
45
*/
46
47
/**
48
* \file
49
* Header file for the radio API
50
* \author
51
* Adam Dunkels <adam@sics.se>
52
*/
53
54
#ifndef RADIO_H_
55
#define RADIO_H_
56
57
/**
58
* The structure of a device driver for a radio in Contiki.
59
*/
60
struct
radio_driver
{
61
62
int (* init)(void);
63
64
/** Prepare the radio with a packet to be sent. */
65
int (*
prepare
)(
const
void
*payload,
unsigned
short
payload_len);
66
67
/** Send the packet that has previously been prepared. */
68
int (*
transmit
)(
unsigned
short
transmit_len);
69
70
/** Prepare & transmit a packet. */
71
int (*
send
)(
const
void
*payload,
unsigned
short
payload_len);
72
73
/** Read a received packet into a buffer. */
74
int (*
read
)(
void
*buf,
unsigned
short
buf_len);
75
76
/** Perform a Clear-Channel Assessment (CCA) to find out if there is
77
a packet in the air or not. */
78
int (*
channel_clear
)(void);
79
80
/** Check if the radio driver is currently receiving a packet */
81
int (*
receiving_packet
)(void);
82
83
/** Check if the radio driver has just received a packet */
84
int (*
pending_packet
)(void);
85
86
/** Turn the radio on. */
87
int (*
on
)(void);
88
89
/** Turn the radio off. */
90
int (*
off
)(void);
91
};
92
93
/* Generic radio return values. */
94
enum
{
95
RADIO_TX_OK,
96
RADIO_TX_ERR,
97
RADIO_TX_COLLISION,
98
RADIO_TX_NOACK,
99
};
100
101
#endif
/* RADIO_H_ */
102
103
104
/** @} */
105
/** @} */
Generated on Thu Apr 24 2014 16:26:11 for Contiki-Inga 3.x by
1.8.3.1