• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /****************************************************************************
2 **+-----------------------------------------------------------------------+**
3 **|                                                                       |**
4 **| Copyright(c) 1998 - 2008 Texas Instruments. All rights reserved.      |**
5 **| All rights reserved.                                                  |**
6 **|                                                                       |**
7 **| Redistribution and use in source and binary forms, with or without    |**
8 **| modification, are permitted provided that the following conditions    |**
9 **| are met:                                                              |**
10 **|                                                                       |**
11 **|  * Redistributions of source code must retain the above copyright     |**
12 **|    notice, this list of conditions and the following disclaimer.      |**
13 **|  * Redistributions in binary form must reproduce the above copyright  |**
14 **|    notice, this list of conditions and the following disclaimer in    |**
15 **|    the documentation and/or other materials provided with the         |**
16 **|    distribution.                                                      |**
17 **|  * Neither the name Texas Instruments nor the names of its            |**
18 **|    contributors may be used to endorse or promote products derived    |**
19 **|    from this software without specific prior written permission.      |**
20 **|                                                                       |**
21 **| THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS   |**
22 **| "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT     |**
23 **| LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |**
24 **| A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT  |**
25 **| OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |**
26 **| SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT      |**
27 **| LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |**
28 **| DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |**
29 **| THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT   |**
30 **| (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |**
31 **| OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.  |**
32 **|                                                                       |**
33 **+-----------------------------------------------------------------------+**
34 ****************************************************************************/
35 
36 /*--------------------------------------------------------------------------*/
37 /* Module:      OSAPI.H*/
38 /**/
39 /* Purpose:     This module defines unified interface to the OS specific*/
40 /*              sources and services.*/
41 /**/
42 /*--------------------------------------------------------------------------*/
43 
44 #ifndef __OS_API_H__
45 #define __OS_API_H__
46 
47 
48 #include "osTIType.h"
49 #include "TI_IPC_Api.h"
50 //TRS:MEB
51 #ifdef _WINDOWS
52 #endif
53 
54 //TRS end
55 
56 
57 /****************************************************************************************
58 						START OF OS API (Common to all GWSI LIB, Driver and TI Driver)
59 *****************************************************************************************/
60 
61 
62 #define OS_API_MEM_ADRR  0x0000000
63 #define OS_API_REG_ADRR  0x300000
64 
65 
66 /****************************************************************************************
67                         OS HW API NEEDED BY DRIVER
68 *****************************************************************************************/
69 
70 
71 #define OS_PAGE_SIZE 4096
72 
73 /*
74 Clear the WLAN Ready Interrupt Line stored in the PIC Controller
75 */
76 VOID os_clearWlanReady(void);
77 
78 /*
79 Read the WLAN_IRQ line
80 */
81 UINT32 os_senseIrqLine( TI_HANDLE OsContext );
82 
83 /* TRS: CDB Needed for osApi.C */
84 #ifdef BSP_H5
85 #define WLAN_GPIO_INTERRUPT_LINE		9
86 #define WLAN_GPIO_POWER_ENABLET_LINE    10
87 #else
88 #define WLAN_GPIO_INTERRUPT_LINE    134
89 #define WLAN_GPIO_POWER_ENABLET_LINE    71
90 #endif
91 
92 
93 VOID
94 os_disableIrq(
95     TI_HANDLE OsContext
96     );
97 
98 VOID
99 os_enableIrq(
100     TI_HANDLE OsContext
101     );
102 
103 /****************************************************************************************
104  *                        																*
105  *						OS Report API													*
106  *																						*
107  ****************************************************************************************/
108 
109 VOID
110 os_setDebugMode(
111 	BOOL enable
112 	);
113 
114 VOID
115 os_printf(
116 	const char *format ,...);
117 
118 VOID os_setDebugOutputToTicon(BOOL value);
119 
120 #define os_report   os_printf
121 #define osPrintf os_printf  //TRS::CDB
122 
123 /****************************************************************************************
124  *                        																*
125  *							OS DMA CALLBACK API											*
126  ****************************************************************************************
127  *	Callback directly called at an IRQ context from the SPI modue						*
128  *	This should triger a tasklet_schedule so that the End of DMA will be handled		*
129  *	in a tasklet  context and then be directed to the TNETWIF to call the Client 		*
130  *																						*
131  *																						*
132  ****************************************************************************************/
133 
134 VOID
135 os_TNETWIF_BusTxn_Complete(
136 	TI_HANDLE OsContext,
137 	int status
138 	);
139 
140 
141 /****************************************************************************************
142  *                        																*
143  *						OS Memory API													*
144  *																						*
145  ****************************************************************************************/
146 
147 PVOID
148 os_memoryAlloc(
149     TI_HANDLE OsContext,
150     UINT32 Size
151     );
152 
153 PVOID
154 os_memoryPreAlloc(
155     TI_HANDLE OsContext,
156     int section,
157     UINT32 Size
158     );
159 
160 PVOID
161 os_memoryCAlloc(
162     TI_HANDLE OsContext,
163     UINT32 Number,
164     UINT32 Size
165     );
166 
167 VOID
168 os_memorySet(
169     TI_HANDLE OsContext,
170     PVOID pMemPtr,
171     INT32 Value,
172     UINT32 Length
173     );
174 
175 VOID
176 os_memoryZero(
177     TI_HANDLE OsContext,
178     PVOID pMemPtr,
179     UINT32 Length
180    );
181 
182 VOID
183 os_memoryCopy(
184     TI_HANDLE pOsContext,
185     PVOID pDestination,
186     PVOID pSource,
187     UINT32 Size
188    );
189 
190 VOID
191 os_memoryMove(
192     TI_HANDLE pOsContext,
193     PVOID pDestination,
194     PVOID pSource,
195     UINT32 Size
196    );
197 
198 VOID
199 os_memoryFree(
200     TI_HANDLE pOsContext,
201     PVOID pMemPtr,
202     UINT32 Size
203     );
204 
205 INT32
206 os_memoryCompare(
207     TI_HANDLE OsContext,
208     PUINT8 Buf1,
209     PUINT8 Buf2,
210     INT32 Count
211     );
212 
213 PVOID
214 os_memoryAlloc4HwDma(
215     TI_HANDLE pOsContext,
216     UINT32 Size
217     );
218 
219 VOID
220 os_memory4HwDmaFree(
221     TI_HANDLE pOsContext,
222     PVOID pPMem_ptr,
223     UINT32 Size
224     );
225 
226 
227 /****************************************************************************************
228  *                        																*
229  *							OS TIMER API												*
230  *																						*
231  ****************************************************************************************/
232 typedef void (*PTIMER_FUNCTION)(TI_HANDLE Context);
233 
234 TI_HANDLE
235 os_timerCreate(
236     TI_HANDLE OsContext,
237     PTIMER_FUNCTION pRoutine,
238     TI_HANDLE Context
239     );
240 
241 VOID
242 os_timerDestroy(
243     TI_HANDLE OsContext,
244     TI_HANDLE TimerHandle
245     );
246 
247 VOID
248 os_timerStart(
249     TI_HANDLE OsContext,
250     TI_HANDLE TimerHandle,
251     UINT32 DelayMs,
252     BOOL bPeriodic
253     );
254 
255 VOID
256 os_timerStop(
257     TI_HANDLE OsContext,
258     TI_HANDLE TimerHandle
259     );
260 
261 VOID
262 os_periodicIntrTimerStart(
263 	TI_HANDLE OsContext
264 	);
265 
266 UINT32
267 os_timeStampMs(
268     TI_HANDLE OsContext
269     );
270 
271 UINT32
272 os_timeStampUs(
273     TI_HANDLE OsContext
274     );
275 
276 VOID
277 os_StalluSec(
278     TI_HANDLE OsContext,
279     UINT32 uSec
280     );
281 
282 void os_ToggleDebugGPIO(int count);
283 
284 
285 /****************************************************************************************
286  *                        																*
287  *							Hardware access functions	API								*
288  *																						*
289  ****************************************************************************************/
290 PVOID
291 os_hwGetRegistersAddr(
292     TI_HANDLE OsContext
293     );
294 
295 
296 PVOID
297 os_hwGetMemoryAddr(
298     TI_HANDLE OsContext
299     );
300 
301 
302 /****************************************************************************************
303  *                        																*
304  *							Protection services	API										*
305  *																						*
306  ****************************************************************************************
307  * OS protection is implemented as dummy functions because								*
308  * all driver code is executed in context of a single tasklet,							*
309  * except IOCTL handlers and xmition.													*
310  * Protection in IOCTL handlers and hard_start_xmit is done by different				*
311  * means.																				*
312  ****************************************************************************************/
313 TI_HANDLE
314 os_protectCreate(
315     TI_HANDLE OsContext
316     );
317 
318 VOID
319 os_protectDestroy(
320     TI_HANDLE OsContext,
321     TI_HANDLE ProtectContext
322     );
323 
324 VOID
325 os_protectLock(
326     TI_HANDLE OsContext,
327     TI_HANDLE ProtectContext
328     );
329 
330 VOID
331 os_protectUnlock(
332     TI_HANDLE OsContext,
333     TI_HANDLE ProtectContext
334     );
335 
336 
337 
338 #ifdef DRIVER_PROFILING
339   void _os_profile (TI_HANDLE OsContext, UINT32 fn, UINT32 par);
340   #define os_profile(hos,fn,par) _os_profile (hos, fn, par)
341 #else
342   #define os_profile(hos,fn,par)
343 #endif
344 
345 
346 /****************************************************************************************
347 						START OF GWSI DRIVER API
348 *****************************************************************************************/
349 VOID
350 os_Complete(
351 	TI_HANDLE OsContext
352 	);
353 
354 #ifndef GWSI_LIB
355 
356 VOID
357 os_WaitComplete(
358 	TI_HANDLE OsContext
359 	);
360 
361 UINT32
362 os_memoryGetPhysicalLow (OS_PHYSICAL_ADDRESS pAddr);
363 UINT32
364 os_memoryGetPhysicalHigh (OS_PHYSICAL_ADDRESS pAddr);
365 
366 /* MEB use native NDIS functions */
367 #ifdef _WINDOWS
368 #else
369 
370   UINT32 os_memoryGetPhysicalLow(OS_PHYSICAL_ADDRESS pAddr);
371   UINT32 os_memoryGetPhysicalHigh(OS_PHYSICAL_ADDRESS pAddr);
372 
373 #endif
374 
375   VOID os_hardResetTnetw(void);
376 
377 #endif
378 
379 
380 /****************************************************************************************
381 						START OF TI DRIVER API
382 *****************************************************************************************/
383 #if !defined(GWSI_DRIVER) && !defined(GWSI_LIB)
384 
385 typedef struct {
386     UINT32      Event;
387     UINT8*      Data;
388 } TI_CONNECTION_STATUS, *PTI_CONNECTION_STATUS;
389 
390 
391 
392 PVOID
393 os_memoryAlloc4HwCopy(
394     TI_HANDLE pOsContext,
395     UINT32 Size
396     );
397 
398 VOID
399 os_memorySharedFree(
400     TI_HANDLE OsContext,
401     PVOID pVirtual,
402     UINT32 Size,
403     OS_PHYSICAL_ADDRESS pPhysical
404     );
405 
406 PVOID
407 os_memorySharedAlloc(
408     TI_HANDLE OsContext,
409     UINT32 Size,
410     OS_PHYSICAL_ADDRESS *pPhysical
411     );
412 
413 VOID
414 os_memoryMoveToHw(
415     TI_HANDLE OsContext,
416     PVOID pTarget,
417     PVOID pSource,
418     UINT32 Size
419     );
420 
421 VOID
422 os_memoryMoveFromHw(
423     TI_HANDLE OsContext,
424     PVOID pTarget,
425     PVOID pSource,
426     UINT32 Size
427     );
428 
429 
430 /**/
431 /* Register access functions*/
432 /**/
433 VOID
434 os_hwReadMemRegisterUINT32(
435     TI_HANDLE OsContext,
436     PUINT32 Register,
437     PUINT32 Data
438     );
439 
440 VOID
441 os_hwWriteMemRegisterUINT32(
442     TI_HANDLE OsContext,
443     PUINT32 Register,
444     UINT32 Data
445     );
446 
447 VOID
448 os_hwReadMemRegisterUINT16(
449     TI_HANDLE OsContext,
450     PUINT16 Register,
451     PUINT16 Data
452     );
453 
454 VOID
455 os_hwWriteMemRegisterUINT16(
456     TI_HANDLE OsContext,
457     PUINT16 Register,
458     UINT16 Data
459     );
460 
461 VOID
462 os_hwReadMemRegisterUINT8(
463     TI_HANDLE OsContext,
464     PUINT8 Register,
465     PUINT8 Data
466     );
467 
468 VOID
469 os_hwWriteMemRegisterUINT8(
470     TI_HANDLE OsContext,
471     PUINT8 Register,
472     UINT8 Data
473     );
474 
475 int
476 os_getFirmwareImage(
477     TI_HANDLE OsContext,
478     PUINT8 *pBuffer,
479     PUINT32 Length,
480     UINT8 RadioType
481     );
482 
483 int
484 os_getRadioImage(
485     TI_HANDLE OsContext,
486     PUINT8 *pBuffer,
487     PUINT32 Length,
488     UINT8 RadioType
489     );
490 
491 VOID
492 os_closeFirmwareImage( TI_HANDLE OsContext );
493 
494 VOID
495 os_closeRadioImage( TI_HANDLE OsContext );
496 
497 BOOL
498 os_receivePacket(
499     TI_HANDLE OsContext,
500     PVOID pPacket,
501     UINT16 Length
502     );
503 
504 INT32
505 os_sendPacket(
506         TI_HANDLE OsContext,
507         PVOID pPacket,
508         UINT16 Length
509         );
510 
511 tiINT32
512 os_IndicateEvent(
513     IPC_EV_DATA* pData
514     );
515 
516 VOID
517 os_powerStateBusy(
518     TI_HANDLE OsContext
519     );
520 
521 VOID
522 os_powerStateIdle(
523     TI_HANDLE OsContext
524     );
525 
526 VOID
527 os_setWakeOnGpio(
528     TI_HANDLE OsContext
529     );
530 
531 VOID
532 os_resetWakeOnGpio(
533     TI_HANDLE OsContext
534     );
535 
536 BOOL
537 os_getEeepromImage(
538     TI_HANDLE OsContext,
539     PUINT8* pBuffer,
540     PUINT32 length
541     );
542 
543 // TRS:JCG missing in 4.03
544 VOID
545 os_setPowerOfTnetw(
546     BOOL bPowerOn
547     );
548 
549 #endif
550 
551 #endif
552