1 /* 2 * Copyright (c) 2014-2018 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: qdf_event.h 21 * This file provides OS abstraction for event APIs. 22 */ 23 24 #if !defined(__QDF_EVENT_H) 25 #define __QDF_EVENT_H 26 27 /* Include Files */ 28 #include "qdf_status.h" 29 #include <qdf_types.h> 30 #include <i_qdf_event.h> 31 #include <qdf_trace.h> 32 #include <qdf_list.h> 33 34 /* Preprocessor definitions and constants */ 35 #ifdef __cplusplus 36 extern "C" { 37 #endif /* __cplusplus */ 38 39 typedef __qdf_event_t qdf_event_t; 40 /* Function declarations and documenation */ 41 42 QDF_STATUS qdf_event_create(qdf_event_t *event); 43 44 QDF_STATUS qdf_event_set(qdf_event_t *event); 45 46 QDF_STATUS qdf_event_reset(qdf_event_t *event); 47 48 QDF_STATUS qdf_event_destroy(qdf_event_t *event); 49 50 QDF_STATUS qdf_wait_single_event(qdf_event_t *event, 51 uint32_t timeout); 52 53 /** 54 * qdf_complete_wait_events() - Sets all the events which are in the list. 55 * 56 * This function traverses the list of events and sets all of them. It 57 * sets the flag force_set as TRUE to indicate that these events have 58 * been forcefully set. 59 * 60 * Return: None 61 */ 62 void qdf_complete_wait_events(void); 63 64 /** 65 * qdf_wait_for_event_completion() - Waits for an event to be set. 66 * @event: Pointer to an event to wait on. 67 * @timeout: Timeout value (in milliseconds). 68 * 69 * This function adds the event in a list and waits on it until it 70 * is set or the timeout duration elapses. The purpose of waiting 71 * is considered complete only if the event is set and the flag 72 * force_set is FALSE, it returns success in this case. In other 73 * cases it returns appropriate error status. 74 * 75 * Return: QDF status 76 */ 77 QDF_STATUS qdf_wait_for_event_completion(qdf_event_t *event, 78 uint32_t timeout); 79 80 /** 81 * qdf_event_list_init() - Creates a list and spinlock for events. 82 * 83 * This function creates a list for maintaining events on which threads 84 * wait for completion. A spinlock is also created to protect related 85 * operations. 86 * 87 * Return: None 88 */ 89 void qdf_event_list_init(void); 90 91 /** 92 * qdf_event_list_destroy() - Destroys list and spinlock created for events. 93 * 94 * This function destroys the list and spinlock created for events on which 95 * threads wait for completion. 96 * 97 * Return: None 98 */ 99 void qdf_event_list_destroy(void); 100 101 /** 102 * qdf_exit_thread() - exit thread execution 103 * @status: QDF status 104 * 105 * Return: QDF status 106 */ 107 QDF_STATUS qdf_exit_thread(QDF_STATUS status); 108 109 #ifdef __cplusplus 110 } 111 #endif /* __cplusplus */ 112 #endif /* __QDF_EVENT_H */ 113