xref: /wlan-driver/qcacld-3.0/core/dp/txrx/wdi_event_api.h (revision 5113495b16420b49004c444715d2daae2066e7dc)
1*5113495bSYour Name /*
2*5113495bSYour Name  * Copyright (c) 2012-2014, 2017-2020 The Linux Foundation. All rights reserved.
3*5113495bSYour Name  *
4*5113495bSYour Name  * Permission to use, copy, modify, and/or distribute this software for
5*5113495bSYour Name  * any purpose with or without fee is hereby granted, provided that the
6*5113495bSYour Name  * above copyright notice and this permission notice appear in all
7*5113495bSYour Name  * copies.
8*5113495bSYour Name  *
9*5113495bSYour Name  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
10*5113495bSYour Name  * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
11*5113495bSYour Name  * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
12*5113495bSYour Name  * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
13*5113495bSYour Name  * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
14*5113495bSYour Name  * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
15*5113495bSYour Name  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
16*5113495bSYour Name  * PERFORMANCE OF THIS SOFTWARE.
17*5113495bSYour Name  */
18*5113495bSYour Name 
19*5113495bSYour Name #ifndef _WDI_EVENT_API_H_
20*5113495bSYour Name #define _WDI_EVENT_API_H_
21*5113495bSYour Name 
22*5113495bSYour Name #include "wdi_event.h"
23*5113495bSYour Name #include <cdp_txrx_handle.h>
24*5113495bSYour Name #include <cdp_txrx_cmn_struct.h>
25*5113495bSYour Name struct ol_txrx_pdev_t;
26*5113495bSYour Name 
27*5113495bSYour Name #ifdef WDI_EVENT_ENABLE
28*5113495bSYour Name /**
29*5113495bSYour Name  * @brief Subscribe to a specified WDI event.
30*5113495bSYour Name  * @details
31*5113495bSYour Name  *  This function adds the provided wdi_event_subscribe object to a list of
32*5113495bSYour Name  *  subscribers for the specified WDI event.
33*5113495bSYour Name  *  When the event in question happens, each subscriber for the event will
34*5113495bSYour Name  *  have their callback function invoked.
35*5113495bSYour Name  *  The order in which callback functions from multiple subscribers are
36*5113495bSYour Name  *  invoked is unspecified.
37*5113495bSYour Name  *
38*5113495bSYour Name  * @param soc_hdl - datapath soc handle
39*5113495bSYour Name  * @param pdev_id - physical device instance id
40*5113495bSYour Name  * @param event_cb_sub - the callback and context for the event subscriber
41*5113495bSYour Name  * @param event - which event's notifications are being subscribed to
42*5113495bSYour Name  * @return error code, or 0 for success
43*5113495bSYour Name  */
44*5113495bSYour Name int wdi_event_sub(struct cdp_soc_t *soc, uint8_t pdev_id,
45*5113495bSYour Name 		  wdi_event_subscribe *event_cb_sub, uint32_t event);
46*5113495bSYour Name 
47*5113495bSYour Name /**
48*5113495bSYour Name  * @brief Unsubscribe from a specified WDI event.
49*5113495bSYour Name  * @details
50*5113495bSYour Name  *  This function removes the provided event subscription object from the
51*5113495bSYour Name  *  list of subscribers for its event.
52*5113495bSYour Name  *  This function shall only be called if there was a successful prior call
53*5113495bSYour Name  *  to event_sub() on the same wdi_event_subscribe object.
54*5113495bSYour Name  *
55*5113495bSYour Name  * @param soc_hdl - datapath soc handle
56*5113495bSYour Name  * @param pdev_id - physical device instance id
57*5113495bSYour Name  * @param event_cb_sub - the event subscription object
58*5113495bSYour Name  * @param event - which event is being unsubscribed
59*5113495bSYour Name  * @return error code, or 0 for success
60*5113495bSYour Name  */
61*5113495bSYour Name int wdi_event_unsub(struct cdp_soc_t *soc, uint8_t pdev_id,
62*5113495bSYour Name 		    wdi_event_subscribe *event_cb_sub, uint32_t event);
63*5113495bSYour Name 
64*5113495bSYour Name 
65*5113495bSYour Name void wdi_event_handler(enum WDI_EVENT event,
66*5113495bSYour Name 		       uint8_t pdev_id, void *data);
67*5113495bSYour Name A_STATUS wdi_event_attach(struct ol_txrx_pdev_t *txrx_pdev);
68*5113495bSYour Name A_STATUS wdi_event_detach(struct ol_txrx_pdev_t *txrx_pdev);
69*5113495bSYour Name 
70*5113495bSYour Name #else
71*5113495bSYour Name 
wdi_event_handler(enum WDI_EVENT event,uint8_t pdev_id,void * data)72*5113495bSYour Name static inline void wdi_event_handler(enum WDI_EVENT event,
73*5113495bSYour Name 				     uint8_t pdev_id, void *data)
74*5113495bSYour Name {
75*5113495bSYour Name }
76*5113495bSYour Name 
wdi_event_attach(struct ol_txrx_pdev_t * txrx_pdev)77*5113495bSYour Name static inline A_STATUS wdi_event_attach(struct ol_txrx_pdev_t *txrx_pdev)
78*5113495bSYour Name {
79*5113495bSYour Name 	return A_OK;
80*5113495bSYour Name }
81*5113495bSYour Name 
wdi_event_detach(struct ol_txrx_pdev_t * txrx_pdev)82*5113495bSYour Name static inline A_STATUS wdi_event_detach(struct ol_txrx_pdev_t *txrx_pdev)
83*5113495bSYour Name {
84*5113495bSYour Name 	return A_OK;
85*5113495bSYour Name }
86*5113495bSYour Name 
wdi_event_sub(struct cdp_soc_t * soc,uint8_t pdev_id,wdi_event_subscribe * event_cb_sub,uint32_t event)87*5113495bSYour Name static inline int wdi_event_sub(struct cdp_soc_t *soc, uint8_t pdev_id,
88*5113495bSYour Name 				wdi_event_subscribe *event_cb_sub,
89*5113495bSYour Name 				uint32_t event)
90*5113495bSYour Name {
91*5113495bSYour Name 	return 0;
92*5113495bSYour Name }
93*5113495bSYour Name 
wdi_event_unsub(struct cdp_soc_t * soc,uint8_t pdev_id,wdi_event_subscribe * event_cb_sub,uint32_t event)94*5113495bSYour Name static inline int wdi_event_unsub(struct cdp_soc_t *soc, uint8_t pdev_id,
95*5113495bSYour Name 				  wdi_event_subscribe *event_cb_sub,
96*5113495bSYour Name 				  uint32_t event)
97*5113495bSYour Name {
98*5113495bSYour Name 	return 0;
99*5113495bSYour Name }
100*5113495bSYour Name #endif /* WDI_EVENT_ENABLE */
101*5113495bSYour Name 
102*5113495bSYour Name #endif /* _WDI_EVENT_API_H_ */
103