2 * @ingroup adf_os_public
4 * This file abstracts deferred execution contexts.
7 #ifndef __ADF_OS_DEFER_H
8 #define __ADF_OS_DEFER_H
10 #include <adf_os_types.h>
11 #include <adf_os_defer_pvt.h>
14 * TODO This implements work queues (worker threads, kernel threads etc.).
15 * Note that there is no cancel on a scheduled work. You cannot free a work
16 * item if its queued. You cannot know if a work item is queued or not unless
17 * its running, whence you know its not queued.
19 * so if, say, a module is asked to unload itself, how exactly will it make
20 * sure that the work's not queued, for OS'es that dont provide such a
25 * @brief Representation of a work queue.
27 typedef __adf_os_work_t adf_os_work_t;
30 * @brief Representation of a bottom half.
32 typedef __adf_os_bh_t adf_os_bh_t;
37 * @brief This initiallizes the Bottom half deferred handler
39 * @param[in] hdl OS handle
40 * @param[in] bh bottom instance
41 * @param[in] func deferred function to run at bottom half interrupt
43 * @param[in] arg argument for the deferred function
46 adf_os_init_bh(adf_os_handle_t hdl, adf_os_bh_t *bh,
47 adf_os_defer_fn_t func,void *arg)
49 __adf_os_init_bh(hdl, bh, func, arg);
54 * @brief schedule a bottom half (DPC)
56 * @param[in] hdl OS handle
57 * @param[in] bh bottom instance
60 adf_os_sched_bh(adf_os_handle_t hdl, adf_os_bh_t *bh)
62 __adf_os_sched_bh(hdl, bh);
66 * @brief disable the bh (synchronous)
68 * @param[in] hdl OS handle
69 * @param[in] bh bottom instance
72 adf_os_disable_bh(adf_os_handle_t hdl, adf_os_bh_t *bh)
74 __adf_os_disable_bh(hdl,bh);
77 /*********************Non-Interrupt Context deferred Execution***************/
80 * @brief allocate a work/task queue, This runs in non-interrupt
81 * context, so can be preempted by H/W & S/W intr
83 * @param[in] hdl OS handle
84 * @param[in] work work instance
85 * @param[in] func deferred function to run at bottom half non-interrupt
87 * @param[in] arg argument for the deferred function
90 adf_os_init_work(adf_os_handle_t hdl, adf_os_work_t *work,
91 adf_os_defer_fn_t func, void *arg)
93 __adf_os_init_work(hdl, work, func, arg);
97 * @brief Schedule a deferred task on non-interrupt context
99 * @param[in] hdl OS handle
100 * @param[in] work work instance
103 adf_os_sched_work(adf_os_handle_t hdl, adf_os_work_t *work)
105 __adf_os_sched_work(hdl, work);
109 *@brief disable the deferred task (synchronous)
111 *@param[in] hdl OS handle
112 *@param[in] work work instance
115 adf_os_disable_work(adf_os_handle_t hdl, adf_os_work_t *work)
117 __adf_os_disable_work(hdl, work);
122 * XXX API to specify processor while scheduling a bh => only on vista
126 #endif /*_ADF_OS_DEFER_H*/