1/******************************************************************************
2 *
3 *  Copyright (C) 2003-2012 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 *  Protocol timer services.
22 *
23 ******************************************************************************/
24#ifndef PTIM_H
25#define PTIM_H
26
27#include "gki.h"
28
29/*****************************************************************************
30**  Constants and data types
31*****************************************************************************/
32
33typedef struct
34{
35    TIMER_LIST_Q        timer_queue;        /* GKI timer queue */
36    INT32               period;             /* Timer period in milliseconds */
37    UINT32              last_gki_ticks;     /* GKI ticks since last time update called */
38    UINT8               timer_id;           /* GKI timer id */
39} tPTIM_CB;
40
41#ifdef __cplusplus
42extern "C"
43{
44#endif
45
46/*****************************************************************************
47**  Function Declarations
48*****************************************************************************/
49
50/*******************************************************************************
51**
52** Function         ptim_init
53**
54** Description      Initialize a protocol timer service control block.
55**
56** Returns          void
57**
58*******************************************************************************/
59extern void ptim_init(tPTIM_CB *p_cb, UINT16 period, UINT8 timer_id);
60
61/*******************************************************************************
62**
63** Function         ptim_timer_update
64**
65** Description      Update the protocol timer list and handle expired timers.
66**
67** Returns          void
68**
69*******************************************************************************/
70extern void ptim_timer_update(tPTIM_CB *p_cb);
71
72/*******************************************************************************
73**
74** Function         ptim_start_timer
75**
76** Description      Start a protocol timer for the specified amount
77**                  of time in milliseconds.
78**
79** Returns          void
80**
81*******************************************************************************/
82extern void ptim_start_timer(tPTIM_CB *p_cb, TIMER_LIST_ENT *p_tle, UINT16 type, INT32 timeout);
83
84/*******************************************************************************
85**
86** Function         ptim_stop_timer
87**
88** Description      Stop a protocol timer.
89**
90** Returns          void
91**
92*******************************************************************************/
93extern void ptim_stop_timer(tPTIM_CB *p_cb, TIMER_LIST_ENT *p_tle);
94
95#ifdef __cplusplus
96}
97#endif
98
99#endif /* PTIM_H */
100