1 /* 2 * Copyright (c) 2017 The Linux Foundation. All rights reserved. 3 * 4 * Permission to use, copy, modify, and/or distribute this software for 5 * any purpose with or without fee is hereby granted, provided that the 6 * above copyright notice and this permission notice appear in all 7 * copies. 8 * 9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL 10 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED 11 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE 12 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL 13 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR 14 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER 15 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 16 * PERFORMANCE OF THIS SOFTWARE. 17 */ 18 19 /** 20 * DOC: Contains mandatory API from legacy 21 */ 22 23 #ifndef _WLAN_UTILITY_H_ 24 #define _WLAN_UTILITY_H_ 25 26 #include <qdf_types.h> 27 #include <wlan_objmgr_psoc_obj.h> 28 #include <wlan_objmgr_pdev_obj.h> 29 #include <wlan_objmgr_vdev_obj.h> 30 31 /** 32 * struct wlan_find_vdev_filter - find vdev filter object. this can be extended 33 * @ifname: interface name of vdev 34 * @found_vdev: found vdev object matching one or more of above params 35 */ 36 struct wlan_find_vdev_filter { 37 char *ifname; 38 struct wlan_objmgr_vdev *found_vdev; 39 }; 40 41 /** 42 * wlan_chan_to_freq() - converts channel to frequency 43 * @chan: channel number 44 * 45 * @return frequency of the channel 46 */ 47 uint32_t wlan_chan_to_freq(uint8_t chan); 48 49 /* 50 * wlan_is_dsrc_channel() - is the channel DSRC 51 * @center_freq: center freq of the channel 52 * 53 * Return: true if DSRC channel or false otherwise 54 */ 55 bool wlan_is_dsrc_channel(uint16_t center_freq); 56 57 /** 58 * wlan_freq_to_chan() - converts frequency to channel 59 * @freq: frequency 60 * 61 * Return: channel of frequency 62 */ 63 uint8_t wlan_freq_to_chan(uint32_t freq); 64 65 /** 66 * wlan_get_vendor_ie_ptr_from_oui() - Find out vendor ie 67 * @oui: oui buffer 68 * @oui_size: oui size 69 * @ie: source ie address 70 * @ie_len: source ie length 71 * 72 * This function find out vendor ie by pass source ie and vendor oui. 73 * 74 * Return: vendor ie address - success 75 * NULL - failure 76 */ 77 uint8_t *wlan_get_vendor_ie_ptr_from_oui(uint8_t *oui, 78 uint8_t oui_size, uint8_t *ie, uint16_t ie_len); 79 80 /** 81 * wlan_is_emulation_platform() - check if platform is emulation based 82 * @phy_version - psoc nif phy_version 83 * 84 * Return: boolean value based on platform type 85 */ 86 bool wlan_is_emulation_platform(uint32_t phy_version); 87 88 /** 89 * wlan_get_pdev_id_from_vdev_id() - Helper func to derive pdev id from vdev_id 90 * @psoc : psoc object 91 * @vdev_id : vdev identifier 92 * @dbg_id : object manager debug id 93 * 94 * This function is used to derive the pdev id from vdev id for a psoc 95 * 96 * Return : pdev_id - +ve integer for success and WLAN_INVALID_PDEV_ID 97 * for failure 98 */ 99 uint32_t wlan_get_pdev_id_from_vdev_id(struct wlan_objmgr_psoc *psoc, 100 uint8_t vdev_id, 101 wlan_objmgr_ref_dbgid dbg_id); 102 103 /** 104 * wlan_util_get_vdev_by_ifname() - function to return vdev object from psoc 105 * matching given interface name 106 * @psoc : psoc object 107 * @ifname : interface name 108 * @ref_id : object manager ref id 109 * 110 * This function returns vdev object from psoc by interface name. If found this 111 * will also take reference with given ref_id 112 * 113 * Return : vdev object if found, NULL otherwise 114 */ 115 struct wlan_objmgr_vdev *wlan_util_get_vdev_by_ifname( 116 struct wlan_objmgr_psoc *psoc, char *ifname, 117 wlan_objmgr_ref_dbgid ref_id); 118 119 #endif /* _WLAN_UTILITY_H_ */ 120