blob: e18588063636d9f3f4a2659b5fd5e70181c41d04 [file] [log] [blame]
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001/*
2 * Copyright (c) 2014-2015 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#if !defined(__CDF_EVENT_H)
29#define __CDF_EVENT_H
30
31/**
32 * DOC: cdf_event.h
33 *
34 * Connectivity driver framework (CDF) events API
35 *
36 **/
37
38/* Include Files */
39#include "cdf_status.h"
40#include "cdf_types.h"
41#include "i_cdf_event.h"
42
43/* Preprocessor definitions and constants */
44#ifdef __cplusplus
45extern "C" {
46#endif /* __cplusplus */
47
48/* Type declarations */
49
50/* Function declarations and documenation */
51
52/**
53 * cdf_event_init() - initializes the specified event
54 *
55 * @event: Pointer to CDF event object to initialize
56 *
57 * Initializes the specified event. Upon successful initialization the state
58 * of the event becomes initialized and not signaled.
59 *
60 * Return:
61 * CDF_STATUS_SUCCESS - Event was successfully initialized and is ready to
62 * be used
63 * Otherwise failure CDF reason code
64 */
65
66CDF_STATUS cdf_event_init(cdf_event_t *event);
67
68/**
69 * cdf_event_set() - set a CDF event
70 *
71 * @event: Pointer of CDF event to set to the signalled state
72 *
73 * The state of the specified event is set to 'signalled by calling
74 * cdf_event_set(). The state of the event remains signalled until an
75 * explicit call to cdf_event_reset().
76 *
77 * Any threads waiting on the event as a result of a cdf_event_wait() will
78 * be unblocked and available to be scheduled for execution when the event
79 * is signaled by a call to cdf_event_set().
80 *
81 * Return:
82 * CDF_STATUS_SUCCESS - Event was successfully set
83 * Otherwise failure CDF reason code
84 */
85CDF_STATUS cdf_event_set(cdf_event_t *event);
86
87/**
88 * cdf_event_reset() - reset a CDF event
89 *
90 * @event: Pointer of CDF event to reset
91 *
92 * The state of the specified event is set to 'NOT signalled' by calling
93 * cdf_event_reset(). The state of the event remains NOT signalled until an
94 * explicit call to cdf_event_set().
95 *
96 * This function sets the event to a NOT signalled state even if the event was
97 * signalled multiple times before being signaled.
98 *
99 * Return:
100 * CDF_STATUS_SUCCESS - Event was successfully reset
101 * Otherwise failure CDF reason code
102 */
103CDF_STATUS cdf_event_reset(cdf_event_t *event);
104
105/**
106 * cdf_event_destroy() - destroy a CDF event
107 *
108 * @event: Pointer of CDF event to destroy
109 *
110 * The function destroys the event object referenced by event.
111 * After a successful return from cdf_event_destroy() the event object becomes,
112 * in effect, uninitialized.
113 *
114 * A destroyed event object can be reinitialized using cdf_event_init();
115 * the results of otherwise referencing the object after it has been destroyed
116 * are undefined. Calls to CDF event functions to manipulate the lock such
117 * as cdf_event_set() will fail if the event is destroyed. Therefore,
118 * don't use the event after it has been destroyed until it has
119 * been re-initialized.
120 *
121 * Return:
122 * CDF_STATUS_SUCCESS - Event was successfully destroyed
123 * Otherwise failure CDF reason code
124 */
125CDF_STATUS cdf_event_destroy(cdf_event_t *event);
126
127/**
128 * cdf_wait_single_event() - wait for a single input CDF event to be set
129 *
130 * @event: Pointer of CDF event to wait on
131 * @timeout: Timeout value in milli seconds
132 *
133 * This API waits for the event to be set. This function returns
134 * if this interval elapses, regardless if any of the events have
135 * been set. An input value of 0 for this timeout parameter means
136 * to wait infinitely, meaning a timeout will never occur.
137 *
138 *
139 * Return:
140 * CDF_STATUS_SUCCESS - the wait was satisifed by the event being
141 * set.
142 *
143 * CDF_STATUS_E_TIMEOUT - the timeout interval elapsed before the
144 * event was set.
145 *
146 * CDF_STATUS_E_INVAL - The value specified by event is invalid.
147 */
148CDF_STATUS cdf_wait_single_event(cdf_event_t *pEvent,
149 uint32_t timeout);
150
151#ifdef __cplusplus
152}
153#endif /* __cplusplus */
154#endif /* __CDF_EVENT_H */