blob: 5fc13220669936eede8a40ed2398dbfeb5177bbb [file] [log] [blame]
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001/*
2 * Copyright (c) 2013-2014 The Linux Foundation. All rights reserved.
3 *
4 * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
5 *
6 *
7 * Permission to use, copy, modify, and/or distribute this software for
8 * any purpose with or without fee is hereby granted, provided that the
9 * above copyright notice and this permission notice appear in all
10 * copies.
11 *
12 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
13 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
14 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
15 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
16 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
17 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
18 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
19 * PERFORMANCE OF THIS SOFTWARE.
20 */
21
22/*
23 * This file was originally distributed by Qualcomm Atheros, Inc.
24 * under proprietary terms before Copyright ownership was assigned
25 * to the Linux Foundation.
26 */
27
28/*
29 * This file contains the API definitions for the Unified Wireless Module Interface (WMI).
30 */
31
32#ifndef _WMI_UNIFIED_API_H_
33#define _WMI_UNIFIED_API_H_
34
35#include <osdep.h>
36#include "a_types.h"
37#include "ol_defines.h"
38#include "wmi.h"
39#include "htc_api.h"
40
41typedef cdf_nbuf_t wmi_buf_t;
42#define wmi_buf_data(_buf) cdf_nbuf_data(_buf)
43
44/**
45 * attach for unified WMI
46 *
47 * @param scn_handle : handle to SCN.
48 * @return opaque handle.
49 */
50void *wmi_unified_attach(void *scn_handle,
51 int (*func)(struct wmi_unified *, wmi_buf_t));
52/**
53 * detach for unified WMI
54 *
55 * @param wmi_handle : handle to WMI.
56 * @return void.
57 */
58void wmi_unified_detach(struct wmi_unified *wmi_handle);
59
60/**
61 * generic function to allocate WMI buffer
62 *
63 * @param wmi_handle : handle to WMI.
64 * @param len : length of the buffer
65 * @return wmi_buf_t.
66 */
67#ifdef MEMORY_DEBUG
68#define wmi_buf_alloc(h, l) wmi_buf_alloc_debug(h, l, __FILE__, __LINE__)
69wmi_buf_t
70wmi_buf_alloc_debug(wmi_unified_t wmi_handle, uint16_t len,
71 uint8_t *file_name, uint32_t line_num);
72#else
73wmi_buf_t wmi_buf_alloc(wmi_unified_t wmi_handle, uint16_t len);
74#endif
75
76/**
77 * generic function frees WMI net buffer
78 *
79 * @param net_buf : Pointer ot net_buf to be freed
80 */
81void wmi_buf_free(wmi_buf_t net_buf);
82
83/**
84 * generic function to send unified WMI command
85 *
86 * @param wmi_handle : handle to WMI.
87 * @param buf : wmi command buffer
88 * @param buflen : wmi command buffer length
89 * @return 0 on success and -ve on failure.
90 */
91int
92wmi_unified_cmd_send(wmi_unified_t wmi_handle, wmi_buf_t buf, int buflen,
93 WMI_CMD_ID cmd_id);
94
95/**
96 * WMI event handler register function
97 *
98 * @param wmi_handle : handle to WMI.
99 * @param event_id : WMI event ID
100 * @param handler_func : Event handler call back function
101 * @return 0 on success and -ve on failure.
102 */
103int
104wmi_unified_register_event_handler(wmi_unified_t wmi_handle,
105 WMI_EVT_ID event_id,
106 wmi_unified_event_handler handler_func);
107
108/**
109 * WMI event handler unregister function
110 *
111 * @param wmi_handle : handle to WMI.
112 * @param event_id : WMI event ID
113 * @return 0 on success and -ve on failure.
114 */
115int
116wmi_unified_unregister_event_handler(wmi_unified_t wmi_handle,
117 WMI_EVT_ID event_id);
118
119/**
120 * request wmi to connet its htc service.
121 * @param wmi_handle : handle to WMI.
122 * @return void
123 */
124int
125wmi_unified_connect_htc_service(struct wmi_unified *wmi_handle,
126 void *htc_handle);
127
128/*
129 * WMI API to verify the host has enough credits to suspend
130 */
131
132int wmi_is_suspend_ready(wmi_unified_t wmi_handle);
133
134/**
135 WMI API to get updated host_credits
136 */
137
138int wmi_get_host_credits(wmi_unified_t wmi_handle);
139
140/**
141 WMI API to get WMI Pending Commands in the HTC queue
142 */
143
144int wmi_get_pending_cmds(wmi_unified_t wmi_handle);
145
146/**
147 WMI API to set target suspend state
148 */
149
150void wmi_set_target_suspend(wmi_unified_t wmi_handle, A_BOOL val);
151
152/**
153 * WMA Callback to process fw event.
154 */
155typedef int (*wma_process_fw_event_handler_cbk)(struct wmi_unified *wmi_handle,
156 wmi_buf_t evt_buf);
157
158void wmi_process_fw_event(struct wmi_unified *wmi_handle, wmi_buf_t evt_buf);
159uint16_t wmi_get_max_msg_len(wmi_unified_t wmi_handle);
160#endif /* _WMI_UNIFIED_API_H_ */