qcacmn: Get opclass from freq and width given a country code

Add the API wlan_reg_get_opclass_from_freq_width, to give country_iso,
channel frequency, channel width and behaviour limit as input, and get
the operating class as output.

Change-Id: I96c39119ab855d10965b2603e8b15c21699daa68
CRs-Fixed: 2583789
Esse commit está contido em:
Hariharan Basuthkar
2019-12-23 17:35:55 +05:30
commit de nshrivas
commit f8f30ced97
4 arquivos alterados com 76 adições e 0 exclusões

Ver arquivo

@@ -342,6 +342,34 @@ uint16_t reg_dmn_get_opclass_from_channel(uint8_t *country, uint8_t channel,
return 0;
}
uint8_t reg_dmn_get_opclass_from_freq_width(uint8_t *country,
qdf_freq_t freq,
uint8_t ch_width,
uint16_t behav_limit)
{
const struct reg_dmn_op_class_map_t *op_class_tbl = NULL;
uint16_t i = 0;
op_class_tbl = reg_get_class_from_country(country);
while (op_class_tbl && op_class_tbl->op_class) {
if (op_class_tbl->chan_spacing == ch_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)) {
return op_class_tbl->op_class;
}
}
}
op_class_tbl++;
}
return 0;
}
void reg_dmn_print_channels_in_opclass(uint8_t *country, uint8_t op_class)
{
const struct reg_dmn_op_class_map_t *class = NULL;

Ver arquivo

@@ -47,6 +47,21 @@ uint16_t reg_dmn_get_chanwidth_from_opclass(uint8_t *country, uint8_t channel,
*/
uint16_t reg_dmn_get_opclass_from_channel(uint8_t *country, uint8_t channel,
uint8_t offset);
/**
* reg_dmn_get_opclass_from_freq_width() - Get operating class from frequency
* @country: Country code.
* @freq: Channel center frequency.
* @ch_width: Channel width.
* @behav_limit: Behaviour limit.
*
* Return: Error code.
*/
uint8_t reg_dmn_get_opclass_from_freq_width(uint8_t *country,
qdf_freq_t freq,
uint8_t ch_width,
uint16_t behav_limit);
/**
* reg_dmn_get_opclass_from_channe() - Print channels in op class.
* @country: Country code.
@@ -166,6 +181,15 @@ static inline uint16_t reg_dmn_get_opclass_from_channel(
return 0;
}
static inline
uint8_t reg_dmn_get_opclass_from_freq_width(uint8_t *country,
qdf_freq_t freq,
uint8_t ch_width,
uint16_t behav_limit)
{
return 0;
}
static inline void reg_dmn_print_channels_in_opclass(uint8_t *country,
uint8_t op_class)
{

Ver arquivo

@@ -546,6 +546,21 @@ QDF_STATUS wlan_reg_get_domain_from_country_code(v_REGDOMAIN_t *reg_domain_ptr,
uint16_t wlan_reg_dmn_get_opclass_from_channel(uint8_t *country,
uint8_t channel,
uint8_t offset);
/**
* wlan_reg_get_opclass_from_freq_width() - Get operating class from frequency
* @country: Country code.
* @freq: Channel center frequency.
* @ch_width: Channel width.
* @behav_limit: Behaviour limit.
*
* Return: Error code.
*/
uint8_t wlan_reg_get_opclass_from_freq_width(uint8_t *country,
qdf_freq_t freq,
uint8_t ch_width,
uint16_t behav_limit);
/**
* wlan_reg_dmn_print_channels_in_opclass() - Print channels in op-class
* @country: country alpha2

Ver arquivo

@@ -267,6 +267,15 @@ uint16_t wlan_reg_dmn_get_opclass_from_channel(uint8_t *country,
offset);
}
uint8_t wlan_reg_get_opclass_from_freq_width(uint8_t *country,
qdf_freq_t freq,
uint8_t ch_width,
uint16_t behav_limit)
{
return reg_dmn_get_opclass_from_freq_width(country, freq, ch_width,
behav_limit);
}
void wlan_reg_dmn_print_channels_in_opclass(uint8_t *country,
uint8_t opclass)
{