blob: c1750f5e551d7745e7767e8cf001dcef280b9f61 [file] [log] [blame]
Jeff Johnson295189b2012-06-20 16:38:30 -07001/*
Kiet Lam1ed83fc2014-02-19 01:15:45 -08002 * 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 Nakkala92f07d82013-01-08 21:16:34 -080020 */
Kiet Lam1ed83fc2014-02-19 01:15:45 -080021
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 Johnson295189b2012-06-20 16:38:30 -070028#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 Johnson295189b2012-06-20 16:38:30 -070039
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 Nakkala3c5b0632012-12-23 08:30:59 -080047typedef VOS_TIMER_STATE WPAL_TIMER_STATE;
48
Jeff Johnson295189b2012-06-20 16:38:30 -070049typedef void (*wpal_timer_callback)(void *pUserData);
50
51typedef 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---------------------------------------------------------------------------*/
68wpt_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---------------------------------------------------------------------------*/
77wpt_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---------------------------------------------------------------------------*/
87wpt_status wpalTimerStart(wpt_timer * pTimer, wpt_uint32 timeout);
88
89/*---------------------------------------------------------------------------
90 wpalTimerStop - stop a wpt_timer object. Stop doesn’t 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---------------------------------------------------------------------------*/
96wpt_status wpalTimerStop(wpt_timer * pTimer);
97
98/*---------------------------------------------------------------------------
Gopichand Nakkalaa5e3ede2012-12-21 15:28:36 -080099 wpalTimerGetCurStatus - Get the current status of timer
100
101 pTimer - a pointer to caller allocated wpt_timer object
102
103 return
Gopichand Nakkala3c5b0632012-12-23 08:30:59 -0800104 WPAL_TIMER_STATE
Gopichand Nakkalaa5e3ede2012-12-21 15:28:36 -0800105---------------------------------------------------------------------------*/
Gopichand Nakkala3c5b0632012-12-23 08:30:59 -0800106WPAL_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---------------------------------------------------------------------------*/
114wpt_uint32 wpalGetSystemTime(void);
Gopichand Nakkalaa5e3ede2012-12-21 15:28:36 -0800115
116/*---------------------------------------------------------------------------
Arif Hussain6c8947a2013-11-27 13:57:14 -0800117 wpalGetArchCounterTime - Get time from physical counter
118
119 return
120 MPM counter value
121---------------------------------------------------------------------------*/
122wpt_uint64 wpalGetArchCounterTime(void);
123
124/*---------------------------------------------------------------------------
Jeff Johnson295189b2012-06-20 16:38:30 -0700125 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---------------------------------------------------------------------------*/
131wpt_status wpalSleep(wpt_uint32 timeout);
132
Leo Changbbf86b72013-06-19 16:13:00 -0700133/*---------------------------------------------------------------------------
Leo Changf8940fd2013-07-12 14:00:25 -0700134 wpalBusyWait - Thread busy wait with specified usec
Leo Changbbf86b72013-06-19 16:13:00 -0700135 Param:
Leo Changf8940fd2013-07-12 14:00:25 -0700136 usecDelay - amount of time to wait. In unit of micro-seconds.
Leo Changbbf86b72013-06-19 16:13:00 -0700137 Return:
Leo Changf8940fd2013-07-12 14:00:25 -0700138 NONE
Leo Changbbf86b72013-06-19 16:13:00 -0700139---------------------------------------------------------------------------*/
Leo Changf8940fd2013-07-12 14:00:25 -0700140void wpalBusyWait(wpt_uint32 usecDelay);
Jeff Johnson295189b2012-06-20 16:38:30 -0700141
142#endif // __WLAN_QCT_PAL_TIMER_H