xref: /wlan-dirver/qca-wifi-host-cmn/qdf/inc/qdf_threads.h (revision 4865edfd190c086bbe2c69aae12a8226f877b91e)
1 /*
2  * Copyright (c) 2014-2017 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_threads
21  * QCA driver framework (QDF) thread related APIs
22  */
23 
24 #if !defined(__QDF_THREADS_H)
25 #define __QDF_THREADS_H
26 
27 #include <qdf_types.h>
28 #include "i_qdf_threads.h"
29 
30 typedef __qdf_thread_t qdf_thread_t;
31 
32 /* Function declarations and documenation */
33 
34 void qdf_sleep(uint32_t ms_interval);
35 
36 void qdf_sleep_us(uint32_t us_interval);
37 
38 void qdf_busy_wait(uint32_t us_interval);
39 
40 /**
41  * qdf_set_user_nice() - set thread's nice value
42  * @thread: pointer to thread
43  * @nice: nice value
44  *
45  * Return: none
46  */
47 void qdf_set_user_nice(qdf_thread_t *thread, long nice);
48 
49 /**
50  * qdf_create_thread() - create a kernel thread
51  * @thread: pointer to thread
52  * @nice: nice value
53  *
54  * Return: pointer to created kernel thread
55  */
56 qdf_thread_t *qdf_create_thread(int (*thread_handler)(void *data), void *data,
57 				const char thread_name[]);
58 
59 /**
60  * qdf_wake_up_process() - wake up given thread
61  * @thread: pointer to thread which needs to be woken up
62  *
63  * Return: none
64  */
65 int qdf_wake_up_process(qdf_thread_t *thread);
66 
67 /**
68  * qdf_print_stack_trace_thread() - prints the stack trace of the given thread
69  * @thread: the thread for which the stack trace will be printed
70  *
71  * Return: None
72  */
73 void qdf_print_thread_trace(qdf_thread_t *thread);
74 
75 /**
76  * qdf_get_current_task() - get current task struct
77  *
78  * Return: pointer to task struct
79  */
80 qdf_thread_t *qdf_get_current_task(void);
81 #endif /* __QDF_THREADS_H */
82