Contiki-NG
dot-15-4g.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2018, Texas Instruments Incorporated - http://www.ti.com/
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 copyright holder nor the names of its
14  * contributors may be used to endorse or promote products derived
15  * from this software without specific prior written permission.
16  *
17  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
20  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
21  * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
22  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
26  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
28  * OF THE POSSIBILITY OF SUCH DAMAGE.
29  */
30 /**
31  * \addtogroup cc13xx-cc26xx-rf
32  * @{
33  *
34  * \defgroup cc13xx-cc26xx-rf-15-4g-modes IEEE 802.15.4g Frequency Bands and Modes
35  *
36  * @{
37  *
38  * \file
39  * Header file with descriptors for the various modes of operation
40  * defined in IEEE 802.15.4g.
41  * \author
42  * Edvard Pettersen <e.pettersen@ti.com>
43  */
44 /*---------------------------------------------------------------------------*/
45 #ifndef DOT_15_4G_H_
46 #define DOT_15_4G_H_
47 /*---------------------------------------------------------------------------*/
48 #include "contiki.h"
49 /*---------------------------------------------------------------------------*/
50 #include <ti/devices/DeviceFamily.h>
51 #include DeviceFamily_constructPath(driverlib/rf_mailbox.h)
52 /*---------------------------------------------------------------------------*/
53 #include <stdint.h>
54 #include <stdbool.h>
55 /*---------------------------------------------------------------------------*/
56 /* IEEE 802.15.4g frequency band identifiers (Table 68f) */
57 #define DOT_15_4G_FREQ_BAND_169 0 /* 169.400–169.475 (Europe) - 169 MHz band */
58 #define DOT_15_4G_FREQ_BAND_450 1 /* 450–470 (US FCC Part 22/90) - 450 MHz band */
59 #define DOT_15_4G_FREQ_BAND_470 2 /* 470–510 (China) - 470 MHz band */
60 #define DOT_15_4G_FREQ_BAND_780 3 /* 779–787 (China) - 780 MHz band */
61 #define DOT_15_4G_FREQ_BAND_863 4 /* 863–870 (Europe) - 863 MHz band */
62 #define DOT_15_4G_FREQ_BAND_896 5 /* 896–901 (US FCC Part 90) - 896 MHz band */
63 #define DOT_15_4G_FREQ_BAND_901 6 /* 901–902 (US FCC Part 24) - 901 MHz band */
64 #define DOT_15_4G_FREQ_BAND_915 7 /* 902–928 (US) - 915 MHz band */
65 #define DOT_15_4G_FREQ_BAND_917 8 /* 917–923.5 (Korea) - 917 MHz band */
66 #define DOT_15_4G_FREQ_BAND_920 9 /* 920–928 (Japan) - 920 MHz band */
67 #define DOT_15_4G_FREQ_BAND_928 10 /* 928–960 (US, non-contiguous) - 928 MHz band */
68 #define DOT_15_4G_FREQ_BAND_950 11 /* 950–958 (Japan) - 950 MHz band */
69 #define DOT_15_4G_FREQ_BAND_1427 12 /* 1427–1518 (US and Canada, non-contiguous) - 1427 MHz band */
70 #define DOT_15_4G_FREQ_BAND_2450 13 /* 2400–2483.5 2450 MHz band */
71 /*---------------------------------------------------------------------------*/
72 /* Default band selection to band 4 - 863MHz */
73 #ifdef DOT_15_4G_CONF_FREQ_BAND_ID
74 #define DOT_15_4G_FREQ_BAND_ID DOT_15_4G_CONF_FREQ_BAND_ID
75 #else
76 #define DOT_15_4G_FREQ_BAND_ID DOT_15_4G_FREQ_BAND_863
77 #endif
78 /*---------------------------------------------------------------------------*/
79 /*
80  * Channel count, spacing and other params relating to the selected band. We
81  * currently only support some of the bands defined in .15.4g and for those
82  * bands we only support operating mode #1 (Table 134).
83  *
84  * DOT_15_4G_CHAN0_FREQ is specified here in KHz
85  */
86 #if (DOT_15_4G_FREQ_BAND_ID == DOT_15_4G_FREQ_BAND_470)
87 #define DOT_15_4G_CHAN_MIN 0
88 #define DOT_15_4G_CHAN_MAX 198
89 #define DOT_15_4G_FREQ_SPACING 200
90 #define DOT_15_4G_CHAN0_FREQ 470200
91 
92 #define PROP_MODE_CONF_CENTER_FREQ 0x01EA
93 #define PROP_MODE_CONF_LO_DIVIDER 0x0A
94 
95 #elif (DOT_15_4G_FREQ_BAND_ID == DOT_15_4G_FREQ_BAND_780)
96 #define DOT_15_4G_CHAN_MIN 0
97 #define DOT_15_4G_CHAN_MAX 38
98 #define DOT_15_4G_FREQ_SPACING 200
99 #define DOT_15_4G_CHAN0_FREQ 779200
100 
101 #define PROP_MODE_CONF_CENTER_FREQ 0x030F
102 #define PROP_MODE_CONF_LO_DIVIDER 0x06
103 
104 #elif (DOT_15_4G_FREQ_BAND_ID == DOT_15_4G_FREQ_BAND_863)
105 #define DOT_15_4G_CHAN_MIN 0
106 #define DOT_15_4G_CHAN_MAX 33
107 #define DOT_15_4G_FREQ_SPACING 200
108 #define DOT_15_4G_CHAN0_FREQ 863125
109 
110 #define PROP_MODE_CONF_CENTER_FREQ 0x0362
111 #define PROP_MODE_CONF_LO_DIVIDER 0x05
112 
113 #elif (DOT_15_4G_FREQ_BAND_ID == DOT_15_4G_FREQ_BAND_915)
114 #define DOT_15_4G_CHAN_MIN 0
115 #define DOT_15_4G_CHAN_MAX 128
116 #define DOT_15_4G_FREQ_SPACING 200
117 #define DOT_15_4G_CHAN0_FREQ 902200
118 
119 #define PROP_MODE_CONF_CENTER_FREQ 0x0393
120 #define PROP_MODE_CONF_LO_DIVIDER 0x05
121 
122 #elif (DOT_15_4G_FREQ_BAND_ID == DOT_15_4G_FREQ_BAND_920)
123 #define DOT_15_4G_CHAN_MIN 0
124 #define DOT_15_4G_CHAN_MAX 37
125 #define DOT_15_4G_FREQ_SPACING 200
126 #define DOT_15_4G_CHAN0_FREQ 920600
127 
128 #define PROP_MODE_CONF_CENTER_FREQ 0x039C
129 #define PROP_MODE_CONF_LO_DIVIDER 0x05
130 
131 #elif (DOT_15_4G_FREQ_BAND_ID == DOT_15_4G_FREQ_BAND_950)
132 #define DOT_15_4G_CHAN_MIN 0
133 #define DOT_15_4G_CHAN_MAX 32
134 #define DOT_15_4G_FREQ_SPACING 200
135 #define DOT_15_4G_CHAN0_FREQ 951000
136 
137 #define PROP_MODE_CONF_CENTER_FREQ 0x03BA
138 #define PROP_MODE_CONF_LO_DIVIDER 0x05
139 
140 #elif (DOT_15_4G_FREQ_BAND_ID == DOT_15_4G_FREQ_BAND_2450)
141 #define DOT_15_4G_CHAN_MIN 11
142 #define DOT_15_4G_CHAN_MAX 26
143 #define DOT_15_4G_FREQ_SPACING 5000
144 #define DOT_15_4G_CHAN0_FREQ 2405000
145 
146 #else
147 #error "The selected IEEE 802.15.4g frequency band is not supported"
148 #endif
149 /*---------------------------------------------------------------------------*/
150 static inline uint32_t
151 dot_15_4g_freq(const uint16_t chan)
152 {
153  const uint32_t chan0 = DOT_15_4G_CHAN0_FREQ;
154  const uint32_t spacing = DOT_15_4G_FREQ_SPACING;
155  const uint32_t chan_min = DOT_15_4G_CHAN_MIN;
156  return chan0 + spacing * ((uint32_t)chan - chan_min);
157 }
158 /*---------------------------------------------------------------------------*/
159 static inline bool
160 dot_15_4g_chan_in_range(const uint16_t chan)
161 {
162  const uint16_t chan_min = DOT_15_4G_CHAN_MIN;
163  const uint16_t chan_max = DOT_15_4G_CHAN_MAX;
164  return (chan >= chan_min) &&
165  (chan <= chan_max);
166 }
167 /*---------------------------------------------------------------------------*/
168 #define DOT_15_4G_DEFAULT_CHAN IEEE802154_DEFAULT_CHANNEL
169 /*---------------------------------------------------------------------------*/
170 #endif /* DOT_15_4G_H_ */
171 /*---------------------------------------------------------------------------*/
172 /**
173  * @}
174  * @}
175  */