1 /* 2 * Copyright (c) 2011-2020 The Linux Foundation. All rights reserved. 3 * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved. 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 * 22 * mac_init_api.c - Header file for mac level init functions 23 * Author: Dinesh Upadhyay 24 * Date: 04/23/2007 25 * History:- 26 * Date Modified by Modification Information 27 * -------------------------------------------------------------------------- 28 * 29 */ 30 #ifndef __MAC_INIT_API_H 31 #define __MAC_INIT_API_H 32 33 #include "ani_global.h" 34 #include "sir_types.h" 35 36 /** 37 * struct mac_start_params - parameters needed when starting the MAC 38 * @driver_type: Operating mode of the driver 39 */ 40 struct mac_start_params { 41 enum qdf_driver_type driver_type; 42 }; 43 44 /** 45 * mac_start() - Start all MAC modules 46 * @mac_handle: Opaque handle to the MAC context 47 * @params: Parameters needed to start the MAC 48 * 49 * This function is called to start MAC. This function will start all 50 * the mac modules. 51 * 52 * Return: QDF_STATUS_SUCCESS if the MAC was successfully started. Any 53 * other value means that there was an issue with starting the 54 * MAC and the MAC should not be considered operational. 55 */ 56 QDF_STATUS mac_start(mac_handle_t mac_handle, 57 struct mac_start_params *params); 58 59 /** 60 * mac_stop() - Stop all MAC modules 61 * @mac_handle: Opaque handle to the MAC context 62 * 63 * This function is called to stop MAC. This function will stop all 64 * the mac modules. 65 * 66 * Return: QDF_STATUS_SUCCESS if the MAC was successfully stopped. Any 67 * other value means that there was an issue with stopping the 68 * MAC, but the caller should still consider the MAC to be 69 * stopped. 70 */ 71 QDF_STATUS mac_stop(mac_handle_t mac_handle); 72 73 /** 74 * mac_open() - Open the MAC 75 * @psoc: SOC global object 76 * @mac_handle: Pointer to where the MAC handle is to be stored 77 * @hdd_handle: Opaque handle to the HDD context 78 * @cds_cfg: Initial configuration 79 * 80 * This function will be called during init. This function is suppose 81 * to allocate all the memory with the global context will be 82 * allocated here. 83 * 84 * Return: QDF_STATUS_SUCCESS if the MAC was successfully opened and a 85 * MAC handle was returned to the caller. Any other value 86 * means the MAC was not opened. 87 */ 88 QDF_STATUS mac_open(struct wlan_objmgr_psoc *psoc, mac_handle_t *mac_handle, 89 hdd_handle_t hdd_handle, struct cds_config_info *cds_cfg); 90 91 /** 92 * mac_close() - close the MAC 93 * @mac_handle: Opaque handle to the MAC context returned by mac_open() 94 * 95 * This function will be called in shutdown sequence from HDD. All the 96 * allocated memory with global context will be freed here. 97 * 98 * Return: QDF_STATUS_SUCCESS if the MAC was successfully closed. Any 99 * other value means that there was an issue with closing the 100 * MAC, but the caller should still consider the MAC to be 101 * closed. 102 */ 103 QDF_STATUS mac_close(mac_handle_t mac_handle); 104 105 /** 106 * mac_register_session_open_close_cb() - register open/close session cb 107 * @mac_handle: Opaque handle to the MAC context 108 * @close_session: callback to be registered with SME for closing the session 109 * @callback: Common callback to hdd for all modes 110 */ 111 void mac_register_session_open_close_cb(mac_handle_t mac_handle, 112 csr_session_close_cb close_session, 113 csr_roam_complete_cb callback); 114 115 #ifdef WLAN_BCN_RECV_FEATURE 116 /** 117 * mac_register_bcn_report_send_cb() - Register bcn receive start 118 * indication handler callback 119 * @mac: Pointer to Global MAC structure 120 * @cb: A pointer to store the callback 121 * 122 * Once driver gets QCA_NL80211_VENDOR_SUBCMD_BEACON_REPORTING vendor 123 * command with attribute for start only. MAC layer register a sme 124 * callback through this function. 125 * 126 * Return: None. 127 */ 128 void mac_register_bcn_report_send_cb(struct mac_context *mac, 129 beacon_report_cb cb); 130 #endif /* WLAN_BCN_RECV_FEATURE */ 131 #endif /* __MAC_INIT_API_H */ 132