blob: 524bbd217fd687a50a9388d08cb2e9c2e2349c42 [file] [log] [blame]
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001/*
2 * Copyright (c) 2013-2014 The Linux Foundation. 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 * This file was originally distributed by Qualcomm Atheros, Inc.
24 * under proprietary terms before Copyright ownership was assigned
25 * to the Linux Foundation.
26 */
27
28/* ================================================================== */
29/* */
30/* File: utils_api.cc */
31/* */
32/* Description: Implemention of a few utility routines. */
33/* */
34/* Author: Neelay Das */
35/* */
36/* // */
37/* Change gHistory: */
38/* 12/15/2003 - NDA - Initial version. */
39/* */
40/* =================================================================== */
41
42#include "utils_api.h"
43
44/* ------------------------------------------------------------------- */
45/**
46 * sir_dump_buf()
47 *
48 * FUNCTION:
49 * This function is called to dump a buffer with a certain level
50 *
51 * LOGIC:
52 *
53 * ASSUMPTIONS:
54 * None.
55 *
56 * NOTE:
57 *
58 * @param pBuf: buffer pointer
59 * @return None.
60 */
61void
62sir_dump_buf(tpAniSirGlobal pMac, uint8_t modId, uint32_t level, uint8_t *buf,
63 uint32_t size)
64{
65 uint32_t i;
66
67 if (level > pMac->utils.gLogDbgLevel[LOG_INDEX_FOR_MODULE(modId)])
68 return;
69
70 log_dbg(pMac, modId, level, FL("Dumping %d bytes in host order\n"),
71 size);
72
73 for (i = 0; (i + 7) < size; i += 8) {
74 log_dbg(pMac, modId, level,
75 "%02x %02x %02x %02x %02x %02x %02x %02x \n",
76 buf[i],
77 buf[i + 1],
78 buf[i + 2],
79 buf[i + 3],
80 buf[i + 4], buf[i + 5], buf[i + 6], buf[i + 7]);
81 }
82
83 /* Dump the bytes in the last line */
84 for (; i < size; i++) {
85 log_dbg(pMac, modId, level, "%02x ", buf[i]);
86
87 if ((i + 1) == size)
88 log_dbg(pMac, modId, level, "\n");
89 }
90
91} /*** end sir_dump_buf() ***/