eventmgr.h
5.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
#ifndef __EVENTMGR_H
#define __EVENTMGR_H
/***************************************************************************
*
* File:
* $Workfile:eventmgr.h$ for iAnywhere Blue SDK, Version 2.1.1
* $Revision:31$
*
* Description:
* Types, defines, and prototypes for OS access to the Event Manager.
*
* Copyright 1999-2005 Extended Systems, Inc.
* Portions copyright 2005 iAnywhere Solutions, Inc.
* All rights reserved. All unpublished rights reserved.
*
* Unpublished Confidential Information of iAnywhere Solutions, Inc.
* Do Not Disclose.
*
* No part of this work may be used or reproduced in any form or by any
* means, or stored in a database or retrieval system, without prior written
* permission of iAnywhere Solutions, Inc.
*
* Use of this work is governed by a license granted by iAnywhere Solutions,
* Inc. This work contains confidential and proprietary information of
* iAnywhere Solutions, Inc. which is protected by copyright, trade secret,
* trademark and other intellectual property rights.
*
****************************************************************************/
#include "osapi.h"
#include "utils.h"
#include "config.h"
#include "xatypes.h"
#include "btdrv_types.h"
#if (IRDA_STACK == XA_ENABLED) || (BT_STACK == XA_ENABLED) || (XA_EVENTMGR == XA_ENABLED)
/*---------------------------------------------------------------------------
* Event Manager API layer
*
* The Event Manager provides a thread of execution to all stack
* components and manages stack initialization and deinitialization. Refer
* to the documentation in each function for specific instructions
* on how it interacts with the operating system integration layer
* (OS API).
*/
//Move to \mcu\interface\hal\bluetooth\btdrv_types.h
#if 0
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
#endif
/****************************************************************************
*
* Function Reference
*
****************************************************************************/
/*---------------------------------------------------------------------------
* EVM_Init()
*
* Called by the OS to initializes the event manager and the stack.
* This must be called before the first call to EVM_Process.
*
* Returns:
* TRUE - Initialization succeeded.
*
* FALSE - Initialization failed.
*/
BOOL EVM_Init(void);
/*---------------------------------------------------------------------------
* EVM_Deinit()
*
* Called by the OS to deinitialize the event manager and the stack.
* Do not call EVM_Process after calling this function.
*/
void EVM_Deinit(void);
/*---------------------------------------------------------------------------
* EVM_Process()
*
* Called by the OS to give a thread of execution to the stack.
* Internally, this function calls OS_LockStack and OS_UnlockStack
* to protect the stack from reentrancy.
*/
void EVM_Process(void);
/* Prototypes for EVM_StartTimer EVM_CancelTimer macros */
void EvmStartTimer(EvmTimer *timer, TimeT ticks, BOOL stopHardware);
void EvmCancelTimer(EvmTimer *timer, BOOL stopHardware);
/*---------------------------------------------------------------------------
* EVM_StartTimer()
*
* Called by stack layers to start a timer. After the specified
* amount of time elapses, the timer fires by calling the timer's
* callback function. The timer fires only once for each call to
* EVM_StartTimer().
*
* If the timer was already running, this function resets it with a
* new time period.
*
* Internally, timers are managed by calling OS_GetSystemTime during
* stack execution. When XA_MULTITASKING is enabled, this function
* uses OS_StartTimer, which maps to a single system timer.
*
* Parameters:
* timer - Pointer to a timer structure. The caller must
* initialize the func field, and may also initialize the context
* field if desired. When the timer fires, timer.func is called
* during stack execution. NOTE: The timer.func will typically check
* for Hold, Park or Sniff mode with ME_GetCurrentMode when called
* and handle these modes differently (usually restarting the timer
* is sufficient.)
*
* ms - Number of milliseconds to wait before firing. This value
* is converted to system ticks using the MS_TO_TICKS macro.
*/
void EVM_StartTimer(EvmTimer *timer, TimeT ms);
//#define EVM_StartTimer(timer, ms) EvmStartTimer(timer, MS_TO_TICKS(ms), TRUE)
/*---------------------------------------------------------------------------
* EVM_CancelTimer()
*
* Called by the stack to cancel a timer. This prevents the timer
* from firing.
*
* Parameters:
* timer - Pointer to a timer structure. The timer must have been
* started by EVM_StartTimer and must not have fired or
* been cancelled already.
*/
void EVM_CancelTimer(EvmTimer *timer);
//#define EVM_CancelTimer(timer) EvmCancelTimer(timer, TRUE)
void EvmResetTimer(EvmTimer *timer);
#define EVM_ResetTimer(timer) EvmResetTimer(timer)
#endif /* (IRDA_STACK == XA_ENABLED) || (BT_STACK == XA_ENABLED) || (XA_EVENTMGR == XA_ENABLED) */
#endif /* __EVENTMGR_H */