1 /* 2 * Copyright (c) 2017-2019 The Linux Foundation. All rights reserved. 3 * 4 * 5 * Permission to use, copy, modify, and/or distribute this software for 6 * any purpose with or without fee is hereby granted, provided that the 7 * above copyright notice and this permission notice appear in all 8 * copies. 9 * 10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL 11 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED 12 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE 13 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL 14 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR 15 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER 16 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 17 * PERFORMANCE OF THIS SOFTWARE. 18 */ 19 20 /** 21 * DOC: reg_db.h 22 * This file contains regulatory data base parser function declarations 23 */ 24 25 #ifndef __REG_DB_PARSER_H 26 #define __REG_DB_PARSER_H 27 28 extern const struct country_code_to_reg_domain g_all_countries[]; 29 extern const struct reg_domain_pair g_reg_dmn_pairs[]; 30 extern const struct regulatory_rule reg_rules_2g[]; 31 extern const struct regdomain regdomains_2g[]; 32 extern const struct regulatory_rule reg_rules_5g[]; 33 extern const struct regdomain regdomains_5g[]; 34 35 /** 36 * reg_is_country_code_valid() - Check if the given country code is valid 37 * @alpha2: Country string 38 * 39 * Return: QDF_STATUS 40 */ 41 QDF_STATUS reg_is_country_code_valid(uint8_t *alpha2); 42 43 /** 44 * reg_regrules_assign() - Get 2GHz and 5GHz regulatory rules from regdomain 45 * structure. 46 * @dmn_id_2g: 2GHz regdomain ID 47 * @dmn_id_5g: 5GHz regdomain ID 48 * @ant_gain_2g: 2GHz antenna gain 49 * @ant_gain_5g: 5GHz antenna gain 50 * @reg_info: Pointer to current regulatory info structure 51 * 52 * Return: QDF_STATUS 53 */ 54 QDF_STATUS reg_regrules_assign(uint8_t dmn_id_2g, uint8_t dmn_id_5g, 55 uint8_t ant_gain_2g, uint8_t ant_gain_5g, 56 struct cur_regulatory_info *reg_info); 57 58 /** 59 * reg_get_cur_reginfo() - Get current regulatory info for a given country code 60 * @reg_info: Pointer to current regulatory info structure 61 * @country_index: Country code index in the country code table 62 * @regdmn_pair: Regdomain pair ID 63 * 64 * Return: QDF_STATUS 65 */ 66 QDF_STATUS reg_get_cur_reginfo(struct cur_regulatory_info *reg_info, 67 uint16_t country_index, uint16_t regdmn_pair); 68 69 /** 70 * reg_get_rdpair_from_country_iso() - Get regdomain pair ID from country string 71 * @alpha: Pointer to country code string 72 * @country_index: Pointer to save country code index 73 * @regdmn_pair: Pointer to save regdomain pair ID index 74 * 75 * Return: QDF_STATUS 76 */ 77 QDF_STATUS reg_get_rdpair_from_country_iso(uint8_t *alpha, 78 uint16_t *country_index, 79 uint16_t *regdmn_pair); 80 81 /** 82 * reg_get_rdpair_from_country_code() - Get regdomain pair ID from country code 83 * @cc: Country code 84 * @country_index: Pointer to save country code index 85 * @regdmn_pair: Pointer to save regdomain pair ID index 86 * 87 * Return: QDF_STATUS 88 */ 89 QDF_STATUS reg_get_rdpair_from_country_code(uint16_t cc, 90 uint16_t *country_index, 91 uint16_t *regdmn_pair); 92 93 /** 94 * reg_get_rdpair_from_regdmn_id() - Get regdomain pair ID from regdomain ID 95 * @regdmn_id: Regdomain ID 96 * @regdmn_pair: Pointer to save regdomain pair ID index 97 * 98 * Return: QDF_STATUS 99 */ 100 QDF_STATUS reg_get_rdpair_from_regdmn_id(uint16_t regdmn_id, 101 uint16_t *regdmn_pair); 102 #endif 103