1/******************************************************************************
2 *
3 *  Copyright (C) 2003-2014 Broadcom Corporation
4 *
5 *  Licensed under the Apache License, Version 2.0 (the "License");
6 *  you may not use this file except in compliance with the License.
7 *  You may obtain a copy of the License at:
8 *
9 *  http://www.apache.org/licenses/LICENSE-2.0
10 *
11 *  Unless required by applicable law or agreed to in writing, software
12 *  distributed under the License is distributed on an "AS IS" BASIS,
13 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 *  See the License for the specific language governing permissions and
15 *  limitations under the License.
16 *
17 ******************************************************************************/
18
19
20/******************************************************************************
21 *
22 *  Protocol timer services.
23 *
24 ******************************************************************************/
25#ifndef NFA_SYS_PTIM_H
26#define NFA_SYS_PTIM_H
27
28#include "gki.h"
29
30/*****************************************************************************
31**  Constants and data types
32*****************************************************************************/
33
34typedef struct
35{
36    TIMER_LIST_Q        timer_queue;        /* GKI timer queue */
37    INT32               period;             /* Timer period in milliseconds */
38    UINT32              last_gki_ticks;     /* GKI ticks since last time update called */
39    UINT8               timer_id;           /* GKI timer id */
40} tPTIM_CB;
41
42#ifdef __cplusplus
43extern "C"
44{
45#endif
46
47/*****************************************************************************
48**  Function Declarations
49*****************************************************************************/
50
51/*******************************************************************************
52**
53** Function         nfa_sys_ptim_init
54**
55** Description      Initialize a protocol timer service control block.
56**
57** Returns          void
58**
59*******************************************************************************/
60extern void nfa_sys_ptim_init (tPTIM_CB *p_cb, UINT16 period, UINT8 timer_id);
61
62/*******************************************************************************
63**
64** Function         nfa_sys_ptim_timer_update
65**
66** Description      Update the protocol timer list and handle expired timers.
67**
68** Returns          void
69**
70*******************************************************************************/
71extern void nfa_sys_ptim_timer_update (tPTIM_CB *p_cb);
72
73/*******************************************************************************
74**
75** Function         nfa_sys_ptim_start_timer
76**
77** Description      Start a protocol timer for the specified amount
78**                  of time in milliseconds.
79**
80** Returns          void
81**
82*******************************************************************************/
83extern void nfa_sys_ptim_start_timer (tPTIM_CB *p_cb, TIMER_LIST_ENT *p_tle, UINT16 type, INT32 timeout);
84
85/*******************************************************************************
86**
87** Function         nfa_sys_ptim_stop_timer
88**
89** Description      Stop a protocol timer.
90**
91** Returns          void
92**
93*******************************************************************************/
94extern void nfa_sys_ptim_stop_timer (tPTIM_CB *p_cb, TIMER_LIST_ENT *p_tle);
95
96#ifdef __cplusplus
97}
98#endif
99
100#endif /* NFA_SYS_PTIM_H */
101