|
@@ -33,94 +33,199 @@
|
|
|
#include <scheduler_api.h>
|
|
|
#include "reg_build_chan_list.h"
|
|
|
#include "reg_opclass.h"
|
|
|
+#include "reg_services_common.h"
|
|
|
|
|
|
#ifdef HOST_OPCLASS
|
|
|
static struct reg_dmn_supp_op_classes reg_dmn_curr_supp_opp_classes = { 0 };
|
|
|
#endif
|
|
|
|
|
|
static const struct reg_dmn_op_class_map_t global_op_class[] = {
|
|
|
- {81, 25, BW20, {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13} },
|
|
|
- {82, 25, BW20, {14} },
|
|
|
- {83, 40, BW40_LOW_PRIMARY, {1, 2, 3, 4, 5, 6, 7, 8, 9} },
|
|
|
- {84, 40, BW40_HIGH_PRIMARY, {5, 6, 7, 8, 9, 10, 11, 12, 13} },
|
|
|
- {115, 20, BW20, {36, 40, 44, 48} },
|
|
|
- {116, 40, BW40_LOW_PRIMARY, {36, 44} },
|
|
|
- {117, 40, BW40_HIGH_PRIMARY, {40, 48} },
|
|
|
- {118, 20, BW20, {52, 56, 60, 64} },
|
|
|
- {119, 40, BW40_LOW_PRIMARY, {52, 60} },
|
|
|
- {120, 40, BW40_HIGH_PRIMARY, {56, 64} },
|
|
|
- {121, 20, BW20,
|
|
|
- {100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140} },
|
|
|
- {122, 40, BW40_LOW_PRIMARY, {100, 108, 116, 124, 132} },
|
|
|
- {123, 40, BW40_HIGH_PRIMARY, {104, 112, 120, 128, 136} },
|
|
|
- {125, 20, BW20, {149, 153, 157, 161, 165, 169} },
|
|
|
- {126, 40, BW40_LOW_PRIMARY, {149, 157} },
|
|
|
- {127, 40, BW40_HIGH_PRIMARY, {153, 161} },
|
|
|
- {128, 80, BW80, {36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108,
|
|
|
- 112, 116, 120, 124, 128, 132, 136, 140, 144,
|
|
|
- 149, 153, 157, 161} },
|
|
|
- {0, 0, 0, {0} },
|
|
|
+ {81, 25, BW20, BIT(BEHAV_NONE), 2407,
|
|
|
+ {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13} },
|
|
|
+ {82, 25, BW20, BIT(BEHAV_NONE), 2414,
|
|
|
+ {14} },
|
|
|
+ {83, 40, BW40_LOW_PRIMARY, BIT(BEHAV_BW40_LOW_PRIMARY), 2407,
|
|
|
+ {1, 2, 3, 4, 5, 6, 7, 8, 9} },
|
|
|
+ {84, 40, BW40_HIGH_PRIMARY, BIT(BEHAV_BW40_HIGH_PRIMARY), 2407,
|
|
|
+ {5, 6, 7, 8, 9, 10, 11, 12, 13} },
|
|
|
+ {115, 20, BW20, BIT(BEHAV_NONE), 5000,
|
|
|
+ {36, 40, 44, 48} },
|
|
|
+ {116, 40, BW40_LOW_PRIMARY, BIT(BEHAV_BW40_LOW_PRIMARY), 5000,
|
|
|
+ {36, 44} },
|
|
|
+ {117, 40, BW40_HIGH_PRIMARY, BIT(BEHAV_BW40_HIGH_PRIMARY), 5000,
|
|
|
+ {40, 48} },
|
|
|
+ {118, 20, BW20, BIT(BEHAV_NONE), 5000,
|
|
|
+ {52, 56, 60, 64} },
|
|
|
+ {119, 40, BW40_LOW_PRIMARY, BIT(BEHAV_BW40_LOW_PRIMARY), 5000,
|
|
|
+ {52, 60} },
|
|
|
+ {120, 40, BW40_HIGH_PRIMARY, BIT(BEHAV_BW40_HIGH_PRIMARY), 5000,
|
|
|
+ {56, 64} },
|
|
|
+ {121, 20, BW20, BIT(BEHAV_NONE), 5000,
|
|
|
+ {100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144} },
|
|
|
+ {122, 40, BW40_LOW_PRIMARY, BIT(BEHAV_BW40_LOW_PRIMARY), 5000,
|
|
|
+ {100, 108, 116, 124, 132, 140} },
|
|
|
+ {123, 40, BW40_HIGH_PRIMARY, BIT(BEHAV_BW40_HIGH_PRIMARY), 5000,
|
|
|
+ {104, 112, 120, 128, 136, 144} },
|
|
|
+ {125, 20, BW20, BIT(BEHAV_NONE), 5000,
|
|
|
+ {149, 153, 157, 161, 165, 169} },
|
|
|
+ {126, 40, BW40_LOW_PRIMARY, BIT(BEHAV_BW40_LOW_PRIMARY), 5000,
|
|
|
+ {149, 157} },
|
|
|
+ {127, 40, BW40_HIGH_PRIMARY, BIT(BEHAV_BW40_HIGH_PRIMARY), 5000,
|
|
|
+ {153, 161} },
|
|
|
+ {128, 80, BW80, BIT(BEHAV_NONE), 5000,
|
|
|
+ {36, 40, 44, 48, 52, 56, 60, 64,
|
|
|
+ 100, 104, 108, 112, 116, 120, 124,
|
|
|
+ 128, 132, 136, 140, 144,
|
|
|
+ 149, 153, 157, 161} },
|
|
|
+
|
|
|
+#ifdef CONFIG_BAND_6GHZ
|
|
|
+ {131, 20, BW20, BIT(BEHAV_NONE), 5940,
|
|
|
+ {1, 5, 9, 13, 17, 21, 25, 29, 33,
|
|
|
+ 37, 41, 45, 49, 53, 57, 61, 65, 69,
|
|
|
+ 73, 77, 81, 85, 89, 93, 97,
|
|
|
+ 101, 105, 109, 113, 117, 121, 125,
|
|
|
+ 129, 133, 137, 141, 145, 149, 153,
|
|
|
+ 157, 161, 165, 169, 173, 177, 181,
|
|
|
+ 185, 189, 193, 197, 201, 205, 209,
|
|
|
+ 213, 217, 221, 225, 229, 233} },
|
|
|
+
|
|
|
+ {132, 40, BW40_LOW_PRIMARY, BIT(BEHAV_NONE), 5940,
|
|
|
+ {1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49,
|
|
|
+ 53, 57, 61, 65, 69, 73, 77, 81, 85, 89, 93, 97,
|
|
|
+ 101, 105, 109, 113, 117, 121, 125, 129, 133, 137,
|
|
|
+ 141, 145, 149, 153, 157, 161, 165, 169, 173, 177,
|
|
|
+ 181, 185, 189, 193, 197, 201, 205, 209, 213, 217,
|
|
|
+ 221, 225, 229, 233} },
|
|
|
+
|
|
|
+ {133, 80, BW80, BIT(BEHAV_NONE), 5940,
|
|
|
+ {1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49,
|
|
|
+ 53, 57, 61, 65, 69, 73, 77, 81, 85, 89, 93, 97,
|
|
|
+ 101, 105, 109, 113, 117, 121, 125, 129, 133, 137,
|
|
|
+ 141, 145, 149, 153, 157, 161, 165, 169, 173,
|
|
|
+ 177, 181, 185, 189, 193, 197, 201, 205, 209, 213,
|
|
|
+ 217, 221, 225, 229, 233} },
|
|
|
+
|
|
|
+ {134, 160, BW80, BIT(BEHAV_NONE), 5940,
|
|
|
+ {1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45,
|
|
|
+ 49, 53, 57, 61, 65, 69, 73, 77, 81, 85, 89,
|
|
|
+ 93, 97, 101, 105, 109, 113, 117, 121, 125,
|
|
|
+ 129, 133, 137, 141, 145, 149, 153, 157, 161,
|
|
|
+ 165, 169, 173, 177, 181, 185, 189, 193, 197,
|
|
|
+ 201, 205, 209, 213, 217, 221, 225, 229, 233} },
|
|
|
+
|
|
|
+ {135, 80, BW80, BIT(BEHAV_BW80_PLUS), 5940,
|
|
|
+ {1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41,
|
|
|
+ 45, 49, 53, 57, 61, 65, 69, 73, 77, 81,
|
|
|
+ 85, 89, 93, 97, 101, 105, 109, 113, 117,
|
|
|
+ 121, 125, 129, 133, 137, 141, 145, 149,
|
|
|
+ 153, 157, 161, 165, 169, 173, 177, 181,
|
|
|
+ 185, 189, 193, 197, 201, 205, 209, 213,
|
|
|
+ 217, 221, 225, 229, 233} },
|
|
|
+#endif
|
|
|
+ {0, 0, 0, 0, 0, {0} },
|
|
|
};
|
|
|
|
|
|
static const struct reg_dmn_op_class_map_t us_op_class[] = {
|
|
|
- {1, 20, BW20, {36, 40, 44, 48} },
|
|
|
- {2, 20, BW20, {52, 56, 60, 64} },
|
|
|
- {4, 20, BW20, {100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140,
|
|
|
- 144} },
|
|
|
- {5, 20, BW20, {149, 153, 157, 161, 165} },
|
|
|
- {12, 25, BW20, {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11} },
|
|
|
- {22, 40, BW40_LOW_PRIMARY, {36, 44} },
|
|
|
- {23, 40, BW40_LOW_PRIMARY, {52, 60} },
|
|
|
- {24, 40, BW40_LOW_PRIMARY, {100, 108, 116, 124, 132} },
|
|
|
- {26, 40, BW40_LOW_PRIMARY, {149, 157} },
|
|
|
- {27, 40, BW40_HIGH_PRIMARY, {40, 48} },
|
|
|
- {28, 40, BW40_HIGH_PRIMARY, {56, 64} },
|
|
|
- {29, 40, BW40_HIGH_PRIMARY, {104, 112, 120, 128, 136} },
|
|
|
- {30, 40, BW40_HIGH_PRIMARY, {153, 161} },
|
|
|
- {31, 40, BW40_HIGH_PRIMARY, {153, 161} },
|
|
|
- {32, 40, BW40_LOW_PRIMARY, {1, 2, 3, 4, 5, 6, 7} },
|
|
|
- {33, 40, BW40_HIGH_PRIMARY, {5, 6, 7, 8, 9, 10, 11} },
|
|
|
- {128, 80, BW80, {36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108,
|
|
|
- 112, 116, 120, 124, 128, 132, 136, 140, 144,
|
|
|
- 149, 153, 157, 161} },
|
|
|
- {0, 0, 0, {0} },
|
|
|
+ {1, 20, BW20, BIT(BEHAV_NONE), 5000,
|
|
|
+ {36, 40, 44, 48} },
|
|
|
+ {2, 20, BW20, BIT(BEHAV_NONE), 5000,
|
|
|
+ {52, 56, 60, 64} },
|
|
|
+ {4, 20, BW20, BIT(BEHAV_NONE), 5000,
|
|
|
+ {100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144} },
|
|
|
+ {5, 20, BW20, BIT(BEHAV_NONE), 5000,
|
|
|
+ {149, 153, 157, 161, 165} },
|
|
|
+ {12, 25, BW20, BIT(BEHAV_NONE), 2407,
|
|
|
+ {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11} },
|
|
|
+ {22, 40, BW40_LOW_PRIMARY, BIT(BEHAV_BW40_LOW_PRIMARY), 5000,
|
|
|
+ {36, 44} },
|
|
|
+ {23, 40, BW40_LOW_PRIMARY, BIT(BEHAV_BW40_LOW_PRIMARY), 5000,
|
|
|
+ {52, 60} },
|
|
|
+ {24, 40, BW40_LOW_PRIMARY, BIT(BEHAV_BW40_LOW_PRIMARY), 5000,
|
|
|
+ {100, 108, 116, 124, 132} },
|
|
|
+ {26, 40, BW40_LOW_PRIMARY, BIT(BEHAV_BW40_LOW_PRIMARY), 5000,
|
|
|
+ {149, 157} },
|
|
|
+ {27, 40, BW40_HIGH_PRIMARY, BIT(BEHAV_BW40_HIGH_PRIMARY), 5000,
|
|
|
+ {40, 48} },
|
|
|
+ {28, 40, BW40_HIGH_PRIMARY, BIT(BEHAV_BW40_HIGH_PRIMARY), 5000,
|
|
|
+ {56, 64} },
|
|
|
+ {29, 40, BW40_HIGH_PRIMARY, BIT(BEHAV_BW40_HIGH_PRIMARY), 5000,
|
|
|
+ {104, 112, 120, 128, 136} },
|
|
|
+ {30, 40, BW40_HIGH_PRIMARY, BIT(BEHAV_BW40_HIGH_PRIMARY), 5000,
|
|
|
+ {153, 161} },
|
|
|
+ {31, 40, BW40_HIGH_PRIMARY, BIT(BEHAV_BW40_HIGH_PRIMARY), 5000,
|
|
|
+ {153, 161} },
|
|
|
+ {32, 40, BW40_LOW_PRIMARY, BIT(BEHAV_BW40_LOW_PRIMARY), 2407,
|
|
|
+ {1, 2, 3, 4, 5, 6, 7} },
|
|
|
+ {33, 40, BW40_HIGH_PRIMARY, BIT(BEHAV_BW40_HIGH_PRIMARY), 2407,
|
|
|
+ {5, 6, 7, 8, 9, 10, 11} },
|
|
|
+ {128, 80, BW80, BIT(BEHAV_NONE), 5000,
|
|
|
+ {36, 40, 44, 48, 52, 56, 60, 64, 100,
|
|
|
+ 104, 108, 112, 116, 120, 124, 128, 132,
|
|
|
+ 136, 140, 144, 149, 153, 157, 161} },
|
|
|
+ {0, 0, 0, 0, 0, {0} },
|
|
|
};
|
|
|
|
|
|
static const struct reg_dmn_op_class_map_t euro_op_class[] = {
|
|
|
- {1, 20, BW20, {36, 40, 44, 48} },
|
|
|
- {2, 20, BW20, {52, 56, 60, 64} },
|
|
|
- {3, 20, BW20, {100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140} },
|
|
|
- {4, 25, BW20, {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13} },
|
|
|
- {5, 40, BW40_LOW_PRIMARY, {36, 44} },
|
|
|
- {6, 40, BW40_LOW_PRIMARY, {52, 60} },
|
|
|
- {7, 40, BW40_LOW_PRIMARY, {100, 108, 116, 124, 132} },
|
|
|
- {8, 40, BW40_HIGH_PRIMARY, {40, 48} },
|
|
|
- {9, 40, BW40_HIGH_PRIMARY, {56, 64} },
|
|
|
- {10, 40, BW40_HIGH_PRIMARY, {104, 112, 120, 128, 136} },
|
|
|
- {11, 40, BW40_LOW_PRIMARY, {1, 2, 3, 4, 5, 6, 7, 8, 9} },
|
|
|
- {12, 40, BW40_HIGH_PRIMARY, {5, 6, 7, 8, 9, 10, 11, 12, 13} },
|
|
|
- {17, 20, BW20, {149, 153, 157, 161, 165, 169} },
|
|
|
- {128, 80, BW80, {36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112,
|
|
|
- 116, 120, 124, 128} },
|
|
|
- {0, 0, 0, {0} },
|
|
|
+ {1, 20, BW20, BIT(BEHAV_NONE), 5000,
|
|
|
+ {36, 40, 44, 48} },
|
|
|
+ {2, 20, BW20, BIT(BEHAV_NONE), 5000,
|
|
|
+ {52, 56, 60, 64} },
|
|
|
+ {3, 20, BW20, BIT(BEHAV_NONE), 5000,
|
|
|
+ {100, 104, 108, 112, 116, 120,
|
|
|
+ 124, 128, 132, 136, 140} },
|
|
|
+ {4, 25, BW20, BIT(BEHAV_NONE), 2407,
|
|
|
+ {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13} },
|
|
|
+ {5, 40, BW40_LOW_PRIMARY, BIT(BEHAV_BW40_LOW_PRIMARY), 5000,
|
|
|
+ {36, 44} },
|
|
|
+ {6, 40, BW40_LOW_PRIMARY, BIT(BEHAV_BW40_LOW_PRIMARY), 5000,
|
|
|
+ {52, 60} },
|
|
|
+ {7, 40, BW40_LOW_PRIMARY, BIT(BEHAV_BW40_LOW_PRIMARY), 5000,
|
|
|
+ {100, 108, 116, 124, 132} },
|
|
|
+ {8, 40, BW40_HIGH_PRIMARY, BIT(BEHAV_BW40_HIGH_PRIMARY), 5000,
|
|
|
+ {40, 48} },
|
|
|
+ {9, 40, BW40_HIGH_PRIMARY, BIT(BEHAV_BW40_HIGH_PRIMARY), 5000,
|
|
|
+ {56, 64} },
|
|
|
+ {10, 40, BW40_HIGH_PRIMARY, BIT(BEHAV_BW40_HIGH_PRIMARY), 5000,
|
|
|
+ {104, 112, 120, 128, 136} },
|
|
|
+ {11, 40, BW40_LOW_PRIMARY, BIT(BEHAV_BW40_LOW_PRIMARY), 2407,
|
|
|
+ {1, 2, 3, 4, 5, 6, 7, 8, 9} },
|
|
|
+ {12, 40, BW40_HIGH_PRIMARY, BIT(BEHAV_BW40_HIGH_PRIMARY), 2407,
|
|
|
+ {5, 6, 7, 8, 9, 10, 11, 12, 13} },
|
|
|
+ {17, 20, BW20, BIT(BEHAV_NONE), 5000,
|
|
|
+ {149, 153, 157, 161, 165, 169} },
|
|
|
+ {128, 80, BW80, BIT(BEHAV_NONE), 5000,
|
|
|
+ {36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120,
|
|
|
+ 124, 128} },
|
|
|
+ {0, 0, 0, 0, 0, {0} },
|
|
|
};
|
|
|
|
|
|
static const struct reg_dmn_op_class_map_t japan_op_class[] = {
|
|
|
- {1, 20, BW20, {36, 40, 44, 48} },
|
|
|
- {30, 25, BW20, {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13} },
|
|
|
- {31, 25, BW20, {14} },
|
|
|
- {32, 20, BW20, {52, 56, 60, 64} },
|
|
|
- {34, 20, BW20,
|
|
|
- {100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140} },
|
|
|
- {36, 40, BW40_LOW_PRIMARY, {36, 44} },
|
|
|
- {37, 40, BW40_LOW_PRIMARY, {52, 60} },
|
|
|
- {39, 40, BW40_LOW_PRIMARY, {100, 108, 116, 124, 132} },
|
|
|
- {41, 40, BW40_HIGH_PRIMARY, {40, 48} },
|
|
|
- {42, 40, BW40_HIGH_PRIMARY, {56, 64} },
|
|
|
- {44, 40, BW40_HIGH_PRIMARY, {104, 112, 120, 128, 136} },
|
|
|
- {128, 80, BW80, {36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112,
|
|
|
- 116, 120, 124, 128} },
|
|
|
- {0, 0, 0, {0} },
|
|
|
+ {1, 20, BW20, BIT(BEHAV_NONE), 5000,
|
|
|
+ {36, 40, 44, 48} },
|
|
|
+ {30, 25, BW20, BIT(BEHAV_NONE), 2407,
|
|
|
+ {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13} },
|
|
|
+ {31, 25, BW20, BIT(BEHAV_NONE), 2407,
|
|
|
+ {14} },
|
|
|
+ {32, 20, BW20, BIT(BEHAV_NONE), 5000,
|
|
|
+ {52, 56, 60, 64} },
|
|
|
+ {34, 20, BW20, BIT(BEHAV_NONE), 5000,
|
|
|
+ {100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140} },
|
|
|
+ {36, 40, BW40_LOW_PRIMARY, BIT(BEHAV_BW40_LOW_PRIMARY), 5000,
|
|
|
+ {36, 44} },
|
|
|
+ {37, 40, BW40_LOW_PRIMARY, BIT(BEHAV_BW40_LOW_PRIMARY), 5000,
|
|
|
+ {52, 60} },
|
|
|
+ {39, 40, BW40_LOW_PRIMARY, BIT(BEHAV_BW40_LOW_PRIMARY), 5000,
|
|
|
+ {100, 108, 116, 124, 132} },
|
|
|
+ {41, 40, BW40_HIGH_PRIMARY, BIT(BEHAV_BW40_HIGH_PRIMARY), 5000,
|
|
|
+ {40, 48} },
|
|
|
+ {42, 40, BW40_HIGH_PRIMARY, BIT(BEHAV_BW40_HIGH_PRIMARY), 5000,
|
|
|
+ {56, 64} },
|
|
|
+ {44, 40, BW40_HIGH_PRIMARY, BIT(BEHAV_BW40_HIGH_PRIMARY), 5000,
|
|
|
+ {104, 112, 120, 128, 136} },
|
|
|
+ {128, 80, BW80, BIT(BEHAV_NONE), 5000,
|
|
|
+ {36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120,
|
|
|
+ 124, 128} },
|
|
|
+ {0, 0, 0, 0, 0, {0} },
|
|
|
};
|
|
|
|
|
|
#ifdef HOST_OPCLASS
|
|
@@ -130,9 +235,8 @@ static const struct reg_dmn_op_class_map_t japan_op_class[] = {
|
|
|
*
|
|
|
* Return: class.
|
|
|
*/
|
|
|
-static
|
|
|
-const struct reg_dmn_op_class_map_t *reg_get_class_from_country(uint8_t
|
|
|
- *country)
|
|
|
+static const
|
|
|
+struct reg_dmn_op_class_map_t *reg_get_class_from_country(uint8_t *country)
|
|
|
{
|
|
|
const struct reg_dmn_op_class_map_t *class = NULL;
|
|
|
|
|
@@ -182,7 +286,7 @@ uint16_t reg_dmn_get_chanwidth_from_opclass(uint8_t *country, uint8_t channel,
|
|
|
for (i = 0; (i < REG_MAX_CHANNELS_PER_OPERATING_CLASS &&
|
|
|
class->channels[i]); i++) {
|
|
|
if (channel == class->channels[i])
|
|
|
- return class->ch_spacing;
|
|
|
+ return class->chan_spacing;
|
|
|
}
|
|
|
}
|
|
|
class++;
|
|
@@ -274,4 +378,130 @@ uint16_t reg_dmn_get_curr_opclasses(uint8_t *num_classes, uint8_t *class)
|
|
|
|
|
|
return 0;
|
|
|
}
|
|
|
+
|
|
|
+#ifdef CONFIG_CHAN_FREQ_API
|
|
|
+void reg_freq_width_to_chan_op_class(struct wlan_objmgr_pdev *pdev,
|
|
|
+ uint16_t freq,
|
|
|
+ uint16_t chan_width,
|
|
|
+ bool global_tbl_lookup,
|
|
|
+ uint16_t behav_limit,
|
|
|
+ uint8_t *op_class,
|
|
|
+ uint8_t *chan_num)
|
|
|
+{
|
|
|
+ const struct reg_dmn_op_class_map_t *op_class_tbl;
|
|
|
+ enum channel_enum chan_enum;
|
|
|
+ uint16_t i;
|
|
|
+
|
|
|
+ chan_enum = reg_get_chan_enum_for_freq(freq);
|
|
|
+
|
|
|
+ if (chan_enum == INVALID_CHANNEL) {
|
|
|
+ reg_err(" channel enumeration is invalid %d", chan_enum);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (global_tbl_lookup) {
|
|
|
+ op_class_tbl = global_op_class;
|
|
|
+ } else {
|
|
|
+ if (channel_map == channel_map_us)
|
|
|
+ op_class_tbl = us_op_class;
|
|
|
+ else if (channel_map == channel_map_eu)
|
|
|
+ op_class_tbl = euro_op_class;
|
|
|
+ else if (channel_map == channel_map_china)
|
|
|
+ op_class_tbl = us_op_class;
|
|
|
+ else if (channel_map == channel_map_jp)
|
|
|
+ op_class_tbl = japan_op_class;
|
|
|
+ else
|
|
|
+ op_class_tbl = global_op_class;
|
|
|
+ }
|
|
|
+
|
|
|
+ while (op_class_tbl->op_class) {
|
|
|
+ if (op_class_tbl->chan_spacing >= chan_width) {
|
|
|
+ for (i = 0; (i < REG_MAX_CHANNELS_PER_OPERATING_CLASS &&
|
|
|
+ op_class_tbl->channels[i]); i++) {
|
|
|
+ if ((op_class_tbl->start_freq +
|
|
|
+ FREQ_TO_CHAN_SCALE *
|
|
|
+ op_class_tbl->channels[i] == freq) &&
|
|
|
+ (behav_limit & op_class_tbl->behav_limit ||
|
|
|
+ behav_limit == BIT(BEHAV_NONE))) {
|
|
|
+ *chan_num = op_class_tbl->channels[i];
|
|
|
+ *op_class = op_class_tbl->op_class;
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ op_class_tbl++;
|
|
|
+ }
|
|
|
+
|
|
|
+ reg_err_rl("invalid frequency %d", freq);
|
|
|
+}
|
|
|
+
|
|
|
+void reg_freq_to_chan_op_class(struct wlan_objmgr_pdev *pdev,
|
|
|
+ uint16_t freq,
|
|
|
+ bool global_tbl_lookup,
|
|
|
+ uint16_t behav_limit,
|
|
|
+ uint8_t *op_class,
|
|
|
+ uint8_t *chan_num)
|
|
|
+{
|
|
|
+ enum channel_enum chan_enum;
|
|
|
+ uint16_t chan_width;
|
|
|
+ struct regulatory_channel *cur_chan_list;
|
|
|
+ struct wlan_regulatory_pdev_priv_obj *pdev_priv_obj;
|
|
|
+
|
|
|
+ pdev_priv_obj = reg_get_pdev_obj(pdev);
|
|
|
+
|
|
|
+ if (!IS_VALID_PDEV_REG_OBJ(pdev_priv_obj)) {
|
|
|
+ reg_err("pdev reg obj is NULL");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ cur_chan_list = pdev_priv_obj->cur_chan_list;
|
|
|
+
|
|
|
+ chan_enum = reg_get_chan_enum_for_freq(freq);
|
|
|
+
|
|
|
+ if (chan_enum == INVALID_CHANNEL) {
|
|
|
+ reg_err(" channel enumeration is invalid %d", chan_enum);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ chan_width = cur_chan_list[chan_enum].max_bw;
|
|
|
+
|
|
|
+ reg_freq_width_to_chan_op_class(pdev, freq,
|
|
|
+ chan_width,
|
|
|
+ global_tbl_lookup,
|
|
|
+ behav_limit,
|
|
|
+ op_class,
|
|
|
+ chan_num);
|
|
|
+}
|
|
|
+#endif
|
|
|
+
|
|
|
+uint16_t reg_get_op_class_width(struct wlan_objmgr_pdev *pdev,
|
|
|
+ uint8_t op_class,
|
|
|
+ bool global_tbl_lookup)
|
|
|
+{
|
|
|
+ const struct reg_dmn_op_class_map_t *op_class_tbl;
|
|
|
+
|
|
|
+ if (global_tbl_lookup) {
|
|
|
+ op_class_tbl = global_op_class;
|
|
|
+ } else {
|
|
|
+ if (channel_map == channel_map_us)
|
|
|
+ op_class_tbl = us_op_class;
|
|
|
+ else if (channel_map == channel_map_eu)
|
|
|
+ op_class_tbl = euro_op_class;
|
|
|
+ else if (channel_map == channel_map_china)
|
|
|
+ op_class_tbl = us_op_class;
|
|
|
+ else if (channel_map == channel_map_jp)
|
|
|
+ op_class_tbl = japan_op_class;
|
|
|
+ else
|
|
|
+ op_class_tbl = global_op_class;
|
|
|
+ }
|
|
|
+
|
|
|
+ while (op_class_tbl->op_class) {
|
|
|
+ if (op_class_tbl->op_class == op_class)
|
|
|
+ return op_class_tbl->chan_spacing;
|
|
|
+ op_class_tbl++;
|
|
|
+ }
|
|
|
+
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
#endif
|