Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: xBedRadio MxSniffer
const.h
00001 /* Copyright (c) 2007, 2008, 2009, 2010 00002 Marco Arena 00003 Axel Wachtler 00004 00005 All rights reserved. 00006 00007 Redistribution and use in source and binary forms, with or without 00008 modification, are permitted provided that the following conditions 00009 are met: 00010 00011 * Redistributions of source code must retain the above copyright 00012 notice, this list of conditions and the following disclaimer. 00013 * Redistributions in binary form must reproduce the above copyright 00014 notice, this list of conditions and the following disclaimer in the 00015 documentation and/or other materials provided with the distribution. 00016 * Neither the name of the authors nor the names of its contributors 00017 may be used to endorse or promote products derived from this software 00018 without specific prior written permission. 00019 00020 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 00021 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 00022 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 00023 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 00024 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 00025 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 00026 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 00027 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 00028 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 00029 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 00030 POSSIBILITY OF SUCH DAMAGE. */ 00031 00032 /* $Id$ */ 00033 /** 00034 * @file 00035 * @brief General Definitions. 00036 * 00037 */ 00038 /*====================================================================*/ 00039 #ifndef CONST_H 00040 #define CONST_H 00041 #include <stdint.h> 00042 #include <stdbool.h> 00043 00044 /** 00045 * @addtogroup grpRadio 00046 * @{ 00047 */ 00048 #if RADIO_TYPE == RADIO_AT86RF230 ||RADIO_TYPE == RADIO_AT86RF230B|| RADIO_TYPE == RADIO_AT86RF231 00049 #define RSSI_BASE_VAL (-91) 00050 #elif RADIO_TYPE == RADIO_ATMEGA128RFA1_A || RADIO_TYPE == RADIO_ATMEGA128RFA1_B ||RADIO_TYPE == RADIO_ATMEGA128RFA1_c ||RADIO_TYPE == RADIO_ATMEGA128RFA1_D ||RADIO_TYPE == RADIO_ATMEGA256RFR2_A 00051 #define RSSI_BASE_VAL (-90) 00052 #elif RADIO_TYPE == RADIO_AT86RF212 00053 #define RSSI_BASE_VAL (-97) 00054 #endif 00055 00056 /*=== radio constants ================================================*/ 00057 #define RADIO_AT86RF230 (1) /**< Identifier for radio AT86RF230 */ 00058 #define RADIO_AT86RF230A (RADIO_AT86RF230) /**< Identifier for radio AT86RF230 Rev A */ 00059 #define RADIO_AT86RF230B (2) /**< Identifier for radio AT86RF230 Rev B */ 00060 #define RADIO_AT86RF231 (3) /**< Identifier for radio AT86RF231 */ 00061 #define RADIO_AT86RF212 (4) /**< Identifier for radio AT86RF212 */ 00062 #define RADIO_ATMEGA128RFA1_A (5) /**< Identifier for radio ATmega128RFA1 Rev. A */ 00063 #define RADIO_ATMEGA128RFA1_B (6) /**< Identifier for radio ATmega128RFA1 Rev. B */ 00064 #define RADIO_ATMEGA128RFA1_C (7) /**< Identifier for radio ATmega128RFA1 Rev. C */ 00065 #define RADIO_ATMEGA128RFA1_D (8) /**< Identifier for radio ATmega128RFA1 Rev. D */ 00066 #define RADIO_AT86RF232 (9) /**< Identifier for radio AT86RF232 */ 00067 #define RADIO_AT86RF233 (10) /**< Identifier for radio AT86RF233 */ 00068 00069 #define RADIO_ATMEGA256RFR2 (11) /**< Identifier for radio ATmega128RFR2 */ 00070 #define RADIO_ATMEGA256RFR2_A (11) /**< Identifier for radio RADIO_ATMEGA256RFR2_A Rev. A */ 00071 #define RADIO_ATMEGA256RFR2_B (12) /**< Identifier for radio RADIO_ATMEGA256RFR2_A Rev. A */ 00072 #define RADIO_ATMEGA256RFR2_C (13) /**< Identifier for radio RADIO_ATMEGA256RFR2_A Rev. A */ 00073 00074 #define RADIO_BAND_700 (1) /**< 700MHz frequency band (china) */ 00075 #define RADIO_BAND_800 (2) /**< 868MHz frequency band (europe)*/ 00076 #define RADIO_BAND_900 (3) /**< 900MHz frequency band (north america)*/ 00077 #define RADIO_BAND_2400 (4) /**< 2.4GHz frequency band (international)*/ 00078 00079 /*=== modulation schemes =============================================*/ 00080 #define MOD_BPSK_20 (0) /**< PHY modulation BPSK, 20 kbit/s */ 00081 #define MOD_BPSK_40 (1) /**< PHY modulation BPSK, 40 kbit/s */ 00082 #define MOD_OQPSK_100 (2) /**< PHY modulation O-QPSK, 100 kbit/s */ 00083 #define MOD_OQPSK_200 (3) /**< PHY modulation O-QPSK, 200 kbit/s */ 00084 #define MOD_OQPSK_250 (4) /**< PHY modulation O-QPSK, 250 kbit/s */ 00085 #define MOD_OQPSK_400 (5) /**< PHY modulation O-QPSK, 400 kbit/s */ 00086 #define MOD_OQPSK_500 (6) /**< PHY modulation O-QPSK, 500 kbit/s */ 00087 #define MOD_OQPSK_1000 (7) /**< PHY modulation O-QPSK, 1000 kbit/s */ 00088 #define MOD_OQPSK_2000 (8) /**< PHY modulation O-QPSK, 2000 kbit/s */ 00089 00090 00091 /** @} */ 00092 00093 /** 00094 * @addtogroup grpHIF 00095 * @{ 00096 */ 00097 00098 /*=== HIF type constants =============================================*/ 00099 #define HIF_NONE (0) /**< Identifier for no host interface */ 00100 #define HIF_UART_0 (10) /**< Identifier for HIF type UART 0 */ 00101 #define HIF_UART_1 (11) /**< Identifier for HIF type UART 1 */ 00102 #define HIF_FT245 (20) /**< Identifier for HIF type USB/FT245*/ 00103 #define HIF_AT90USB (21) /**< Identifier for HIF type USB/ATmega1287 */ 00104 00105 /*=== USB constants ==================================================*/ 00106 /** 00107 * uracoli USB Vendor ID 00108 * 00109 * The pair of the uracoli vendor id, device id are obtained by 00110 * 00111 * - http://www.voti.nl/pids/ 00112 * - http://www.frank-buss.de/pid.txt 00113 */ 00114 #define URACOLI_USB_VID (5824) 00115 /** 00116 * uracoli USB Product ID 00117 * see also @ref USB_VID_URACOLI 00118 */ 00119 #define URACOLI_USB_PID (2183) 00120 00121 #define URACOLI_USB_BCD_RELEASE (0x100) 00122 #define URACOLI_USB_VENDOR_NAME L"URACOLI" 00123 #define URACOLI_USB_PRODUCT_NAME L"RZUSBSTICK" 00124 00125 /** @} */ 00126 00127 /** 00128 * @addtogroup grpTrx 00129 * @{ 00130 */ 00131 00132 /*=== spi constants ==================================================*/ 00133 #define SPI_RATE_1_2 (4) /**< SPI clock running is 0.5 (1/2) of cpu clock */ 00134 #define SPI_RATE_1_4 (0) /**< SPI clock running is 0.25 (1/4) of cpu clock */ 00135 #define SPI_RATE_1_8 (5) /**< SPI clock running is 0.125 (1/8) of cpu clock */ 00136 #define SPI_RATE_1_16 (1) /**< SPI clock running is 0.0635 (1/16) of cpu clock */ 00137 #define SPI_RATE_1_32 (6) /**< SPI clock running is 0.03125 (1/32)of cpu clock */ 00138 #define SPI_RATE_1_64 (2) /**< SPI clock running is 0.015625 (1/64)of cpu clock */ 00139 #define SPI_RATE_1_128 (3) /**< SPI clock running is 0.0078125 (1/128) of cpuclock */ 00140 00141 /** @} */ 00142 00143 00144 #if defined (DOXYGEN) 00145 /** macro that forces an enumeration to use 8 bit instead of 16 bit integers. */ 00146 #define SHORTENUM 00147 #else 00148 #define SHORTENUM __attribute__((packed)) 00149 #endif 00150 00151 /** 00152 * @addtogroup grpTrx 00153 * @{ 00154 */ 00155 #define FCTL_DATA _BV(0) /**< data frame fype in frame control field */ 00156 #define FCTL_ACK _BV(5) /**< ack request in frame control field */ 00157 #define FCTL_IPAN _BV(6) /**< intra pan bit in frame control field */ 00158 #define FCTL_DST_SHORT 0x0800 /**< destination short address in frame control field */ 00159 #define FCTL_DST_LONG 0x0c00 /**< destination long address in frame control field */ 00160 #define FCTL_SRC_SHORT 0x8000 /**< source short address in frame control field */ 00161 #define FCTL_SRC_LONG 0xc000 /**< source long address in frame control field */ 00162 00163 #define FCTL_SRC_MASK (FCTL_SRC_LONG) 00164 #define FCTL_DST_MASK (FCTL_DST_LONG) 00165 #define FCTL_IPAN_MASK (FCTL_IPAN) 00166 /** @} */ 00167 00168 /* === Types ================================================================= */ 00169 00170 00171 /** 00172 * @addtogroup grpTrx 00173 * @{ 00174 */ 00175 00176 /** transceiver channel type */ 00177 typedef int8_t channel_t; 00178 00179 /** transceiver transmit type */ 00180 typedef int8_t txpwr_t; 00181 00182 /** radio idle state, if true radio idles in state PX_ON 00183 * @todo make it state_t variable, so that idle state can explicitely selected. 00184 */ 00185 typedef bool rxidle_t; 00186 00187 /** transceiver cca mode, 1 : ED, 2: CS, 3: CS & ED */ 00188 typedef uint8_t ccamode_t; 00189 00190 /* ... cca_ed_tresh, clkm, pdt, ... */ 00191 00192 /** 00193 * Transceiver parameter structure 00194 */ 00195 typedef struct 00196 { 00197 /** current channel see sub register @ref SR_CHANNEL*/ 00198 channel_t chan; 00199 /** TX power index see sub register @ref SR_TX_PWR*/ 00200 unsigned int txp : 4; 00201 /** CCA mode see sub register @ref SR_CCA_MODE */ 00202 unsigned int cca : 2; 00203 /** ED threshold see sub register @ref SR_CCA_ED_THRES */ 00204 unsigned int edt : 4; 00205 00206 /** clkm control see sub register @ref SR_CLKM_CTRL */ 00207 unsigned int clkm : 3; 00208 00209 } trx_param_t; 00210 00211 /** @} */ 00212 #endif /* #ifndef CONST_H */
Generated on Thu Jul 14 2022 01:09:39 by
1.7.2

