Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1 | /* |
Kiet Lam | 1ed83fc | 2014-02-19 01:15:45 -0800 | [diff] [blame] | 2 | * Copyright (c) 2012-2013 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. |
Gopichand Nakkala | 92f07d8 | 2013-01-08 21:16:34 -0800 | [diff] [blame] | 20 | */ |
Kiet Lam | 1ed83fc | 2014-02-19 01:15:45 -0800 | [diff] [blame] | 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 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 28 | #if !defined( __WLAN_QCT_PAL_TIMER_H ) |
| 29 | #define __WLAN_QCT_PAL_TIMER_H |
| 30 | |
| 31 | /**========================================================================= |
| 32 | |
| 33 | \file wlan_qct_pal_timer.h |
| 34 | |
| 35 | \brief define synchronization objects PAL exports. wpt = (Wlan Pal Type) wpal = (Wlan PAL) |
| 36 | |
| 37 | Definitions for platform independent. |
| 38 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 39 | |
| 40 | ========================================================================*/ |
| 41 | |
| 42 | #include "wlan_qct_pal_type.h" |
| 43 | #include "wlan_qct_pal_status.h" |
| 44 | #include "wlan_qct_os_timer.h" |
| 45 | |
| 46 | |
Gopichand Nakkala | 3c5b063 | 2012-12-23 08:30:59 -0800 | [diff] [blame] | 47 | typedef VOS_TIMER_STATE WPAL_TIMER_STATE; |
| 48 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 49 | typedef void (*wpal_timer_callback)(void *pUserData); |
| 50 | |
| 51 | typedef struct |
| 52 | { |
| 53 | wpt_os_timer timer; |
| 54 | wpal_timer_callback callback; |
| 55 | void *pUserData; |
| 56 | } wpt_timer; |
| 57 | |
| 58 | |
| 59 | /*--------------------------------------------------------------------------- |
| 60 | wpalTimerInit - initialize a wpt_timer object |
| 61 | Param: |
| 62 | pTimer - a pointer to caller allocated wpt_timer object |
| 63 | callback - A callback function |
| 64 | pUserData - A pointer to data pass as parameter of the callback function. |
| 65 | Return: |
| 66 | eWLAN_PAL_STATUS_SUCCESS - success. Fail otherwise. |
| 67 | ---------------------------------------------------------------------------*/ |
| 68 | wpt_status wpalTimerInit(wpt_timer * pTimer, wpal_timer_callback callback, void *pUserData); |
| 69 | |
| 70 | /*--------------------------------------------------------------------------- |
| 71 | wpalTimerDelete - invalidate a wpt_timer object |
| 72 | Param: |
| 73 | pTimer - a pointer to caller allocated wpt_timer object |
| 74 | Return: |
| 75 | eWLAN_PAL_STATUS_SUCCESS - success. Fail otherwise. |
| 76 | ---------------------------------------------------------------------------*/ |
| 77 | wpt_status wpalTimerDelete(wpt_timer * pTimer); |
| 78 | |
| 79 | /*--------------------------------------------------------------------------- |
| 80 | wpalTimerStart - start a wpt_timer object with a timeout value |
| 81 | Param: |
| 82 | pTimer - a pointer to caller allocated wpt_timer object |
| 83 | timeout - timeout value of the timer. In unit of milli-seconds. |
| 84 | Return: |
| 85 | eWLAN_PAL_STATUS_SUCCESS - success. Fail otherwise. |
| 86 | ---------------------------------------------------------------------------*/ |
| 87 | wpt_status wpalTimerStart(wpt_timer * pTimer, wpt_uint32 timeout); |
| 88 | |
| 89 | /*--------------------------------------------------------------------------- |
| 90 | wpalTimerStop - stop a wpt_timer object. Stop doesnt guarantee the timer handler is not called if it is already timeout. |
| 91 | Param: |
| 92 | pTimer - a pointer to caller allocated wpt_timer object |
| 93 | Return: |
| 94 | eWLAN_PAL_STATUS_SUCCESS - success. Fail otherwise. |
| 95 | ---------------------------------------------------------------------------*/ |
| 96 | wpt_status wpalTimerStop(wpt_timer * pTimer); |
| 97 | |
| 98 | /*--------------------------------------------------------------------------- |
Gopichand Nakkala | a5e3ede | 2012-12-21 15:28:36 -0800 | [diff] [blame] | 99 | wpalTimerGetCurStatus - Get the current status of timer |
| 100 | |
| 101 | pTimer - a pointer to caller allocated wpt_timer object |
| 102 | |
| 103 | return |
Gopichand Nakkala | 3c5b063 | 2012-12-23 08:30:59 -0800 | [diff] [blame] | 104 | WPAL_TIMER_STATE |
Gopichand Nakkala | a5e3ede | 2012-12-21 15:28:36 -0800 | [diff] [blame] | 105 | ---------------------------------------------------------------------------*/ |
Gopichand Nakkala | 3c5b063 | 2012-12-23 08:30:59 -0800 | [diff] [blame] | 106 | WPAL_TIMER_STATE wpalTimerGetCurStatus(wpt_timer * pTimer); |
| 107 | |
| 108 | /*--------------------------------------------------------------------------- |
| 109 | wpalGetSystemTime - Get the system time in milliseconds |
| 110 | |
| 111 | return |
| 112 | current time in milliseconds |
| 113 | ---------------------------------------------------------------------------*/ |
| 114 | wpt_uint32 wpalGetSystemTime(void); |
Gopichand Nakkala | a5e3ede | 2012-12-21 15:28:36 -0800 | [diff] [blame] | 115 | |
| 116 | /*--------------------------------------------------------------------------- |
Arif Hussain | 6c8947a | 2013-11-27 13:57:14 -0800 | [diff] [blame] | 117 | wpalGetArchCounterTime - Get time from physical counter |
| 118 | |
| 119 | return |
| 120 | MPM counter value |
| 121 | ---------------------------------------------------------------------------*/ |
| 122 | wpt_uint64 wpalGetArchCounterTime(void); |
| 123 | |
| 124 | /*--------------------------------------------------------------------------- |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 125 | wpalSleep - sleep for a specified interval |
| 126 | Param: |
| 127 | timeout - amount of time to sleep. In unit of milli-seconds. |
| 128 | Return: |
| 129 | eWLAN_PAL_STATUS_SUCCESS - success. Fail otherwise. |
| 130 | ---------------------------------------------------------------------------*/ |
| 131 | wpt_status wpalSleep(wpt_uint32 timeout); |
| 132 | |
Leo Chang | bbf86b7 | 2013-06-19 16:13:00 -0700 | [diff] [blame] | 133 | /*--------------------------------------------------------------------------- |
Leo Chang | f8940fd | 2013-07-12 14:00:25 -0700 | [diff] [blame] | 134 | wpalBusyWait - Thread busy wait with specified usec |
Leo Chang | bbf86b7 | 2013-06-19 16:13:00 -0700 | [diff] [blame] | 135 | Param: |
Leo Chang | f8940fd | 2013-07-12 14:00:25 -0700 | [diff] [blame] | 136 | usecDelay - amount of time to wait. In unit of micro-seconds. |
Leo Chang | bbf86b7 | 2013-06-19 16:13:00 -0700 | [diff] [blame] | 137 | Return: |
Leo Chang | f8940fd | 2013-07-12 14:00:25 -0700 | [diff] [blame] | 138 | NONE |
Leo Chang | bbf86b7 | 2013-06-19 16:13:00 -0700 | [diff] [blame] | 139 | ---------------------------------------------------------------------------*/ |
Leo Chang | f8940fd | 2013-07-12 14:00:25 -0700 | [diff] [blame] | 140 | void wpalBusyWait(wpt_uint32 usecDelay); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 141 | |
| 142 | #endif // __WLAN_QCT_PAL_TIMER_H |