센서보드 RF IRQ 테스트 중
Fork of stm-spirit1-rf-driver by
source/libs/Contiki_STM32_Library/radio.h@75:8dc65c09af67, 2017-09-01 (annotated)
- Committer:
- Wolfgang Betz
- Date:
- Fri Sep 01 08:51:04 2017 +0200
- Revision:
- 75:8dc65c09af67
- Parent:
- 34:edda6a7238ec
- Child:
- 84:45b9ff78a066
Clarification on radio configuration
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Wolfgang Betz |
34:edda6a7238ec | 1 | /* |
Wolfgang Betz |
34:edda6a7238ec | 2 | * Copyright (c) 2005, Swedish Institute of Computer Science. |
Wolfgang Betz |
34:edda6a7238ec | 3 | * All rights reserved. |
Wolfgang Betz |
34:edda6a7238ec | 4 | * |
Wolfgang Betz |
34:edda6a7238ec | 5 | * Redistribution and use in source and binary forms, with or without |
Wolfgang Betz |
34:edda6a7238ec | 6 | * modification, are permitted provided that the following conditions |
Wolfgang Betz |
34:edda6a7238ec | 7 | * are met: |
Wolfgang Betz |
34:edda6a7238ec | 8 | * 1. Redistributions of source code must retain the above copyright |
Wolfgang Betz |
34:edda6a7238ec | 9 | * notice, this list of conditions and the following disclaimer. |
Wolfgang Betz |
34:edda6a7238ec | 10 | * 2. Redistributions in binary form must reproduce the above copyright |
Wolfgang Betz |
34:edda6a7238ec | 11 | * notice, this list of conditions and the following disclaimer in the |
Wolfgang Betz |
34:edda6a7238ec | 12 | * documentation and/or other materials provided with the distribution. |
Wolfgang Betz |
34:edda6a7238ec | 13 | * 3. Neither the name of the Institute nor the names of its contributors |
Wolfgang Betz |
34:edda6a7238ec | 14 | * may be used to endorse or promote products derived from this software |
Wolfgang Betz |
34:edda6a7238ec | 15 | * without specific prior written permission. |
Wolfgang Betz |
34:edda6a7238ec | 16 | * |
Wolfgang Betz |
34:edda6a7238ec | 17 | * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND |
Wolfgang Betz |
34:edda6a7238ec | 18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
Wolfgang Betz |
34:edda6a7238ec | 19 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
Wolfgang Betz |
34:edda6a7238ec | 20 | * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE |
Wolfgang Betz |
34:edda6a7238ec | 21 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
Wolfgang Betz |
34:edda6a7238ec | 22 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
Wolfgang Betz |
34:edda6a7238ec | 23 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
Wolfgang Betz |
34:edda6a7238ec | 24 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
Wolfgang Betz |
34:edda6a7238ec | 25 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
Wolfgang Betz |
34:edda6a7238ec | 26 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
Wolfgang Betz |
34:edda6a7238ec | 27 | * SUCH DAMAGE. |
Wolfgang Betz |
34:edda6a7238ec | 28 | * |
Wolfgang Betz |
34:edda6a7238ec | 29 | * This file is part of the Contiki operating system. |
Wolfgang Betz |
34:edda6a7238ec | 30 | * |
Wolfgang Betz |
34:edda6a7238ec | 31 | */ |
Wolfgang Betz |
34:edda6a7238ec | 32 | |
Wolfgang Betz |
34:edda6a7238ec | 33 | /** |
Wolfgang Betz |
34:edda6a7238ec | 34 | * \file |
Wolfgang Betz |
34:edda6a7238ec | 35 | * Header file for the radio API |
Wolfgang Betz |
34:edda6a7238ec | 36 | * \author |
Wolfgang Betz |
34:edda6a7238ec | 37 | * Adam Dunkels <adam@sics.se> |
Wolfgang Betz |
34:edda6a7238ec | 38 | * Joakim Eriksson <joakime@sics.se> |
Wolfgang Betz |
34:edda6a7238ec | 39 | * Niclas Finne <nfi@sics.se> |
Wolfgang Betz |
34:edda6a7238ec | 40 | * Nicolas Tsiftes <nvt@sics.se> |
Wolfgang Betz |
34:edda6a7238ec | 41 | */ |
Wolfgang Betz |
34:edda6a7238ec | 42 | |
Wolfgang Betz |
34:edda6a7238ec | 43 | /** |
Wolfgang Betz |
34:edda6a7238ec | 44 | * \addtogroup dev |
Wolfgang Betz |
34:edda6a7238ec | 45 | * @{ |
Wolfgang Betz |
34:edda6a7238ec | 46 | */ |
Wolfgang Betz |
34:edda6a7238ec | 47 | |
Wolfgang Betz |
34:edda6a7238ec | 48 | /** |
Wolfgang Betz |
34:edda6a7238ec | 49 | * \defgroup radio Radio API |
Wolfgang Betz |
34:edda6a7238ec | 50 | * |
Wolfgang Betz |
34:edda6a7238ec | 51 | * The radio API module defines a set of functions that a radio device |
Wolfgang Betz |
34:edda6a7238ec | 52 | * driver must implement. |
Wolfgang Betz |
34:edda6a7238ec | 53 | * |
Wolfgang Betz |
34:edda6a7238ec | 54 | * @{ |
Wolfgang Betz |
34:edda6a7238ec | 55 | */ |
Wolfgang Betz |
34:edda6a7238ec | 56 | |
Wolfgang Betz |
34:edda6a7238ec | 57 | #ifndef RADIO_H_ |
Wolfgang Betz |
34:edda6a7238ec | 58 | #define RADIO_H_ |
Wolfgang Betz |
34:edda6a7238ec | 59 | |
Wolfgang Betz |
34:edda6a7238ec | 60 | #include <stddef.h> |
Wolfgang Betz |
34:edda6a7238ec | 61 | |
Wolfgang Betz |
34:edda6a7238ec | 62 | /** |
Wolfgang Betz |
34:edda6a7238ec | 63 | * Each radio has a set of parameters that designate the current |
Wolfgang Betz |
34:edda6a7238ec | 64 | * configuration and state of the radio. Parameters can either have |
Wolfgang Betz |
34:edda6a7238ec | 65 | * values of type radio_value_t, or, when this type is insufficient, a |
Wolfgang Betz |
34:edda6a7238ec | 66 | * generic object that is specified by a memory pointer and the size |
Wolfgang Betz |
34:edda6a7238ec | 67 | * of the object. |
Wolfgang Betz |
34:edda6a7238ec | 68 | * |
Wolfgang Betz |
34:edda6a7238ec | 69 | * The radio_value_t type is set to an integer type that can hold most |
Wolfgang Betz |
34:edda6a7238ec | 70 | * values used to configure the radio, and is therefore the most |
Wolfgang Betz |
34:edda6a7238ec | 71 | * common type used for a parameter. Certain parameters require |
Wolfgang Betz |
34:edda6a7238ec | 72 | * objects of a considerably larger size than radio_value_t, however, |
Wolfgang Betz |
34:edda6a7238ec | 73 | * and in these cases the documentation below for the parameter will |
Wolfgang Betz |
34:edda6a7238ec | 74 | * indicate this. |
Wolfgang Betz |
34:edda6a7238ec | 75 | * |
Wolfgang Betz |
34:edda6a7238ec | 76 | * All radio parameters that can vary during runtime are prefixed by |
Wolfgang Betz |
34:edda6a7238ec | 77 | * "RADIO_PARAM", whereas those "parameters" that are guaranteed to |
Wolfgang Betz |
34:edda6a7238ec | 78 | * remain immutable are prefixed by "RADIO_CONST". Each mutable |
Wolfgang Betz |
34:edda6a7238ec | 79 | * parameter has a set of valid parameter values. When attempting to |
Wolfgang Betz |
34:edda6a7238ec | 80 | * set a parameter to an invalid value, the radio will return |
Wolfgang Betz |
34:edda6a7238ec | 81 | * RADIO_RESULT_INVALID_VALUE. |
Wolfgang Betz |
34:edda6a7238ec | 82 | * |
Wolfgang Betz |
34:edda6a7238ec | 83 | * Some radios support only a subset of the defined radio parameters. |
Wolfgang Betz |
34:edda6a7238ec | 84 | * When trying to set or get such an unsupported parameter, the radio |
Wolfgang Betz |
34:edda6a7238ec | 85 | * will return RADIO_RESULT_NOT_SUPPORTED. |
Wolfgang Betz |
34:edda6a7238ec | 86 | */ |
Wolfgang Betz |
34:edda6a7238ec | 87 | |
Wolfgang Betz |
34:edda6a7238ec | 88 | typedef int radio_value_t; |
Wolfgang Betz |
34:edda6a7238ec | 89 | typedef unsigned radio_param_t; |
Wolfgang Betz |
34:edda6a7238ec | 90 | |
Wolfgang Betz |
34:edda6a7238ec | 91 | enum { |
Wolfgang Betz |
34:edda6a7238ec | 92 | |
Wolfgang Betz |
34:edda6a7238ec | 93 | /* Radio power mode determines if the radio is on |
Wolfgang Betz |
34:edda6a7238ec | 94 | (RADIO_POWER_MODE_ON) or off (RADIO_POWER_MODE_OFF). */ |
Wolfgang Betz |
34:edda6a7238ec | 95 | RADIO_PARAM_POWER_MODE, |
Wolfgang Betz |
34:edda6a7238ec | 96 | |
Wolfgang Betz |
34:edda6a7238ec | 97 | /* |
Wolfgang Betz |
34:edda6a7238ec | 98 | * Channel used for radio communication. The channel depends on the |
Wolfgang Betz |
34:edda6a7238ec | 99 | * communication standard used by the radio. The values can range |
Wolfgang Betz |
34:edda6a7238ec | 100 | * from RADIO_CONST_CHANNEL_MIN to RADIO_CONST_CHANNEL_MAX. |
Wolfgang Betz |
34:edda6a7238ec | 101 | */ |
Wolfgang Betz |
34:edda6a7238ec | 102 | RADIO_PARAM_CHANNEL, |
Wolfgang Betz |
34:edda6a7238ec | 103 | |
Wolfgang Betz |
34:edda6a7238ec | 104 | /* Personal area network identifier, which is used by the address filter. */ |
Wolfgang Betz |
34:edda6a7238ec | 105 | RADIO_PARAM_PAN_ID, |
Wolfgang Betz |
34:edda6a7238ec | 106 | |
Wolfgang Betz |
34:edda6a7238ec | 107 | /* Short address (16 bits) for the radio, which is used by the address |
Wolfgang Betz |
34:edda6a7238ec | 108 | filter. */ |
Wolfgang Betz |
34:edda6a7238ec | 109 | RADIO_PARAM_16BIT_ADDR, |
Wolfgang Betz |
34:edda6a7238ec | 110 | |
Wolfgang Betz |
34:edda6a7238ec | 111 | /* |
Wolfgang Betz |
34:edda6a7238ec | 112 | * Radio receiver mode determines if the radio has address filter |
Wolfgang Betz |
34:edda6a7238ec | 113 | * (RADIO_RX_MODE_ADDRESS_FILTER) and auto-ACK (RADIO_RX_MODE_AUTOACK) |
Wolfgang Betz |
34:edda6a7238ec | 114 | * enabled. This parameter is set as a bit mask. |
Wolfgang Betz |
34:edda6a7238ec | 115 | */ |
Wolfgang Betz |
34:edda6a7238ec | 116 | RADIO_PARAM_RX_MODE, |
Wolfgang Betz |
34:edda6a7238ec | 117 | |
Wolfgang Betz |
34:edda6a7238ec | 118 | /* |
Wolfgang Betz |
34:edda6a7238ec | 119 | * Radio transmission mode determines if the radio has send on CCA |
Wolfgang Betz |
34:edda6a7238ec | 120 | * (RADIO_TX_MODE_SEND_ON_CCA) enabled or not. This parameter is set |
Wolfgang Betz |
34:edda6a7238ec | 121 | * as a bit mask. |
Wolfgang Betz |
34:edda6a7238ec | 122 | */ |
Wolfgang Betz |
34:edda6a7238ec | 123 | RADIO_PARAM_TX_MODE, |
Wolfgang Betz |
34:edda6a7238ec | 124 | |
Wolfgang Betz |
34:edda6a7238ec | 125 | /* |
Wolfgang Betz |
34:edda6a7238ec | 126 | * Transmission power in dBm. The values can range from |
Wolfgang Betz |
34:edda6a7238ec | 127 | * RADIO_CONST_TXPOWER_MIN to RADIO_CONST_TXPOWER_MAX. |
Wolfgang Betz |
34:edda6a7238ec | 128 | * |
Wolfgang Betz |
34:edda6a7238ec | 129 | * Some radios restrict the available values to a subset of this |
Wolfgang Betz |
34:edda6a7238ec | 130 | * range. If an unavailable TXPOWER value is requested to be set, |
Wolfgang Betz |
34:edda6a7238ec | 131 | * the radio may select another TXPOWER close to the requested |
Wolfgang Betz |
34:edda6a7238ec | 132 | * one. When getting the value of this parameter, the actual value |
Wolfgang Betz |
34:edda6a7238ec | 133 | * used by the radio will be returned. |
Wolfgang Betz |
34:edda6a7238ec | 134 | */ |
Wolfgang Betz |
34:edda6a7238ec | 135 | RADIO_PARAM_TXPOWER, |
Wolfgang Betz |
34:edda6a7238ec | 136 | |
Wolfgang Betz |
34:edda6a7238ec | 137 | /* |
Wolfgang Betz |
34:edda6a7238ec | 138 | * Clear channel assessment threshold in dBm. This threshold |
Wolfgang Betz |
34:edda6a7238ec | 139 | * determines the minimum RSSI level at which the radio will assume |
Wolfgang Betz |
34:edda6a7238ec | 140 | * that there is a packet in the air. |
Wolfgang Betz |
34:edda6a7238ec | 141 | * |
Wolfgang Betz |
34:edda6a7238ec | 142 | * The CCA threshold must be set to a level above the noise floor of |
Wolfgang Betz |
34:edda6a7238ec | 143 | * the deployment. Otherwise mechanisms such as send-on-CCA and |
Wolfgang Betz |
34:edda6a7238ec | 144 | * low-power-listening duty cycling protocols may not work |
Wolfgang Betz |
34:edda6a7238ec | 145 | * correctly. Hence, the default value of the system may not be |
Wolfgang Betz |
34:edda6a7238ec | 146 | * optimal for any given deployment. |
Wolfgang Betz |
34:edda6a7238ec | 147 | */ |
Wolfgang Betz |
34:edda6a7238ec | 148 | RADIO_PARAM_CCA_THRESHOLD, |
Wolfgang Betz |
34:edda6a7238ec | 149 | |
Wolfgang Betz |
34:edda6a7238ec | 150 | /* Received signal strength indicator in dBm. */ |
Wolfgang Betz |
34:edda6a7238ec | 151 | RADIO_PARAM_RSSI, |
Wolfgang Betz |
34:edda6a7238ec | 152 | |
Wolfgang Betz |
34:edda6a7238ec | 153 | /* |
Wolfgang Betz |
34:edda6a7238ec | 154 | * Long (64 bits) address for the radio, which is used by the address filter. |
Wolfgang Betz |
34:edda6a7238ec | 155 | * The address is specified in network byte order. |
Wolfgang Betz |
34:edda6a7238ec | 156 | * |
Wolfgang Betz |
34:edda6a7238ec | 157 | * Because this parameter value is larger than what fits in radio_value_t, |
Wolfgang Betz |
34:edda6a7238ec | 158 | * it needs to be used with radio.get_object()/set_object(). |
Wolfgang Betz |
34:edda6a7238ec | 159 | */ |
Wolfgang Betz |
34:edda6a7238ec | 160 | RADIO_PARAM_64BIT_ADDR, |
Wolfgang Betz |
34:edda6a7238ec | 161 | |
Wolfgang Betz |
34:edda6a7238ec | 162 | /* Constants (read only) */ |
Wolfgang Betz |
34:edda6a7238ec | 163 | |
Wolfgang Betz |
34:edda6a7238ec | 164 | /* The lowest radio channel. */ |
Wolfgang Betz |
34:edda6a7238ec | 165 | RADIO_CONST_CHANNEL_MIN, |
Wolfgang Betz |
34:edda6a7238ec | 166 | /* The highest radio channel. */ |
Wolfgang Betz |
34:edda6a7238ec | 167 | RADIO_CONST_CHANNEL_MAX, |
Wolfgang Betz |
34:edda6a7238ec | 168 | |
Wolfgang Betz |
34:edda6a7238ec | 169 | /* The minimum transmission power in dBm. */ |
Wolfgang Betz |
34:edda6a7238ec | 170 | RADIO_CONST_TXPOWER_MIN, |
Wolfgang Betz |
34:edda6a7238ec | 171 | /* The maximum transmission power in dBm. */ |
Wolfgang Betz |
34:edda6a7238ec | 172 | RADIO_CONST_TXPOWER_MAX |
Wolfgang Betz |
34:edda6a7238ec | 173 | }; |
Wolfgang Betz |
34:edda6a7238ec | 174 | |
Wolfgang Betz |
34:edda6a7238ec | 175 | /* Radio power modes */ |
Wolfgang Betz |
34:edda6a7238ec | 176 | enum { |
Wolfgang Betz |
34:edda6a7238ec | 177 | RADIO_POWER_MODE_OFF, |
Wolfgang Betz |
34:edda6a7238ec | 178 | RADIO_POWER_MODE_ON |
Wolfgang Betz |
34:edda6a7238ec | 179 | }; |
Wolfgang Betz |
34:edda6a7238ec | 180 | |
Wolfgang Betz |
34:edda6a7238ec | 181 | /** |
Wolfgang Betz |
34:edda6a7238ec | 182 | * The radio reception mode controls address filtering and automatic |
Wolfgang Betz |
34:edda6a7238ec | 183 | * transmission of acknowledgements in the radio (if such operations |
Wolfgang Betz |
34:edda6a7238ec | 184 | * are supported by the radio). A single parameter is used to allow |
Wolfgang Betz |
34:edda6a7238ec | 185 | * setting these features simultaneously as an atomic operation. |
Wolfgang Betz |
34:edda6a7238ec | 186 | * |
Wolfgang Betz |
34:edda6a7238ec | 187 | * To enable both address filter and transmissions of automatic |
Wolfgang Betz |
34:edda6a7238ec | 188 | * acknowledgments: |
Wolfgang Betz |
34:edda6a7238ec | 189 | * |
Wolfgang Betz |
34:edda6a7238ec | 190 | * NETSTACK_RADIO.set_value(RADIO_PARAM_RX_MODE, |
Wolfgang Betz |
34:edda6a7238ec | 191 | * RADIO_RX_MODE_ADDRESS_FILTER | RADIO_RX_MODE_AUTOACK); |
Wolfgang Betz |
34:edda6a7238ec | 192 | */ |
Wolfgang Betz |
34:edda6a7238ec | 193 | #define RADIO_RX_MODE_ADDRESS_FILTER (1 << 0) |
Wolfgang Betz |
34:edda6a7238ec | 194 | #define RADIO_RX_MODE_AUTOACK (1 << 1) |
Wolfgang Betz |
34:edda6a7238ec | 195 | |
Wolfgang Betz |
34:edda6a7238ec | 196 | /** |
Wolfgang Betz |
34:edda6a7238ec | 197 | * The radio transmission mode controls whether transmissions should |
Wolfgang Betz |
34:edda6a7238ec | 198 | * be done using clear channel assessment (if supported by the |
Wolfgang Betz |
34:edda6a7238ec | 199 | * radio). If send-on-CCA is enabled, the radio's send function will |
Wolfgang Betz |
34:edda6a7238ec | 200 | * wait for a radio-specific time window for the channel to become |
Wolfgang Betz |
34:edda6a7238ec | 201 | * clear. If this does not happen, the send function will return |
Wolfgang Betz |
34:edda6a7238ec | 202 | * RADIO_TX_COLLISION. |
Wolfgang Betz |
34:edda6a7238ec | 203 | */ |
Wolfgang Betz |
34:edda6a7238ec | 204 | #define RADIO_TX_MODE_SEND_ON_CCA (1 << 0) |
Wolfgang Betz |
34:edda6a7238ec | 205 | |
Wolfgang Betz |
34:edda6a7238ec | 206 | /* Radio return values when setting or getting radio parameters. */ |
Wolfgang Betz |
34:edda6a7238ec | 207 | typedef enum { |
Wolfgang Betz |
34:edda6a7238ec | 208 | RADIO_RESULT_OK, |
Wolfgang Betz |
34:edda6a7238ec | 209 | RADIO_RESULT_NOT_SUPPORTED, |
Wolfgang Betz |
34:edda6a7238ec | 210 | RADIO_RESULT_INVALID_VALUE, |
Wolfgang Betz |
34:edda6a7238ec | 211 | RADIO_RESULT_ERROR |
Wolfgang Betz |
34:edda6a7238ec | 212 | } radio_result_t; |
Wolfgang Betz |
34:edda6a7238ec | 213 | |
Wolfgang Betz |
34:edda6a7238ec | 214 | /* Radio return values for transmissions. */ |
Wolfgang Betz |
34:edda6a7238ec | 215 | enum { |
Wolfgang Betz |
34:edda6a7238ec | 216 | RADIO_TX_OK, |
Wolfgang Betz |
34:edda6a7238ec | 217 | RADIO_TX_ERR, |
Wolfgang Betz |
34:edda6a7238ec | 218 | RADIO_TX_COLLISION, |
Wolfgang Betz |
34:edda6a7238ec | 219 | RADIO_TX_NOACK, |
Wolfgang Betz |
34:edda6a7238ec | 220 | }; |
Wolfgang Betz |
34:edda6a7238ec | 221 | |
Wolfgang Betz |
34:edda6a7238ec | 222 | /** |
Wolfgang Betz |
34:edda6a7238ec | 223 | * The structure of a device driver for a radio in Contiki. |
Wolfgang Betz |
34:edda6a7238ec | 224 | */ |
Wolfgang Betz |
34:edda6a7238ec | 225 | struct radio_driver { |
Wolfgang Betz |
34:edda6a7238ec | 226 | |
Wolfgang Betz |
34:edda6a7238ec | 227 | int (* init)(void); |
Wolfgang Betz |
34:edda6a7238ec | 228 | |
Wolfgang Betz |
34:edda6a7238ec | 229 | /** Prepare the radio with a packet to be sent. */ |
Wolfgang Betz |
34:edda6a7238ec | 230 | int (* prepare)(const void *payload, unsigned short payload_len); |
Wolfgang Betz |
34:edda6a7238ec | 231 | |
Wolfgang Betz |
34:edda6a7238ec | 232 | /** Send the packet that has previously been prepared. */ |
Wolfgang Betz |
34:edda6a7238ec | 233 | int (* transmit)(unsigned short transmit_len); |
Wolfgang Betz |
34:edda6a7238ec | 234 | |
Wolfgang Betz |
34:edda6a7238ec | 235 | /** Prepare & transmit a packet. */ |
Wolfgang Betz |
34:edda6a7238ec | 236 | int (* send)(const void *payload, unsigned short payload_len); |
Wolfgang Betz |
34:edda6a7238ec | 237 | |
Wolfgang Betz |
34:edda6a7238ec | 238 | /** Read a received packet into a buffer. */ |
Wolfgang Betz |
34:edda6a7238ec | 239 | int (* read)(void *buf, unsigned short buf_len); |
Wolfgang Betz |
34:edda6a7238ec | 240 | |
Wolfgang Betz |
34:edda6a7238ec | 241 | /** Perform a Clear-Channel Assessment (CCA) to find out if there is |
Wolfgang Betz |
34:edda6a7238ec | 242 | a packet in the air or not. */ |
Wolfgang Betz |
34:edda6a7238ec | 243 | int (* channel_clear)(void); |
Wolfgang Betz |
34:edda6a7238ec | 244 | |
Wolfgang Betz |
34:edda6a7238ec | 245 | /** Check if the radio driver is currently receiving a packet */ |
Wolfgang Betz |
34:edda6a7238ec | 246 | int (* receiving_packet)(void); |
Wolfgang Betz |
34:edda6a7238ec | 247 | |
Wolfgang Betz |
34:edda6a7238ec | 248 | /** Check if the radio driver has just received a packet */ |
Wolfgang Betz |
34:edda6a7238ec | 249 | int (* pending_packet)(void); |
Wolfgang Betz |
34:edda6a7238ec | 250 | |
Wolfgang Betz |
34:edda6a7238ec | 251 | /** Turn the radio on. */ |
Wolfgang Betz |
34:edda6a7238ec | 252 | int (* on)(void); |
Wolfgang Betz |
34:edda6a7238ec | 253 | |
Wolfgang Betz |
34:edda6a7238ec | 254 | /** Turn the radio off. */ |
Wolfgang Betz |
34:edda6a7238ec | 255 | int (* off)(void); |
Wolfgang Betz |
34:edda6a7238ec | 256 | |
Wolfgang Betz |
34:edda6a7238ec | 257 | /** Get a radio parameter value. */ |
Wolfgang Betz |
34:edda6a7238ec | 258 | radio_result_t (* get_value)(radio_param_t param, radio_value_t *value); |
Wolfgang Betz |
34:edda6a7238ec | 259 | |
Wolfgang Betz |
34:edda6a7238ec | 260 | /** Set a radio parameter value. */ |
Wolfgang Betz |
34:edda6a7238ec | 261 | radio_result_t (* set_value)(radio_param_t param, radio_value_t value); |
Wolfgang Betz |
34:edda6a7238ec | 262 | |
Wolfgang Betz |
34:edda6a7238ec | 263 | /** |
Wolfgang Betz |
34:edda6a7238ec | 264 | * Get a radio parameter object. The argument 'dest' must point to a |
Wolfgang Betz |
34:edda6a7238ec | 265 | * memory area of at least 'size' bytes, and this memory area will |
Wolfgang Betz |
34:edda6a7238ec | 266 | * contain the parameter object if the function succeeds. |
Wolfgang Betz |
34:edda6a7238ec | 267 | */ |
Wolfgang Betz |
34:edda6a7238ec | 268 | radio_result_t (* get_object)(radio_param_t param, void *dest, size_t size); |
Wolfgang Betz |
34:edda6a7238ec | 269 | |
Wolfgang Betz |
34:edda6a7238ec | 270 | /** |
Wolfgang Betz |
34:edda6a7238ec | 271 | * Set a radio parameter object. The memory area referred to by the |
Wolfgang Betz |
34:edda6a7238ec | 272 | * argument 'src' will not be accessed after the function returns. |
Wolfgang Betz |
34:edda6a7238ec | 273 | */ |
Wolfgang Betz |
34:edda6a7238ec | 274 | radio_result_t (* set_object)(radio_param_t param, const void *src, |
Wolfgang Betz |
34:edda6a7238ec | 275 | size_t size); |
Wolfgang Betz |
34:edda6a7238ec | 276 | |
Wolfgang Betz |
34:edda6a7238ec | 277 | }; |
Wolfgang Betz |
34:edda6a7238ec | 278 | |
Wolfgang Betz |
34:edda6a7238ec | 279 | #endif /* RADIO_H_ */ |
Wolfgang Betz |
34:edda6a7238ec | 280 | |
Wolfgang Betz |
34:edda6a7238ec | 281 | /** @} */ |
Wolfgang Betz |
34:edda6a7238ec | 282 | /** @} */ |