Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame^] | 1 | /* |
| 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 | /** |
| 29 | * DOC: cdf_softirq_timer |
| 30 | * This file abstracts OS timers running in soft IRQ context. |
| 31 | */ |
| 32 | |
| 33 | #ifndef _CDF_SOFTIRQ_TIMER_H |
| 34 | #define _CDF_SOFTIRQ_TIMER_H |
| 35 | |
| 36 | #include <cdf_types.h> |
| 37 | #include <i_cdf_softirq_timer.h> |
| 38 | |
| 39 | /* Platform timer object */ |
| 40 | typedef __cdf_softirq_timer_t cdf_softirq_timer_t; |
| 41 | |
| 42 | /** |
| 43 | * cdf_softirq_timer_init() - initialize a softirq timer |
| 44 | * @hdl: OS handle |
| 45 | * @timer: Timer object pointer |
| 46 | * @func: Timer function |
| 47 | * @arg: Arguement of timer function |
| 48 | * @type: deferrable or non deferrable timer type |
| 49 | * |
| 50 | * Timer type CDF_TIMER_TYPE_SW means its a deferrable sw timer which will |
| 51 | * not cause CPU wake upon expiry |
| 52 | * Timer type CDF_TIMER_TYPE_WAKE_APPS means its a non-deferrable timer which |
| 53 | * will cause CPU wake up on expiry |
| 54 | * |
| 55 | * Return: none |
| 56 | */ |
| 57 | static inline void |
| 58 | cdf_softirq_timer_init(cdf_handle_t hdl, |
| 59 | cdf_softirq_timer_t *timer, |
| 60 | cdf_softirq_timer_func_t func, void *arg, |
| 61 | CDF_TIMER_TYPE type) |
| 62 | { |
| 63 | __cdf_softirq_timer_init(hdl, timer, func, arg, type); |
| 64 | } |
| 65 | |
| 66 | /** |
| 67 | * cdf_softirq_timer_start() - start a one-shot softirq timer |
| 68 | * @timer: Timer object pointer |
| 69 | * @msec: Expiration period in milliseconds |
| 70 | * |
| 71 | * Return: none |
| 72 | */ |
| 73 | static inline void |
| 74 | cdf_softirq_timer_start(cdf_softirq_timer_t *timer, int msec) |
| 75 | { |
| 76 | __cdf_softirq_timer_start(timer, msec); |
| 77 | } |
| 78 | |
| 79 | /** |
| 80 | * cdf_softirq_timer_mod() - modify existing timer to new timeout value |
| 81 | * @timer: Timer object pointer |
| 82 | * @msec: Expiration period in milliseconds |
| 83 | * |
| 84 | * Return: none |
| 85 | */ |
| 86 | static inline void cdf_softirq_timer_mod(cdf_softirq_timer_t *timer, int msec) |
| 87 | { |
| 88 | __cdf_softirq_timer_mod(timer, msec); |
| 89 | } |
| 90 | |
| 91 | /** |
| 92 | * cdf_softirq_timer_cancel() - cancel cdf softirq timer |
| 93 | * @timer: Timer object pointer |
| 94 | * @retval: Timer was cancelled and deactived |
| 95 | * @retval: Timer was cancelled but already got fired. |
| 96 | * |
| 97 | * The function will return after any running timer completes. |
| 98 | * |
| 99 | * Return: none |
| 100 | */ |
| 101 | static inline bool cdf_softirq_timer_cancel(cdf_softirq_timer_t *timer) |
| 102 | { |
| 103 | return __cdf_softirq_timer_cancel(timer); |
| 104 | } |
| 105 | |
| 106 | /** |
| 107 | * cdf_softirq_timer_free() - free cdf softirq timer |
| 108 | * @timer: Timer object pointer |
| 109 | * |
| 110 | * The function will return after any running timer completes. |
| 111 | * Return: none |
| 112 | */ |
| 113 | static inline void cdf_softirq_timer_free(cdf_softirq_timer_t *timer) |
| 114 | { |
| 115 | __cdf_softirq_timer_free(timer); |
| 116 | } |
| 117 | |
| 118 | #endif |