Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
regulatory.h
Go to the documentation of this file.
1 #ifndef __NET_REGULATORY_H
2 #define __NET_REGULATORY_H
3 /*
4  * regulatory support structures
5  *
6  * Copyright 2008-2009 Luis R. Rodriguez <[email protected]>
7  *
8  * Permission to use, copy, modify, and/or distribute this software for any
9  * purpose with or without fee is hereby granted, provided that the above
10  * copyright notice and this permission notice appear in all copies.
11  *
12  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
13  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
14  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
15  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
16  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
17  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
18  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
19  */
20 
21 
33 };
34 
75  int wiphy_idx;
78  char alpha2[2];
80  bool intersect;
81  bool processed;
83  struct list_head list;
84 };
85 
90 };
91 
95 };
96 
101 };
102 
105  char alpha2[2];
108 };
109 
110 #define MHZ_TO_KHZ(freq) ((freq) * 1000)
111 #define KHZ_TO_MHZ(freq) ((freq) / 1000)
112 #define DBI_TO_MBI(gain) ((gain) * 100)
113 #define MBI_TO_DBI(gain) ((gain) / 100)
114 #define DBM_TO_MBM(gain) ((gain) * 100)
115 #define MBM_TO_DBM(gain) ((gain) / 100)
116 
117 #define REG_RULE(start, end, bw, gain, eirp, reg_flags) \
118 { \
119  .freq_range.start_freq_khz = MHZ_TO_KHZ(start), \
120  .freq_range.end_freq_khz = MHZ_TO_KHZ(end), \
121  .freq_range.max_bandwidth_khz = MHZ_TO_KHZ(bw), \
122  .power_rule.max_antenna_gain = DBI_TO_MBI(gain),\
123  .power_rule.max_eirp = DBM_TO_MBM(eirp), \
124  .flags = reg_flags, \
125 }
126 
127 #endif