xref: /wlan-dirver/qca-wifi-host-cmn/umac/regulatory/core/src/reg_opclass.h (revision dd4dc88b837a295134aa9869114a2efee0f4894b)
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_opclass.h
22  * This file provides prototypes of the regulatory opclass functions
23  */
24 
25 #ifndef __REG_OPCLASS_H__
26 #define __REG_OPCLASS_H__
27 
28 #ifdef HOST_OPCLASS
29 /**
30  * reg_dmn_get_chanwidth_from_opclass() - Get channel width from opclass.
31  * @country: Country code
32  * @channel: Channel number
33  * @opclass: Operating class
34  *
35  * Return: Channel width
36  */
37 uint16_t reg_dmn_get_chanwidth_from_opclass(uint8_t *country, uint8_t channel,
38 					    uint8_t opclass);
39 
40 /**
41  * reg_dmn_get_opclass_from_channel() - Get operating class from channel.
42  * @country: Country code.
43  * @channel: Channel number.
44  * @offset: Operating class offset.
45  *
46  * Return: Error code.
47  */
48 uint16_t reg_dmn_get_opclass_from_channel(uint8_t *country, uint8_t channel,
49 					  uint8_t offset);
50 /**
51  * reg_dmn_get_opclass_from_channe() - Print channels in op class.
52  * @country: Country code.
53  * @opclass: opclass.
54  *
55  * Return: Void.
56  */
57 void reg_dmn_print_channels_in_opclass(uint8_t *country, uint8_t op_class);
58 
59 /**
60  * reg_dmn_set_curr_opclasses() - Set current operating class
61  * @num_classes: Number of classes
62  * @class: Pointer to operating class.
63  *
64  * Return: Error code.
65  */
66 uint16_t reg_dmn_set_curr_opclasses(uint8_t num_classes, uint8_t *class);
67 
68 /**
69  * reg_dmn_get_curr_opclasses() - Get current supported operating classes.
70  * @num_classes: Number of classes.
71  * @class: Pointer to operating class.
72  *
73  * Return: Error code.
74  */
75 uint16_t reg_dmn_get_curr_opclasses(uint8_t *num_classes, uint8_t *class);
76 
77 #else
78 
79 static inline uint16_t reg_dmn_get_chanwidth_from_opclass(
80 		uint8_t *country, uint8_t channel, uint8_t opclass)
81 {
82 	return 0;
83 }
84 
85 static inline uint16_t reg_dmn_set_curr_opclasses(
86 		uint8_t num_classes, uint8_t *class)
87 {
88 	return 0;
89 }
90 
91 static inline uint16_t reg_dmn_get_curr_opclasses(
92 		uint8_t *num_classes, uint8_t *class)
93 {
94 	return 0;
95 }
96 
97 static inline uint16_t reg_dmn_get_opclass_from_channel(
98 		uint8_t *country, uint8_t channel, uint8_t offset)
99 {
100 	return 0;
101 }
102 
103 static inline void reg_dmn_print_channels_in_opclass(uint8_t *country,
104 						     uint8_t op_class)
105 {
106 }
107 
108 #endif
109 #endif
110