blob: a78345da93ef29d6b8eefac7db805ebc345dc1dd [file] [log] [blame]
Jeff Johnson295189b2012-06-20 16:38:30 -07001/*
2 * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
3 *
4 * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
5 *
6 *
7 * Permission to use, copy, modify, and/or distribute this software for
8 * any purpose with or without fee is hereby granted, provided that the
9 * above copyright notice and this permission notice appear in all
10 * copies.
11 *
12 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
13 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
14 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
15 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
16 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
17 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
18 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
19 * PERFORMANCE OF THIS SOFTWARE.
20 */
21
22//==================================================================
23//
24// File: utilsApi.cc
25//
26// Description: Implemention of a few utility routines.
27//
28// Author: Neelay Das
29//
30// Copyright 2003, Woodside Networks, Inc. All rights reserved.
31//
32// Change gHistory:
33// 12/15/2003 - NDA - Initial version.
34//
35//===================================================================
36
37
38#include "utilsApi.h"
39
40#if defined (ANI_OS_TYPE_WINDOWS)
41
42/**---------------------------------------------------------------------
43 * sirBusyWaitIntern()
44 *
45 * FUNCTION:
46 * This function is called to put processor in a busy loop for
47 * a given amount of duration
48 *
49 * LOGIC:
50 *
51 * ASSUMPTIONS:
52 * None.
53 *
54 * NOTE:
55 * 1. Argument to this function should be in nano second units
56 * 2. OS specific calls used if available. Otherwise this need
57 * to be enhanced.
58 *
59 * @param duration Duration to be busy slept
60 * @return None
61 */
62
63void
64sirBusyWaitIntern(void *pMacGlobal, tANI_U32 duration)
65{
66 NdisStallExecution((duration+999)/1000); // This routine takes the duration in uSecs.
67} // sirBusyWaitIntern()
68
69#endif // (WNI_POLARIS_FW_OS == SIR_WINDOWS)
70
71
72
73#if !defined ANI_OS_TYPE_OSX
74
75// -------------------------------------------------------------------
76/**
77 * sirDumpBuf()
78 *
79 * FUNCTION:
80 * This function is called to dump a buffer with a certain level
81 *
82 * LOGIC:
83 *
84 * ASSUMPTIONS:
85 * None.
86 *
87 * NOTE:
88 *
89 * @param pBuf: buffer pointer
90 * @return None.
91 */
92void
93sirDumpBuf(tpAniSirGlobal pMac, tANI_U8 modId, tANI_U32 level, tANI_U8 *buf, tANI_U32 size)
94{
95 tANI_U32 i;
96
97 if (level > pMac->utils.gLogDbgLevel[LOG_INDEX_FOR_MODULE(modId)])
98 return;
99
100 logDbg(pMac, modId, level, FL("Dumping %d bytes in host order\n"), size);
101
102 for (i=0; (i+7)<size; i+=8)
103 {
104 logDbg(pMac, modId, level,
105 "%02x %02x %02x %02x %02x %02x %02x %02x \n",
106 buf[i],
107 buf[i+1],
108 buf[i+2],
109 buf[i+3],
110 buf[i+4],
111 buf[i+5],
112 buf[i+6],
113 buf[i+7]);
114 }
115
116 // Dump the bytes in the last line
117 for (; i < size; i++)
118 {
119 logDbg(pMac, modId, level, "%02x ", buf[i]);
120
121 if((i+1) == size)
122 logDbg(pMac, modId, level, "\n");
123 }
124
125}/*** end sirDumpBuf() ***/
126#else
127void
128sirDumpBuf(tpAniSirGlobal pMac, tANI_U8 modId, tANI_U32 level, tANI_U8 *buf, tANI_U32 size)
129{
130 (void)pMac; (void)modId; (void)level; (void)buf; (void)size;
131}
132#endif