• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /******************************************************************************
2  *
3  *  Copyright (C) 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 #ifndef GKI_HAL_TARGET_H
19 #define GKI_HAL_TARGET_H
20 
21 #ifdef BUILDCFG
22 #include "buildcfg_hal.h"
23 #endif
24 
25 #include "data_types.h"
26 
27 /* Define export prefixes for modules exported by HAL */
28 #ifndef GKI_API
29 #define GKI_API
30 #endif
31 
32 #ifndef UDRV_API
33 #define UDRV_API
34 #endif
35 
36 #ifndef EXPORT_API
37 #define EXPORT_API
38 #endif
39 
40 
41 /******************************************************************************
42 **
43 ** Task configuration
44 **
45 ******************************************************************************/
46 
47 /* Definitions of task IDs for inter-task messaging */
48 #ifndef NFC_HAL_TASK
49 #define NFC_HAL_TASK                0
50 #endif
51 
52 /* The number of GKI tasks in the software system. */
53 #ifndef GKI_MAX_TASKS
54 #define GKI_MAX_TASKS               1
55 #endif
56 
57 /******************************************************************************
58 **
59 ** Timer configuration
60 **
61 ******************************************************************************/
62 
63 /* The number of GKI timers in the software system. */
64 #ifndef GKI_NUM_TIMERS
65 #define GKI_NUM_TIMERS              2
66 #endif
67 
68 /* A conversion value for translating ticks to calculate GKI timer.  */
69 #ifndef TICKS_PER_SEC
70 #define TICKS_PER_SEC               100
71 #endif
72 
73 /************************************************************************
74 **  Utility macros converting ticks to time with user define OS ticks per sec
75 **/
76 #ifndef GKI_MS_TO_TICKS
77 #define GKI_MS_TO_TICKS(x)   ((x) / (1000 / TICKS_PER_SEC))
78 #endif
79 
80 #ifndef GKI_SECS_TO_TICKS
81 #define GKI_SECS_TO_TICKS(x)   ((x) * (TICKS_PER_SEC))
82 #endif
83 
84 #ifndef GKI_TICKS_TO_MS
85 #define GKI_TICKS_TO_MS(x)   ((x) * 1000 / TICKS_PER_SEC)
86 #endif
87 
88 #ifndef GKI_TICKS_TO_SECS
89 #define GKI_TICKS_TO_SECS(x)   ((x) / TICKS_PER_SEC)
90 #endif
91 
92 
93 
94 /* TICK per second from OS (OS dependent change this macro accordingly to various OS) */
95 #ifndef OS_TICKS_PER_SEC
96 #define OS_TICKS_PER_SEC               1000
97 #endif
98 
99 /************************************************************************
100 **  Utility macros converting ticks to time with user define OS ticks per sec
101 **/
102 
103 #ifndef GKI_OS_TICKS_TO_MS
104 #define GKI_OS_TICKS_TO_MS(x)   ((x) * 1000 / OS_TICKS_PER_SEC)
105 #endif
106 
107 
108 #ifndef GKI_OS_TICKS_TO_SECS
109 #define GKI_OS_TICKS_TO_SECS(x)   ((x) / OS_TICKS_PER_SEC))
110 #endif
111 
112 
113 /* delay in ticks before stopping system tick. */
114 #ifndef GKI_DELAY_STOP_SYS_TICK
115 #define GKI_DELAY_STOP_SYS_TICK     10
116 #endif
117 
118 /* Option to guarantee no preemption during timer expiration (most system don't need this) */
119 #ifndef GKI_TIMER_LIST_NOPREEMPT
120 #define GKI_TIMER_LIST_NOPREEMPT    FALSE
121 #endif
122 
123 /******************************************************************************
124 **
125 ** Buffer configuration
126 **
127 ******************************************************************************/
128 
129 /* TRUE if GKI uses dynamic buffers. */
130 #ifndef GKI_USE_DYNAMIC_BUFFERS
131 #define GKI_USE_DYNAMIC_BUFFERS     FALSE
132 #endif
133 
134 /* The size of the buffers in pool 0. */
135 #ifndef GKI_BUF0_SIZE
136 #define GKI_BUF0_SIZE               64
137 #endif
138 
139 /* The number of buffers in buffer pool 0. */
140 #ifndef GKI_BUF0_MAX
141 #define GKI_BUF0_MAX                8
142 #endif
143 
144 /* The ID of buffer pool 0. */
145 #ifndef GKI_POOL_ID_0
146 #define GKI_POOL_ID_0               0
147 #endif
148 
149 /* The size of the buffers in pool 1. */
150 #ifndef GKI_BUF1_SIZE
151 #define GKI_BUF1_SIZE               288
152 #endif
153 
154 /* The number of buffers in buffer pool 1. */
155 #ifndef GKI_BUF1_MAX
156 #define GKI_BUF1_MAX                8
157 #endif
158 
159 /* The ID of buffer pool 1. */
160 #ifndef GKI_POOL_ID_1
161 #define GKI_POOL_ID_1               1
162 #endif
163 
164 /* The size of the largest PUBLIC fixed buffer in system. */
165 #ifndef GKI_MAX_BUF_SIZE
166 #define GKI_MAX_BUF_SIZE            GKI_BUF1_SIZE
167 #endif
168 
169 /* The pool ID of the largest PUBLIC fixed buffer in system. */
170 #ifndef GKI_MAX_BUF_SIZE_POOL_ID
171 #define GKI_MAX_BUF_SIZE_POOL_ID    GKI_POOL_ID_1
172 #endif
173 
174 /* buffer size for USERIAL, it must large enough to hold NFC_HDR and max packet size */
175 #ifndef USERIAL_POOL_BUF_SIZE
176 #define USERIAL_POOL_BUF_SIZE       GKI_BUF1_SIZE
177 #endif
178 
179 /* buffer pool ID for USERIAL */
180 #ifndef USERIAL_POOL_ID
181 #define USERIAL_POOL_ID             GKI_POOL_ID_1
182 #endif
183 
184 #ifndef GKI_NUM_FIXED_BUF_POOLS
185 #define GKI_NUM_FIXED_BUF_POOLS     2
186 #endif
187 
188 /* The number of fixed and dynamic buffer pools */
189 #ifndef GKI_NUM_TOTAL_BUF_POOLS
190 #define GKI_NUM_TOTAL_BUF_POOLS     2
191 #endif
192 
193 /* The buffer pool usage mask. */
194 #ifndef GKI_DEF_BUFPOOL_PERM_MASK
195 #define GKI_DEF_BUFPOOL_PERM_MASK   0xfff0
196 #endif
197 
198 /* The buffer corruption check flag. */
199 #ifndef GKI_ENABLE_BUF_CORRUPTION_CHECK
200 #define GKI_ENABLE_BUF_CORRUPTION_CHECK TRUE
201 #endif
202 
203 /* The GKI severe error macro. */
204 #ifndef GKI_SEVERE
205 #define GKI_SEVERE(code)
206 #endif
207 
208 /* TRUE if GKI includes debug functionality. */
209 #ifndef GKI_DEBUG
210 #define GKI_DEBUG                   FALSE
211 #endif
212 
213 /* Maximum number of exceptions logged. */
214 #ifndef GKI_MAX_EXCEPTION
215 #define GKI_MAX_EXCEPTION           8
216 #endif
217 
218 /* Maximum number of chars stored for each exception message. */
219 #ifndef GKI_MAX_EXCEPTION_MSGLEN
220 #define GKI_MAX_EXCEPTION_MSGLEN    64
221 #endif
222 
223 #ifndef GKI_SEND_MSG_FROM_ISR
224 #define GKI_SEND_MSG_FROM_ISR    FALSE
225 #endif
226 
227 
228 /* GKI Trace Macros */
229 #define GKI_TRACE_0(m)                          LogMsg(TRACE_CTRL_GENERAL | TRACE_LAYER_GKI | TRACE_ORG_GKI | TRACE_TYPE_GENERIC,m)
230 #define GKI_TRACE_1(m,p1)                       LogMsg(TRACE_CTRL_GENERAL | TRACE_LAYER_GKI | TRACE_ORG_GKI | TRACE_TYPE_GENERIC,m,p1)
231 #define GKI_TRACE_2(m,p1,p2)                    LogMsg(TRACE_CTRL_GENERAL | TRACE_LAYER_GKI | TRACE_ORG_GKI | TRACE_TYPE_GENERIC,m,p1,p2)
232 #define GKI_TRACE_3(m,p1,p2,p3)                 LogMsg(TRACE_CTRL_GENERAL | TRACE_LAYER_GKI | TRACE_ORG_GKI | TRACE_TYPE_GENERIC,m,p1,p2,p3)
233 #define GKI_TRACE_4(m,p1,p2,p3,p4)              LogMsg(TRACE_CTRL_GENERAL | TRACE_LAYER_GKI | TRACE_ORG_GKI | TRACE_TYPE_GENERIC,m,p1,p2,p3,p4)
234 #define GKI_TRACE_5(m,p1,p2,p3,p4,p5)           LogMsg(TRACE_CTRL_GENERAL | TRACE_LAYER_GKI | TRACE_ORG_GKI | TRACE_TYPE_GENERIC,m,p1,p2,p3,p4,p5)
235 #define GKI_TRACE_6(m,p1,p2,p3,p4,p5,p6)        LogMsg(TRACE_CTRL_GENERAL | TRACE_LAYER_GKI | TRACE_ORG_GKI | TRACE_TYPE_GENERIC,m,p1,p2,p3,p4,p5,p6)
236 
237 #define GKI_TRACE_ERROR_0(m)                    LogMsg(TRACE_CTRL_GENERAL | TRACE_LAYER_GKI | TRACE_ORG_GKI | TRACE_TYPE_ERROR,m)
238 #define GKI_TRACE_ERROR_1(m,p1)                 LogMsg(TRACE_CTRL_GENERAL | TRACE_LAYER_GKI | TRACE_ORG_GKI | TRACE_TYPE_ERROR,m,p1)
239 #define GKI_TRACE_ERROR_2(m,p1,p2)              LogMsg(TRACE_CTRL_GENERAL | TRACE_LAYER_GKI | TRACE_ORG_GKI | TRACE_TYPE_ERROR,m,p1,p2)
240 #define GKI_TRACE_ERROR_3(m,p1,p2,p3)           LogMsg(TRACE_CTRL_GENERAL | TRACE_LAYER_GKI | TRACE_ORG_GKI | TRACE_TYPE_ERROR,m,p1,p2,p3)
241 #define GKI_TRACE_ERROR_4(m,p1,p2,p3,p4)        LogMsg(TRACE_CTRL_GENERAL | TRACE_LAYER_GKI | TRACE_ORG_GKI | TRACE_TYPE_ERROR,m,p1,p2,p3,p4)
242 #define GKI_TRACE_ERROR_5(m,p1,p2,p3,p4,p5)     LogMsg(TRACE_CTRL_GENERAL | TRACE_LAYER_GKI | TRACE_ORG_GKI | TRACE_TYPE_ERROR,m,p1,p2,p3,p4,p5)
243 #define GKI_TRACE_ERROR_6(m,p1,p2,p3,p4,p5,p6)  LogMsg(TRACE_CTRL_GENERAL | TRACE_LAYER_GKI | TRACE_ORG_GKI | TRACE_TYPE_ERROR,m,p1,p2,p3,p4,p5,p6)
244 
245 #ifdef __cplusplus
246 extern "C"
247 {
248 #endif
249 
250 extern void LogMsg (UINT32 trace_set_mask, const char *fmt_str, ...);
251 
252 #ifdef __cplusplus
253 }
254 #endif
255 
256 #endif  /* GKI_TARGET_H */
257